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

Ronald S. Bultje rsbultje
Tue Mar 31 21:00:21 CEST 2009


Hi,

On Tue, Mar 31, 2009 at 1:45 PM, zhentan feng <spyfeng at gmail.com> wrote:
>> > + ? ?if (waveformatextensible) { ? ? ? ? ? ? ? ? ? ? /* write
>> WAVEFORMATEXTENSIBLE extensions */
>> > + ? ? ? ?update_size_pos = url_ftell(pb);
>> > + ? ? ? ?put_le16(pb, enc->extradata_size+22); ? ? ? /* 22 is the size of
>> WAVEFORMATEXTENSIBLE-WAVEFORMATEX */
[..]
>> > + ? ?if (!url_is_streamed(pb)){
>> > + ? ? ? ?if (hdrsize > 40 && waveformatextensible) { /* ?40 means 22
>> WAVEFORMATEXTENSBLE size + 18 */
>> > + ? ? ? ? ? ?pos = url_ftell(pb);
>> > + ? ? ? ? ? ?url_fseek(pb, update_size_pos, SEEK_SET);
>> > + ? ? ? ? ? ?put_le16(pb, hdrsize - 18);
>> > + ? ? ? ? ? ?url_fseek(pb, pos, SEEK_SET);
>> > + ? ? ? ?}
>> > + ? ?}
>>
>> fails if url_is_streamed

This isn't needed at all.

Zhentan, just calculate the size in advance, don't do unnecessary
seeking, it will complicate your code in the end. Just calculate the
size of the data after the default tag, and write it correctly
directly. You know (or can within reasonable terms calculate) the data
size in advance.

Ronald



More information about the ffmpeg-devel mailing list