[FFmpeg-devel] [PATCH 1/2] lavfi: make AVFilteFormats use int64_t lists to support channel layouts.

Mina Nagy Zaki mnzaki at gmail.com
Thu Jun 9 12:25:25 CEST 2011


The list type was changed to int64_t to be able to hold
channel layouts.

Usage of avfilter_make_format_list for PixelFromats/[AV]SampleFormats
had to be changed to use int64_t[] instead of enums, as they are 32bit.
---
 cmdutils.c                  |    4 ++--
 ffplay.c                    |    2 +-
 libavfilter/avfilter.h      |    6 +++---
 libavfilter/formats.c       |    6 +++---
 libavfilter/vf_blackframe.c |    2 +-
 libavfilter/vf_crop.c       |    2 +-
 libavfilter/vf_cropdetect.c |    2 +-
 libavfilter/vf_drawbox.c    |    2 +-
 libavfilter/vf_drawtext.c   |    2 +-
 libavfilter/vf_fade.c       |    2 +-
 libavfilter/vf_frei0r.c     |    2 +-
 libavfilter/vf_gradfun.c    |    2 +-
 libavfilter/vf_hflip.c      |    2 +-
 libavfilter/vf_hqdn3d.c     |    2 +-
 libavfilter/vf_libopencv.c  |    2 +-
 libavfilter/vf_overlay.c    |    4 ++--
 libavfilter/vf_pad.c        |    2 +-
 libavfilter/vf_transpose.c  |    2 +-
 libavfilter/vf_unsharp.c    |    2 +-
 libavfilter/vf_yadif.c      |    2 +-
 libavfilter/vsrc_buffer.c   |    4 ++--
 libavfilter/vsrc_color.c    |    2 +-
 libavfilter/vsrc_movie.c    |    2 +-
 23 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/cmdutils.c b/cmdutils.c
index 4f27f50..c2e90b2 100644
--- a/cmdutils.c
+++ b/cmdutils.c
@@ -768,7 +768,7 @@ void show_filters(void)
 
 void show_pix_fmts(void)
 {
-    enum PixelFormat pix_fmt;
+    int64_t pix_fmt;
 
     printf(
         "Pixel formats:\n"
@@ -899,7 +899,7 @@ static void null_end_frame(AVFilterLink *inlink) { }
 static int ffsink_query_formats(AVFilterContext *ctx)
 {
     FFSinkContext *priv = ctx->priv;
-    enum PixelFormat pix_fmts[] = { priv->pix_fmt, PIX_FMT_NONE };
+    int64_t pix_fmts[] = { priv->pix_fmt, PIX_FMT_NONE };
 
     avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts));
     return 0;
diff --git a/ffplay.c b/ffplay.c
index ebe9e05..9bcefe7 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -1639,7 +1639,7 @@ static int input_request_frame(AVFilterLink *link)
 static int input_query_formats(AVFilterContext *ctx)
 {
     FilterPriv *priv = ctx->priv;
-    enum PixelFormat pix_fmts[] = {
+    int64_t pix_fmts[] = {
         priv->is->video_st->codec->pix_fmt, PIX_FMT_NONE
     };
 
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index 8edf42f..3a71fb4 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -223,7 +223,7 @@ void avfilter_unref_buffer(AVFilterBufferRef *ref);
  */
 typedef struct AVFilterFormats {
     unsigned format_count;      ///< number of formats
-    int *formats;               ///< list of media formats
+    int64_t *formats;           ///< list of media formats
 
     unsigned refcount;          ///< number of references to this list
     struct AVFilterFormats ***refs; ///< references to this list
@@ -237,7 +237,7 @@ typedef struct AVFilterFormats {
  *        empty list is created.
  * @return the format list, with no existing references
  */
-AVFilterFormats *avfilter_make_format_list(const int *fmts);
+AVFilterFormats *avfilter_make_format_list(const int64_t *fmts);
 
 /**
  * Add fmt to the list of media formats contained in *avff.
@@ -247,7 +247,7 @@ AVFilterFormats *avfilter_make_format_list(const int 
*fmts);
  * @return a non negative value in case of success, or a negative
  * value corresponding to an AVERROR code in case of error
  */
-int avfilter_add_format(AVFilterFormats **avff, int fmt);
+int avfilter_add_format(AVFilterFormats **avff, int64_t fmt);
 
 /**
  * Return a list of all formats supported by FFmpeg for the given media type.
diff --git a/libavfilter/formats.c b/libavfilter/formats.c
index 58593fc..962a915 100644
--- a/libavfilter/formats.c
+++ b/libavfilter/formats.c
@@ -72,7 +72,7 @@ AVFilterFormats *avfilter_merge_formats(AVFilterFormats *a, 
AVFilterFormats *b)
     return ret;
 }
 
-AVFilterFormats *avfilter_make_format_list(const int *fmts)
+AVFilterFormats *avfilter_make_format_list(const int64_t *fmts)
 {
     AVFilterFormats *formats;
     int count = 0;
@@ -91,9 +91,9 @@ AVFilterFormats *avfilter_make_format_list(const int *fmts)
     return formats;
 }
 
-int avfilter_add_format(AVFilterFormats **avff, int fmt)
+int avfilter_add_format(AVFilterFormats **avff, int64_t fmt)
 {
-    int *fmts;
+    int64_t *fmts;
 
     if (!(*avff) && !(*avff = av_mallocz(sizeof(AVFilterFormats))))
         return AVERROR(ENOMEM);
diff --git a/libavfilter/vf_blackframe.c b/libavfilter/vf_blackframe.c
index 658c30f..01ee5f3 100644
--- a/libavfilter/vf_blackframe.c
+++ b/libavfilter/vf_blackframe.c
@@ -38,7 +38,7 @@ typedef struct {
 
 static int query_formats(AVFilterContext *ctx)
 {
-    static const enum PixelFormat pix_fmts[] = {
+    static const int64_t pix_fmts[] = {
         PIX_FMT_YUV410P, PIX_FMT_YUV420P, PIX_FMT_GRAY8, PIX_FMT_NV12,
         PIX_FMT_NV21, PIX_FMT_YUV444P, PIX_FMT_YUV422P, PIX_FMT_YUV411P,
         PIX_FMT_NONE
diff --git a/libavfilter/vf_crop.c b/libavfilter/vf_crop.c
index 8182a36..59df507 100644
--- a/libavfilter/vf_crop.c
+++ b/libavfilter/vf_crop.c
@@ -78,7 +78,7 @@ typedef struct {
 
 static int query_formats(AVFilterContext *ctx)
 {
-    static const enum PixelFormat pix_fmts[] = {
+    static const int64_t pix_fmts[] = {
         PIX_FMT_RGB48BE,      PIX_FMT_RGB48LE,
         PIX_FMT_BGR48BE,      PIX_FMT_BGR48LE,
         PIX_FMT_ARGB,         PIX_FMT_RGBA,
diff --git a/libavfilter/vf_cropdetect.c b/libavfilter/vf_cropdetect.c
index 000c8bb..b735a84 100644
--- a/libavfilter/vf_cropdetect.c
+++ b/libavfilter/vf_cropdetect.c
@@ -37,7 +37,7 @@ typedef struct {
 
 static int query_formats(AVFilterContext *ctx)
 {
-    static const enum PixelFormat pix_fmts[] = {
+    static const int64_t pix_fmts[] = {
         PIX_FMT_YUV420P, PIX_FMT_YUVJ420P,
         PIX_FMT_YUV422P, PIX_FMT_YUVJ422P,
         PIX_FMT_YUV444P, PIX_FMT_YUVJ444P,
diff --git a/libavfilter/vf_drawbox.c b/libavfilter/vf_drawbox.c
index 3785072..6b4553d 100644
--- a/libavfilter/vf_drawbox.c
+++ b/libavfilter/vf_drawbox.c
@@ -62,7 +62,7 @@ static av_cold int init(AVFilterContext *ctx, const char 
*args, void *opaque)
 
 static int query_formats(AVFilterContext *ctx)
 {
-    enum PixelFormat pix_fmts[] = {
+    int64_t pix_fmts[] = {
         PIX_FMT_YUV444P,  PIX_FMT_YUV422P,  PIX_FMT_YUV420P,
         PIX_FMT_YUV411P,  PIX_FMT_YUV410P,
         PIX_FMT_YUVJ444P, PIX_FMT_YUVJ422P, PIX_FMT_YUVJ420P,
diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c
index cf0eb43..63d3ec3 100644
--- a/libavfilter/vf_drawtext.c
+++ b/libavfilter/vf_drawtext.c
@@ -324,7 +324,7 @@ static av_cold int init(AVFilterContext *ctx, const char 
*args, void *opaque)
 
 static int query_formats(AVFilterContext *ctx)
 {
-    static const enum PixelFormat pix_fmts[] = {
+    static const int64_t pix_fmts[] = {
         PIX_FMT_ARGB,    PIX_FMT_RGBA,
         PIX_FMT_ABGR,    PIX_FMT_BGRA,
         PIX_FMT_RGB24,   PIX_FMT_BGR24,
diff --git a/libavfilter/vf_fade.c b/libavfilter/vf_fade.c
index 28179a3..a2a473a 100644
--- a/libavfilter/vf_fade.c
+++ b/libavfilter/vf_fade.c
@@ -69,7 +69,7 @@ static av_cold int init(AVFilterContext *ctx, const char 
*args, void *opaque)
 
 static int query_formats(AVFilterContext *ctx)
 {
-    const static enum PixelFormat pix_fmts[] = {
+    const static int64_t pix_fmts[] = {
         PIX_FMT_YUV444P,  PIX_FMT_YUV422P,  PIX_FMT_YUV420P,
         PIX_FMT_YUV411P,  PIX_FMT_YUV410P,
         PIX_FMT_YUVJ444P, PIX_FMT_YUVJ422P, PIX_FMT_YUVJ420P,
diff --git a/libavfilter/vf_frei0r.c b/libavfilter/vf_frei0r.c
index 0cb5fd3..18b24ee 100644
--- a/libavfilter/vf_frei0r.c
+++ b/libavfilter/vf_frei0r.c
@@ -323,7 +323,7 @@ static int query_formats(AVFilterContext *ctx)
     } else if (frei0r->plugin_info.color_model == F0R_COLOR_MODEL_RGBA8888) {
         avfilter_add_format(&formats, PIX_FMT_RGBA);
     } else {                                   /* F0R_COLOR_MODEL_PACKED32 */
-        static const enum PixelFormat pix_fmts[] = {
+        static const int64_t pix_fmts[] = {
             PIX_FMT_BGRA, PIX_FMT_ARGB, PIX_FMT_ABGR, PIX_FMT_ARGB, 
PIX_FMT_NONE
         };
         formats = avfilter_make_format_list(pix_fmts);
diff --git a/libavfilter/vf_gradfun.c b/libavfilter/vf_gradfun.c
index 32dd3c1..111ce5a 100644
--- a/libavfilter/vf_gradfun.c
+++ b/libavfilter/vf_gradfun.c
@@ -152,7 +152,7 @@ static av_cold void uninit(AVFilterContext *ctx)
 
 static int query_formats(AVFilterContext *ctx)
 {
-    static const enum PixelFormat pix_fmts[] = {
+    static const int64_t pix_fmts[] = {
         PIX_FMT_YUV410P,            PIX_FMT_YUV420P,
         PIX_FMT_GRAY8,              PIX_FMT_NV12,
         PIX_FMT_NV21,               PIX_FMT_YUV444P,
diff --git a/libavfilter/vf_hflip.c b/libavfilter/vf_hflip.c
index f1a37e7..ce77ba2 100644
--- a/libavfilter/vf_hflip.c
+++ b/libavfilter/vf_hflip.c
@@ -36,7 +36,7 @@ typedef struct {
 
 static int query_formats(AVFilterContext *ctx)
 {
-    static const enum PixelFormat pix_fmts[] = {
+    static const int64_t pix_fmts[] = {
         PIX_FMT_RGB48BE,      PIX_FMT_RGB48LE,
         PIX_FMT_BGR48BE,      PIX_FMT_BGR48LE,
         PIX_FMT_ARGB,         PIX_FMT_RGBA,
diff --git a/libavfilter/vf_hqdn3d.c b/libavfilter/vf_hqdn3d.c
index 78a7bf7..7b64a62 100644
--- a/libavfilter/vf_hqdn3d.c
+++ b/libavfilter/vf_hqdn3d.c
@@ -264,7 +264,7 @@ static void uninit(AVFilterContext *ctx)
 
 static int query_formats(AVFilterContext *ctx)
 {
-    static const enum PixelFormat pix_fmts[] = {
+    static const int64_t pix_fmts[] = {
         PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_YUV411P, PIX_FMT_NONE
     };
 
diff --git a/libavfilter/vf_libopencv.c b/libavfilter/vf_libopencv.c
index b789c8e..4dd59df 100644
--- a/libavfilter/vf_libopencv.c
+++ b/libavfilter/vf_libopencv.c
@@ -57,7 +57,7 @@ static void fill_picref_from_iplimage(AVFilterBufferRef 
*picref, const IplImage
 
 static int query_formats(AVFilterContext *ctx)
 {
-    static const enum PixelFormat pix_fmts[] = {
+    static const int64_t pix_fmts[] = {
         PIX_FMT_BGR24, PIX_FMT_BGRA, PIX_FMT_GRAY8, PIX_FMT_NONE
     };
 
diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c
index 0eb24b9..f8f5e28 100644
--- a/libavfilter/vf_overlay.c
+++ b/libavfilter/vf_overlay.c
@@ -91,8 +91,8 @@ static av_cold void uninit(AVFilterContext *ctx)
 
 static int query_formats(AVFilterContext *ctx)
 {
-    const enum PixelFormat inout_pix_fmts[] = { PIX_FMT_YUV420P,  
PIX_FMT_NONE };
-    const enum PixelFormat blend_pix_fmts[] = { PIX_FMT_YUVA420P, 
PIX_FMT_NONE };
+    const int64_t inout_pix_fmts[] = { PIX_FMT_YUV420P,  PIX_FMT_NONE };
+    const int64_t blend_pix_fmts[] = { PIX_FMT_YUVA420P, PIX_FMT_NONE };
     AVFilterFormats *inout_formats = 
avfilter_make_format_list(inout_pix_fmts);
     AVFilterFormats *blend_formats = 
avfilter_make_format_list(blend_pix_fmts);
 
diff --git a/libavfilter/vf_pad.c b/libavfilter/vf_pad.c
index e41ebe8..75db319 100644
--- a/libavfilter/vf_pad.c
+++ b/libavfilter/vf_pad.c
@@ -68,7 +68,7 @@ enum var_name {
 
 static int query_formats(AVFilterContext *ctx)
 {
-    static const enum PixelFormat pix_fmts[] = {
+    static const int64_t pix_fmts[] = {
         PIX_FMT_ARGB,         PIX_FMT_RGBA,
         PIX_FMT_ABGR,         PIX_FMT_BGRA,
         PIX_FMT_RGB24,        PIX_FMT_BGR24,
diff --git a/libavfilter/vf_transpose.c b/libavfilter/vf_transpose.c
index a5247c9..b3a85e0 100644
--- a/libavfilter/vf_transpose.c
+++ b/libavfilter/vf_transpose.c
@@ -59,7 +59,7 @@ static av_cold int init(AVFilterContext *ctx, const char 
*args, void *opaque)
 
 static int query_formats(AVFilterContext *ctx)
 {
-    enum PixelFormat pix_fmts[] = {
+    int64_t pix_fmts[] = {
         PIX_FMT_ARGB,         PIX_FMT_RGBA,
         PIX_FMT_ABGR,         PIX_FMT_BGRA,
         PIX_FMT_RGB24,        PIX_FMT_BGR24,
diff --git a/libavfilter/vf_unsharp.c b/libavfilter/vf_unsharp.c
index fa75de5..8e27cf4 100644
--- a/libavfilter/vf_unsharp.c
+++ b/libavfilter/vf_unsharp.c
@@ -149,7 +149,7 @@ static av_cold int init(AVFilterContext *ctx, const char 
*args, void *opaque)
 
 static int query_formats(AVFilterContext *ctx)
 {
-    enum PixelFormat pix_fmts[] = {
+    int64_t pix_fmts[] = {
         PIX_FMT_YUV420P,  PIX_FMT_YUV422P,  PIX_FMT_YUV444P,  
PIX_FMT_YUV410P,
         PIX_FMT_YUV411P,  PIX_FMT_YUV440P,  PIX_FMT_YUVJ420P, 
PIX_FMT_YUVJ422P,
         PIX_FMT_YUVJ444P, PIX_FMT_YUVJ440P, PIX_FMT_NONE
diff --git a/libavfilter/vf_yadif.c b/libavfilter/vf_yadif.c
index d608c65..a4421db 100644
--- a/libavfilter/vf_yadif.c
+++ b/libavfilter/vf_yadif.c
@@ -313,7 +313,7 @@ static av_cold void uninit(AVFilterContext *ctx)
 
 static int query_formats(AVFilterContext *ctx)
 {
-    static const enum PixelFormat pix_fmts[] = {
+    static const int64_t pix_fmts[] = {
         PIX_FMT_YUV420P,
         PIX_FMT_YUV422P,
         PIX_FMT_YUV444P,
diff --git a/libavfilter/vsrc_buffer.c b/libavfilter/vsrc_buffer.c
index 246444b..f73064d 100644
--- a/libavfilter/vsrc_buffer.c
+++ b/libavfilter/vsrc_buffer.c
@@ -31,7 +31,7 @@
 typedef struct {
     AVFilterBufferRef *picref;
     int               h, w;
-    enum PixelFormat  pix_fmt;
+    int64_t  pix_fmt;
     AVRational        time_base;     ///< time_base to set in the output link
     AVRational        sample_aspect_ratio;
     char              sws_param[256];
@@ -164,7 +164,7 @@ static av_cold int init(AVFilterContext *ctx, const char 
*args, void *opaque)
 static int query_formats(AVFilterContext *ctx)
 {
     BufferSourceContext *c = ctx->priv;
-    enum PixelFormat pix_fmts[] = { c->pix_fmt, PIX_FMT_NONE };
+    int64_t pix_fmts[] = { c->pix_fmt, PIX_FMT_NONE };
 
     avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts));
     return 0;
diff --git a/libavfilter/vsrc_color.c b/libavfilter/vsrc_color.c
index dc73e1b..0f57549 100644
--- a/libavfilter/vsrc_color.c
+++ b/libavfilter/vsrc_color.c
@@ -79,7 +79,7 @@ static av_cold void color_uninit(AVFilterContext *ctx)
 
 static int query_formats(AVFilterContext *ctx)
 {
-    static const enum PixelFormat pix_fmts[] = {
+    static const int64_t pix_fmts[] = {
         PIX_FMT_ARGB,         PIX_FMT_RGBA,
         PIX_FMT_ABGR,         PIX_FMT_BGRA,
         PIX_FMT_RGB24,        PIX_FMT_BGR24,
diff --git a/libavfilter/vsrc_movie.c b/libavfilter/vsrc_movie.c
index 6c5c831..883e665 100644
--- a/libavfilter/vsrc_movie.c
+++ b/libavfilter/vsrc_movie.c
@@ -201,7 +201,7 @@ static av_cold void uninit(AVFilterContext *ctx)
 static int query_formats(AVFilterContext *ctx)
 {
     MovieContext *movie = ctx->priv;
-    enum PixelFormat pix_fmts[] = { movie->codec_ctx->pix_fmt, PIX_FMT_NONE 
};
+    int64_t pix_fmts[] = { movie->codec_ctx->pix_fmt, PIX_FMT_NONE };
 
     avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts));
     return 0;
-- 
1.7.4.4



More information about the ffmpeg-devel mailing list