[FFmpeg-devel] [PATCH] flac encoding, issue 526

Justin Ruggles justinruggles
Sat Jul 19 20:07:37 CEST 2008


Justin Ruggles wrote:
> Justin Ruggles wrote:
>> Mathieu Velten wrote:
>>> new patch attached
>>>
>>> if ((data == NULL) || (avctx->frame_size != s->frame.blocksize)) {
>>>      write_streaminfo(s, avctx->extradata);
>>> }
>>>
>>> this is also execute during the first frame, so the header stored in
>>> extradata will have the length of the first frame instead of 0 during
>>> the encoding.
>>> is it a problem ?
>> Yes, it's a problem.  Check for the last frame at the beginning of
>> flac_encode_frame().
>>
>> int last_frame = (data == NULL) || (avctx->frame_size != s->frame.blocksize)
>>
>> ...
>>
>> if(last_frame)
>>     write_streaminfo(...)
> 
> Oh, I see what you mean.  You also need to set s->frame.blocksize in
> flac_encode_init().

A simple solution might be something like:

1. add full_blocksize to the FlacEncodeContext
2. set avctx->frame_size and s->full_blocksize at flac_encode_init()
3. use s->full_blocksize to write the block size to the header in
write_streaminfo()
4. check the current avctx->frame_size against s->full_blocksize to
check for last frame.

-Justin




More information about the ffmpeg-devel mailing list