X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fcodec%2Faraw.c;h=26d576b9d04c2ed7550402c78008c95da1f3515f;hb=8060b3457e20e6223b70927693f8da8f547b8fef;hp=8fcd6bfc83397cf1b4dc16f0e05f7d5743c3fff8;hpb=85b29bdc288a1573d43bd524908be5748a9b3640;p=vlc diff --git a/modules/codec/araw.c b/modules/codec/araw.c index 8fcd6bfc83..26d576b9d0 100644 --- a/modules/codec/araw.c +++ b/modules/codec/araw.c @@ -1,7 +1,7 @@ /***************************************************************************** * araw.c: Pseudo audio decoder; for raw pcm data ***************************************************************************** - * Copyright (C) 2001, 2003 VideoLAN (Centrale Réseaux) and its contributors + * Copyright (C) 2001, 2003 the VideoLAN team * $Id$ * * Authors: Laurent Aimar @@ -18,14 +18,19 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ /***************************************************************************** * Preamble *****************************************************************************/ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include -#include +#include +#include /***************************************************************************** * Module descriptor @@ -59,16 +64,18 @@ vlc_module_end(); * Local prototypes *****************************************************************************/ static aout_buffer_t *DecodeBlock( decoder_t *, block_t ** ); +#ifdef ENABLE_SOUT static block_t *EncoderEncode( encoder_t *, aout_buffer_t * ); +#endif struct decoder_sys_t { - int16_t *p_logtos16; /* used with m/alaw to int16_t */ + const int16_t *p_logtos16; /* used with m/alaw to int16_t */ audio_date_t end_date; }; -static int pi_channels_maps[] = +static const int pi_channels_maps[] = { 0, AOUT_CHAN_CENTER, @@ -88,7 +95,7 @@ static int pi_channels_maps[] = | AOUT_CHAN_MIDDLELEFT | AOUT_CHAN_MIDDLERIGHT | AOUT_CHAN_LFE }; -static int16_t ulawtos16[256] = +static const int16_t ulawtos16[256] = { -32124, -31100, -30076, -29052, -28028, -27004, -25980, -24956, -23932, -22908, -21884, -20860, -19836, -18812, -17788, -16764, @@ -124,7 +131,7 @@ static int16_t ulawtos16[256] = 56, 48, 40, 32, 24, 16, 8, 0 }; -static int16_t alawtos16[256] = +static const int16_t alawtos16[256] = { -5504, -5248, -6016, -5760, -4480, -4224, -4992, -4736, -7552, -7296, -8064, -7808, -6528, -6272, -7040, -6784, @@ -172,6 +179,7 @@ static int DecoderOpen( vlc_object_t *p_this ) { /* from wav/avi/asf file */ case VLC_FOURCC('a','r','a','w'): + case VLC_FOURCC('p','c','m',' '): case VLC_FOURCC('a','f','l','t'): /* _signed_ big endian samples (mov)*/ case VLC_FOURCC('t','w','o','s'): @@ -192,6 +200,9 @@ static int DecoderOpen( vlc_object_t *p_this ) case VLC_FOURCC('s','1','6','b'): case VLC_FOURCC('s','8',' ',' '): case VLC_FOURCC('u','8',' ',' '): + case VLC_FOURCC('i','n','2','4'): /* Quicktime in24, bigendian int24 */ + case VLC_FOURCC('4','2','n','i'): /* Quicktime in24, little-endian int24 */ + case VLC_FOURCC('i','n','3','2'): /* Quicktime in32, bigendian int32 */ break; default: @@ -201,7 +212,8 @@ static int DecoderOpen( vlc_object_t *p_this ) if( p_dec->fmt_in.audio.i_channels <= 0 || p_dec->fmt_in.audio.i_channels > 8 ) { - msg_Err( p_dec, "bad channels count (1-8)" ); + msg_Err( p_dec, "bad channels count (1-8): %i", + p_dec->fmt_in.audio.i_channels ); return VLC_EGENERIC; } @@ -241,12 +253,29 @@ static int DecoderOpen( vlc_object_t *p_this ) p_dec->fmt_out.i_codec = p_dec->fmt_in.i_codec; p_dec->fmt_in.audio.i_bitspersample = 32; } + else if( p_dec->fmt_in.i_codec == VLC_FOURCC( 'i', 'n', '3', '2' ) ) + { + /* FIXME: mplayer uses bigendian for in24 .... but here it works + * with little endian ... weird */ + p_dec->fmt_out.i_codec = VLC_FOURCC( 's', '3', '2', 'l' ); + p_dec->fmt_in.audio.i_bitspersample = 32; + } else if( p_dec->fmt_in.i_codec == VLC_FOURCC( 's', '2', '4', 'l' ) || p_dec->fmt_in.i_codec == VLC_FOURCC( 's', '2', '4', 'b' ) ) { p_dec->fmt_out.i_codec = p_dec->fmt_in.i_codec; p_dec->fmt_in.audio.i_bitspersample = 24; } + else if( p_dec->fmt_in.i_codec == VLC_FOURCC( 'i', 'n', '2', '4' ) ) + { + p_dec->fmt_out.i_codec = VLC_FOURCC( 's', '2', '4', 'b' ); + p_dec->fmt_in.audio.i_bitspersample = 24; + } + else if( p_dec->fmt_in.i_codec == VLC_FOURCC( '4', '2', 'n', 'i' ) ) + { + p_dec->fmt_out.i_codec = VLC_FOURCC( 's', '2', '4', 'l' ); + p_dec->fmt_in.audio.i_bitspersample = 24; + } else if( p_dec->fmt_in.i_codec == VLC_FOURCC( 's', '1', '6', 'l' ) || p_dec->fmt_in.i_codec == VLC_FOURCC( 's', '1', '6', 'b' ) ) { @@ -274,7 +303,8 @@ static int DecoderOpen( vlc_object_t *p_this ) return VLC_EGENERIC; } } - else if( p_dec->fmt_in.i_codec == VLC_FOURCC( 'a', 'r', 'a', 'w' ) ) + else if( p_dec->fmt_in.i_codec == VLC_FOURCC( 'a', 'r', 'a', 'w' ) || + p_dec->fmt_in.i_codec == VLC_FOURCC( 'p', 'c', 'm', ' ' ) ) { switch( ( p_dec->fmt_in.audio.i_bitspersample + 7 ) / 8 ) { @@ -350,6 +380,7 @@ static int DecoderOpen( vlc_object_t *p_this ) p_sys->p_logtos16 = ulawtos16; p_dec->fmt_in.audio.i_bitspersample = 8; } + else return VLC_EGENERIC; /* Set output properties */ p_dec->fmt_out.i_cat = AUDIO_ES; @@ -1365,7 +1396,8 @@ static int EncoderOpen( vlc_object_t *p_this ) else if( p_enc->fmt_out.i_codec == VLC_FOURCC('u','2','4','l') || p_enc->fmt_out.i_codec == VLC_FOURCC('u','2','4','b') || p_enc->fmt_out.i_codec == VLC_FOURCC('s','2','4','l') || - p_enc->fmt_out.i_codec == VLC_FOURCC('s','2','4','b') ) + p_enc->fmt_out.i_codec == VLC_FOURCC('s','2','4','b') || + p_enc->fmt_out.i_codec == VLC_FOURCC('i','n','2','4') ) { p_enc->fmt_out.audio.i_bitspersample = 24; } @@ -1373,6 +1405,7 @@ static int EncoderOpen( vlc_object_t *p_this ) p_enc->fmt_out.i_codec == VLC_FOURCC('u','3','2','b') || p_enc->fmt_out.i_codec == VLC_FOURCC('s','3','2','l') || p_enc->fmt_out.i_codec == VLC_FOURCC('s','3','2','b') || + p_enc->fmt_out.i_codec == VLC_FOURCC('i','n','3','2') || p_enc->fmt_out.i_codec == VLC_FOURCC('f','i','3','2') || p_enc->fmt_out.i_codec == VLC_FOURCC('f','l','3','2') ) { @@ -1413,6 +1446,11 @@ static int EncoderOpen( vlc_object_t *p_this ) p_sys->i_s16tolog = ULAW; } + p_enc->fmt_out.i_bitrate = + p_enc->fmt_in.audio.i_channels * + p_enc->fmt_in.audio.i_rate * + p_enc->fmt_in.audio.i_bitspersample; + msg_Dbg( p_enc, "samplerate:%dHz channels:%d bits/sample:%d", p_enc->fmt_out.audio.i_rate, p_enc->fmt_out.audio.i_channels, p_enc->fmt_out.audio.i_bitspersample ); @@ -1425,7 +1463,7 @@ static int EncoderOpen( vlc_object_t *p_this ) *****************************************************************************/ static void EncoderClose ( vlc_object_t *p_this ) { - return; + VLC_UNUSED(p_this); } /*****************************************************************************