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

zhentan feng spyfeng
Wed Apr 8 03:10:00 CEST 2009


Hi

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

> On Mon, Apr 06, 2009 at 10:51:57AM +0800, zhentan feng wrote:
> > 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.
>
> looks ok if it works and has been tested
>
>
I have tested the patch and it passed the regression test and can mux
correct multi-channel wave files.
any replies or further improvments for the latest patches?

thanks
zhentan
-- 
Best wishes~



More information about the ffmpeg-devel mailing list