[FFmpeg-devel] Add waveformat extensible support in wav muxer (SoC qualification task)

zhentan feng spyfeng
Mon Apr 6 04:51:57 CEST 2009


Hi

2009/4/6 Michael Niedermayer <michaelni at gmx.at>

> [...]
> > +    waveformatextensible = enc->channels > 2 && enc->channel_layout;
> > +    if (waveformatextensible) {
> > +        put_le16(pb, 0xfffe);
> > +    } else {
> > +    put_le16(pb, enc->codec_tag);
> > +    }
> >
> > -    put_le16(pb, enc->codec_tag);
>
> this looks strange
>

fixed, and changed indent in a separate patch named ident.patch as below.

>
>
> >      put_le16(pb, enc->channels);
> >      put_le32(pb, enc->sample_rate);
> >      if (enc->codec_id == CODEC_ID_MP2 || enc->codec_id == CODEC_ID_MP3
> || enc->codec_id == CODEC_ID_GSM_MS) {
> > @@ -326,43 +336,54 @@
> >      put_le16(pb, blkalign); /* block align */
> >      put_le16(pb, bps); /* bits per sample */
> >      if (enc->codec_id == CODEC_ID_MP3) {
> > -        put_le16(pb, 12); /* wav_extra_size */
> >          hdrsize += 12;
> > -        put_le16(pb, 1); /* wID */
> > -        put_le32(pb, 2); /* fdwFlags */
> > -        put_le16(pb, 1152); /* nBlockSize */
> > -        put_le16(pb, 1); /* nFramesPerBlock */
> > -        put_le16(pb, 1393); /* nCodecDelay */
>
> > +        bytestream_put_le16(&riff_extradata, 1); /* wID */
> > +        bytestream_put_le32(&riff_extradata, 2); /* fdwFlags */
> > +        bytestream_put_le16(&riff_extradata, 1152); /* nBlockSize */
> > +        bytestream_put_le16(&riff_extradata, 1); /* nFramesPerBlock */
> > +        bytestream_put_le16(&riff_extradata, 1393); /* nCodecDelay */
>
> vertical align
>

fixed. see waveformatextensible_15.patch

>
>
> [...]
> >      } else if(enc->extradata_size){
> > -        put_le16(pb, enc->extradata_size);
> > -        put_buffer(pb, enc->extradata, enc->extradata_size);
> > +        riff_extradata_start= enc->extradata;
> > +        riff_extradata= enc->extradata + enc->extradata_size;
> >          hdrsize += enc->extradata_size;
> > -        if(hdrsize&1){
> > -            hdrsize++;
> > -            put_byte(pb, 0);
> > -        }
> >      } else {
> >          hdrsize -= 2;
> >      }
> > +    if(waveformatextensible) {                      /* write
> WAVEFORMATEXTENSIBLE extensions */
> > +        if (riff_extradata == riff_extradata_start)
> > +            hdrsize += 2;
> > +        hdrsize += 22;
> > +        put_le16(pb, riff_extradata - riff_extradata_start + 22); /* 22
> is WAVEFORMATEXTENSIBLE size */
> > +        put_le16(pb, enc->bits_per_coded_sample);   /*
> ValidBitsPerSample || SamplesPerBlock || Reserved */
> > +        put_le32(pb, enc->channel_layout);          /* dwChannelMask */
> > +        put_le32(pb, enc->codec_tag);               /* GUID + next 3 */
> > +        put_le32(pb, 0x00100000);
> > +        put_le32(pb, 0xAA000080);
> > +        put_le32(pb, 0x719B3800);
> > +    } else if(riff_extradata - riff_extradata_start) {
> > +        put_le16(pb, riff_extradata - riff_extradata_start);
> > +    }
>
> now its a mess again
>

please see waveformatextensible_15.patch.

thanks
zhentan
-- 
Best wishes~
-------------- next part --------------
A non-text attachment was scrubbed...
Name: waveformatextensible_15.patch
Type: application/octet-stream
Size: 5076 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090406/f124ada8/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: indent.patch
Type: application/octet-stream
Size: 711 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090406/f124ada8/attachment-0001.obj>



More information about the ffmpeg-devel mailing list