mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-25 10:04:19 +00:00
codecparsers: h264: recognize SVC NAL units.
Identify SVC NAL units and tag them as such. This is necessary for gst_h264_parser_parse_slice_hdr() to fail gracefully, if the user did not perform the check himself. Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
This commit is contained in:
parent
b50c3e2127
commit
65fc58da4d
2 changed files with 24 additions and 1 deletions
gst-libs/gst/codecparsers
|
@ -226,7 +226,11 @@ gst_h264_parse_nalu_header (GstH264NalUnit * nalu)
|
|||
nalu->size - nalu->header_bytes);
|
||||
|
||||
svc_extension_flag = gst_bit_reader_get_bits_uint8_unchecked (&br, 1);
|
||||
if (!svc_extension_flag) { /* MVC */
|
||||
if (svc_extension_flag) { /* SVC */
|
||||
|
||||
nalu->extension_type = GST_H264_NAL_EXTENSION_SVC;
|
||||
|
||||
} else { /* MVC */
|
||||
GstH264NalUnitExtensionMVC *const mvc = &nalu->extension.mvc;
|
||||
|
||||
nalu->extension_type = GST_H264_NAL_EXTENSION_MVC;
|
||||
|
@ -2139,6 +2143,12 @@ gst_h264_parser_parse_slice_hdr (GstH264NalParser * nalparser,
|
|||
return GST_H264_PARSER_BROKEN_LINK;
|
||||
}
|
||||
|
||||
/* Check we can actually parse this slice (AVC, MVC headers only) */
|
||||
if (sps->extension_type && sps->extension_type != GST_H264_NAL_EXTENSION_MVC) {
|
||||
GST_WARNING ("failed to parse unsupported slice header");
|
||||
return GST_H264_PARSER_BROKEN_DATA;
|
||||
}
|
||||
|
||||
/* set default values for fields that might not be present in the bitstream
|
||||
and have valid defaults */
|
||||
slice->field_pic_flag = 0;
|
||||
|
|
|
@ -50,6 +50,17 @@ G_BEGIN_DECLS
|
|||
#define GST_H264_IS_SP_SLICE(slice) (((slice)->type % 5) == GST_H264_SP_SLICE)
|
||||
#define GST_H264_IS_SI_SLICE(slice) (((slice)->type % 5) == GST_H264_SI_SLICE)
|
||||
|
||||
/**
|
||||
* GST_H264_IS_SVC_NALU:
|
||||
* @nalu: a #GstH264NalUnit
|
||||
*
|
||||
* Check if @nalu is a scalable extension NAL unit.
|
||||
*
|
||||
* Since: 1.6
|
||||
*/
|
||||
#define GST_H264_IS_SVC_NALU(nalu) \
|
||||
((nalu)->extension_type == GST_H264_NAL_EXTENSION_SVC)
|
||||
|
||||
/**
|
||||
* GST_H264_IS_MVC_NALU:
|
||||
* @nalu: a #GstH264NalUnit
|
||||
|
@ -147,6 +158,7 @@ typedef enum
|
|||
/**
|
||||
* GstH264NalUnitExtensionType:
|
||||
* @GST_H264_NAL_EXTENSION_NONE: No NAL unit header extension is available
|
||||
* @GST_H264_NAL_EXTENSION_SVC: NAL unit header extension for SVC (Annex G)
|
||||
* @GST_H264_NAL_EXTENSION_MVC: NAL unit header extension for MVC (Annex H)
|
||||
*
|
||||
* Indicates the type of H.264 NAL unit extension.
|
||||
|
@ -156,6 +168,7 @@ typedef enum
|
|||
typedef enum
|
||||
{
|
||||
GST_H264_NAL_EXTENSION_NONE = 0,
|
||||
GST_H264_NAL_EXTENSION_SVC,
|
||||
GST_H264_NAL_EXTENSION_MVC,
|
||||
} GstH264NalUnitExtensionType;
|
||||
|
||||
|
|
Loading…
Reference in a new issue