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
pull/2/head
Stefano Sabatini 14 years ago committed by Stefano Sabatini
parent 9899037dc6
commit ea8de109af
  1. 3
      doc/APIchanges
  2. 2
      libavfilter/Makefile
  3. 68
      libavfilter/all_channel_layouts.h
  4. 7
      libavfilter/avfilter.h
  5. 41
      libavfilter/formats.c

@ -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_*.

@ -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

@ -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,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IGHT|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_RIG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_LEFT|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,

@ -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.
*/

@ -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

Loading…
Cancel
Save