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

zhentan feng spyfeng
Tue Mar 31 13:47:59 CEST 2009


Hi

2009/3/31 Michael Niedermayer <michaelni at gmx.at>

> On Tue, Mar 31, 2009 at 09:46:29AM +0800, zhentan feng wrote:
> > Hi
> >
> > 2009/3/31 Michael Niedermayer <michaelni at gmx.at>
> >
> > > [...]
> > > > here is the new patch for version 0.5.
> > > > according to get_wav_header() fucntion, write the
> WAVEFORMATEXTENSIBLE
> > > > struct first and update the extrasize if necessary.
> > > >
> > > [...]
> > > > @@ -343,16 +365,14 @@
> > > >          put_le16(pb, 16); /* fwHeadFlags */
> > > >          put_le32(pb, 0);  /* dwPTSLow */
> > > >          put_le32(pb, 0);  /* dwPTSHigh */
> > > > -    } else if (enc->codec_id == CODEC_ID_GSM_MS) {
> > > > -        put_le16(pb, 2); /* wav_extra_size */
> > > > +    } else if (enc->codec_id == CODEC_ID_GSM_MS || enc->codec_id ==
> > > CODEC_ID_ADPCM_IMA_WAV) {
> > > > +        if (!waveformatextensible)
> > > > +            put_le16(pb, 2); /* wav_extra_size */
> > > >          hdrsize += 2;
> > > >          put_le16(pb, enc->frame_size); /* wSamplesPerBlock */
> > > > -    } else if (enc->codec_id == CODEC_ID_ADPCM_IMA_WAV) {
> > > > -        put_le16(pb, 2); /* wav_extra_size */
> > > > -        hdrsize += 2;
> > > > -        put_le16(pb, enc->frame_size); /* wSamplesPerBlock */
> > > > -    } else if(enc->extradata_size){
> > > > -        put_le16(pb, enc->extradata_size);
> > > > +    } else if (enc->extradata_size){
> > > > +        if (!waveformatextensible)
> > > > +            put_le16(pb, enc->extradata_size);
> > > >          put_buffer(pb, enc->extradata, enc->extradata_size);
> > > >          hdrsize += enc->extradata_size;
> > > >          if(hdrsize&1){
> > >
> > > factorizing code should be in a seperate patch
> > >
> > >
> > > > @@ -363,6 +383,10 @@
> > > >          hdrsize -= 2;
> > > >      }
> > > >
> > > > +    if (hdrsize > 40 && waveformatextensible) { /*  40 means 22
> > > WAVEFORMATEXTENSBLE size + 18 */
> > > > +        put_le16(update_pb, hdrsize - 18);
> > > > +    }
> > > > +
> > > >      return hdrsize;
> > > >  }
> > > >
> > >
> > > this is not correct
> > >
> >
> > thanks for reviewing the patch.
> >
> > do you mean the if condition is not correct or the way of updating size
> is
> > wrong?
>
> the problem is that behind pb there can be a file, pipe, http or anything
> else, duplicating it like you do will lead to random results
>
>
> >
> > if it is the update size problem, is it correct to use url_feek() for
> > updating the size?
>
> url_fseek() may be an option
> pb does have its own internal buffer and as long as the seek can be done
> within this buffer it works, otherwise it depends on the ability of the
> underlaying protocol to be seekable.
> For example a pipe cant be seeked ...
>
> one issue with url_fseek() might be if extradata_size is bigger than the
> buffer, i dont remember if this case could lead to the rewriting in
> your code.
>
>
> [...]


here is new patch attached below.

-- 
Best wishes~
-------------- next part --------------
A non-text attachment was scrubbed...
Name: waveformatextensible_06.patch
Type: application/octet-stream
Size: 3774 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090331/3ab97c43/attachment.obj>



More information about the ffmpeg-devel mailing list