[Ffmpeg-devel] [PATCH] ADTS muxer

Måns Rullgård mru
Fri Feb 10 00:10:41 CET 2006


Baptiste COUDURIER <baptiste.coudurier at smartjog.com> writes:

> Hi,
>
> Here is an ADTS muxer. I think it will solve Erik Slagter problem with
> gpac. Does it worker for you Erik ?
>
> +static int adts_write_aac_header(ADTSContext *ctx, int size)
> +{
> +    PutBitContext pb;
> +    uint8_t buffer[ADTS_HEADER_SIZE];
> +
> +    init_put_bits(&pb, buffer, ADTS_HEADER_SIZE);
> +    put_bits(&pb, 12, 0xfff);
> +    put_bits(&pb, 1, 0);
> +    put_bits(&pb, 2, 0);
> +    put_bits(&pb, 1, 0); /* protection present ? */
> +    put_bits(&pb, 2, 0);
> +    put_bits(&pb, 2, ctx->sample_rate_index);
> +    put_bits(&pb, 1, 0);
> +    put_bits(&pb, 3, ctx->enc->channels);
> +    put_bits(&pb, 1, 0);
> +    put_bits(&pb, 1, 0);
> +
> +
> +    /* adts variable header */
> +    put_bits(&pb, 1, 0);
> +    put_bits(&pb, 1, 0);
> +    put_bits(&pb, 13, size); /* size */
> +    put_bits(&pb, 11, 0);
> +    put_bits(&pb, 2, 0);
> +    flush_put_bits(&pb);
> +    return 0;
> +}

This will not create a valid adts frame header.  Furthermore, you are
never actually writing it to the output.

Annoyingly, documentation for AAC seems notoriously difficult to find.
Worse, the various drafts I've managed to come across vary quite
considerably.

-- 
M?ns Rullg?rd
mru at inprovide.com





More information about the ffmpeg-devel mailing list