summaryrefslogtreecommitdiff
authorMichael Niedermayer <michaelni@gmx.at>2013-03-12 20:26:13 (GMT)
committer Michael Niedermayer <michaelni@gmx.at>2013-03-12 20:34:24 (GMT)
commitd64b8540751bf8debab4ebcfad6ff87c61d3c19d (patch)
treea275f8c86ca44c3fa3743b91702b3f8c8f9fbcff
parent212b89f8b426d78e1be8be45daaa6604fd0f35c4 (diff)
parent666fe5da47d127074be7f0e2bac93db6af8b4a30 (diff)
downloadffmpeg-d64b8540751bf8debab4ebcfad6ff87c61d3c19d.zip
ffmpeg-d64b8540751bf8debab4ebcfad6ff87c61d3c19d.tar.gz
ffmpeg-d64b8540751bf8debab4ebcfad6ff87c61d3c19d.tar.bz2
Merge commit '666fe5da47d127074be7f0e2bac93db6af8b4a30'
* commit '666fe5da47d127074be7f0e2bac93db6af8b4a30': atomic: Exclude the unsupported implementation headers from checkheaders avconv: do not silently ignore unused codec AVOptions. Conflicts: ffmpeg_opt.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat
-rw-r--r--Changelog2
-rw-r--r--ffmpeg_opt.c89
-rw-r--r--libavutil/Makefile4
-rwxr-xr-xtests/lavf-regression.sh2
4 files changed, 96 insertions, 1 deletions
diff --git a/Changelog b/Changelog
index 834821e..464931b 100644
--- a/Changelog
+++ b/Changelog
@@ -4,6 +4,8 @@ releases are sorted from youngest to oldest.
version <next>:
- curves filter
- reference-counting for AVFrame and AVPacket data
+- avconv now fails when input options are used for output file
+ or vice versa
version 1.2:
diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
index 196ab3c..6b3ef3b 100644
--- a/ffmpeg_opt.c
+++ b/ffmpeg_opt.c
@@ -151,6 +151,24 @@ static void init_options(OptionsContext *o, int is_input)
o->chapters_input_file = INT_MAX;
}
+/* return a copy of the input with the stream specifiers removed from the keys */
+static AVDictionary *strip_specifiers(AVDictionary *dict)
+{
+ AVDictionaryEntry *e = NULL;
+ AVDictionary *ret = NULL;
+
+ while ((e = av_dict_get(dict, "", e, AV_DICT_IGNORE_SUFFIX))) {
+ char *p = strchr(e->key, ':');
+
+ if (p)
+ *p = 0;
+ av_dict_set(&ret, e->key, e->value, 0);
+ if (p)
+ *p = ':';
+ }
+ return ret;
+}
+
static int opt_sameq(void *optctx, const char *opt, const char *arg)
{
av_log(NULL, AV_LOG_ERROR, "Option '%s' was removed. "
@@ -705,6 +723,8 @@ static int open_input_file(OptionsContext *o, const char *filename)
int64_t timestamp;
uint8_t buf[128];
AVDictionary **opts;
+ AVDictionary *unused_opts = NULL;
+ AVDictionaryEntry *e = NULL;
int orig_nb_streams; // number of streams before avformat_find_stream_info
char * video_codec_name = NULL;
char * audio_codec_name = NULL;
@@ -831,6 +851,39 @@ static int open_input_file(OptionsContext *o, const char *filename)
f->nb_streams = ic->nb_streams;
f->rate_emu = o->rate_emu;
+ /* check if all codec options have been used */
+ unused_opts = strip_specifiers(o->g->codec_opts);
+ for (i = f->ist_index; i < nb_input_streams; i++) {
+ e = NULL;
+ while ((e = av_dict_get(input_streams[i]->opts, "", e,
+ AV_DICT_IGNORE_SUFFIX)))
+ av_dict_set(&unused_opts, e->key, NULL, 0);
+ }
+
+ e = NULL;
+ while ((e = av_dict_get(unused_opts, "", e, AV_DICT_IGNORE_SUFFIX))) {
+ const AVClass *class = avcodec_get_class();
+ const AVOption *option = av_opt_find(&class, e->key, NULL, 0,
+ AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ);
+ if (!option)
+ continue;
+ if (!(option->flags & AV_OPT_FLAG_DECODING_PARAM)) {
+ av_log(NULL, AV_LOG_ERROR, "Codec AVOption %s (%s) specified for "
+ "input file #%d (%s) is not a decoding option.\n", e->key,
+ option->help ? option->help : "", nb_input_files - 1,
+ filename);
+ exit(1);
+ }
+
+ av_log(NULL, AV_LOG_WARNING, "Codec AVOption %s (%s) specified for "
+ "input file #%d (%s) has not been used for any stream. The most "
+ "likely reason is either wrong type (e.g. a video option with "
+ "no video streams) or that it is a private option of some decoder "
+ "which was not actually used for any stream.\n", e->key,
+ option->help ? option->help : "", nb_input_files - 1, filename);
+ }
+ av_dict_free(&unused_opts);
+
for (i = 0; i < o->nb_dump_attachment; i++) {
int j;
@@ -1452,6 +1505,8 @@ static int open_output_file(OptionsContext *o, const char *filename)
OutputFile *of;
OutputStream *ost;
InputStream *ist;
+ AVDictionary *unused_opts = NULL;
+ AVDictionaryEntry *e = NULL;
if (configure_complex_filters() < 0) {
av_log(NULL, AV_LOG_FATAL, "Error configuring filters.\n");
@@ -1701,6 +1756,40 @@ loop_end:
of->shortest = o->shortest;
av_dict_copy(&of->opts, o->g->format_opts, 0);
+
+ /* check if all codec options have been used */
+ unused_opts = strip_specifiers(o->g->codec_opts);
+ for (i = of->ost_index; i < nb_output_streams; i++) {
+ e = NULL;
+ while ((e = av_dict_get(output_streams[i]->opts, "", e,
+ AV_DICT_IGNORE_SUFFIX)))
+ av_dict_set(&unused_opts, e->key, NULL, 0);
+ }
+
+ e = NULL;
+ while ((e = av_dict_get(unused_opts, "", e, AV_DICT_IGNORE_SUFFIX))) {
+ const AVClass *class = avcodec_get_class();
+ const AVOption *option = av_opt_find(&class, e->key, NULL, 0,
+ AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ);
+ if (!option)
+ continue;
+ if (!(option->flags & AV_OPT_FLAG_ENCODING_PARAM)) {
+ av_log(NULL, AV_LOG_ERROR, "Codec AVOption %s (%s) specified for "
+ "output file #%d (%s) is not an encoding option.\n", e->key,
+ option->help ? option->help : "", nb_output_files - 1,
+ filename);
+ exit(1);
+ }
+
+ av_log(NULL, AV_LOG_WARNING, "Codec AVOption %s (%s) specified for "
+ "output file #%d (%s) has not been used for any stream. The most "
+ "likely reason is either wrong type (e.g. a video option with "
+ "no video streams) or that it is a private option of some encoder "
+ "which was not actually used for any stream.\n", e->key,
+ option->help ? option->help : "", nb_output_files - 1, filename);
+ }
+ av_dict_free(&unused_opts);
+
/* check filename in case of an image number is expected */
if (oc->oformat->flags & AVFMT_NEEDNUMBER) {
if (!av_filename_number_test(oc->filename)) {
diff --git a/libavutil/Makefile b/libavutil/Makefile
index 87e222b..103ce5e 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -111,6 +111,10 @@ OBJS += $(COMPAT_OBJS:%=../compat/%)
SKIPHEADERS = old_pix_fmts.h
+SKIPHEADERS-$(HAVE_MACHINE_RW_BARRIER) += atomic_suncc.h
+SKIPHEADERS-$(HAVE_MEMORYBARRIER) += atomic_win32.h
+SKIPHEADERS-$(HAVE_SYNC_VAL_COMPARE_AND_SWAP) += atomic_gcc.h
+
TESTPROGS = adler32 \
aes \
atomic \
diff --git a/tests/lavf-regression.sh b/tests/lavf-regression.sh
index d0335c1..1bfdd1e 100755
--- a/tests/lavf-regression.sh
+++ b/tests/lavf-regression.sh
@@ -99,7 +99,7 @@ do_lavf swf "" "-an"
fi
if [ -n "$do_ffm" ] ; then
-do_lavf ffm "-ab 64k"
+do_lavf ffm
fi
if [ -n "$do_flm" ] ; then