Commit 63e8d976 authored by Stefano Sabatini's avatar Stefano Sabatini
Browse files

Use the new libavcore audio channel API.

This also allows to remove a linking dependency of libavfilter on
libavcodec.

Originally committed as revision 25789 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent d6e60253
......@@ -36,6 +36,7 @@
#include "libswscale/swscale.h"
#include "libavcodec/opt.h"
#include "libavcodec/audioconvert.h"
#include "libavcore/audioconvert.h"
#include "libavcore/parseutils.h"
#include "libavcore/samplefmt.h"
#include "libavutil/colorspace.h"
......@@ -3541,7 +3542,7 @@ static void new_audio_stream(AVFormatContext *oc, int file_idx)
audio_enc->sample_fmt = audio_sample_fmt;
audio_enc->sample_rate = audio_sample_rate;
audio_enc->channel_layout = channel_layout;
if (avcodec_channel_layout_num_channels(channel_layout) != audio_channels)
if (av_get_channel_layout_nb_channels(channel_layout) != audio_channels)
audio_enc->channel_layout = 0;
choose_sample_fmt(st, codec);
choose_sample_rate(st, codec);
......
......@@ -30,6 +30,7 @@
#ifndef AVCODEC_AACDECTAB_H
#define AVCODEC_AACDECTAB_H
#include "libavcore/audioconvert.h"
#include "aac.h"
#include <stdint.h>
......@@ -82,13 +83,13 @@ static const uint8_t aac_channel_layout_map[7][5][2] = {
};
static const int64_t aac_channel_layout[8] = {
CH_LAYOUT_MONO,
CH_LAYOUT_STEREO,
CH_LAYOUT_SURROUND,
CH_LAYOUT_4POINT0,
CH_LAYOUT_5POINT0_BACK,
CH_LAYOUT_5POINT1_BACK,
CH_LAYOUT_7POINT1_WIDE,
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,
AV_CH_LAYOUT_7POINT1_WIDE,
0,
};
......
......@@ -25,6 +25,7 @@
*/
//#define DEBUG
//#define DEBUG_BITALLOC
#include "libavcore/audioconvert.h"
#include "libavutil/crc.h"
#include "avcodec.h"
#include "libavutil/common.h" /* for av_reverse */
......@@ -620,26 +621,26 @@ static av_cold int set_channel_info(AC3EncodeContext *s, int channels,
ch_layout = *channel_layout;
if (!ch_layout)
ch_layout = avcodec_guess_channel_layout(channels, CODEC_ID_AC3, NULL);
if (avcodec_channel_layout_num_channels(ch_layout) != channels)
if (av_get_channel_layout_nb_channels(ch_layout) != channels)
return -1;
s->lfe = !!(ch_layout & CH_LOW_FREQUENCY);
s->lfe = !!(ch_layout & AV_CH_LOW_FREQUENCY);
s->nb_all_channels = channels;
s->nb_channels = channels - s->lfe;
s->lfe_channel = s->lfe ? s->nb_channels : -1;
if (s->lfe)
ch_layout -= CH_LOW_FREQUENCY;
ch_layout -= AV_CH_LOW_FREQUENCY;
switch (ch_layout) {
case CH_LAYOUT_MONO: s->channel_mode = AC3_CHMODE_MONO; break;
case CH_LAYOUT_STEREO: s->channel_mode = AC3_CHMODE_STEREO; break;
case CH_LAYOUT_SURROUND: s->channel_mode = AC3_CHMODE_3F; break;
case CH_LAYOUT_2_1: s->channel_mode = AC3_CHMODE_2F1R; break;
case CH_LAYOUT_4POINT0: s->channel_mode = AC3_CHMODE_3F1R; break;
case CH_LAYOUT_QUAD:
case CH_LAYOUT_2_2: s->channel_mode = AC3_CHMODE_2F2R; break;
case CH_LAYOUT_5POINT0:
case CH_LAYOUT_5POINT0_BACK: s->channel_mode = AC3_CHMODE_3F2R; break;
case AV_CH_LAYOUT_MONO: s->channel_mode = AC3_CHMODE_MONO; break;
case AV_CH_LAYOUT_STEREO: s->channel_mode = AC3_CHMODE_STEREO; break;
case AV_CH_LAYOUT_SURROUND: s->channel_mode = AC3_CHMODE_3F; break;
case AV_CH_LAYOUT_2_1: s->channel_mode = AC3_CHMODE_2F1R; break;
case AV_CH_LAYOUT_4POINT0: s->channel_mode = AC3_CHMODE_3F1R; break;
case AV_CH_LAYOUT_QUAD:
case AV_CH_LAYOUT_2_2: s->channel_mode = AC3_CHMODE_2F2R; break;
case AV_CH_LAYOUT_5POINT0:
case AV_CH_LAYOUT_5POINT0_BACK: s->channel_mode = AC3_CHMODE_3F2R; break;
default:
return -1;
}
......@@ -647,7 +648,7 @@ static av_cold int set_channel_info(AC3EncodeContext *s, int channels,
s->channel_map = ff_ac3_enc_channel_map[s->channel_mode][s->lfe];
*channel_layout = ch_layout;
if (s->lfe)
*channel_layout |= CH_LOW_FREQUENCY;
*channel_layout |= AV_CH_LOW_FREQUENCY;
return 0;
}
......@@ -1403,23 +1404,23 @@ AVCodec ac3_encoder = {
.sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
.long_name = NULL_IF_CONFIG_SMALL("ATSC A/52A (AC-3)"),
.channel_layouts = (const int64_t[]){
CH_LAYOUT_MONO,
CH_LAYOUT_STEREO,
CH_LAYOUT_2_1,
CH_LAYOUT_SURROUND,
CH_LAYOUT_2_2,
CH_LAYOUT_QUAD,
CH_LAYOUT_4POINT0,
CH_LAYOUT_5POINT0,
CH_LAYOUT_5POINT0_BACK,
(CH_LAYOUT_MONO | CH_LOW_FREQUENCY),
(CH_LAYOUT_STEREO | CH_LOW_FREQUENCY),
(CH_LAYOUT_2_1 | CH_LOW_FREQUENCY),
(CH_LAYOUT_SURROUND | CH_LOW_FREQUENCY),
(CH_LAYOUT_2_2 | CH_LOW_FREQUENCY),
(CH_LAYOUT_QUAD | CH_LOW_FREQUENCY),
(CH_LAYOUT_4POINT0 | CH_LOW_FREQUENCY),
CH_LAYOUT_5POINT1,
CH_LAYOUT_5POINT1_BACK,
AV_CH_LAYOUT_MONO,
AV_CH_LAYOUT_STEREO,
AV_CH_LAYOUT_2_1,
AV_CH_LAYOUT_SURROUND,
AV_CH_LAYOUT_2_2,
AV_CH_LAYOUT_QUAD,
AV_CH_LAYOUT_4POINT0,
AV_CH_LAYOUT_5POINT0,
AV_CH_LAYOUT_5POINT0_BACK,
(AV_CH_LAYOUT_MONO | AV_CH_LOW_FREQUENCY),
(AV_CH_LAYOUT_STEREO | AV_CH_LOW_FREQUENCY),
(AV_CH_LAYOUT_2_1 | AV_CH_LOW_FREQUENCY),
(AV_CH_LAYOUT_SURROUND | AV_CH_LOW_FREQUENCY),
(AV_CH_LAYOUT_2_2 | AV_CH_LOW_FREQUENCY),
(AV_CH_LAYOUT_QUAD | AV_CH_LOW_FREQUENCY),
(AV_CH_LAYOUT_4POINT0 | AV_CH_LOW_FREQUENCY),
AV_CH_LAYOUT_5POINT1,
AV_CH_LAYOUT_5POINT1_BACK,
0 },
};
......@@ -24,6 +24,7 @@
* tables taken directly from the AC-3 spec.
*/
#include "libavcore/audioconvert.h"
#include "avcodec.h"
#include "ac3tab.h"
......@@ -84,14 +85,14 @@ const uint8_t ff_ac3_channels_tab[8] = {
* Map audio coding mode (acmod) to channel layout mask.
*/
const uint16_t ff_ac3_channel_layout_tab[8] = {
CH_LAYOUT_STEREO,
CH_LAYOUT_MONO,
CH_LAYOUT_STEREO,
CH_LAYOUT_SURROUND,
CH_LAYOUT_2_1,
CH_LAYOUT_4POINT0,
CH_LAYOUT_2_2,
CH_LAYOUT_5POINT0
AV_CH_LAYOUT_STEREO,
AV_CH_LAYOUT_MONO,
AV_CH_LAYOUT_STEREO,
AV_CH_LAYOUT_SURROUND,
AV_CH_LAYOUT_2_1,
AV_CH_LAYOUT_4POINT0,
AV_CH_LAYOUT_2_2,
AV_CH_LAYOUT_5POINT0
};
#define COMMON_CHANNEL_MAP \
......
......@@ -51,13 +51,13 @@ void avcodec_sample_fmt_string (char *buf, int buf_size, int sample_fmt)
int64_t avcodec_guess_channel_layout(int nb_channels, enum CodecID codec_id, const char *fmt_name)
{
switch(nb_channels) {
case 1: return CH_LAYOUT_MONO;
case 2: return CH_LAYOUT_STEREO;
case 3: return CH_LAYOUT_SURROUND;
case 4: return CH_LAYOUT_QUAD;
case 5: return CH_LAYOUT_5POINT0;
case 6: return CH_LAYOUT_5POINT1;
case 8: return CH_LAYOUT_7POINT1;
case 1: return AV_CH_LAYOUT_MONO;
case 2: return AV_CH_LAYOUT_STEREO;
case 3: return AV_CH_LAYOUT_SURROUND;
case 4: return AV_CH_LAYOUT_QUAD;
case 5: return AV_CH_LAYOUT_5POINT0;
case 6: return AV_CH_LAYOUT_5POINT1;
case 8: return AV_CH_LAYOUT_7POINT1;
default: return 0;
}
}
......
......@@ -33,7 +33,7 @@
#define LIBAVCODEC_VERSION_MAJOR 52
#define LIBAVCODEC_VERSION_MINOR 97
#define LIBAVCODEC_VERSION_MICRO 1
#define LIBAVCODEC_VERSION_MICRO 2
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
......@@ -80,7 +80,7 @@
#define FF_API_OLD_SAMPLE_FMT (LIBAVCODEC_VERSION_MAJOR < 53)
#endif
#ifndef FF_API_OLD_AUDIOCONVERT
#define FF_API_OLD_AUDIOCONVERT (LIBAVCODEC_VERSION_MAJOR < 54)
#define FF_API_OLD_AUDIOCONVERT (LIBAVCODEC_VERSION_MAJOR < 53)
#endif
#define AV_NOPTS_VALUE INT64_C(0x8000000000000000)
......
......@@ -28,6 +28,7 @@
#include "libavutil/intmath.h"
#include "libavutil/intreadwrite.h"
#include "libavcore/audioconvert.h"
#include "avcodec.h"
#include "dsputil.h"
#include "fft.h"
......@@ -74,22 +75,22 @@ enum DCAMode {
*/
static const int64_t dca_core_channel_layout[] = {
CH_FRONT_CENTER, ///< 1, A
CH_LAYOUT_STEREO, ///< 2, A + B (dual mono)
CH_LAYOUT_STEREO, ///< 2, L + R (stereo)
CH_LAYOUT_STEREO, ///< 2, (L+R) + (L-R) (sum-difference)
CH_LAYOUT_STEREO, ///< 2, LT +RT (left and right total)
CH_LAYOUT_STEREO|CH_FRONT_CENTER, ///< 3, C+L+R
CH_LAYOUT_STEREO|CH_BACK_CENTER, ///< 3, L+R+S
CH_LAYOUT_STEREO|CH_FRONT_CENTER|CH_BACK_CENTER, ///< 4, C + L + R+ S
CH_LAYOUT_STEREO|CH_SIDE_LEFT|CH_SIDE_RIGHT, ///< 4, L + R +SL+ SR
CH_LAYOUT_STEREO|CH_FRONT_CENTER|CH_SIDE_LEFT|CH_SIDE_RIGHT, ///< 5, C + L + R+ SL+SR
CH_LAYOUT_STEREO|CH_SIDE_LEFT|CH_SIDE_RIGHT|CH_FRONT_LEFT_OF_CENTER|CH_FRONT_RIGHT_OF_CENTER, ///< 6, CL + CR + L + R + SL + SR
CH_LAYOUT_STEREO|CH_BACK_LEFT|CH_BACK_RIGHT|CH_FRONT_CENTER|CH_BACK_CENTER, ///< 6, C + L + R+ LR + RR + OV
CH_FRONT_CENTER|CH_FRONT_RIGHT_OF_CENTER|CH_FRONT_LEFT_OF_CENTER|CH_BACK_CENTER|CH_BACK_LEFT|CH_BACK_RIGHT, ///< 6, CF+ CR+LF+ RF+LR + RR
CH_FRONT_LEFT_OF_CENTER|CH_FRONT_CENTER|CH_FRONT_RIGHT_OF_CENTER|CH_LAYOUT_STEREO|CH_SIDE_LEFT|CH_SIDE_RIGHT, ///< 7, CL + C + CR + L + R + SL + SR
CH_FRONT_LEFT_OF_CENTER|CH_FRONT_RIGHT_OF_CENTER|CH_LAYOUT_STEREO|CH_SIDE_LEFT|CH_SIDE_RIGHT|CH_BACK_LEFT|CH_BACK_RIGHT, ///< 8, CL + CR + L + R + SL1 + SL2+ SR1 + SR2
CH_FRONT_LEFT_OF_CENTER|CH_FRONT_CENTER|CH_FRONT_RIGHT_OF_CENTER|CH_LAYOUT_STEREO|CH_SIDE_LEFT|CH_BACK_CENTER|CH_SIDE_RIGHT, ///< 8, CL + C+ CR + L + R + SL + S+ SR
AV_CH_FRONT_CENTER, ///< 1, A
AV_CH_LAYOUT_STEREO, ///< 2, A + B (dual mono)
AV_CH_LAYOUT_STEREO, ///< 2, L + R (stereo)
AV_CH_LAYOUT_STEREO, ///< 2, (L+R) + (L-R) (sum-difference)
AV_CH_LAYOUT_STEREO, ///< 2, LT +RT (left and right total)
AV_CH_LAYOUT_STEREO|AV_CH_FRONT_CENTER, ///< 3, C+L+R
AV_CH_LAYOUT_STEREO|AV_CH_BACK_CENTER, ///< 3, L+R+S
AV_CH_LAYOUT_STEREO|AV_CH_FRONT_CENTER|CH_BACK_CENTER, ///< 4, C + L + R+ S
AV_CH_LAYOUT_STEREO|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT, ///< 4, L + R +SL+ SR
AV_CH_LAYOUT_STEREO|AV_CH_FRONT_CENTER|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT, ///< 5, C + L + R+ SL+SR
AV_CH_LAYOUT_STEREO|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER, ///< 6, CL + CR + L + R + SL + SR
AV_CH_LAYOUT_STEREO|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT|AV_CH_FRONT_CENTER|AV_CH_BACK_CENTER, ///< 6, C + L + R+ LR + RR + OV
AV_CH_FRONT_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_BACK_CENTER|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT, ///< 6, CF+ CR+LF+ RF+LR + RR
AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER|AV_CH_LAYOUT_STEREO|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT, ///< 7, CL + C + CR + L + R + SL + SR
AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER|AV_CH_LAYOUT_STEREO|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT, ///< 8, CL + CR + L + R + SL1 + SL2+ SR1 + SR2
AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER|AV_CH_LAYOUT_STEREO|AV_CH_SIDE_LEFT|AV_CH_BACK_CENTER|AV_CH_SIDE_RIGHT, ///< 8, CL + C+ CR + L + R + SL + S+ SR
};
static const int8_t dca_lfe_index[] = {
......@@ -1368,9 +1369,9 @@ static int dca_decode_frame(AVCodecContext * avctx,
if (s->xch_present && (!avctx->request_channels ||
avctx->request_channels > num_core_channels + !!s->lfe)) {
avctx->channel_layout |= CH_BACK_CENTER;
avctx->channel_layout |= AV_CH_BACK_CENTER;
if (s->lfe) {
avctx->channel_layout |= CH_LOW_FREQUENCY;
avctx->channel_layout |= AV_CH_LOW_FREQUENCY;
s->channel_order_tab = dca_channel_reorder_lfe_xch[s->amode];
} else {
s->channel_order_tab = dca_channel_reorder_nolfe_xch[s->amode];
......@@ -1379,7 +1380,7 @@ static int dca_decode_frame(AVCodecContext * avctx,
channels = num_core_channels + !!s->lfe;
s->xch_present = 0; /* disable further xch processing */
if (s->lfe) {
avctx->channel_layout |= CH_LOW_FREQUENCY;
avctx->channel_layout |= AV_CH_LOW_FREQUENCY;
s->channel_order_tab = dca_channel_reorder_lfe[s->amode];
} else
s->channel_order_tab = dca_channel_reorder_nolfe[s->amode];
......@@ -1392,7 +1393,7 @@ static int dca_decode_frame(AVCodecContext * avctx,
if (avctx->request_channels == 2 && s->prim_channels > 2) {
channels = 2;
s->output = DCA_STEREO;
avctx->channel_layout = CH_LAYOUT_STEREO;
avctx->channel_layout = AV_CH_LAYOUT_STEREO;
}
} else {
av_log(avctx, AV_LOG_ERROR, "Non standard configuration %d !\n",s->amode);
......
......@@ -34,6 +34,7 @@
#include "nellymoser.h"
#include "libavutil/lfg.h"
#include "libavutil/random_seed.h"
#include "libavcore/audioconvert.h"
#include "avcodec.h"
#include "dsputil.h"
#include "fft.h"
......@@ -148,7 +149,7 @@ static av_cold int decode_init(AVCodecContext * avctx) {
ff_init_ff_sine_windows(7);
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
avctx->channel_layout = CH_LAYOUT_MONO;
avctx->channel_layout = AV_CH_LAYOUT_MONO;
return 0;
}
......
......@@ -24,6 +24,7 @@
* PCM codecs for encodings found in MPEG streams (DVD/Blu-ray)
*/
#include "libavcore/audioconvert.h"
#include "avcodec.h"
#include "bytestream.h"
......@@ -53,9 +54,9 @@ static int pcm_bluray_parse_header(AVCodecContext *avctx,
{
static const uint8_t bits_per_samples[4] = { 0, 16, 20, 24 };
static const uint32_t channel_layouts[16] = {
0, CH_LAYOUT_MONO, 0, CH_LAYOUT_STEREO, CH_LAYOUT_SURROUND,
CH_LAYOUT_2_1, CH_LAYOUT_4POINT0, CH_LAYOUT_2_2, CH_LAYOUT_5POINT0,
CH_LAYOUT_5POINT1, CH_LAYOUT_7POINT0, CH_LAYOUT_7POINT1, 0, 0, 0, 0
0, AV_CH_LAYOUT_MONO, 0, AV_CH_LAYOUT_STEREO, AV_CH_LAYOUT_SURROUND,
AV_CH_LAYOUT_2_1, AV_CH_LAYOUT_4POINT0, AV_CH_LAYOUT_2_2, AV_CH_LAYOUT_5POINT0,
AV_CH_LAYOUT_5POINT1, AV_CH_LAYOUT_7POINT0, AV_CH_LAYOUT_7POINT1, 0, 0, 0, 0
};
static const uint8_t channels[16] = {
0, 1, 0, 2, 3, 3, 4, 4, 5, 6, 7, 8, 0, 0, 0, 0
......@@ -158,9 +159,9 @@ static int pcm_bluray_decode_frame(AVCodecContext *avctx,
if (samples) {
switch (avctx->channel_layout) {
/* cases with same number of source and coded channels */
case CH_LAYOUT_STEREO:
case CH_LAYOUT_4POINT0:
case CH_LAYOUT_2_2:
case AV_CH_LAYOUT_STEREO:
case AV_CH_LAYOUT_4POINT0:
case AV_CH_LAYOUT_2_2:
samples *= num_source_channels;
if (AV_SAMPLE_FMT_S16 == avctx->sample_fmt) {
#if HAVE_BIGENDIAN
......@@ -177,10 +178,10 @@ static int pcm_bluray_decode_frame(AVCodecContext *avctx,
}
break;
/* cases where number of source channels = coded channels + 1 */
case CH_LAYOUT_MONO:
case CH_LAYOUT_SURROUND:
case CH_LAYOUT_2_1:
case CH_LAYOUT_5POINT0:
case AV_CH_LAYOUT_MONO:
case AV_CH_LAYOUT_SURROUND:
case AV_CH_LAYOUT_2_1:
case AV_CH_LAYOUT_5POINT0:
if (AV_SAMPLE_FMT_S16 == avctx->sample_fmt) {
do {
#if HAVE_BIGENDIAN
......@@ -206,7 +207,7 @@ static int pcm_bluray_decode_frame(AVCodecContext *avctx,
}
break;
/* remapping: L, R, C, LBack, RBack, LF */
case CH_LAYOUT_5POINT1:
case AV_CH_LAYOUT_5POINT1:
if (AV_SAMPLE_FMT_S16 == avctx->sample_fmt) {
do {
dst16[0] = bytestream_get_be16(&src);
......@@ -230,7 +231,7 @@ static int pcm_bluray_decode_frame(AVCodecContext *avctx,
}
break;
/* remapping: L, R, C, LSide, LBack, RBack, RSide, <unused> */
case CH_LAYOUT_7POINT0:
case AV_CH_LAYOUT_7POINT0:
if (AV_SAMPLE_FMT_S16 == avctx->sample_fmt) {
do {
dst16[0] = bytestream_get_be16(&src);
......@@ -258,7 +259,7 @@ static int pcm_bluray_decode_frame(AVCodecContext *avctx,
}
break;
/* remapping: L, R, C, LSide, LBack, RBack, RSide, LF */
case CH_LAYOUT_7POINT1:
case AV_CH_LAYOUT_7POINT1:
if (AV_SAMPLE_FMT_S16 == avctx->sample_fmt) {
do {
dst16[0] = bytestream_get_be16(&src);
......
......@@ -29,6 +29,7 @@
#include "libavutil/integer.h"
#include "libavutil/crc.h"
#include "libavutil/pixdesc.h"
#include "libavcore/audioconvert.h"
#include "libavcore/imgutils.h"
#include "libavcore/internal.h"
#include "libavcore/samplefmt.h"
......@@ -922,7 +923,7 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
", %d Hz", enc->sample_rate);
}
av_strlcat(buf, ", ", buf_size);
avcodec_get_channel_layout_string(buf + strlen(buf), buf_size - strlen(buf), enc->channels, enc->channel_layout);
av_get_channel_layout_string(buf + strlen(buf), buf_size - strlen(buf), enc->channels, enc->channel_layout);
if (enc->sample_fmt != AV_SAMPLE_FMT_NONE) {
snprintf(buf + strlen(buf), buf_size - strlen(buf),
", %s", av_get_sample_fmt_name(enc->sample_fmt));
......
include $(SUBDIR)../config.mak
NAME = avfilter
FFLIBS = avcodec avcore avutil
FFLIBS = avcore avutil
FFLIBS-$(CONFIG_SCALE_FILTER) += swscale
HEADERS = avfilter.h avfiltergraph.h
......
......@@ -22,7 +22,7 @@
*/
#include "avfilter.h"
#include "libavcodec/audioconvert.h"
#include "libavcore/audioconvert.h"
typedef struct {
int64_t channel_layout;
......@@ -35,7 +35,7 @@ static int init(AVFilterContext *ctx, const char *args, void *opaque)
char channel_layout_str[128] = "";
priv->sample_rate = 44100;
priv->channel_layout = CH_LAYOUT_STEREO;
priv->channel_layout = AV_CH_LAYOUT_STEREO;
if (args)
sscanf(args, "%"PRId64":%s", &priv->sample_rate, channel_layout_str);
......@@ -46,7 +46,7 @@ static int init(AVFilterContext *ctx, const char *args, void *opaque)
}
if (*channel_layout_str)
if (!(priv->channel_layout = avcodec_get_channel_layout(channel_layout_str))
if (!(priv->channel_layout = av_get_channel_layout(channel_layout_str))
&& sscanf(channel_layout_str, "%"PRId64, &priv->channel_layout) != 1) {
av_log(ctx, AV_LOG_ERROR, "Invalid value '%s' for channel layout\n",
channel_layout_str);
......@@ -65,8 +65,8 @@ static int config_props(AVFilterLink *outlink)
outlink->sample_rate = priv->sample_rate;
outlink->channel_layout = priv->channel_layout;
chans_nb = avcodec_channel_layout_num_channels(priv->channel_layout);
avcodec_get_channel_layout_string(buf, sizeof(buf), chans_nb, priv->channel_layout);
chans_nb = av_get_channel_layout_nb_channels(priv->channel_layout);
av_get_channel_layout_string(buf, sizeof(buf), chans_nb, priv->channel_layout);
av_log(outlink->src, AV_LOG_INFO,
"sample_rate:%"PRId64 " channel_layout:%"PRId64 " channel_layout_description:'%s'\n",
priv->sample_rate, priv->channel_layout, buf);
......
......@@ -26,7 +26,7 @@
#define LIBAVFILTER_VERSION_MAJOR 1
#define LIBAVFILTER_VERSION_MINOR 63
#define LIBAVFILTER_VERSION_MICRO 0
#define LIBAVFILTER_VERSION_MICRO 1
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
LIBAVFILTER_VERSION_MINOR, \
......@@ -579,7 +579,7 @@ struct AVFilterLink {
int w; ///< agreed upon image width
int h; ///< agreed upon image height
/* These two parameters apply only to audio */
int64_t channel_layout; ///< channel layout of current buffer (see avcodec.h)
int64_t channel_layout; ///< channel layout of current buffer (see libavcore/audioconvert.h)
int64_t sample_rate; ///< samples per second
int format; ///< agreed upon media format
......
......@@ -19,9 +19,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libavcore/audioconvert.h"
#include "libavcore/imgutils.h"
#include "libavcore/samplefmt.h"
#include "libavcodec/audioconvert.h"
#include "avfilter.h"
/* TODO: buffer pool. see comment for avfilter_default_get_video_buffer() */
......@@ -111,7 +111,7 @@ AVFilterBufferRef *avfilter_default_get_audio_buffer(AVFilterLink *link, int per
samples->free = avfilter_default_free_buffer;
sample_size = av_get_bits_per_sample_fmt(sample_fmt) >>3;
chans_nb = avcodec_channel_layout_num_channels(channel_layout);
chans_nb = av_get_channel_layout_nb_channels(channel_layout);
per_channel_size = size/chans_nb;
ref->audio->samples_nb = per_channel_size/sample_size;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment