[FFmpeg-cvslog] examples/demuxing_decoding: return error when no codec found

Even Wiik Thomassen git at videolan.org
Fri Dec 13 09:46:51 CET 2013


ffmpeg | branch: master | Even Wiik Thomassen <e.thomassen at sportradar.com> | Fri Dec 13 09:24:18 2013 +0100| [43f116d1621aeaafdadacaf1c9ee1f662447b023] | committer: Stefano Sabatini

examples/demuxing_decoding: return error when no codec found

The open_codec_context function, when it fails to find a codec, now
return AVERROR(EINVAL) to signal an error.

Before it would return the stream index, which was always >= 0, and
continue as if a codec was found. This change make it fail faster,
instead of repeated failed tries to decode frames with no codec.

Signed-off-by: Even Wiik Thomassen <e.thomassen at sportradar.com>
Signed-off-by: Stefano Sabatini <stefasab at gmail.com>

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

 doc/examples/demuxing_decoding.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/examples/demuxing_decoding.c b/doc/examples/demuxing_decoding.c
index 1b5a989..bd034cc 100644
--- a/doc/examples/demuxing_decoding.c
+++ b/doc/examples/demuxing_decoding.c
@@ -159,7 +159,7 @@ static int open_codec_context(int *stream_idx,
         if (!dec) {
             fprintf(stderr, "Failed to find %s codec\n",
                     av_get_media_type_string(type));
-            return ret;
+            return AVERROR(EINVAL);
         }
 
         /* Init the decoders, with or without reference counting */



More information about the ffmpeg-cvslog mailing list