From: Gildas Bazin Date: Mon, 23 Feb 2004 23:01:05 +0000 (+0000) Subject: * modules/demux/wav.c: more fixes for multichannel wav files support. X-Git-Tag: 0.7.1~73 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=5fc353732109802357706fcde7202462767e2d2e;p=vlc * modules/demux/wav.c: more fixes for multichannel wav files support. * include/codecs.h: ms speakers definitions. * modules/codec/araw.c: added support for fl64 fourcc. --- diff --git a/include/codecs.h b/include/codecs.h index 82179f50f0..1e3f30f4a8 100644 --- a/include/codecs.h +++ b/include/codecs.h @@ -2,7 +2,7 @@ * codecs.h: codec related structures needed by the demuxers and decoders ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: codecs.h,v 1.11 2004/02/14 17:03:33 gbazin Exp $ + * $Id: codecs.h,v 1.12 2004/02/23 23:01:05 gbazin Exp $ * * Author: Gildas Bazin * @@ -126,8 +126,7 @@ typedef struct unsigned int i_id; } dvb_spuinfo_t; -/* WAVE form wFormatTag IDs */ - +/* WAVE format wFormatTag IDs */ #define WAVE_FORMAT_UNKNOWN 0x0000 /* Microsoft Corporation */ #define WAVE_FORMAT_PCM 0x0001 /* Microsoft Corporation */ #define WAVE_FORMAT_ADPCM 0x0002 /* Microsoft Corporation */ @@ -155,6 +154,27 @@ typedef struct #define WAVE_FORMAT_EXTENSIBLE 0xFFFE /* Microsoft */ #endif +/* Microsoft speaker definitions */ +#define WAVE_SPEAKER_FRONT_LEFT 0x1 +#define WAVE_SPEAKER_FRONT_RIGHT 0x2 +#define WAVE_SPEAKER_FRONT_CENTER 0x4 +#define WAVE_SPEAKER_LOW_FREQUENCY 0x8 +#define WAVE_SPEAKER_BACK_LEFT 0x10 +#define WAVE_SPEAKER_BACK_RIGHT 0x20 +#define WAVE_SPEAKER_FRONT_LEFT_OF_CENTER 0x40 +#define WAVE_SPEAKER_FRONT_RIGHT_OF_CENTER 0x80 +#define WAVE_SPEAKER_BACK_CENTER 0x100 +#define WAVE_SPEAKER_SIDE_LEFT 0x200 +#define WAVE_SPEAKER_SIDE_RIGHT 0x400 +#define WAVE_SPEAKER_TOP_CENTER 0x800 +#define WAVE_SPEAKER_TOP_FRONT_LEFT 0x1000 +#define WAVE_SPEAKER_TOP_FRONT_CENTER 0x2000 +#define WAVE_SPEAKER_TOP_FRONT_RIGHT 0x4000 +#define WAVE_SPEAKER_TOP_BACK_LEFT 0x8000 +#define WAVE_SPEAKER_TOP_BACK_CENTER 0x10000 +#define WAVE_SPEAKER_TOP_BACK_RIGHT 0x20000 +#define WAVE_SPEAKER_RESERVED 0x80000000 + static struct { uint16_t i_tag; @@ -165,7 +185,7 @@ wave_format_tag_to_fourcc[] = { { WAVE_FORMAT_PCM, VLC_FOURCC( 'a', 'r', 'a', 'w' ), "Raw audio" }, { WAVE_FORMAT_ADPCM, VLC_FOURCC( 'm', 's', 0x00,0x02), "Adpcm" }, - { WAVE_FORMAT_IEEE_FLOAT, VLC_FOURCC( 'f', 'l', '3', '2' ), "IEEE Float audio" }, + { WAVE_FORMAT_IEEE_FLOAT, VLC_FOURCC( 'a', 'f', 'l', 't' ), "IEEE Float audio" }, { WAVE_FORMAT_ALAW, VLC_FOURCC( 'a', 'l', 'a', 'w' ), "A-Law" }, { WAVE_FORMAT_MULAW, VLC_FOURCC( 'm', 'l', 'a', 'w' ), "Mu-Law" }, { WAVE_FORMAT_IMA_ADPCM,VLC_FOURCC( 'm', 's', 0x00,0x11), "Ima-Adpcm" }, diff --git a/modules/codec/araw.c b/modules/codec/araw.c index 219610c1f2..946e84c02c 100644 --- a/modules/codec/araw.c +++ b/modules/codec/araw.c @@ -2,7 +2,7 @@ * araw.c: Pseudo audio decoder; for raw pcm data ***************************************************************************** * Copyright (C) 2001, 2003 VideoLAN - * $Id: araw.c,v 1.29 2004/02/14 17:03:32 gbazin Exp $ + * $Id: araw.c,v 1.30 2004/02/23 23:01:05 gbazin Exp $ * * Authors: Laurent Aimar * @@ -160,7 +160,7 @@ static int DecoderOpen( vlc_object_t *p_this ) { /* from wav/avi/asf file */ case VLC_FOURCC('a','r','a','w'): - case VLC_FOURCC('f','l','3','2'): + case VLC_FOURCC('a','f','l','t'): /* _signed_ big endian samples (mov)*/ case VLC_FOURCC('t','w','o','s'): /* _signed_ little endian samples (mov)*/ @@ -202,13 +202,16 @@ static int DecoderOpen( vlc_object_t *p_this ) p_dec->fmt_in.audio.i_rate, p_dec->fmt_in.audio.i_channels, p_dec->fmt_in.audio.i_bitspersample ); - if( p_dec->fmt_in.i_codec == VLC_FOURCC( 'f', 'l', '3', '2' ) ) + if( p_dec->fmt_in.i_codec == VLC_FOURCC( 'a', 'f', 'l', 't' ) ) { switch( ( p_dec->fmt_in.audio.i_bitspersample + 7 ) / 8 ) { case 4: p_dec->fmt_out.i_codec = VLC_FOURCC('f','l','3','2'); break; + case 8: + p_dec->fmt_out.i_codec = VLC_FOURCC('f','l','6','4'); + break; default: msg_Err( p_dec, "bad parameters(bits/sample)" ); return VLC_EGENERIC; diff --git a/modules/demux/wav.c b/modules/demux/wav.c index 8aef31e46f..d2ac680b7a 100644 --- a/modules/demux/wav.c +++ b/modules/demux/wav.c @@ -2,7 +2,7 @@ * wav.c : wav file input module for vlc ***************************************************************************** * Copyright (C) 2001-2003 VideoLAN - * $Id: wav.c,v 1.13 2004/02/14 17:03:32 gbazin Exp $ + * $Id: wav.c,v 1.14 2004/02/23 23:01:05 gbazin Exp $ * * Authors: Laurent Aimar * @@ -118,7 +118,7 @@ static int Open( vlc_object_t * p_this ) msg_Err( p_input, "invalid 'fmt ' chunk" ); goto error; } - stream_Read( p_input->s, NULL, 8 ); /* cannot fail */ + stream_Read( p_input->s, NULL, 8 ); /* Cannot fail */ /* load waveformatex */ p_wf = (WAVEFORMATEX *)p_wf_ext = malloc( __EVEN( i_size ) + 2 ); @@ -143,7 +143,7 @@ static int Open( vlc_object_t * p_this ) /* Handle new WAVE_FORMAT_EXTENSIBLE wav files */ if( GetWLE( &p_wf->wFormatTag ) == WAVE_FORMAT_EXTENSIBLE && - i_size >= sizeof( WAVEFORMATEXTENSIBLE ) - 2 ) + i_size >= sizeof( WAVEFORMATEXTENSIBLE ) ) { wf_tag_to_fourcc( GetWLE( &p_wf_ext->SubFormat ), &p_sys->fmt.i_codec, &psz_name ); @@ -158,8 +158,8 @@ static int Open( vlc_object_t * p_this ) p_sys->fmt.i_extra ); } - msg_Dbg( p_input, "format: 0x%4.4x fourcc: %4.4s channels: %d " - "freq: %d Hz bitrate: %dKo/s blockalign: %d bits/samples: %d " + msg_Dbg( p_input, "format: 0x%4.4x, fourcc: %4.4s, channels: %d, " + "freq: %d Hz, bitrate: %dKo/s, blockalign: %d, bits/samples: %d, " "extra size: %d", GetWLE( &p_wf->wFormatTag ), (char *)&p_sys->fmt.i_codec, p_sys->fmt.audio.i_channels, p_sys->fmt.audio.i_rate, @@ -171,7 +171,7 @@ static int Open( vlc_object_t * p_this ) switch( p_sys->fmt.i_codec ) { case VLC_FOURCC( 'a', 'r', 'a', 'w' ): - case VLC_FOURCC( 'f', 'l', '3', '2' ): + case VLC_FOURCC( 'a', 'f', 'l', 't' ): case VLC_FOURCC( 'u', 'l', 'a', 'w' ): case VLC_FOURCC( 'a', 'l', 'a', 'w' ): FrameInfo_PCM( p_input, &p_sys->i_frame_size, &p_sys->i_frame_length ); @@ -207,11 +207,9 @@ static int Open( vlc_object_t * p_this ) msg_Err( p_input, "cannot find 'data' chunk" ); goto error; } - + stream_Read( p_input->s, NULL, 8 ); /* Cannot fail */ p_sys->i_data_pos = stream_Tell( p_input->s ); - stream_Read( p_input->s, NULL, 8 ); /* cannot fail */ - /* Create one program */ vlc_mutex_lock( &p_input->stream.stream_lock ); if( input_InitStream( p_input, 0 ) == -1)