On Thu, Apr 07, 2011 at 12:18:53PM +0300, Martin Storsjö wrote:
> ---
>  Changelog                 |    1 +
>  configure                 |    6 ++
>  libavcodec/Makefile       |    1 +
>  libavcodec/allcodecs.c    |    1 +
>  libavcodec/libvo-aacenc.c |  132 
> +++++++++++++++++++++++++++++++++++++++++++++
>  5 files changed, 141 insertions(+), 0 deletions(-)
>  create mode 100644 libavcodec/libvo-aacenc.c

minor bump, docs update

> --- /dev/null
> +++ b/libavcodec/libvo-aacenc.c
> @@ -0,0 +1,132 @@
> +/*
> + * AAC encoder wrapper
> + * Copyright (c) 2010 Martin Storsjo

2011?

> +#include "avcodec.h"
> +#include <vo-aacenc/voAAC.h>
> +#include <vo-aacenc/cmnMemory.h>
> +#include "mpeg4audio.h"

Place system headers before local headers, separate by an empty line.

> +typedef struct AACContext {
> +    VO_AUDIO_CODECAPI codec_api;
> +    VO_HANDLE handle;
> +    VO_MEM_OPERATOR mem_operator;
> +    VO_CODEC_INIT_USERDATA user_data;
> +} AACContext;
> +
> +static av_cold int aac_encode_init(AVCodecContext *avctx)
> +{
> +    AACContext *s = avctx->priv_data;
> +    AACENC_PARAM params;
> +    int index;
> +
> +    memset(&params, 0, sizeof(params));

Why not initialize params to 0 instead?

> +    avctx->coded_frame = avcodec_alloc_frame();
> +    avctx->frame_size = 1024;

> +    s->mem_operator.Alloc = cmnMemAlloc;
> +    s->mem_operator.Copy = cmnMemCopy;
> +    s->mem_operator.Free = cmnMemFree;
> +    s->mem_operator.Set = cmnMemSet;
> +    s->mem_operator.Check = cmnMemCheck;
> +    s->user_data.memflag = VO_IMF_USERMEMOPERATOR;
> +    s->user_data.memData = &s->mem_operator;
> +    s->codec_api.Init(&s->handle, VO_AUDIO_CodingAAC, &s->user_data);

> +    params.sampleRate = avctx->sample_rate;
> +    params.bitRate = avctx->bit_rate;
> +    params.nChannels = avctx->channels;
> +    params.adtsUsed = 0;

> +    avctx->extradata_size = 2;
> +    avctx->extradata = av_mallocz(avctx->extradata_size +
> +                                  FF_INPUT_BUFFER_PADDING_SIZE);

nit: align the '='

> +static int aac_encode_frame(AVCodecContext *avctx,
> +                            unsigned char *frame/*out*/,
> +                            int buf_size, void *data/*in*/)
> +{
> +    AACContext *s = avctx->priv_data;
> +    VO_CODECBUFFER input, output;
> +    VO_AUDIO_OUTPUTINFO output_info;
> +
> +    memset(&input,       0, sizeof(input));
> +    memset(&output,      0, sizeof(output));
> +    memset(&output_info, 0, sizeof(output_info));

same, initialize to 0

Diego
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to