]> git.sesse.net Git - vlc/blobdiff - modules/demux/cdg.c
modules: use the new add_shortcut capability (add multiple shortcuts at a time).
[vlc] / modules / demux / cdg.c
index d9102884bc680ef0e3e2ac190daf5a51ddd05b26..c7a3b6ec7a84fd9298511d08c270e66a5758a388 100644 (file)
@@ -33,8 +33,6 @@
 #include <vlc_plugin.h>
 #include <vlc_demux.h>
 
-#include <vlc_codecs.h>
-
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
@@ -47,8 +45,7 @@ vlc_module_begin ()
     set_subcategory( SUBCAT_INPUT_DEMUX )
     set_capability( "demux", 3 )
     set_callbacks( Open, Close )
-    add_shortcut( "cdg" )
-    add_shortcut( "subtitle" )
+    add_shortcut( "cdg", "subtitle" )
 vlc_module_end ()
 
 /*****************************************************************************
@@ -94,7 +91,7 @@ static int Open( vlc_object_t * p_this )
     p_demux->p_sys      = p_sys = malloc( sizeof( demux_sys_t ) );
 
     /* */
-    es_format_Init( &p_sys->fmt, VIDEO_ES, VLC_FOURCC('C','D','G', ' ' ) );
+    es_format_Init( &p_sys->fmt, VIDEO_ES, VLC_CODEC_CDG );
     p_sys->fmt.video.i_width  = 300-2*6;
     p_sys->fmt.video.i_height = 216-2*12 ;
 
@@ -102,7 +99,7 @@ static int Open( vlc_object_t * p_this )
 
     /* There is CDG_FRAME_RATE frames per second */
     date_Init( &p_sys->pts, CDG_FRAME_RATE, 1 );
-    date_Set( &p_sys->pts, 1 );
+    date_Set( &p_sys->pts, 0 );
 
     return VLC_SUCCESS;
 }
@@ -125,11 +122,14 @@ static int Demux( demux_t *p_demux )
     }
 
     p_block->i_dts =
-    p_block->i_pts = date_Increment( &p_sys->pts, 1 );
+    p_block->i_pts = VLC_TS_0 + date_Get( &p_sys->pts );
 
     es_out_Control( p_demux->out, ES_OUT_SET_PCR, p_block->i_pts );
 
     es_out_Send( p_demux->out, p_sys->p_es, p_block );
+
+    date_Increment( &p_sys->pts, 1 );
+
     return 1;
 }