From 82f1d5e8be6d1bd42191e8559142bb091dd09750 Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Thu, 5 Mar 2020 14:29:22 +0900 Subject: [PATCH] codecs: Change output_picture() to mandatory implementation GstVideoCodecFrame is expected to be consumed by subclass per output_picture(). So the implementation cannot be optional. --- gst-libs/gst/codecs/gsth264decoder.c | 4 ++-- gst-libs/gst/codecs/gsth264decoder.h | 8 +++++--- gst-libs/gst/codecs/gsth265decoder.c | 4 ++-- gst-libs/gst/codecs/gsth265decoder.h | 8 +++++--- gst-libs/gst/codecs/gstvp9decoder.c | 8 ++++---- gst-libs/gst/codecs/gstvp9decoder.h | 8 +++++--- 6 files changed, 23 insertions(+), 17 deletions(-) diff --git a/gst-libs/gst/codecs/gsth264decoder.c b/gst-libs/gst/codecs/gsth264decoder.c index 55d9fab8dd..7af307441d 100644 --- a/gst-libs/gst/codecs/gsth264decoder.c +++ b/gst-libs/gst/codecs/gsth264decoder.c @@ -1117,8 +1117,8 @@ gst_h264_decoder_do_output_picture (GstH264Decoder * self, klass = GST_H264_DECODER_GET_CLASS (self); - if (klass->output_picture) - priv->last_ret = klass->output_picture (self, picture); + g_assert (klass->output_picture); + priv->last_ret = klass->output_picture (self, picture); } static gboolean diff --git a/gst-libs/gst/codecs/gsth264decoder.h b/gst-libs/gst/codecs/gsth264decoder.h index b5d8991d43..9c213bb8c0 100644 --- a/gst-libs/gst/codecs/gsth264decoder.h +++ b/gst-libs/gst/codecs/gsth264decoder.h @@ -65,9 +65,11 @@ struct _GstH264Decoder * Called whenever new #GstH264Picture is created. * Subclass can set implementation specific user data * on the #GstH264Picture via gst_h264_picture_set_user_data() - * @output_picture: Optional. - * Called just before gst_video_decoder_have_frame(). - * Subclass should be prepared for handle_frame() + * @output_picture: Called with a #GstH264Picture which is required to be outputted. + * Subclass can retrieve parent #GstVideoCodecFrame by using + * gst_video_decoder_get_frame() with system_frame_number + * and the #GstVideoCodecFrame must be consumed by subclass via + * gst_video_decoder_{finish,drop,release}_frame(). * @start_picture: Optional. * Called per one #GstH264Picture to notify subclass to prepare * decoding process for the #GstH264Picture diff --git a/gst-libs/gst/codecs/gsth265decoder.c b/gst-libs/gst/codecs/gsth265decoder.c index 560b82d1f6..26c37ec5c5 100644 --- a/gst-libs/gst/codecs/gsth265decoder.c +++ b/gst-libs/gst/codecs/gsth265decoder.c @@ -1112,8 +1112,8 @@ gst_h265_decoder_do_output_picture (GstH265Decoder * self, klass = GST_H265_DECODER_GET_CLASS (self); - if (klass->output_picture) - priv->last_ret = klass->output_picture (self, picture); + g_assert (klass->output_picture); + priv->last_ret = klass->output_picture (self, picture); } static gint diff --git a/gst-libs/gst/codecs/gsth265decoder.h b/gst-libs/gst/codecs/gsth265decoder.h index 7c2e8d7c03..df192e4235 100644 --- a/gst-libs/gst/codecs/gsth265decoder.h +++ b/gst-libs/gst/codecs/gsth265decoder.h @@ -78,9 +78,11 @@ struct _GstH265Decoder * Called whenever new #GstH265Picture is created. * Subclass can set implementation specific user data * on the #GstH265Picture via gst_h265_picture_set_user_data() - * @output_picture: Optional. - * Called just before gst_video_decoder_have_frame(). - * Subclass should be prepared for handle_frame() + * @output_picture: Called with a #GstH265Picture which is required to be outputted. + * Subclass can retrieve parent #GstVideoCodecFrame by using + * gst_video_decoder_get_frame() with system_frame_number + * and the #GstVideoCodecFrame must be consumed by subclass via + * gst_video_decoder_{finish,drop,release}_frame(). * @start_picture: Optional. * Called per one #GstH265Picture to notify subclass to prepare * decoding process for the #GstH265Picture diff --git a/gst-libs/gst/codecs/gstvp9decoder.c b/gst-libs/gst/codecs/gstvp9decoder.c index 7ddf808a49..29dfc2e28e 100644 --- a/gst-libs/gst/codecs/gstvp9decoder.c +++ b/gst-libs/gst/codecs/gstvp9decoder.c @@ -373,8 +373,8 @@ gst_vp9_decoder_handle_frame (GstVideoDecoder * decoder, (GDestroyNotify) gst_vp9_picture_unref); } - if (klass->output_picture) - ret = klass->output_picture (self, picture); + g_assert (klass->output_picture); + ret = klass->output_picture (self, picture); gst_vp9_picture_unref (picture); picture = NULL; @@ -433,8 +433,8 @@ gst_vp9_decoder_handle_frame (GstVideoDecoder * decoder, } } - if (klass->output_picture) - ret = klass->output_picture (self, picture); + g_assert (klass->output_picture); + ret = klass->output_picture (self, picture); /* transfer ownership of picture */ gst_vp9_dpb_add (priv->dpb, picture); diff --git a/gst-libs/gst/codecs/gstvp9decoder.h b/gst-libs/gst/codecs/gstvp9decoder.h index 86007dca09..835cac37a5 100644 --- a/gst-libs/gst/codecs/gstvp9decoder.h +++ b/gst-libs/gst/codecs/gstvp9decoder.h @@ -66,9 +66,11 @@ struct _GstVp9Decoder * Subclass can set implementation specific user data * on the #GstH264Picture via gst_h264_picture_set_user_data() * @duplicate_picture: Duplicate the #GstVp9Picture - * @output_picture: Optional. - * Called just before gst_video_decoder_have_frame(). - * Subclass should be prepared for handle_frame() + * @output_picture: Called with a #GstVp9Picture which is required to be outputted. + * Subclass can retrieve parent #GstVideoCodecFrame by using + * gst_video_decoder_get_frame() with system_frame_number + * and the #GstVideoCodecFrame must be consumed by subclass via + * gst_video_decoder_{finish,drop,release}_frame(). * @start_picture: Optional. * Called per one #GstH264Picture to notify subclass to prepare * decoding process for the #GstH264Picture