]> git.sesse.net Git - vlc/blobdiff - modules/codec/araw.c
Enabled again timeout for win32 in live555.
[vlc] / modules / codec / araw.c
index e31843cd2de3de3c956ab20b31cf9a2edd03b477..7a5ec825eb6e065671e49f17184cc1aee4534cf2 100644 (file)
@@ -28,7 +28,8 @@
 # include "config.h"
 #endif
 
-#include <vlc/vlc.h>
+#include <vlc_common.h>
+#include <vlc_plugin.h>
 #include <vlc_aout.h>
 #include <vlc_codec.h>
 
@@ -43,22 +44,22 @@ static int  EncoderOpen ( vlc_object_t * );
 static void EncoderClose( vlc_object_t * );
 #endif
 
-vlc_module_begin();
+vlc_module_begin ()
     /* audio decoder module */
-    set_description( _("Raw/Log Audio decoder") );
-    set_capability( "decoder", 100 );
-    set_category( CAT_INPUT );
-    set_subcategory( SUBCAT_INPUT_ACODEC );
-    set_callbacks( DecoderOpen, DecoderClose );
+    set_description( N_("Raw/Log Audio decoder") )
+    set_capability( "decoder", 100 )
+    set_category( CAT_INPUT )
+    set_subcategory( SUBCAT_INPUT_ACODEC )
+    set_callbacks( DecoderOpen, DecoderClose )
 
 #ifdef ENABLE_SOUT
     /* audio encoder submodule */
-    add_submodule();
-    set_description( _("Raw audio encoder") );
-    set_capability( "encoder", 150 );
-    set_callbacks( EncoderOpen, EncoderClose );
+    add_submodule ()
+    set_description( N_("Raw audio encoder") )
+    set_capability( "encoder", 150 )
+    set_callbacks( EncoderOpen, EncoderClose )
 #endif
-vlc_module_end();
+vlc_module_end ()
 
 /*****************************************************************************
  * Local prototypes
@@ -71,6 +72,7 @@ static block_t *EncoderEncode( encoder_t *, aout_buffer_t * );
 struct decoder_sys_t
 {
     const int16_t *p_logtos16;  /* used with m/alaw to int16_t */
+    int i_bytespersample;
 
     audio_date_t end_date;
 };
@@ -226,10 +228,7 @@ static int DecoderOpen( 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;
 
     p_sys->p_logtos16 = NULL;
 
@@ -406,6 +405,7 @@ static int DecoderOpen( vlc_object_t *p_this )
 
     aout_DateInit( &p_sys->end_date, p_dec->fmt_out.audio.i_rate );
     aout_DateSet( &p_sys->end_date, 0 );
+    p_sys->i_bytespersample = ( p_dec->fmt_in.audio.i_bitspersample + 7 ) / 8;
 
     p_dec->pf_decode_audio = DecodeBlock;
 
@@ -443,7 +443,7 @@ static aout_buffer_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
     /* Don't re-use the same pts twice */
     p_block->i_pts = 0;
 
-    i_samples = p_block->i_buffer * 8 / p_dec->fmt_in.audio.i_bitspersample /
+    i_samples = p_block->i_buffer / p_sys->i_bytespersample /
         p_dec->fmt_in.audio.i_channels;
 
     if( i_samples <= 0 )
@@ -455,7 +455,7 @@ static aout_buffer_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
     /* Create chunks of max 1024 samples */
     i_samples = __MIN( i_samples, 1024 );
 
-    p_out = p_dec->pf_aout_buffer_new( p_dec, i_samples );
+    p_out = decoder_NewAudioBuffer( p_dec, i_samples );
     if( p_out == NULL )
     {
         block_Release( p_block );
@@ -508,7 +508,7 @@ struct encoder_sys_t
     int i_s16tolog;  /* used with int16_t to m/alaw */
 };
 
-static int8_t alaw_encode[2049] =
+static const int8_t alaw_encode[2049] =
 {
     0xD5, 0xD4, 0xD7, 0xD6, 0xD1, 0xD0, 0xD3, 0xD2, 0xDD, 0xDC, 0xDF, 0xDE,
     0xD9, 0xD8, 0xDB, 0xDA, 0xC5, 0xC4, 0xC7, 0xC6, 0xC1, 0xC0, 0xC3, 0xC2,
@@ -683,7 +683,7 @@ static int8_t alaw_encode[2049] =
     0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0x2A
 }; /* alaw_encode */
 
-static int8_t ulaw_encode[8193] =
+static const int8_t ulaw_encode[8193] =
 {
     0xFF, 0xFE, 0xFE, 0xFD, 0xFD, 0xFC, 0xFC, 0xFB, 0xFB, 0xFA, 0xFA, 0xF9,
     0xF9, 0xF8, 0xF8, 0xF7, 0xF7, 0xF6, 0xF6, 0xF5, 0xF5, 0xF4, 0xF4, 0xF3,
@@ -1423,10 +1423,7 @@ static int EncoderOpen( vlc_object_t *p_this )
     /* Allocate the memory needed to store the encoder's structure */
     if( ( p_enc->p_sys = p_sys =
           (encoder_sys_t *)malloc(sizeof(encoder_sys_t)) ) == NULL )
-    {
-        msg_Err( p_enc, "out of memory" );
-        return VLC_EGENERIC;
-    }
+        return VLC_ENOMEM;
 
     p_enc->pf_encode_audio = EncoderEncode;
     p_enc->fmt_in.i_codec = p_enc->fmt_out.i_codec;
@@ -1463,7 +1460,7 @@ static int EncoderOpen( vlc_object_t *p_this )
  *****************************************************************************/
 static void EncoderClose ( vlc_object_t *p_this )
 {
-    return;
+    VLC_UNUSED(p_this);
 }
 
 /*****************************************************************************