1 From b1974b68fac0dad1c76ab74f0b6b3d9ff99b6f27 Mon Sep 17 00:00:00 2001
2 From: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
3 Date: Tue, 19 Mar 2013 14:23:00 +0200
4 Subject: [PATCH 8/8] h264parse: add initial support for MVC NAL units.
6 Initial support for MVC NAL units. It is only needed to propagate the
7 complete set of NAL units downstream at this time.
9 https://bugzilla.gnome.org/show_bug.cgi?id=696135
11 Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
12 Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
14 gst/vaapi/gsth264parse.c | 20 +++++++++++++++-----
15 1 file changed, 15 insertions(+), 5 deletions(-)
17 diff --git a/gst/vaapi/gsth264parse.c b/gst/vaapi/gsth264parse.c
18 index 413a227..b4f20f7 100644
19 --- a/gst/vaapi/gsth264parse.c
20 +++ b/gst/vaapi/gsth264parse.c
21 @@ -433,7 +433,7 @@ gst_h264_parser_store_nal (GstH264Parse * h264parse, guint id,
22 GstBuffer *buf, **store;
23 guint size = nalu->size, store_size;
25 - if (naltype == GST_H264_NAL_SPS) {
26 + if (naltype == GST_H264_NAL_SPS || naltype == GST_H264_NAL_SUBSET_SPS) {
27 store_size = GST_H264_MAX_SPS_COUNT;
28 store = h264parse->sps_nals;
29 GST_DEBUG_OBJECT (h264parse, "storing sps %u", id);
30 @@ -551,10 +551,16 @@ gst_h264_parse_process_nal (GstH264Parse * h264parse, GstH264NalUnit * nalu)
31 nal_type, _nal_name (nal_type), nalu->size);
34 + case GST_H264_NAL_SUBSET_SPS:
35 + if (!GST_H264_PARSE_STATE_VALID (h264parse, GST_H264_PARSE_STATE_GOT_SPS))
39 case GST_H264_NAL_SPS:
40 /* reset state, everything else is obsolete */
44 pres = gst_h264_parser_parse_sps (nalparser, nalu, &sps, TRUE);
45 /* arranged for a fallback sps.id, so use that one and only warn */
46 if (pres != GST_H264_PARSER_OK) {
47 @@ -631,6 +637,7 @@ gst_h264_parse_process_nal (GstH264Parse * h264parse, GstH264NalUnit * nalu)
48 case GST_H264_NAL_SLICE_DPB:
49 case GST_H264_NAL_SLICE_DPC:
50 case GST_H264_NAL_SLICE_IDR:
51 + case GST_H264_NAL_SLICE_EXT:
52 /* expected state: got-sps|got-pps (valid picture headers) */
53 h264parse->state &= GST_H264_PARSE_STATE_VALID_PICTURE_HEADERS;
54 if (!GST_H264_PARSE_STATE_VALID (h264parse,
55 @@ -638,13 +645,15 @@ gst_h264_parse_process_nal (GstH264Parse * h264parse, GstH264NalUnit * nalu)
58 /* don't need to parse the whole slice (header) here */
59 - if (*(nalu->data + nalu->offset + 1) & 0x80) {
60 + if (*(nalu->data + nalu->offset + nalu->header_bytes) & 0x80) {
61 /* means first_mb_in_slice == 0 */
63 GST_DEBUG_OBJECT (h264parse, "first_mb_in_slice = 0");
64 h264parse->frame_start = TRUE;
66 GST_DEBUG_OBJECT (h264parse, "frame start: %i", h264parse->frame_start);
67 + if (nal_type == GST_H264_NAL_SLICE_EXT && !GST_H264_IS_MVC_NALU (nalu))
70 GstH264SliceHdr slice;
72 @@ -741,8 +750,9 @@ gst_h264_parse_collect_nal (GstH264Parse * h264parse, const guint8 * data,
73 * and also works with broken frame_num in NAL
74 * (where spec-wise would fail) */
75 nal_type = nnalu.type;
76 - complete = h264parse->picture_start && (nal_type >= GST_H264_NAL_SEI &&
77 - nal_type <= GST_H264_NAL_AU_DELIMITER);
78 + complete = h264parse->picture_start && ((nal_type >= GST_H264_NAL_SEI &&
79 + nal_type <= GST_H264_NAL_AU_DELIMITER) ||
80 + (nal_type >= 14 && nal_type <= 18));
82 GST_LOG_OBJECT (h264parse, "next nal type: %d %s", nal_type,
83 _nal_name (nal_type));
84 @@ -750,7 +760,7 @@ gst_h264_parse_collect_nal (GstH264Parse * h264parse, const guint8 * data,
85 || nal_type == GST_H264_NAL_SLICE_DPA
86 || nal_type == GST_H264_NAL_SLICE_IDR) &&
87 /* first_mb_in_slice == 0 considered start of frame */
88 - (nnalu.data[nnalu.offset + 1] & 0x80);
89 + (nnalu.data[nnalu.offset + nnalu.header_bytes] & 0x80);
91 GST_LOG_OBJECT (h264parse, "au complete: %d", complete);