]> git.sesse.net Git - vlc/blobdiff - modules/codec/faad.c
Used VLC_CODEC_* and vlc_fourcc_GetCodec when suitable.
[vlc] / modules / codec / faad.c
index 521b272e3b42c34c449c0294e270bca1dc7cef5f..1f4f079d7c74731deefc4e7f0cf57f95d82e1dcd 100644 (file)
@@ -117,14 +117,13 @@ static int Open( vlc_object_t *p_this )
     decoder_sys_t *p_sys = p_dec->p_sys;
     faacDecConfiguration *cfg;
 
-    if( p_dec->fmt_in.i_codec != VLC_FOURCC('m','p','4','a') )
+    if( p_dec->fmt_in.i_codec != VLC_CODEC_MP4A )
     {
         return VLC_EGENERIC;
     }
 
     /* 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 )
+    if( ( p_dec->p_sys = p_sys = malloc( sizeof(*p_sys) ) ) == NULL )
         return VLC_ENOMEM;
 
     /* Open a faad context */
@@ -139,7 +138,7 @@ static int Open( vlc_object_t *p_this )
     p_dec->fmt_out.i_cat = AUDIO_ES;
 
     if (vlc_CPU() & CPU_CAPABILITY_FPU)
-        p_dec->fmt_out.i_codec = VLC_FOURCC('f','l','3','2');
+        p_dec->fmt_out.i_codec = VLC_CODEC_FL32;
     else
         p_dec->fmt_out.i_codec = AOUT_FMT_S16_NE;
     p_dec->pf_decode_audio = DecodeBlock;
@@ -157,6 +156,7 @@ static int Open( vlc_object_t *p_this )
                           p_dec->fmt_in.i_extra,
                           &i_rate, &i_channels ) < 0 )
         {
+            msg_Err( p_dec, "Failed to initialize faad using extra data" );
             return VLC_EGENERIC;
         }
 
@@ -365,27 +365,19 @@ static aout_buffer_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
             = pi_channels_guessed[frame.channels];
 
         /* Adjust stream info when dealing with SBR/PS */
-        if( (p_sys->b_sbr != frame.sbr || p_sys->b_ps != frame.ps) &&
-            p_dec->p_parent->i_object_type == VLC_OBJECT_INPUT )
+        if( p_sys->b_sbr != frame.sbr || p_sys->b_ps != frame.ps )
         {
-            input_thread_t *p_input = (input_thread_t *)p_dec->p_parent;
-            char *psz_cat;
             const char *psz_ext = (frame.sbr && frame.ps) ? "SBR+PS" :
                                     frame.sbr ? "SBR" : "PS";
 
             msg_Dbg( p_dec, "AAC %s (channels: %u, samplerate: %lu)",
                     psz_ext, frame.channels, frame.samplerate );
 
-            if( asprintf( &psz_cat, _("Stream %d"), p_dec->fmt_in.i_id ) != -1 )
-            {
-                input_Control( p_input, INPUT_ADD_INFO, psz_cat,
-                            _("AAC extension"), "%s", psz_ext );
-                input_Control( p_input, INPUT_ADD_INFO, psz_cat,
-                            _("Channels"), "%d", frame.channels );
-                input_Control( p_input, INPUT_ADD_INFO, psz_cat,
-                            _("Sample rate"), _("%d Hz"), frame.samplerate );
-                free( psz_cat );
-            }
+            if( !p_dec->p_description )
+                p_dec->p_description = vlc_meta_New();
+            if( p_dec->p_description )
+                vlc_meta_AddExtra( p_dec->p_description, _("AAC extension"), psz_ext );
+
             p_sys->b_sbr = frame.sbr; p_sys->b_ps = frame.ps;
         }