Revision d89e738a

View differences:

Changelog
83 83
- Linux framebuffer input device added
84 84
- Chronomaster DFA decoder
85 85
- Mobotix MxPEG decoder
86
- AAC encoding via libvo-aacenc
86 87

  
87 88

  
88 89
version 0.6:
configure
178 178
  --enable-libschroedinger enable Dirac support via libschroedinger [no]
179 179
  --enable-libspeex        enable Speex decoding via libspeex [no]
180 180
  --enable-libtheora       enable Theora encoding via libtheora [no]
181
  --enable-libvo-aacenc    enable AAC encoding via libvo-aacenc [no]
181 182
  --enable-libvorbis       enable Vorbis encoding via libvorbis,
182 183
                           native implementation exists [no]
183 184
  --enable-libvpx          enable VP8 support via libvpx [no]
......
937 938
    libschroedinger
938 939
    libspeex
939 940
    libtheora
941
    libvo_aacenc
940 942
    libvorbis
941 943
    libvpx
942 944
    libx264
......
1384 1386
libschroedinger_encoder_deps="libschroedinger"
1385 1387
libspeex_decoder_deps="libspeex"
1386 1388
libtheora_encoder_deps="libtheora"
1389
libvo_aacenc_encoder_deps="libvo_aacenc"
1387 1390
libvorbis_encoder_deps="libvorbis"
1388 1391
libvpx_decoder_deps="libvpx"
1389 1392
libvpx_encoder_deps="libvpx"
......
2525 2528

  
2526 2529
die_license_disabled version3 libopencore_amrnb
2527 2530
die_license_disabled version3 libopencore_amrwb
2531
die_license_disabled version3 libvo_aacenc
2528 2532

  
2529 2533
enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
2530 2534

  
......
2864 2868
enabled libschroedinger && require_pkg_config schroedinger-1.0 schroedinger/schro.h schro_init
2865 2869
enabled libspeex   && require  libspeex speex/speex.h speex_decoder_init -lspeex
2866 2870
enabled libtheora  && require  libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
2871
enabled libvo_aacenc && require libvo_aacenc vo-aacenc/voAAC.h voGetAACEncAPI -lvo-aacenc
2867 2872
enabled libvorbis  && require  libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
2868 2873
enabled libvpx     && {
2869 2874
    enabled libvpx_decoder && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_dec_init_ver -lvpx ||
......
3132 3137
echo "libspeex enabled          ${libspeex-no}"
3133 3138
echo "libtheora enabled         ${libtheora-no}"
3134 3139
echo "libva enabled             ${vaapi-no}"
3140
echo "libvo-aacenc support      ${libvo_aacenc-no}"
3135 3141
echo "libvorbis enabled         ${libvorbis-no}"
3136 3142
echo "libvpx enabled            ${libvpx-no}"
3137 3143
echo "libx264 enabled           ${libx264-no}"
doc/general.texi
540 540
@item Name @tab Encoding @tab Decoding @tab Comments
541 541
@item 8SVX audio             @tab     @tab  X
542 542
@item AAC                    @tab  E  @tab  X
543
    @tab encoding supported through external library libfaac
543
    @tab encoding supported through external library libfaac and libvo-aacenc
544 544
@item AC-3                   @tab IX  @tab  X
545 545
@item ADPCM 4X Movie         @tab     @tab  X
546 546
@item ADPCM CDROM XA         @tab     @tab  X
libavcodec/Makefile
568 568
                                             libdirac_libschro.o
569 569
OBJS-$(CONFIG_LIBSPEEX_DECODER)           += libspeexdec.o
570 570
OBJS-$(CONFIG_LIBTHEORA_ENCODER)          += libtheoraenc.o
571
OBJS-$(CONFIG_LIBVO_AACENC_ENCODER)       += libvo-aacenc.o mpeg4audio.o
571 572
OBJS-$(CONFIG_LIBVORBIS_ENCODER)          += libvorbis.o vorbis_data.o
572 573
OBJS-$(CONFIG_LIBVPX_DECODER)             += libvpxdec.o
573 574
OBJS-$(CONFIG_LIBVPX_ENCODER)             += libvpxenc.o
libavcodec/allcodecs.c
366 366
    REGISTER_ENCDEC  (LIBSCHROEDINGER, libschroedinger);
367 367
    REGISTER_DECODER (LIBSPEEX, libspeex);
368 368
    REGISTER_ENCODER (LIBTHEORA, libtheora);
369
    REGISTER_ENCODER (LIBVO_AACENC, libvo_aacenc);
369 370
    REGISTER_ENCODER (LIBVORBIS, libvorbis);
370 371
    REGISTER_ENCDEC  (LIBVPX, libvpx);
371 372
    REGISTER_ENCODER (LIBX264, libx264);
libavcodec/libvo-aacenc.c
1
/*
2
 * AAC encoder wrapper
3
 * Copyright (c) 2010 Martin Storsjo
4
 *
5
 * This file is part of Libav.
6
 *
7
 * Libav is free software; you can redistribute it and/or
8
 * modify it under the terms of the GNU Lesser General Public
9
 * License as published by the Free Software Foundation; either
10
 * version 2.1 of the License, or (at your option) any later version.
11
 *
12
 * Libav is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
 * Lesser General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU Lesser General Public
18
 * License along with Libav; if not, write to the Free Software
19
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
 */
21

  
22
#include <vo-aacenc/voAAC.h>
23
#include <vo-aacenc/cmnMemory.h>
24

  
25
#include "avcodec.h"
26
#include "mpeg4audio.h"
27

  
28
typedef struct AACContext {
29
    VO_AUDIO_CODECAPI codec_api;
30
    VO_HANDLE handle;
31
    VO_MEM_OPERATOR mem_operator;
32
    VO_CODEC_INIT_USERDATA user_data;
33
} AACContext;
34

  
35
static av_cold int aac_encode_init(AVCodecContext *avctx)
36
{
37
    AACContext *s = avctx->priv_data;
38
    AACENC_PARAM params = { 0 };
39
    int index;
40

  
41
    avctx->coded_frame = avcodec_alloc_frame();
42
    avctx->frame_size = 1024;
43

  
44
    voGetAACEncAPI(&s->codec_api);
45

  
46
    s->mem_operator.Alloc = cmnMemAlloc;
47
    s->mem_operator.Copy = cmnMemCopy;
48
    s->mem_operator.Free = cmnMemFree;
49
    s->mem_operator.Set = cmnMemSet;
50
    s->mem_operator.Check = cmnMemCheck;
51
    s->user_data.memflag = VO_IMF_USERMEMOPERATOR;
52
    s->user_data.memData = &s->mem_operator;
53
    s->codec_api.Init(&s->handle, VO_AUDIO_CodingAAC, &s->user_data);
54

  
55
    params.sampleRate = avctx->sample_rate;
56
    params.bitRate    = avctx->bit_rate;
57
    params.nChannels  = avctx->channels;
58
    params.adtsUsed   = !(avctx->flags & CODEC_FLAG_GLOBAL_HEADER);
59
    if (s->codec_api.SetParam(s->handle, VO_PID_AAC_ENCPARAM, &params)
60
        != VO_ERR_NONE) {
61
        av_log(avctx, AV_LOG_ERROR, "Unable to set encoding parameters\n");
62
        return AVERROR_UNKNOWN;
63
    }
64

  
65
    avctx->extradata_size = 2;
66
    avctx->extradata      = av_mallocz(avctx->extradata_size +
67
                                       FF_INPUT_BUFFER_PADDING_SIZE);
68
    if (!avctx->extradata)
69
        return AVERROR(ENOMEM);
70

  
71
    for (index = 0; index < 16; index++)
72
        if (avctx->sample_rate == ff_mpeg4audio_sample_rates[index])
73
            break;
74
    if (index == 16) {
75
        av_log(avctx, AV_LOG_ERROR, "Unsupported sample rate %d\n",
76
                                    avctx->sample_rate);
77
        return AVERROR_NOTSUPP;
78
    }
79
    avctx->extradata[0] = 0x02 << 3 | index >> 1;
80
    avctx->extradata[1] = (index & 0x01) << 7 | avctx->channels << 3;
81
    return 0;
82
}
83

  
84
static int aac_encode_close(AVCodecContext *avctx)
85
{
86
    AACContext *s = avctx->priv_data;
87

  
88
    s->codec_api.Uninit(s->handle);
89
    av_freep(&avctx->coded_frame);
90

  
91
    return 0;
92
}
93

  
94
static int aac_encode_frame(AVCodecContext *avctx,
95
                            unsigned char *frame/*out*/,
96
                            int buf_size, void *data/*in*/)
97
{
98
    AACContext *s = avctx->priv_data;
99
    VO_CODECBUFFER input = { 0 }, output = { 0 };
100
    VO_AUDIO_OUTPUTINFO output_info = { { 0 } };
101

  
102
    input.Buffer = data;
103
    input.Length = 2 * avctx->channels * avctx->frame_size;
104
    output.Buffer = frame;
105
    output.Length = buf_size;
106

  
107
    s->codec_api.SetInputData(s->handle, &input);
108
    if (s->codec_api.GetOutputData(s->handle, &output, &output_info)
109
        != VO_ERR_NONE) {
110
        av_log(avctx, AV_LOG_ERROR, "Unable to encode frame\n");
111
        return AVERROR_UNKNOWN;
112
    }
113
    return output.Length;
114
}
115

  
116
AVCodec ff_libvo_aacenc_encoder = {
117
    "libvo_aacenc",
118
    CODEC_TYPE_AUDIO,
119
    CODEC_ID_AAC,
120
    sizeof(AACContext),
121
    aac_encode_init,
122
    aac_encode_frame,
123
    aac_encode_close,
124
    NULL,
125
    .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
126
    .long_name = NULL_IF_CONFIG_SMALL("libvo-aacenc AAC"),
127
};
128

  
libavcodec/version.h
21 21
#define AVCODEC_VERSION_H
22 22

  
23 23
#define LIBAVCODEC_VERSION_MAJOR 52
24
#define LIBAVCODEC_VERSION_MINOR 117
25
#define LIBAVCODEC_VERSION_MICRO  1
24
#define LIBAVCODEC_VERSION_MINOR 118
25
#define LIBAVCODEC_VERSION_MICRO  0
26 26

  
27 27
#define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
28 28
                                               LIBAVCODEC_VERSION_MINOR, \

Also available in: Unified diff