Skip to content

Commit

Permalink
avconv: fix disabling auto mappings with -map_metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
elenril committed Oct 16, 2012
1 parent a25d912 commit a119c64
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions avconv_opt.c
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,10 @@ static int copy_metadata(char *outspec, char *inspec, AVFormatContext *oc, AVFor
if (type_in == 'c' || type_out == 'c')
o->metadata_chapters_manual = 1;

/* ic is NULL when just disabling automatic mappings */
if (!ic)
return 0;

#define METADATA_CHECK_INDEX(index, nb_elems, desc)\
if ((index) < 0 || (index) >= (nb_elems)) {\
av_log(NULL, AV_LOG_FATAL, "Invalid %s index %d while processing metadata maps.\n",\
Expand Down Expand Up @@ -1410,13 +1414,13 @@ void opt_output_file(void *optctx, const char *filename)
char *p;
int in_file_index = strtol(o->metadata_map[i].u.str, &p, 0);

if (in_file_index < 0)
continue;
if (in_file_index >= nb_input_files) {
av_log(NULL, AV_LOG_FATAL, "Invalid input file index %d while processing metadata maps\n", in_file_index);
exit(1);
}
copy_metadata(o->metadata_map[i].specifier, *p ? p + 1 : p, oc, input_files[in_file_index]->ctx, o);
copy_metadata(o->metadata_map[i].specifier, *p ? p + 1 : p, oc,
in_file_index >= 0 ?
input_files[in_file_index]->ctx : NULL, o);
}

/* copy chapters */
Expand Down

0 comments on commit a119c64

Please sign in to comment.