[FFmpeg-devel] Add waveformat extensible support in wav muxer (SoC qualification task)
Michael Niedermayer
michaelni
Mon Apr 6 16:26:43 CEST 2009
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
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Breaking DRM is a little like attempting to break through a door even
though the window is wide open and the only thing in the house is a bunch
of things you dont want and which you would get tomorrow for free anyway
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090406/3a703c1d/attachment.pgp>
More information about the ffmpeg-devel
mailing list