mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-29 13:11:06 +00:00
libav: Port deprecated AVFrame fields to flags
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5186>
This commit is contained in:
parent
09de59477a
commit
b46559102b
2 changed files with 45 additions and 4 deletions
|
@ -1128,11 +1128,19 @@ picture_changed (GstFFMpegVidDec * ffmpegdec, AVFrame * picture,
|
|||
|
||||
if (one_field) {
|
||||
pic_field_order = ffmpegdec->pic_field_order;
|
||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(60, 31, 100)
|
||||
} else if (picture->flags & AV_FRAME_FLAG_INTERLACED) {
|
||||
#else
|
||||
} else if (picture->interlaced_frame) {
|
||||
#endif
|
||||
if (picture->repeat_pict)
|
||||
pic_field_order |= GST_VIDEO_BUFFER_FLAG_RFF;
|
||||
if (picture->top_field_first)
|
||||
pic_field_order |= GST_VIDEO_BUFFER_FLAG_TFF;
|
||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(60, 31, 100)
|
||||
} else if (picture->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST) {
|
||||
#else
|
||||
} else if (picture->top_field_first) {
|
||||
#endif
|
||||
pic_field_order |= GST_VIDEO_BUFFER_FLAG_TFF;
|
||||
}
|
||||
|
||||
return !(ffmpegdec->pic_width == picture->width
|
||||
|
@ -1140,7 +1148,12 @@ picture_changed (GstFFMpegVidDec * ffmpegdec, AVFrame * picture,
|
|||
&& ffmpegdec->pic_pix_fmt == picture->format
|
||||
&& ffmpegdec->pic_par_n == picture->sample_aspect_ratio.num
|
||||
&& ffmpegdec->pic_par_d == picture->sample_aspect_ratio.den
|
||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(60, 31, 100)
|
||||
&& ffmpegdec->pic_interlaced ==
|
||||
(picture->flags & AV_FRAME_FLAG_INTERLACED)
|
||||
#else
|
||||
&& ffmpegdec->pic_interlaced == picture->interlaced_frame
|
||||
#endif
|
||||
&& ffmpegdec->pic_field_order == pic_field_order
|
||||
&& ffmpegdec->cur_multiview_mode == ffmpegdec->picture_multiview_mode
|
||||
&& ffmpegdec->cur_multiview_flags == ffmpegdec->picture_multiview_flags);
|
||||
|
@ -1166,10 +1179,18 @@ update_video_context (GstFFMpegVidDec * ffmpegdec, AVCodecContext * context,
|
|||
{
|
||||
gint pic_field_order = 0;
|
||||
|
||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(60, 31, 100)
|
||||
if (picture->flags & AV_FRAME_FLAG_INTERLACED) {
|
||||
#else
|
||||
if (picture->interlaced_frame) {
|
||||
#endif
|
||||
if (picture->repeat_pict)
|
||||
pic_field_order |= GST_VIDEO_BUFFER_FLAG_RFF;
|
||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(60, 31, 100)
|
||||
if (picture->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST)
|
||||
#else
|
||||
if (picture->top_field_first)
|
||||
#endif
|
||||
pic_field_order |= GST_VIDEO_BUFFER_FLAG_TFF;
|
||||
}
|
||||
|
||||
|
@ -1205,7 +1226,11 @@ update_video_context (GstFFMpegVidDec * ffmpegdec, AVCodecContext * context,
|
|||
ffmpegdec->pic_field_order_changed = TRUE;
|
||||
|
||||
ffmpegdec->pic_field_order = pic_field_order;
|
||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(60, 31, 100)
|
||||
ffmpegdec->pic_interlaced = picture->flags & AV_FRAME_FLAG_INTERLACED;
|
||||
#else
|
||||
ffmpegdec->pic_interlaced = picture->interlaced_frame;
|
||||
#endif
|
||||
|
||||
if (!ffmpegdec->pic_interlaced)
|
||||
ffmpegdec->pic_field_order_changed = FALSE;
|
||||
|
@ -1946,9 +1971,17 @@ gst_ffmpegviddec_video_frame (GstFFMpegVidDec * ffmpegdec,
|
|||
/* set interlaced flags */
|
||||
if (ffmpegdec->picture->repeat_pict)
|
||||
GST_BUFFER_FLAG_SET (out_frame->output_buffer, GST_VIDEO_BUFFER_FLAG_RFF);
|
||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(60, 31, 100)
|
||||
if (ffmpegdec->picture->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST)
|
||||
#else
|
||||
if (ffmpegdec->picture->top_field_first)
|
||||
#endif
|
||||
GST_BUFFER_FLAG_SET (out_frame->output_buffer, GST_VIDEO_BUFFER_FLAG_TFF);
|
||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(60, 31, 100)
|
||||
if (ffmpegdec->picture->flags & AV_FRAME_FLAG_INTERLACED)
|
||||
#else
|
||||
if (ffmpegdec->picture->interlaced_frame)
|
||||
#endif
|
||||
GST_BUFFER_FLAG_SET (out_frame->output_buffer,
|
||||
GST_VIDEO_BUFFER_FLAG_INTERLACED);
|
||||
}
|
||||
|
|
|
@ -569,11 +569,19 @@ gst_ffmpegvidenc_send_frame (GstFFMpegVidEnc * ffmpegenc,
|
|||
gst_ffmpegvidenc_add_cc (frame->input_buffer, picture);
|
||||
|
||||
if (GST_VIDEO_INFO_IS_INTERLACED (&ffmpegenc->input_state->info)) {
|
||||
picture->interlaced_frame = TRUE;
|
||||
picture->top_field_first =
|
||||
const gboolean top_field_first =
|
||||
GST_BUFFER_FLAG_IS_SET (frame->input_buffer, GST_VIDEO_BUFFER_FLAG_TFF)
|
||||
|| GST_VIDEO_INFO_FIELD_ORDER (&ffmpegenc->input_state->info) ==
|
||||
GST_VIDEO_FIELD_ORDER_TOP_FIELD_FIRST;
|
||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(60, 31, 100)
|
||||
picture->flags |= AV_FRAME_FLAG_INTERLACED;
|
||||
if (top_field_first) {
|
||||
picture->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST;
|
||||
}
|
||||
#else
|
||||
picture->interlaced_frame = TRUE;
|
||||
picture->top_field_first = top_field_first;
|
||||
#endif
|
||||
picture->repeat_pict =
|
||||
GST_BUFFER_FLAG_IS_SET (frame->input_buffer, GST_VIDEO_BUFFER_FLAG_RFF);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue