h264parse: set the HEADER flag on buffers containing SPS or PPS
This commit is contained in:
parent
4b43e95ebd
commit
d518033e77
@ -189,6 +189,7 @@ gst_h264_parse_reset_frame (GstH264Parse * h264parse)
|
|||||||
h264parse->idr_pos = -1;
|
h264parse->idr_pos = -1;
|
||||||
h264parse->sei_pos = -1;
|
h264parse->sei_pos = -1;
|
||||||
h264parse->keyframe = FALSE;
|
h264parse->keyframe = FALSE;
|
||||||
|
h264parse->header = FALSE;
|
||||||
h264parse->frame_start = FALSE;
|
h264parse->frame_start = FALSE;
|
||||||
gst_adapter_clear (h264parse->frame_out);
|
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);
|
buf = gst_buffer_new_allocate (NULL, size, NULL);
|
||||||
gst_buffer_fill (buf, 0, nalu->data + nalu->offset, size);
|
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])
|
if (store[id])
|
||||||
gst_buffer_unref (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);
|
gst_h264_parser_store_nal (h264parse, sps.id, nal_type, nalu);
|
||||||
h264parse->state |= GST_H264_PARSE_STATE_GOT_SPS;
|
h264parse->state |= GST_H264_PARSE_STATE_GOT_SPS;
|
||||||
|
h264parse->header |= TRUE;
|
||||||
break;
|
break;
|
||||||
case GST_H264_NAL_PPS:
|
case GST_H264_NAL_PPS:
|
||||||
/* expected state: got-sps */
|
/* 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_parser_store_nal (h264parse, pps.id, nal_type, nalu);
|
||||||
gst_h264_pps_clear (&pps);
|
gst_h264_pps_clear (&pps);
|
||||||
h264parse->state |= GST_H264_PARSE_STATE_GOT_PPS;
|
h264parse->state |= GST_H264_PARSE_STATE_GOT_PPS;
|
||||||
|
h264parse->header |= TRUE;
|
||||||
break;
|
break;
|
||||||
case GST_H264_NAL_SEI:
|
case GST_H264_NAL_SEI:
|
||||||
/* expected state: got-sps */
|
/* expected state: got-sps */
|
||||||
@ -1556,6 +1563,11 @@ gst_h264_parse_parse_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
|
|||||||
else
|
else
|
||||||
GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT);
|
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) {
|
if (h264parse->discont) {
|
||||||
GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DISCONT);
|
GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DISCONT);
|
||||||
h264parse->discont = FALSE;
|
h264parse->discont = FALSE;
|
||||||
|
@ -109,6 +109,7 @@ struct _GstH264Parse
|
|||||||
gboolean update_caps;
|
gboolean update_caps;
|
||||||
GstAdapter *frame_out;
|
GstAdapter *frame_out;
|
||||||
gboolean keyframe;
|
gboolean keyframe;
|
||||||
|
gboolean header;
|
||||||
gboolean frame_start;
|
gboolean frame_start;
|
||||||
/* AU state */
|
/* AU state */
|
||||||
gboolean picture_start;
|
gboolean picture_start;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user