h264picture: Add system_frame_num

This allow cross-referencing GstH264Picture and GstVideoCodecFrame.
This commit is contained in:
Nicolas Dufresne 2020-02-14 21:50:15 -05:00 committed by Nicolas Dufresne
parent 2b9ffa8f54
commit 56c3b40c30
6 changed files with 19 additions and 6 deletions

View file

@ -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),

View file

@ -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;

View file

@ -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),

View file

@ -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;

View file

@ -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);

View file

@ -37,6 +37,8 @@ struct _GstVp9Picture
GstMiniObject parent;
GstClockTime pts;
/* From GstVideoCodecFrame */
guint32 system_frame_number;
GstVp9FrameHdr frame_hdr;