1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00

lavfi: add avfilter_all_channel_layouts public symbol

This list is mainly useful to be directly used as a parameter by the
audio sink buffer, when there is no need to force a specific channel
layout.

The list of formats is generated programmatically, and avoids channel
layouts not supported by libavfilter (with more than 8 channels).

We preferred to avoid compile-time generation in order to avoid some
unnecessary complexity (build hacks, generating code maintainance
etc.).

A more compact way to express this list through the use of macros
should be possible when libavfilter will support more than 8 channels,
as there will be no need to filter out channel layouts with more than
8 channels.

See thread:
Subject: [FFmpeg-devel] [PATCH] lavfi: add ff_all_channel_layouts internal symbol
Date: Sat, 20 Aug 2011 15:33:16 +0200
This commit is contained in:
Stefano Sabatini 2011-08-18 15:26:21 +02:00 committed by Stefano Sabatini
parent 9899037dc6
commit ea8de109af
5 changed files with 103 additions and 18 deletions

View File

@ -13,6 +13,9 @@ libavutil: 2011-04-18
API changes, most recent first:
2011-09-16 - xxxxxxx - lavfi 2.42.0
Add avfilter_all_channel_layouts.
2011-09-16 - xxxxxxx - lavfi 2.41.0
Rename avfilter_all_* function names to avfilter_make_all_*.

View File

@ -146,6 +146,8 @@ OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/pullup.o
DIRS = x86 libmpcodecs
TESTPROGS = formats
TOOLS = graph2dot lavfi-showfiltfmts
include $(SRC_PATH)/subdir.mak

View File

@ -0,0 +1,68 @@
AV_CH_FRONT_CENTER,
AV_CH_FRONT_CENTER|AV_CH_LOW_FREQUENCY,
AV_CH_FRONT_LEFT|AV_CH_FRONT_RIGHT,
AV_CH_FRONT_LEFT|AV_CH_FRONT_RIGHT|AV_CH_LOW_FREQUENCY,
AV_CH_FRONT_LEFT|AV_CH_FRONT_RIGHT|AV_CH_FRONT_CENTER,
AV_CH_FRONT_LEFT|AV_CH_FRONT_RIGHT|AV_CH_FRONT_CENTER|AV_CH_LOW_FREQUENCY,
AV_CH_FRONT_CENTER|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT,
AV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T|AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT,
AV_CH_FRONT_LEFT|AV_CH_FRONT_RIGHT|AV_CH_LOW_FREQUENCY|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT|AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT,
AV_CH_FRONT_LEFT|AV_CH_FRONT_RIGHT|AV_CH_FRONT_CENTER|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT|AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT,
AV_CH_FRONT_LEFT|AV_CH_FRONT_RIGHT|AV_CH_FRONT_CENTER|AV_CH_LOW_FREQUENCY|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT|AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT,
AV_CH_FRONT_CENTER|AV_CH_BACK_CENTER|AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT,
AV_CH_FRONT_CENTER|AV_CH_LOW_FREQUENCY|AV_CH_BACK_CENTER|AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT,
AV_CH_FRONT_LEFT|AV_CH_FRONT_RIGHT|AV_CH_BACK_CENTER|AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT,
AV_CH_FRONT_LEFT|AV_CH_FRONT_RIGHT|AV_CH_LOW_FREQUENCY|AV_CH_BACK_CENTER|AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT,
AV_CH_FRONT_LEFT|AV_CH_FRONT_RIGHT|AV_CH_FRONT_CENTER|AV_CH_BACK_CENTER|AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT,
AV_CH_FRONT_LEFT|AV_CH_FRONT_RIGHT|AV_CH_FRONT_CENTER|AV_CH_LOW_FREQUENCY|AV_CH_BACK_CENTER|AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT,
AV_CH_FRONT_CENTER|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT|AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT,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FT|AV_CH_STEREO_RIGHT,
AV_CH_FRONT_CENTER|AV_CH_LOW_FREQUENCY|AV_CH_BACK_CENTER|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT|AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT,
AV_CH_FRONT_LEFT|AV_CH_FRONT_RIGHT|AV_CH_BACK_CENTER|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT|AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT,
AV_CH_FRONT_LEFT|AV_CH_FRONT_RIGHT|AV_CH_LOW_FREQUENCY|AV_CH_BACK_CENTER|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT|AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT,
AV_CH_FRONT_LEFT|AV_CH_FRONT_RIGHT|AV_CH_FRONT_CENTER|AV_CH_BACK_CENTER|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT|AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT,

View File

@ -29,7 +29,7 @@
#include "libavutil/rational.h"
#define LIBAVFILTER_VERSION_MAJOR 2
#define LIBAVFILTER_VERSION_MINOR 41
#define LIBAVFILTER_VERSION_MINOR 42
#define LIBAVFILTER_VERSION_MICRO 0
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
@ -274,6 +274,11 @@ AVFilterFormats *avfilter_all_formats(enum AVMediaType type);
*/
AVFilterFormats *avfilter_make_all_formats(enum AVMediaType type);
/**
* A list of all channel layouts supported by libavfilter.
*/
extern const int64_t avfilter_all_channel_layouts[];
/**
* Return a list of all channel layouts supported by FFmpeg.
*/

View File

@ -160,25 +160,14 @@ AVFilterFormats *avfilter_make_all_formats(enum AVMediaType type)
return ret;
}
const int64_t avfilter_all_channel_layouts[] = {
#include "all_channel_layouts.h"
-1
};
AVFilterFormats *avfilter_make_all_channel_layouts(void)
{
static int64_t chlayouts[] = {
AV_CH_LAYOUT_MONO,
AV_CH_LAYOUT_STEREO,
AV_CH_LAYOUT_4POINT0,
AV_CH_LAYOUT_QUAD,
AV_CH_LAYOUT_5POINT0,
AV_CH_LAYOUT_5POINT0_BACK,
AV_CH_LAYOUT_5POINT1,
AV_CH_LAYOUT_5POINT1_BACK,
AV_CH_LAYOUT_5POINT1|AV_CH_LAYOUT_STEREO_DOWNMIX,
AV_CH_LAYOUT_7POINT1,
AV_CH_LAYOUT_7POINT1_WIDE,
AV_CH_LAYOUT_7POINT1|AV_CH_LAYOUT_STEREO_DOWNMIX,
-1,
};
return avfilter_make_format64_list(chlayouts);
return avfilter_make_format64_list(avfilter_all_channel_layouts);
}
AVFilterFormats *avfilter_make_all_packing_formats(void)
@ -317,3 +306,21 @@ int ff_parse_packing_format(int *ret, const char *arg, void *log_ctx)
return 0;
}
#ifdef TEST
#undef printf
int main(void)
{
const int64_t *cl;
char buf[512];
for (cl = avfilter_all_channel_layouts_int64; *cl != -1; cl++) {
av_get_channel_layout_string(buf, sizeof(buf), -1, *cl);
printf("%s\n", buf);
}
return 0;
}
#endif