On Sat, Apr 07, 2012 at 10:51:43PM -0700, Luca Barbato wrote:
>
> --- a/doc/general.texi
> +++ b/doc/general.texi
> @@ -625,6 +625,8 @@ following image formats are supported:
> @multitable @columnfractions .4 .1 .1 .4
> @item Name @tab Encoding @tab Decoding @tab Comments
> @item 8SVX audio @tab @tab X
> +@item AAC+ @tab E @tab X
> + @tab encoding supported through external library libaacplus
> @item AAC @tab E @tab X
> @tab encoding supported through external library libfaac and libvo-aacenc
> @item AC-3 @tab IX @tab X
Move this below the AAC entry.
> --- /dev/null
> +++ b/libavcodec/libaacplus.c
> @@ -0,0 +1,134 @@
> +/*
> + * Interface to libaacplus for aac+ (sbr+ps) encoding
AAC+ (SBR + PS)
> +#include "avcodec.h"
> +#include <aacplus.h>
#include <aacplus.h>
#include "avcodec.h"
> +typedef struct aacPlusAudioContext {
> + aacplusEncHandle aacplus_handle;
> +} aacPlusAudioContext;
Why not use the encapsulated member directly?
> + /* number of channels */
> + if (avctx->channels < 1 || avctx->channels > 2) {
> + av_log(avctx, AV_LOG_ERROR, "encoding %d channel(s) is not
> allowed\n", avctx->channels);
long line
> + s->aacplus_handle = aacplusEncOpen(avctx->sample_rate,
> + avctx->channels,
> + &samples_input, &max_bytes_output);
> + if(!s->aacplus_handle) {
> + av_log(avctx, AV_LOG_ERROR, "can't open encoder\n");
> + return -1;
> + }
if (, indentation
> + /* put the options in the configuration struct */
> + if(avctx->profile != FF_PROFILE_AAC_LOW && avctx->profile !=
> FF_PROFILE_UNKNOWN) {
> + av_log(avctx, AV_LOG_ERROR, "invalid AAC profile: %d, only LC
> supported\n", avctx->profile);
> + aacplusEncClose(s->aacplus_handle);
> + return -1;
> + }
same, long line
> + aacplus_cfg->bitRate = avctx->bit_rate;
> + aacplus_cfg->bandWidth = avctx->cutoff;
> + aacplus_cfg->outputFormat = !(avctx->flags & CODEC_FLAG_GLOBAL_HEADER);
> + aacplus_cfg->inputFormat = AACPLUS_INPUT_16BIT;
align
> + if (!aacplusEncSetConfiguration(s->aacplus_handle, aacplus_cfg)) {
> + av_log(avctx, AV_LOG_ERROR, "libaacplus doesn't support this output
> format!\n");
> + return -1;
> + }
> +
> + avctx->frame_size = samples_input / avctx->channels;
> +
> + avctx->coded_frame= avcodec_alloc_frame();
> + avctx->coded_frame->key_frame= 1;
> + /* Set decoder specific info */
> + avctx->extradata_size = 0;
align
> + if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER) {
> +
> + unsigned char *buffer = NULL;
> + unsigned long decoder_specific_info_size;
nit: drop empty line
> + if (aacplusEncGetDecoderSpecificInfo(s->aacplus_handle, &buffer,
> + &decoder_specific_info_size) ==
> 1) {
indentation
> + avctx->extradata = av_malloc(decoder_specific_info_size +
> FF_INPUT_BUFFER_PADDING_SIZE);
unchecked_malloc++;
> +#undef free
> + free(buffer);
> +#define free please_use_av_free
?
> +static int aacPlus_encode_frame(AVCodecContext *avctx,
> + unsigned char *frame, int buf_size, void *data)
indentation
> +{
> + aacPlusAudioContext *s = avctx->priv_data;
> + int bytes_written;
> +
> + bytes_written = aacplusEncEncode(s->aacplus_handle,
> + data,
> + avctx->frame_size * avctx->channels,
> + frame,
> + buf_size);
ditto
> +AVCodec ff_libaacplus_encoder = {
> + "libaacplus",
> + AVMEDIA_TYPE_AUDIO,
> + CODEC_ID_AAC,
> + sizeof(aacPlusAudioContext),
> + aacPlus_encode_init,
> + aacPlus_encode_frame,
> + aacPlus_encode_close,
> + .sample_fmts = (const enum
> SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
> + .long_name = NULL_IF_CONFIG_SMALL("libaacplus AAC+ (Advanced Audio Codec
> with SBR+PS)"),
> +};
designated initializers please
Diego
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel