On Tue, Sep 06, 2011 at 08:19:51AM -0700, Kieran Kunhya wrote:
> Gone through the new formats checklist and added ALS support.

If you give me a command line to test with, I'll test and push this.
Also, what about adding some sort of FATE test?

> --- /dev/null
> +++ b/libavformat/latmenc.c
> @@ -0,0 +1,190 @@
> +static const AVOption options[] = {
> +    { "smc-interval", "StreamMuxConfig interval.",
> +      offsetof(LATMContext, mod), FF_OPT_TYPE_INT, {.dbl = 0x0014 }, 0x0001, 
> 0xffff, AV_OPT_FLAG_ENCODING_PARAM},

nit: inconsistent spacing around { and }

> +static const AVClass latm_muxer_class = {
> +    .class_name     = "LATM/LOAS muxer",
> +    .item_name      = av_default_item_name,
> +    .option         = options,
> +    .version        = LIBAVUTIL_VERSION_INT,

nit: lots of spaces before =

> +static int latm_decode_extradata(LATMContext *ctx, uint8_t *buf, int size)
> +{
> +    GetBitContext gb;
> +    MPEG4AudioConfig m4ac;
> +
> +    init_get_bits(&gb, buf, size * 8);
> +    ctx->off = ff_mpeg4audio_get_config(&m4ac, buf, size);
> +    if (ctx->off < 0)
> +        return ctx->off;
> +    skip_bits_long(&gb, ctx->off);
> +
> +    /* FIXME: are any formats not allowed in LATM? */
> +
> +    if (m4ac.object_type > AOT_SBR && m4ac.object_type != AOT_ALS) {
> +        av_log(ctx, AV_LOG_ERROR, "Muxing MPEG-4 AOT %d in LATM is not 
> supported\n", m4ac.object_type);
> +        return -1;

AVERROR_INVALIDDATA ?

> +static int latm_write_header(AVFormatContext *s)
> +{
> +    LATMContext *ctx = s->priv_data;
> +    AVCodecContext *avctx = s->streams[0]->codec;
> +
> +    if (avctx->extradata_size > 0 &&
> +        latm_decode_extradata(ctx, avctx->extradata, avctx->extradata_size) 
> < 0)
> +        return -1;

same?

> +        /* AudioSpecificConfig */
> +        if (ctx->object_type == AOT_ALS) {
> +            header_size = avctx->extradata_size-((ctx->off + 7) >> 3);
> +            ff_copy_bits(bs, &avctx->extradata[ctx->off], header_size);
> +        } else {
> +            ff_copy_bits(bs, avctx->extradata, ctx->off + 3);
> +
> +            if (!ctx->channel_conf) {
> +                ff_copy_pce_data(bs, &gb);
> +            }

nit: pointless {}

> +static int latm_write_packet(AVFormatContext *s, AVPacket *pkt)
> +{
> +    AVIOContext *pb = s->pb;
> +    PutBitContext bs;
> +    int i, len;
> +    uint8_t loas_header[] = "\x56\xe0\x00";
> +    uint8_t *buf;
> +
> +    if (pkt->size > 2 && pkt->data[0] == 0xff && (pkt->data[1] >> 4) == 0xf) 
> {
> +        av_log(s, AV_LOG_ERROR, "ADTS header detected - ADTS will not be 
> incorrectly muxed into LATM\n");
> +        return -1;

AVERROR_INVALIDDATA ?

> --- a/libavformat/version.h
> +++ b/libavformat/version.h
> @@ -24,7 +24,7 @@
>  #include "libavutil/avutil.h"
>  
>  #define LIBAVFORMAT_VERSION_MAJOR 53
> -#define LIBAVFORMAT_VERSION_MINOR  5
> +#define LIBAVFORMAT_VERSION_MINOR  7

You are skipping a version there.

Diego
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to