From d0d65fa875777d7c292f3bf45bd79975dc11fbea Mon Sep 17 00:00:00 2001
From: Philipp Zabel
Date: Wed, 4 Sep 2019 15:57:30 +0200
Subject: [PATCH] codecparsers: h264: record dec_ref_pic_marking() size
Some hardware decoders, for example Hantro G1, have to be told the size
of the dec_ref_pic_marking() syntax element in bits. Record the size so
it can be passed on to the hardware.
---
gst-libs/gst/codecparsers/gsth264parser.c | 5 +++++
gst-libs/gst/codecparsers/gsth264parser.h | 3 +++
2 files changed, 8 insertions(+)
diff --git a/gst-libs/gst/codecparsers/gsth264parser.c b/gst-libs/gst/codecparsers/gsth264parser.c
index 4af4d44f96..320777b0b0 100644
--- a/gst-libs/gst/codecparsers/gsth264parser.c
+++ b/gst-libs/gst/codecparsers/gsth264parser.c
@@ -704,9 +704,12 @@ gst_h264_slice_parse_dec_ref_pic_marking (GstH264SliceHdr * slice,
GstH264NalUnit * nalu, NalReader * nr)
{
GstH264DecRefPicMarking *dec_ref_pic_m;
+ guint start_pos;
GST_DEBUG ("parsing \"Decoded reference picture marking\"");
+ start_pos = nal_reader_get_pos (nr);
+
dec_ref_pic_m = &slice->dec_ref_pic_marking;
if (nalu->idr_pic_flag) {
@@ -746,6 +749,8 @@ gst_h264_slice_parse_dec_ref_pic_marking (GstH264SliceHdr * slice,
}
}
+ dec_ref_pic_m->bit_size = nal_reader_get_pos (nr) - start_pos;
+
return TRUE;
error:
diff --git a/gst-libs/gst/codecparsers/gsth264parser.h b/gst-libs/gst/codecparsers/gsth264parser.h
index dda51d6da9..9670be5c95 100644
--- a/gst-libs/gst/codecparsers/gsth264parser.h
+++ b/gst-libs/gst/codecparsers/gsth264parser.h
@@ -867,6 +867,9 @@ struct _GstH264DecRefPicMarking
guint8 adaptive_ref_pic_marking_mode_flag;
GstH264RefPicMarking ref_pic_marking[10];
guint8 n_ref_pic_marking;
+
+ /* Size of the dec_ref_pic_marking() syntax element in bits (Since: 1.18) */
+ guint bit_size;
};