[FFmpeg-devel] [PATCH 1/3] vidstab*: Remove accidentally exported av_2_vs_pixel_format()

Timothy Gu timothygu99 at gmail.com
Sun Aug 17 02:47:12 CEST 2014


Also correctly namespace other functions in vidstabutils, and decrease
difference from Libav.

Initial-patch-by: Vittorio Giovara <vittorio.giovara at gmail.com>
Signed-off-by: Timothy Gu <timothygu99 at gmail.com>
---

Does this need an FF_API_VIDSTAB?

 doc/APIchanges                    | 4 ++++
 libavfilter/version.h             | 2 +-
 libavfilter/vf_vidstabdetect.c    | 5 +++--
 libavfilter/vf_vidstabtransform.c | 6 +++---
 libavfilter/vidstabutils.c        | 8 ++++----
 libavfilter/vidstabutils.h        | 4 ++--
 6 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 067f60f..fec36ff 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,10 @@ libavutil:     2014-08-09
 
 API changes, most recent first:
 
+2014-08-xx - xxxxxxx - lavfi 5.1.0
+  The accidentally exported and never exposed av_2_vs_pixel_format() is
+  removed.
+
 2014-08-xx - xxxxxxx - lavu 54.03.0 - mem.h
   Add av_strndup().
 
diff --git a/libavfilter/version.h b/libavfilter/version.h
index 2003b76..6ebb1ce 100644
--- a/libavfilter/version.h
+++ b/libavfilter/version.h
@@ -30,7 +30,7 @@
 #include "libavutil/version.h"
 
 #define LIBAVFILTER_VERSION_MAJOR  5
-#define LIBAVFILTER_VERSION_MINOR  0
+#define LIBAVFILTER_VERSION_MINOR  1
 #define LIBAVFILTER_VERSION_MICRO 100
 
 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
diff --git a/libavfilter/vf_vidstabdetect.c b/libavfilter/vf_vidstabdetect.c
index 9b4b20f..bf067af 100644
--- a/libavfilter/vf_vidstabdetect.c
+++ b/libavfilter/vf_vidstabdetect.c
@@ -63,7 +63,7 @@ AVFILTER_DEFINE_CLASS(vidstabdetect);
 static av_cold int init(AVFilterContext *ctx)
 {
     StabData *sd = ctx->priv;
-    vs_set_mem_and_log_functions();
+    ff_vs_init();
     sd->class = &vidstabdetect_class;
     av_log(ctx, AV_LOG_VERBOSE, "vidstabdetect filter: init %s\n", LIBVIDSTAB_VERSION);
     return 0;
@@ -106,7 +106,8 @@ static int config_input(AVFilterLink *inlink)
     VSFrameInfo fi;
     const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
 
-    vsFrameInfoInit(&fi, inlink->w, inlink->h, av_2_vs_pixel_format(ctx, inlink->format));
+    vsFrameInfoInit(&fi, inlink->w, inlink->h,
+                    ff_av2vs_pixfmt(ctx, inlink->format));
     if (fi.bytesPerPixel != av_get_bits_per_pixel(desc)/8) {
         av_log(ctx, AV_LOG_ERROR, "pixel-format error: wrong bits/per/pixel, please report a BUG");
         return AVERROR(EINVAL);
diff --git a/libavfilter/vf_vidstabtransform.c b/libavfilter/vf_vidstabtransform.c
index 3ce4769..1bd43ff 100644
--- a/libavfilter/vf_vidstabtransform.c
+++ b/libavfilter/vf_vidstabtransform.c
@@ -107,7 +107,7 @@ AVFILTER_DEFINE_CLASS(vidstabtransform);
 static av_cold int init(AVFilterContext *ctx)
 {
     TransformContext *tc = ctx->priv;
-    vs_set_mem_and_log_functions();
+    ff_vs_init();
     tc->class = &vidstabtransform_class;
     av_log(ctx, AV_LOG_VERBOSE, "vidstabtransform filter: init %s\n", LIBVIDSTAB_VERSION);
     return 0;
@@ -151,9 +151,9 @@ static int config_input(AVFilterLink *inlink)
     VSFrameInfo fi_dest;
 
     if (!vsFrameInfoInit(&fi_src, inlink->w, inlink->h,
-                         av_2_vs_pixel_format(ctx, inlink->format)) ||
+                         ff_av2vs_pixfmt(ctx, inlink->format)) ||
         !vsFrameInfoInit(&fi_dest, inlink->w, inlink->h,
-                         av_2_vs_pixel_format(ctx, inlink->format))) {
+                         ff_av2vs_pixfmt(ctx, inlink->format))) {
         av_log(ctx, AV_LOG_ERROR, "unknown pixel format: %i (%s)",
                inlink->format, desc->name);
         return AVERROR(EINVAL);
diff --git a/libavfilter/vidstabutils.c b/libavfilter/vidstabutils.c
index dd6486d..1f9f331 100644
--- a/libavfilter/vidstabutils.c
+++ b/libavfilter/vidstabutils.c
@@ -21,7 +21,7 @@
 #include "vidstabutils.h"
 
 /** convert AV's pixelformat to vid.stab pixelformat */
-VSPixelFormat av_2_vs_pixel_format(AVFilterContext *ctx, enum AVPixelFormat pf)
+VSPixelFormat ff_av2vs_pixfmt(AVFilterContext *ctx, enum AVPixelFormat pf)
 {
     switch (pf) {
     case AV_PIX_FMT_YUV420P:  return PF_YUV420P;
@@ -47,7 +47,7 @@ typedef struct {
 } VS2AVLogCtx;
 
 /** wrapper to log vs_log into av_log */
-static int vs_2_av_log_wrapper(int type, const char *tag, const char *format, ...)
+static int vs2av_log(int type, const char *tag, const char *format, ...)
 {
     va_list ap;
     VS2AVLogCtx ctx;
@@ -66,7 +66,7 @@ static int vs_2_av_log_wrapper(int type, const char *tag, const char *format, ..
 }
 
 /** sets the memory allocation function and logging constants to av versions */
-void vs_set_mem_and_log_functions(void)
+void ff_vs_init(void)
 {
     vs_malloc  = av_malloc;
     vs_zalloc  = av_mallocz;
@@ -78,7 +78,7 @@ void vs_set_mem_and_log_functions(void)
     VS_INFO_TYPE  = AV_LOG_INFO;
     VS_MSG_TYPE   = AV_LOG_VERBOSE;
 
-    vs_log   = vs_2_av_log_wrapper;
+    vs_log   = vs2av_log;
 
     VS_ERROR = 0;
     VS_OK    = 1;
diff --git a/libavfilter/vidstabutils.h b/libavfilter/vidstabutils.h
index f1c20e6..93278f6 100644
--- a/libavfilter/vidstabutils.h
+++ b/libavfilter/vidstabutils.h
@@ -28,9 +28,9 @@
 /* ** some conversions from avlib to vid.stab constants and functions *** */
 
 /** converts the pixelformat of avlib into the one of the vid.stab library */
-VSPixelFormat av_2_vs_pixel_format(AVFilterContext *ctx, enum AVPixelFormat pf);
+VSPixelFormat ff_av2vs_pixfmt(AVFilterContext *ctx, enum AVPixelFormat pf);
 
 /** sets the memory allocation function and logging constants to av versions */
-void vs_set_mem_and_log_functions(void);
+void ff_vs_init(void);
 
 #endif
-- 
1.9.1



More information about the ffmpeg-devel mailing list