Remove all uses of AVPicture
authorMathieu Duponchelle <mathieu@centricular.com>
Fri, 29 Jun 2018 02:52:02 +0000 (04:52 +0200)
committerMathieu Duponchelle <mathieu@centricular.com>
Thu, 12 Jul 2018 22:53:26 +0000 (00:53 +0200)
https://bugzilla.gnome.org/show_bug.cgi?id=792900

ext/libav/gstavdeinterlace.c
ext/libav/gstavdemux.c
ext/libav/gstavutils.c
ext/libav/gstavutils.h

index 0a1809a..faa0398 100644 (file)
@@ -96,7 +96,7 @@ typedef struct _GstFFMpegDeinterlace
   GstFFMpegDeinterlaceMode new_mode;
 
   enum AVPixelFormat pixfmt;
-  AVPicture from_frame, to_frame;
+  AVFrame from_frame, to_frame;
 
   AVFilterContext *buffersink_ctx;
   AVFilterContext *buffersrc_ctx;
@@ -355,8 +355,8 @@ init_filter_graph (GstFFMpegDeinterlace * deinterlace,
 }
 
 static int
-process_filter_graph (GstFFMpegDeinterlace * deinterlace, AVPicture * dst,
-    const AVPicture * src, enum AVPixelFormat pixfmt, int width, int height)
+process_filter_graph (GstFFMpegDeinterlace * deinterlace, AVFrame * dst,
+    const AVFrame * src, enum AVPixelFormat pixfmt, int width, int height)
 {
   int res;
 
@@ -384,8 +384,9 @@ process_filter_graph (GstFFMpegDeinterlace * deinterlace, AVPicture * dst,
       deinterlace->filter_frame);
   if (res < 0)
     return res;
-  av_picture_copy (dst, (const AVPicture *) deinterlace->filter_frame, pixfmt,
-      width, height);
+  av_image_copy (dst->data, dst->linesize,
+      (const uint8_t **) deinterlace->filter_frame->data,
+      deinterlace->filter_frame->linesize, pixfmt, width, height);
   av_frame_unref (deinterlace->filter_frame);
 
   return 0;
index 7de25e4..c296238 100644 (file)
@@ -26,6 +26,7 @@
 #include <string.h>
 
 #include <libavformat/avformat.h>
+#include <libavutil/imgutils.h>
 /* #include <ffmpeg/avi.h> */
 #include <gst/gst.h>
 #include <gst/base/gstflowcombiner.h>
@@ -1491,7 +1492,7 @@ gst_ffmpegdemux_loop (GstFFMpegDemux * demux)
   /* copy the data from packet into the target buffer
    * and do conversions for raw video packets */
   if (rawvideo) {
-    AVPicture src, dst;
+    AVFrame src, dst;
     const gchar *plugin_name =
         ((GstFFMpegDemuxClass *) (G_OBJECT_GET_CLASS (demux)))->in_plugin->name;
     GstMapInfo map;
@@ -1506,8 +1507,9 @@ gst_ffmpegdemux_loop (GstFFMpegDemux * demux)
         avstream->codec->pix_fmt, avstream->codec->width,
         avstream->codec->height);
 
-    av_picture_copy (&dst, &src, avstream->codec->pix_fmt,
-        avstream->codec->width, avstream->codec->height);
+    av_image_copy (dst.data, dst.linesize, (const uint8_t **) src.data,
+        src.linesize, avstream->codec->pix_fmt, avstream->codec->width,
+        avstream->codec->height);
     gst_buffer_unmap (outbuf, &map);
   } else {
     gst_buffer_fill (outbuf, 0, pkt.data, outsize);
index 2f04abf..3780cff 100644 (file)
@@ -77,7 +77,7 @@ av_smp_format_depth (enum AVSampleFormat smp_fmt)
 
 
 /*
- * Fill in pointers to memory in a AVPicture, where
+ * Fill in pointers to memory in a AVFrame, where
  * everything is aligned by 4 (as required by X).
  * This is mostly a copy from imgconvert.c with some
  * small changes.
@@ -88,7 +88,7 @@ av_smp_format_depth (enum AVSampleFormat smp_fmt)
 #define FF_COLOR_YUV      2     /* YUV color space. 16 <= Y <= 235, 16 <= U, V <= 240 */
 #define FF_COLOR_YUV_JPEG 3     /* YUV color space. 0 <= Y <= 255, 0 <= U, V <= 255 */
 
-#define FF_PIXEL_PLANAR   0     /* each channel has one component in AVPicture */
+#define FF_PIXEL_PLANAR   0     /* each channel has one component in AVFrame */
 #define FF_PIXEL_PACKED   1     /* only one components containing all the channels */
 #define FF_PIXEL_PALETTE  2     /* one components containing indexes for a palette */
 
@@ -267,7 +267,7 @@ gst_ffmpeg_init_pix_fmt_info (void)
 int
 gst_ffmpeg_avpicture_get_size (int pix_fmt, int width, int height)
 {
-  AVPicture dummy_pict;
+  AVFrame dummy_pict;
 
   return gst_ffmpeg_avpicture_fill (&dummy_pict, NULL, pix_fmt, width, height);
 }
@@ -280,7 +280,7 @@ gst_ffmpeg_avpicture_get_size (int pix_fmt, int width, int height)
 #define DIV_ROUND_UP_X(v,x) (((v) + GEN_MASK(x)) >> (x))
 
 int
-gst_ffmpeg_avpicture_fill (AVPicture * picture,
+gst_ffmpeg_avpicture_fill (AVFrame * picture,
     uint8_t * ptr, enum AVPixelFormat pix_fmt, int width, int height)
 {
   int size, w2, h2, size2;
index f4d90ef..d18b979 100644 (file)
@@ -36,11 +36,11 @@ int
 gst_ffmpeg_avpicture_get_size (int pix_fmt, int width, int height);
 
 /*
- * Fill in pointers in an AVPicture, aligned by 4 (required by X).
+ * Fill in pointers in an AVFrame, aligned by 4 (required by X).
  */
 
 int
-gst_ffmpeg_avpicture_fill (AVPicture * picture,
+gst_ffmpeg_avpicture_fill (AVFrame * picture,
                            uint8_t *   ptr,
                            enum AVPixelFormat pix_fmt,
                            int         width,