Change multichannel API define prefix from "CHANNEL_" to "CH_".

Originally committed as revision 15768 to svn://svn.ffmpeg.org/ffmpeg/trunk
pull/126/head
Andreas Öman 16 years ago
parent 7cebed70a8
commit 9d9b9d32e6
  1. 34
      libavcodec/audioconvert.c
  2. 62
      libavcodec/avcodec.h
  3. 64
      libavcodec/dca.c

@ -89,13 +89,13 @@ const char *get_channel_name(int channel_id)
int64_t avcodec_guess_channel_layout(int nb_channels, enum CodecID codec_id, const char *fmt_name)
{
switch(nb_channels) {
case 1: return CHANNEL_LAYOUT_MONO;
case 2: return CHANNEL_LAYOUT_STEREO;
case 3: return CHANNEL_LAYOUT_SURROUND;
case 4: return CHANNEL_LAYOUT_QUAD;
case 5: return CHANNEL_LAYOUT_5POINT0;
case 6: return CHANNEL_LAYOUT_5POINT1;
case 8: return CHANNEL_LAYOUT_7POINT1;
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;
default: return 0;
}
}
@ -105,16 +105,16 @@ static const struct {
int nb_channels;
int64_t layout;
} const channel_layout_map[] = {
{ "mono", 1, CHANNEL_LAYOUT_MONO },
{ "stereo", 2, CHANNEL_LAYOUT_STEREO },
{ "surround", 3, CHANNEL_LAYOUT_SURROUND },
{ "quad", 4, CHANNEL_LAYOUT_QUAD },
{ "5.0", 5, CHANNEL_LAYOUT_5POINT0 },
{ "5.1", 6, CHANNEL_LAYOUT_5POINT1 },
{ "5.1+downmix", 8, CHANNEL_LAYOUT_5POINT1|CHANNEL_LAYOUT_STEREO_DOWNMIX, },
{ "7.1", 8, CHANNEL_LAYOUT_7POINT1 },
{ "7.1(wide)", 8, CHANNEL_LAYOUT_7POINT1_WIDE },
{ "7.1+downmix", 10, CHANNEL_LAYOUT_7POINT1|CHANNEL_LAYOUT_STEREO_DOWNMIX, },
{ "mono", 1, CH_LAYOUT_MONO },
{ "stereo", 2, CH_LAYOUT_STEREO },
{ "surround", 3, CH_LAYOUT_SURROUND },
{ "quad", 4, CH_LAYOUT_QUAD },
{ "5.0", 5, CH_LAYOUT_5POINT0 },
{ "5.1", 6, CH_LAYOUT_5POINT1 },
{ "5.1+downmix", 8, CH_LAYOUT_5POINT1|CH_LAYOUT_STEREO_DOWNMIX, },
{ "7.1", 8, CH_LAYOUT_7POINT1 },
{ "7.1(wide)", 8, CH_LAYOUT_7POINT1_WIDE },
{ "7.1+downmix", 10, CH_LAYOUT_7POINT1|CH_LAYOUT_STEREO_DOWNMIX, },
{ 0 }
};

@ -347,39 +347,39 @@ enum SampleFormat {
};
/* Audio channel masks */
#define CHANNEL_FRONT_LEFT 0x00000001
#define CHANNEL_FRONT_RIGHT 0x00000002
#define CHANNEL_FRONT_CENTER 0x00000004
#define CHANNEL_LOW_FREQUENCY 0x00000008
#define CHANNEL_BACK_LEFT 0x00000010
#define CHANNEL_BACK_RIGHT 0x00000020
#define CHANNEL_FRONT_LEFT_OF_CENTER 0x00000040
#define CHANNEL_FRONT_RIGHT_OF_CENTER 0x00000080
#define CHANNEL_BACK_CENTER 0x00000100
#define CHANNEL_SIDE_LEFT 0x00000200
#define CHANNEL_SIDE_RIGHT 0x00000400
#define CHANNEL_TOP_CENTER 0x00000800
#define CHANNEL_TOP_FRONT_LEFT 0x00001000
#define CHANNEL_TOP_FRONT_CENTER 0x00002000
#define CHANNEL_TOP_FRONT_RIGHT 0x00004000
#define CHANNEL_TOP_BACK_LEFT 0x00008000
#define CHANNEL_TOP_BACK_CENTER 0x00010000
#define CHANNEL_TOP_BACK_RIGHT 0x00020000
#define CHANNEL_STEREO_LEFT 0x20000000 ///< Stereo downmix.
#define CHANNEL_STEREO_RIGHT 0x40000000 ///< See CHANNEL_STEREO_LEFT.
#define CH_FRONT_LEFT 0x00000001
#define CH_FRONT_RIGHT 0x00000002
#define CH_FRONT_CENTER 0x00000004
#define CH_LOW_FREQUENCY 0x00000008
#define CH_BACK_LEFT 0x00000010
#define CH_BACK_RIGHT 0x00000020
#define CH_FRONT_LEFT_OF_CENTER 0x00000040
#define CH_FRONT_RIGHT_OF_CENTER 0x00000080
#define CH_BACK_CENTER 0x00000100
#define CH_SIDE_LEFT 0x00000200
#define CH_SIDE_RIGHT 0x00000400
#define CH_TOP_CENTER 0x00000800
#define CH_TOP_FRONT_LEFT 0x00001000
#define CH_TOP_FRONT_CENTER 0x00002000
#define CH_TOP_FRONT_RIGHT 0x00004000
#define CH_TOP_BACK_LEFT 0x00008000
#define CH_TOP_BACK_CENTER 0x00010000
#define CH_TOP_BACK_RIGHT 0x00020000
#define CH_STEREO_LEFT 0x20000000 ///< Stereo downmix.
#define CH_STEREO_RIGHT 0x40000000 ///< See CH_STEREO_LEFT.
/* Audio channel convenience macros */
#define CHANNEL_LAYOUT_MONO (CHANNEL_FRONT_CENTER)
#define CHANNEL_LAYOUT_STEREO (CHANNEL_FRONT_LEFT|CHANNEL_FRONT_RIGHT)
#define CHANNEL_LAYOUT_SURROUND (CHANNEL_LAYOUT_STEREO|CHANNEL_FRONT_CENTER)
#define CHANNEL_LAYOUT_QUAD (CHANNEL_LAYOUT_STEREO|CHANNEL_BACK_LEFT|CHANNEL_BACK_RIGHT)
#define CHANNEL_LAYOUT_5POINT0 (CHANNEL_LAYOUT_SURROUND|CHANNEL_SIDE_LEFT|CHANNEL_SIDE_RIGHT)
#define CHANNEL_LAYOUT_5POINT1 (CHANNEL_LAYOUT_5POINT0|CHANNEL_LOW_FREQUENCY)
#define CHANNEL_LAYOUT_7POINT1 (CHANNEL_LAYOUT_5POINT1|CHANNEL_BACK_LEFT|CHANNEL_BACK_RIGHT)
#define CHANNEL_LAYOUT_7POINT1_WIDE (CHANNEL_LAYOUT_SURROUND|CHANNEL_LOW_FREQUENCY|\
CHANNEL_BACK_LEFT|CHANNEL_BACK_RIGHT|\
CHANNEL_FRONT_LEFT_OF_CENTER|CHANNEL_FRONT_RIGHT_OF_CENTER)
#define CHANNEL_LAYOUT_STEREO_DOWNMIX (CHANNEL_STEREO_LEFT|CHANNEL_STEREO_RIGHT)
#define CH_LAYOUT_MONO (CH_FRONT_CENTER)
#define CH_LAYOUT_STEREO (CH_FRONT_LEFT|CH_FRONT_RIGHT)
#define CH_LAYOUT_SURROUND (CH_LAYOUT_STEREO|CH_FRONT_CENTER)
#define CH_LAYOUT_QUAD (CH_LAYOUT_STEREO|CH_BACK_LEFT|CH_BACK_RIGHT)
#define CH_LAYOUT_5POINT0 (CH_LAYOUT_SURROUND|CH_SIDE_LEFT|CH_SIDE_RIGHT)
#define CH_LAYOUT_5POINT1 (CH_LAYOUT_5POINT0|CH_LOW_FREQUENCY)
#define CH_LAYOUT_7POINT1 (CH_LAYOUT_5POINT1|CH_BACK_LEFT|CH_BACK_RIGHT)
#define CH_LAYOUT_7POINT1_WIDE (CH_LAYOUT_SURROUND|CH_LOW_FREQUENCY|\
CH_BACK_LEFT|CH_BACK_RIGHT|\
CH_FRONT_LEFT_OF_CENTER|CH_FRONT_RIGHT_OF_CENTER)
#define CH_LAYOUT_STEREO_DOWNMIX (CH_STEREO_LEFT|CH_STEREO_RIGHT)
/* in bytes */
#define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000 // 1 second of 48khz 32bit audio

@ -66,41 +66,41 @@ enum DCAMode {
* L = left, R = right, C = center, S = surround, F = front, R = rear, T = total, OV = overhead.
* S -> back, when both rear and back are configured move one of them to the side channel
* OV -> center back
* All 2 channel configurations -> CHANNEL_LAYOUT_STEREO
* All 2 channel configurations -> CH_LAYOUT_STEREO
*/
static const int64_t dca_core_channel_layout[] = {
CHANNEL_FRONT_CENTER, ///< 1, A
CHANNEL_LAYOUT_STEREO, ///< 2, A + B (dual mono)
CHANNEL_LAYOUT_STEREO, ///< 2, L + R (stereo)
CHANNEL_LAYOUT_STEREO, ///< 2, (L+R) + (L-R) (sum-difference)
CHANNEL_LAYOUT_STEREO, ///< 2, LT +RT (left and right total)
CHANNEL_LAYOUT_STEREO|CHANNEL_FRONT_CENTER, ///< 3, C+L+R
CHANNEL_LAYOUT_STEREO|CHANNEL_BACK_CENTER, ///< 3, L+R+S
CHANNEL_LAYOUT_STEREO|CHANNEL_FRONT_CENTER|CHANNEL_BACK_CENTER, ///< 4, C + L + R+ S
CHANNEL_LAYOUT_STEREO|CHANNEL_BACK_LEFT|CHANNEL_BACK_RIGHT, ///< 4, L + R+ SL+SR
CHANNEL_LAYOUT_STEREO|CHANNEL_FRONT_CENTER|CHANNEL_BACK_LEFT|CHANNEL_BACK_RIGHT, ///< 5, C + L + R+ SL+SR
CHANNEL_LAYOUT_STEREO|CHANNEL_BACK_LEFT|CHANNEL_BACK_RIGHT|CHANNEL_FRONT_LEFT_OF_CENTER|CHANNEL_FRONT_RIGHT_OF_CENTER, ///< 6, CL + CR + L + R + SL + SR
CHANNEL_LAYOUT_STEREO|CHANNEL_BACK_LEFT|CHANNEL_BACK_RIGHT|CHANNEL_FRONT_CENTER|CHANNEL_BACK_CENTER, ///< 6, C + L + R+ LR + RR + OV
CHANNEL_FRONT_CENTER|CHANNEL_FRONT_RIGHT_OF_CENTER|CHANNEL_FRONT_LEFT_OF_CENTER|CHANNEL_BACK_CENTER|CHANNEL_BACK_LEFT|CHANNEL_BACK_RIGHT, ///< 6, CF+ CR+LF+ RF+LR + RR
CHANNEL_FRONT_LEFT_OF_CENTER|CHANNEL_FRONT_CENTER|CHANNEL_FRONT_RIGHT_OF_CENTER|CHANNEL_LAYOUT_STEREO|CHANNEL_BACK_LEFT|CHANNEL_BACK_RIGHT, ///< 7, CL + C + CR + L + R + SL + SR
CHANNEL_FRONT_LEFT_OF_CENTER|CHANNEL_FRONT_RIGHT_OF_CENTER|CHANNEL_LAYOUT_STEREO|CHANNEL_SIDE_LEFT|CHANNEL_SIDE_RIGHT|CHANNEL_BACK_LEFT|CHANNEL_BACK_RIGHT, ///< 8, CL + CR + L + R + SL1 + SL2+ SR1 + SR2
CHANNEL_FRONT_LEFT_OF_CENTER|CHANNEL_FRONT_CENTER|CHANNEL_FRONT_RIGHT_OF_CENTER|CHANNEL_LAYOUT_STEREO|CHANNEL_BACK_LEFT|CHANNEL_BACK_CENTER|CHANNEL_BACK_RIGHT, ///< 8, CL + C+ CR + L + R + SL + S+ SR
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_BACK_LEFT|CH_BACK_RIGHT, ///< 4, L + R+ SL+SR
CH_LAYOUT_STEREO|CH_FRONT_CENTER|CH_BACK_LEFT|CH_BACK_RIGHT, ///< 5, C + L + R+ SL+SR
CH_LAYOUT_STEREO|CH_BACK_LEFT|CH_BACK_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_BACK_LEFT|CH_BACK_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_BACK_LEFT|CH_BACK_CENTER|CH_BACK_RIGHT, ///< 8, CL + C+ CR + L + R + SL + S+ SR
/* The following entries adds the LFE layouts, this way we can reuse the table for the AVCodec channel_layouts member*/
CHANNEL_FRONT_CENTER|CHANNEL_LOW_FREQUENCY,
CHANNEL_LAYOUT_STEREO|CHANNEL_LOW_FREQUENCY,
CHANNEL_LAYOUT_STEREO|CHANNEL_FRONT_CENTER|CHANNEL_LOW_FREQUENCY,
CHANNEL_LAYOUT_STEREO|CHANNEL_BACK_CENTER|CHANNEL_LOW_FREQUENCY,
CHANNEL_LAYOUT_STEREO|CHANNEL_FRONT_CENTER|CHANNEL_BACK_CENTER|CHANNEL_LOW_FREQUENCY,
CHANNEL_LAYOUT_STEREO|CHANNEL_BACK_LEFT|CHANNEL_BACK_RIGHT|CHANNEL_LOW_FREQUENCY,
CHANNEL_LAYOUT_STEREO|CHANNEL_FRONT_CENTER|CHANNEL_BACK_LEFT|CHANNEL_BACK_RIGHT|CHANNEL_LOW_FREQUENCY,
CHANNEL_LAYOUT_STEREO|CHANNEL_BACK_LEFT|CHANNEL_BACK_RIGHT|CHANNEL_FRONT_LEFT_OF_CENTER|CHANNEL_FRONT_RIGHT_OF_CENTER|CHANNEL_LOW_FREQUENCY,
CHANNEL_LAYOUT_STEREO|CHANNEL_BACK_LEFT|CHANNEL_BACK_RIGHT|CHANNEL_FRONT_CENTER|CHANNEL_BACK_CENTER|CHANNEL_LOW_FREQUENCY,
CHANNEL_FRONT_CENTER|CHANNEL_FRONT_RIGHT_OF_CENTER|CHANNEL_FRONT_LEFT_OF_CENTER|CHANNEL_BACK_CENTER|CHANNEL_BACK_LEFT|CHANNEL_BACK_RIGHT|CHANNEL_LOW_FREQUENCY,
CHANNEL_FRONT_LEFT_OF_CENTER|CHANNEL_FRONT_CENTER|CHANNEL_FRONT_RIGHT_OF_CENTER|CHANNEL_LAYOUT_STEREO|CHANNEL_BACK_LEFT|CHANNEL_BACK_RIGHT|CHANNEL_LOW_FREQUENCY,
CHANNEL_FRONT_LEFT_OF_CENTER|CHANNEL_FRONT_RIGHT_OF_CENTER|CHANNEL_LAYOUT_STEREO|CHANNEL_SIDE_LEFT|CHANNEL_SIDE_RIGHT|CHANNEL_BACK_LEFT|CHANNEL_BACK_RIGHT|CHANNEL_LOW_FREQUENCY,
CHANNEL_FRONT_LEFT_OF_CENTER|CHANNEL_FRONT_CENTER|CHANNEL_FRONT_RIGHT_OF_CENTER|CHANNEL_LAYOUT_STEREO|CHANNEL_BACK_LEFT|CHANNEL_BACK_CENTER|CHANNEL_BACK_RIGHT|CHANNEL_LOW_FREQUENCY,
CH_FRONT_CENTER|CH_LOW_FREQUENCY,
CH_LAYOUT_STEREO|CH_LOW_FREQUENCY,
CH_LAYOUT_STEREO|CH_FRONT_CENTER|CH_LOW_FREQUENCY,
CH_LAYOUT_STEREO|CH_BACK_CENTER|CH_LOW_FREQUENCY,
CH_LAYOUT_STEREO|CH_FRONT_CENTER|CH_BACK_CENTER|CH_LOW_FREQUENCY,
CH_LAYOUT_STEREO|CH_BACK_LEFT|CH_BACK_RIGHT|CH_LOW_FREQUENCY,
CH_LAYOUT_STEREO|CH_FRONT_CENTER|CH_BACK_LEFT|CH_BACK_RIGHT|CH_LOW_FREQUENCY,
CH_LAYOUT_STEREO|CH_BACK_LEFT|CH_BACK_RIGHT|CH_FRONT_LEFT_OF_CENTER|CH_FRONT_RIGHT_OF_CENTER|CH_LOW_FREQUENCY,
CH_LAYOUT_STEREO|CH_BACK_LEFT|CH_BACK_RIGHT|CH_FRONT_CENTER|CH_BACK_CENTER|CH_LOW_FREQUENCY,
CH_FRONT_CENTER|CH_FRONT_RIGHT_OF_CENTER|CH_FRONT_LEFT_OF_CENTER|CH_BACK_CENTER|CH_BACK_LEFT|CH_BACK_RIGHT|CH_LOW_FREQUENCY,
CH_FRONT_LEFT_OF_CENTER|CH_FRONT_CENTER|CH_FRONT_RIGHT_OF_CENTER|CH_LAYOUT_STEREO|CH_BACK_LEFT|CH_BACK_RIGHT|CH_LOW_FREQUENCY,
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|CH_LOW_FREQUENCY,
CH_FRONT_LEFT_OF_CENTER|CH_FRONT_CENTER|CH_FRONT_RIGHT_OF_CENTER|CH_LAYOUT_STEREO|CH_BACK_LEFT|CH_BACK_CENTER|CH_BACK_RIGHT|CH_LOW_FREQUENCY,
0,
};
@ -1211,12 +1211,12 @@ 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 = CHANNEL_LAYOUT_STEREO;
avctx->channel_layout = CH_LAYOUT_STEREO;
}
if (s->amode<16)
avctx->channel_layout = dca_core_channel_layout[s->amode];
if (s->lfe) avctx->channel_layout |= CHANNEL_LOW_FREQUENCY;
if (s->lfe) avctx->channel_layout |= CH_LOW_FREQUENCY;
/* There is nothing that prevents a dts frame to change channel configuration
but FFmpeg doesn't support that so only set the channels if it is previously

Loading…
Cancel
Save