[vlc-commits] commit: AVFormat Muxer : Don't create AVStreams for unsupported ES types. ( Jai Menon )

git at videolan.org git at videolan.org
Wed Jun 16 18:36:25 CEST 2010


vlc | branch: master | Jai Menon <jmenon86 at gmail.com> | Wed Jun 16 17:13:07 2010 +0530| [e276b6488d2c59d61549828aafe95221f0e76146] | committer: Jean-Baptiste Kempf 

AVFormat Muxer : Don't create AVStreams for unsupported ES types.

Currently, the libavformat based muxer supports audio and video streams
properly. Subtitle muxing is still a work-in-progress. Till those are
verified to work as well, we need to ensure that we don't create AVStreams
with invalid codec type.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/demux/avformat/mux.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/modules/demux/avformat/mux.c b/modules/demux/avformat/mux.c
index cd40492..00c2277 100644
--- a/modules/demux/avformat/mux.c
+++ b/modules/demux/avformat/mux.c
@@ -214,6 +214,12 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
     p_input->p_sys = malloc( sizeof( int ) );
     *((int *)p_input->p_sys) = p_sys->oc->nb_streams;
 
+    if( p_input->p_fmt->i_cat != VIDEO_ES && p_input->p_fmt->i_cat != AUDIO_ES)
+    {
+        msg_Warn( p_mux, "Unhandled ES category" );
+        return VLC_EGENERIC;
+    }
+
     stream = av_new_stream( p_sys->oc, p_sys->oc->nb_streams);
     if( !stream )
     {
@@ -257,8 +263,6 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
         codec->time_base.num = p_input->p_fmt->video.i_frame_rate_base;
         break;
 
-    default:
-        msg_Warn( p_mux, "Unhandled ES category" );
     }
 
     codec->bit_rate = p_input->p_fmt->i_bitrate;



More information about the vlc-commits mailing list