]> git.sesse.net Git - vlc/blobdiff - modules/codec/realaudio.c
Add vlclua_dir_list_free to free list created by vlclua_dir_list and use it.
[vlc] / modules / codec / realaudio.c
index e3084c35a3a9fa97f15fa6371ee023be061cb9c9..1eb45e08877f27cf83b485cef1ec756d8747147d 100644 (file)
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
-#include <vlc/vlc.h>
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <vlc_common.h>
+#include <vlc_plugin.h>
 #include <vlc_aout.h>
 #include <vlc_codec.h>
 
@@ -57,7 +62,7 @@ static int  Open ( vlc_object_t * );
 static void Close( vlc_object_t * );
 
 vlc_module_begin();
-    set_description( _("RealAudio library decoder") );
+    set_description( N_("RealAudio library decoder") );
     set_capability( "decoder", 10 );
     set_category( CAT_INPUT );
     set_subcategory( SUBCAT_INPUT_VCODEC );
@@ -186,6 +191,7 @@ static int Open( vlc_object_t *p_this )
         return VLC_EGENERIC;
     }
 
+    /* Channel detection */
     if( p_dec->fmt_in.audio.i_channels <= 0 ||
         p_dec->fmt_in.audio.i_channels > 6 )
     {
@@ -195,21 +201,16 @@ static int Open( vlc_object_t *p_this )
     }
 
     p_dec->p_sys = p_sys = malloc( sizeof( decoder_sys_t ) );
+    if( !p_sys )
+        return VLC_ENOMEM;
     memset( p_sys, 0, sizeof(decoder_sys_t) );
 
+    /* Flavor for SIPR codecs */
     p_sys->i_codec_flavor = -1;
     if( p_dec->fmt_in.i_codec == VLC_FOURCC('s','i','p','r') )
     {
-        if( p_dec->fmt_in.audio.i_bitspersample > 1531 )
-            p_sys->i_codec_flavor = 3;
-        else if( p_dec->fmt_in.audio.i_bitspersample > 937 )
-            p_sys->i_codec_flavor = 1;
-        else if( p_dec->fmt_in.audio.i_bitspersample > 719 )
-            p_sys->i_codec_flavor = 0;
-        else
-            p_sys->i_codec_flavor = 2;
-        msg_Dbg( p_dec, "Got sipr flavor %d from bitrate %d\n", 
-            p_sys->i_codec_flavor, p_dec->fmt_in.audio.i_bitspersample );
+        p_sys->i_codec_flavor = p_dec->fmt_in.audio.i_flavor;
+        msg_Dbg( p_dec, "Got sipr flavor %d", p_sys->i_codec_flavor );
     }
 
     if( OpenDll( p_dec ) != VLC_SUCCESS )
@@ -237,6 +238,11 @@ static int Open( vlc_object_t *p_this )
     p_dec->pf_decode_audio = Decode;
 
     p_sys->p_out = malloc( 4096 * 10 );
+    if( !p_sys->p_out )
+    {
+        free( p_sys );
+        return VLC_ENOMEM;
+    }
     p_sys->i_out = 0;
 
     return VLC_SUCCESS;
@@ -250,7 +256,7 @@ static void Close( vlc_object_t *p_this )
     decoder_t *p_dec = (decoder_t*)p_this;
 
     CloseDll( p_dec );
-    if( p_dec->p_sys->p_out ) free( p_dec->p_sys->p_out );
+    free( p_dec->p_sys->p_out );
     free( p_dec->p_sys );
 }
 
@@ -651,7 +657,7 @@ static aout_buffer_t *Decode( decoder_t *p_dec, block_t **pp_block )
         if( OpenDll( p_dec ) != VLC_SUCCESS )
         {
             /* Fatal */
-            p_dec->b_error = VLC_TRUE;
+            p_dec->b_error = true;
             return NULL;
         }
     }