summaryrefslogtreecommitdiff
path: root/libavcodec/libfaac.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-04-17 22:18:21 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-04-18 00:28:06 +0200
commit123272374180d8dc3ce9dff50f0c77d5b3b3341f (patch)
tree2c2add85161e74ebe6d4301a6607adc521112582 /libavcodec/libfaac.c
parenta66675268f63dd6794ce946c7edbcb8b49ae0f13 (diff)
parent0f96f0d9968a767ead3aec823fcdfb78f26f7be7 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: aacenc: Fix issues with huge values of bit_rate. dv_tablegen: Drop unnecessary av_unused attribute from dv_vlc_map_tableinit(). proresenc: multithreaded quantiser search riff: use bps instead of bits_per_coded_sample in the WAVEFORMATEXTENSIBLE header avconv: only set the "channels" option when it exists for the specified input format avplay: update get_buffer to be inline with avconv aacdec: More robust output configuration. faac: Fix multi-channel ordering faac: Add .channel_layouts rtmp: Support 'rtmp_playpath', an option which overrides the stream identifier rtmp: Support 'rtmp_app', an option which overrides the name of application avutil: add better documentation for AVSampleFormat Conflicts: libavcodec/aac.h libavcodec/aacdec.c libavcodec/aacenc.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/libfaac.c')
-rw-r--r--libavcodec/libfaac.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/libavcodec/libfaac.c b/libavcodec/libfaac.c
index 8169b0a16b..c174f7af36 100644
--- a/libavcodec/libfaac.c
+++ b/libavcodec/libfaac.c
@@ -29,6 +29,7 @@
#include "avcodec.h"
#include "audio_frame_queue.h"
#include "internal.h"
+#include "libavutil/audioconvert.h"
/* libfaac has an encoder delay of 1024 samples */
@@ -39,13 +40,6 @@ typedef struct FaacAudioContext {
AudioFrameQueue afq;
} FaacAudioContext;
-static const int channel_maps[][6] = {
- { 2, 0, 1 }, //< C L R
- { 2, 0, 1, 3 }, //< C L R Cs
- { 2, 0, 1, 3, 4 }, //< C L R Ls Rs
- { 2, 0, 1, 4, 5, 3 }, //< C L R Ls Rs LFE
-};
-
static av_cold int Faac_encode_close(AVCodecContext *avctx)
{
FaacAudioContext *s = avctx->priv_data;
@@ -62,6 +56,13 @@ static av_cold int Faac_encode_close(AVCodecContext *avctx)
return 0;
}
+static const int channel_maps[][6] = {
+ { 2, 0, 1 }, //< C L R
+ { 2, 0, 1, 3 }, //< C L R Cs
+ { 2, 0, 1, 3, 4 }, //< C L R Ls Rs
+ { 2, 0, 1, 4, 5, 3 }, //< C L R Ls Rs LFE
+};
+
static av_cold int Faac_encode_init(AVCodecContext *avctx)
{
FaacAudioContext *s = avctx->priv_data;
@@ -184,8 +185,10 @@ static int Faac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
int num_samples = frame ? frame->nb_samples : 0;
void *samples = frame ? frame->data[0] : NULL;
- if ((ret = ff_alloc_packet2(avctx, avpkt, (7 + 768) * avctx->channels)))
+ if ((ret = ff_alloc_packet2(avctx, avpkt, (7 + 768) * avctx->channels))) {
+ av_log(avctx, AV_LOG_ERROR, "Error getting output packet\n");
return ret;
+ }
bytes_written = faacEncEncode(s->faac_handle, samples,
num_samples * avctx->channels,
@@ -221,6 +224,16 @@ static const AVProfile profiles[] = {
{ FF_PROFILE_UNKNOWN },
};
+static const uint64_t faac_channel_layouts[] = {
+ AV_CH_LAYOUT_MONO,
+ AV_CH_LAYOUT_STEREO,
+ AV_CH_LAYOUT_SURROUND,
+ AV_CH_LAYOUT_4POINT0,
+ AV_CH_LAYOUT_5POINT0_BACK,
+ AV_CH_LAYOUT_5POINT1_BACK,
+ 0
+};
+
AVCodec ff_libfaac_encoder = {
.name = "libfaac",
.type = AVMEDIA_TYPE_AUDIO,
@@ -234,4 +247,5 @@ AVCodec ff_libfaac_encoder = {
AV_SAMPLE_FMT_NONE },
.long_name = NULL_IF_CONFIG_SMALL("libfaac AAC (Advanced Audio Codec)"),
.profiles = NULL_IF_CONFIG_SMALL(profiles),
+ .channel_layouts = faac_channel_layouts,
};