]> git.sesse.net Git - vlc/blobdiff - modules/demux/mpeg/mpgv.c
A bit more strict es demux probing in wav.
[vlc] / modules / demux / mpeg / mpgv.c
index 204307fe5fe3a47f0de223a3c1079aa98b76e89f..e9cbd8e35653114ca1ea468e63125ee47b34cd08 100644 (file)
  * Preamble
  *****************************************************************************/
 
-#include <vlc/vlc.h>
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <vlc_common.h>
+#include <vlc_plugin.h>
 #include <vlc_demux.h>
 #include <vlc_codec.h>
 
 static int  Open ( vlc_object_t * );
 static void Close( vlc_object_t * );
 
-vlc_module_begin();
-    set_category( CAT_INPUT );
-    set_subcategory( SUBCAT_INPUT_DEMUX );
-    set_description( _("MPEG-I/II video demuxer" ) );
-    set_capability( "demux2", 100 );
-    set_callbacks( Open, Close );
-    add_shortcut( "mpgv" );
-vlc_module_end();
+vlc_module_begin ()
+    set_category( CAT_INPUT )
+    set_subcategory( SUBCAT_INPUT_DEMUX )
+    set_description( N_("MPEG-I/II video demuxer" ) )
+    set_capability( "demux", 100 )
+    set_callbacks( Open, Close )
+    add_shortcut( "mpgv" )
+vlc_module_end ()
 
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
 struct demux_sys_t
 {
-    vlc_bool_t  b_start;
+    bool  b_start;
 
     es_out_id_t *p_es;
 
@@ -68,7 +73,7 @@ static int Open( vlc_object_t * p_this )
 {
     demux_t     *p_demux = (demux_t*)p_this;
     demux_sys_t *p_sys;
-    vlc_bool_t   b_forced = VLC_FALSE;
+    bool   b_forced = false;
 
     const uint8_t *p_peek;
 
@@ -81,7 +86,7 @@ static int Open( vlc_object_t * p_this )
     }
 
     if( p_demux->b_force )
-        b_forced = VLC_TRUE;
+        b_forced = true;
 
     if( p_peek[0] != 0x00 || p_peek[1] != 0x00 || p_peek[2] != 0x01 )
     {
@@ -99,16 +104,20 @@ static int Open( vlc_object_t * p_this )
     p_demux->pf_demux  = Demux;
     p_demux->pf_control= Control;
     p_demux->p_sys     = p_sys = malloc( sizeof( demux_sys_t ) );
-    p_sys->b_start     = VLC_TRUE;
+    p_sys->b_start     = true;
     p_sys->p_es        = NULL;
 
     /* Load the mpegvideo packetizer */
-    INIT_VPACKETIZER( p_sys->p_packetizer,  'm', 'p', 'g', 'v' );
-    es_format_Init( &p_sys->p_packetizer->fmt_out, UNKNOWN_ES, 0 );
-    LOAD_PACKETIZER_OR_FAIL( p_sys->p_packetizer, "MPEG Video" );
+    es_format_Init( &fmt, VIDEO_ES, VLC_CODEC_MPGV );
+    p_sys->p_packetizer = demux_PacketizerNew( p_demux, &fmt, "mpeg video" );
+    if( !p_sys->p_packetizer )
+    {
+        free( p_sys );
+        return VLC_EGENERIC;
+    }
 
     /* create the output */
-    es_format_Init( &fmt, VIDEO_ES, VLC_FOURCC( 'm', 'p', 'g', 'v' ) );
+    es_format_Init( &fmt, VIDEO_ES, VLC_CODEC_MPGV );
     p_sys->p_es = es_out_Add( p_demux->out, &fmt );
 
     return VLC_SUCCESS;
@@ -122,8 +131,7 @@ static void Close( vlc_object_t * p_this )
     demux_t     *p_demux = (demux_t*)p_this;
     demux_sys_t *p_sys = p_demux->p_sys;
 
-    DESTROY_PACKETIZER( p_sys->p_packetizer );
-
+    demux_PacketizerDestroy( p_sys->p_packetizer );
     free( p_sys );
 }
 
@@ -155,7 +163,7 @@ static int Demux( demux_t *p_demux )
 
     while( (p_block_out = p_sys->p_packetizer->pf_packetize( p_sys->p_packetizer, &p_block_in )) )
     {
-        p_sys->b_start = VLC_FALSE;
+        p_sys->b_start = false;
 
         while( p_block_out )
         {
@@ -182,7 +190,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
     if( i_query == DEMUX_SET_TIME )
         return VLC_EGENERIC;
     else
-        return demux2_vaControlHelper( p_demux->s,
+        return demux_vaControlHelper( p_demux->s,
                                        0, -1,
                                        0, 1, i_query, args );
 }