Permalink
Browse files

filter: ensure type safety for the VideoFilter init function

add a function pointer to the FilterInfo struct and use it instead of
using dlsym and a symbol string. Fix many "X is defined but not used"
warnings after the FFmpeg sync (caused by declaring functions static
after `gcc -Werror=missing-prototypes` failed to compile).

git-svn-id: http://svn.mythtv.org/svn/trunk@25811 7dbf422c-18fa-0310-86e9-fd20926502f2
  • Loading branch information...
1 parent a449cbc commit 29f275681c05e2f98d0f010c37a990dd1720eaef @jannau jannau committed Aug 23, 2010
@@ -312,7 +312,7 @@ static FmtConv FmtList[] =
ConstFilterInfo filter_table[] =
{
{
- symbol: "newAdjustFilter",
+ filter_init: &newAdjustFilter,
name: "adjust",
descript: "adjust range and gamma of video",
formats: FmtList,
@@ -103,8 +103,10 @@ void bobDtor(VideoFilter *f)
free(filter->tmp_ptr);
}
-VideoFilter *new_filter(VideoFrameType inpixfmt, VideoFrameType outpixfmt,
- int *width, int *height, char *options, int threads)
+static VideoFilter *new_filter(VideoFrameType inpixfmt,
+ VideoFrameType outpixfmt,
+ int *width, int *height, char *options,
+ int threads)
{
BDFilter *filter;
(void)width;
@@ -141,7 +143,7 @@ static FmtConv FmtList[] =
ConstFilterInfo filter_table[] =
{
{
- symbol: "new_filter",
+ filter_init: &new_filter,
name: "bobdeint",
descript: "bob deinterlace filter; splits fields to top and bottom of buffer",
formats: FmtList,
@@ -159,7 +159,7 @@ static FmtConv FmtList[] =
FilterInfo filter_table[] =
{
{
- symbol: "newConvertFilter",
+ filter_init: &newConvertFilter,
name: "convert",
descript: "converts between various video types",
formats: FmtList,
@@ -303,7 +303,7 @@ static FmtConv FmtList[] =
ConstFilterInfo filter_table[] =
{
{
- symbol: "new_filter",
+ filter_init: &new_filter,
name: "crop",
descript: "crops picture by macroblock intervals",
formats: FmtList,
@@ -473,7 +473,7 @@ static FmtConv FmtList[] =
ConstFilterInfo filter_table[] =
{
{
- symbol: "NewDenoise3DFilter",
+ filter_init: &NewDenoise3DFilter,
name: "denoise3d",
descript: "removes noise with a spatial and temporal low-pass filter",
formats: FmtList,
@@ -193,10 +193,10 @@ static void CleanupFieldorderDeintFilter(VideoFilter * filter)
}
}
-static VideoFilter * FieldorderDeintFilter(VideoFrameType inpixfmt,
- VideoFrameType outpixfmt,
- int *width, int *height,
- char *options)
+static VideoFilter *FieldorderDeintFilter(VideoFrameType inpixfmt,
+ VideoFrameType outpixfmt,
+ int *width, int *height,
+ char *options, int threads)
{
ThisFilter *filter;
(void) height;
@@ -229,7 +229,7 @@ static FmtConv FmtList[] =
ConstFilterInfo filter_table[] =
{
{
- symbol: "FieldorderDeintFilter",
+ filter_init: &FieldorderDeintFilter,
name: "fieldorderdoubleprocessdeint",
descript: "avoids synchronisation problems when matching an "
"interlaced video mode to an interlaced source",
@@ -6,7 +6,7 @@
#include "filter.h"
#include "frame.h"
-VideoFilter *
+static VideoFilter *
new_force_template (VideoFrameType inpixfmt, VideoFrameType outpixfmt,
VideoFrameType mypixfmt)
{
@@ -26,9 +26,9 @@ new_force_template (VideoFrameType inpixfmt, VideoFrameType outpixfmt,
return filter;
}
-VideoFilter *
+static VideoFilter *
new_force_yv12 (VideoFrameType inpixfmt, VideoFrameType outpixfmt, int *width,
- int *height, char *options)
+ int *height, char *options, int threads)
{
(void) width;
(void) height;
@@ -37,9 +37,9 @@ new_force_yv12 (VideoFrameType inpixfmt, VideoFrameType outpixfmt, int *width,
return new_force_template (inpixfmt, outpixfmt, FMT_YV12);
}
-VideoFilter *
+static VideoFilter *
new_force_yuv422p (VideoFrameType inpixfmt, VideoFrameType outpixfmt, int *width,
- int *height, char *options)
+ int *height, char *options, int threads)
{
(void) width;
(void) height;
@@ -48,9 +48,9 @@ new_force_yuv422p (VideoFrameType inpixfmt, VideoFrameType outpixfmt, int *width
return new_force_template (inpixfmt, outpixfmt, FMT_YUV422P);
}
-VideoFilter *
+static VideoFilter *
new_force_rgb24 (VideoFrameType inpixfmt, VideoFrameType outpixfmt, int *width,
- int *height, char *options)
+ int *height, char *options, int threads)
{
(void) width;
(void) height;
@@ -59,7 +59,7 @@ new_force_rgb24 (VideoFrameType inpixfmt, VideoFrameType outpixfmt, int *width,
return new_force_template (inpixfmt, outpixfmt, FMT_RGB24);
}
-VideoFilter *
+static VideoFilter *
new_force_argb32 (VideoFrameType inpixfmt, VideoFrameType outpixfmt, int *width,
int *height, char *options, int threads)
{
@@ -98,28 +98,28 @@ static FmtConv Fmt_List_ARGB32[] =
ConstFilterInfo filter_table[] =
{
{
- symbol: "new_force_yv12",
+ filter_init: &new_force_yv12,
name: "forceyv12",
descript: "forces use of YV12 video format",
formats: Fmt_List_YV12,
libname: NULL
},
{
- symbol: "new_force_yuv422p",
+ filter_init: &new_force_yuv422p,
name: "forceyuv422p",
descript: "forces use of YUV422P video format",
formats: Fmt_List_YUV422P,
libname: NULL
},
{
- symbol: "new_force_rgb24",
+ filter_init: &new_force_rgb24,
name: "forcergb24",
descript: "forces use of RGB24 video format",
formats: Fmt_List_RGB24,
libname: NULL
},
{
- symbol: "new_force_argb32",
+ filter_init: &new_force_argb32,
name: "forceargb32",
descript: "forces use of ARGB32 video format",
formats: Fmt_List_ARGB32,
@@ -275,14 +275,14 @@ static FmtConv FmtList[] =
ConstFilterInfo filter_table[] =
{
{
- symbol: "GreedyHDeintFilter",
+ filter_init: &GreedyHDeintFilter,
name: "greedyhdeint",
descript: "combines data from several fields to deinterlace with less motion blur",
formats: FmtList,
libname: NULL
},
{
- symbol: "GreedyHDeintFilter",
+ filter_init: &GreedyHDeintFilter,
name: "greedyhdoubleprocessdeint",
descript: "combines data from several fields to deinterlace with less motion blur",
formats: FmtList,
@@ -38,8 +38,10 @@ int invert(VideoFilter *vf, VideoFrame *frame, int field)
return 0;
}
-VideoFilter *new_filter(VideoFrameType inpixfmt, VideoFrameType outpixfmt,
- int *width, int *height, char *options, int threads)
+static VideoFilter *new_filter(VideoFrameType inpixfmt,
+ VideoFrameType outpixfmt,
+ int *width, int *height, char *options,
+ int threads)
{
ThisFilter *filter;
@@ -77,7 +79,7 @@ static FmtConv FmtList[] =
ConstFilterInfo filter_table[] =
{
{
- symbol: "new_filter",
+ filter_init: &new_filter,
name: "invert",
descript: "inverts the colors of the input video",
formats: FmtList,
@@ -190,9 +190,10 @@ static void SetupFilter(ThisFilter *vf, int width, int height, int *pitches)
vf->context->stride[3] = 0;
}
-static VideoFilter *
-NewIvtcFilter (VideoFrameType inpixfmt, VideoFrameType outpixfmt,
- int *width, int *height, char *options, int threads)
+static VideoFilter *NewIvtcFilter(VideoFrameType inpixfmt,
+ VideoFrameType outpixfmt,
+ int *width, int *height, char *options,
+ int threads)
{
(void) threads;
@@ -251,7 +252,7 @@ static FmtConv FmtList[] =
ConstFilterInfo filter_table[] =
{
{
- symbol: "NewIvtcFilter",
+ filter_init: &NewIvtcFilter,
name: "ivtc",
descript: "inverse telecine filter",
formats: FmtList,
@@ -663,15 +663,15 @@ static FmtConv FmtList[] =
ConstFilterInfo filter_table[] =
{
{
- symbol: "NewKernelDeintFilter",
+ filter_init: &NewKernelDeintFilter,
name: "kerneldeint",
descript: "combines data from several fields to deinterlace "
"with less motion blur",
formats: FmtList,
libname: NULL
},
{
- symbol: "NewKernelDeintFilter",
+ filter_init: &NewKernelDeintFilter,
name: "kerneldoubleprocessdeint",
descript: "combines data from several fields to deinterlace "
"with less motion blur",
@@ -370,7 +370,7 @@ static FmtConv FmtList[] =
ConstFilterInfo filter_table[] =
{
{
- symbol: "new_filter",
+ filter_init: &new_filter,
name: "linearblend",
descript: "fast blending deinterlace filter",
formats: FmtList,
@@ -58,8 +58,10 @@ int oneFieldFilter(VideoFilter *f, VideoFrame *frame, int field)
return 0;
}
-VideoFilter *new_filter(VideoFrameType inpixfmt, VideoFrameType outpixfmt,
- int *width, int *height, char *options, int threads)
+static VideoFilter *new_filter(VideoFrameType inpixfmt,
+ VideoFrameType outpixfmt,
+ int *width, int *height, char *options,
+ int threads)
{
OFFilter *filter;
(void)width;
@@ -95,7 +97,7 @@ static FmtConv FmtList[] =
ConstFilterInfo filter_table[] =
{
{
- symbol: "new_filter",
+ filter_init: &new_filter,
name: "onefield",
descript: "one-field-only deinterlace filter; parameter \"bottom\" for bottom field, otherwise top",
formats: FmtList,
@@ -136,7 +136,7 @@ FmtConv FmtList[] =
FilterInfo filter_table[] =
{
{
- symbol: "new_filter",
+ filter_init: &new_filter,
name: "postprocess",
descript: "FFMPEG's postprocessing filters",
formats: FmtList,
@@ -590,7 +590,7 @@ static FmtConv FmtList[] =
ConstFilterInfo filter_table[] =
{
{
- symbol: "new_filter",
+ filter_init: &new_filter,
name: "quickdnr",
descript: "removes noise with a fast single/double thresholded average filter",
formats: FmtList,
@@ -723,14 +723,14 @@ static FmtConv FmtList[] =
ConstFilterInfo filter_table[] =
{
{
- symbol: "YadifDeintFilter",
+ filter_init: &YadifDeintFilter,
name: "yadifdeint",
descript: "combines data from several fields to deinterlace with less motion blur",
formats: FmtList,
libname: NULL
},
{
- symbol: "YadifDeintFilter",
+ filter_init: &YadifDeintFilter,
name: "yadifdoubleprocessdeint",
descript: "combines data from several fields to deinterlace with less motion blur",
formats: FmtList,
@@ -19,9 +19,13 @@ typedef struct FmtConv_
#define FMT_NULL {FMT_NONE,FMT_NONE}
+typedef struct VideoFilter_ VideoFilter;
+
+typedef VideoFilter*(*init_filter)(int, int, int *, int *, char *, int);
+
typedef struct FilterInfo_
{
- char *symbol;
+ init_filter filter_init;
char *name;
char *descript;
FmtConv *formats;
@@ -30,14 +34,14 @@ typedef struct FilterInfo_
typedef struct ConstFilterInfo_
{
- const char *symbol;
+ const init_filter filter_init;
const char *name;
const char *descript;
const FmtConv *formats;
const char *libname;
} ConstFilterInfo;
-typedef struct VideoFilter_
+struct VideoFilter_
{
int (*filter)(struct VideoFilter_ *, VideoFrame *, int);
void (*cleanup)(struct VideoFilter_ *);
@@ -47,7 +51,7 @@ typedef struct VideoFilter_
VideoFrameType outpixfmt;
char *opts;
FilterInfo *info;
-} VideoFilter;
+};
#define FILT_NULL {NULL,NULL,NULL,NULL,NULL}
Oops, something went wrong.

0 comments on commit 29f2756

Please sign in to comment.