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 {
...
@@ -224,7 +224,7 @@ typedef struct OutputStream {
AVFilterGraph
*
graph
;
AVFilterGraph
*
graph
;
#endif
#endif
int
sws_flags
;
int
64_t
sws_flags
;
AVDictionary
*
opts
;
AVDictionary
*
opts
;
int
is_past_recording_time
;
int
is_past_recording_time
;
}
OutputStream
;
}
OutputStream
;
...
@@ -421,7 +421,7 @@ static int configure_video_filters(InputStream *ist, OutputStream *ost)
...
@@ -421,7 +421,7 @@ static int configure_video_filters(InputStream *ist, OutputStream *ost)
snprintf
(
args
,
255
,
"%d:%d:flags=0x%X"
,
snprintf
(
args
,
255
,
"%d:%d:flags=0x%X"
,
codec
->
width
,
codec
->
width
,
codec
->
height
,
codec
->
height
,
ost
->
sws_flags
);
(
unsigned
)
ost
->
sws_flags
);
if
((
ret
=
avfilter_graph_create_filter
(
&
filter
,
avfilter_get_by_name
(
"scale"
),
if
((
ret
=
avfilter_graph_create_filter
(
&
filter
,
avfilter_get_by_name
(
"scale"
),
NULL
,
args
,
NULL
,
ost
->
graph
))
<
0
)
NULL
,
args
,
NULL
,
ost
->
graph
))
<
0
)
return
ret
;
return
ret
;
...
@@ -430,7 +430,7 @@ static int configure_video_filters(InputStream *ist, OutputStream *ost)
...
@@ -430,7 +430,7 @@ static int configure_video_filters(InputStream *ist, OutputStream *ost)
last_filter
=
filter
;
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
);
ost
->
graph
->
scale_sws_opts
=
av_strdup
(
args
);
if
(
ost
->
avfilter
)
{
if
(
ost
->
avfilter
)
{
...
@@ -3033,7 +3033,7 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e
...
@@ -3033,7 +3033,7 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e
if
(
oc
->
oformat
->
flags
&
AVFMT_GLOBALHEADER
)
if
(
oc
->
oformat
->
flags
&
AVFMT_GLOBALHEADER
)
st
->
codec
->
flags
|=
CODEC_FLAG_GLOBAL_HEADER
;
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
;
return
ost
;
}
}
...
...
avserver.c
View file @
3b3ea346
...
@@ -3938,7 +3938,7 @@ static int avserver_opt_default(const char *opt, const char *arg,
...
@@ -3938,7 +3938,7 @@ static int avserver_opt_default(const char *opt, const char *arg,
int
ret
=
0
;
int
ret
=
0
;
const
AVOption
*
o
=
av_opt_find
(
avctx
,
opt
,
NULL
,
type
,
0
);
const
AVOption
*
o
=
av_opt_find
(
avctx
,
opt
,
NULL
,
type
,
0
);
if
(
o
)
if
(
o
)
ret
=
av_
set_string3
(
avctx
,
opt
,
arg
,
1
,
NULL
);
ret
=
av_
opt_set
(
avctx
,
opt
,
arg
,
0
);
return
ret
;
return
ret
;
}
}
...
...
cmdutils.c
View file @
3b3ea346
...
@@ -361,7 +361,7 @@ int opt_default(const char *opt, const char *arg)
...
@@ -361,7 +361,7 @@ int opt_default(const char *opt, const char *arg)
av_dict_set
(
&
format_opts
,
opt
,
arg
,
FLAGS
);
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
)))
{
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
// 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
)
{
if
(
ret
<
0
)
{
av_log
(
NULL
,
AV_LOG_ERROR
,
"Error setting option %s.
\n
"
,
opt
);
av_log
(
NULL
,
AV_LOG_ERROR
,
"Error setting option %s.
\n
"
,
opt
);
return
ret
;
return
ret
;
...
...
libavformat/applehttp.c
View file @
3b3ea346
...
@@ -350,8 +350,8 @@ static int open_input(struct variant *var)
...
@@ -350,8 +350,8 @@ static int open_input(struct variant *var)
snprintf
(
url
,
sizeof
(
url
),
"crypto:%s"
,
seg
->
url
);
snprintf
(
url
,
sizeof
(
url
),
"crypto:%s"
,
seg
->
url
);
if
((
ret
=
ffurl_alloc
(
&
var
->
input
,
url
,
AVIO_FLAG_READ
))
<
0
)
if
((
ret
=
ffurl_alloc
(
&
var
->
input
,
url
,
AVIO_FLAG_READ
))
<
0
)
return
ret
;
return
ret
;
av_
set_string3
(
var
->
input
->
priv_data
,
"key"
,
key
,
0
,
NULL
);
av_
opt_set
(
var
->
input
->
priv_data
,
"key"
,
key
,
0
);
av_
set_string3
(
var
->
input
->
priv_data
,
"iv"
,
iv
,
0
,
NULL
);
av_
opt_set
(
var
->
input
->
priv_data
,
"iv"
,
iv
,
0
);
if
((
ret
=
ffurl_connect
(
var
->
input
))
<
0
)
{
if
((
ret
=
ffurl_connect
(
var
->
input
))
<
0
)
{
ffurl_close
(
var
->
input
);
ffurl_close
(
var
->
input
);
var
->
input
=
NULL
;
var
->
input
=
NULL
;
...
...
libavformat/rtp.c
View file @
3b3ea346
...
@@ -97,9 +97,9 @@ int ff_rtp_get_payload_type(AVFormatContext *fmt, AVCodecContext *codec)
...
@@ -97,9 +97,9 @@ int ff_rtp_get_payload_type(AVFormatContext *fmt, AVCodecContext *codec)
/* Was the payload type already specified for the RTP muxer? */
/* Was the payload type already specified for the RTP muxer? */
if
(
ofmt
&&
ofmt
->
priv_class
)
{
if
(
ofmt
&&
ofmt
->
priv_class
)
{
int
payload_type
=
av_get_int
(
fmt
->
priv_data
,
"payload_type"
,
NULL
)
;
int
64_t
payload_type
;
if
(
payload_type
>=
0
)
if
(
av_opt_get_int
(
fmt
->
priv_data
,
"payload_type"
,
0
,
&
payload_type
)
>=
0
)
return
payload_type
;
return
(
int
)
payload_type
;
}
}
/* static 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,
...
@@ -31,6 +31,8 @@ AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st,
AVFormatContext
*
rtpctx
;
AVFormatContext
*
rtpctx
;
int
ret
;
int
ret
;
AVOutputFormat
*
rtp_format
=
av_guess_format
(
"rtp"
,
NULL
,
NULL
);
AVOutputFormat
*
rtp_format
=
av_guess_format
(
"rtp"
,
NULL
,
NULL
);
uint8_t
*
rtpflags
;
AVDictionary
*
opts
=
NULL
;
if
(
!
rtp_format
)
if
(
!
rtp_format
)
return
NULL
;
return
NULL
;
...
@@ -50,12 +52,8 @@ AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st,
...
@@ -50,12 +52,8 @@ AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st,
/* Copy other stream parameters. */
/* Copy other stream parameters. */
rtpctx
->
streams
[
0
]
->
sample_aspect_ratio
=
st
->
sample_aspect_ratio
;
rtpctx
->
streams
[
0
]
->
sample_aspect_ratio
=
st
->
sample_aspect_ratio
;
av_set_parameters
(
rtpctx
,
NULL
);
if
(
av_opt_get
(
s
,
"rtpflags"
,
AV_OPT_SEARCH_CHILDREN
,
&
rtpflags
)
>=
0
)
/* Copy the rtpflags values straight through */
av_dict_set
(
&
opts
,
"rtpflags"
,
rtpflags
,
AV_DICT_DONT_STRDUP_VAL
);
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
));
/* Set the synchronized start time. */
/* Set the synchronized start time. */
rtpctx
->
start_time_realtime
=
s
->
start_time_realtime
;
rtpctx
->
start_time_realtime
=
s
->
start_time_realtime
;
...
@@ -66,7 +64,8 @@ AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st,
...
@@ -66,7 +64,8 @@ AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st,
ffio_fdopen
(
&
rtpctx
->
pb
,
handle
);
ffio_fdopen
(
&
rtpctx
->
pb
,
handle
);
}
else
}
else
ffio_open_dyn_packet_buf
(
&
rtpctx
->
pb
,
packet_size
);
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
(
ret
)
{
if
(
handle
)
{
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_
...
@@ -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
)
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
*
field
=
av_opt_find
(
obj
,
field_name
,
NULL
,
0
,
0
);
const
AVOption
*
flag
=
av_find_opt
(
obj
,
flag_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
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
,
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,
...
@@ -513,7 +515,7 @@ static void opt_list(void *obj, void *av_log_obj, const char *unit,
{
{
const
AVOption
*
opt
=
NULL
;
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
))
if
(
!
(
opt
->
flags
&
req_flags
)
||
(
opt
->
flags
&
rej_flags
))
continue
;
continue
;
...
@@ -599,7 +601,7 @@ void av_opt_set_defaults2(void *s, int mask, int flags)
...
@@ -599,7 +601,7 @@ void av_opt_set_defaults2(void *s, int mask, int flags)
{
{
#endif
#endif
const
AVOption
*
opt
=
NULL
;
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 FF_API_OLD_AVOPTIONS
if
((
opt
->
flags
&
mask
)
!=
flags
)
if
((
opt
->
flags
&
mask
)
!=
flags
)
continue
;
continue
;
...
@@ -612,29 +614,29 @@ void av_opt_set_defaults2(void *s, int mask, int flags)
...
@@ -612,29 +614,29 @@ void av_opt_set_defaults2(void *s, int mask, int flags)
case
FF_OPT_TYPE_INT
:
{
case
FF_OPT_TYPE_INT
:
{
int
val
;
int
val
;
val
=
opt
->
default_val
.
dbl
;
val
=
opt
->
default_val
.
dbl
;
av_
set_int
(
s
,
opt
->
name
,
val
);
av_
opt_set_int
(
s
,
opt
->
name
,
val
,
0
);
}
}
break
;
break
;
case
FF_OPT_TYPE_INT64
:
case
FF_OPT_TYPE_INT64
:
if
((
double
)(
opt
->
default_val
.
dbl
+
0
.
6
)
==
opt
->
default_val
.
dbl
)
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_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
;
break
;
case
FF_OPT_TYPE_DOUBLE
:
case
FF_OPT_TYPE_DOUBLE
:
case
FF_OPT_TYPE_FLOAT
:
{
case
FF_OPT_TYPE_FLOAT
:
{
double
val
;
double
val
;
val
=
opt
->
default_val
.
dbl
;
val
=
opt
->
default_val
.
dbl
;
av_
set_double
(
s
,
opt
->
name
,
val
);
av_
opt_set_double
(
s
,
opt
->
name
,
val
,
0
);
}
}
break
;
break
;
case
FF_OPT_TYPE_RATIONAL
:
{
case
FF_OPT_TYPE_RATIONAL
:
{
AVRational
val
;
AVRational
val
;
val
=
av_d2q
(
opt
->
default_val
.
dbl
,
INT_MAX
);
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
;
break
;
case
FF_OPT_TYPE_STRING
:
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
;
break
;
case
FF_OPT_TYPE_BINARY
:
case
FF_OPT_TYPE_BINARY
:
/* Cannot set default for binary */
/* Cannot set default for binary */
...
@@ -659,7 +661,7 @@ void av_opt_set_defaults2(void *s, int mask, int flags)
...
@@ -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
* set, or a negative value corresponding to an AVERROR code in case
* of error:
* of error:
* AVERROR(EINVAL) if the key/value pair cannot be parsed,
* 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
* cannot be set
*/
*/
static
int
parse_key_value_pair
(
void
*
ctx
,
const
char
**
buf
,
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,
...
@@ -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
);
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
)
if
(
ret
==
AVERROR_OPTION_NOT_FOUND
)
av_log
(
ctx
,
AV_LOG_ERROR
,
"Key '%s' not found.
\n
"
,
key
);
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,
...
@@ -709,7 +711,7 @@ int av_set_options_string(void *ctx, const char *opts,
void
av_opt_free
(
void
*
obj
)
void
av_opt_free
(
void
*
obj
)
{
{
const
AVOption
*
o
=
NULL
;
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
)
if
(
o
->
type
==
FF_OPT_TYPE_STRING
||
o
->
type
==
FF_OPT_TYPE_BINARY
)
av_freep
((
uint8_t
*
)
obj
+
o
->
offset
);
av_freep
((
uint8_t
*
)
obj
+
o
->
offset
);
}
}
...
@@ -721,7 +723,7 @@ int av_opt_set_dict(void *obj, AVDictionary **options)
...
@@ -721,7 +723,7 @@ int av_opt_set_dict(void *obj, AVDictionary **options)
int
ret
=
0
;
int
ret
=
0
;
while
((
t
=
av_dict_get
(
*
options
,
""
,
t
,
AV_DICT_IGNORE_SUFFIX
)))
{
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
)
if
(
ret
==
AVERROR_OPTION_NOT_FOUND
)
av_dict_set
(
&
tmp
,
t
->
key
,
t
->
value
,
0
);
av_dict_set
(
&
tmp
,
t
->
key
,
t
->
value
,
0
);
else
if
(
ret
<
0
)
{
else
if
(
ret
<
0
)
{
...
@@ -761,7 +763,7 @@ const AVOption *av_opt_find2(void *obj, const char *name, const char *unit,
...
@@ -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
&&
if
(
!
strcmp
(
o
->
name
,
name
)
&&
(
o
->
flags
&
opt_flags
)
==
opt_flags
&&
((
!
unit
&&
o
->
type
!=
FF_OPT_TYPE_CONST
)
||
((
!
unit
&&
o
->
type
!=
FF_OPT_TYPE_CONST
)
||
(
unit
&&
o
->
unit
&&
!
strcmp
(
o
->
unit
,
unit
))))
{
(
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