[FFmpeg-cvslog] avconv: move the avcodec_find_decoder() call to add_input_streams().

Anton Khirnov git at videolan.org
Tue Aug 23 18:44:28 CEST 2011


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Mon Aug 22 12:48:06 2011 +0200| [c74b44de08ffc2853f872c8a5d31526cdbacfc89] | committer: Anton Khirnov

avconv: 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.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c74b44de08ffc2853f872c8a5d31526cdbacfc89
---

 avconv.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/avconv.c b/avconv.c
index fc0a311..3bad6e0 100644
--- a/avconv.c
+++ b/avconv.c
@@ -1825,8 +1825,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 id %d) not found for input stream #%d.%d",
                     ist->st->codec->codec_id, ist->file_index, ist->st->index);
@@ -2895,6 +2893,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:



More information about the ffmpeg-cvslog mailing list