summaryrefslogtreecommitdiff
path: root/gst/videoparsers
diff options
context:
space:
mode:
authorJosep Torra <n770galaxy@gmail.com>2014-11-07 15:50:51 +0100
committerJosep Torra <n770galaxy@gmail.com>2014-11-07 15:51:48 +0100
commitd518033e77259a9ba79a7619c4791f345a7b92d7 (patch)
tree43f1dca308f310ae0ebfea115bce916f815e90ca /gst/videoparsers
parent4b43e95ebd6550605ceb65d46e79ff93140250f5 (diff)
downloadgstreamer-plugins-bad-d518033e77259a9ba79a7619c4791f345a7b92d7.tar.gz
h264parse: set the HEADER flag on buffers containing SPS or PPS
Diffstat (limited to 'gst/videoparsers')
-rw-r--r--gst/videoparsers/gsth264parse.c12
-rw-r--r--gst/videoparsers/gsth264parse.h1
2 files changed, 13 insertions, 0 deletions
diff --git a/gst/videoparsers/gsth264parse.c b/gst/videoparsers/gsth264parse.c
index 9dee1ae4f..db8e90966 100644
--- a/gst/videoparsers/gsth264parse.c
+++ b/gst/videoparsers/gsth264parse.c
@@ -189,6 +189,7 @@ gst_h264_parse_reset_frame (GstH264Parse * h264parse)
h264parse->idr_pos = -1;
h264parse->sei_pos = -1;
h264parse->keyframe = FALSE;
+ h264parse->header = FALSE;
h264parse->frame_start = FALSE;
gst_adapter_clear (h264parse->frame_out);
}
@@ -447,6 +448,10 @@ gst_h264_parser_store_nal (GstH264Parse * h264parse, 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_H264_NAL_SPS || naltype == GST_H264_NAL_PPS)
+ GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_HEADER);
+
if (store[id])
gst_buffer_unref (store[id]);
@@ -591,6 +596,7 @@ gst_h264_parse_process_nal (GstH264Parse * h264parse, GstH264NalUnit * nalu)
gst_h264_parser_store_nal (h264parse, sps.id, nal_type, nalu);
h264parse->state |= GST_H264_PARSE_STATE_GOT_SPS;
+ h264parse->header |= TRUE;
break;
case GST_H264_NAL_PPS:
/* expected state: got-sps */
@@ -624,6 +630,7 @@ gst_h264_parse_process_nal (GstH264Parse * h264parse, GstH264NalUnit * nalu)
gst_h264_parser_store_nal (h264parse, pps.id, nal_type, nalu);
gst_h264_pps_clear (&pps);
h264parse->state |= GST_H264_PARSE_STATE_GOT_PPS;
+ h264parse->header |= TRUE;
break;
case GST_H264_NAL_SEI:
/* expected state: got-sps */
@@ -1556,6 +1563,11 @@ gst_h264_parse_parse_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
else
GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT);
+ if (h264parse->header)
+ GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_HEADER);
+ else
+ GST_BUFFER_FLAG_UNSET (buffer, GST_BUFFER_FLAG_HEADER);
+
if (h264parse->discont) {
GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DISCONT);
h264parse->discont = FALSE;
diff --git a/gst/videoparsers/gsth264parse.h b/gst/videoparsers/gsth264parse.h
index c9d188bcb..e056ca2cd 100644
--- a/gst/videoparsers/gsth264parse.h
+++ b/gst/videoparsers/gsth264parse.h
@@ -109,6 +109,7 @@ struct _GstH264Parse
gboolean update_caps;
GstAdapter *frame_out;
gboolean keyframe;
+ gboolean header;
gboolean frame_start;
/* AU state */
gboolean picture_start;