[FFmpeg-devel] diracdec: fix deprecated API usage

Submitted by ffmpeg@fratti.ch on Nov. 2, 2017, 10:39 p.m.

Details

Message ID 20171102223953.4294-1-ffmpeg@fratti.ch
State New
Headers show

Commit Message

ffmpeg@fratti.ch Nov. 2, 2017, 10:39 p.m.
avcodec_get_chroma_sub_sample is deprecated and generates a warning
during build, so av_pix_fmt_get_chroma_sub_sample is used

Signed-off-by: Nicolas Frattaroli <ffmpeg@fratti.ch>
---
 libavcodec/diracdec.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

Comments

James Almer Nov. 3, 2017, 3:27 a.m.
On 11/2/2017 7:39 PM, Nicolas Frattaroli wrote:
> avcodec_get_chroma_sub_sample is deprecated and generates a warning
> during build, so av_pix_fmt_get_chroma_sub_sample is used
> 
> Signed-off-by: Nicolas Frattaroli <ffmpeg@fratti.ch>
> ---
>  libavcodec/diracdec.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c
> index 0abb8b0599..7f83ed47f2 100644
> --- a/libavcodec/diracdec.c
> +++ b/libavcodec/diracdec.c
> @@ -26,6 +26,7 @@
>   * @author Marco Gerards <marco@gnu.org>, David Conrad, Jordi Ortiz <nenjordi@gmail.com>
>   */
>  
> +#include "libavutil/pixdesc.h"
>  #include "libavutil/thread.h"
>  #include "avcodec.h"
>  #include "get_bits.h"
> @@ -1927,7 +1928,10 @@ static int get_buffer_with_edge(AVCodecContext *avctx, AVFrame *f, int flags)
>  {
>      int ret, i;
>      int chroma_x_shift, chroma_y_shift;
> -    avcodec_get_chroma_sub_sample(avctx->pix_fmt, &chroma_x_shift, &chroma_y_shift);
> +    ret = av_pix_fmt_get_chroma_sub_sample(avctx->pix_fmt, &chroma_x_shift,
> +                                           &chroma_y_shift);
> +    if (ret)
> +        return ret;
>  
>      f->width  = avctx->width  + 2 * EDGE_WIDTH;
>      f->height = avctx->height + 2 * EDGE_WIDTH + 2;
> @@ -2126,7 +2130,11 @@ static int dirac_decode_data_unit(AVCodecContext *avctx, const uint8_t *buf, int
>  
>          s->pshift = s->bit_depth > 8;
>  
> -        avcodec_get_chroma_sub_sample(avctx->pix_fmt, &s->chroma_x_shift, &s->chroma_y_shift);
> +        ret = av_pix_fmt_get_chroma_sub_sample(avctx->pix_fmt,
> +                                               &s->chroma_x_shift,
> +                                               &s->chroma_y_shift);
> +        if (ret)
> +            return ret;
>  
>          ret = alloc_sequence_buffers(s);
>          if (ret < 0)

Pushed, thanks.

Patch hide | download patch | download mbox

diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c
index 0abb8b0599..7f83ed47f2 100644
--- a/libavcodec/diracdec.c
+++ b/libavcodec/diracdec.c
@@ -26,6 +26,7 @@ 
  * @author Marco Gerards <marco@gnu.org>, David Conrad, Jordi Ortiz <nenjordi@gmail.com>
  */
 
+#include "libavutil/pixdesc.h"
 #include "libavutil/thread.h"
 #include "avcodec.h"
 #include "get_bits.h"
@@ -1927,7 +1928,10 @@  static int get_buffer_with_edge(AVCodecContext *avctx, AVFrame *f, int flags)
 {
     int ret, i;
     int chroma_x_shift, chroma_y_shift;
-    avcodec_get_chroma_sub_sample(avctx->pix_fmt, &chroma_x_shift, &chroma_y_shift);
+    ret = av_pix_fmt_get_chroma_sub_sample(avctx->pix_fmt, &chroma_x_shift,
+                                           &chroma_y_shift);
+    if (ret)
+        return ret;
 
     f->width  = avctx->width  + 2 * EDGE_WIDTH;
     f->height = avctx->height + 2 * EDGE_WIDTH + 2;
@@ -2126,7 +2130,11 @@  static int dirac_decode_data_unit(AVCodecContext *avctx, const uint8_t *buf, int
 
         s->pshift = s->bit_depth > 8;
 
-        avcodec_get_chroma_sub_sample(avctx->pix_fmt, &s->chroma_x_shift, &s->chroma_y_shift);
+        ret = av_pix_fmt_get_chroma_sub_sample(avctx->pix_fmt,
+                                               &s->chroma_x_shift,
+                                               &s->chroma_y_shift);
+        if (ret)
+            return ret;
 
         ret = alloc_sequence_buffers(s);
         if (ret < 0)