]> git.sesse.net Git - vlc/blobdiff - modules/packetizer/mpeg4audio.c
Missing <assert.h>
[vlc] / modules / packetizer / mpeg4audio.c
index c9b16d7d36933e89a4e2583521f02aee07bdc9cb..2bf711bf5e5da99b127be4dba02082280a56f4ab 100644 (file)
 # include "config.h"
 #endif
 
-#include <vlc/vlc.h>
+#include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_aout.h>
 #include <vlc_codec.h>
 #include <vlc_block.h>
-#include <vlc_sout.h>
-#include <vlc_codecs.h>
-#include <vlc_input.h>
 #include <vlc_bits.h>
 
 #include "vlc_block_helper.h"
@@ -179,13 +176,13 @@ static block_t *PacketizeStreamBlock( decoder_t *, block_t ** );
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
-vlc_module_begin();
-    set_category( CAT_SOUT );
-    set_subcategory( SUBCAT_SOUT_PACKETIZER );
-    set_description( N_("MPEG4 audio packetizer") );
-    set_capability( "packetizer", 50 );
-    set_callbacks( OpenPacketizer, ClosePacketizer );
-vlc_module_end();
+vlc_module_begin ()
+    set_category( CAT_SOUT )
+    set_subcategory( SUBCAT_SOUT_PACKETIZER )
+    set_description( N_("MPEG4 audio packetizer") )
+    set_capability( "packetizer", 50 )
+    set_callbacks( OpenPacketizer, ClosePacketizer )
+vlc_module_end ()
 
 /*****************************************************************************
  * OpenPacketizer: probe the packetizer and return score
@@ -203,16 +200,12 @@ static int OpenPacketizer( vlc_object_t *p_this )
     /* Allocate the memory needed to store the decoder's structure */
     if( ( p_dec->p_sys = p_sys =
           (decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL )
-    {
-        msg_Err( p_dec, "out of memory" );
-        return VLC_EGENERIC;
-    }
+        return VLC_ENOMEM;
 
     /* Misc init */
     p_sys->i_state = STATE_NOSYNC;
     aout_DateSet( &p_sys->end_date, 0 );
     p_sys->bytestream = block_BytestreamInit();
-    p_sys->i_input_rate = INPUT_RATE_DEFAULT;
     p_sys->b_latm_cfg = false;
 
     /* Set output properties */
@@ -297,7 +290,7 @@ static block_t *PacketizeRawBlock( decoder_t *p_dec, block_t **pp_block )
 
     if( (*pp_block)->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
     {
-        //aout_DateSet( &p_sys->end_date, 0 );
+        aout_DateSet( &p_sys->end_date, 0 );
         block_Release( *pp_block );
         return NULL;
     }
@@ -320,7 +313,7 @@ static block_t *PacketizeRawBlock( decoder_t *p_dec, block_t **pp_block )
     p_block->i_pts = p_block->i_dts = aout_DateGet( &p_sys->end_date );
 
     p_block->i_length = aout_DateIncrement( &p_sys->end_date,
-        p_dec->fmt_out.audio.i_frame_length * p_sys->i_input_rate / INPUT_RATE_DEFAULT ) - p_block->i_pts;
+        p_dec->fmt_out.audio.i_frame_length ) - p_block->i_pts;
 
     return p_block;
 }
@@ -830,7 +823,7 @@ static int LOASParse( decoder_t *p_dec, uint8_t *p_buffer, int i_buffer )
     if( !p_sys->b_latm_cfg )
         return 0;
 
-    /* FIXME do we need to split the subframe into independant packet ? */
+    /* FIXME do we need to split the subframe into independent packet ? */
     if( p_sys->latm.i_sub_frames > 1 )
         msg_Err( p_dec, "latm sub frames not yet supported, please send a sample" );
 
@@ -993,9 +986,6 @@ static block_t *PacketizeStreamBlock( decoder_t *p_dec, block_t **pp_block )
         return NULL;
     }
 
-    if( (*pp_block)->i_rate > 0 )
-        p_sys->i_input_rate = (*pp_block)->i_rate;
-
     block_BytestreamPush( &p_sys->bytestream, *pp_block );
 
     for( ;; )
@@ -1219,9 +1209,8 @@ static void SetupOutput( decoder_t *p_dec, block_t *p_block )
 
     p_block->i_pts = p_block->i_dts = aout_DateGet( &p_sys->end_date );
 
-    p_block->i_length = aout_DateIncrement( &p_sys->end_date,
-                            p_sys->i_frame_length * p_sys->i_input_rate / INPUT_RATE_DEFAULT ) -
-                                p_block->i_pts;
+    p_block->i_length =
+        aout_DateIncrement( &p_sys->end_date, p_sys->i_frame_length ) - p_block->i_pts;
 }
 
 /*****************************************************************************