Remove all uses of AVPicture

https://bugzilla.gnome.org/show_bug.cgi?id=792900
This commit is contained in:
Mathieu Duponchelle 2018-06-29 04:52:02 +02:00
parent 9cc57a74d8
commit 4f28ea23eb
4 changed files with 17 additions and 14 deletions

View file

@ -96,7 +96,7 @@ typedef struct _GstFFMpegDeinterlace
GstFFMpegDeinterlaceMode new_mode; GstFFMpegDeinterlaceMode new_mode;
enum AVPixelFormat pixfmt; enum AVPixelFormat pixfmt;
AVPicture from_frame, to_frame; AVFrame from_frame, to_frame;
AVFilterContext *buffersink_ctx; AVFilterContext *buffersink_ctx;
AVFilterContext *buffersrc_ctx; AVFilterContext *buffersrc_ctx;
@ -355,8 +355,8 @@ init_filter_graph (GstFFMpegDeinterlace * deinterlace,
} }
static int static int
process_filter_graph (GstFFMpegDeinterlace * deinterlace, AVPicture * dst, process_filter_graph (GstFFMpegDeinterlace * deinterlace, AVFrame * dst,
const AVPicture * src, enum AVPixelFormat pixfmt, int width, int height) const AVFrame * src, enum AVPixelFormat pixfmt, int width, int height)
{ {
int res; int res;
@ -384,8 +384,9 @@ process_filter_graph (GstFFMpegDeinterlace * deinterlace, AVPicture * dst,
deinterlace->filter_frame); deinterlace->filter_frame);
if (res < 0) if (res < 0)
return res; return res;
av_picture_copy (dst, (const AVPicture *) deinterlace->filter_frame, pixfmt, av_image_copy (dst->data, dst->linesize,
width, height); (const uint8_t **) deinterlace->filter_frame->data,
deinterlace->filter_frame->linesize, pixfmt, width, height);
av_frame_unref (deinterlace->filter_frame); av_frame_unref (deinterlace->filter_frame);
return 0; return 0;

View file

@ -26,6 +26,7 @@
#include <string.h> #include <string.h>
#include <libavformat/avformat.h> #include <libavformat/avformat.h>
#include <libavutil/imgutils.h>
/* #include <ffmpeg/avi.h> */ /* #include <ffmpeg/avi.h> */
#include <gst/gst.h> #include <gst/gst.h>
#include <gst/base/gstflowcombiner.h> #include <gst/base/gstflowcombiner.h>
@ -1491,7 +1492,7 @@ gst_ffmpegdemux_loop (GstFFMpegDemux * demux)
/* copy the data from packet into the target buffer /* copy the data from packet into the target buffer
* and do conversions for raw video packets */ * and do conversions for raw video packets */
if (rawvideo) { if (rawvideo) {
AVPicture src, dst; AVFrame src, dst;
const gchar *plugin_name = const gchar *plugin_name =
((GstFFMpegDemuxClass *) (G_OBJECT_GET_CLASS (demux)))->in_plugin->name; ((GstFFMpegDemuxClass *) (G_OBJECT_GET_CLASS (demux)))->in_plugin->name;
GstMapInfo map; GstMapInfo map;
@ -1506,8 +1507,9 @@ gst_ffmpegdemux_loop (GstFFMpegDemux * demux)
avstream->codec->pix_fmt, avstream->codec->width, avstream->codec->pix_fmt, avstream->codec->width,
avstream->codec->height); avstream->codec->height);
av_picture_copy (&dst, &src, avstream->codec->pix_fmt, av_image_copy (dst.data, dst.linesize, (const uint8_t **) src.data,
avstream->codec->width, avstream->codec->height); src.linesize, avstream->codec->pix_fmt, avstream->codec->width,
avstream->codec->height);
gst_buffer_unmap (outbuf, &map); gst_buffer_unmap (outbuf, &map);
} else { } else {
gst_buffer_fill (outbuf, 0, pkt.data, outsize); gst_buffer_fill (outbuf, 0, pkt.data, outsize);

View 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). * everything is aligned by 4 (as required by X).
* This is mostly a copy from imgconvert.c with some * This is mostly a copy from imgconvert.c with some
* small changes. * 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 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_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_PACKED 1 /* only one components containing all the channels */
#define FF_PIXEL_PALETTE 2 /* one components containing indexes for a palette */ #define FF_PIXEL_PALETTE 2 /* one components containing indexes for a palette */
@ -267,7 +267,7 @@ gst_ffmpeg_init_pix_fmt_info (void)
int int
gst_ffmpeg_avpicture_get_size (int pix_fmt, int width, int height) 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); 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)) #define DIV_ROUND_UP_X(v,x) (((v) + GEN_MASK(x)) >> (x))
int int
gst_ffmpeg_avpicture_fill (AVPicture * picture, gst_ffmpeg_avpicture_fill (AVFrame * picture,
uint8_t * ptr, enum AVPixelFormat pix_fmt, int width, int height) uint8_t * ptr, enum AVPixelFormat pix_fmt, int width, int height)
{ {
int size, w2, h2, size2; int size, w2, h2, size2;

View file

@ -36,11 +36,11 @@ int
gst_ffmpeg_avpicture_get_size (int pix_fmt, int width, int height); 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 int
gst_ffmpeg_avpicture_fill (AVPicture * picture, gst_ffmpeg_avpicture_fill (AVFrame * picture,
uint8_t * ptr, uint8_t * ptr,
enum AVPixelFormat pix_fmt, enum AVPixelFormat pix_fmt,
int width, int width,