diff --git a/gst-libs/gst/codecs/gsth264decoder.c b/gst-libs/gst/codecs/gsth264decoder.c index 81db6ffadb..55d9fab8dd 100644 --- a/gst-libs/gst/codecs/gsth264decoder.c +++ b/gst-libs/gst/codecs/gsth264decoder.c @@ -661,6 +661,8 @@ gst_h264_decoder_parse_slice (GstH264Decoder * self, GstH264NalUnit * nalu, return FALSE; } + /* This allows accessing the frame from the picture. */ + picture->system_frame_number = priv->current_frame->system_frame_number; priv->current_picture = picture; gst_video_codec_frame_set_user_data (priv->current_frame, gst_h264_picture_ref (priv->current_picture), diff --git a/gst-libs/gst/codecs/gsth264picture.h b/gst-libs/gst/codecs/gsth264picture.h index 8d3a449c52..73cad13630 100644 --- a/gst-libs/gst/codecs/gsth264picture.h +++ b/gst-libs/gst/codecs/gsth264picture.h @@ -58,6 +58,8 @@ struct _GstH264Picture GstH264SliceType type; GstClockTime pts; + /* From GstVideoCodecFrame */ + guint32 system_frame_number; guint8 pic_order_cnt_type; /* SPS */ gint32 top_field_order_cnt; diff --git a/gst-libs/gst/codecs/gsth265decoder.c b/gst-libs/gst/codecs/gsth265decoder.c index 9ce7d46c5c..09ca56a187 100644 --- a/gst-libs/gst/codecs/gsth265decoder.c +++ b/gst-libs/gst/codecs/gsth265decoder.c @@ -392,6 +392,8 @@ gst_h265_decoder_parse_slice (GstH265Decoder * self, GstH265NalUnit * nalu, return FALSE; } + /* This allows accessing the frame from the picture. */ + picture->system_frame_number = priv->current_frame->system_frame_number; priv->current_picture = picture; gst_video_codec_frame_set_user_data (priv->current_frame, gst_h265_picture_ref (priv->current_picture), diff --git a/gst-libs/gst/codecs/gsth265picture.h b/gst-libs/gst/codecs/gsth265picture.h index 2c40badcdb..38dd5b3628 100644 --- a/gst-libs/gst/codecs/gsth265picture.h +++ b/gst-libs/gst/codecs/gsth265picture.h @@ -64,6 +64,8 @@ struct _GstH265Picture GstH265SliceType type; GstClockTime pts; + /* From GstVideoCodecFrame */ + guint32 system_frame_number; gint pic_order_cnt; gint pic_order_cnt_msb; diff --git a/gst-libs/gst/codecs/gstvp9decoder.c b/gst-libs/gst/codecs/gstvp9decoder.c index 3b11c621a0..7ddf808a49 100644 --- a/gst-libs/gst/codecs/gstvp9decoder.c +++ b/gst-libs/gst/codecs/gstvp9decoder.c @@ -396,6 +396,15 @@ gst_vp9_decoder_handle_frame (GstVideoDecoder * decoder, picture->subsampling_y = priv->parser->subsampling_y; picture->bit_depth = priv->parser->bit_depth; + if (i == frame_idx_to_consume) { + /* This allows accessing the frame from the picture. */ + picture->system_frame_number = frame->system_frame_number; + gst_video_codec_frame_set_user_data (frame, + gst_vp9_picture_ref (picture), + (GDestroyNotify) gst_vp9_picture_unref); + } + + if (klass->new_picture) { if (!klass->new_picture (self, picture)) { GST_ERROR_OBJECT (self, "new picture error"); @@ -424,12 +433,6 @@ gst_vp9_decoder_handle_frame (GstVideoDecoder * decoder, } } - if (i == frame_idx_to_consume) { - gst_video_codec_frame_set_user_data (frame, - gst_vp9_picture_ref (picture), - (GDestroyNotify) gst_vp9_picture_unref); - } - if (klass->output_picture) ret = klass->output_picture (self, picture); diff --git a/gst-libs/gst/codecs/gstvp9picture.h b/gst-libs/gst/codecs/gstvp9picture.h index 138014519e..25a82df1e3 100644 --- a/gst-libs/gst/codecs/gstvp9picture.h +++ b/gst-libs/gst/codecs/gstvp9picture.h @@ -37,6 +37,8 @@ struct _GstVp9Picture GstMiniObject parent; GstClockTime pts; + /* From GstVideoCodecFrame */ + guint32 system_frame_number; GstVp9FrameHdr frame_hdr;