]> git.sesse.net Git - vlc/blobdiff - modules/codec/aes3.c
macosx: Cocoa cannot deal with 2 images of the same name in a single bundle even...
[vlc] / modules / codec / aes3.c
index e1fd62656bb20c6707e1769e7e1105728eaf7022..4b07489fbc4deea592659e560f7bdc7c33df23f3 100644 (file)
@@ -31,7 +31,6 @@
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_codec.h>
-#include <vlc_aout.h>
 #include <assert.h>
 
 /*****************************************************************************
@@ -64,7 +63,7 @@ struct decoder_sys_t
     /*
      * Output properties
      */
-    audio_date_t end_date;
+    date_t end_date;
 };
 
 #define AES3_HEADER_LEN 4
@@ -119,11 +118,11 @@ static void Close( vlc_object_t *p_this )
  ****************************************************************************
  * Beware, this function must be fed with complete frames (PES packet).
  *****************************************************************************/
-static aout_buffer_t *Decode( decoder_t *p_dec, block_t **pp_block )
+static block_t *Decode( decoder_t *p_dec, block_t **pp_block )
 {
     decoder_sys_t *p_sys = p_dec->p_sys;
     block_t       *p_block;
-    aout_buffer_t *p_aout_buffer;
+    block_t       *p_aout_buffer;
     int            i_frame_length, i_bits;
 
     p_block = Parse( p_dec, &i_frame_length, &i_bits, pp_block, false );
@@ -134,8 +133,9 @@ static aout_buffer_t *Decode( decoder_t *p_dec, block_t **pp_block )
     if( p_aout_buffer == NULL )
         goto exit;
 
-    p_aout_buffer->start_date = aout_DateGet( &p_sys->end_date );
-    p_aout_buffer->end_date = aout_DateIncrement( &p_sys->end_date, i_frame_length );
+    p_aout_buffer->i_pts = date_Get( &p_sys->end_date );
+    p_aout_buffer->i_length = date_Increment( &p_sys->end_date,
+                                      i_frame_length ) - p_aout_buffer->i_pts;
 
     p_block->i_buffer -= AES3_HEADER_LEN;
     p_block->p_buffer += AES3_HEADER_LEN;
@@ -219,8 +219,8 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
     if( !p_block )
         return NULL;
 
-    p_block->i_pts = p_block->i_dts = aout_DateGet( &p_sys->end_date );
-    p_block->i_length = aout_DateIncrement( &p_sys->end_date, i_frame_length ) - p_block->i_pts;
+    p_block->i_pts = p_block->i_dts = date_Get( &p_sys->end_date );
+    p_block->i_length = date_Increment( &p_sys->end_date, i_frame_length ) - p_block->i_pts;
 
     /* Just pass on the incoming frame */
     return p_block;
@@ -239,12 +239,12 @@ static int Open( decoder_t *p_dec, bool b_packetizer )
     /* Allocate the memory needed to store the decoder's structure */
     p_dec->p_sys = p_sys = malloc( sizeof(decoder_sys_t) );
 
-    if( !p_sys )
+    if( unlikely( !p_sys ) )
         return VLC_EGENERIC;
 
     /* Misc init */
-    aout_DateInit( &p_sys->end_date, 48000 );
-    aout_DateSet( &p_sys->end_date, 0 );
+    date_Init( &p_sys->end_date, 48000, 1 );
+    date_Set( &p_sys->end_date, 0 );
 
     /* Set output properties */
     p_dec->fmt_out.i_cat = AUDIO_ES;
@@ -260,6 +260,9 @@ static int Open( decoder_t *p_dec, bool b_packetizer )
     }
     else
     {
+        p_dec->fmt_out.i_codec = VLC_CODEC_S16N;
+        p_dec->fmt_out.audio.i_bitspersample = 16;
+
         p_dec->pf_decode_audio = Decode;
         p_dec->pf_packetize    = NULL;
     }
@@ -287,7 +290,6 @@ static block_t *Parse( decoder_t *p_dec, int *pi_frame_length, int *pi_bits,
     uint32_t h;
     unsigned int i_size;
     int i_channels;
-    int i_id;
     int i_bits;
 
     if( !pp_block || !*pp_block ) return NULL;
@@ -296,13 +298,13 @@ static block_t *Parse( decoder_t *p_dec, int *pi_frame_length, int *pi_bits,
     *pp_block = NULL; /* So the packet doesn't get re-sent */
 
     /* Date management */
-    if( p_block->i_pts > 0 &&
-        p_block->i_pts != aout_DateGet( &p_sys->end_date ) )
+    if( p_block->i_pts > VLC_TS_INVALID &&
+        p_block->i_pts != date_Get( &p_sys->end_date ) )
     {
-        aout_DateSet( &p_sys->end_date, p_block->i_pts );
+        date_Set( &p_sys->end_date, p_block->i_pts );
     }
 
-    if( !aout_DateGet( &p_sys->end_date ) )
+    if( !date_Get( &p_sys->end_date ) )
     {
         /* We've just started the stream, wait for the first PTS. */
         block_Release( p_block );
@@ -328,7 +330,6 @@ static block_t *Parse( decoder_t *p_dec, int *pi_frame_length, int *pi_bits,
     h = GetDWBE( p_block->p_buffer );
     i_size = (h >> 16) & 0xffff;
     i_channels = 2 + 2*( (h >> 14) & 0x03 );
-    i_id = (h >> 6) & 0xff;
     i_bits = 16 + 4*( (h >> 4)&0x03 );
 
     if( AES3_HEADER_LEN + i_size != p_block->i_buffer || i_bits > 24 )
@@ -351,7 +352,7 @@ static block_t *Parse( decoder_t *p_dec, int *pi_frame_length, int *pi_bits,
 
     p_dec->fmt_out.audio.i_channels = i_channels;
     p_dec->fmt_out.audio.i_original_channels = pi_original_channels[i_channels/2-1];
-    p_dec->fmt_out.audio.i_physical_channels = pi_original_channels[i_channels/2-1] & AOUT_CHAN_PHYSMASK;
+    p_dec->fmt_out.audio.i_physical_channels = pi_original_channels[i_channels/2-1];
 
     *pi_frame_length = (p_block->i_buffer - AES3_HEADER_LEN) / ( (4+i_bits) * i_channels / 8 );
     *pi_bits = i_bits;