int n;
AVStream *st;
AudioChannelMap *m;
+ char *allow_unused;
+ char *mapchan;
+ mapchan = av_strdup(arg);
+ if (!mapchan)
+ return AVERROR(ENOMEM);
GROW_ARRAY(o->audio_channel_maps, o->nb_audio_channel_maps);
m = &o->audio_channel_maps[o->nb_audio_channel_maps - 1];
m->file_idx = m->stream_idx = -1;
if (n == 1)
m->ofile_idx = m->ostream_idx = -1;
+ av_free(mapchan);
return 0;
}
m->file_idx, m->stream_idx);
exit_program(1);
}
+ /* allow trailing ? to map_channel */
+ if (allow_unused = strchr(mapchan, '?'))
+ *allow_unused = 0;
if (m->channel_idx < 0 || m->channel_idx >= st->codecpar->channels) {
- av_log(NULL, AV_LOG_FATAL, "mapchan: invalid audio channel #%d.%d.%d\n",
- m->file_idx, m->stream_idx, m->channel_idx);
- exit_program(1);
+ if (allow_unused) {
+ av_log(NULL, AV_LOG_VERBOSE, "mapchan: invalid audio channel #%d.%d.%d\n",
+ m->file_idx, m->stream_idx, m->channel_idx);
+ } else {
+ av_log(NULL, AV_LOG_FATAL, "mapchan: invalid audio channel #%d.%d.%d\n"
+ "To ignore this, add a trailing '?' to the map_channel.\n",
+ m->file_idx, m->stream_idx, m->channel_idx);
+ exit_program(1);
+ }
+
}
+ av_free(mapchan);
return 0;
}
case AVMEDIA_TYPE_VIDEO:
if(!ist->dec)
ist->dec = avcodec_find_decoder(par->codec_id);
-#if FF_API_EMU_EDGE
+#if FF_API_LOWRES
if (av_codec_get_lowres(st->codec)) {
av_codec_set_lowres(ist->dec_ctx, av_codec_get_lowres(st->codec));
ist->dec_ctx->width = st->codec->width;
ist->dec_ctx->height = st->codec->height;
ist->dec_ctx->coded_width = st->codec->coded_width;
ist->dec_ctx->coded_height = st->codec->coded_height;
+#if FF_API_EMU_EDGE
ist->dec_ctx->flags |= CODEC_FLAG_EMU_EDGE;
+#endif
}
#endif
AVDictionary **opts = setup_find_stream_info_opts(ic, o->g->codec_opts);
int orig_nb_streams = ic->nb_streams;
- // TODO: reindent
- /* If not enough info to get the stream parameters, we decode the
- first frames to get it. (used in mpeg case for example) */
- ret = avformat_find_stream_info(ic, opts);
+ /* If not enough info to get the stream parameters, we decode the
+ first frames to get it. (used in mpeg case for example) */
+ ret = avformat_find_stream_info(ic, opts);
- for (i = 0; i < orig_nb_streams; i++)
- av_dict_free(&opts[i]);
- av_freep(&opts);
+ for (i = 0; i < orig_nb_streams; i++)
+ av_dict_free(&opts[i]);
+ av_freep(&opts);
- if (ret < 0) {
- av_log(NULL, AV_LOG_FATAL, "%s: could not find codec parameters\n", filename);
- if (ic->nb_streams == 0) {
- avformat_close_input(&ic);
- exit_program(1);
+ if (ret < 0) {
+ av_log(NULL, AV_LOG_FATAL, "%s: could not find codec parameters\n", filename);
+ if (ic->nb_streams == 0) {
+ avformat_close_input(&ic);
+ exit_program(1);
+ }
}
}
- }
if (o->start_time_eof != AV_NOPTS_VALUE) {
if (ic->duration>0) {