From 4b43e95ebd6550605ceb65d46e79ff93140250f5 Mon Sep 17 00:00:00 2001 From: Josep Torra Date: Fri, 7 Nov 2014 15:41:15 +0100 Subject: [PATCH] h265parse: set the HEADER flag on buffers containing VPS, SPS or PPS --- gst/videoparsers/gsth265parse.c | 13 +++++++++++++ gst/videoparsers/gsth265parse.h | 1 + 2 files changed, 14 insertions(+) diff --git a/gst/videoparsers/gsth265parse.c b/gst/videoparsers/gsth265parse.c index 2aaac57f24..2d7b997270 100644 --- a/gst/videoparsers/gsth265parse.c +++ b/gst/videoparsers/gsth265parse.c @@ -168,6 +168,7 @@ gst_h265_parse_reset_frame (GstH265Parse * h265parse) h265parse->idr_pos = -1; h265parse->sei_pos = -1; h265parse->keyframe = FALSE; + h265parse->header = FALSE; gst_adapter_clear (h265parse->frame_out); } @@ -419,6 +420,10 @@ gst_h265_parser_store_nal (GstH265Parse * h265parse, guint id, buf = gst_buffer_new_allocate (NULL, size, NULL); gst_buffer_fill (buf, 0, nalu->data + nalu->offset, size); + /* Indicate that buffer contain a header needed for decoding */ + if (naltype >= GST_H265_NAL_VPS && naltype <= GST_H265_NAL_PPS) + GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_HEADER); + if (store[id]) gst_buffer_unref (store[id]); @@ -524,6 +529,7 @@ gst_h265_parse_process_nal (GstH265Parse * h265parse, GstH265NalUnit * nalu) } gst_h265_parser_store_nal (h265parse, vps.id, nal_type, nalu); + h265parse->header |= TRUE; break; case GST_H265_NAL_SPS: pres = gst_h265_parser_parse_sps (nalparser, nalu, &sps, TRUE); @@ -546,6 +552,7 @@ gst_h265_parse_process_nal (GstH265Parse * h265parse, GstH265NalUnit * nalu) } gst_h265_parser_store_nal (h265parse, sps.id, nal_type, nalu); + h265parse->header |= TRUE; break; case GST_H265_NAL_PPS: pres = gst_h265_parser_parse_pps (nalparser, nalu, &pps); @@ -571,6 +578,7 @@ gst_h265_parse_process_nal (GstH265Parse * h265parse, GstH265NalUnit * nalu) } gst_h265_parser_store_nal (h265parse, pps.id, nal_type, nalu); + h265parse->header |= TRUE; break; case GST_H265_NAL_PREFIX_SEI: case GST_H265_NAL_SUFFIX_SEI: @@ -1407,6 +1415,11 @@ gst_h265_parse_parse_frame (GstBaseParse * parse, GstBaseParseFrame * frame) else GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT); + if (h265parse->header) + GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_HEADER); + else + GST_BUFFER_FLAG_UNSET (buffer, GST_BUFFER_FLAG_HEADER); + /* replace with transformed HEVC output if applicable */ av = gst_adapter_available (h265parse->frame_out); if (av) { diff --git a/gst/videoparsers/gsth265parse.h b/gst/videoparsers/gsth265parse.h index 7e07a603d7..91e84ab1fa 100644 --- a/gst/videoparsers/gsth265parse.h +++ b/gst/videoparsers/gsth265parse.h @@ -83,6 +83,7 @@ struct _GstH265Parse gboolean update_caps; GstAdapter *frame_out; gboolean keyframe; + gboolean header; /* AU state */ gboolean picture_start;