[FFmpeg-devel] [PATCH] riff: make the G723.1 in wav output compatible with WMP/msacm codec

Michael Niedermayer michaelni at gmx.at
Tue Jul 24 20:10:04 CEST 2012


On Tue, Jul 24, 2012 at 11:42:55AM +0200, Piotr Bandurski wrote:
> Attached patch (together with demuxing patch) allows WMP/msacm G723.1 codec decode files encoded by FFmpeg.

> diff --git a/libavformat/riff.c b/libavformat/riff.c
> index e3cf459..38175d0 100644
> --- a/libavformat/riff.c
> +++ b/libavformat/riff.c
> @@ -482,6 +482,8 @@ int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc)
>          //blkalign = 144 * enc->bit_rate/enc->sample_rate;
>      } else if (enc->codec_id == CODEC_ID_AC3) {
>              blkalign = 3840; //maximum bytes per frame
> +    } else if (enc->codec_id == CODEC_ID_G723_1) {
> +            blkalign = 24;
>      } else if (enc->block_align != 0) { /* specified by the codec */
>          blkalign = enc->block_align;
>      } else
> @@ -493,6 +495,8 @@ int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc)
>          enc->codec_id == CODEC_ID_PCM_F64LE ||
>          enc->codec_id == CODEC_ID_PCM_S16LE) {
>          bytespersec = enc->sample_rate * blkalign;
> +    } else if (enc->codec_id == CODEC_ID_G723_1) {
> +        bytespersec = 800;
>      } else {
>          bytespersec = enc->bit_rate / 8;
>      }

g723.1 supports multiple bitrates, is this correct for all ?


> @@ -516,6 +520,11 @@ int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc)
>          bytestream_put_le16(&riff_extradata, 16);                         /* fwHeadFlags */
>          bytestream_put_le32(&riff_extradata, 0);                          /* dwPTSLow */
>          bytestream_put_le32(&riff_extradata, 0);                          /* dwPTSHigh */
> +    } else if (enc->codec_id == CODEC_ID_G723_1) {
> +        hdrsize += 20;
> +        bytestream_put_le32(&riff_extradata, 0x9ace0002); /* extradata needed for msacm g723.1 codec */
> +        bytestream_put_le32(&riff_extradata, 0xaea2f732);
> +        bytestream_put_le16(&riff_extradata, 0xacde);

i assume noone has an idea what these are ?
I could find a spec for g723 in wav but not g723.1 ...

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The real ebay dictionary, page 3
"Rare item" - "Common item with rare defect or maybe just a lie"
"Professional" - "'Toy' made in china, not functional except as doorstop"
"Experts will know" - "The seller hopes you are not an expert"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120724/fa4e81f4/attachment.asc>


More information about the ffmpeg-devel mailing list