summaryrefslogtreecommitdiff
path: root/ffmpeg.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2011-08-30 16:25:18 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-08-30 18:08:23 +0200
commit10c3b033806bfbbe35fe3d1606aaacf85f98596f (patch)
tree116f8ba77df05d2252a755df9f247bb3fbf33565 /ffmpeg.c
parent93ed69ad2103e0c58ebcaa80dd55742d75f8c461 (diff)
ffmpeg: move the avcodec_find_decoder() call to add_input_streams().
This makes the code simpler to understand, though it results in an unnecessary call to avcodec_find_decoder() if the stream won't be decoded.
Diffstat (limited to 'ffmpeg.c')
-rw-r--r--ffmpeg.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index 7c63166821..246f9485b7 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1891,8 +1891,6 @@ static int init_input_stream(int ist_index, OutputStream *output_streams, int nb
InputStream *ist = &input_streams[ist_index];
if (ist->decoding_needed) {
AVCodec *codec = ist->dec;
- if (!codec)
- codec = avcodec_find_decoder(ist->st->codec->codec_id);
if (!codec) {
snprintf(error, sizeof(error), "Decoder (codec %s) not found for input stream #%d.%d",
avcodec_get_name(ist->st->codec->codec_id), ist->file_index, ist->st->index);
@@ -3061,6 +3059,8 @@ static void add_input_streams(AVFormatContext *ic)
ist->ts_scale = strtod(scale, NULL);
ist->dec = choose_codec(ic, st, dec->codec_type, codec_names);
+ if (!ist->dec)
+ ist->dec = avcodec_find_decoder(dec->codec_id);
switch (dec->codec_type) {
case AVMEDIA_TYPE_AUDIO: