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

Justin Ruggles justinruggles
Sun Jul 20 18:26:43 CEST 2008


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:
static void write_streaminfo(..., int update_only)
{
    init
    if(update_only) {
        copy bits
    } else {
        write header stuff
    }
    write nb_samples
    flush
}

The rest of the patch looks ok.

-Justin




More information about the ffmpeg-devel mailing list