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

Justin Ruggles justinruggles
Sun Jul 20 19:45:48 CEST 2008


Michael Niedermayer wrote:
> On Sun, Jul 20, 2008 at 12:26:43PM -0400, Justin Ruggles wrote:
>> Mathieu Velten wrote:
>>> regarding your previous comments, here is an other try :)
>>>
>>> [...]
>>  > +static void update_nb_samples_streaminfo(uint64_t nb_samples,
>> uint8_t *header)
>>> +{
>>> +    PutBitContext pb;
>>> +
>>> +    init_put_bits(&pb, header, FLAC_STREAMINFO_SIZE);
>>> +
>>> +    /* copy the beginning of the header */
>>> +    ff_copy_bits(&pb, header, 108);
>>> +    /* Write the number of samples in two times */
>>> +    put_bits(&pb, 24, (nb_samples >> 12));
>>> +    put_bits(&pb, 12, nb_samples);
>>> +    flush_put_bits(&pb);
>>> +    /* MD5 signature = 0 */
>>> +}
>> You don't need to create a whole new partially-duplicate function. You
>> can do something like:
> 
> or even better just call the existig write_streaminfo()
> its not as if the function is over its best before date when the fileend
> is reached.

I was implying that the existing function be modified.  But yes, I
overlooked the fact that it should work now as-is (with the addition of
writing nb_samples of course).  avctx->frame_size will be the full
normal size for the last call since CODEC_CAP_DELAY is used.

Thanks,
Justin




More information about the ffmpeg-devel mailing list