]> git.sesse.net Git - vlc/blobdiff - modules/demux/voc.c
Merge branch 'master' of git://git.videolan.org/vlc
[vlc] / modules / demux / voc.c
index 34391585560065aec7698caaa2e0589dcddf2f17..aa9ca8cb831ac0db4d55119824cc716fe45451b4 100644 (file)
 # include "config.h"
 #endif
 
-#include <vlc/vlc.h>
+#include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_demux.h>
 #include <vlc_aout.h>
 
-#include <vlc_codecs.h>
-
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
 static int  Open ( vlc_object_t * );
 static void Close( vlc_object_t * );
 
-vlc_module_begin();
-    set_description( N_("VOC demuxer") );
-    set_category( CAT_INPUT );
-    set_subcategory( SUBCAT_INPUT_DEMUX );
-    set_capability( "demux", 10 );
-    set_callbacks( Open, Close );
-vlc_module_end();
+vlc_module_begin ()
+    set_description( N_("VOC demuxer") )
+    set_category( CAT_INPUT )
+    set_subcategory( SUBCAT_INPUT_DEMUX )
+    set_capability( "demux", 10 )
+    set_callbacks( Open, Close )
+vlc_module_end ()
 
 /*****************************************************************************
  * Local prototypes
@@ -196,7 +194,7 @@ static int ReadBlockHeader( demux_t *p_demux )
                 return VLC_EGENERIC;
             }
 
-            new_fmt.i_codec = VLC_FOURCC('u','8',' ',' ');
+            new_fmt.i_codec = VLC_CODEC_U8;
             new_fmt.audio.i_rate = fix_voc_sr( 1000000L / (256L - buf[0]) );
             new_fmt.audio.i_bytes_per_frame = 1;
             new_fmt.audio.i_frame_length = 1;
@@ -221,7 +219,7 @@ static int ReadBlockHeader( demux_t *p_demux )
             i_block_size = 0;
             p_sys->i_silence_countdown = GetWLE( buf );
 
-            new_fmt.i_codec = VLC_FOURCC('u','8',' ',' ');
+            new_fmt.i_codec = VLC_CODEC_U8;
             new_fmt.audio.i_rate = fix_voc_sr( 1000000L / (256L - buf[0]) );
             new_fmt.audio.i_bytes_per_frame = 1;
             new_fmt.audio.i_frame_length = 1;
@@ -272,7 +270,7 @@ static int ReadBlockHeader( demux_t *p_demux )
                 return VLC_EGENERIC;
             }
 
-            new_fmt.i_codec = VLC_FOURCC('u','8',' ',' ');
+            new_fmt.i_codec = VLC_CODEC_U8;
             new_fmt.audio.i_channels = buf[3] + 1; /* can't be nul */
             new_fmt.audio.i_rate = 256000000L /
                           ((65536L - GetWLE(buf)) * new_fmt.audio.i_channels);
@@ -323,11 +321,11 @@ static int ReadBlockHeader( demux_t *p_demux )
                     switch( new_fmt.audio.i_bitspersample )
                     {
                         case 8:
-                            new_fmt.i_codec = VLC_FOURCC('u','8',' ',' ');
+                            new_fmt.i_codec = VLC_CODEC_U8;
                             break;
 
                         case 16:
-                            new_fmt.i_codec = VLC_FOURCC('u','1','6','l');
+                            new_fmt.i_codec = VLC_CODEC_U16L;
                             break;
 
                         default:
@@ -341,11 +339,11 @@ static int ReadBlockHeader( demux_t *p_demux )
                     switch( new_fmt.audio.i_bitspersample )
                     {
                         case 8:
-                            new_fmt.i_codec = VLC_FOURCC('s','8',' ',' ');
+                            new_fmt.i_codec = VLC_CODEC_S8;
                             break;
 
                         case 16:
-                            new_fmt.i_codec = VLC_FOURCC('s','1','6','l');
+                            new_fmt.i_codec = VLC_CODEC_S16L;
                             break;
 
                         default:
@@ -462,13 +460,14 @@ static int Demux( demux_t *p_demux )
         p_sys->i_silence_countdown -= i;
     }
 
-    p_block->i_dts = p_block->i_pts =
-        date_Increment( &p_sys->pts, p_sys->fmt.audio.i_frame_length * i );
+    p_block->i_dts = 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, p_sys->fmt.audio.i_frame_length * i );
+
     return 1;
 }