Commit 9899037d authored by Stefano Sabatini's avatar Stefano Sabatini Committed by Stefano Sabatini

lavfi: rename avfilter_all_* function names to avfilter_make_all_*

A function name should tell what the function does rather than what
the function returns. This also avoids possible conflicts
(e.g. between a function and a public list of all supported formats),
and clarifies the code.

Breaks audio API/ABI, add a backward compatibility layer for video
API/ABI.
parent 98b906e1
...@@ -13,6 +13,14 @@ libavutil: 2011-04-18 ...@@ -13,6 +13,14 @@ libavutil: 2011-04-18
API changes, most recent first: API changes, most recent first:
2011-09-16 - xxxxxxx - lavfi 2.41.0
Rename avfilter_all_* function names to avfilter_make_all_*.
In particular, apply the renames:
avfilter_all_formats -> avfilter_make_all_formats
avfilter_all_channel_layouts -> avfilter_make_all_channel_layouts
avfilter_all_packing_formats -> avfilter_make_all_packing_formats
2011-09-12 - xxxxxxx - lavfi 2.40.0 2011-09-12 - xxxxxxx - lavfi 2.40.0
Change AVFilterBufferRefAudioProps.sample_rate type from uint32_t to int. Change AVFilterBufferRefAudioProps.sample_rate type from uint32_t to int.
......
...@@ -63,9 +63,9 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque) ...@@ -63,9 +63,9 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
if (*args) \ if (*args) \
args++; args++;
ADD_FORMATS(avfilter_all_formats(AVMEDIA_TYPE_AUDIO), sample_format, int, formats); ADD_FORMATS(avfilter_make_all_formats(AVMEDIA_TYPE_AUDIO), sample_format, int, formats);
ADD_FORMATS(avfilter_all_channel_layouts(), channel_layout, int64_t, chlayouts); ADD_FORMATS(avfilter_make_all_channel_layouts(), channel_layout, int64_t, chlayouts);
ADD_FORMATS(avfilter_all_packing_formats(), packing_format, int, packing); ADD_FORMATS(avfilter_make_all_packing_formats(), packing_format, int, packing);
return 0; return 0;
......
...@@ -104,12 +104,12 @@ static int query_formats(AVFilterContext *ctx) ...@@ -104,12 +104,12 @@ static int query_formats(AVFilterContext *ctx)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
avfilter_set_common_sample_formats(ctx, formats); avfilter_set_common_sample_formats(ctx, formats);
formats = avfilter_all_channel_layouts(); formats = avfilter_make_all_channel_layouts();
if (!formats) if (!formats)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
avfilter_set_common_channel_layouts(ctx, formats); avfilter_set_common_channel_layouts(ctx, formats);
formats = avfilter_all_packing_formats(); formats = avfilter_make_all_packing_formats();
if (!formats) if (!formats)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
avfilter_set_common_packing_formats(ctx, formats); avfilter_set_common_packing_formats(ctx, formats);
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include "libavutil/rational.h" #include "libavutil/rational.h"
#define LIBAVFILTER_VERSION_MAJOR 2 #define LIBAVFILTER_VERSION_MAJOR 2
#define LIBAVFILTER_VERSION_MINOR 40 #define LIBAVFILTER_VERSION_MINOR 41
#define LIBAVFILTER_VERSION_MICRO 0 #define LIBAVFILTER_VERSION_MICRO 0
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
...@@ -43,6 +43,9 @@ ...@@ -43,6 +43,9 @@
#ifndef FF_API_OLD_VSINK_API #ifndef FF_API_OLD_VSINK_API
#define FF_API_OLD_VSINK_API (LIBAVUTIL_VERSION_MAJOR < 3) #define FF_API_OLD_VSINK_API (LIBAVUTIL_VERSION_MAJOR < 3)
#endif #endif
#ifndef FF_API_OLD_ALL_FORMATS_API
#define FF_API_OLD_ALL_FORMATS_API (LIBAVUTIL_VERSION_MAJOR < 3)
#endif
#include <stddef.h> #include <stddef.h>
...@@ -258,20 +261,28 @@ AVFilterFormats *avfilter_make_format64_list(const int64_t *fmts); ...@@ -258,20 +261,28 @@ AVFilterFormats *avfilter_make_format64_list(const int64_t *fmts);
*/ */
int avfilter_add_format(AVFilterFormats **avff, int64_t fmt); int avfilter_add_format(AVFilterFormats **avff, int64_t fmt);
#if FF_API_OLD_ALL_FORMATS_API
/** /**
* Return a list of all formats supported by FFmpeg for the given media type. * @deprecated Use avfilter_make_all_formats() instead.
*/ */
attribute_deprecated
AVFilterFormats *avfilter_all_formats(enum AVMediaType type); AVFilterFormats *avfilter_all_formats(enum AVMediaType type);
#endif
/**
* Return a list of all formats supported by FFmpeg for the given media type.
*/
AVFilterFormats *avfilter_make_all_formats(enum AVMediaType type);
/** /**
* Return a list of all channel layouts supported by FFmpeg. * Return a list of all channel layouts supported by FFmpeg.
*/ */
AVFilterFormats *avfilter_all_channel_layouts(void); AVFilterFormats *avfilter_make_all_channel_layouts(void);
/** /**
* Return a list of all audio packing formats. * Return a list of all audio packing formats.
*/ */
AVFilterFormats *avfilter_all_packing_formats(void); AVFilterFormats *avfilter_make_all_packing_formats(void);
/** /**
* Return a format list which contains the intersection of the formats of * Return a format list which contains the intersection of the formats of
......
...@@ -222,10 +222,10 @@ void avfilter_set_common_packing_formats(AVFilterContext *ctx, AVFilterFormats * ...@@ -222,10 +222,10 @@ void avfilter_set_common_packing_formats(AVFilterContext *ctx, AVFilterFormats *
int avfilter_default_query_formats(AVFilterContext *ctx) int avfilter_default_query_formats(AVFilterContext *ctx)
{ {
avfilter_set_common_pixel_formats(ctx, avfilter_all_formats(AVMEDIA_TYPE_VIDEO)); avfilter_set_common_pixel_formats(ctx, avfilter_make_all_formats(AVMEDIA_TYPE_VIDEO));
avfilter_set_common_sample_formats(ctx, avfilter_all_formats(AVMEDIA_TYPE_AUDIO)); avfilter_set_common_sample_formats(ctx, avfilter_make_all_formats(AVMEDIA_TYPE_AUDIO));
avfilter_set_common_channel_layouts(ctx, avfilter_all_channel_layouts()); avfilter_set_common_channel_layouts(ctx, avfilter_make_all_channel_layouts());
avfilter_set_common_packing_formats(ctx, avfilter_all_packing_formats()); avfilter_set_common_packing_formats(ctx, avfilter_make_all_packing_formats());
return 0; return 0;
} }
......
...@@ -138,7 +138,14 @@ int avfilter_add_format(AVFilterFormats **avff, int64_t fmt) ...@@ -138,7 +138,14 @@ int avfilter_add_format(AVFilterFormats **avff, int64_t fmt)
return 0; return 0;
} }
#if FF_API_OLD_ALL_FORMATS_API
AVFilterFormats *avfilter_all_formats(enum AVMediaType type) AVFilterFormats *avfilter_all_formats(enum AVMediaType type)
{
return avfilter_make_all_formats(type);
}
#endif
AVFilterFormats *avfilter_make_all_formats(enum AVMediaType type)
{ {
AVFilterFormats *ret = NULL; AVFilterFormats *ret = NULL;
int fmt; int fmt;
...@@ -153,7 +160,7 @@ AVFilterFormats *avfilter_all_formats(enum AVMediaType type) ...@@ -153,7 +160,7 @@ AVFilterFormats *avfilter_all_formats(enum AVMediaType type)
return ret; return ret;
} }
AVFilterFormats *avfilter_all_channel_layouts(void) AVFilterFormats *avfilter_make_all_channel_layouts(void)
{ {
static int64_t chlayouts[] = { static int64_t chlayouts[] = {
AV_CH_LAYOUT_MONO, AV_CH_LAYOUT_MONO,
...@@ -174,7 +181,7 @@ AVFilterFormats *avfilter_all_channel_layouts(void) ...@@ -174,7 +181,7 @@ AVFilterFormats *avfilter_all_channel_layouts(void)
return avfilter_make_format64_list(chlayouts); return avfilter_make_format64_list(chlayouts);
} }
AVFilterFormats *avfilter_all_packing_formats(void) AVFilterFormats *avfilter_make_all_packing_formats(void)
{ {
static int packing[] = { static int packing[] = {
AVFILTER_PACKED, AVFILTER_PACKED,
......
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