diff mbox

[FFmpeg-devel] snowenc: fix use of deprecated API

Message ID 20171102191248.27675-1-ffmpeg@fratti.ch
State Accepted
Commit 6a50a8f340161a0b65feb3537591b0381a6a6b38
Headers show

Commit Message

Nicolas Frattaroli Nov. 2, 2017, 7:12 p.m. UTC
From: Nicolas Frattaroli <ffmpeg@fratti.ch>

Replace avcodec_get_chroma_sub_sample with the recommended
av_pix_fmt_get_chroma_sub_sample, which fixes a compilation warning.
---
 libavcodec/snowenc.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Comments

Michael Niedermayer Nov. 3, 2017, 12:32 p.m. UTC | #1
On Thu, Nov 02, 2017 at 08:12:48PM +0100, ffmpeg@fratti.ch wrote:
> From: Nicolas Frattaroli <ffmpeg@fratti.ch>
> 
> Replace avcodec_get_chroma_sub_sample with the recommended
> av_pix_fmt_get_chroma_sub_sample, which fixes a compilation warning.
> ---
>  libavcodec/snowenc.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)

applied

thanks

[...]
diff mbox

Patch

diff --git a/libavcodec/snowenc.c b/libavcodec/snowenc.c
index e7d670ac10..4fec377591 100644
--- a/libavcodec/snowenc.c
+++ b/libavcodec/snowenc.c
@@ -22,6 +22,7 @@ 
 #include "libavutil/libm.h"
 #include "libavutil/log.h"
 #include "libavutil/opt.h"
+#include "libavutil/pixdesc.h"
 #include "avcodec.h"
 #include "internal.h"
 #include "snow_dwt.h"
@@ -127,7 +128,13 @@  FF_ENABLE_DEPRECATION_WARNINGS
         av_log(avctx, AV_LOG_ERROR, "pixel format not supported\n");
         return AVERROR_PATCHWELCOME;
     }
-    avcodec_get_chroma_sub_sample(avctx->pix_fmt, &s->chroma_h_shift, &s->chroma_v_shift);
+
+    ret = av_pix_fmt_get_chroma_sub_sample(avctx->pix_fmt, &s->chroma_h_shift,
+                                           &s->chroma_v_shift);
+    if (ret) {
+        av_log(avctx, AV_LOG_ERROR, "pixel format invalid or unknown\n");
+        return ret;
+    }
 
     ff_set_cmp(&s->mecc, s->mecc.me_cmp, s->avctx->me_cmp);
     ff_set_cmp(&s->mecc, s->mecc.me_sub_cmp, s->avctx->me_sub_cmp);