aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefano Sabatini <stefano.sabatini-lala@poste.it>2011-06-30 09:51:17 +0200
committerStefano Sabatini <stefano.sabatini-lala@poste.it>2011-07-01 12:14:16 +0200
commit7464a53aaa5a241858ffbcb0194d3fc44a7aa441 (patch)
treedd17645623fb10135a6ded42bdb262a41841e53c
parent518d8d436566e6260d73346cd999ff69eeb94e49 (diff)
downloadffmpeg-7464a53aaa5a241858ffbcb0194d3fc44a7aa441.tar.gz
lavfi: make pix_fmt_is_in() in vf_lut.c an internal function
Also generalize it, making it accept ints rather than pixel formats. Allow factorization.
-rw-r--r--libavfilter/avfilter.h2
-rw-r--r--libavfilter/formats.c12
-rw-r--r--libavfilter/internal.h3
-rw-r--r--libavfilter/vf_lut.c15
4 files changed, 19 insertions, 13 deletions
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index 5d25c72289..0b8f2d4bc7 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -27,7 +27,7 @@
#define LIBAVFILTER_VERSION_MAJOR 2
#define LIBAVFILTER_VERSION_MINOR 24
-#define LIBAVFILTER_VERSION_MICRO 0
+#define LIBAVFILTER_VERSION_MICRO 1
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
LIBAVFILTER_VERSION_MINOR, \
diff --git a/libavfilter/formats.c b/libavfilter/formats.c
index eccb52304b..b6e30e7ab4 100644
--- a/libavfilter/formats.c
+++ b/libavfilter/formats.c
@@ -22,6 +22,7 @@
#include "libavutil/pixdesc.h"
#include "libavutil/audioconvert.h"
#include "avfilter.h"
+#include "internal.h"
/**
* Add all refs from a to ret and destroy a.
@@ -73,6 +74,17 @@ AVFilterFormats *avfilter_merge_formats(AVFilterFormats *a, AVFilterFormats *b)
return ret;
}
+int ff_fmt_is_in(int fmt, const int *fmts)
+{
+ const int *p;
+
+ for (p = fmts; *p != -1; p++) {
+ if (fmt == *p)
+ return 1;
+ }
+ return 0;
+}
+
#define MAKE_FORMAT_LIST() \
AVFilterFormats *formats; \
int count = 0; \
diff --git a/libavfilter/internal.h b/libavfilter/internal.h
index be1e9b08f2..7537565768 100644
--- a/libavfilter/internal.h
+++ b/libavfilter/internal.h
@@ -58,4 +58,7 @@ int ff_avfilter_graph_config_formats(AVFilterGraph *graphctx, AVClass *log_ctx);
/** default handler for freeing audio/video buffer when there are no references left */
void ff_avfilter_default_free_buffer(AVFilterBuffer *buf);
+/** Tell is a format is contained in the provided list terminated by -1. */
+int ff_fmt_is_in(int fmt, const int *fmts);
+
#endif /* AVFILTER_INTERNAL_H */
diff --git a/libavfilter/vf_lut.c b/libavfilter/vf_lut.c
index fdab6941a4..8607ee906c 100644
--- a/libavfilter/vf_lut.c
+++ b/libavfilter/vf_lut.c
@@ -28,6 +28,7 @@
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
+#include "internal.h"
static const char *var_names[] = {
"E",
@@ -165,16 +166,6 @@ static int query_formats(AVFilterContext *ctx)
return 0;
}
-static int pix_fmt_is_in(enum PixelFormat pix_fmt, enum PixelFormat *pix_fmts)
-{
- enum PixelFormat *p;
- for (p = pix_fmts; *p != PIX_FMT_NONE; p++) {
- if (pix_fmt == *p)
- return 1;
- }
- return 0;
-}
-
/**
* Clip value val in the minval - maxval range.
*/
@@ -245,8 +236,8 @@ static int config_props(AVFilterLink *inlink)
}
lut->is_yuv = lut->is_rgb = 0;
- if (pix_fmt_is_in(inlink->format, yuv_pix_fmts)) lut->is_yuv = 1;
- else if (pix_fmt_is_in(inlink->format, rgb_pix_fmts)) lut->is_rgb = 1;
+ if (ff_fmt_is_in(inlink->format, yuv_pix_fmts)) lut->is_yuv = 1;
+ else if (ff_fmt_is_in(inlink->format, rgb_pix_fmts)) lut->is_rgb = 1;
if (lut->is_rgb) {
switch (inlink->format) {