Revision f502ff3f

View differences:

Changelog
84 84
- Chronomaster DFA decoder
85 85
- Mobotix MxPEG decoder
86 86
- AAC encoding via libvo-aacenc
87
- AMR-WB encoding via libvo-amrwbenc
87 88

  
88 89

  
89 90
version 0.6:
configure
179 179
  --enable-libspeex        enable Speex decoding via libspeex [no]
180 180
  --enable-libtheora       enable Theora encoding via libtheora [no]
181 181
  --enable-libvo-aacenc    enable AAC encoding via libvo-aacenc [no]
182
  --enable-libvo-amrwbenc  enable AMR-WB encoding via libvo-amrwbenc [no]
182 183
  --enable-libvorbis       enable Vorbis encoding via libvorbis,
183 184
                           native implementation exists [no]
184 185
  --enable-libvpx          enable VP8 support via libvpx [no]
......
939 940
    libspeex
940 941
    libtheora
941 942
    libvo_aacenc
943
    libvo_amrwbenc
942 944
    libvorbis
943 945
    libvpx
944 946
    libx264
......
1387 1389
libspeex_decoder_deps="libspeex"
1388 1390
libtheora_encoder_deps="libtheora"
1389 1391
libvo_aacenc_encoder_deps="libvo_aacenc"
1392
libvo_amrwbenc_encoder_deps="libvo_amrwbenc"
1390 1393
libvorbis_encoder_deps="libvorbis"
1391 1394
libvpx_decoder_deps="libvpx"
1392 1395
libvpx_encoder_deps="libvpx"
......
2529 2532
die_license_disabled version3 libopencore_amrnb
2530 2533
die_license_disabled version3 libopencore_amrwb
2531 2534
die_license_disabled version3 libvo_aacenc
2535
die_license_disabled version3 libvo_amrwbenc
2532 2536

  
2533 2537
enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
2534 2538

  
......
2869 2873
enabled libspeex   && require  libspeex speex/speex.h speex_decoder_init -lspeex
2870 2874
enabled libtheora  && require  libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
2871 2875
enabled libvo_aacenc && require libvo_aacenc vo-aacenc/voAAC.h voGetAACEncAPI -lvo-aacenc
2876
enabled libvo_amrwbenc && require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_init -lvo-amrwbenc
2872 2877
enabled libvorbis  && require  libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
2873 2878
enabled libvpx     && {
2874 2879
    enabled libvpx_decoder && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_dec_init_ver -lvpx ||
......
3138 3143
echo "libtheora enabled         ${libtheora-no}"
3139 3144
echo "libva enabled             ${vaapi-no}"
3140 3145
echo "libvo-aacenc support      ${libvo_aacenc-no}"
3146
echo "libvo-amrwbenc support    ${libvo_amrwbenc-no}"
3141 3147
echo "libvorbis enabled         ${libvorbis-no}"
3142 3148
echo "libvpx enabled            ${libvpx-no}"
3143 3149
echo "libx264 enabled           ${libx264-no}"
doc/general.texi
588 588
@item ADPCM Yamaha           @tab  X  @tab  X
589 589
@item AMR-NB                 @tab  E  @tab  X
590 590
    @tab encoding supported through external library libopencore-amrnb
591
@item AMR-WB                 @tab     @tab  X
591
@item AMR-WB                 @tab  E  @tab  X
592
    @tab encoding supported through external library libvo-amrwbenc
592 593
@item Apple lossless audio   @tab  X  @tab  X
593 594
    @tab QuickTime fourcc 'alac'
594 595
@item Atrac 1                @tab     @tab  X
libavcodec/Makefile
569 569
OBJS-$(CONFIG_LIBSPEEX_DECODER)           += libspeexdec.o
570 570
OBJS-$(CONFIG_LIBTHEORA_ENCODER)          += libtheoraenc.o
571 571
OBJS-$(CONFIG_LIBVO_AACENC_ENCODER)       += libvo-aacenc.o mpeg4audio.o
572
OBJS-$(CONFIG_LIBVO_AMRWBENC_ENCODER)     += libvo-amrwbenc.o
572 573
OBJS-$(CONFIG_LIBVORBIS_ENCODER)          += libvorbis.o vorbis_data.o
573 574
OBJS-$(CONFIG_LIBVPX_DECODER)             += libvpxdec.o
574 575
OBJS-$(CONFIG_LIBVPX_ENCODER)             += libvpxenc.o
libavcodec/allcodecs.c
367 367
    REGISTER_DECODER (LIBSPEEX, libspeex);
368 368
    REGISTER_ENCODER (LIBTHEORA, libtheora);
369 369
    REGISTER_ENCODER (LIBVO_AACENC, libvo_aacenc);
370
    REGISTER_ENCODER (LIBVO_AMRWBENC, libvo_amrwbenc);
370 371
    REGISTER_ENCODER (LIBVORBIS, libvorbis);
371 372
    REGISTER_ENCDEC  (LIBVPX, libvpx);
372 373
    REGISTER_ENCODER (LIBX264, libx264);
libavcodec/libvo-amrwbenc.c
1
/*
2
 * AMR Audio encoder stub
3
 * Copyright (c) 2003 the ffmpeg project
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-amrwbenc/enc_if.h>
23

  
24
#include "avcodec.h"
25

  
26
static const char wb_bitrate_unsupported[] =
27
    "bitrate not supported: use one of 6.6k, 8.85k, 12.65k, 14.25k, 15.85k, "
28
    "18.25k, 19.85k, 23.05k, or 23.85k\n";
29

  
30
typedef struct AMRWB_bitrates {
31
    int rate;
32
    int mode;
33
} AMRWB_bitrates;
34

  
35
typedef struct AMRWBContext {
36
    void  *state;
37
    int    mode;
38
    int    allow_dtx;
39
} AMRWBContext;
40

  
41
static int getWBBitrateMode(int bitrate)
42
{
43
    /* make the correspondance between bitrate and mode */
44
    AMRWB_bitrates rates[] = { { 6600, 0},
45
                               { 8850, 1},
46
                               {12650, 2},
47
                               {14250, 3},
48
                               {15850, 4},
49
                               {18250, 5},
50
                               {19850, 6},
51
                               {23050, 7},
52
                               {23850, 8}, };
53
    int i;
54

  
55
    for (i = 0; i < 9; i++)
56
        if (rates[i].rate == bitrate)
57
            return rates[i].mode;
58
    /* no bitrate matching, return an error */
59
    return -1;
60
}
61

  
62
static av_cold int amr_wb_encode_init(AVCodecContext *avctx)
63
{
64
    AMRWBContext *s = avctx->priv_data;
65

  
66
    if (avctx->sample_rate != 16000) {
67
        av_log(avctx, AV_LOG_ERROR, "Only 16000Hz sample rate supported\n");
68
        return -1;
69
    }
70

  
71
    if (avctx->channels != 1) {
72
        av_log(avctx, AV_LOG_ERROR, "Only mono supported\n");
73
        return -1;
74
    }
75

  
76
    if ((s->mode = getWBBitrateMode(avctx->bit_rate)) < 0) {
77
        av_log(avctx, AV_LOG_ERROR, wb_bitrate_unsupported);
78
        return -1;
79
    }
80

  
81
    avctx->frame_size  = 320;
82
    avctx->coded_frame = avcodec_alloc_frame();
83

  
84
    s->state     = E_IF_init();
85
    s->allow_dtx = 0;
86

  
87
    return 0;
88
}
89

  
90
static int amr_wb_encode_close(AVCodecContext *avctx)
91
{
92
    AMRWBContext *s = avctx->priv_data;
93

  
94
    E_IF_exit(s->state);
95
    av_freep(&avctx->coded_frame);
96
    return 0;
97
}
98

  
99
static int amr_wb_encode_frame(AVCodecContext *avctx,
100
                               unsigned char *frame/*out*/,
101
                               int buf_size, void *data/*in*/)
102
{
103
    AMRWBContext *s = avctx->priv_data;
104
    int size;
105

  
106
    if ((s->mode = getWBBitrateMode(avctx->bit_rate)) < 0) {
107
        av_log(avctx, AV_LOG_ERROR, wb_bitrate_unsupported);
108
        return -1;
109
    }
110
    size = E_IF_encode(s->state, s->mode, data, frame, s->allow_dtx);
111
    return size;
112
}
113

  
114
AVCodec ff_libvo_amrwbenc_encoder = {
115
    "libvo_amrwbenc",
116
    CODEC_TYPE_AUDIO,
117
    CODEC_ID_AMR_WB,
118
    sizeof(AMRWBContext),
119
    amr_wb_encode_init,
120
    amr_wb_encode_frame,
121
    amr_wb_encode_close,
122
    NULL,
123
    .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
124
    .long_name = NULL_IF_CONFIG_SMALL("libvo-amrwbenc Adaptive Multi-Rate "
125
                                      "(AMR) Wide-Band"),
126
};
127

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

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

  
27 27
#define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \

Also available in: Unified diff