[vlc-commits] avcodec: map AV_CODEC_ID_NONE

Rémi Denis-Courmont git at videolan.org
Fri Oct 3 19:21:39 CEST 2014


vlc/vlc-2.2 | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Oct  2 21:33:01 2014 +0300| [021082692843141a0fe57eae70c72fcac369610e] | committer: Rémi Denis-Courmont

avcodec: map AV_CODEC_ID_NONE

(cherry picked from commit 97ef3628415ece0ee2931e70cab424d5446eb64b)

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=021082692843141a0fe57eae70c72fcac369610e
---

 modules/codec/avcodec/avcodec.c |    3 ++-
 modules/codec/avcodec/encoder.c |    3 +++
 modules/codec/avcodec/fourcc.c  |    2 ++
 modules/demux/avformat/mux.c    |    3 ++-
 4 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/modules/codec/avcodec/avcodec.c b/modules/codec/avcodec/avcodec.c
index 7046061..2a710f3 100644
--- a/modules/codec/avcodec/avcodec.c
+++ b/modules/codec/avcodec/avcodec.c
@@ -263,7 +263,8 @@ static int OpenDecoder( vlc_object_t *p_this )
 
     /* *** determine codec type *** */
     if( !GetFfmpegCodec( p_dec->fmt_in.i_codec, &i_cat, &i_codec_id,
-                             &psz_namecodec ) )
+                             &psz_namecodec )
+     || i_cat == UNKNOWN_ES )
     {
         return VLC_EGENERIC;
     }
diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c
index 3e18086..c0098d3 100644
--- a/modules/codec/avcodec/encoder.c
+++ b/modules/codec/avcodec/encoder.c
@@ -281,6 +281,9 @@ int OpenEncoder( vlc_object_t *p_this )
         psz_namecodec = "Raw video";
     }
 
+    if( i_cat == UNKNOWN_ES )
+        return VLC_EGENERIC;
+
     if( p_enc->fmt_out.i_cat == VIDEO_ES && i_cat != VIDEO_ES )
     {
         msg_Err( p_enc, "\"%s\" is not a video encoder", psz_namecodec );
diff --git a/modules/codec/avcodec/fourcc.c b/modules/codec/avcodec/fourcc.c
index 3608f2c..c6875d0 100644
--- a/modules/codec/avcodec/fourcc.c
+++ b/modules/codec/avcodec/fourcc.c
@@ -43,6 +43,8 @@ static const struct
     int i_cat;
 } codecs_table[] =
 {
+    { 0, AV_CODEC_ID_NONE, UNKNOWN_ES },
+
     /*
      * Video Codecs
      */
diff --git a/modules/demux/avformat/mux.c b/modules/demux/avformat/mux.c
index c9532f5..2974a6d 100644
--- a/modules/demux/avformat/mux.c
+++ b/modules/demux/avformat/mux.c
@@ -180,7 +180,8 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
 
     msg_Dbg( p_mux, "adding input" );
 
-    if( !GetFfmpegCodec( fmt->i_codec, 0, &i_codec_id, 0 ) )
+    if( !GetFfmpegCodec( fmt->i_codec, 0, &i_codec_id, 0 )
+     || i_codec_id == AV_CODEC_ID_NONE )
     {
         msg_Dbg( p_mux, "couldn't find codec for fourcc '%4.4s'",
                  (char *)&fmt->i_codec );



More information about the vlc-commits mailing list