[06/17] lavc: Deprecate the deinterlace functions in libavcodec

Message ID 1362578206-2806-6-git-send-email-martin@martin.st
State Superseded
Headers show

Commit Message

Martin Storsjö March 6, 2013, 1:56 p.m.
From: "Ronald S. Bultje" <rsbultje@gmail.com>

---
 avconv.c                |    2 +-
 avconv_opt.c            |    4 ++++
 libavcodec/avcodec.h    |    3 +++
 libavcodec/imgconvert.c |    4 ++++
 libavcodec/version.h    |    3 +++
 5 files changed, 15 insertions(+), 1 deletion(-)

Comments

Luca Barbato March 6, 2013, 2:40 p.m. | #1
On 06/03/13 14:56, Martin Storsjö wrote:
> +#define FF_API_DEINTERLACE (LIBAVCODEC_VERSION_MAJOR < 55)

I'd make it 56. The rest is fine for me. Not sure if there is still
something else that could be removed but might.

lu
Anton Khirnov March 6, 2013, 3:53 p.m. | #2
On Wed,  6 Mar 2013 15:56:35 +0200, Martin Storsjö <martin@martin.st> wrote:
> From: "Ronald S. Bultje" <rsbultje@gmail.com>
> 
> ---
>  avconv.c                |    2 +-
>  avconv_opt.c            |    4 ++++
>  libavcodec/avcodec.h    |    3 +++
>  libavcodec/imgconvert.c |    4 ++++
>  libavcodec/version.h    |    3 +++
>  5 files changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/avconv.c b/avconv.c
> index 75a8f0d..25f7b7a 100644
> --- a/avconv.c
> +++ b/avconv.c
> @@ -414,7 +414,7 @@ static void pre_process_video_frame(InputStream *ist, AVPicture *picture, void *
>      dec = ist->st->codec;
>  
>      /* deinterlace : must be done before any resize */
> -    if (do_deinterlace) {
> +    if (FF_API_DEINTERLACE && do_deinterlace) {

Ifdef out the whole pre_process_video_frame() and its call instead.

>          int size;
>  
>          /* create temporary picture */
> diff --git a/avconv_opt.c b/avconv_opt.c
> index 7c58f49..5bb7fb7 100644
> --- a/avconv_opt.c
> +++ b/avconv_opt.c
> @@ -1715,12 +1715,14 @@ static int opt_vsync(void *optctx, const char *opt, const char *arg)
>      return 0;
>  }
>  
> +#if FF_API_DEINTERLACE
>  static int opt_deinterlace(void *optctx, const char *opt, const char *arg)
>  {
>      av_log(NULL, AV_LOG_WARNING, "-%s is deprecated, use -filter:v yadif instead\n", opt);
>      do_deinterlace = 1;
>      return 0;
>  }
> +#endif
>  
>  int opt_cpuflags(void *optctx, const char *opt, const char *arg)
>  {
> @@ -2057,8 +2059,10 @@ const OptionDef options[] = {
>          "select the pass number (1 or 2)", "n" },
>      { "passlogfile",  OPT_VIDEO | HAS_ARG | OPT_STRING | OPT_EXPERT | OPT_SPEC,  { .off = OFFSET(passlogfiles) },
>          "select two pass log file name prefix", "prefix" },
> +#if FF_API_DEINTERLACE
>      { "deinterlace",  OPT_VIDEO | OPT_EXPERT ,                                   { .func_arg = opt_deinterlace },
>          "this option is deprecated, use the yadif filter instead" },
> +#endif
>      { "vstats",       OPT_VIDEO | OPT_EXPERT ,                                   { &opt_vstats },
>          "dump video coding statistics to file" },
>      { "vstats_file",  OPT_VIDEO | HAS_ARG | OPT_EXPERT ,                         { opt_vstats_file },
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index 7a24775..f5f3e82 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -4269,7 +4269,10 @@ int avpicture_get_size(enum AVPixelFormat pix_fmt, int width, int height);
>  
>  /**
>   *  deinterlace - if not supported return -1
> + *
> + * @deprecated - use yadif (in libavfilter) instead
>   */
> +attribute_deprecated
>  int avpicture_deinterlace(AVPicture *dst, const AVPicture *src,
>                            enum AVPixelFormat pix_fmt, int width, int height);

Needs to be ifdefed out as well

>  /**
> diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c
> index 36c24df..8f8b6e3 100644
> --- a/libavcodec/imgconvert.c
> +++ b/libavcodec/imgconvert.c
> @@ -366,6 +366,8 @@ int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width,
>      return 0;
>  }
>  
> +#if FF_API_DEINTERLACE
> +
>  #if !HAVE_MMX_EXTERNAL
>  /* filter parameters: [-1 4 2 4 -1] // 8 */
>  static void deinterlace_line_c(uint8_t *dst,
> @@ -524,3 +526,5 @@ int avpicture_deinterlace(AVPicture *dst, const AVPicture *src,
>      emms_c();
>      return 0;
>  }
> +
> +#endif /* FF_API_DEINTERLACE */
> diff --git a/libavcodec/version.h b/libavcodec/version.h
> index 7a024d3..efbb59e 100644
> --- a/libavcodec/version.h
> +++ b/libavcodec/version.h
> @@ -97,5 +97,8 @@
>  #ifndef FF_API_IDCT
>  #define FF_API_IDCT              (LIBAVCODEC_VERSION_MAJOR < 55)
>  #endif
> +#ifndef FF_API_DEINTERLACE
> +#define FF_API_DEINTERLACE       (LIBAVCODEC_VERSION_MAJOR < 55)

+1 on 56, the 55 bump is just days away

Patch

diff --git a/avconv.c b/avconv.c
index 75a8f0d..25f7b7a 100644
--- a/avconv.c
+++ b/avconv.c
@@ -414,7 +414,7 @@  static void pre_process_video_frame(InputStream *ist, AVPicture *picture, void *
     dec = ist->st->codec;
 
     /* deinterlace : must be done before any resize */
-    if (do_deinterlace) {
+    if (FF_API_DEINTERLACE && do_deinterlace) {
         int size;
 
         /* create temporary picture */
diff --git a/avconv_opt.c b/avconv_opt.c
index 7c58f49..5bb7fb7 100644
--- a/avconv_opt.c
+++ b/avconv_opt.c
@@ -1715,12 +1715,14 @@  static int opt_vsync(void *optctx, const char *opt, const char *arg)
     return 0;
 }
 
+#if FF_API_DEINTERLACE
 static int opt_deinterlace(void *optctx, const char *opt, const char *arg)
 {
     av_log(NULL, AV_LOG_WARNING, "-%s is deprecated, use -filter:v yadif instead\n", opt);
     do_deinterlace = 1;
     return 0;
 }
+#endif
 
 int opt_cpuflags(void *optctx, const char *opt, const char *arg)
 {
@@ -2057,8 +2059,10 @@  const OptionDef options[] = {
         "select the pass number (1 or 2)", "n" },
     { "passlogfile",  OPT_VIDEO | HAS_ARG | OPT_STRING | OPT_EXPERT | OPT_SPEC,  { .off = OFFSET(passlogfiles) },
         "select two pass log file name prefix", "prefix" },
+#if FF_API_DEINTERLACE
     { "deinterlace",  OPT_VIDEO | OPT_EXPERT ,                                   { .func_arg = opt_deinterlace },
         "this option is deprecated, use the yadif filter instead" },
+#endif
     { "vstats",       OPT_VIDEO | OPT_EXPERT ,                                   { &opt_vstats },
         "dump video coding statistics to file" },
     { "vstats_file",  OPT_VIDEO | HAS_ARG | OPT_EXPERT ,                         { opt_vstats_file },
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 7a24775..f5f3e82 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -4269,7 +4269,10 @@  int avpicture_get_size(enum AVPixelFormat pix_fmt, int width, int height);
 
 /**
  *  deinterlace - if not supported return -1
+ *
+ * @deprecated - use yadif (in libavfilter) instead
  */
+attribute_deprecated
 int avpicture_deinterlace(AVPicture *dst, const AVPicture *src,
                           enum AVPixelFormat pix_fmt, int width, int height);
 /**
diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c
index 36c24df..8f8b6e3 100644
--- a/libavcodec/imgconvert.c
+++ b/libavcodec/imgconvert.c
@@ -366,6 +366,8 @@  int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width,
     return 0;
 }
 
+#if FF_API_DEINTERLACE
+
 #if !HAVE_MMX_EXTERNAL
 /* filter parameters: [-1 4 2 4 -1] // 8 */
 static void deinterlace_line_c(uint8_t *dst,
@@ -524,3 +526,5 @@  int avpicture_deinterlace(AVPicture *dst, const AVPicture *src,
     emms_c();
     return 0;
 }
+
+#endif /* FF_API_DEINTERLACE */
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 7a024d3..efbb59e 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -97,5 +97,8 @@ 
 #ifndef FF_API_IDCT
 #define FF_API_IDCT              (LIBAVCODEC_VERSION_MAJOR < 55)
 #endif
+#ifndef FF_API_DEINTERLACE
+#define FF_API_DEINTERLACE       (LIBAVCODEC_VERSION_MAJOR < 55)
+#endif
 
 #endif /* AVCODEC_VERSION_H */