Skip to content
Snippets Groups Projects
Commit 6e18a221 authored by Sebastian Dröge's avatar Sebastian Dröge :tea:
Browse files

avviddec: Use AVFrame API instead of deprecated AVPicture API

parent 4e0b05bf
No related branches found
No related tags found
No related merge requests found
......@@ -1179,7 +1179,7 @@ static GstFlowReturn
get_output_buffer (GstFFMpegVidDec * ffmpegdec, GstVideoCodecFrame * frame)
{
GstFlowReturn ret = GST_FLOW_OK;
AVPicture pic, *outpic;
AVFrame pic, *outpic;
GstVideoFrame vframe;
GstVideoInfo *info;
gint c;
......@@ -1203,6 +1203,10 @@ get_output_buffer (GstFFMpegVidDec * ffmpegdec, GstVideoCodecFrame * frame)
GST_MAP_READ | GST_MAP_WRITE))
goto map_failed;
memset (&pic, 0, sizeof (pic));
pic.format = ffmpegdec->pic_pix_fmt;
pic.width = GST_VIDEO_FRAME_WIDTH (&vframe);
pic.height = GST_VIDEO_FRAME_HEIGHT (&vframe);
for (c = 0; c < AV_NUM_DATA_POINTERS; c++) {
if (c < GST_VIDEO_INFO_N_PLANES (info)) {
pic.data[c] = GST_VIDEO_FRAME_PLANE_DATA (&vframe, c);
......@@ -1215,10 +1219,12 @@ get_output_buffer (GstFFMpegVidDec * ffmpegdec, GstVideoCodecFrame * frame)
}
}
outpic = (AVPicture *) ffmpegdec->picture;
outpic = ffmpegdec->picture;
av_picture_copy (&pic, outpic, ffmpegdec->context->pix_fmt,
GST_VIDEO_INFO_WIDTH (info), GST_VIDEO_INFO_HEIGHT (info));
if (av_frame_copy (&pic, outpic) != 0) {
GST_ERROR_OBJECT (ffmpegdec, "Failed to copy output frame");
ret = GST_FLOW_ERROR;
}
gst_video_frame_unmap (&vframe);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment