]> git.sesse.net Git - vlc/blobdiff - modules/codec/mpeg_audio.c
* modules/services_discovery/sap.c, modules/codec/x264.c: fixed small mem leaks.
[vlc] / modules / codec / mpeg_audio.c
index 9af3348b3e9affaaf9991b5882956e7ad38a10d6..f7dbd4635d9d8b699860db972505be438db68a8f 100644 (file)
@@ -28,7 +28,6 @@
  * Preamble
  *****************************************************************************/
 #include <vlc/vlc.h>
-#include <vlc/input.h>          /* for input infos */
 #include <vlc/decoder.h>
 #include <vlc/aout.h>
 
@@ -105,8 +104,10 @@ static int SyncInfo( uint32_t i_header, unsigned int * pi_channels,
  *****************************************************************************/
 vlc_module_begin();
     set_description( _("MPEG audio layer I/II/III parser") );
-#if defined(SYS_DARWIN)
-    set_capability( "decoder", 5 );
+    set_category( CAT_INPUT );
+    set_subcategory( SUBCAT_INPUT_ACODEC );
+#if defined(SYS_DARWIN) || defined(UNDER_CE)
+   set_capability( "decoder", 5 );
 #else
     set_capability( "decoder", 100 );
 #endif
@@ -148,6 +149,7 @@ static int OpenDecoder( vlc_object_t *p_this )
     /* Set output properties */
     p_dec->fmt_out.i_cat = AUDIO_ES;
     p_dec->fmt_out.i_codec = VLC_FOURCC('m','p','g','a');
+    p_dec->fmt_out.audio.i_rate = 0; /* So end_date gets initialized */
 
     /* Set callback */
     p_dec->pf_decode_audio = (aout_buffer_t *(*)(decoder_t *, block_t **))
@@ -194,7 +196,7 @@ static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
         return NULL;
     }
 
-    if( (*pp_block)->i_flags&BLOCK_FLAG_DISCONTINUITY )
+    if( (*pp_block)->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
     {
         p_sys->i_state = STATE_NOSYNC;
     }
@@ -464,35 +466,11 @@ static uint8_t *GetOutBuffer( decoder_t *p_dec, void **pp_out_buffer )
 
     if( p_dec->fmt_out.audio.i_rate != p_sys->i_rate )
     {
-#define TITLE_MAX 30
-        input_info_category_t *p_cat;
-        char psz_streamid[TITLE_MAX];
-        int i_es_id = p_dec->fmt_out.i_id;
-        input_thread_t * p_input = vlc_object_find( p_dec, VLC_OBJECT_INPUT, FIND_PARENT );
+        msg_Info( p_dec, "MPGA channels:%d samplerate:%d bitrate:%d",
+                  p_sys->i_channels, p_sys->i_rate, p_sys->i_bit_rate );
 
-        if( p_input )
-        {
-            snprintf(psz_streamid, TITLE_MAX, "%s%04x", _("Stream "), i_es_id);
-            p_cat = input_InfoCategory( p_input, psz_streamid );
-
-#if 1
-            /* We should be finding this stream, but we aren't. */
-            input_AddInfo( p_cat, _("Type"), "%s", _("audio") );
-            input_AddInfo( p_cat, _("Description"), "%s", _("MPEG audio") );
-#endif
-
-            input_AddInfo( p_cat, _("Sample Rate"), "%d", p_sys->i_rate );
-            input_AddInfo( p_cat, _("Bit Rate"), "%d", p_sys->i_bit_rate );
-            input_AddInfo( p_cat, _("Channel(s)"), "%d", p_sys->i_channels );
-
-            msg_Info( p_dec, "MPGA channels:%d samplerate:%d bitrate:%d",
-                      p_sys->i_channels, p_sys->i_rate, p_sys->i_bit_rate );
-
-            aout_DateInit( &p_sys->end_date, p_sys->i_rate );
-            aout_DateSet( &p_sys->end_date, p_sys->i_pts );
-
-            vlc_object_release( p_input );
-        }
+        aout_DateInit( &p_sys->end_date, p_sys->i_rate );
+        aout_DateSet( &p_sys->end_date, p_sys->i_pts );
     }
 
     p_dec->fmt_out.audio.i_rate     = p_sys->i_rate;
@@ -505,7 +483,7 @@ static uint8_t *GetOutBuffer( decoder_t *p_dec, void **pp_out_buffer )
     p_dec->fmt_out.audio.i_physical_channels =
         p_sys->i_channels_conf & AOUT_CHAN_PHYSMASK;
 
-    p_dec->fmt_out.i_bitrate = p_sys->i_bit_rate;
+    p_dec->fmt_out.i_bitrate = p_sys->i_bit_rate * 1000;
 
     if( p_sys->b_packetizer )
     {