From: Srikanth Raju Date: Fri, 27 Mar 2009 21:04:12 +0000 (+0530) Subject: Wav GSM Demuxer Support Fixes Wav demux to work with MS-GSM codec. Uses ffmpeg decoder. X-Git-Tag: 1.0.0-pre2~353 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=aaddb130d42824b0f63e48059efd1c2829a30dac;p=vlc Wav GSM Demuxer Support Fixes Wav demux to work with MS-GSM codec. Uses ffmpeg decoder. Signed-off-by: Laurent Aimar --- diff --git a/include/vlc_codecs.h b/include/vlc_codecs.h index d31b539c85..85176d0205 100644 --- a/include/vlc_codecs.h +++ b/include/vlc_codecs.h @@ -305,7 +305,7 @@ wave_format_tag_to_fourcc[] = { 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" }, - { WAVE_FORMAT_GSM610, VLC_FOURCC( 'g', 's', 'm', ' ' ), "GSM 610" }, + { WAVE_FORMAT_GSM610, VLC_FOURCC( 'a', 'g', 's', 'm' ), "Microsoft WAV GSM" }, { WAVE_FORMAT_G726, VLC_FOURCC( 'g', '7', '2', '6' ), "G.726 ADPCM" }, { WAVE_FORMAT_MPEGLAYER3, VLC_FOURCC( 'm', 'p', 'g', 'a' ), "Mpeg Audio" }, { WAVE_FORMAT_MPEG, VLC_FOURCC( 'm', 'p', 'g', 'a' ), "Mpeg Audio" }, diff --git a/modules/codec/avcodec/fourcc.c b/modules/codec/avcodec/fourcc.c index 3886875aea..6f8fc8322c 100644 --- a/modules/codec/avcodec/fourcc.c +++ b/modules/codec/avcodec/fourcc.c @@ -1046,7 +1046,7 @@ static const struct #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 51, 34, 0 ) { VLC_FOURCC('g','s','m',' '), CODEC_ID_GSM, AUDIO_ES, "GSM Audio" }, - { VLC_FOURCC('g','s','m','s'), CODEC_ID_GSM_MS, + { VLC_FOURCC('a','g','s','m'), CODEC_ID_GSM_MS, /* According to http://wiki.multimedia.cx/index.php?title=GSM */ AUDIO_ES, "Microsoft GSM Audio" }, #endif diff --git a/modules/demux/wav.c b/modules/demux/wav.c index be7f848baf..cf66ce9d7e 100644 --- a/modules/demux/wav.c +++ b/modules/demux/wav.c @@ -78,6 +78,7 @@ static int ChunkFind( demux_t *, const char *, unsigned int * ); static void FrameInfo_IMA_ADPCM( demux_t *, unsigned int *, int * ); static void FrameInfo_MS_ADPCM ( demux_t *, unsigned int *, int * ); static void FrameInfo_PCM ( demux_t *, unsigned int *, int * ); +static void FrameInfo_MSGSM ( demux_t *, unsigned int *, int * ); static const uint32_t pi_channels_src[] = { WAVE_SPEAKER_FRONT_LEFT, WAVE_SPEAKER_FRONT_RIGHT, @@ -263,6 +264,10 @@ static int Open( vlc_object_t * p_this ) case VLC_FOURCC( 'a', '5', '2', ' ' ): /* FIXME set end of area FIXME */ goto error; + case VLC_FOURCC( 'a', 'g', 's', 'm' ): + FrameInfo_MSGSM( p_demux, &p_sys->i_frame_size, + &p_sys->i_frame_samples ); + break; default: msg_Err( p_demux, "unsupported codec (%4.4s)", (char*)&p_sys->fmt.i_codec ); @@ -454,3 +459,13 @@ static void FrameInfo_IMA_ADPCM( demux_t *p_demux, unsigned int *pi_size, *pi_size = p_sys->fmt.audio.i_blockalign; } + +static void FrameInfo_MSGSM( demux_t *p_demux, unsigned int *pi_size, + int *pi_samples ) +{ + demux_sys_t *p_sys = p_demux->p_sys; + + *pi_samples = ( p_sys->fmt.audio.i_blockalign * p_sys->fmt.audio.i_rate * 8) + / p_sys->fmt.i_bitrate; + *pi_size = p_sys->fmt.audio.i_blockalign; +}