Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
BC
public
external
ffmpeg
Commits
5c7db097
Commit
5c7db097
authored
Dec 18, 2012
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avconv: pass libavresample options to AVFilterGraph
parent
9f122356
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
33 additions
and
4 deletions
+33
-4
avconv.c
avconv.c
+1
-0
avconv.h
avconv.h
+1
-0
avconv_filter.c
avconv_filter.c
+17
-1
avconv_opt.c
avconv_opt.c
+2
-0
cmdutils.c
cmdutils.c
+10
-2
cmdutils.h
cmdutils.h
+2
-1
No files found.
avconv.c
View file @
5c7db097
...
...
@@ -2303,6 +2303,7 @@ static int transcode(void)
av_freep
(
&
ost
->
st
->
codec
->
subtitle_header
);
av_free
(
ost
->
forced_kf_pts
);
av_dict_free
(
&
ost
->
opts
);
av_dict_free
(
&
ost
->
resample_opts
);
}
}
}
...
...
avconv.h
View file @
5c7db097
...
...
@@ -293,6 +293,7 @@ typedef struct OutputStream {
int64_t
sws_flags
;
AVDictionary
*
opts
;
AVDictionary
*
resample_opts
;
int
finished
;
/* no more packets should be written for this stream */
int
stream_copy
;
const
char
*
attachment_filename
;
...
...
avconv_filter.c
View file @
5c7db097
...
...
@@ -23,8 +23,12 @@
#include "libavfilter/avfilter.h"
#include "libavfilter/avfiltergraph.h"
#include "libavresample/avresample.h"
#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
#include "libavutil/channel_layout.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "libavutil/pixfmt.h"
#include "libavutil/samplefmt.h"
...
...
@@ -501,9 +505,21 @@ int configure_filtergraph(FilterGraph *fg)
if
(
simple
)
{
OutputStream
*
ost
=
fg
->
outputs
[
0
]
->
ost
;
char
args
[
255
];
char
args
[
512
];
AVDictionaryEntry
*
e
=
NULL
;
const
AVClass
*
rc
=
avresample_get_class
();
snprintf
(
args
,
sizeof
(
args
),
"flags=0x%X"
,
(
unsigned
)
ost
->
sws_flags
);
fg
->
graph
->
scale_sws_opts
=
av_strdup
(
args
);
args
[
0
]
=
'\0'
;
while
((
e
=
av_dict_get
(
fg
->
outputs
[
0
]
->
ost
->
resample_opts
,
""
,
e
,
AV_DICT_IGNORE_SUFFIX
)))
{
av_strlcatf
(
args
,
sizeof
(
args
),
"%s=%s:"
,
e
->
key
,
e
->
value
);
}
if
(
strlen
(
args
))
args
[
strlen
(
args
)
-
1
]
=
'\0'
;
fg
->
graph
->
resample_lavr_opts
=
av_strdup
(
args
);
}
if
((
ret
=
avfilter_graph_parse2
(
fg
->
graph
,
graph_desc
,
&
inputs
,
&
outputs
))
<
0
)
...
...
avconv_opt.c
View file @
5c7db097
...
...
@@ -844,6 +844,8 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e
av_opt_get_int
(
o
->
g
->
sws_opts
,
"sws_flags"
,
0
,
&
ost
->
sws_flags
);
av_dict_copy
(
&
ost
->
resample_opts
,
o
->
g
->
resample_opts
,
0
);
ost
->
pix_fmts
[
0
]
=
ost
->
pix_fmts
[
1
]
=
AV_PIX_FMT_NONE
;
return
ost
;
...
...
cmdutils.c
View file @
5c7db097
...
...
@@ -54,7 +54,7 @@
#endif
struct
SwsContext
*
sws_opts
;
AVDictionary
*
format_opts
,
*
codec_opts
;
AVDictionary
*
format_opts
,
*
codec_opts
,
*
resample_opts
;
static
const
int
this_year
=
2013
;
...
...
@@ -74,6 +74,7 @@ void uninit_opts(void)
#endif
av_dict_free
(
&
format_opts
);
av_dict_free
(
&
codec_opts
);
av_dict_free
(
&
resample_opts
);
}
void
log_callback_help
(
void
*
ptr
,
int
level
,
const
char
*
fmt
,
va_list
vl
)
...
...
@@ -405,6 +406,7 @@ int opt_default(void *optctx, const char *opt, const char *arg)
char
opt_stripped
[
128
];
const
char
*
p
;
const
AVClass
*
cc
=
avcodec_get_class
(),
*
fc
=
avformat_get_class
();
const
AVClass
*
rc
=
avresample_get_class
();
#if CONFIG_SWSCALE
const
AVClass
*
sc
=
sws_get_class
();
#endif
...
...
@@ -421,6 +423,9 @@ int opt_default(void *optctx, const char *opt, const char *arg)
else
if
((
o
=
av_opt_find
(
&
fc
,
opt
,
NULL
,
0
,
AV_OPT_SEARCH_CHILDREN
|
AV_OPT_SEARCH_FAKE_OBJ
)))
av_dict_set
(
&
format_opts
,
opt
,
arg
,
FLAGS
);
else
if
((
o
=
av_opt_find
(
&
rc
,
opt
,
NULL
,
0
,
AV_OPT_SEARCH_CHILDREN
|
AV_OPT_SEARCH_FAKE_OBJ
)))
av_dict_set
(
&
resample_opts
,
opt
,
arg
,
FLAGS
);
#if CONFIG_SWSCALE
else
if
((
o
=
av_opt_find
(
&
sc
,
opt
,
NULL
,
0
,
AV_OPT_SEARCH_CHILDREN
|
AV_OPT_SEARCH_FAKE_OBJ
)))
{
...
...
@@ -480,9 +485,11 @@ static void finish_group(OptionParseContext *octx, int group_idx,
#endif
g
->
codec_opts
=
codec_opts
;
g
->
format_opts
=
format_opts
;
g
->
resample_opts
=
resample_opts
;
codec_opts
=
NULL
;
format_opts
=
NULL
;
resample_opts
=
NULL
;
#if CONFIG_SWSCALE
sws_opts
=
NULL
;
#endif
...
...
@@ -539,6 +546,7 @@ void uninit_parse_context(OptionParseContext *octx)
av_freep
(
&
l
->
groups
[
j
].
opts
);
av_dict_free
(
&
l
->
groups
[
j
].
codec_opts
);
av_dict_free
(
&
l
->
groups
[
j
].
format_opts
);
av_dict_free
(
&
l
->
groups
[
j
].
resample_opts
);
#if CONFIG_SWSCALE
sws_freeContext
(
l
->
groups
[
j
].
sws_opts
);
#endif
...
...
@@ -645,7 +653,7 @@ do { \
return
AVERROR_OPTION_NOT_FOUND
;
}
if
(
octx
->
cur_group
.
nb_opts
||
codec_opts
||
format_opts
)
if
(
octx
->
cur_group
.
nb_opts
||
codec_opts
||
format_opts
||
resample_opts
)
av_log
(
NULL
,
AV_LOG_WARNING
,
"Trailing options were found on the "
"commandline.
\n
"
);
...
...
cmdutils.h
View file @
5c7db097
...
...
@@ -42,7 +42,7 @@ extern const int program_birth_year;
extern
AVCodecContext
*
avcodec_opts
[
AVMEDIA_TYPE_NB
];
extern
AVFormatContext
*
avformat_opts
;
extern
struct
SwsContext
*
sws_opts
;
extern
AVDictionary
*
format_opts
,
*
codec_opts
;
extern
AVDictionary
*
format_opts
,
*
codec_opts
,
*
resample_opts
;
/**
* Initialize the cmdutils option system, in particular
...
...
@@ -235,6 +235,7 @@ typedef struct OptionGroup {
AVDictionary
*
codec_opts
;
AVDictionary
*
format_opts
;
AVDictionary
*
resample_opts
;
struct
SwsContext
*
sws_opts
;
}
OptionGroup
;
...
...
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