Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
3b3ea346
Commit
3b3ea346
authored
Oct 03, 2011
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove all uses of deprecated AVOptions API.
parent
8c5dcaad
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
35 additions
and
34 deletions
+35
-34
avconv.c
avconv.c
+4
-4
avserver.c
avserver.c
+1
-1
cmdutils.c
cmdutils.c
+1
-1
applehttp.c
libavformat/applehttp.c
+2
-2
rtp.c
libavformat/rtp.c
+3
-3
rtpenc_chain.c
libavformat/rtpenc_chain.c
+6
-7
opt.c
libavutil/opt.c
+18
-16
No files found.
avconv.c
View file @
3b3ea346
...
...
@@ -224,7 +224,7 @@ typedef struct OutputStream {
AVFilterGraph
*
graph
;
#endif
int
sws_flags
;
int
64_t
sws_flags
;
AVDictionary
*
opts
;
int
is_past_recording_time
;
}
OutputStream
;
...
...
@@ -421,7 +421,7 @@ static int configure_video_filters(InputStream *ist, OutputStream *ost)
snprintf
(
args
,
255
,
"%d:%d:flags=0x%X"
,
codec
->
width
,
codec
->
height
,
ost
->
sws_flags
);
(
unsigned
)
ost
->
sws_flags
);
if
((
ret
=
avfilter_graph_create_filter
(
&
filter
,
avfilter_get_by_name
(
"scale"
),
NULL
,
args
,
NULL
,
ost
->
graph
))
<
0
)
return
ret
;
...
...
@@ -430,7 +430,7 @@ static int configure_video_filters(InputStream *ist, OutputStream *ost)
last_filter
=
filter
;
}
snprintf
(
args
,
sizeof
(
args
),
"flags=0x%X"
,
ost
->
sws_flags
);
snprintf
(
args
,
sizeof
(
args
),
"flags=0x%X"
,
(
unsigned
)
ost
->
sws_flags
);
ost
->
graph
->
scale_sws_opts
=
av_strdup
(
args
);
if
(
ost
->
avfilter
)
{
...
...
@@ -3033,7 +3033,7 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e
if
(
oc
->
oformat
->
flags
&
AVFMT_GLOBALHEADER
)
st
->
codec
->
flags
|=
CODEC_FLAG_GLOBAL_HEADER
;
ost
->
sws_flags
=
av_get_int
(
sws_opts
,
"sws_flags"
,
NULL
);
av_opt_get_int
(
sws_opts
,
"sws_flags"
,
0
,
&
ost
->
sws_flags
);
return
ost
;
}
...
...
avserver.c
View file @
3b3ea346
...
...
@@ -3938,7 +3938,7 @@ static int avserver_opt_default(const char *opt, const char *arg,
int
ret
=
0
;
const
AVOption
*
o
=
av_opt_find
(
avctx
,
opt
,
NULL
,
type
,
0
);
if
(
o
)
ret
=
av_
set_string3
(
avctx
,
opt
,
arg
,
1
,
NULL
);
ret
=
av_
opt_set
(
avctx
,
opt
,
arg
,
0
);
return
ret
;
}
...
...
cmdutils.c
View file @
3b3ea346
...
...
@@ -361,7 +361,7 @@ int opt_default(const char *opt, const char *arg)
av_dict_set
(
&
format_opts
,
opt
,
arg
,
FLAGS
);
else
if
((
o
=
av_opt_find
(
&
sc
,
opt
,
NULL
,
0
,
AV_OPT_SEARCH_CHILDREN
|
AV_OPT_SEARCH_FAKE_OBJ
)))
{
// XXX we only support sws_flags, not arbitrary sws options
int
ret
=
av_
set_string3
(
sws_opts
,
opt
,
arg
,
1
,
NULL
);
int
ret
=
av_
opt_set
(
sws_opts
,
opt
,
arg
,
0
);
if
(
ret
<
0
)
{
av_log
(
NULL
,
AV_LOG_ERROR
,
"Error setting option %s.
\n
"
,
opt
);
return
ret
;
...
...
libavformat/applehttp.c
View file @
3b3ea346
...
...
@@ -350,8 +350,8 @@ static int open_input(struct variant *var)
snprintf
(
url
,
sizeof
(
url
),
"crypto:%s"
,
seg
->
url
);
if
((
ret
=
ffurl_alloc
(
&
var
->
input
,
url
,
AVIO_FLAG_READ
))
<
0
)
return
ret
;
av_
set_string3
(
var
->
input
->
priv_data
,
"key"
,
key
,
0
,
NULL
);
av_
set_string3
(
var
->
input
->
priv_data
,
"iv"
,
iv
,
0
,
NULL
);
av_
opt_set
(
var
->
input
->
priv_data
,
"key"
,
key
,
0
);
av_
opt_set
(
var
->
input
->
priv_data
,
"iv"
,
iv
,
0
);
if
((
ret
=
ffurl_connect
(
var
->
input
))
<
0
)
{
ffurl_close
(
var
->
input
);
var
->
input
=
NULL
;
...
...
libavformat/rtp.c
View file @
3b3ea346
...
...
@@ -97,9 +97,9 @@ int ff_rtp_get_payload_type(AVFormatContext *fmt, AVCodecContext *codec)
/* Was the payload type already specified for the RTP muxer? */
if
(
ofmt
&&
ofmt
->
priv_class
)
{
int
payload_type
=
av_get_int
(
fmt
->
priv_data
,
"payload_type"
,
NULL
)
;
if
(
payload_type
>=
0
)
return
payload_type
;
int
64_t
payload_type
;
if
(
av_opt_get_int
(
fmt
->
priv_data
,
"payload_type"
,
0
,
&
payload_type
)
>=
0
)
return
(
int
)
payload_type
;
}
/* static payload type */
...
...
libavformat/rtpenc_chain.c
View file @
3b3ea346
...
...
@@ -31,6 +31,8 @@ AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st,
AVFormatContext
*
rtpctx
;
int
ret
;
AVOutputFormat
*
rtp_format
=
av_guess_format
(
"rtp"
,
NULL
,
NULL
);
uint8_t
*
rtpflags
;
AVDictionary
*
opts
=
NULL
;
if
(
!
rtp_format
)
return
NULL
;
...
...
@@ -50,12 +52,8 @@ AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st,
/* Copy other stream parameters. */
rtpctx
->
streams
[
0
]
->
sample_aspect_ratio
=
st
->
sample_aspect_ratio
;
av_set_parameters
(
rtpctx
,
NULL
);
/* Copy the rtpflags values straight through */
if
(
s
->
oformat
->
priv_class
&&
av_find_opt
(
s
->
priv_data
,
"rtpflags"
,
NULL
,
0
,
0
))
av_set_int
(
rtpctx
->
priv_data
,
"rtpflags"
,
av_get_int
(
s
->
priv_data
,
"rtpflags"
,
NULL
));
if
(
av_opt_get
(
s
,
"rtpflags"
,
AV_OPT_SEARCH_CHILDREN
,
&
rtpflags
)
>=
0
)
av_dict_set
(
&
opts
,
"rtpflags"
,
rtpflags
,
AV_DICT_DONT_STRDUP_VAL
);
/* Set the synchronized start time. */
rtpctx
->
start_time_realtime
=
s
->
start_time_realtime
;
...
...
@@ -66,7 +64,8 @@ AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st,
ffio_fdopen
(
&
rtpctx
->
pb
,
handle
);
}
else
ffio_open_dyn_packet_buf
(
&
rtpctx
->
pb
,
packet_size
);
ret
=
avformat_write_header
(
rtpctx
,
NULL
);
ret
=
avformat_write_header
(
rtpctx
,
&
opts
);
av_dict_free
(
&
opts
);
if
(
ret
)
{
if
(
handle
)
{
...
...
libavutil/opt.c
View file @
3b3ea346
...
...
@@ -500,12 +500,14 @@ int av_opt_get_q(void *obj, const char *name, int search_flags, AVRational *out_
int
av_opt_flag_is_set
(
void
*
obj
,
const
char
*
field_name
,
const
char
*
flag_name
)
{
const
AVOption
*
field
=
av_find_opt
(
obj
,
field_name
,
NULL
,
0
,
0
);
const
AVOption
*
flag
=
av_find_opt
(
obj
,
flag_name
,
NULL
,
0
,
0
);
const
AVOption
*
field
=
av_opt_find
(
obj
,
field_name
,
NULL
,
0
,
0
);
const
AVOption
*
flag
=
av_opt_find
(
obj
,
flag_name
,
NULL
,
0
,
0
);
int64_t
res
;
if
(
!
field
||
!
flag
||
flag
->
type
!=
FF_OPT_TYPE_CONST
)
if
(
!
field
||
!
flag
||
flag
->
type
!=
FF_OPT_TYPE_CONST
||
av_opt_get_int
(
obj
,
field_name
,
0
,
&
res
)
<
0
)
return
0
;
return
av_get_int
(
obj
,
field_name
,
NULL
)
&
(
int
)
flag
->
default_val
.
dbl
;
return
res
&
(
int
)
flag
->
default_val
.
dbl
;
}
static
void
opt_list
(
void
*
obj
,
void
*
av_log_obj
,
const
char
*
unit
,
...
...
@@ -513,7 +515,7 @@ static void opt_list(void *obj, void *av_log_obj, const char *unit,
{
const
AVOption
*
opt
=
NULL
;
while
((
opt
=
av_next_option
(
obj
,
opt
)))
{
while
((
opt
=
av_opt_next
(
obj
,
opt
)))
{
if
(
!
(
opt
->
flags
&
req_flags
)
||
(
opt
->
flags
&
rej_flags
))
continue
;
...
...
@@ -599,7 +601,7 @@ void av_opt_set_defaults2(void *s, int mask, int flags)
{
#endif
const
AVOption
*
opt
=
NULL
;
while
((
opt
=
av_
next_option
(
s
,
opt
))
!=
NULL
)
{
while
((
opt
=
av_
opt_next
(
s
,
opt
))
!=
NULL
)
{
#if FF_API_OLD_AVOPTIONS
if
((
opt
->
flags
&
mask
)
!=
flags
)
continue
;
...
...
@@ -612,29 +614,29 @@ void av_opt_set_defaults2(void *s, int mask, int flags)
case
FF_OPT_TYPE_INT
:
{
int
val
;
val
=
opt
->
default_val
.
dbl
;
av_
set_int
(
s
,
opt
->
name
,
val
);
av_
opt_set_int
(
s
,
opt
->
name
,
val
,
0
);
}
break
;
case
FF_OPT_TYPE_INT64
:
if
((
double
)(
opt
->
default_val
.
dbl
+
0
.
6
)
==
opt
->
default_val
.
dbl
)
av_log
(
s
,
AV_LOG_DEBUG
,
"loss of precision in default of %s
\n
"
,
opt
->
name
);
av_
set_int
(
s
,
opt
->
name
,
opt
->
default_val
.
dbl
);
av_
opt_set_int
(
s
,
opt
->
name
,
opt
->
default_val
.
dbl
,
0
);
break
;
case
FF_OPT_TYPE_DOUBLE
:
case
FF_OPT_TYPE_FLOAT
:
{
double
val
;
val
=
opt
->
default_val
.
dbl
;
av_
set_double
(
s
,
opt
->
name
,
val
);
av_
opt_set_double
(
s
,
opt
->
name
,
val
,
0
);
}
break
;
case
FF_OPT_TYPE_RATIONAL
:
{
AVRational
val
;
val
=
av_d2q
(
opt
->
default_val
.
dbl
,
INT_MAX
);
av_
set_q
(
s
,
opt
->
name
,
val
);
av_
opt_set_q
(
s
,
opt
->
name
,
val
,
0
);
}
break
;
case
FF_OPT_TYPE_STRING
:
av_
set_string3
(
s
,
opt
->
name
,
opt
->
default_val
.
str
,
1
,
NULL
);
av_
opt_set
(
s
,
opt
->
name
,
opt
->
default_val
.
str
,
0
);
break
;
case
FF_OPT_TYPE_BINARY
:
/* Cannot set default for binary */
...
...
@@ -659,7 +661,7 @@ void av_opt_set_defaults2(void *s, int mask, int flags)
* set, or a negative value corresponding to an AVERROR code in case
* of error:
* AVERROR(EINVAL) if the key/value pair cannot be parsed,
* the error code issued by av_
set_string3
() if the key/value pair
* the error code issued by av_
opt_set
() if the key/value pair
* cannot be set
*/
static
int
parse_key_value_pair
(
void
*
ctx
,
const
char
**
buf
,
...
...
@@ -680,7 +682,7 @@ static int parse_key_value_pair(void *ctx, const char **buf,
av_log
(
ctx
,
AV_LOG_DEBUG
,
"Setting value '%s' for key '%s'
\n
"
,
val
,
key
);
ret
=
av_
set_string3
(
ctx
,
key
,
val
,
1
,
NULL
);
ret
=
av_
opt_set
(
ctx
,
key
,
val
,
0
);
if
(
ret
==
AVERROR_OPTION_NOT_FOUND
)
av_log
(
ctx
,
AV_LOG_ERROR
,
"Key '%s' not found.
\n
"
,
key
);
...
...
@@ -709,7 +711,7 @@ int av_set_options_string(void *ctx, const char *opts,
void
av_opt_free
(
void
*
obj
)
{
const
AVOption
*
o
=
NULL
;
while
((
o
=
av_
next_option
(
obj
,
o
)))
while
((
o
=
av_
opt_next
(
obj
,
o
)))
if
(
o
->
type
==
FF_OPT_TYPE_STRING
||
o
->
type
==
FF_OPT_TYPE_BINARY
)
av_freep
((
uint8_t
*
)
obj
+
o
->
offset
);
}
...
...
@@ -721,7 +723,7 @@ int av_opt_set_dict(void *obj, AVDictionary **options)
int
ret
=
0
;
while
((
t
=
av_dict_get
(
*
options
,
""
,
t
,
AV_DICT_IGNORE_SUFFIX
)))
{
ret
=
av_
set_string3
(
obj
,
t
->
key
,
t
->
value
,
1
,
NULL
);
ret
=
av_
opt_set
(
obj
,
t
->
key
,
t
->
value
,
0
);
if
(
ret
==
AVERROR_OPTION_NOT_FOUND
)
av_dict_set
(
&
tmp
,
t
->
key
,
t
->
value
,
0
);
else
if
(
ret
<
0
)
{
...
...
@@ -761,7 +763,7 @@ const AVOption *av_opt_find2(void *obj, const char *name, const char *unit,
}
}
while
(
o
=
av_
next_option
(
obj
,
o
))
{
while
(
o
=
av_
opt_next
(
obj
,
o
))
{
if
(
!
strcmp
(
o
->
name
,
name
)
&&
(
o
->
flags
&
opt_flags
)
==
opt_flags
&&
((
!
unit
&&
o
->
type
!=
FF_OPT_TYPE_CONST
)
||
(
unit
&&
o
->
unit
&&
!
strcmp
(
o
->
unit
,
unit
))))
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment