summaryrefslogtreecommitdiff
path: root/include/gst/codecparsers
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2022-08-03 21:02:36 +0300
committerGeorge Hazan <ghazan@miranda.im>2022-08-03 21:02:36 +0300
commit5323a782c4e8c42781f22ce2f488962a18f82554 (patch)
treef71537197b16f0f8fd0d6937f7120d018d220814 /include/gst/codecparsers
parent50acf9d37183f86f6f623aad410003392b0af41f (diff)
Jabber: initial version of Jingle support
Diffstat (limited to 'include/gst/codecparsers')
-rw-r--r--include/gst/codecparsers/codecparsers-prelude.h35
-rw-r--r--include/gst/codecparsers/gstav1parser.h1846
-rw-r--r--include/gst/codecparsers/gsth264parser.h1336
-rw-r--r--include/gst/codecparsers/gsth265parser.h1815
-rw-r--r--include/gst/codecparsers/gstjpeg2000sampling.h115
-rw-r--r--include/gst/codecparsers/gstjpegparser.h412
-rw-r--r--include/gst/codecparsers/gstmpeg4parser.h592
-rw-r--r--include/gst/codecparsers/gstmpegvideometa.h92
-rw-r--r--include/gst/codecparsers/gstmpegvideoparser.h570
-rw-r--r--include/gst/codecparsers/gstvc1parser.h656
-rw-r--r--include/gst/codecparsers/gstvp8parser.h346
-rw-r--r--include/gst/codecparsers/gstvp8rangedecoder.h80
-rw-r--r--include/gst/codecparsers/gstvp9parser.h521
13 files changed, 8416 insertions, 0 deletions
diff --git a/include/gst/codecparsers/codecparsers-prelude.h b/include/gst/codecparsers/codecparsers-prelude.h
new file mode 100644
index 0000000000..b056c6489e
--- /dev/null
+++ b/include/gst/codecparsers/codecparsers-prelude.h
@@ -0,0 +1,35 @@
+/* GStreamer Codec Parsers Library
+ * Copyright (C) 2018 GStreamer developers
+ *
+ * codecparsers-prelude.h: prelude include header for gst-codecparsers library
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_CODEC_PARSERS_PRELUDE_H__
+#define __GST_CODEC_PARSERS_PRELUDE_H__
+
+#include <gst/gst.h>
+
+#ifndef GST_CODEC_PARSERS_API
+# ifdef BUILDING_GST_CODEC_PARSERS
+# define GST_CODEC_PARSERS_API GST_API_EXPORT /* from config.h */
+# else
+# define GST_CODEC_PARSERS_API GST_API_IMPORT
+# endif
+#endif
+
+#endif /* __GST_CODEC_PARSERS_PRELUDE_H__ */
diff --git a/include/gst/codecparsers/gstav1parser.h b/include/gst/codecparsers/gstav1parser.h
new file mode 100644
index 0000000000..31f5945498
--- /dev/null
+++ b/include/gst/codecparsers/gstav1parser.h
@@ -0,0 +1,1846 @@
+/*
+ * gstav1parser.h
+ *
+ * Copyright (C) 2018 Georg Ottinger
+ * Copyright (C) 2019-2020 Intel Corporation
+ * Author: Georg Ottinger<g.ottinger@gmx.at>
+ * Author: Junyan He<junyan.he@hotmail.com>
+ * Author: Victor Jaquez <vjaquez@igalia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_AV1_PARSER_H__
+#define __GST_AV1_PARSER_H__
+
+#ifndef GST_USE_UNSTABLE_API
+#warning "The AV1 parsing library is unstable API and may change in future."
+#warning "You can define GST_USE_UNSTABLE_API to avoid this warning."
+#endif
+
+#include <gst/gst.h>
+#include <gst/codecparsers/codecparsers-prelude.h>
+
+G_BEGIN_DECLS
+
+#define GST_AV1_MAX_NUM_TEMPORAL_LAYERS 8
+#define GST_AV1_MAX_NUM_SPATIAL_LAYERS 4
+#define GST_AV1_MAX_TILE_WIDTH 4096
+#define GST_AV1_MAX_TILE_AREA (4096 * 2304)
+#define GST_AV1_TOTAL_REFS_PER_FRAME 8
+#define GST_AV1_MAX_SEGMENTS 8
+#define GST_AV1_SEG_LVL_MAX 8
+#define GST_AV1_MAX_TILE_COLS 64
+#define GST_AV1_MAX_TILE_ROWS 64
+
+#define GST_AV1_REFS_PER_FRAME 7
+#define GST_AV1_PRIMARY_REF_NONE 7
+#define GST_AV1_SUPERRES_NUM 8
+#define GST_AV1_SUPERRES_DENOM_MIN 9
+#define GST_AV1_SUPERRES_DENOM_BITS 3
+#define GST_AV1_MAX_LOOP_FILTER 63
+#define GST_AV1_GM_ABS_TRANS_BITS 12
+#define GST_AV1_GM_ABS_TRANS_ONLY_BITS 9
+#define GST_AV1_GM_ABS_ALPHA_BITS 12
+#define GST_AV1_GM_ALPHA_PREC_BITS 15
+#define GST_AV1_GM_TRANS_PREC_BITS 6
+#define GST_AV1_GM_TRANS_ONLY_PREC_BITS 3
+#define GST_AV1_WARPEDMODEL_PREC_BITS 16
+#define GST_AV1_WARP_PARAM_REDUCE_BITS 6
+#define GST_AV1_SELECT_SCREEN_CONTENT_TOOLS 2
+#define GST_AV1_SELECT_INTEGER_MV 2
+#define GST_AV1_RESTORATION_TILESIZE_MAX 256
+#define GST_AV1_SEG_LVL_ALT_Q 0
+#define GST_AV1_SEG_LVL_REF_FRAME 5
+/* Following defines are derived from the spec, but not mentioned by
+ * this particular name in the spec */
+#define GST_AV1_CDEF_MAX (1 << 3)
+#define GST_AV1_MAX_TILE_COUNT 512
+#define GST_AV1_MAX_OPERATING_POINTS \
+ (GST_AV1_MAX_NUM_TEMPORAL_LAYERS * GST_AV1_MAX_NUM_SPATIAL_LAYERS)
+#define GST_AV1_MAX_SPATIAL_LAYERS 2 /* correct? */
+#define GST_AV1_MAX_TEMPORAL_GROUP_SIZE 8 /* correct? */
+#define GST_AV1_MAX_TEMPORAL_GROUP_REFERENCES 8 /* correct? */
+#define GST_AV1_MAX_NUM_Y_POINTS 16
+#define GST_AV1_MAX_NUM_CB_POINTS 16
+#define GST_AV1_MAX_NUM_CR_POINTS 16
+#define GST_AV1_MAX_NUM_POS_LUMA 25
+#define GST_AV1_MAX_NUM_PLANES 3
+
+#define GST_AV1_DIV_LUT_PREC_BITS 14
+#define GST_AV1_DIV_LUT_BITS 8
+#define GST_AV1_DIV_LUT_NUM (1 << GST_AV1_DIV_LUT_BITS)
+
+
+typedef struct _GstAV1Parser GstAV1Parser;
+
+typedef struct _GstAV1OBUHeader GstAV1OBUHeader;
+typedef struct _GstAV1OBU GstAV1OBU;
+
+typedef struct _GstAV1SequenceHeaderOBU GstAV1SequenceHeaderOBU;
+typedef struct _GstAV1MetadataOBU GstAV1MetadataOBU;
+typedef struct _GstAV1FrameHeaderOBU GstAV1FrameHeaderOBU;
+typedef struct _GstAV1TileListOBU GstAV1TileListOBU;
+typedef struct _GstAV1TileGroupOBU GstAV1TileGroupOBU;
+typedef struct _GstAV1FrameOBU GstAV1FrameOBU;
+
+typedef struct _GstAV1OperatingPoint GstAV1OperatingPoint;
+typedef struct _GstAV1DecoderModelInfo GstAV1DecoderModelInfo;
+typedef struct _GstAV1TimingInfo GstAV1TimingInfo;
+typedef struct _GstAV1ColorConfig GstAV1ColorConfig;
+typedef struct _GstAV1MetadataITUT_T35 GstAV1MetadataITUT_T35;
+typedef struct _GstAV1MetadataHdrCll GstAV1MetadataHdrCll;
+typedef struct _GstAV1MetadataHdrMdcv GstAV1MetadataHdrMdcv;
+typedef struct _GstAV1MetadataScalability GstAV1MetadataScalability;
+typedef struct _GstAV1MetadataTimecode GstAV1MetadataTimecode;
+typedef struct _GstAV1LoopFilterParams GstAV1LoopFilterParams;
+typedef struct _GstAV1QuantizationParams GstAV1QuantizationParams;
+typedef struct _GstAV1SegmenationParams GstAV1SegmenationParams;
+typedef struct _GstAV1TileInfo GstAV1TileInfo;
+typedef struct _GstAV1CDEFParams GstAV1CDEFParams;
+typedef struct _GstAV1LoopRestorationParams GstAV1LoopRestorationParams;
+typedef struct _GstAV1GlobalMotionParams GstAV1GlobalMotionParams;
+typedef struct _GstAV1FilmGrainParams GstAV1FilmGrainParams;
+
+typedef struct _GstAV1ReferenceFrameInfo GstAV1ReferenceFrameInfo;
+
+/**
+ * GstAV1ParserResult:
+ * @GST_AV1_PARSER_OK: successful return
+ * @GST_AV1_PARSER_NO_MORE_DATA: the parser needs more data for one OBU
+ * @GST_AV1_PARSER_DROP: no need to handle this OBU, skip it
+ * @GST_AV1_PARSER_BITSTREAM_ERROR: stream error, for example, include invalid bits
+ * @GST_AV1_PARSER_MISSING_OBU_REFERENCE: no reference, for example, no sequence found
+ * @GST_AV1_PARSER_INVALID_OPERATION: something like invalid parameters
+ *
+ * Defines the result of parser process
+ */
+typedef enum {
+ GST_AV1_PARSER_OK = 0,
+ GST_AV1_PARSER_NO_MORE_DATA = 1,
+ GST_AV1_PARSER_DROP = 2,
+ GST_AV1_PARSER_BITSTREAM_ERROR = 3,
+ GST_AV1_PARSER_MISSING_OBU_REFERENCE = 4,
+ GST_AV1_PARSER_INVALID_OPERATION = 5,
+} GstAV1ParserResult;
+
+/**
+ * GstAV1Profile:
+ * @GST_AV1_PROFILE_0: 8-bit and 10-bit 4:2:0 and 4:0:0 only.
+ * @GST_AV1_PROFILE_1: 8-bit and 10-bit 4:4:4.
+ * @GST_AV1_PROFILE_2: 8-bit and 10-bit 4:2:2, 12-bit 4:0:0 4:2:2 and 4:4:4
+ * @GST_AV1_PROFILE_UNDEFINED: unknow AV1 profile (Since: 1.20)
+ *
+ * Defines the AV1 profiles
+ */
+/**
+ * GST_AV1_PROFILE_UNDEFINED:
+ *
+ * unknow AV1 profile
+ *
+ * Since: 1.20
+ */
+typedef enum {
+ GST_AV1_PROFILE_0 = 0,
+ GST_AV1_PROFILE_1 = 1,
+ GST_AV1_PROFILE_2 = 2,
+ GST_AV1_PROFILE_UNDEFINED,
+} GstAV1Profile;
+
+/**
+ * GstAV1OBUType:
+ * @GST_AV1_OBU_RESERVED_0: Reserved 0
+ * @GST_AV1_OBU_SEQUENCE_HEADER: Sequence Header OBU
+ * @GST_AV1_OBU_TEMPORAL_DELIMITER: Temporal Delimiter OBU
+ * @GST_AV1_OBU_FRAME_HEADER: Frame Header OBU
+ * @GST_AV1_OBU_TILE_GROUP: Tile Group OBU
+ * @GST_AV1_OBU_METADATA: Metadata OBU
+ * @GST_AV1_OBU_FRAME: Frame OBU (includes Frame Header and one Tile Group)
+ * @GST_AV1_OBU_REDUNDANT_FRAME_HEADER: Redundant Frame Header OBU
+ * @GST_AV1_OBU_TILE_LIST: Tile LIst OBU
+ * @GST_AV1_OBU_RESERVED_9: Reserved 9
+ * @GST_AV1_OBU_RESERVED_10: Reserved 10
+ * @GST_AV1_OBU_RESERVED_11: Reserved 11
+ * @GST_AV1_OBU_RESERVED_12: Reserved 12
+ * @GST_AV1_OBU_RESERVED_13: Reserved 13
+ * @GST_AV1_OBU_RESERVED_14: Reserved 14
+ * @GST_AV1_OBU_PADDING: Padding
+ *
+ * Defines all the possible OBU types
+ */
+typedef enum {
+ GST_AV1_OBU_RESERVED_0 = 0,
+ GST_AV1_OBU_SEQUENCE_HEADER = 1,
+ GST_AV1_OBU_TEMPORAL_DELIMITER = 2,
+ GST_AV1_OBU_FRAME_HEADER = 3,
+ GST_AV1_OBU_TILE_GROUP = 4,
+ GST_AV1_OBU_METADATA = 5,
+ GST_AV1_OBU_FRAME = 6,
+ GST_AV1_OBU_REDUNDANT_FRAME_HEADER = 7,
+ GST_AV1_OBU_TILE_LIST = 8,
+ GST_AV1_OBU_RESERVED_9 = 9,
+ GST_AV1_OBU_RESERVED_10 = 10,
+ GST_AV1_OBU_RESERVED_11 = 11,
+ GST_AV1_OBU_RESERVED_12 = 12,
+ GST_AV1_OBU_RESERVED_13 = 13,
+ GST_AV1_OBU_RESERVED_14 = 14,
+ GST_AV1_OBU_PADDING = 15,
+} GstAV1OBUType;
+
+/**
+ * GstAV1SeqLevels:
+ * @GST_AV1_SEQ_LEVEL_2_0: Level 2.0
+ * @GST_AV1_SEQ_LEVEL_2_1: Level 2.1
+ * @GST_AV1_SEQ_LEVEL_2_2: Level 2.2
+ * @GST_AV1_SEQ_LEVEL_2_3: Level 2.3
+ * @GST_AV1_SEQ_LEVEL_3_0: Level 3.0
+ * @GST_AV1_SEQ_LEVEL_3_1: Level 3.1
+ * @GST_AV1_SEQ_LEVEL_3_2: Level 3.2
+ * @GST_AV1_SEQ_LEVEL_3_3: Level 3.3
+ * @GST_AV1_SEQ_LEVEL_4_0: Level 4.0
+ * @GST_AV1_SEQ_LEVEL_4_1: Level 4.1
+ * @GST_AV1_SEQ_LEVEL_4_2: Level 4.2
+ * @GST_AV1_SEQ_LEVEL_4_3: Level 4.3
+ * @GST_AV1_SEQ_LEVEL_5_0: Level 5.0
+ * @GST_AV1_SEQ_LEVEL_5_1: Level 5.1
+ * @GST_AV1_SEQ_LEVEL_5_2: Level 5.2
+ * @GST_AV1_SEQ_LEVEL_5_3: Level 5.3
+ * @GST_AV1_SEQ_LEVEL_6_0: Level 6.0
+ * @GST_AV1_SEQ_LEVEL_6_1: Level 6.1
+ * @GST_AV1_SEQ_LEVEL_6_2: Level 6.2
+ * @GST_AV1_SEQ_LEVEL_6_3: Level 6.3
+ * @GST_AV1_SEQ_LEVEL_7_0: Level 7.0
+ * @GST_AV1_SEQ_LEVEL_7_1: Level 7.1
+ * @GST_AV1_SEQ_LEVEL_7_2: Level 7.2
+ * @GST_AV1_SEQ_LEVEL_7_3: Level 7.3
+ * @GST_AV1_SEQ_LEVELS: all valid levels
+ * @GST_AV1_SEQ_LEVEL_MAX: Maximum parameters
+ *
+ * Defines all the possible OBU types
+ */
+typedef enum {
+ GST_AV1_SEQ_LEVEL_2_0 = 0,
+ GST_AV1_SEQ_LEVEL_2_1 = 1,
+ GST_AV1_SEQ_LEVEL_2_2 = 2,
+ GST_AV1_SEQ_LEVEL_2_3 = 3,
+ GST_AV1_SEQ_LEVEL_3_0 = 4,
+ GST_AV1_SEQ_LEVEL_3_1 = 5,
+ GST_AV1_SEQ_LEVEL_3_2 = 6,
+ GST_AV1_SEQ_LEVEL_3_3 = 7,
+ GST_AV1_SEQ_LEVEL_4_0 = 8,
+ GST_AV1_SEQ_LEVEL_4_1 = 9,
+ GST_AV1_SEQ_LEVEL_4_2 = 10,
+ GST_AV1_SEQ_LEVEL_4_3 = 11,
+ GST_AV1_SEQ_LEVEL_5_0 = 12,
+ GST_AV1_SEQ_LEVEL_5_1 = 13,
+ GST_AV1_SEQ_LEVEL_5_2 = 14,
+ GST_AV1_SEQ_LEVEL_5_3 = 15,
+ GST_AV1_SEQ_LEVEL_6_0 = 16,
+ GST_AV1_SEQ_LEVEL_6_1 = 17,
+ GST_AV1_SEQ_LEVEL_6_2 = 18,
+ GST_AV1_SEQ_LEVEL_6_3 = 19,
+ GST_AV1_SEQ_LEVEL_7_0 = 20,
+ GST_AV1_SEQ_LEVEL_7_1 = 21,
+ GST_AV1_SEQ_LEVEL_7_2 = 22,
+ GST_AV1_SEQ_LEVEL_7_3 = 23,
+ GST_AV1_SEQ_LEVELS,
+ GST_AV1_SEQ_LEVEL_MAX = 31
+} GstAV1SeqLevels;
+
+/**
+ * GstAV1MetadataType:
+ * @GST_AV1_METADATA_TYPE_RESERVED_0: Reserved 0
+ * @GST_AV1_METADATA_TYPE_HDR_CLL: Metadata high dynamic range content
+ * light level semantics
+ * @GST_AV1_METADATA_TYPE_HDR_MDCV: Metadata high dynamic range mastering
+ * display color volume semantics
+ * @GST_AV1_METADATA_TYPE_SCALABILITY: Metadata scalability semantics
+ * @GST_AV1_METADATA_TYPE_ITUT_T35: Metadata ITUT T35 semantics
+ * @GST_AV1_METADATA_TYPE_TIMECODE: Timecode semantics
+ */
+typedef enum {
+ GST_AV1_METADATA_TYPE_RESERVED_0 = 0,
+ GST_AV1_METADATA_TYPE_HDR_CLL = 1,
+ GST_AV1_METADATA_TYPE_HDR_MDCV = 2,
+ GST_AV1_METADATA_TYPE_SCALABILITY = 3,
+ GST_AV1_METADATA_TYPE_ITUT_T35 = 4,
+ GST_AV1_METADATA_TYPE_TIMECODE = 5,
+} GstAV1MetadataType;
+
+/**
+ * GstAV1ScalabilityModes:
+ * @GST_AV1_SCALABILITY_L1T2: 1 spatial layer, 2 temporal layers
+ * @GST_AV1_SCALABILITY_L1T3: 1 spatial layer, 3 temporal layers
+ * @GST_AV1_SCALABILITY_L2T1: 2 spatial layer (ratio 2:1), 1 temporal layer,
+ * inter-layer dependency
+ * @GST_AV1_SCALABILITY_L2T2: 2 spatial layer (ratio 2:1), 2 temporal layer,
+ * inter-layer dependency
+ * @GST_AV1_SCALABILITY_L2T3: 2 spatial layer (ratio 2:1), 3 temporal layer,
+ * inter-layer dependency
+ * @GST_AV1_SCALABILITY_S2T1: 2 spatial layer (ratio 2:1), 1 temporal layer
+ * @GST_AV1_SCALABILITY_S2T2: 2 spatial layer (ratio 2:1), 2 temporal layer
+ * @GST_AV1_SCALABILITY_S2T3: 2 spatial layer (ratio 2:1), 3 temporal layer
+ * @GST_AV1_SCALABILITY_L2T1h: 2 spatial layer (ratio 1.5:1), 1 temporal layer,
+ * inter-layer dependency
+ * @GST_AV1_SCALABILITY_L2T2h: 2 spatial layer (ratio 1.5:1), 2 temporal layer,
+ * inter-layer dependency
+ * @GST_AV1_SCALABILITY_L2T3h: 2 spatial layer (ratio 1.5:1), 3 temporal layer,
+ * inter-layer dependency
+ * @GST_AV1_SCALABILITY_S2T1h: 2 spatial layer (ratio 1.5:1), 1 temporal layer
+ * @GST_AV1_SCALABILITY_S2T2h: 2 spatial layer (ratio 1.5:1), 2 temporal layer
+ * @GST_AV1_SCALABILITY_S2T3h: 2 spatial layer (ratio 1.5:1), 3 temporal layer
+ * @GST_AV1_SCALABILITY_SS: Use scalability structure #GstAV1MetadataScalability
+ */
+typedef enum {
+ GST_AV1_SCALABILITY_L1T2 = 0,
+ GST_AV1_SCALABILITY_L1T3 = 1,
+ GST_AV1_SCALABILITY_L2T1 = 2,
+ GST_AV1_SCALABILITY_L2T2 = 3,
+ GST_AV1_SCALABILITY_L2T3 = 4,
+ GST_AV1_SCALABILITY_S2T1 = 5,
+ GST_AV1_SCALABILITY_S2T2 = 6,
+ GST_AV1_SCALABILITY_S2T3 = 7,
+ GST_AV1_SCALABILITY_L2T1h = 8,
+ GST_AV1_SCALABILITY_L2T2h = 9,
+ GST_AV1_SCALABILITY_L2T3h = 10,
+ GST_AV1_SCALABILITY_S2T1h = 11,
+ GST_AV1_SCALABILITY_S2T2h = 12,
+ GST_AV1_SCALABILITY_S2T3h = 13,
+ GST_AV1_SCALABILITY_SS = 14,
+} GstAV1ScalabilityModes;
+
+/**
+ * GstAV1ColorPrimaries:
+ * @GST_AV1_CP_BT_709: BT.709
+ * @GST_AV1_CP_UNSPECIFIED: Unspecified
+ * @GST_AV1_CP_BT_470_M: BT.470 System M (historical)
+ * @GST_AV1_CP_BT_470_B_G:BT.470 System B, G (historical),
+ * @GST_AV1_CP_BT_601: BT.601
+ * @GST_AV1_CP_SMPTE_240: SMPTE 240
+ * @GST_AV1_CP_GENERIC_FILM: Generic film (color filters using illuminant C,
+ * @GST_AV1_CP_BT_2020: BT.2020, BT.2100,
+ * @GST_AV1_CP_XYZ: SMPTE 428 (CIE 1921 XYZ),
+ * @GST_AV1_CP_SMPTE_431: SMPTE RP 431-2
+ * @GST_AV1_CP_SMPTE_432: SMPTE EG 432-1
+ * @GST_AV1_CP_EBU_3213: EBU Tech. 3213-E
+ */
+typedef enum {
+ GST_AV1_CP_BT_709 = 1,
+ GST_AV1_CP_UNSPECIFIED = 2,
+ GST_AV1_CP_BT_470_M = 4,
+ GST_AV1_CP_BT_470_B_G = 5,
+ GST_AV1_CP_BT_601 = 6,
+ GST_AV1_CP_SMPTE_240 = 7,
+ GST_AV1_CP_GENERIC_FILM = 8,
+ GST_AV1_CP_BT_2020 = 9,
+ GST_AV1_CP_XYZ = 10,
+ GST_AV1_CP_SMPTE_431 = 11,
+ GST_AV1_CP_SMPTE_432 = 12,
+ GST_AV1_CP_EBU_3213 = 22,
+} GstAV1ColorPrimaries;
+
+/**
+ * GstAV1TransferCharacteristics:
+ * @GST_AV1_TC_RESERVED_0: For future use
+ * @GST_AV1_TC_BT_709: BT.709
+ * @GST_AV1_TC_UNSPECIFIED: Unspecified
+ * @GST_AV1_TC_RESERVED_3: For future use
+ * @GST_AV1_TC_BT_470_M: BT.470 System M (historical)
+ * @GST_AV1_TC_BT_470_B_G: BT.470 System B, G (historical)
+ * @GST_AV1_TC_BT_601: BT.601
+ * @GST_AV1_TC_SMPTE_240: SMPTE 240 M
+ * @GST_AV1_TC_LINEAR: Linear
+ * @GST_AV1_TC_LOG_100: Logarithmic (100 : 1 range)
+ * @GST_AV1_TC_LOG_100_SQRT10: Logarithmic (100 * Sqrt(10) : 1 range)
+ * @GST_AV1_TC_IEC_61966: IEC 61966-2-4
+ * @GST_AV1_TC_BT_1361: BT.1361
+ * @GST_AV1_TC_SRGB: sRGB or sYCC
+ * @GST_AV1_TC_BT_2020_10_BIT: BT.2020 10-bit systems
+ * @GST_AV1_TC_BT_2020_12_BIT: BT.2020 12-bit systems
+ * @GST_AV1_TC_SMPTE_2084: SMPTE ST 2084, ITU BT.2100 PQ
+ * @GST_AV1_TC_SMPTE_428: SMPTE ST 428
+ * @GST_AV1_TC_HLG: BT.2100 HLG, ARIB STD-B67
+ */
+typedef enum {
+ GST_AV1_TC_RESERVED_0 = 0,
+ GST_AV1_TC_BT_709 = 1,
+ GST_AV1_TC_UNSPECIFIED = 2,
+ GST_AV1_TC_RESERVED_3 = 3,
+ GST_AV1_TC_BT_470_M = 4,
+ GST_AV1_TC_BT_470_B_G = 5,
+ GST_AV1_TC_BT_601 = 6,
+ GST_AV1_TC_SMPTE_240 = 7,
+ GST_AV1_TC_LINEAR = 8,
+ GST_AV1_TC_LOG_100 = 9,
+ GST_AV1_TC_LOG_100_SQRT10 = 10,
+ GST_AV1_TC_IEC_61966 = 11,
+ GST_AV1_TC_BT_1361 = 12,
+ GST_AV1_TC_SRGB = 13,
+ GST_AV1_TC_BT_2020_10_BIT = 14,
+ GST_AV1_TC_BT_2020_12_BIT = 15,
+ GST_AV1_TC_SMPTE_2084 = 16,
+ GST_AV1_TC_SMPTE_428 = 17,
+ GST_AV1_TC_HLG = 18,
+} GstAV1TransferCharacteristics;
+
+/**
+ * GstAV1MatrixCoefficients:
+ * @GST_AV1_MC_IDENTITY: Identity matrix
+ * @GST_AV1_MC_BT_709: BT.709
+ * @GST_AV1_MC_UNSPECIFIED: Unspecified
+ * @GST_AV1_MC_RESERVED_3: For future use
+ * @GST_AV1_MC_FCC: US FCC 73.628
+ * @GST_AV1_MC_BT_470_B_G: BT.470 System B, G (historical)
+ * @GST_AV1_MC_BT_601: BT.601
+ * @GST_AV1_MC_SMPTE_240: SMPTE 240 M
+ * @GST_AV1_MC_SMPTE_YCGCO: YCgCo
+ * @GST_AV1_MC_BT_2020_NCL: BT.2020 non-constant luminance, BT.2100 YCbCr
+ * @GST_AV1_MC_BT_2020_CL: BT.2020 constant luminance
+ * @GST_AV1_MC_SMPTE_2085: SMPTE ST 2085 YDzDx
+ * @GST_AV1_MC_CHROMAT_NCL: Chromaticity-derived non-constant luminance
+ * @GST_AV1_MC_CHROMAT_CL: Chromaticity-derived constant luminancw
+ * @GST_AV1_MC_ICTCP: BT.2100 ICtCp
+ */
+typedef enum {
+ GST_AV1_MC_IDENTITY = 0,
+ GST_AV1_MC_BT_709 = 1,
+ GST_AV1_MC_UNSPECIFIED = 2,
+ GST_AV1_MC_RESERVED_3 = 3,
+ GST_AV1_MC_FCC = 4,
+ GST_AV1_MC_BT_470_B_G = 5,
+ GST_AV1_MC_BT_601 = 6,
+ GST_AV1_MC_SMPTE_240 = 7,
+ GST_AV1_MC_SMPTE_YCGCO = 8,
+ GST_AV1_MC_BT_2020_NCL = 9,
+ GST_AV1_MC_BT_2020_CL = 10,
+ GST_AV1_MC_SMPTE_2085 = 11,
+ GST_AV1_MC_CHROMAT_NCL = 12,
+ GST_AV1_MC_CHROMAT_CL = 13,
+ GST_AV1_MC_ICTCP = 14,
+} GstAV1MatrixCoefficients;
+
+/**
+ * GstAV1ChromaSamplePositions:
+ * @GST_AV1_CSP_UNKNOWN: Unknown (in this case the source video transfer
+ * function must be signaled outside the AV1 bitstream).
+ * @GST_AV1_CSP_VERTICAL: Horizontally co-located with (0, 0) luma sample,
+ * vertical position in the middle between two luma samples.
+ * @GST_AV1_CSP_COLOCATED: co-located with (0, 0) luma sample.
+ * @GST_AV1_CSP_RESERVED: For future use.
+ */
+typedef enum {
+ GST_AV1_CSP_UNKNOWN = 0,
+ GST_AV1_CSP_VERTICAL = 1,
+ GST_AV1_CSP_COLOCATED = 2,
+ GST_AV1_CSP_RESERVED = 3,
+} GstAV1ChromaSamplePositions;
+
+/**
+ * GstAV1FrameType:
+ * @GST_AV1_KEY_FRAME: Key Frame
+ * @GST_AV1_INTER_FRAME: InterFrame
+ * @GST_AV1_INTRA_ONLY_FRAME: Intra-Only Frame
+ * @GST_AV1_SWITCH_FRAME: Switch Frame
+ */
+typedef enum {
+ GST_AV1_KEY_FRAME = 0,
+ GST_AV1_INTER_FRAME = 1,
+ GST_AV1_INTRA_ONLY_FRAME = 2,
+ GST_AV1_SWITCH_FRAME = 3,
+} GstAV1FrameType;
+
+/**
+ * GstAV1InterpolationFilter:
+ * @GST_AV1_INTERPOLATION_FILTER_EIGHTTAP: Eighttap
+ * @GST_AV1_INTERPOLATION_FILTER_EIGHTTAP_SMOOTH: Eighttap Smooth
+ * @GST_AV1_INTERPOLATION_FILTER_EIGHTTAP_SHARP: Eighttap Sharp
+ * @GST_AV1_INTERPOLATION_FILTER_BILINEAR: Bilinear
+ * @GST_AV1_INTERPOLATION_FILTER_SWITCHABLE: Filter is swichtable
+ */
+typedef enum {
+ GST_AV1_INTERPOLATION_FILTER_EIGHTTAP = 0,
+ GST_AV1_INTERPOLATION_FILTER_EIGHTTAP_SMOOTH = 1,
+ GST_AV1_INTERPOLATION_FILTER_EIGHTTAP_SHARP = 2,
+ GST_AV1_INTERPOLATION_FILTER_BILINEAR = 3,
+ GST_AV1_INTERPOLATION_FILTER_SWITCHABLE = 4,
+} GstAV1InterpolationFilter;
+
+/**
+ * GstAV1TXModes:
+ * @GST_AV1_TX_MODE_ONLY_4x4: the inverse transform will use only 4x4 transforms.
+ * @GST_AV1_TX_MODE_LARGEST: the inverse transform will use the largest transform
+ * size that fits inside the block.
+ * @GST_AV1_TX_MODE_SELECT: the choice of transform size is specified explicitly
+ * for each block.
+ */
+typedef enum {
+ GST_AV1_TX_MODE_ONLY_4x4 = 0,
+ GST_AV1_TX_MODE_LARGEST = 1,
+ GST_AV1_TX_MODE_SELECT = 2,
+} GstAV1TXModes;
+
+/**
+ * GstAV1FrameRestorationType:
+ * @GST_AV1_FRAME_RESTORE_NONE: no filtering is applied
+ * @GST_AV1_FRAME_RESTORE_WIENER: Wiener filter process is invoked
+ * @GST_AV1_FRAME_RESTORE_SGRPROJ: self guided filter proces is invoked
+ * @GST_AV1_FRAME_RESTORE_SWITCHABLE: restoration filter is swichtable
+ */
+typedef enum {
+ GST_AV1_FRAME_RESTORE_NONE = 0,
+ GST_AV1_FRAME_RESTORE_WIENER = 1,
+ GST_AV1_FRAME_RESTORE_SGRPROJ = 2,
+ GST_AV1_FRAME_RESTORE_SWITCHABLE = 3,
+} GstAV1FrameRestorationType;
+
+/**
+ * GstAV1ReferenceFrame:
+ * @GST_AV1_REF_INTRA_FRAME: Intra Frame Reference
+ * @GST_AV1_REF_LAST_FRAME: Last Reference Frame
+ * @GST_AV1_REF_LAST2_FRAME: Last2 Reference Frame
+ * @GST_AV1_REF_LAST3_FRAME: Last3 Reference Frame
+ * @GST_AV1_REF_GOLDEN_FRAME: Golden Reference Frame
+ * @GST_AV1_REF_BWDREF_FRAME: BWD Reference Frame
+ * @GST_AV1_REF_ALTREF2_FRAME: Alternative2 Reference Frame
+ * @GST_AV1_REF_ALTREF_FRAME: Alternative Reference Frame
+ * @GST_AV1_NUM_REF_FRAMES: Total Reference Frame Number
+ */
+typedef enum {
+ GST_AV1_REF_INTRA_FRAME = 0,
+ GST_AV1_REF_LAST_FRAME = 1,
+ GST_AV1_REF_LAST2_FRAME = 2,
+ GST_AV1_REF_LAST3_FRAME = 3,
+ GST_AV1_REF_GOLDEN_FRAME = 4,
+ GST_AV1_REF_BWDREF_FRAME = 5,
+ GST_AV1_REF_ALTREF2_FRAME = 6,
+ GST_AV1_REF_ALTREF_FRAME = 7,
+ GST_AV1_NUM_REF_FRAMES
+} GstAV1ReferenceFrame;
+
+/**
+ * GstAV1WarpModelType:
+ * @GST_AV1_WARP_MODEL_IDENTITY: Warp model is just an identity transform
+ * @GST_AV1_WARP_MODEL_TRANSLATION: Warp model is a pure translation
+ * @GST_AV1_WARP_MODEL_ROTZOOM: Warp model is a rotation + symmetric zoom
+ * + translation
+ * @GST_AV1_WARP_MODEL_AFFINE: Warp model is a general affine transform
+ */
+typedef enum {
+ GST_AV1_WARP_MODEL_IDENTITY = 0,
+ GST_AV1_WARP_MODEL_TRANSLATION = 1,
+ GST_AV1_WARP_MODEL_ROTZOOM = 2,
+ GST_AV1_WARP_MODEL_AFFINE = 3,
+} GstAV1WarpModelType;
+
+/**
+ * GstAV1OBUHeader:
+ * @obu_type: the type of data structure contained in the OBU payload.
+ * @obu_extention_flag: indicates if OBU header extention is present.
+ * @obu_has_size_field: equal to 1 indicates that the obu_size syntax element will be
+ * present. @obu_has_size_field equal to 0 indicates that the @obu_size syntax element
+ * will not be present.
+ * @obu_temporal_id: specifies the temporal level of the data contained in the OBU.
+ * @obu_spatial_id: specifies the spatial level of the data contained in the OBU.
+ *
+ * Collect info for OBU header and OBU extension header if
+ * obu_extension_flag == 1.
+ */
+struct _GstAV1OBUHeader {
+ GstAV1OBUType obu_type;
+ gboolean obu_extention_flag;
+ gboolean obu_has_size_field;
+ guint8 obu_temporal_id;
+ guint8 obu_spatial_id;
+};
+
+/**
+ * GstAV1OBU:
+ * @header: a #GstAV1OBUHeader OBU Header
+ * @obu_type: the type of data structure contained in the OBU payload.
+ * @data: references the current data chunk that holds the OBU
+ * @obu_size: size of the OBU, not include header size
+ *
+ * It is the general representation of AV1 OBU (Open Bitstream
+ * Unit). One OBU include its header and payload.
+ */
+struct _GstAV1OBU {
+ GstAV1OBUHeader header;
+ GstAV1OBUType obu_type;
+ guint8 *data;
+ guint32 obu_size;
+};
+
+/**
+ * GstAV1OperatingPoint:
+ * @seq_level_idx: specifies the level that the coded video sequence conforms to.
+ * @seq_tier: specifies the tier that the coded video sequence conforms to.
+ * @idc: contains a bitmask that indicates which spatial and temporal layers should be
+ * decoded. Bit k is equal to 1 if temporal layer k should be decoded (for k between
+ * 0 and 7). Bit j+8 is equal to 1 if spatial layer j should be decoded (for j between
+ * 0 and 3).
+ * @decoder_model_present_for_this_op: equal to one indicates that there is a decoder model
+ * associated with this operating point. @decoder_model_present_for_this_op equal to zero
+ * indicates that there is not a decoder model associated.
+ * @decoder_buffer_delay: specifies the time interval between the arrival of the first bit
+ * in the smoothing buffer and the subsequent removal of the data that belongs to the
+ * first coded frame for operating point op, measured in units of 1/90000 seconds. The
+ * length of @decoder_buffer_delay is specified by @buffer_delay_length_minus_1 + 1, in bits.
+ * @encoder_buffer_delay: specifies, in combination with @decoder_buffer_delay syntax element,
+ * the first bit arrival time of frames to be decoded to the smoothing buffer.
+ * @encoder_buffer_delay is measured in units of 1/90000 seconds. For a video sequence that
+ * includes one or more random access points the sum of @decoder_buffer_delay and
+ * @encoder_buffer_delay shall be kept constant.
+ * @low_delay_mode_flag: equal to 1 indicates that the smoothing buffer operates in low-delay
+ * mode for operating point op. In low-delay mode late decode times and buffer underflow
+ * are both permitted. @low_delay_mode_flag equal to 0 indicates that the smoothing buffer
+ * operates in strict mode, where buffer underflow is not allowed.
+ * @initial_display_delay_present_for_this_op: equal to 1 indicates that
+ * @initial_display_delay_minus_1 is specified for this operating. 0 indicates that
+ * @initial_display_delay_minus_1 is not specified for this operating point.
+ * @initial_display_delay_minus_1: plus 1 specifies, for operating point i, the number of
+ * decoded frames that should be present in the buffer pool before the first presentable
+ * frame is displayed. This will ensure that all presentable frames in the sequence can
+ * be decoded at or before the time that they are scheduled for display.
+ */
+struct _GstAV1OperatingPoint {
+ guint8 seq_level_idx;
+ guint8 seq_tier;
+ guint16 idc;
+ gboolean decoder_model_present_for_this_op;
+ guint8 decoder_buffer_delay;
+ guint8 encoder_buffer_delay;
+ gboolean low_delay_mode_flag;
+ gboolean initial_display_delay_present_for_this_op;
+ guint8 initial_display_delay_minus_1;
+};
+
+/**
+ * GstAV1DecoderModelInfo:
+ * @buffer_delay_length_minus_1: plus 1 specifies the length of the
+ * @decoder_buffer_delay and the @encoder_buffer_delay syntax elements,
+ * in bits.
+ * @num_units_in_decoding_tick: is the number of time units of a decoding clock
+ * operating at the frequency @time_scale Hz that corresponds to one increment
+ * of a clock tick counter.
+ * @buffer_removal_time_length_minus_1: plus 1 specifies the length of the
+ * @buffer_removal_time syntax element, in bits.
+ * @frame_presentation_time_length_minus_1: plus 1 specifies the length of the
+ * @frame_presentation_time syntax element, in bits.
+ */
+struct _GstAV1DecoderModelInfo {
+ guint8 buffer_delay_length_minus_1;
+ guint32 num_units_in_decoding_tick;
+ guint8 buffer_removal_time_length_minus_1;
+ guint8 frame_presentation_time_length_minus_1;
+};
+
+/**
+ * GstAV1TimingInfo:
+ * @num_units_in_display_tick: is the number of time units of a clock operating at the
+ * frequency @time_scale Hz that corresponds to one increment of a clock tick counter.
+ * A clock tick, in seconds, is equal to num_units_in_display_tick divided by time_scale.
+ * It is a requirement of bitstream conformance that num_units_in_display_tick is greater
+ * than 0.
+ * @time_scale: is the number of time units that pass in one second. It is a requirement of
+ * bitstream conformance that @time_scale is greater than 0.
+ * @equal_picture_interval: equal to 1 indicates that pictures should be displayed according
+ * to their output order with the number of ticks between two consecutive pictures (without
+ * dropping frames) specified by @num_ticks_per_picture_minus_1 + 1. @equal_picture_interval
+ * equal to 0 indicates that the interval between two consecutive pictures is not specified.
+ * @num_ticks_per_picture_minus_1: plus 1 specifies the number of clock ticks corresponding
+ * to output time between two consecutive pictures in the output order. It is a requirement
+ * of bitstream conformance that the value of @num_ticks_per_picture_minus_1 shall be in the
+ * range of 0 to (1 << 32) - 2, inclusive.
+ */
+struct _GstAV1TimingInfo {
+ guint32 num_units_in_display_tick;
+ guint32 time_scale;
+ gboolean equal_picture_interval;
+ guint32 num_ticks_per_picture_minus_1;
+};
+
+/**
+ * GstAV1ColorConfig:
+ * @high_bitdepth: syntax element which, together with @seq_profile, determine the bit depth.
+ * @twelve_bit: is syntax elements which, together with @seq_profile and @high_bitdepth,
+ * determines the bit depth.
+ * @mono_chrome: equal to 1 indicates that the video does not contain U and V color planes.
+ * @mono_chrome equal to 0 indicates that the video contains Y, U, and V color planes.
+ * @color_description_present_flag: equal to 1 specifies that color_primaries,
+ * @transfer_characteristics, and @matrix_coefficients are present.
+ * @color_description_present_flag equal to 0 specifies that @color_primaries,
+ * @transfer_characteristics and @matrix_coefficients are not present.
+ * @color_primaries: is an integer that is defined by the "Color primaries" section of
+ * ISO/IEC 23091-4/ITU-T H.273.
+ * @transfer_characteristics: is an integer that is defined by the "Transfer characteristics"
+ * section of ISO/IEC 23091-4/ITU-T H.273.
+ * @matrix_coefficients: is an integer that is defined by the "Matrix coefficients" section
+ * of ISO/IEC 23091-4/ITU-T H.273.
+ * @color_range: is a binary value that is associated with the VideoFullRangeFlag variable
+ * specified in ISO/IEC 23091-4/ITU-T H.273. color range equal to 0 shall be referred to
+ * as the studio swing representation and color range equal to 1 shall be referred to as
+ * the full swing representation for all intents relating to this specification.
+ * @subsampling_x, @subsampling_y: specify the chroma subsampling format. If
+ * @matrix_coefficients is equal to GST_AV1_MC_IDENTITY, it is a requirement of bitstream
+ * conformance that @subsampling_x is equal to 0 and @subsampling_y is equal to 0.
+ * @chroma_sample_position specifies the sample position for subsampled streams:
+ * @separate_uv_delta_q: equal to 1 indicates that the U and V planes may have separate
+ * delta quantizer values. @separate_uv_delta_q equal to 0 indicates that the U and V
+ * planes will share the same delta quantizer value.
+ */
+struct _GstAV1ColorConfig {
+ gboolean high_bitdepth;
+ gboolean twelve_bit;
+ gboolean mono_chrome;
+ gboolean color_description_present_flag;
+ GstAV1ColorPrimaries color_primaries;
+ GstAV1TransferCharacteristics transfer_characteristics;
+ GstAV1MatrixCoefficients matrix_coefficients;
+ gboolean color_range;
+ guint8 subsampling_x;
+ guint8 subsampling_y;
+ GstAV1ChromaSamplePositions chroma_sample_position;
+ gboolean separate_uv_delta_q;
+};
+
+/**
+ * GstAV1SequenceHeaderOBU:
+ * @seq_profile: specifies the features that can be used in the coded video sequence
+ * @still_picture: equal to 1 specifies that the bitstream contains only one coded frame.
+ * @reduced_still_picture_header: specifies that the syntax elements not needed by a still
+ * picture are omitted.
+ * @frame_width_bits_minus_1: specifies the number of bits minus 1 used for transmitting
+ * the frame width syntax elements.
+ * @frame_height_bits_minus_1: specifies the number of bits minus 1 used for transmitting
+ * the frame height syntax elements.
+ * @max_frame_width_minus_1: specifies the maximum frame width minus 1 for the frames
+ * represented by this sequenceheader.
+ * @max_frame_height_minus_1: specifies the maximum frame height minus 1 for the frames
+ * represented by this sequenceheader.
+ * @frame_id_numbers_present_flag: specifies whether frame id numbers are present in the bitstream.
+ * @delta_frame_id_length_minus_2: specifies the number of bits minus 2 used to encode
+ * delta_frame_id syntax elements.
+ * @additional_frame_id_length_minus_1: is used to calculate the number of bits used to
+ * encode the frame_id syntax element.
+ * @use_128x128_superblock: when equal to 1, indicates that superblocks contain 128x128 luma
+ * samples. When equal to 0, it indicates that superblocks contain 64x64 luma samples.
+ * (The number of contained chroma samples depends on @subsampling_x and @subsampling_y).
+ * @enable_filter_intra: equal to 1 specifies that the @use_filter_intra syntax element may
+ * be present. @enable_filter_intra equal to 0 specifies that the @use_filter_intra syntax
+ * element will not be present.
+ * @enable_intra_edge_filter: specifies whether the intra edge filtering process should be enabled.
+ * @enable_interintra_compound: equal to 1 specifies that the mode info for inter blocks may
+ * contain the syntax element interintra. @enable_interintra_compound equal to 0 specifies
+ * that the syntax element interintra will not be present.
+ * @enable_masked_compound: equal to 1 specifies that the mode info for inter blocks may
+ * contain the syntax element @compound_type. @enable_masked_compound equal to 0 specifies
+ * that the syntax element @compound_type will not be present.
+ * @enable_warped_motion: equal to 1 indicates that the allow_warped_motion syntax element
+ * may be present. @enable_warped_motion equal to 0 indicates that the @allow_warped_motion
+ * syntax element will not be present.
+ * @enable_order_hint: equal to 1 indicates that tools based on the values of order hints
+ * may be used. @enable_order_hint equal to 0 indicates that tools based on order hints
+ * are disabled.
+ * @enable_dual_filter: equal to 1 indicates that the inter prediction filter type may be
+ * specified independently in the horizontal and vertical directions. If the flag is equal
+ * to 0, only one filter type may be specified, which is then used in both directions.
+ * @enable_jnt_comp: equal to 1 indicates that the distance weights process may be used
+ * for inter prediction.
+ * @enable_ref_frame_mvs: equal to 1 indicates that the @use_ref_frame_mvs syntax element
+ * may be present. @enable_ref_frame_mvs equal to 0 indicates that the @use_ref_frame_mvs
+ * syntax element will not be present.
+ * @seq_choose_screen_content_tools: equal to 0 indicates that the @seq_force_screen_content_tools
+ * syntax element will be present. @seq_choose_screen_content_tools equal to 1 indicates
+ * that @seq_force_screen_content_tools should be set equal to SELECT_SCREEN_CONTENT_TOOLS.
+ * @seq_force_screen_content_tools: equal to SELECT_SCREEN_CONTENT_TOOLS indicates that the
+ * @allow_screen_content_tools syntax element will be present in the frame header. Otherwise,
+ * @seq_force_screen_content_tools contains the value for @allow_screen_content_tools.
+ * @seq_choose_integer_mv: equal to 0 indicates that the seq_force_integer_mv syntax element
+ * will be present. @seq_choose_integer_mv equal to 1 indicates that @seq_force_integer_mv
+ * should be set equal to SELECT_INTEGER_MV.
+ * @seq_force_integer_mv: equal to SELECT_INTEGER_MV indicates that the @force_integer_mv
+ * syntax element will be present in the frame header (providing allow_screen_content_tools
+ * is equal to 1). Otherwise, @seq_force_integer_mv contains the value for @force_integer_mv.
+ * @order_hint_bits_minus_1: is used to compute OrderHintBits.
+ * @enable_superres: equal to 1 specifies that the use_superres syntax element will be present
+ * in the uncompressed header. enable_superres equal to 0 specifies that the use_superres
+ * syntax element will not be present (instead use_superres will be set to 0 in the
+ * uncompressed header without being read).
+ * @enable_cdef: equal to 1 specifies that cdef filtering may be enabled. enable_cdef equal
+ * to 0 specifies that cdef filtering is disabled.
+ * @enable_restoration: equal to 1 specifies that loop restoration filtering may be enabled.
+ * enable_restoration equal to 0 specifies that loop restoration filtering is disabled.
+ * @film_grain_params_present: specifies whether film grain parameters are present in the bitstream.
+ * @operating_points_cnt_minus_1: indicates the number of operating points minus 1 present
+ * in this bitstream.
+ * @operating_points: specifies the corresponding operating point for a set of operating
+ * parameters.
+ * @decoder_model_info_present_flag: specifies whether the decoder model info is present in
+ * the bitstream.
+ * @decoder_model_info: holds information about the decoder model.
+ * @initial_display_delay_present_flag: specifies whether initial display delay information
+ * is present in the bitstream or not.
+ * @timing_info_present_flag: specifies whether timing info is present in the bitstream.
+ * @timing_info: holds the timing information.
+ * @color_config: hold the color configuration.
+ * @order_hint_bits: specifies the number of bits used for the order_hint syntax element.
+ * @bit_depth: the bit depth of the stream.
+ * @num_planes: the YUV plane number.
+ */
+struct _GstAV1SequenceHeaderOBU {
+ GstAV1Profile seq_profile;
+ gboolean still_picture;
+ guint8 reduced_still_picture_header;
+
+ guint8 frame_width_bits_minus_1;
+ guint8 frame_height_bits_minus_1;
+ guint16 max_frame_width_minus_1;
+ guint16 max_frame_height_minus_1;
+
+ gboolean frame_id_numbers_present_flag;
+ guint8 delta_frame_id_length_minus_2;
+ guint8 additional_frame_id_length_minus_1;
+
+ gboolean use_128x128_superblock;
+ gboolean enable_filter_intra;
+ gboolean enable_intra_edge_filter;
+ gboolean enable_interintra_compound;
+ gboolean enable_masked_compound;
+ gboolean enable_warped_motion;
+ gboolean enable_order_hint;
+ gboolean enable_dual_filter;
+ gboolean enable_jnt_comp;
+ gboolean enable_ref_frame_mvs;
+ gboolean seq_choose_screen_content_tools;
+ guint8 seq_force_screen_content_tools;
+ gboolean seq_choose_integer_mv;
+ guint8 seq_force_integer_mv;
+ gint8 order_hint_bits_minus_1;
+
+ gboolean enable_superres;
+ gboolean enable_cdef;
+ gboolean enable_restoration;
+
+ guint8 film_grain_params_present;
+
+ guint8 operating_points_cnt_minus_1;
+ GstAV1OperatingPoint operating_points[GST_AV1_MAX_OPERATING_POINTS];
+
+ gboolean decoder_model_info_present_flag;
+ GstAV1DecoderModelInfo decoder_model_info;
+ guint8 initial_display_delay_present_flag;
+
+ gboolean timing_info_present_flag;
+ GstAV1TimingInfo timing_info;
+
+ GstAV1ColorConfig color_config;
+
+ /* Global var calculated by sequence */
+ guint8 order_hint_bits; /* OrderHintBits */
+ guint8 bit_depth; /* BitDepth */
+ guint8 num_planes; /* NumPlanes */
+};
+
+/**
+ * GstAV1MetadataITUT_T35:
+ * @itu_t_t35_country_code: shall be a byte having a value specified as a country code by
+ * Annex A of Recommendation ITU-T T.35.
+ * @itu_t_t35_country_code_extension_byte: shall be a byte having a value specified as a
+ * country code by Annex B of Recommendation ITU-T T.35.
+ * @itu_t_t35_payload_bytes: shall be bytes containing data registered as specified in
+ * Recommendation ITU-T T.35.
+ */
+struct _GstAV1MetadataITUT_T35 {
+ guint8 itu_t_t35_country_code;
+ guint8 itu_t_t35_country_code_extention_byte;
+ /* itu_t_t35_payload_bytes - not specified at this spec */
+ guint8 *itu_t_t35_payload_bytes;
+};
+
+/**
+ * GstAV1MetadataHdrCll:
+ * @max_cll: specifies the maximum content light level as specified in CEA-861.3, Appendix A.
+ * @max_fall: specifies the maximum frame-average light level as specified in CEA-861.3, Appendix A.
+ *
+ * High Dynamic Range content light level syntax metadata.
+ */
+struct _GstAV1MetadataHdrCll {
+ guint16 max_cll;
+ guint16 max_fall;
+};
+
+/**
+ * GstAV1MetadataHdrMdcv:
+ * @primary_chromaticity_x: specifies a 0.16 fixed-point X chromaticity coordinate as
+ * defined by CIE 1931, where i = 0,1,2 specifies Red, Green, Blue respectively.
+ * @primary_chromaticity_y: specifies a 0.16 fixed-point Y chromaticity coordinate as
+ * defined by CIE 1931, where i = 0,1,2 specifies Red, Green, Blue respectively.
+ * @white_point_chromaticity_x: specifies a 0.16 fixed-point white X chromaticity coordinate
+ * as defined by CIE 1931.
+ * @white_point_chromaticity_y: specifies a 0.16 fixed-point white Y chromaticity coordinate
+ * as defined by CIE 1931.
+ * @luminance_max: is a 24.8 fixed-point maximum luminance, represented in candelas per
+ * square meter.
+ * @luminance_min: is a 18.14 fixed-point minimum luminance, represented in candelas per
+ * square meter.
+ *
+ * High Dynamic Range mastering display color volume metadata.
+ */
+struct _GstAV1MetadataHdrMdcv {
+ guint16 primary_chromaticity_x[3];
+ guint16 primary_chromaticity_y[3];
+ guint16 white_point_chromaticity_x;
+ guint16 white_point_chromaticity_y;
+ guint32 luminance_max;
+ guint32 luminance_min;
+};
+
+/**
+ * GstAV1MetadataScalability:
+ * @scalability_mode_idc: indicates the picture prediction structure of the bitstream.
+ * @spatial_layers_cnt_minus_1: indicates the number of spatial layers present in the video
+ * sequence minus one.
+ * @spatial_layer_description_present_flag: indicates when set to 1 that the
+ * spatial_layer_ref_id is present for each of the (@spatial_layers_cnt_minus_1 + 1) layers,
+ * or that it is not present when set to 0.
+ * @spatial_layer_dimensions_present_flag: indicates when set to 1 that the
+ * @spatial_layer_max_width and @spatial_layer_max_height parameters are present for each of
+ * the (@spatial_layers_cnt_minus_1 + 1) layers, or that it they are not present when set to 0.
+ * @temporal_group_description_present_flag: indicates when set to 1 that the temporal
+ * dependency information is present, or that it is not when set to 0.
+ * @spatial_layer_max_width: specifies the maximum frame width for the frames with
+ * @spatial_id equal to i. This number must not be larger than @max_frame_width_minus_1 + 1.
+ * @spatial_layer_max_height: specifies the maximum frame height for the frames with
+ * @spatial_id equal to i. This number must not be larger than @max_frame_height_minus_1 + 1.
+ * @spatial_layer_ref_id: specifies the @spatial_id value of the frame within the current
+ * temporal unit that the frame of layer i uses for reference. If no frame within the
+ * current temporal unit is used for reference the value must be equal to 255.
+ * @temporal_group_size: indicates the number of pictures in a temporal picture group. If the
+ * @temporal_group_size is greater than 0, then the scalability structure data allows the
+ * inter-picture temporal dependency structure of the video sequence to be specified. If the
+ * @temporal_group_size is greater than 0, then for @temporal_group_size pictures in the
+ * temporal group, each picture's temporal layer id (@temporal_id), switch up points
+ * (@temporal_group_temporal_switching_up_point_flag and
+ * @temporal_group_spatial_switching_up_point_flag), and the reference picture indices
+ * (@temporal_group_ref_pic_diff) are specified. The first picture specified in a temporal
+ * group must have @temporal_id equal to 0. If the parameter @temporal_group_size is not
+ * present or set to 0, then either there is only one temporal layer or there is no fixed
+ * inter-picture temporal dependency present going forward in the video sequence. Note that
+ * for a given picture, all frames follow the same inter-picture temporal dependency
+ * structure. However, the frame rate of each layer can be different from each other. The
+ * specified dependency structure in the scalability structure data must be for the highest
+ * frame rate layer.
+ * @temporal_group_temporal_id: specifies the temporal_id value for the i-th picture in
+ * the temporal group.
+ * @temporal_group_temporal_switching_up_point_flag: is set to 1 if subsequent (in decoding
+ * order) pictures with a @temporal_id higher than @temporal_group_temporal_id[i] do not
+ * depend on any picture preceding the current picture (in coding order) with @temporal_id
+ * higher than @temporal_group_temporal_id[ i ].
+ * @temporal_group_spatial_switching_up_point_flag: is set to 1 if spatial layers of the
+ * current picture in the temporal group (i.e., pictures with a spatial_id higher than zero)
+ * do not depend on any picture preceding the current picture in the temporal group.
+ * @temporal_group_ref_cnt: indicates the number of reference pictures used by the i-th
+ * picture in the temporal group.
+ * @temporal_group_ref_pic_diff: indicates, for the i-th picture in the temporal group,
+ * the temporal distance between the i-th picture and the j-th reference picture used by
+ * the i-th picture. The temporal distance is measured in frames, counting only frames of
+ * identical @spatial_id values.
+ *
+ * The scalability metadata OBU is intended for use by intermediate
+ * processing entities that may perform selective layer elimination.
+ */
+struct _GstAV1MetadataScalability {
+ GstAV1ScalabilityModes scalability_mode_idc;
+ guint8 spatial_layers_cnt_minus_1;
+ gboolean spatial_layer_dimensions_present_flag;
+ gboolean spatial_layer_description_present_flag;
+ gboolean temporal_group_description_present_flag;
+ guint16 spatial_layer_max_width[GST_AV1_MAX_SPATIAL_LAYERS];
+ guint16 spatial_layer_max_height[GST_AV1_MAX_SPATIAL_LAYERS];
+ guint8 spatial_layer_ref_id[GST_AV1_MAX_SPATIAL_LAYERS];
+ guint8 temporal_group_size;
+
+ guint8 temporal_group_temporal_id[GST_AV1_MAX_TEMPORAL_GROUP_SIZE];
+ guint8 temporal_group_temporal_switching_up_point_flag[GST_AV1_MAX_TEMPORAL_GROUP_SIZE];
+ guint8 temporal_group_spatial_switching_up_point_flag[GST_AV1_MAX_TEMPORAL_GROUP_SIZE];
+ guint8 temporal_group_ref_cnt[GST_AV1_MAX_TEMPORAL_GROUP_SIZE];
+ guint8 temporal_group_ref_pic_diff[GST_AV1_MAX_TEMPORAL_GROUP_SIZE]
+ [GST_AV1_MAX_TEMPORAL_GROUP_REFERENCES];
+};
+
+/**
+ * GstAV1MetadataTimecode:
+ * @counting_type: specifies the method of dropping values of the n_frames syntax element as
+ * specified in AV1 Spec 6.1.1. @counting_type should be the same for all pictures in the
+ * coded video sequence.
+ * @full_timestamp_flag: equal to 1 indicates that the the @seconds_value, @minutes_value,
+ * @hours_value syntax elements will be present. @full_timestamp_flag equal to 0 indicates
+ * that there are flags to control the presence of these syntax elements.
+ * @discontinuity_flag: equal to 0 indicates that the difference between the current value
+ * of clockTimestamp and the value of clockTimestamp computed from the previous set of
+ * timestamp syntax elements in output order can be interpreted as the time difference
+ * between the times of origin or capture of the associated frames or fields.
+ * @discontinuity_flag equal to 1 indicates that the difference between the current value of
+ * clockTimestamp and the value of clockTimestamp computed from the previous set of clock
+ * timestamp syntax elements in output order should not be interpreted as the time difference
+ * between the times of origin or capture of the associated frames or fields.
+ * @cnt_dropped_flag: specifies the skipping of one or more values of @n_frames using the
+ * counting method specified by counting_type.
+ * @n_frames: is used to compute clockTimestamp. When @timing_info_present_flag is equal to 1,
+ * @n_frames shall be less than maxFps, where maxFps is specified by
+ * maxFps = ceil( time_scale / ( 2 * @num_units_in_display_tick ) ).
+ * @seconds_flag: equal to 1 specifies that @seconds_value and @minutes_flag are present when
+ * @full_timestamp_flag is equal to 0. @seconds_flag equal to 0 specifies that @seconds_value
+ * and @minutes_flag are not present.
+ * @seconds_value: is used to compute clockTimestamp and shall be in the range of 0 to 59.
+ * When @seconds_value is not present, its value is inferred to be equal to the value of
+ * @seconds_value for the previous set of clock timestamp syntax elements in decoding order,
+ * and it is required that such a previous @seconds_value shall have been present.
+ * @minutes_flag: equal to 1 specifies that @minutes_value and @hours_flag are present when
+ * @full_timestamp_flag is equal to 0 and @seconds_flag is equal to 1. @minutes_flag equal to 0
+ * specifies that @minutes_value and @hours_flag are not present.
+ * @minutes_value: specifies the value of mm used to compute clockTimestamp and shall be in
+ * the range of 0 to 59, inclusive. When minutes_value is not present, its value is inferred
+ * to be equal to the value of @minutes_value for the previous set of clock timestamp syntax
+ * elements in decoding order, and it is required that such a previous @minutes_value shall
+ * have been present.
+ * @hours_flag: equal to 1 specifies that @hours_value is present when @full_timestamp_flag is
+ * equal to 0 and @seconds_flag is equal to 1 and @minutes_flag is equal to 1.
+ * @hours_value: is used to compute clockTimestamp and shall be in the range of 0 to 23,
+ * inclusive. When @hours_value is not present, its value is inferred to be equal to the
+ * value of @hours_value for the previous set of clock timestamp syntax elements in decoding
+ * order, and it is required that such a previous @hours_value shall have been present.
+ * @time_offset_length: greater than 0 specifies the length in bits of the @time_offset_value
+ * syntax element. @time_offset_length equal to 0 specifies that the @time_offset_value syntax
+ * element is not present. @time_offset_length should be the same for all pictures in the
+ * coded video sequence.
+ * @time_offset_value: is used to compute clockTimestamp. The number of bits used to represent
+ * @time_offset_value is equal to @time_offset_length. When @time_offset_value is not present,
+ * its value is inferred to be equal to 0.
+ */
+struct _GstAV1MetadataTimecode {
+ guint8 counting_type; /* candidate for sperate Type GstAV1TimecodeCountingType */
+ gboolean full_timestamp_flag;
+ gboolean discontinuity_flag;
+ gboolean cnt_dropped_flag;
+ guint8 n_frames;
+ gboolean seconds_flag;
+ guint8 seconds_value;
+ gboolean minutes_flag;
+ guint8 minutes_value;
+ gboolean hours_flag;
+ guint8 hours_value;
+ guint8 time_offset_length;
+ guint32 time_offset_value;
+};
+
+/**
+ * GstAV1MetadataOBU:
+ * @metadata_type: type of metadata
+ * @itut_t35: ITUT T35 metadata
+ * @hdrcll: high dynamic range content light level metadata
+ * @hdrcmdcv: high dynamic range mastering display color volume metadata_type
+ * @scalability: Scalability metadata
+ * @timecode: Timecode metadata
+ */
+struct _GstAV1MetadataOBU {
+ GstAV1MetadataType metadata_type;
+ union {
+ GstAV1MetadataITUT_T35 itut_t35;
+ GstAV1MetadataHdrCll hdr_cll;
+ GstAV1MetadataHdrMdcv hdr_mdcv;
+ GstAV1MetadataScalability scalability;
+ GstAV1MetadataTimecode timecode;
+ };
+};
+
+/**
+ * GstAV1LoopFilterParams:
+ * @loop_filter_level: is an array containing loop filter strength values. Different loop
+ * filter strength values from the array are used depending on the image plane being
+ * filtered, and the edge direction (vertical or horizontal) being filtered.
+ * @loop_filter_sharpness: indicates the sharpness level. The @loop_filter_level and
+ * @loop_filter_sharpness together determine when a block edge is filtered, and by how much
+ * the filtering can change the sample values. The loop filter process is described in AV1
+ * Bitstream Spec. section 7.14.
+ * @loop_filter_delta_enabled: equal to 1 means that the filter level depends on the mode and
+ * reference frame used to predict a block. @loop_filter_delta_enabled equal to 0 means that
+ * the filter level does not depend on the mode and reference frame.
+ * @loop_filter_delta_update: equal to 1 means that the bitstream contains additional syntax
+ * elements that specify which mode and reference frame deltas are to be updated.
+ * @loop_filter_delta_update equal to 0 means that these syntax elements are not present.
+ * @loop_filter_ref_deltas: contains the adjustment needed for the filter level based on
+ * the chosen reference frame. If this syntax element is not present in the bitstream,
+ * it maintains its previous value.
+ * @loop_filter_mode_deltas: contains the adjustment needed for the filter level based on
+ * the chosen mode. If this syntax element is not present in the bitstream, it maintains
+ * its previous value.
+ * @delta_lf_present: specifies whether loop filter delta values are present in the bitstream.
+ * @delta_lf_res: specifies the left shift which should be applied to decoded loop filter
+ * delta values.
+ * @delta_lf_multi: equal to 1 specifies that separate loop filter deltas are sent for
+ * horizontal luma edges, vertical luma edges, the U edges, and the V edges. @delta_lf_multi
+ * equal to 0 specifies that the same loop filter delta is used for all edges.
+ */
+struct _GstAV1LoopFilterParams {
+ guint8 loop_filter_level[4];
+ guint8 loop_filter_sharpness;
+ gboolean loop_filter_delta_enabled;
+ gboolean loop_filter_delta_update;
+
+ gint8 loop_filter_ref_deltas[GST_AV1_TOTAL_REFS_PER_FRAME];
+ gint8 loop_filter_mode_deltas[2];
+
+ gboolean delta_lf_present;
+ guint8 delta_lf_res;
+ guint8 delta_lf_multi;
+};
+
+/**
+ * GstAV1QuantizationParams:
+ * @base_q_idx: indicates the base frame qindex. This is used for Y AC coefficients and as
+ * the base value for the other quantizers.
+ * @diff_uv_delta: equal to 1 indicates that the U and V delta quantizer values are coded
+ * separately. @diff_uv_delta equal to 0 indicates that the U and V delta quantizer values
+ * share a common value.
+ * @using_qmatrix: specifies that the quantizer matrix will be used to compute quantizers.
+ * @qm_y: specifies the level in the quantizer matrix that should be used for luma plane decoding.
+ * @qm_u: specifies the level in the quantizer matrix that should be used for chroma U plane decoding.
+ * @qm_v: specifies the level in the quantizer matrix that should be used for chroma V plane decoding.
+ * @delta_q_present: specifies whether quantizer index delta values are present in the bitstream.
+ * @delta_q_res: specifies the left shift which should be applied to decoded quantizer index
+ * delta values.
+ * @delta_q_y_dc: indicates the Y DC quantizer relative to base_q_idx.
+ * @delta_q_u_dc: indicates the U DC quantizer relative to base_q_idx.
+ * @delta_q_u_ac: indicates the U AC quantizer relative to base_q_idx.
+ * @delta_q_v_dc: indicates the V DC quantizer relative to base_q_idx.
+ * @delta_q_v_ac: indicates the V AC quantizer relative to base_q_idx.
+ */
+struct _GstAV1QuantizationParams {
+ guint8 base_q_idx;
+ gboolean diff_uv_delta;
+ gboolean using_qmatrix;
+ guint8 qm_y;
+ guint8 qm_u;
+ guint8 qm_v;
+
+ gboolean delta_q_present;
+ guint8 delta_q_res;
+
+ gint8 delta_q_y_dc; /* DeltaQYDc */
+ gint8 delta_q_u_dc; /* DeltaQUDc */
+ gint8 delta_q_u_ac; /* DeltaQUAc */
+ gint8 delta_q_v_dc; /* DeltaQVDc */
+ gint8 delta_q_v_ac; /* DeltaQVAc */
+};
+
+/**
+ * GstAV1SegmenationParams:
+ * @segmentation_enabled: equal to 1 indicates that this frame makes use of the segmentation
+ * tool; @segmentation_enabled equal to 0 indicates that the frame does not use segmentation.
+ * @segmentation_update_map: equal to 1 indicates that the segmentation map are updated during
+ * the decoding of this frame. @segmentation_update_map equal to 0 means that the segmentation
+ * map from the previous frame is used.
+ * @segmentation_temporal_update: equal to 1 indicates that the updates to the segmentation map
+ * are coded relative to the existing segmentation map. @segmentation_temporal_update equal to
+ * 0 indicates that the new segmentation map is coded without reference to the existing
+ * segmentation map.
+ * @segmentation_update_data: equal to 1 indicates that new parameters are about to be
+ * specified for each segment. @segmentation_update_data equal to 0 indicates that the
+ * segmentation parameters should keep their existing values.
+ * @feature_enabled: set to 1 when the feature of segmentation is enabled.
+ * @feature_data: the value of according segmentation feature.
+ * @seg_id_pre_skip: equal to 1 indicates that the segment id will be read before the skip
+ * syntax element. @seg_id_pre_skip equal to 0 indicates that the skip syntax element will be
+ * read first.
+ * @last_active_seg_id: indicates the highest numbered segment id that has some enabled feature.
+ * This is used when decoding the segment id to only decode choices corresponding to used
+ * segments.
+ */
+struct _GstAV1SegmenationParams {
+ gboolean segmentation_enabled;
+ guint8 segmentation_update_map;
+ guint8 segmentation_temporal_update;
+ guint8 segmentation_update_data;
+
+ gint8 feature_enabled[GST_AV1_MAX_SEGMENTS][GST_AV1_SEG_LVL_MAX]; /* FeatureEnabled */
+ gint16 feature_data[GST_AV1_MAX_SEGMENTS][GST_AV1_SEG_LVL_MAX]; /* FeatureData */
+ guint8 seg_id_pre_skip; /* SegIdPreSkip */
+ guint8 last_active_seg_id; /* LastActiveSegId */
+};
+
+/**
+ * GstAV1TileInfo:
+ * @uniform_tile_spacing_flag: equal to 1 means that the tiles are uniformly spaced across the
+ * frame. (In other words, all tiles are the same size except for the ones at the right and
+ * bottom edge which can be smaller.) @uniform_tile_spacing_flag equal to 0 means that the
+ * tile sizes are coded.
+ * @increment_tile_rows_log2: is used to compute @tile_rows_log2.
+ * @width_in_sbs_minus_1: specifies the width of a tile minus 1 in units of superblocks.
+ * @height_in_sbs_minus_1: specifies the height of a tile minus 1 in units of superblocks.
+ * @tile_size_bytes_minus_1: is used to compute @tile_size_bytes
+ * @context_update_tile_id: specifies which tile to use for the CDF update.
+ * @mi_col_starts: is an array specifying the start column (in units of 4x4 luma samples) for
+ * each tile across the image.
+ * @mi_row_starts: is an array specifying the start row (in units of 4x4 luma samples) for
+ * each tile down the image.
+ * @tile_cols_log2: specifies the base 2 logarithm of the desired number of tiles across the frame.
+ * @tile_cols: specifies the number of tiles across the frame. It is a requirement of bitstream
+ * conformance that @tile_cols is less than or equal to GST_AV1_MAX_TILE_COLS.
+ * @tile_rows_log2: specifies the base 2 logarithm of the desired number of tiles down the frame.
+ * @tile_rows: specifies the number of tiles down the frame. It is a requirement of bitstream
+ * conformance that @tile_rows is less than or equal to GST_AV1_MAX_TILE_ROWS.
+ * @tile_size_bytes: specifies the number of bytes needed to code each tile size.
+ */
+struct _GstAV1TileInfo {
+ guint8 uniform_tile_spacing_flag;
+ gint increment_tile_rows_log2;
+ gint width_in_sbs_minus_1[GST_AV1_MAX_TILE_COLS];
+ gint height_in_sbs_minus_1[GST_AV1_MAX_TILE_ROWS];
+ gint tile_size_bytes_minus_1;
+ guint8 context_update_tile_id;
+
+ guint32 mi_col_starts[GST_AV1_MAX_TILE_COLS + 1]; /* MiColStarts */
+ guint32 mi_row_starts[GST_AV1_MAX_TILE_ROWS + 1]; /* MiRowStarts */
+ guint8 tile_cols_log2; /* TileColsLog2 */
+ guint8 tile_cols; /* TileCols */
+ guint8 tile_rows_log2; /* TileRowsLog2 */
+ guint8 tile_rows; /* TileRows */
+ guint8 tile_size_bytes; /* TileSizeBytes */
+};
+
+/**
+ * GstAV1CDEFParams:
+ * @cdef_damping: controls the amount of damping in the deringing filter.
+ * @cdef_bits: specifies the number of bits needed to specify which CDEF filter to apply.
+ * @cdef_y_pri_strength: specify the strength of the primary filter (Y component)
+ * @cdef_uv_pri_strength: specify the strength of the primary filter (UV components).
+ * @cdef_y_sec_strength: specify the strength of the secondary filter (Y component).
+ * @cdef_uv_sec_strength: specify the strength of the secondary filter (UV components).
+ *
+ * Parameters of Constrained Directional Enhancement Filter (CDEF).
+ */
+struct _GstAV1CDEFParams {
+ guint8 cdef_damping;
+ guint8 cdef_bits;
+ guint8 cdef_y_pri_strength[GST_AV1_CDEF_MAX];
+ guint8 cdef_y_sec_strength[GST_AV1_CDEF_MAX];
+ guint8 cdef_uv_pri_strength[GST_AV1_CDEF_MAX];
+ guint8 cdef_uv_sec_strength[GST_AV1_CDEF_MAX];
+};
+
+/**
+ * GstAV1LoopRestorationParams:
+ * @lr_unit_shift: specifies if the luma restoration size should be halved.
+ * @lr_uv_shift: is only present for 4:2:0 formats and specifies if the chroma size should be
+ * half the luma size.
+ * @frame_restoration_type: specifies the type of restoration used for each plane.
+ * @loop_restoration_size: specifies the size of loop restoration units in units of samples in
+ * the current plane.
+ * @uses_lr: indicates if any plane uses loop restoration.
+ */
+struct _GstAV1LoopRestorationParams {
+ guint8 lr_unit_shift;
+ gboolean lr_uv_shift;
+
+ GstAV1FrameRestorationType frame_restoration_type[GST_AV1_MAX_NUM_PLANES]; /* FrameRestorationType */
+ guint32 loop_restoration_size[GST_AV1_MAX_NUM_PLANES]; /* LoopRestorationSize */
+ guint8 uses_lr; /* UsesLr */
+};
+
+/**
+ * GstAV1GlobalMotionParams:
+ * @is_global: specifies whether global motion parameters are present for a particular
+ * reference frame.
+ * @is_rot_zoom: specifies whether a particular reference frame uses rotation and zoom
+ * global motion.
+ * @is_translation: specifies whether a particular reference frame uses translation
+ * global motion.
+ * @gm_params: is set equal to SavedGmParams[ frame_to_show_map_idx ][ ref ][ j ] for
+ * ref = LAST_FRAME..ALTREF_FRAME, for j = 0..5.
+ * @gm_type: specifying the type of global motion.
+ * @invalid: whether this global motion parameters is invalid. (Since: 1.20)
+ */
+/**
+ * _GstAV1GlobalMotionParams.invalid:
+ *
+ * whether this global motion parameters is invalid.
+ *
+ * Since: 1.20
+ */
+struct _GstAV1GlobalMotionParams {
+ gboolean is_global[GST_AV1_NUM_REF_FRAMES];
+ gboolean is_rot_zoom[GST_AV1_NUM_REF_FRAMES];
+ gboolean is_translation[GST_AV1_NUM_REF_FRAMES];
+ gint32 gm_params[GST_AV1_NUM_REF_FRAMES][6];
+
+ GstAV1WarpModelType gm_type[GST_AV1_NUM_REF_FRAMES]; /* GmType */
+ gboolean invalid[GST_AV1_NUM_REF_FRAMES];
+};
+
+/**
+ * GstAV1FilmGrainParams:
+ * @apply_grain: equal to 1 specifies that film grain should be added to this frame.
+ * apply_grain equal to 0 specifies that film grain should not be added.
+ * @grain_seed: specifies the starting value for the pseudo-random numbers used during film
+ * grain synthesis.
+ * @update_grain: equal to 1 means that a new set of parameters should be sent. @update_grain
+ * equal to 0 means that the previous set of parameters should be used.
+ * @film_grain_params_ref_idx: indicates which reference frame contains the film grain
+ * parameters to be used for this frame.
+ * @num_y_points: specifies the number of points for the piece-wise linear scaling function
+ * of the luma component. It is a requirement of bitstream conformance that @num_y_points is
+ * less than or equal to 14.
+ * @point_y_value: represents the x (luma value) coordinate for the i-th point of the
+ * piecewise linear scaling function for luma component. The values are signaled on the
+ * scale of 0..255. (In case of 10 bit video, these values correspond to luma values divided
+ * by 4. In case of 12 bit video, these values correspond to luma values divided by 16.)
+ * If i is greater than 0, it is a r equirement of bitstream conformance that
+ * @point_y_value[ i ] is greater than @point_y_value[ i - 1 ] (this ensures the x coordinates
+ * are specified in increasing order).
+ * @point_y_scaling: represents the scaling (output) value for the i-th point of the
+ * piecewise linear scaling function for luma component.
+ * @chroma_scaling_from_luma: specifies that the chroma scaling is inferred from the luma scaling.
+ * @num_cb_points: specifies the number of points for the piece-wise linear scaling function
+ * of the cb component. It is a requirement of bitstream conformance that @num_cb_points is
+ * less than or equal to 10.
+ * @point_cb_value: represents the x coordinate for the i-th point of the piece-wise linear
+ * scaling function for cb component. The values are signaled on the scale of 0..255. If i
+ * is greater than 0, it is a requirement of bitstream conformance that point_cb_value[ i ]
+ * is greater than point_cb_value[ i - 1 ].
+ * @point_cb_scaling: represents the scaling (output) value for the i-th point of the
+ * piecewise linear scaling function for cb component.
+ * @num_cr_points: specifies represents the number of points for the piece-wise linear scaling
+ * function of the cr component. It is a requirement of bitstream conformance that
+ * num_cr_points is less than or equal to 10. If subsampling_x is equal to 1 and
+ * @subsampling_y is equal to 1 and num_cb_points is equal to 0, it is a requirement of
+ * bitstream conformance that num_cr_points is equal to 0. If @subsampling_x is equal to 1
+ * and @subsampling_y is equal to 1 and @num_cb_points is not equal to 0, it is a requirement
+ * of bitstream conformance that @num_cr_points is not equal to 0.
+ * @point_cr_value: represents the x coordinate for the i-th point of the piece-wise linear
+ * scaling function for cr component. The values are signaled on the scale of 0..255. If i
+ * is greater than 0, it is a requirement of bitstream conformance that @point_cr_value[ i ]
+ * is greater than @point_cr_value[ i - 1 ].
+ * @point_cr_scaling: represents the scaling (output) value for the i-th point of the
+ * piecewise linear scaling function for cr component.
+ * @grain_scaling_minus_8: represents the shift - 8 applied to the values of the chroma
+ * component. The @grain_scaling_minus_8 can take values of 0..3 and determines the range and
+ * quantization step of the standard deviation of film grain.
+ * @ar_coeff_lag: specifies the number of auto-regressive coefficients for luma and chroma.
+ * @ar_coeffs_y_plus_128: specifies auto-regressive coefficients used for the Y plane.
+ * @ar_coeffs_cb_plus_128: specifies auto-regressive coefficients used for the U plane.
+ * @ar_coeffs_cr_plus_128: specifies auto-regressive coefficients used for the V plane.
+ * @ar_coeff_shift_minus_6: specifies the range of the auto-regressive coefficients. Values
+ * of 0, 1, 2, and 3 correspond to the ranges for auto-regressive coefficients of [-2, 2),
+ * [-1, 1), [-0.5, 0.5) and [-0.25, 0.25) respectively.
+ * @grain_scale_shift: specifies how much the Gaussian random numbers should be scaled down
+ * during the grain synthesis process.
+ * @cb_mult: represents a multiplier for the cb component used in derivation of the input
+ * index to the cb component scaling function.
+ * @cb_luma_mult: represents a multiplier for the average luma component used in derivation
+ * of the input index to the cb component scaling function.
+ * @cb_offset: represents an offset used in derivation of the input index to the cb component
+ * scaling function.
+ * @cr_mult: represents a multiplier for the cr component used in derivation of the input
+ * index to the cr component scaling function.
+ * @cr_luma_mult: represents a multiplier for the average luma component used in derivation
+ * of the input index to the cr component scaling function.
+ * @cr_offset: represents an offset used in derivation of the input index to the cr component
+ * scaling function.
+ * @overlap_flag: equal to 1 indicates that the overlap between film grain blocks shall be
+ * applied. overlap_flag equal to 0 indicates that the overlap between film grain blocks
+ * shall not be applied.
+ * @clip_to_restricted_range: equal to 1 indicates that clipping to the restricted (studio)
+ * range shall be applied to the sample values after adding the film grain (see the
+ * semantics for color_range for an explanation of studio swing). clip_to_restricted_range
+ * equal to 0 indicates that clipping to the full range shall be applied to the sample
+ * values after adding the film grain.
+ */
+struct _GstAV1FilmGrainParams {
+ gboolean apply_grain;
+ guint16 grain_seed;
+ gboolean update_grain;
+ guint8 film_grain_params_ref_idx;
+ guint8 num_y_points;
+ guint8 point_y_value[GST_AV1_MAX_NUM_Y_POINTS];
+ guint8 point_y_scaling[GST_AV1_MAX_NUM_Y_POINTS];
+ guint8 chroma_scaling_from_luma;
+ guint8 num_cb_points;
+ guint8 point_cb_value[GST_AV1_MAX_NUM_CB_POINTS];
+ guint8 point_cb_scaling[GST_AV1_MAX_NUM_CB_POINTS];
+ guint8 num_cr_points;
+ guint8 point_cr_value[GST_AV1_MAX_NUM_CR_POINTS];
+ guint8 point_cr_scaling[GST_AV1_MAX_NUM_CR_POINTS];
+ guint8 grain_scaling_minus_8;
+ guint8 ar_coeff_lag;
+ guint8 ar_coeffs_y_plus_128[GST_AV1_MAX_NUM_POS_LUMA];
+ guint8 ar_coeffs_cb_plus_128[GST_AV1_MAX_NUM_POS_LUMA];
+ guint8 ar_coeffs_cr_plus_128[GST_AV1_MAX_NUM_POS_LUMA];
+ guint8 ar_coeff_shift_minus_6;
+ guint8 grain_scale_shift;
+ guint8 cb_mult;
+ guint8 cb_luma_mult;
+ guint16 cb_offset;
+ guint8 cr_mult;
+ guint8 cr_luma_mult;
+ guint16 cr_offset;
+ gboolean overlap_flag;
+ gboolean clip_to_restricted_range;
+};
+
+/**
+ * GstAV1FrameHeaderOBU:
+ * @show_existing_frame: equal to 1, indicates the frame indexed by @frame_to_show_map_idx is
+ * to be output; @show_existing_frame equal to 0 indicates that further processing is required.
+ * If @obu_type is equal to #GST_AV1_OBU_FRAME, it is a requirement of bitstream conformance that
+ * @show_existing_frame is equal to 0.
+ * @frame_to_show_map_idx: specifies the frame to be output. It is only available if
+ * @show_existing_frame is 1.
+ * @frame_presentation_time: specifies the presentation time of the frame in clock ticks
+ * DispCT counted from the removal time of the last frame with frame_type equal to KEY_FRAME
+ * for the operating point that is being decoded. The syntax element is signaled as a fixed
+ * length unsigned integer with a length in bits given by
+ * @frame_presentation_time_length_minus_1 + 1. The @frame_presentation_time is the remainder
+ * of a modulo 1 << (@frame_presentation_time_length_minus_1 + 1) counter.
+ * @tu_presentation_delay: is a syntax element used by the decoder model. It does not affect
+ * the decoding process.
+ * @display_frame_id: provides the frame id number for the frame to output. It is a requirement
+ * of bitstream conformance that whenever @display_frame_id is read, the value matches
+ * @ref_frame_id[ @frame_to_show_map_idx ] (the value of @current_frame_id at the time that the
+ * frame indexed by @frame_to_show_map_idx was stored), and that
+ * @ref_valid[ @frame_to_show_map_idx ] is equjal to 1. It is a requirement of bitstream
+ * conformance that the number of bits needed to read @display_frame_id does not exceed 16.
+ * This is equivalent to the constraint that idLen <= 16
+ * @frame_type: specifies the type of the frame.
+ * @show_frame: equal to 1 specifies that this frame should be immediately output once decoded.
+ * show_frame equal to 0 specifies that this frame should not be immediately output. (It may
+ * be output later if a later uncompressed header uses @show_existing_frame equal to 1).
+ * @showable_frame: equal to 1 specifies that the frame may be output using the
+ * @show_existing_frame mechanism. showable_frame equal to 0 specifies that this frame will
+ * not be output using the @show_existing_frame mechanism. It is a requirement of bitstream
+ * conformance that when @show_existing_frame is used to show a previous frame, that the
+ * value of @showable_frame for the previous frame was equal to 1. It is a requirement of
+ * bitstream conformance that a particular showable frame is output via the
+ * @show_existing_frame mechanism at most once.
+ * @error_resilient_mode: equal to 1 indicates that error resilient mode is enabled;
+ * @error_resilient_mode equal to 0 indicates that error resilient mode is disabled.
+ * @disable_cdf_update: specifies whether the CDF update in the symbol decoding process should
+ * be disabled.
+ * @allow_screen_content_tools: equal to 1 indicates that intra blocks may use palette encoding;
+ * @allow_screen_content_tools equal to 0 indicates that palette encoding is never used.
+ * @force_integer_mv: equal to 1 specifies that motion vectors will always be integers.
+ * @force_integer_mv equal to 0 specifies that motion vectors can contain fractional bits.
+ * @current_frame_id: specifies the frame id number for the current frame. Frame id numbers
+ * are additional information that do not affect the decoding process, but provide decoders
+ * with a way of detecting missing reference frames so that appropriate action can be taken.
+ * @frame_size_override_flag: equal to 0 specifies that the frame size is equal to the size in
+ * the sequence header. @frame_size_override_flag equal to 1 specifies that the frame size
+ * will either be specified as the size of one of the reference frames, or computed from the
+ * @frame_width_minus_1 and @frame_height_minus_1 syntax elements.
+ * @order_hint: is used to compute order_hint.
+ * @primary_ref_frame: specifies which reference frame contains the CDF values and other state
+ * that should be loaded at the start of the frame.
+ * @buffer_removal_time_present_flag: equal to 1 specifies that @buffer_removal_time is present
+ * in the bitstream. @buffer_removal_time_present_flag equal to 0 specifies that
+ * @buffer_removal_time is not present in the bitstream.
+ * @buffer_removal_time: specifies the frame removal time in units of DecCT clock ticks
+ * counted from the removal time of the last frame with frame_type equal to KEY_FRAME for
+ * operating point opNum. @buffer_removal_time is signaled as a fixed length unsigned integer
+ * with a length in bits given by @buffer_removal_time_length_minus_1 + 1. @buffer_removal_time
+ * is the remainder of a modulo 1 << ( @buffer_removal_time_length_minus_1 + 1 ) counter.
+ * @refresh_frame_flags: contains a bitmask that specifies which reference frame slots will be
+ * updated with the current frame after it is decoded. If @frame_type is equal to
+ * #GST_AV1_INTRA_ONLY_FRAME, it is a requirement of bitstream conformance that
+ * @refresh_frame_flags is not equal to 0xff.
+ * @ref_order_hint: specifies the expected output order hint for each reference buffer.
+ * @allow_intrabc: equal to 1 indicates that intra block copy may be used in this frame.
+ * allow_intrabc equal to 0 indicates that intra block copy is not allowed in this frame.
+ * @frame_refs_short_signaling: equal to 1 indicates that only two reference frames are
+ * explicitly signaled. frame_refs_short_signaling equal to 0 indicates that all reference
+ * frames are explicitly signaled.
+ * @last_frame_idx: specifies the reference frame to use for LAST_FRAME.
+ * @gold_frame_idx: specifies the reference frame to use for GOLDEN_FRAME.
+ * @ref_frame_idx[i]: specifies which reference frames are used by inter frames.
+ * @delta_frame_id_minus_1 is used to calculate @delta_frame_id.
+ * @allow_high_precision_mv: equal to 0 specifies that motion vectors are specified to quarter
+ * pel precision; @allow_high_precision_mv equal to 1 specifies that motion vectors are
+ * specified to eighth pel precision.
+ * @is_motion_mode_switchable: equal to 0 specifies that only the SIMPLE motion mode will be used.
+ * @use_ref_frame_mvs: equal to 1 specifies that motion vector information from a previous
+ * frame can be used when decoding the current frame. @use_ref_frame_mvs equal to 0 specifies
+ * that this information will not be used.
+ * @disable_frame_end_update_cdf: equal to 1 indicates that the end of frame CDF update is
+ * disabled; @disable_frame_end_update_cdf equal to 0 indicates that the end of frame CDF
+ * update is enabled.
+ * @allow_warped_motion: equal to 1 indicates that the syntax element @motion_mode may be
+ * present. @allow_warped_motion equal to 0 indicates that the syntax element motion_mode
+ * will not be present (this means that LOCALWARP cannot be signaled if @allow_warped_motion
+ * is equal to 0).
+ * @reduced_tx_set: equal to 1 specifies that the frame is restricted to a reduced subset of
+ * the full set of transform types.
+ * @render_and_frame_size_different: equal to 0 means that the render width and height are
+ * inferred from the frame width and height. @render_and_frame_size_different equal to 1
+ * means that the render width and height are explicitly coded in the bitstream.
+ * @use_superres: equal to 0 indicates that no upscaling is needed. @use_superres equal to 1
+ * indicates that upscaling is needed.
+ * @is_filter_switchable: equal to 1 indicates that the filter selection is signaled at the
+ * block level; @is_filter_switchable equal to 0 indicates that the filter selection is
+ * signaled at the frame level.
+ * @interpolation_filter: a #GstAV1InterpolationFilter that specifies the filter selection used
+ * for performing inter prediction.
+ * @loop_filter_params: a #GstAV1LoopFilterParams holding the loop filter parameters.
+ * @quantization_params: a #GstAV1QuantizationParams holding the quantization parameters.
+ * @segmentation_params: a #GstAV1SegmenationParams holding the segementation parameters.
+ * @tile_info: a #GstAV1TileInfo holding the tile info.
+ * @cdef_params: a #GstAV1CDEFParams holding the CDEF paramters.
+ * @loop_restoration_params: a #GstAV1LoopRestorationParams holding the loop restoration parameters.
+ * @tx_mode_select: is used to compute TxMode.
+ * @skip_mode_present: equal to 1 specifies that the syntax element @skip_mode will be coded
+ * in the bitstream. @skip_mode_present equal to 0 specifies that @skip_mode will not be used
+ * for this frame.
+ * @reference_select: equal to 1 specifies that the mode info for inter blocks contains the
+ * syntax element comp_mode that indicates whether to use single or compound reference
+ * prediction. Reference_select equal to 0 specifies that all interblocks will use single
+ * prediction.
+ * @global_motion_params: a #GstAV1GlobalMotionParams holding the global motion parameters.
+ * @film_grain_params: a #GstAV1FilmGrainParams holding the Film Grain parameters.
+ * @superres_denom: is the denominator of a fraction that specifies the ratio between the
+ * superblock width before and after upscaling.
+ * @frame_is_intra: if equal to 0 indicating that this frame may use inter prediction.
+ * @order_hints: specifies the expected output order for each reference frame.
+ * @ref_frame_sign_bias: specifies the intended direction of the motion vector in time for
+ * each reference frame.
+ * @coded_lossless: is a variable that is equal to 1 when all segments use lossless encoding.
+ * @all_lossless: is a variable that is equal to 1 when @coded_lossless is equal to 1 and
+ * @frame_width is equal to @upscaled_width. This indicates that the frame is fully lossless
+ * at the upscaled resolution.
+ * @lossless_array: whether the segmentation is lossless.
+ * @seg_qm_Level: the segmentation's qm level.
+ * @upscaled_width: the upscaled width.
+ * @frame_width: the frame width.
+ * @frame_height: the frame height.
+ * @render_width: the frame width to be rendered.
+ * @render_height: the frame height to be rendered.
+ * @tx_mode: specifies how the transform size is determined.
+ * @skip_mode_frame: specifies the frames to use for compound prediction when @skip_mode is 1.
+ */
+struct _GstAV1FrameHeaderOBU {
+ gboolean show_existing_frame;
+ gint8 frame_to_show_map_idx;
+ guint32 frame_presentation_time;
+ guint32 tu_presentation_delay;
+ guint32 display_frame_id;
+ GstAV1FrameType frame_type;
+ gboolean show_frame;
+ gboolean showable_frame;
+ gboolean error_resilient_mode;
+ gboolean disable_cdf_update;
+ guint8 allow_screen_content_tools;
+ gboolean force_integer_mv;
+ guint32 current_frame_id;
+ gboolean frame_size_override_flag;
+ guint32 order_hint;
+ guint8 primary_ref_frame;
+ gboolean buffer_removal_time_present_flag;
+ guint32 buffer_removal_time[GST_AV1_MAX_OPERATING_POINTS];
+ guint8 refresh_frame_flags;
+ guint32 ref_order_hint[GST_AV1_NUM_REF_FRAMES];
+ gboolean allow_intrabc;
+ gboolean frame_refs_short_signaling;
+ gint8 last_frame_idx;
+ gint8 gold_frame_idx;
+ gint8 ref_frame_idx[GST_AV1_REFS_PER_FRAME];
+ gboolean allow_high_precision_mv;
+ gboolean is_motion_mode_switchable;
+ gboolean use_ref_frame_mvs;
+ gboolean disable_frame_end_update_cdf;
+ gboolean allow_warped_motion;
+ gboolean reduced_tx_set;
+ gboolean render_and_frame_size_different;
+ gboolean use_superres;
+ gboolean is_filter_switchable;
+ GstAV1InterpolationFilter interpolation_filter;
+ GstAV1LoopFilterParams loop_filter_params;
+ GstAV1QuantizationParams quantization_params;
+ GstAV1SegmenationParams segmentation_params;
+ GstAV1TileInfo tile_info;
+ GstAV1CDEFParams cdef_params;
+ GstAV1LoopRestorationParams loop_restoration_params;
+ gboolean tx_mode_select;
+ gboolean skip_mode_present;
+ gboolean reference_select;
+ GstAV1GlobalMotionParams global_motion_params;
+ GstAV1FilmGrainParams film_grain_params;
+
+ /* Global vars set by frame header */
+ guint32 superres_denom; /* SuperresDenom */
+ guint8 frame_is_intra; /* FrameIsIntra */
+ guint32 order_hints[GST_AV1_NUM_REF_FRAMES]; /* OrderHints */
+ guint32 ref_frame_sign_bias[GST_AV1_NUM_REF_FRAMES]; /* RefFrameSignBias */
+
+ guint8 coded_lossless; /* CodedLossless */
+ guint8 all_lossless; /* AllLossless */
+ guint8 lossless_array[GST_AV1_MAX_SEGMENTS]; /* LosslessArray */
+ guint8 seg_qm_Level[3][GST_AV1_MAX_SEGMENTS]; /* SegQMLevel */
+
+ guint32 upscaled_width; /* UpscaledWidth */
+ guint32 frame_width; /* FrameWidth */
+ guint32 frame_height; /* FrameHeight */
+ guint32 render_width; /* RenderWidth */
+ guint32 render_height; /* RenderHeight */
+
+ GstAV1TXModes tx_mode; /* TxMode */
+
+ guint8 skip_mode_frame[2]; /* SkipModeFrame */
+};
+
+/**
+ * GstAV1ReferenceFrameInfo:
+ *
+ * All the info related to a reference frames.
+ */
+struct _GstAV1ReferenceFrameInfo {
+ struct {
+ gboolean ref_valid; /* RefValid */
+ guint32 ref_frame_id; /* RefFrameId */
+ guint32 ref_upscaled_width; /* RefUpscaledWidth */
+ guint32 ref_frame_width; /* RefFrameWidth */
+ guint32 ref_frame_height; /* RefFrameHeight */
+ guint32 ref_render_width; /* RefRenderWidth */
+ guint32 ref_render_height; /* RefRenderHeight */
+ guint32 ref_mi_cols; /* RefMiCols */
+ guint32 ref_mi_rows; /* RefMiRows */
+ GstAV1FrameType ref_frame_type; /* RefFrameType */
+ guint8 ref_subsampling_x; /* RefSubsamplingX */
+ guint8 ref_subsampling_y; /* RefSubsamplingY */
+ guint8 ref_bit_depth; /* RefBitDepth */
+ guint32 ref_order_hint; /* RefOrderHint */
+ GstAV1SegmenationParams ref_segmentation_params;
+ GstAV1GlobalMotionParams ref_global_motion_params;
+ GstAV1LoopFilterParams ref_lf_params;
+ GstAV1FilmGrainParams ref_film_grain_params;
+ GstAV1TileInfo ref_tile_info;
+ } entry[GST_AV1_NUM_REF_FRAMES];
+};
+
+/**
+ * GstAV1TileListOBU:
+ * @output_frame_width_in_tiles_minus_1: plus one is the width of the output frame, in tile units.
+ * @output_frame_height_in_tiles_minus_1: plus one is the height of the output frame, in tile units.
+ * @tile_count_minus_1: plus one is the number of @tile_list_entry in the list. It is a requirement
+ * of bitstream conformance that @tile_count_minus_1 is less than or equal to 511.
+ * @anchor_frame_idx: is the index into an array AnchorFrames of the frames that the tile uses
+ * for prediction. The AnchorFrames array is provided by external means and may change for
+ * each tile list OBU. The process for creating the AnchorFrames array is outside of the
+ * scope of this specification. It is a requirement of bitstream conformance that
+ * @anchor_frame_idx is less than or equal to 127.
+ * @anchor_tile_row: the row coordinate of the tile in the frame that it belongs, in tile
+ * units. It is a requirement of bitstream conformance that @anchor_tile_row is less than @tile_rows.
+ * @anchor_tile_col: is the column coordinate of the tile in the frame that it belongs, in tile
+ * units. It is a requirement of bitstream conformance that @anchor_tile_col is less than @tile_cols.
+ * @tile_data_size_minus_1: plus one is the size of the coded tile data, @coded_tile_data, in bytes.
+ * @coded_tile_data: are the @tile_data_size_minus_1 + 1 bytes of the coded tile.
+ */
+struct _GstAV1TileListOBU {
+ guint8 output_frame_width_in_tiles_minus_1;
+ guint8 output_frame_height_in_tiles_minus_1;
+ guint16 tile_count_minus_1;
+ struct {
+ gint8 anchor_frame_idx;
+ guint8 anchor_tile_row;
+ guint8 anchor_tile_col;
+ guint16 tile_data_size_minus_1;
+ /* Just refer to obu's data, invalid after OBU data released */
+ guint8 *coded_tile_data;
+ } entry[GST_AV1_MAX_TILE_COUNT];
+};
+
+/**
+ * GstAV1TileListOBU:
+ * @tile_start_and_end_present_flag: specifies whether @tg_start and @tg_end are present
+ * in the bitstream. If @tg_start and @tg_end are not present in the bitstream, this
+ * tile group covers the entire frame. If @obu_type is equal to #GST_AV1_OBU_FRAME, it is a
+ * requirement of bitstream conformance that the value of @tile_start_and_end_present_flag
+ * is equal to 0.
+ * @tg_start: specifies the zero-based index of the first tile in the current tile group.
+ * It is a requirement of bitstream conformance that the value of @tg_start is equal to
+ * the value of TileNum at the point that tile_group_obu is invoked.
+ * @tg_end: specifies the zero-based index of the last tile in the current tile group.
+ * It is a requirement of bitstream conformance that the value of tg_end is greater
+ * than or equal to tg_start. It is a requirement of bitstream conformance that the
+ * value of tg_end for the last tile group in each frame is equal to num_tiles-1.
+ * @tile_offset: Offset from the OBU data, the real data start of this tile.
+ * @tg_size: Data size of this tile.
+ * @tile_row: Tile index in row.
+ * @tile_col: Tile index in column.
+ * @mi_row_start: start position in mi rows
+ * @mi_row_end: end position in mi rows
+ * @mi_col_start: start position in mi cols
+ * @mi_col_end: end position in mi cols
+ * @num_tiles: specifies the total number of tiles in the frame.
+ */
+struct _GstAV1TileGroupOBU {
+ gboolean tile_start_and_end_present_flag;
+ guint8 tg_start;
+ guint8 tg_end;
+ struct {
+ guint32 tile_offset; /* Tile data offset from the OBU data. */
+ guint32 tile_size; /* Data size of this tile */
+ guint32 tile_row; /* tileRow */
+ guint32 tile_col; /* tileCol */
+ /* global varialbes */
+ guint32 mi_row_start; /* MiRowStart */
+ guint32 mi_row_end; /* MiRowEnd */
+ guint32 mi_col_start; /* MiColStart */
+ guint32 mi_col_end; /* MiColEnd */
+ } entry[GST_AV1_MAX_TILE_COUNT];
+
+ guint32 num_tiles; /* NumTiles */
+};
+
+/**
+ * GstAV1FrameOBU:
+ * @frame_header: a #GstAV1FrameHeaderOBU holding frame_header data.
+ * @tile_group: a #GstAV1TileGroupOBU holding tile_group data.
+ */
+struct _GstAV1FrameOBU {
+ GstAV1TileGroupOBU tile_group;
+ GstAV1FrameHeaderOBU frame_header;
+};
+
+/**
+ * GstAV1Parser:
+ *
+ * #GstAV1Parser opaque structure
+ *
+ * Instantiante it with gst_av1_parser_new() and destroy it with
+ * gst_av1_parser_free()
+ */
+struct _GstAV1Parser
+{
+ /*< private >*/
+ struct
+ {
+ guint32 operating_point; /* Set by choose_operating_point() */
+ guint8 seen_frame_header; /* SeenFrameHeader */
+ guint32 operating_point_idc; /* OperatingPointIdc */
+ gboolean sequence_changed; /* Received a new sequence */
+ gboolean begin_first_frame; /* already find the first frame */
+
+ /* frame */
+ guint32 upscaled_width; /* UpscaledWidth */
+ guint32 frame_width; /* FrameWidth */
+ guint32 frame_height; /* FrameHeight */
+ guint32 mi_cols; /* MiCols */
+ guint32 mi_rows; /* MiRows */
+ guint32 render_width; /* RenderWidth */
+ guint32 render_height; /* RenderHeight */
+ guint32 prev_frame_id; /* PrevFrameID */
+ guint32 current_frame_id; /* the current frame ID */
+ GstAV1ReferenceFrameInfo ref_info; /* RefInfo */
+
+ guint32 mi_col_starts[GST_AV1_MAX_TILE_COLS + 1]; /* MiColStarts */
+ guint32 mi_row_starts[GST_AV1_MAX_TILE_ROWS + 1]; /* MiRowStarts */
+ guint8 tile_cols_log2; /* TileColsLog2 */
+ guint8 tile_cols; /* TileCols */
+ guint8 tile_rows_log2; /* TileRowsLog2 */
+ guint8 tile_rows; /* TileRows */
+ guint8 tile_size_bytes; /* TileSizeBytes */
+ } state;
+
+ gboolean annex_b;
+ guint32 temporal_unit_size;
+ /* consumed of this temporal unit */
+ guint32 temporal_unit_consumed;
+ guint32 frame_unit_size;
+ /* consumed of this frame unit */
+ guint32 frame_unit_consumed;
+
+ GstAV1SequenceHeaderOBU *seq_header;
+};
+
+GST_CODEC_PARSERS_API
+void
+gst_av1_parser_reset (GstAV1Parser * parser, gboolean annex_b);
+
+GST_CODEC_PARSERS_API
+void
+gst_av1_parser_reset_annex_b (GstAV1Parser * parser);
+
+GST_CODEC_PARSERS_API
+GstAV1ParserResult
+gst_av1_parser_identify_one_obu (GstAV1Parser * parser, const guint8 * data,
+ guint32 size, GstAV1OBU * obu, guint32 * consumed);
+
+GST_CODEC_PARSERS_API
+GstAV1ParserResult
+gst_av1_parser_parse_sequence_header_obu (GstAV1Parser * parser,
+ GstAV1OBU * obu, GstAV1SequenceHeaderOBU * seq_header);
+
+GST_CODEC_PARSERS_API
+GstAV1ParserResult
+gst_av1_parser_parse_temporal_delimiter_obu (GstAV1Parser * parser,
+ GstAV1OBU * obu);
+
+GST_CODEC_PARSERS_API
+GstAV1ParserResult
+gst_av1_parser_parse_metadata_obu (GstAV1Parser * parser, GstAV1OBU * obu,
+ GstAV1MetadataOBU * metadata);
+
+GST_CODEC_PARSERS_API
+GstAV1ParserResult
+gst_av1_parser_parse_tile_list_obu (GstAV1Parser * parser, GstAV1OBU * obu,
+ GstAV1TileListOBU * tile_list);
+
+GST_CODEC_PARSERS_API
+GstAV1ParserResult
+gst_av1_parser_parse_tile_group_obu (GstAV1Parser * parser, GstAV1OBU * obu,
+ GstAV1TileGroupOBU * tile_group);
+
+GST_CODEC_PARSERS_API
+GstAV1ParserResult
+gst_av1_parser_parse_frame_header_obu (GstAV1Parser * parser, GstAV1OBU * obu,
+ GstAV1FrameHeaderOBU * frame_header);
+
+GST_CODEC_PARSERS_API
+GstAV1ParserResult
+gst_av1_parser_parse_frame_obu (GstAV1Parser * parser, GstAV1OBU * obu,
+ GstAV1FrameOBU * frame);
+
+GST_CODEC_PARSERS_API
+GstAV1ParserResult
+gst_av1_parser_reference_frame_loading (GstAV1Parser * parser,
+ GstAV1FrameHeaderOBU * frame_header);
+
+GST_CODEC_PARSERS_API
+GstAV1ParserResult
+gst_av1_parser_reference_frame_update (GstAV1Parser * parser,
+ GstAV1FrameHeaderOBU * frame_header);
+
+GST_CODEC_PARSERS_API
+GstAV1ParserResult
+gst_av1_parser_set_operating_point (GstAV1Parser * parser,
+ gint32 operating_point);
+
+GST_CODEC_PARSERS_API
+GstAV1Parser * gst_av1_parser_new (void);
+
+GST_CODEC_PARSERS_API
+void gst_av1_parser_free (GstAV1Parser * parser);
+
+G_END_DECLS
+
+#endif /* __GST_AV1_PARSER_H__ */
diff --git a/include/gst/codecparsers/gsth264parser.h b/include/gst/codecparsers/gsth264parser.h
new file mode 100644
index 0000000000..d2f9542320
--- /dev/null
+++ b/include/gst/codecparsers/gsth264parser.h
@@ -0,0 +1,1336 @@
+/* Gstreamer
+ * Copyright (C) <2011> Intel Corporation
+ * Copyright (C) <2011> Collabora Ltd.
+ * Copyright (C) <2011> Thibault Saunier <thibault.saunier@collabora.com>
+ *
+ * Some bits C-c,C-v'ed and s/4/3 from h264parse and videoparsers/h264parse.c:
+ * Copyright (C) <2010> Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
+ * Copyright (C) <2010> Collabora Multimedia
+ * Copyright (C) <2010> Nokia Corporation
+ *
+ * (C) 2005 Michal Benes <michal.benes@itonis.tv>
+ * (C) 2008 Wim Taymans <wim.taymans@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_H264_PARSER_H__
+#define __GST_H264_PARSER_H__
+
+#ifndef GST_USE_UNSTABLE_API
+#warning "The H.264 parsing library is unstable API and may change in future."
+#warning "You can define GST_USE_UNSTABLE_API to avoid this warning."
+#endif
+
+#include <gst/gst.h>
+#include <gst/codecparsers/codecparsers-prelude.h>
+
+G_BEGIN_DECLS
+
+#define GST_H264_MAX_SPS_COUNT 32
+#define GST_H264_MAX_PPS_COUNT 256
+#define GST_H264_MAX_VIEW_COUNT 1024
+#define GST_H264_MAX_VIEW_ID (GST_H264_MAX_VIEW_COUNT - 1)
+
+#define GST_H264_IS_P_SLICE(slice) (((slice)->type % 5) == GST_H264_P_SLICE)
+#define GST_H264_IS_B_SLICE(slice) (((slice)->type % 5) == GST_H264_B_SLICE)
+#define GST_H264_IS_I_SLICE(slice) (((slice)->type % 5) == GST_H264_I_SLICE)
+#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
+ *
+ * Check if @nalu is a multiview extension NAL unit.
+ *
+ * Since: 1.6
+ */
+#define GST_H264_IS_MVC_NALU(nalu) \
+ ((nalu)->extension_type == GST_H264_NAL_EXTENSION_MVC)
+
+/**
+ * GstH264Profile:
+ * @GST_H264_PROFILE_BASELINE: Baseline profile (A.2.1)
+ * @GST_H264_PROFILE_MAIN: Main profile (A.2.2)
+ * @GST_H264_PROFILE_EXTENDED: Extended profile (A.2.3)
+ * @GST_H264_PROFILE_HIGH: High profile (A.2.4),
+ * or Progressive High profile (A.2.4.1), or Constrained High profile (A.2.4.2)
+ * depending on constraint_set4_flag and constraint_set5_flag
+ * @GST_H264_PROFILE_HIGH10: High 10 profile (A.2.5) or High 10 Intra
+ * profile (A.2.8), or Progressive High 10 profile (A.2.5.1) depending on
+ * constraint_set3_flag and constraint_set4_flag
+ * @GST_H264_PROFILE_HIGH_422: High 4:2:2 profile (A.2.6) or High
+ * 4:2:2 Intra profile (A.2.9), depending on constraint_set3_flag
+ * @GST_H264_PROFILE_HIGH_444: High 4:4:4 Predictive profile (A.2.7)
+ * or High 4:4:4 Intra profile (A.2.10), depending on the value of
+ * constraint_set3_flag
+ * @GST_H264_PROFILE_MULTIVIEW_HIGH: Multiview High profile (H.10.1.1)
+ * @GST_H264_PROFILE_STEREO_HIGH: Stereo High profile (H.10.1.2)
+ * @GST_H264_PROFILE_SCALABLE_BASELINE: Scalable Baseline profile (G.10.1.1)
+ * @GST_H264_PROFILE_SCALABLE_HIGH: Scalable High profile (G.10.1.2)
+ * or Scalable High Intra profile (G.10.1.3), depending on the value
+ * of constraint_set3_flag
+ *
+ * H.264 Profiles.
+ *
+ * Since: 1.2
+ */
+typedef enum {
+ GST_H264_PROFILE_BASELINE = 66,
+ GST_H264_PROFILE_MAIN = 77,
+ GST_H264_PROFILE_EXTENDED = 88,
+ GST_H264_PROFILE_HIGH = 100,
+ GST_H264_PROFILE_HIGH10 = 110,
+ GST_H264_PROFILE_HIGH_422 = 122,
+ GST_H264_PROFILE_HIGH_444 = 244,
+ GST_H264_PROFILE_MULTIVIEW_HIGH = 118,
+ GST_H264_PROFILE_STEREO_HIGH = 128,
+ GST_H264_PROFILE_SCALABLE_BASELINE = 83,
+ GST_H264_PROFILE_SCALABLE_HIGH = 86
+} GstH264Profile;
+
+/**
+ * GstH264NalUnitType:
+ * @GST_H264_NAL_UNKNOWN: Unknown nal type
+ * @GST_H264_NAL_SLICE: Slice nal
+ * @GST_H264_NAL_SLICE_DPA: DPA slice nal
+ * @GST_H264_NAL_SLICE_DPB: DPB slice nal
+ * @GST_H264_NAL_SLICE_DPC: DPC slice nal
+ * @GST_H264_NAL_SLICE_IDR: DPR slice nal
+ * @GST_H264_NAL_SEI: Supplemental enhancement information (SEI) nal unit
+ * @GST_H264_NAL_SPS: Sequence parameter set (SPS) nal unit
+ * @GST_H264_NAL_PPS: Picture parameter set (PPS) nal unit
+ * @GST_H264_NAL_AU_DELIMITER: Access unit (AU) delimiter nal unit
+ * @GST_H264_NAL_SEQ_END: End of sequence nal unit
+ * @GST_H264_NAL_STREAM_END: End of stream nal unit
+ * @GST_H264_NAL_FILLER_DATA: Filler data nal lunit
+ * @GST_H264_NAL_SPS_EXT: Sequence parameter set (SPS) extension NAL unit
+ * @GST_H264_NAL_PREFIX_UNIT: Prefix NAL unit
+ * @GST_H264_NAL_SUBSET_SPS: Subset sequence parameter set (SSPS) NAL unit
+ * @GST_H264_NAL_DEPTH_SPS: Depth parameter set (DPS) NAL unit
+ * @GST_H264_NAL_SLICE_AUX: Auxiliary coded picture without partitioning NAL unit
+ * @GST_H264_NAL_SLICE_EXT: Coded slice extension NAL unit
+ * @GST_H264_NAL_SLICE_DEPTH: Coded slice extension for depth or 3D-AVC texture view
+ *
+ * Indicates the type of H264 Nal Units
+ */
+typedef enum
+{
+ GST_H264_NAL_UNKNOWN = 0,
+ GST_H264_NAL_SLICE = 1,
+ GST_H264_NAL_SLICE_DPA = 2,
+ GST_H264_NAL_SLICE_DPB = 3,
+ GST_H264_NAL_SLICE_DPC = 4,
+ GST_H264_NAL_SLICE_IDR = 5,
+ GST_H264_NAL_SEI = 6,
+ GST_H264_NAL_SPS = 7,
+ GST_H264_NAL_PPS = 8,
+ GST_H264_NAL_AU_DELIMITER = 9,
+ GST_H264_NAL_SEQ_END = 10,
+ GST_H264_NAL_STREAM_END = 11,
+ GST_H264_NAL_FILLER_DATA = 12,
+ GST_H264_NAL_SPS_EXT = 13,
+ GST_H264_NAL_PREFIX_UNIT = 14,
+ GST_H264_NAL_SUBSET_SPS = 15,
+ GST_H264_NAL_DEPTH_SPS = 16,
+ GST_H264_NAL_SLICE_AUX = 19,
+ GST_H264_NAL_SLICE_EXT = 20,
+ GST_H264_NAL_SLICE_DEPTH = 21
+} GstH264NalUnitType;
+
+/**
+ * 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.
+ *
+ * Since: 1.6
+ */
+typedef enum
+{
+ GST_H264_NAL_EXTENSION_NONE = 0,
+ GST_H264_NAL_EXTENSION_SVC,
+ GST_H264_NAL_EXTENSION_MVC,
+} GstH264NalUnitExtensionType;
+
+/**
+ * GstH264ParserResult:
+ * @GST_H264_PARSER_OK: The parsing succeeded
+ * @GST_H264_PARSER_BROKEN_DATA: The data to parse is broken
+ * @GST_H264_PARSER_BROKEN_LINK: The link to structure needed for the parsing couldn't be found
+ * @GST_H264_PARSER_ERROR: An error occurred when parsing
+ * @GST_H264_PARSER_NO_NAL: No NAL unit found during the parsing
+ * @GST_H264_PARSER_NO_NAL_END: Start of the NAL unit found, but not the end.
+ * This will be returned if no start/sync marker for the next NAL unit was
+ * found. In this case the parser will assume that the end of the data is
+ * also the end of the NAL unit. Whether this assumption is correct or not
+ * depends on the context, which only the caller can know, which is why a
+ * special result value is returned in this case. If the data is NAL-aligned
+ * then #GST_H264_PARSER_NO_NAL_END can be treated just like
+ * #GST_H264_PARSER_OK. If the data is not guaranteed to be NAL-aligned,
+ * then the caller probably wants to collect more data until there's another
+ * sync marker or the end of the stream has been reached.
+ *
+ * The result of parsing H264 data.
+ */
+typedef enum
+{
+ GST_H264_PARSER_OK,
+ GST_H264_PARSER_BROKEN_DATA,
+ GST_H264_PARSER_BROKEN_LINK,
+ GST_H264_PARSER_ERROR,
+ GST_H264_PARSER_NO_NAL,
+ GST_H264_PARSER_NO_NAL_END
+} GstH264ParserResult;
+
+/**
+ * GstH264FramePackingType:
+ * @GST_H264_FRAME_PACKING_NONE: A complete 2D frame without any frame packing
+ * @GST_H264_FRAME_PACKING_CHECKERBOARD_INTERLEAVING: Checkerboard
+ * based interleaving
+ * @GST_H264_FRAME_PACKING_COLUMN_INTERLEAVING: Column based interleaving
+ * @GST_H264_FRAME_PACKING_ROW_INTERLEAVING: Row based interleaving
+ * @GST_H264_FRAME_PACKING_SIDE_BY_SIDE: Side-by-side packing
+ * @GST_H264_FRMAE_PACKING_TOP_BOTTOM: Top-Bottom packing
+ * @GST_H264_FRAME_PACKING_TEMPORAL_INTERLEAVING: Temporal interleaving
+ *
+ * Frame packing arrangement types.
+ *
+ * Since: 1.6
+ */
+typedef enum
+{
+ GST_H264_FRAME_PACKING_NONE = 6,
+ GST_H264_FRAME_PACKING_CHECKERBOARD_INTERLEAVING = 0,
+ GST_H264_FRAME_PACKING_COLUMN_INTERLEAVING = 1,
+ GST_H264_FRAME_PACKING_ROW_INTERLEAVING = 2,
+ GST_H264_FRAME_PACKING_SIDE_BY_SIDE = 3,
+ GST_H264_FRMAE_PACKING_TOP_BOTTOM = 4,
+ GST_H264_FRAME_PACKING_TEMPORAL_INTERLEAVING = 5
+} GstH264FramePackingType;
+
+/**
+ * GstH264SEIPayloadType:
+ * @GST_H264_SEI_BUF_PERIOD: Buffering Period SEI Message
+ * @GST_H264_SEI_PIC_TIMING: Picture Timing SEI Message
+ * @GST_H264_SEI_REGISTERED_USER_DATA: Registered user data (D.2.5)
+ * @GST_H264_SEI_RECOVERY_POINT: Recovery Point SEI Message (D.2.7)
+ * @GST_H264_SEI_STEREO_VIDEO_INFO: stereo video info SEI message (Since: 1.6)
+ * @GST_H264_SEI_FRAME_PACKING: Frame Packing Arrangement (FPA) message that
+ * contains the 3D arrangement for stereoscopic 3D video (Since: 1.6)
+ * @GST_H264_SEI_MASTERING_DISPLAY_COLOUR_VOLUME: Mastering display colour volume information SEI message (D.2.29) (Since: 1.18)
+ * @GST_H264_SEI_CONTENT_LIGHT_LEVEL: Content light level information SEI message (D.2.31) (Since: 1.18)
+ * @GST_H264_SEI_UNHANDLED_PAYLOAD: Unhandled SEI message. This may or may not
+ * be defined by spec (Since 1.18)
+ * ...
+ *
+ * The type of SEI message.
+ */
+typedef enum
+{
+ GST_H264_SEI_BUF_PERIOD = 0,
+ GST_H264_SEI_PIC_TIMING = 1,
+ GST_H264_SEI_REGISTERED_USER_DATA = 4,
+ GST_H264_SEI_RECOVERY_POINT = 6,
+ GST_H264_SEI_STEREO_VIDEO_INFO = 21,
+ GST_H264_SEI_FRAME_PACKING = 45,
+ GST_H264_SEI_MASTERING_DISPLAY_COLOUR_VOLUME = 137,
+ GST_H264_SEI_CONTENT_LIGHT_LEVEL = 144,
+ /* and more... */
+
+ /* Unhandled SEI type */
+ GST_H264_SEI_UNHANDLED_PAYLOAD = -1
+} GstH264SEIPayloadType;
+
+/**
+ * GstH264SEIPicStructType:
+ * @GST_H264_SEI_PIC_STRUCT_FRAME: Picture is a frame
+ * @GST_H264_SEI_PIC_STRUCT_TOP_FIELD: Top field of frame
+ * @GST_H264_SEI_PIC_STRUCT_BOTTOM_FIELD: Bottom field of frame
+ * @GST_H264_SEI_PIC_STRUCT_TOP_BOTTOM: Top bottom field of frame
+ * @GST_H264_SEI_PIC_STRUCT_BOTTOM_TOP: bottom top field of frame
+ * @GST_H264_SEI_PIC_STRUCT_TOP_BOTTOM_TOP: top bottom top field of frame
+ * @GST_H264_SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM: bottom top bottom field of frame
+ * @GST_H264_SEI_PIC_STRUCT_FRAME_DOUBLING: indicates that the frame should
+ * be displayed two times consecutively
+ * @GST_H264_SEI_PIC_STRUCT_FRAME_TRIPLING: indicates that the frame should be
+ * displayed three times consecutively
+ *
+ * SEI pic_struct type
+ */
+typedef enum
+{
+ GST_H264_SEI_PIC_STRUCT_FRAME = 0,
+ GST_H264_SEI_PIC_STRUCT_TOP_FIELD = 1,
+ GST_H264_SEI_PIC_STRUCT_BOTTOM_FIELD = 2,
+ GST_H264_SEI_PIC_STRUCT_TOP_BOTTOM = 3,
+ GST_H264_SEI_PIC_STRUCT_BOTTOM_TOP = 4,
+ GST_H264_SEI_PIC_STRUCT_TOP_BOTTOM_TOP = 5,
+ GST_H264_SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM = 6,
+ GST_H264_SEI_PIC_STRUCT_FRAME_DOUBLING = 7,
+ GST_H264_SEI_PIC_STRUCT_FRAME_TRIPLING = 8
+} GstH264SEIPicStructType;
+
+/**
+ * GstH264SliceType:
+ *
+ * Type of Picture slice
+ */
+
+typedef enum
+{
+ GST_H264_P_SLICE = 0,
+ GST_H264_B_SLICE = 1,
+ GST_H264_I_SLICE = 2,
+ GST_H264_SP_SLICE = 3,
+ GST_H264_SI_SLICE = 4,
+ GST_H264_S_P_SLICE = 5,
+ GST_H264_S_B_SLICE = 6,
+ GST_H264_S_I_SLICE = 7,
+ GST_H264_S_SP_SLICE = 8,
+ GST_H264_S_SI_SLICE = 9
+} GstH264SliceType;
+
+/**
+ * GstH264CtType
+ *
+ * Mapping of ct_type to source picture scan
+ *
+ * Since: 1.16
+ */
+
+typedef enum
+{
+ GST_H264_CT_TYPE_PROGRESSIVE = 0,
+ GST_H264_CT_TYPE_INTERLACED = 1,
+ GST_H264_CT_TYPE_UNKNOWN = 2,
+} GstCtType;
+
+typedef struct _GstH264NalParser GstH264NalParser;
+
+typedef struct _GstH264NalUnit GstH264NalUnit;
+typedef struct _GstH264NalUnitExtensionMVC GstH264NalUnitExtensionMVC;
+
+typedef struct _GstH264SPSExtMVCView GstH264SPSExtMVCView;
+typedef struct _GstH264SPSExtMVCLevelValue GstH264SPSExtMVCLevelValue;
+typedef struct _GstH264SPSExtMVCLevelValueOp GstH264SPSExtMVCLevelValueOp;
+typedef struct _GstH264SPSExtMVC GstH264SPSExtMVC;
+
+typedef struct _GstH264SPS GstH264SPS;
+typedef struct _GstH264PPS GstH264PPS;
+typedef struct _GstH264HRDParams GstH264HRDParams;
+typedef struct _GstH264VUIParams GstH264VUIParams;
+
+typedef struct _GstH264RefPicListModification GstH264RefPicListModification;
+typedef struct _GstH264DecRefPicMarking GstH264DecRefPicMarking;
+typedef struct _GstH264RefPicMarking GstH264RefPicMarking;
+typedef struct _GstH264PredWeightTable GstH264PredWeightTable;
+typedef struct _GstH264SliceHdr GstH264SliceHdr;
+
+typedef struct _GstH264ClockTimestamp GstH264ClockTimestamp;
+typedef struct _GstH264PicTiming GstH264PicTiming;
+typedef struct _GstH264RegisteredUserData GstH264RegisteredUserData;
+typedef struct _GstH264BufferingPeriod GstH264BufferingPeriod;
+typedef struct _GstH264RecoveryPoint GstH264RecoveryPoint;
+typedef struct _GstH264StereoVideoInfo GstH264StereoVideoInfo;
+typedef struct _GstH264FramePacking GstH264FramePacking;
+typedef struct _GstH264MasteringDisplayColourVolume GstH264MasteringDisplayColourVolume;
+typedef struct _GstH264ContentLightLevel GstH264ContentLightLevel;
+typedef struct _GstH264SEIUnhandledPayload GstH264SEIUnhandledPayload;
+typedef struct _GstH264SEIMessage GstH264SEIMessage;
+
+/**
+ * GstH264NalUnitExtensionMVC:
+ * @non_idr_flag: If equal to 0, it specifies that the current access
+ * unit is an IDR access unit
+ * @priority_id: The priority identifier for the NAL unit
+ * @view_id: The view identifier for the NAL unit
+ * @temporal_id: The temporal identifier for the NAL unit
+ * @anchor_pic_flag: If equal to 1, it specifies that the current
+ * access unit is an anchor access unit
+ * @inter_view_flag: If equal to 0, it specifies that the current view
+ * component is not used for inter-view prediction by any other view
+ * component in the current access unit
+ *
+ * Since: 1.6
+ */
+struct _GstH264NalUnitExtensionMVC
+{
+ guint8 non_idr_flag;
+ guint8 priority_id;
+ guint16 view_id;
+ guint8 temporal_id;
+ guint8 anchor_pic_flag;
+ guint8 inter_view_flag;
+};
+
+/**
+ * GstH264NalUnit:
+ * @ref_idc: not equal to 0 specifies that the content of the NAL unit
+ * contains a sequence parameter set, a sequence parameter set
+ * extension, a subset sequence parameter set, a picture parameter
+ * set, a slice of a reference picture, a slice data partition of a
+ * reference picture, or a prefix NAL unit preceding a slice of a
+ * reference picture.
+ * @type: A #GstH264NalUnitType
+ * @idr_pic_flag: calculated idr_pic_flag
+ * @size: The size of the NAL unit starting from @offset, thus
+ * including the header bytes. e.g. @type (nal_unit_type),
+ * but not the start code.
+ * @offset: The offset of the first byte of the NAL unit header,
+ * just after the start code.
+ * @sc_offset: The offset of the first byte of the start code of
+ * the NAL unit.
+ * @valid: If the NAL unit is valid, which means it has
+ * already been parsed
+ * @data: The data array from which the NAL unit has been parsed,
+ * into which the offset and sc_offset apply.
+ * @header_bytes: The size of the NALU header in bytes. The NALU
+ * header is the 1-byte type code, and for extension / prefix NALs
+ * includes the extension header bytes. @offset + @header_bytes is
+ * therefore the first byte of the actual packet payload.
+ * (Since: 1.6)
+ * @extension_type: the extension type for prefix NAL/MVC/SVC
+ * (Since: 1.6)
+ *
+ * Structure defining the NAL unit headers
+ */
+struct _GstH264NalUnit
+{
+ guint16 ref_idc;
+ guint16 type;
+
+ /* calculated values */
+ guint8 idr_pic_flag;
+ guint size;
+ guint offset;
+ guint sc_offset;
+ gboolean valid;
+
+ guint8 *data;
+
+ guint8 header_bytes;
+ guint8 extension_type;
+ union {
+ GstH264NalUnitExtensionMVC mvc;
+ } extension;
+};
+
+/**
+ * GstH264HRDParams:
+ * @cpb_cnt_minus1: plus 1 specifies the number of alternative
+ * CPB specifications in the bitstream
+ * @bit_rate_scale: specifies the maximum input bit rate of the
+ * SchedSelIdx-th CPB
+ * @cpb_size_scale: specifies the CPB size of the SchedSelIdx-th CPB
+ * @guint32 bit_rate_value_minus1: specifies the maximum input bit rate for the
+ * SchedSelIdx-th CPB
+ * @cpb_size_value_minus1: is used together with cpb_size_scale to specify the
+ * SchedSelIdx-th CPB size
+ * @cbr_flag: Specifies if running in constant or intermittent bit rate mode
+ * @initial_cpb_removal_delay_length_minus1: specifies the length in bits of
+ * the cpb_removal_delay syntax element
+ * @cpb_removal_delay_length_minus1: specifies the length in bits of the
+ * dpb_output_delay syntax element
+ * @dpb_output_delay_length_minus1: >0 specifies the length in bits of the time_offset syntax element.
+ * =0 specifies that the time_offset syntax element is not present
+ * @time_offset_length: Length of the time offset
+ *
+ * Defines the HRD parameters
+ */
+struct _GstH264HRDParams
+{
+ guint8 cpb_cnt_minus1;
+ guint8 bit_rate_scale;
+ guint8 cpb_size_scale;
+
+ guint32 bit_rate_value_minus1[32];
+ guint32 cpb_size_value_minus1[32];
+ guint8 cbr_flag[32];
+
+ guint8 initial_cpb_removal_delay_length_minus1;
+ guint8 cpb_removal_delay_length_minus1;
+ guint8 dpb_output_delay_length_minus1;
+ guint8 time_offset_length;
+};
+
+/**
+ * GstH264VUIParams:
+ * @aspect_ratio_info_present_flag: %TRUE specifies that aspect_ratio_idc is present.
+ * %FALSE specifies that aspect_ratio_idc is not present
+ * @aspect_ratio_idc specifies the value of the sample aspect ratio of the luma samples
+ * @sar_width indicates the horizontal size of the sample aspect ratio
+ * @sar_height indicates the vertical size of the sample aspect ratio
+ * @overscan_info_present_flag: %TRUE overscan_appropriate_flag is present %FALSE otherwise
+ * @overscan_appropriate_flag: %TRUE indicates that the cropped decoded pictures
+ * output are suitable for display using overscan. %FALSE the cropped decoded pictures
+ * output contain visually important information
+ * @video_signal_type_present_flag: %TRUE specifies that video_format, video_full_range_flag and
+ * colour_description_present_flag are present.
+ * @video_format: indicates the representation of the picture
+ * @video_full_range_flag: indicates the black level and range of the luma and chroma signals
+ * @colour_description_present_flag: %TRUE specifies that colour_primaries,
+ * transfer_characteristics and matrix_coefficients are present
+ * @colour_primaries: indicates the chromaticity coordinates of the source primaries
+ * @transfer_characteristics: indicates the opto-electronic transfer characteristic
+ * @matrix_coefficients: describes the matrix coefficients used in deriving luma and chroma signals
+ * @chroma_loc_info_present_flag: %TRUE specifies that chroma_sample_loc_type_top_field and
+ * chroma_sample_loc_type_bottom_field are present, %FALSE otherwise
+ * @chroma_sample_loc_type_top_field: specify the location of chroma for top field
+ * @chroma_sample_loc_type_bottom_field specify the location of chroma for bottom field
+ * @timing_info_present_flag: %TRUE specifies that num_units_in_tick,
+ * time_scale and fixed_frame_rate_flag are present in the bitstream
+ * @num_units_in_tick: is the number of time units of a clock operating at the frequency time_scale Hz
+ * time_scale: is the number of time units that pass in one second
+ * @fixed_frame_rate_flag: %TRUE indicates that the temporal distance between the HRD output times
+ * of any two consecutive pictures in output order is constrained as specified in the spec, %FALSE
+ * otherwise.
+ * @nal_hrd_parameters_present_flag: %TRUE if NAL HRD parameters exist in the bitstream
+ * @vcl_hrd_parameters_present_flag: %TRUE if VCL HRD parameters exist in the bitstream
+ * @low_delay_hrd_flag: specifies the HRD operational mode
+ * @pic_struct_present_flag: %TRUE specifies that picture timing SEI messages are present or not
+ * @bitstream_restriction_flag: %TRUE specifies that the following coded video sequence bitstream restriction
+ * parameters are present
+ * @motion_vectors_over_pic_boundaries_flag: %FALSE indicates that no sample outside the
+ * picture boundaries and no sample at a fractional sample position, %TRUE indicates that one or more
+ * samples outside picture boundaries may be used in inter prediction
+ * @max_bytes_per_pic_denom: indicates a number of bytes not exceeded by the sum of the sizes of
+ * the VCL NAL units associated with any coded picture in the coded video sequence.
+ * @max_bits_per_mb_denom: indicates the maximum number of coded bits of macroblock_layer
+ * @log2_max_mv_length_horizontal: indicate the maximum absolute value of a decoded horizontal
+ * motion vector component
+ * @log2_max_mv_length_vertical: indicate the maximum absolute value of a decoded vertical
+ * motion vector component
+ * @num_reorder_frames: indicates the maximum number of frames, complementary field pairs,
+ * or non-paired fields that precede any frame,
+ * @max_dec_frame_buffering: specifies the required size of the HRD decoded picture buffer in
+ * units of frame buffers.
+ *
+ * The structure representing the VUI parameters.
+ */
+struct _GstH264VUIParams
+{
+ guint8 aspect_ratio_info_present_flag;
+ guint8 aspect_ratio_idc;
+ /* if aspect_ratio_idc == 255 */
+ guint16 sar_width;
+ guint16 sar_height;
+
+ guint8 overscan_info_present_flag;
+ /* if overscan_info_present_flag */
+ guint8 overscan_appropriate_flag;
+
+ guint8 video_signal_type_present_flag;
+ guint8 video_format;
+ guint8 video_full_range_flag;
+ guint8 colour_description_present_flag;
+ guint8 colour_primaries;
+ guint8 transfer_characteristics;
+ guint8 matrix_coefficients;
+
+ guint8 chroma_loc_info_present_flag;
+ guint8 chroma_sample_loc_type_top_field;
+ guint8 chroma_sample_loc_type_bottom_field;
+
+ guint8 timing_info_present_flag;
+ /* if timing_info_present_flag */
+ guint32 num_units_in_tick;
+ guint32 time_scale;
+ guint8 fixed_frame_rate_flag;
+
+ guint8 nal_hrd_parameters_present_flag;
+ /* if nal_hrd_parameters_present_flag */
+ GstH264HRDParams nal_hrd_parameters;
+
+ guint8 vcl_hrd_parameters_present_flag;
+ /* if vcl_hrd_parameters_present_flag */
+ GstH264HRDParams vcl_hrd_parameters;
+
+ guint8 low_delay_hrd_flag;
+ guint8 pic_struct_present_flag;
+
+ guint8 bitstream_restriction_flag;
+ /* if bitstream_restriction_flag */
+ guint8 motion_vectors_over_pic_boundaries_flag;
+ guint32 max_bytes_per_pic_denom;
+ guint32 max_bits_per_mb_denom;
+ guint32 log2_max_mv_length_horizontal;
+ guint32 log2_max_mv_length_vertical;
+ guint32 num_reorder_frames;
+ guint32 max_dec_frame_buffering;
+
+ /* calculated values */
+ guint par_n;
+ guint par_d;
+};
+
+/**
+ * GstH264SPSExtMVCView:
+ * @num_anchor_refs_l0: specifies the number of view components for
+ * inter-view prediction in the initialized RefPicList0 in decoding
+ * anchor view components.
+ * @anchor_ref_l0: specifies the view_id for inter-view prediction in
+ * the initialized RefPicList0 in decoding anchor view components.
+ * @num_anchor_refs_l1: specifies the number of view components for
+ * inter-view prediction in the initialized RefPicList1 in decoding
+ * anchor view components.
+ * @anchor_ref_l1: specifies the view_id for inter-view prediction in
+ * the initialized RefPicList1 in decoding anchor view components.
+ * @num_non_anchor_refs_l0: specifies the number of view components
+ * for inter-view prediction in the initialized RefPicList0 in
+ * decoding non-anchor view components.
+ * @non_anchor_ref_l0: specifies the view_id for inter-view prediction
+ * in the initialized RefPicList0 in decoding non-anchor view
+ * components.
+ * @num_non_anchor_refs_l1: specifies the number of view components
+ * for inter-view prediction in the initialized RefPicList1 in
+ * decoding non-anchor view components.
+ * @non_anchor_ref_l1: specifies the view_id for inter-view prediction
+ * in the initialized RefPicList1 in decoding non-anchor view
+ * components.
+ *
+ * Represents inter-view dependency relationships for the coded video
+ * sequence.
+ *
+ * Since: 1.6
+ */
+struct _GstH264SPSExtMVCView
+{
+ guint16 view_id;
+ guint8 num_anchor_refs_l0;
+ guint16 anchor_ref_l0[15];
+ guint8 num_anchor_refs_l1;
+ guint16 anchor_ref_l1[15];
+ guint8 num_non_anchor_refs_l0;
+ guint16 non_anchor_ref_l0[15];
+ guint8 num_non_anchor_refs_l1;
+ guint16 non_anchor_ref_l1[15];
+};
+
+/**
+ * GstH264SPSExtMVCLevelValueOp:
+ *
+ * Represents an operation point for the coded video sequence.
+ *
+ * Since: 1.6
+ */
+struct _GstH264SPSExtMVCLevelValueOp
+{
+ guint8 temporal_id;
+ guint16 num_target_views_minus1;
+ guint16 *target_view_id;
+ guint16 num_views_minus1;
+};
+
+/**
+ * GstH264SPSExtMVCLevelValue:
+ * @level_idc: specifies the level value signalled for the coded video
+ * sequence
+ * @num_applicable_ops_minus1: plus 1 specifies the number of
+ * operation points to which the level indicated by level_idc applies
+ * @applicable_op: specifies the applicable operation point
+ *
+ * Represents level values for a subset of the operation points for
+ * the coded video sequence.
+ *
+ * Since: 1.6
+ */
+struct _GstH264SPSExtMVCLevelValue
+{
+ guint8 level_idc;
+ guint16 num_applicable_ops_minus1;
+ GstH264SPSExtMVCLevelValueOp *applicable_op;
+};
+
+/**
+ * GstH264SPSExtMVC:
+ * @num_views_minus1: plus 1 specifies the maximum number of coded
+ * views in the coded video sequence
+ * @view: array of #GstH264SPSExtMVCView
+ * @num_level_values_signalled_minus1: plus 1 specifies the number of
+ * level values signalled for the coded video sequence.
+ * @level_value: array of #GstH264SPSExtMVCLevelValue
+ *
+ * Represents the parsed `seq_parameter_set_mvc_extension()`.
+ *
+ * Since: 1.6
+ */
+struct _GstH264SPSExtMVC
+{
+ guint16 num_views_minus1;
+ GstH264SPSExtMVCView *view;
+ guint8 num_level_values_signalled_minus1;
+ GstH264SPSExtMVCLevelValue *level_value;
+};
+
+/**
+ * GstH264SPS:
+ * @id: The ID of the sequence parameter set
+ * @profile_idc: indicate the profile to which the coded video sequence conforms
+ *
+ * H264 Sequence Parameter Set (SPS)
+ */
+struct _GstH264SPS
+{
+ gint id;
+
+ guint8 profile_idc;
+ guint8 constraint_set0_flag;
+ guint8 constraint_set1_flag;
+ guint8 constraint_set2_flag;
+ guint8 constraint_set3_flag;
+ guint8 constraint_set4_flag;
+ guint8 constraint_set5_flag;
+ guint8 level_idc;
+
+ guint8 chroma_format_idc;
+ guint8 separate_colour_plane_flag;
+ guint8 bit_depth_luma_minus8;
+ guint8 bit_depth_chroma_minus8;
+ guint8 qpprime_y_zero_transform_bypass_flag;
+
+ guint8 scaling_matrix_present_flag;
+ guint8 scaling_lists_4x4[6][16];
+ guint8 scaling_lists_8x8[6][64];
+
+ guint8 log2_max_frame_num_minus4;
+ guint8 pic_order_cnt_type;
+
+ /* if pic_order_cnt_type == 0 */
+ guint8 log2_max_pic_order_cnt_lsb_minus4;
+
+ /* else if pic_order_cnt_type == 1 */
+ guint8 delta_pic_order_always_zero_flag;
+ gint32 offset_for_non_ref_pic;
+ gint32 offset_for_top_to_bottom_field;
+ guint8 num_ref_frames_in_pic_order_cnt_cycle;
+ gint32 offset_for_ref_frame[255];
+
+ /* FIXME rename according to spec, max_num_ref_frames */
+ guint32 num_ref_frames;
+ guint8 gaps_in_frame_num_value_allowed_flag;
+ guint32 pic_width_in_mbs_minus1;
+ guint32 pic_height_in_map_units_minus1;
+ guint8 frame_mbs_only_flag;
+
+ guint8 mb_adaptive_frame_field_flag;
+
+ guint8 direct_8x8_inference_flag;
+
+ guint8 frame_cropping_flag;
+
+ /* if frame_cropping_flag */
+ guint32 frame_crop_left_offset;
+ guint32 frame_crop_right_offset;
+ guint32 frame_crop_top_offset;
+ guint32 frame_crop_bottom_offset;
+
+ guint8 vui_parameters_present_flag;
+ /* if vui_parameters_present_flag */
+ GstH264VUIParams vui_parameters;
+
+ /* calculated values */
+ guint8 chroma_array_type;
+ guint32 max_frame_num;
+ gint width, height;
+ gint crop_rect_width, crop_rect_height;
+ gint crop_rect_x, crop_rect_y;
+ gint fps_num_removed, fps_den_removed; /* FIXME: remove */
+ gboolean valid;
+
+ /* Subset SPS extensions */
+ guint8 extension_type;
+ union {
+ GstH264SPSExtMVC mvc;
+ } extension;
+};
+
+/**
+ * GstH264PPS:
+ *
+ * H264 Picture Parameter Set
+ */
+struct _GstH264PPS
+{
+ gint id;
+
+ GstH264SPS *sequence;
+
+ guint8 entropy_coding_mode_flag;
+ guint8 pic_order_present_flag;
+
+ guint32 num_slice_groups_minus1;
+
+ /* if num_slice_groups_minus1 > 0 */
+ guint8 slice_group_map_type;
+ /* and if slice_group_map_type == 0 */
+ guint32 run_length_minus1[8];
+ /* or if slice_group_map_type == 2 */
+ guint32 top_left[8];
+ guint32 bottom_right[8];
+ /* or if slice_group_map_type == (3, 4, 5) */
+ guint8 slice_group_change_direction_flag;
+ guint32 slice_group_change_rate_minus1;
+ /* or if slice_group_map_type == 6 */
+ guint32 pic_size_in_map_units_minus1;
+ guint8 *slice_group_id;
+
+ /* FIXME rename to num_ref_idx_l{0,1}_default_active_minus1 */
+ guint8 num_ref_idx_l0_active_minus1;
+ guint8 num_ref_idx_l1_active_minus1;
+ guint8 weighted_pred_flag;
+ guint8 weighted_bipred_idc;
+ gint8 pic_init_qp_minus26;
+ gint8 pic_init_qs_minus26;
+ gint8 chroma_qp_index_offset;
+ guint8 deblocking_filter_control_present_flag;
+ guint8 constrained_intra_pred_flag;
+ guint8 redundant_pic_cnt_present_flag;
+
+ guint8 transform_8x8_mode_flag;
+
+ guint8 scaling_lists_4x4[6][16];
+ guint8 scaling_lists_8x8[6][64];
+
+ guint8 second_chroma_qp_index_offset;
+
+ gboolean valid;
+
+ /* Since: 1.18 */
+ guint8 pic_scaling_matrix_present_flag;
+};
+
+struct _GstH264RefPicListModification
+{
+ guint8 modification_of_pic_nums_idc;
+ union
+ {
+ /* if modification_of_pic_nums_idc == 0 || 1 */
+ guint32 abs_diff_pic_num_minus1;
+ /* if modification_of_pic_nums_idc == 2 */
+ guint32 long_term_pic_num;
+ /* if modification_of_pic_nums_idc == 4 || 5 */
+ guint32 abs_diff_view_idx_minus1;
+ } value;
+};
+
+struct _GstH264PredWeightTable
+{
+ guint8 luma_log2_weight_denom;
+ guint8 chroma_log2_weight_denom;
+
+ gint16 luma_weight_l0[32];
+ gint8 luma_offset_l0[32];
+
+ /* if seq->ChromaArrayType != 0 */
+ gint16 chroma_weight_l0[32][2];
+ gint8 chroma_offset_l0[32][2];
+
+ /* if slice->slice_type % 5 == 1 */
+ gint16 luma_weight_l1[32];
+ gint8 luma_offset_l1[32];
+
+ /* and if seq->ChromaArrayType != 0 */
+ gint16 chroma_weight_l1[32][2];
+ gint8 chroma_offset_l1[32][2];
+};
+
+struct _GstH264RefPicMarking
+{
+ guint8 memory_management_control_operation;
+
+ guint32 difference_of_pic_nums_minus1;
+ guint32 long_term_pic_num;
+ guint32 long_term_frame_idx;
+ guint32 max_long_term_frame_idx_plus1;
+};
+
+struct _GstH264DecRefPicMarking
+{
+ /* if slice->nal_unit.IdrPicFlag */
+ guint8 no_output_of_prior_pics_flag;
+ guint8 long_term_reference_flag;
+
+ guint8 adaptive_ref_pic_marking_mode_flag;
+ GstH264RefPicMarking ref_pic_marking[10];
+ guint8 n_ref_pic_marking;
+
+ /* Size of the dec_ref_pic_marking() syntax element in bits (Since: 1.18) */
+ guint bit_size;
+};
+
+
+struct _GstH264SliceHdr
+{
+ guint32 first_mb_in_slice;
+ guint32 type;
+ GstH264PPS *pps;
+
+ /* if seq->separate_colour_plane_flag */
+ guint8 colour_plane_id;
+
+ guint16 frame_num;
+
+ guint8 field_pic_flag;
+ guint8 bottom_field_flag;
+
+ /* if nal_unit.type == 5 */
+ guint16 idr_pic_id;
+
+ /* if seq->pic_order_cnt_type == 0 */
+ guint16 pic_order_cnt_lsb;
+ /* if seq->pic_order_present_flag && !field_pic_flag */
+ gint32 delta_pic_order_cnt_bottom;
+
+ gint32 delta_pic_order_cnt[2];
+ guint8 redundant_pic_cnt;
+
+ /* if slice_type == B_SLICE */
+ guint8 direct_spatial_mv_pred_flag;
+
+ guint8 num_ref_idx_l0_active_minus1;
+ guint8 num_ref_idx_l1_active_minus1;
+
+ guint8 ref_pic_list_modification_flag_l0;
+ guint8 n_ref_pic_list_modification_l0;
+ GstH264RefPicListModification ref_pic_list_modification_l0[32];
+ guint8 ref_pic_list_modification_flag_l1;
+ guint8 n_ref_pic_list_modification_l1;
+ GstH264RefPicListModification ref_pic_list_modification_l1[32];
+
+ GstH264PredWeightTable pred_weight_table;
+ /* if nal_unit.ref_idc != 0 */
+ GstH264DecRefPicMarking dec_ref_pic_marking;
+
+ guint8 cabac_init_idc;
+ gint8 slice_qp_delta;
+ gint8 slice_qs_delta;
+
+ guint8 disable_deblocking_filter_idc;
+ gint8 slice_alpha_c0_offset_div2;
+ gint8 slice_beta_offset_div2;
+
+ guint16 slice_group_change_cycle;
+
+ /* calculated values */
+ guint32 max_pic_num;
+ gboolean valid;
+
+ /* Size of the slice_header() in bits */
+ guint header_size;
+
+ /* Number of emulation prevention bytes (EPB) in this slice_header() */
+ guint n_emulation_prevention_bytes;
+
+ /* Since: 1.18 */
+ guint8 num_ref_idx_active_override_flag;
+ guint8 sp_for_switch_flag;
+
+ /*
+ * Size of the pic_order_cnt related syntax elements pic_order_cnt_lsb,
+ * delta_pic_order_cnt_bottom, delta_pic_order_cnt[0], and
+ * delta_pic_order_cnt[1]. (Since: 1.18)
+ */
+ guint pic_order_cnt_bit_size;
+};
+
+/**
+ * GstH264ClockTimestamp:
+ * @ct_type: indicates the scan type, 0: progressive, 1: interlaced, 2: unknown,
+ * 3: reserved
+ * @nuit_field_based_flag: used in calculating clockTimestamp
+ * @counting_type: specifies the method of dropping values of the n_frames
+ * @full_timestamp_flag: equal to 1 specifies that the n_frames syntax element
+ * is followed by seconds_value, minutes_value, and hours_value (Since 1.18)
+ * @discontinuity_flag: indicates whether the difference between the current
+ * value of clockTimestamp and the value of clockTimestamp computed from the
+ * previous clock timestamp can be interpreted as the time difference or not.
+ * @cnt_dropped_flag: specifies the skipping of one or more values of n_frames
+ * using the counting method specified by counting_type
+ * @n_frames: specifies the value of nFrames used to compute clockTimestamp
+ * @seconds_flag: equal to 1 specifies that @seconds_value and minutes_flag are
+ * present when @full_timestamp_flag is equal to 0
+ * @seconds_value: specifies the value of seconds to compute clockTimestamp
+ * @minutes_flag: equal to 1 specifies that @minutes_value and hours_flag are
+ * present when @full_timestamp_flag is equal to 0 and @seconds_flag is
+ * equal to 1
+ * @minutes_value: specifies the value of minutes to compute clockTimestamp
+ * @hours_flag: equal to 1 specifies that @hours_value is present when
+ * @full_timestamp_flag is equal to 0 and @seconds_flag is equal to 1 and
+ * @minutes_flag is equal to 1
+ * @time_offset: specifies the value of tOffset used to compute clockTimestamp
+ */
+struct _GstH264ClockTimestamp
+{
+ guint8 ct_type;
+ guint8 nuit_field_based_flag;
+ guint8 counting_type;
+ guint8 full_timestamp_flag;
+ guint8 discontinuity_flag;
+ guint8 cnt_dropped_flag;
+ guint8 n_frames;
+
+ guint8 seconds_flag;
+ guint8 seconds_value;
+
+ guint8 minutes_flag;
+ guint8 minutes_value;
+
+ guint8 hours_flag;
+ guint8 hours_value;
+
+ guint32 time_offset;
+};
+
+/**
+ * GstH264FramePacking:
+ *
+ * Since: 1.6
+ */
+struct _GstH264FramePacking
+{
+ guint32 frame_packing_id;
+ guint8 frame_packing_cancel_flag;
+ guint8 frame_packing_type; /* GstH264FramePackingType */
+ guint8 quincunx_sampling_flag;
+ guint8 content_interpretation_type;
+ guint8 spatial_flipping_flag;
+ guint8 frame0_flipped_flag;
+ guint8 field_views_flag;
+ guint8 current_frame_is_frame0_flag;
+ guint8 frame0_self_contained_flag;
+ guint8 frame1_self_contained_flag;
+ guint8 frame0_grid_position_x;
+ guint8 frame0_grid_position_y;
+ guint8 frame1_grid_position_x;
+ guint8 frame1_grid_position_y;
+ guint16 frame_packing_repetition_period;
+};
+
+/**
+ * GstH264StereoVideoInfo:
+ *
+ * Since: 1.6
+ */
+struct _GstH264StereoVideoInfo
+{
+ guint8 field_views_flag;
+ guint8 top_field_is_left_view_flag;
+ guint8 current_frame_is_left_view_flag;
+ guint8 next_frame_is_second_view_flag;
+ guint8 left_view_self_contained_flag;
+ guint8 right_view_self_contained_flag;
+};
+
+/**
+ * GstH264PicTiming:
+ * @CpbDpbDelaysPresentFlag: non-zero if linked
+ * GstH264VUIParams::nal_hrd_parameters_present_flag or
+ * GstH264VUIParams::vcl_hrd_parameters_present_flag is non-zero (Since: 1.18)
+ * @cpb_removal_delay_length_minus1: specifies the length of @cpb_removal_delay
+ * in bits (Since 1.18)
+ * @dpb_output_delay_length_minus1: specifies the length of @dpb_output_delay
+ * in bits (Since 1.18)
+ * @cpb_removal_delay: specifies how many clock ticks to wait after removal from
+ * the CPB of the access unit associated with the most recent buffering period
+ * SEI message in a preceding access unit before removing from the
+ * buffer the access unit data associated with the picture timing SEI message
+ * @dpb_output_delay: used to compute the DPB output time of the picture
+ * @pic_struct_present_flag: GstH264VUIParams::pic_struct_present_flag
+ * @pic_struct: indicates whether a picture should be displayed as a frame or
+ * one or more fields
+ * @clock_timestamp_flag: equal to 1 indicates that a number of clock timestamp
+ * syntax elements are present
+ * @clock_timestamp: a #GstH264ClockTimestamp
+ * @time_offset_length: specifies the length time_offset of
+ * #GstH264ClockTimestamp in bits (Since 1.18)
+ */
+struct _GstH264PicTiming
+{
+ /* from vui */
+ guint8 CpbDpbDelaysPresentFlag;
+ /* if CpbDpbDelaysPresentFlag */
+ guint8 cpb_removal_delay_length_minus1;
+ guint8 dpb_output_delay_length_minus1;
+ guint32 cpb_removal_delay;
+ guint32 dpb_output_delay;
+
+ guint8 pic_struct_present_flag;
+ /* if pic_struct_present_flag */
+ guint8 pic_struct;
+
+ guint8 clock_timestamp_flag[3];
+ GstH264ClockTimestamp clock_timestamp[3];
+ guint8 time_offset_length;
+};
+
+/**
+ * GstH264RegisteredUserData:
+ * The User data registered by Rec. ITU-T T.35 SEI messag.
+ * @country_code: an itu_t_t35_country_code.
+ * @country_code_extension: an itu_t_t35_country_code_extension_byte.
+ * Should be ignored when @country_code is not 0xff
+ * @data: the data of itu_t_t35_payload_byte
+ * excluding @country_code and @country_code_extension
+ * @size: the size of @data in bytes
+ *
+ * Since: 1.16
+ */
+struct _GstH264RegisteredUserData
+{
+ guint8 country_code;
+ guint8 country_code_extension;
+ const guint8 *data;
+ guint size;
+};
+
+struct _GstH264BufferingPeriod
+{
+ GstH264SPS *sps;
+
+ /* seq->vui_parameters->nal_hrd_parameters_present_flag */
+ guint32 nal_initial_cpb_removal_delay[32];
+ guint32 nal_initial_cpb_removal_delay_offset[32];
+
+ /* seq->vui_parameters->vcl_hrd_parameters_present_flag */
+ guint32 vcl_initial_cpb_removal_delay[32];
+ guint32 vcl_initial_cpb_removal_delay_offset[32];
+};
+
+struct _GstH264RecoveryPoint
+{
+ guint32 recovery_frame_cnt;
+ guint8 exact_match_flag;
+ guint8 broken_link_flag;
+ guint8 changing_slice_group_idc;
+};
+
+/**
+ * GstH264MasteringDisplayColourVolume:
+ * The colour volume (primaries, white point and luminance range) of display
+ * defined by SMPTE ST 2086.
+ *
+ * D.2.29
+ *
+ * Since: 1.18
+ */
+struct _GstH264MasteringDisplayColourVolume
+{
+ guint16 display_primaries_x[3];
+ guint16 display_primaries_y[3];
+ guint16 white_point_x;
+ guint16 white_point_y;
+ guint32 max_display_mastering_luminance;
+ guint32 min_display_mastering_luminance;
+};
+
+/**
+ * GstH264ContentLightLevel:
+ * The upper bounds for the nominal target brightness light level
+ * as specified in CEA-861.3
+ *
+ * D.2.31
+ *
+ * Since: 1.18
+ */
+struct _GstH264ContentLightLevel
+{
+ guint16 max_content_light_level;
+ guint16 max_pic_average_light_level;
+};
+
+/**
+ * GstH264SEIUnhandledPayload:
+ * @payloadType: Payload type
+ * @data: payload raw data excluding payload type and payload size byte
+ * @size: the size of @data
+ *
+ * Contains unhandled SEI payload data. This SEI may or may not
+ * be defined by spec
+ *
+ * Since: 1.18
+ */
+struct _GstH264SEIUnhandledPayload
+{
+ guint payloadType;
+
+ guint8 *data;
+ guint size;
+};
+
+struct _GstH264SEIMessage
+{
+ GstH264SEIPayloadType payloadType;
+
+ union {
+ GstH264BufferingPeriod buffering_period;
+ GstH264PicTiming pic_timing;
+ GstH264RegisteredUserData registered_user_data;
+ GstH264RecoveryPoint recovery_point;
+ GstH264StereoVideoInfo stereo_video_info;
+ GstH264FramePacking frame_packing;
+ GstH264MasteringDisplayColourVolume mastering_display_colour_volume;
+ GstH264ContentLightLevel content_light_level;
+ GstH264SEIUnhandledPayload unhandled_payload;
+ /* ... could implement more */
+ } payload;
+};
+
+/**
+ * GstH264NalParser:
+ *
+ * H264 NAL Parser (opaque structure).
+ */
+struct _GstH264NalParser
+{
+ /*< private >*/
+ GstH264SPS sps[GST_H264_MAX_SPS_COUNT];
+ GstH264PPS pps[GST_H264_MAX_PPS_COUNT];
+ GstH264SPS *last_sps;
+ GstH264PPS *last_pps;
+};
+
+GST_CODEC_PARSERS_API
+GstH264NalParser *gst_h264_nal_parser_new (void);
+
+GST_CODEC_PARSERS_API
+GstH264ParserResult gst_h264_parser_identify_nalu (GstH264NalParser *nalparser,
+ const guint8 *data, guint offset,
+ gsize size, GstH264NalUnit *nalu);
+
+GST_CODEC_PARSERS_API
+GstH264ParserResult gst_h264_parser_identify_nalu_unchecked (GstH264NalParser *nalparser,
+ const guint8 *data, guint offset,
+ gsize size, GstH264NalUnit *nalu);
+
+GST_CODEC_PARSERS_API
+GstH264ParserResult gst_h264_parser_identify_nalu_avc (GstH264NalParser *nalparser, const guint8 *data,
+ guint offset, gsize size, guint8 nal_length_size,
+ GstH264NalUnit *nalu);
+
+GST_CODEC_PARSERS_API
+GstH264ParserResult gst_h264_parser_parse_nal (GstH264NalParser *nalparser,
+ GstH264NalUnit *nalu);
+
+GST_CODEC_PARSERS_API
+GstH264ParserResult gst_h264_parser_parse_slice_hdr (GstH264NalParser *nalparser, GstH264NalUnit *nalu,
+ GstH264SliceHdr *slice, gboolean parse_pred_weight_table,
+ gboolean parse_dec_ref_pic_marking);
+
+GST_CODEC_PARSERS_API
+GstH264ParserResult gst_h264_parser_parse_subset_sps (GstH264NalParser *nalparser, GstH264NalUnit *nalu,
+ GstH264SPS *sps);
+
+GST_CODEC_PARSERS_API
+GstH264ParserResult gst_h264_parser_parse_sps (GstH264NalParser *nalparser, GstH264NalUnit *nalu,
+ GstH264SPS *sps);
+
+GST_CODEC_PARSERS_API
+GstH264ParserResult gst_h264_parser_parse_pps (GstH264NalParser *nalparser,
+ GstH264NalUnit *nalu, GstH264PPS *pps);
+
+GST_CODEC_PARSERS_API
+GstH264ParserResult gst_h264_parser_parse_sei (GstH264NalParser *nalparser,
+ GstH264NalUnit *nalu, GArray ** messages);
+
+GST_CODEC_PARSERS_API
+GstH264ParserResult gst_h264_parser_update_sps (GstH264NalParser *nalparser,
+ GstH264SPS *sps);
+
+GST_CODEC_PARSERS_API
+GstH264ParserResult gst_h264_parser_update_pps (GstH264NalParser *nalparser,
+ GstH264PPS *pps);
+
+GST_CODEC_PARSERS_API
+void gst_h264_nal_parser_free (GstH264NalParser *nalparser);
+
+GST_CODEC_PARSERS_API
+GstH264ParserResult gst_h264_parse_subset_sps (GstH264NalUnit *nalu,
+ GstH264SPS *sps);
+
+GST_CODEC_PARSERS_API
+GstH264ParserResult gst_h264_parse_sps (GstH264NalUnit *nalu,
+ GstH264SPS *sps);
+
+GST_CODEC_PARSERS_API
+GstH264ParserResult gst_h264_parse_pps (GstH264NalParser *nalparser,
+ GstH264NalUnit *nalu, GstH264PPS *pps);
+
+GST_CODEC_PARSERS_API
+void gst_h264_sps_clear (GstH264SPS *sps);
+
+GST_CODEC_PARSERS_API
+void gst_h264_pps_clear (GstH264PPS *pps);
+
+GST_CODEC_PARSERS_API
+void gst_h264_sei_clear (GstH264SEIMessage *sei);
+
+GST_CODEC_PARSERS_API
+void gst_h264_quant_matrix_8x8_get_zigzag_from_raster (guint8 out_quant[64],
+ const guint8 quant[64]);
+
+GST_CODEC_PARSERS_API
+void gst_h264_quant_matrix_8x8_get_raster_from_zigzag (guint8 out_quant[64],
+ const guint8 quant[64]);
+
+GST_CODEC_PARSERS_API
+void gst_h264_quant_matrix_4x4_get_zigzag_from_raster (guint8 out_quant[16],
+ const guint8 quant[16]);
+
+GST_CODEC_PARSERS_API
+void gst_h264_quant_matrix_4x4_get_raster_from_zigzag (guint8 out_quant[16],
+ const guint8 quant[16]);
+
+GST_CODEC_PARSERS_API
+void gst_h264_video_calculate_framerate (const GstH264SPS * sps, guint field_pic_flag,
+ guint pic_struct, gint * fps_num, gint * fps_den);
+
+GST_CODEC_PARSERS_API
+GstMemory * gst_h264_create_sei_memory (guint8 start_code_prefix_length,
+ GArray * messages);
+
+GST_CODEC_PARSERS_API
+GstMemory * gst_h264_create_sei_memory_avc (guint8 nal_length_size,
+ GArray * messages);
+
+GST_CODEC_PARSERS_API
+GstBuffer * gst_h264_parser_insert_sei (GstH264NalParser * nalparser,
+ GstBuffer * au,
+ GstMemory * sei);
+
+GST_CODEC_PARSERS_API
+GstBuffer * gst_h264_parser_insert_sei_avc (GstH264NalParser * nalparser,
+ guint8 nal_length_size,
+ GstBuffer * au,
+ GstMemory * sei);
+
+G_END_DECLS
+
+#endif
diff --git a/include/gst/codecparsers/gsth265parser.h b/include/gst/codecparsers/gsth265parser.h
new file mode 100644
index 0000000000..0d80c19b36
--- /dev/null
+++ b/include/gst/codecparsers/gsth265parser.h
@@ -0,0 +1,1815 @@
+/* Gstreamer H.265 bitstream parser
+ * Copyright (C) 2013 Intel Corporation
+ * Copyright (C) 2013 Sreerenj Balachandran <sreerenj.balachandran@intel.com>
+ *
+ * Contact: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_H265_PARSER_H__
+#define __GST_H265_PARSER_H__
+
+#ifndef GST_USE_UNSTABLE_API
+#warning "The H.265 parsing library is unstable API and may change in future."
+#warning "You can define GST_USE_UNSTABLE_API to avoid this warning."
+#endif
+
+#include <gst/gst.h>
+#include <gst/codecparsers/codecparsers-prelude.h>
+
+G_BEGIN_DECLS
+
+#define GST_H265_MAX_SUB_LAYERS 8
+#define GST_H265_MAX_VPS_COUNT 16
+#define GST_H265_MAX_SPS_COUNT 16
+#define GST_H265_MAX_PPS_COUNT 64
+
+#define GST_H265_IS_B_SLICE(slice) ((slice)->type == GST_H265_B_SLICE)
+#define GST_H265_IS_P_SLICE(slice) ((slice)->type == GST_H265_P_SLICE)
+#define GST_H265_IS_I_SLICE(slice) ((slice)->type == GST_H265_I_SLICE)
+
+/**
+ * GST_H265_IS_NAL_TYPE_IDR:
+ * @nal_type: a #GstH265NalUnitType
+ *
+ * Check whether @nal_type is IDR or not
+ *
+ * Since: 1.18
+ */
+#define GST_H265_IS_NAL_TYPE_IDR(nal_type) \
+ ((nal_type) == GST_H265_NAL_SLICE_IDR_W_RADL || (nal_type) == GST_H265_NAL_SLICE_IDR_N_LP)
+
+/**
+ * GST_H265_IS_NAL_TYPE_IRAP:
+ * @nal_type: a #GstH265NalUnitType
+ *
+ * Check whether @nal_type is IRAP or not
+ *
+ * Since: 1.18
+ */
+#define GST_H265_IS_NAL_TYPE_IRAP(nal_type) \
+ ((nal_type) >= GST_H265_NAL_SLICE_BLA_W_LP && (nal_type) <= RESERVED_IRAP_NAL_TYPE_MAX)
+
+/**
+ * GST_H265_IS_NAL_TYPE_BLA:
+ * @nal_type: a #GstH265NalUnitType
+ *
+ * Check whether @nal_type is BLA or not
+ *
+ * Since: 1.18
+ */
+#define GST_H265_IS_NAL_TYPE_BLA(nal_type) \
+ ((nal_type) >= GST_H265_NAL_SLICE_BLA_W_LP && (nal_type) <= GST_H265_NAL_SLICE_BLA_N_LP)
+
+/**
+ * GST_H265_IS_NAL_TYPE_CRA:
+ * @nal_type: a #GstH265NalUnitType
+ *
+ * Check whether @nal_type is CRA or not
+ *
+ * Since: 1.18
+ */
+#define GST_H265_IS_NAL_TYPE_CRA(nal_type) \
+ ((nal_type) == GST_H265_NAL_SLICE_CRA_NUT)
+
+/**
+ * GST_H265_IS_NAL_TYPE_RADL:
+ * @nal_type: a #GstH265NalUnitType
+ *
+ * Check whether @nal_type is RADL or not
+ *
+ * Since: 1.18
+ */
+#define GST_H265_IS_NAL_TYPE_RADL(nal_type) \
+ ((nal_type) == GST_H265_NAL_SLICE_RADL_N || (nal_type) == GST_H265_NAL_SLICE_RADL_R)
+
+/**
+ * GST_H265_IS_NAL_TYPE_RASL:
+ * @nal_type: a #GstH265NalUnitType
+ *
+ * Check whether @nal_type is RASL or not
+ *
+ * Since: 1.18
+ */
+#define GST_H265_IS_NAL_TYPE_RASL(nal_type) \
+ ((nal_type) == GST_H265_NAL_SLICE_RASL_N || (nal_type) == GST_H265_NAL_SLICE_RASL_R)
+
+/**
+ * GstH265Profile:
+ * @GST_H265_PROFILE_MAIN: Main profile (A.3.2)
+ * @GST_H265_PROFILE_MAIN_10: Main 10 profile (A.3.3)
+ * @GST_H265_PROFILE_MAIN_STILL_PICTURE: Main Still Picture profile (A.3.4)
+ * @GST_H265_PROFILE_MONOCHROME: Monochrome profile (A.3.4)
+ * @GST_H265_PROFILE_MONOCHROME_12: Monochrome 12-bits profile (A.3.4)
+ * @GST_H265_PROFILE_MONOCHROME_16: Monochrome 16-bits profile (A.3.4)
+ * @GST_H265_PROFILE_MAIN_12: Main profile 12-bits (A.3.4)
+ * @GST_H265_PROFILE_MAIN_422_10: Main 4:2:2 profile 10-bits (A.3.4)
+ * @GST_H265_PROFILE_MAIN_422_12: Main 4:2:2 profile 12-bits (A.3.4)
+ * @GST_H265_PROFILE_MAIN_444: Main 4:4:4 profile (A.3.4)
+ * @GST_H265_PROFILE_MAIN_444_10: Main 4:4:4 10-bits profile (A.3.4)
+ * @GST_H265_PROFILE_MAIN_444_12: Main 4:4:4 12-bits profile (A.3.4)
+ * @GST_H265_PROFILE_MAIN_INTRA: Main Intra profile (A.3.4)
+ * @GST_H265_PROFILE_MAIN_10_INTRA: Main Intra 10-bits profile (A.3.4)
+ * @GST_H265_PROFILE_MAIN_12_INTRA: Main Intra 12-bits profile (A.3.4)
+ * @GST_H265_PROFILE_MAIN_422_10_INTRA: Main Intra 4:2:2 10-bits profile (A.3.4)
+ * @GST_H265_PROFILE_MAIN_422_12_INTRA: Main Intra 4:2:2 12-bits profile (A.3.4)
+ * @GST_H265_PROFILE_MAIN_444_INTRA: Main Intra 4:4:4 profile (A.3.4)
+ * @GST_H265_PROFILE_MAIN_444_10_INTRA: Main Intra 4:4:4 10-bits profile (A.3.4)
+ * @GST_H265_PROFILE_MAIN_444_12_INTRA: Main Intra 4:4:4 12-bits profile (A.3.4)
+ * @GST_H265_PROFILE_MAIN_444_16_INTRA: Main Intra 4:4:4 16-bits profile (A.3.4)
+ * @GST_H265_PROFILE_MAIN_444_STILL_PICTURE: Main 4:4:4 Still Picture profile (A.3.4)
+ * @GST_H265_PROFILE_MAIN_444_16_STILL_PICTURE: Main 4:4:4 16-bits Still Picture profile (A.3.4)
+ * @GST_H265_PROFILE_MONOCHROME_10: Monochrome 10-bits profile (A.3.5) (Since: 1.18)
+ * @GST_H265_PROFILE_HIGH_THROUGHPUT_444: High Throughput 4:4:4 profile (A.3.6) (Since: 1.18)
+ * @GST_H265_PROFILE_HIGH_THROUGHPUT_444_10: High Throughput 4:4:4 10-bits profile (A.3.6) (Since: 1.18)
+ * @GST_H265_PROFILE_HIGH_THROUGHPUT_444_14: High Throughput 4:4:4 14-bits profile (A.3.6) (Since: 1.18)
+ * @GST_H265_PROFILE_HIGH_THROUGHPUT_444_16_INTRA: High Throughput 4:4:4 16-bits Intra profile (A.3.6) (Since: 1.18)
+ * @GST_H265_PROFILE_SCREEN_EXTENDED_MAIN: Screen-Extended Main profile (A.3.7) (Since: 1.18)
+ * @GST_H265_PROFILE_SCREEN_EXTENDED_MAIN_10: Screen-Extended Main 10-bits profile (A.3.7) (Since: 1.18)
+ * @GST_H265_PROFILE_SCREEN_EXTENDED_MAIN_444: Screen-Extended Main 4:4:4 profile (A.3.7) (Since: 1.18)
+ * @GST_H265_PROFILE_SCREEN_EXTENDED_MAIN_444_10: Screen-Extended Main 4:4:4 10-bits profile (A.3.7) (Since: 1.18)
+ * @GST_H265_PROFILE_SCREEN_EXTENDED_HIGH_THROUGHPUT_444: Screen-Extended High Throughput 4:4:4 profile (A.3.7) (Since: 1.18)
+ * @GST_H265_PROFILE_SCREEN_EXTENDED_HIGH_THROUGHPUT_444_10: Screen-Extended High Throughput 4:4:4 10-bits profile (A.3.7) (Since: 1.18)
+ * @GST_H265_PROFILE_SCREEN_EXTENDED_HIGH_THROUGHPUT_444_14: Screen-Extended High Throughput 4:4:4 14-bits profile (A.3.7) (Since: 1.18)
+ * @GST_H265_PROFILE_MULTIVIEW_MAIN: Multiview Main profile (G.11.1) (Since: 1.18)
+ * @GST_H265_PROFILE_SCALABLE_MAIN: Scalable Main profile (H.11.1) (Since: 1.18)
+ * @GST_H265_PROFILE_SCALABLE_MAIN_10: Scalable Main 10-bits profile (H.11.1) (Since: 1.18)
+ * @GST_H265_PROFILE_SCALABLE_MONOCHROME: Scalable Monochrome profile (H.11.1) (Since: 1.18)
+ * @GST_H265_PROFILE_SCALABLE_MONOCHROME_12: Scalable Monochrome 12-bits profile (H.11.1) (Since: 1.18)
+ * @GST_H265_PROFILE_SCALABLE_MONOCHROME_16: Scalable Monochrome 16-bits profile (H.11.1) (Since: 1.18)
+ * @GST_H265_PROFILE_SCALABLE_MAIN_444: Scalable Main 4:4:4 profile (H.11.1) (Since: 1.18)
+ * @GST_H265_PROFILE_3D_MAIN: 3D Main 4:4:4 profile (I.11.1) (Since: 1.18)
+ *
+ * H.265 Profiles.
+ *
+ */
+typedef enum {
+ GST_H265_PROFILE_INVALID = -1,
+ GST_H265_PROFILE_MAIN = 1,
+ GST_H265_PROFILE_MAIN_10 = 2,
+ GST_H265_PROFILE_MAIN_STILL_PICTURE = 3,
+ GST_H265_PROFILE_MONOCHROME,
+ GST_H265_PROFILE_MONOCHROME_12,
+ GST_H265_PROFILE_MONOCHROME_16,
+ GST_H265_PROFILE_MAIN_12,
+ GST_H265_PROFILE_MAIN_422_10,
+ GST_H265_PROFILE_MAIN_422_12,
+ GST_H265_PROFILE_MAIN_444,
+ GST_H265_PROFILE_MAIN_444_10,
+ GST_H265_PROFILE_MAIN_444_12,
+ GST_H265_PROFILE_MAIN_INTRA,
+ GST_H265_PROFILE_MAIN_10_INTRA,
+ GST_H265_PROFILE_MAIN_12_INTRA,
+ GST_H265_PROFILE_MAIN_422_10_INTRA,
+ GST_H265_PROFILE_MAIN_422_12_INTRA,
+ GST_H265_PROFILE_MAIN_444_INTRA,
+ GST_H265_PROFILE_MAIN_444_10_INTRA,
+ GST_H265_PROFILE_MAIN_444_12_INTRA,
+ GST_H265_PROFILE_MAIN_444_16_INTRA,
+ GST_H265_PROFILE_MAIN_444_STILL_PICTURE,
+ GST_H265_PROFILE_MAIN_444_16_STILL_PICTURE,
+ GST_H265_PROFILE_MONOCHROME_10,
+ GST_H265_PROFILE_HIGH_THROUGHPUT_444,
+ GST_H265_PROFILE_HIGH_THROUGHPUT_444_10,
+ GST_H265_PROFILE_HIGH_THROUGHPUT_444_14,
+ GST_H265_PROFILE_HIGH_THROUGHPUT_444_16_INTRA,
+ GST_H265_PROFILE_SCREEN_EXTENDED_MAIN,
+ GST_H265_PROFILE_SCREEN_EXTENDED_MAIN_10,
+ GST_H265_PROFILE_SCREEN_EXTENDED_MAIN_444,
+ GST_H265_PROFILE_SCREEN_EXTENDED_MAIN_444_10,
+ GST_H265_PROFILE_SCREEN_EXTENDED_HIGH_THROUGHPUT_444,
+ GST_H265_PROFILE_SCREEN_EXTENDED_HIGH_THROUGHPUT_444_10,
+ GST_H265_PROFILE_SCREEN_EXTENDED_HIGH_THROUGHPUT_444_14,
+ GST_H265_PROFILE_MULTIVIEW_MAIN,
+ GST_H265_PROFILE_SCALABLE_MAIN,
+ GST_H265_PROFILE_SCALABLE_MAIN_10,
+ GST_H265_PROFILE_SCALABLE_MONOCHROME,
+ GST_H265_PROFILE_SCALABLE_MONOCHROME_12,
+ GST_H265_PROFILE_SCALABLE_MONOCHROME_16,
+ GST_H265_PROFILE_SCALABLE_MAIN_444,
+ GST_H265_PROFILE_3D_MAIN,
+
+ /* end of the profiles */
+ GST_H265_PROFILE_MAX
+} GstH265Profile;
+
+/**
+ * GstH265ProfileIDC:
+ * @GST_H265_PROFILE_IDC_MAIN: Main profile (A.3.2)
+ * @GST_H265_PROFILE_IDC_MAIN_10: Main 10 profile (A.3.3)
+ * @GST_H265_PROFILE_IDC_MAIN_STILL_PICTURE: Main Still Picture profile (A.3.4)
+ * @GST_H265_PROFILE_IDC_FORMAT_RANGE_EXTENSION: Format range extensions profile (A.3.5)
+ * @GST_H265_PROFILE_IDC_HIGH_THROUGHPUT: High throughput profiles (A.3.6)
+ * @GST_H265_PROFILE_IDC_MULTIVIEW_MAIN: Multiview Main profiles (G.11.1) (Since: 1.18)
+ * @GST_H265_PROFILE_IDC_SCALABLE_MAIN: Scalable Main and Scalable Main 10 profile (H.11.1) (Since: 1.18)
+ * @GST_H265_PROFILE_IDC_SCREEN_CONTENT_CODING: Screen content coding extensions profiles (A.3.7)
+ * @GST_H265_PROFILE_IDC_3D_MAIN: 3D Main profile (I.11.1) (Since: 1.18)
+ * @GST_H265_PROFILE_IDC_SCALABLE_FORMAT_RANGE_EXTENSION: Scalable Format range extensions profiles (H.11.1) (Since: 1.18)
+ * @GST_H265_PROFILE_IDC_HIGH_THROUGHPUT_SCREEN_CONTENT_CODING_EXTENSION: High throughput screen content coding extensions profiles (A.3.8) (Since: 1.18)
+ *
+ * Valid values for the profile_idc field. This is different from
+ * #GstH265Profile as an extension idc can be used to encode a whole variety of
+ * profiles.
+ *
+ */
+typedef enum {
+ GST_H265_PROFILE_IDC_MAIN = 1,
+ GST_H265_PROFILE_IDC_MAIN_10 = 2,
+ GST_H265_PROFILE_IDC_MAIN_STILL_PICTURE = 3,
+ GST_H265_PROFILE_IDC_FORMAT_RANGE_EXTENSION = 4,
+ GST_H265_PROFILE_IDC_HIGH_THROUGHPUT = 5,
+ GST_H265_PROFILE_IDC_MULTIVIEW_MAIN = 6,
+ GST_H265_PROFILE_IDC_SCALABLE_MAIN = 7,
+ GST_H265_PROFILE_IDC_3D_MAIN = 8,
+ GST_H265_PROFILE_IDC_SCREEN_CONTENT_CODING = 9,
+ GST_H265_PROFILE_IDC_SCALABLE_FORMAT_RANGE_EXTENSION = 10,
+ GST_H265_PROFILE_IDC_HIGH_THROUGHPUT_SCREEN_CONTENT_CODING_EXTENSION = 11,
+} GstH265ProfileIDC;
+
+/**
+ * GstH265NalUnitType:
+ * @GST_H265_NAL_SLICE_TRAIL_N: Slice nal of a non-TSA, non-STSA trailing picture
+ * @GST_H265_NAL_SLICE_TRAIL_R: Slice nal of a non-TSA, non-STSA trailing picture
+ * @GST_H265_NAL_SLICE_TSA_N: Slice nal of a TSA picture
+ * @GST_H265_NAL_SLICE_TSA_R: Slice nal of a TSA picture
+ * @GST_H265_NAL_SLICE_STSA_N: Slice nal of a STSA picture
+ * @GST_H265_NAL_SLICE_STSA_R: Slice nal of a STSA picture
+ * @GST_H265_NAL_SLICE_RADL_N: Slice nal of a RADL picture
+ * @GST_H265_NAL_SLICE_RADL_R: Slice nal of a RADL piicture
+ * @GST_H265_NAL_SLICE_RASL_N: Slice nal of a RASL picture
+ * @GST_H265_NAL_SLICE_RASL_R: Slice nal of a RASL picture
+ * @GST_H265_NAL_SLICE_BLA_W_LP: Slice nal of a BLA picture
+ * @GST_H265_NAL_SLICE_BLA_W_RADL: Slice nal of a BLA picture
+ * @GST_H265_NAL_SLICE_BLA_N_LP: Slice nal of a BLA picture
+ * @GST_H265_NAL_SLICE_IDR_W_RADL: Slice nal of an IDR picture
+ * @GST_H265_NAL_SLICE_IDR_N_LP: Slice nal of an IDR picture
+ * @GST_H265_NAL_SLICE_CRA_NUT: Slice nal of a CRA picture
+ * @GST_H265_NAL_VPS: Video parameter set(VPS) nal unit
+ * @GST_H265_NAL_SPS: Sequence parameter set (SPS) nal unit
+ * @GST_H265_NAL_PPS: Picture parameter set (PPS) nal unit
+ * @GST_H265_NAL_AUD: Access unit (AU) delimiter nal unit
+ * @GST_H265_NAL_EOS: End of sequence (EOS) nal unit
+ * @GST_H265_NAL_EOB: End of bitstream (EOB) nal unit
+ * @GST_H265_NAL_FD: Filler data (FD) nal lunit
+ * @GST_H265_NAL_PREFIX_SEI: Supplemental enhancement information prefix nal unit
+ * @GST_H265_NAL_SUFFIX_SEI: Suppliemental enhancement information suffix nal unit
+ *
+ * Indicates the type of H265 Nal Units
+ */
+typedef enum
+{
+ GST_H265_NAL_SLICE_TRAIL_N = 0,
+ GST_H265_NAL_SLICE_TRAIL_R = 1,
+ GST_H265_NAL_SLICE_TSA_N = 2,
+ GST_H265_NAL_SLICE_TSA_R = 3,
+ GST_H265_NAL_SLICE_STSA_N = 4,
+ GST_H265_NAL_SLICE_STSA_R = 5,
+ GST_H265_NAL_SLICE_RADL_N = 6,
+ GST_H265_NAL_SLICE_RADL_R = 7,
+ GST_H265_NAL_SLICE_RASL_N = 8,
+ GST_H265_NAL_SLICE_RASL_R = 9,
+ GST_H265_NAL_SLICE_BLA_W_LP = 16,
+ GST_H265_NAL_SLICE_BLA_W_RADL = 17,
+ GST_H265_NAL_SLICE_BLA_N_LP = 18,
+ GST_H265_NAL_SLICE_IDR_W_RADL = 19,
+ GST_H265_NAL_SLICE_IDR_N_LP = 20,
+ GST_H265_NAL_SLICE_CRA_NUT = 21,
+ GST_H265_NAL_VPS = 32,
+ GST_H265_NAL_SPS = 33,
+ GST_H265_NAL_PPS = 34,
+ GST_H265_NAL_AUD = 35,
+ GST_H265_NAL_EOS = 36,
+ GST_H265_NAL_EOB = 37,
+ GST_H265_NAL_FD = 38,
+ GST_H265_NAL_PREFIX_SEI = 39,
+ GST_H265_NAL_SUFFIX_SEI = 40
+} GstH265NalUnitType;
+
+#define RESERVED_NON_IRAP_SUBLAYER_NAL_TYPE_MIN 10
+#define RESERVED_NON_IRAP_SUBLAYER_NAL_TYPE_MAX 15
+
+#define RESERVED_IRAP_NAL_TYPE_MIN 22
+#define RESERVED_IRAP_NAL_TYPE_MAX 23
+
+#define RESERVED_NON_IRAP_NAL_TYPE_MIN 24
+#define RESERVED_NON_IRAP_NAL_TYPE_MAX 31
+
+#define RESERVED_NON_VCL_NAL_TYPE_MIN 41
+#define RESERVED_NON_VCL_NAL_TYPE_MAX 47
+
+#define UNSPECIFIED_NON_VCL_NAL_TYPE_MIN 48
+#define UNSPECIFIED_NON_VCL_NAL_TYPE_MAX 63
+
+/**
+ * GstH265ParserResult:
+ * @GST_H265_PARSER_OK: The parsing succeeded
+ * @GST_H265_PARSER_BROKEN_DATA: The data to parse is broken
+ * @GST_H265_PARSER_BROKEN_LINK: The link to structure needed for the parsing couldn't be found
+ * @GST_H265_PARSER_ERROR: An error accured when parsing
+ * @GST_H265_PARSER_NO_NAL: No nal found during the parsing
+ * @GST_H265_PARSER_NO_NAL_END: Start of the nal found, but not the end.
+ *
+ * The result of parsing H265 data.
+ */
+typedef enum
+{
+ GST_H265_PARSER_OK,
+ GST_H265_PARSER_BROKEN_DATA,
+ GST_H265_PARSER_BROKEN_LINK,
+ GST_H265_PARSER_ERROR,
+ GST_H265_PARSER_NO_NAL,
+ GST_H265_PARSER_NO_NAL_END
+} GstH265ParserResult;
+
+/**
+ * GstH265SEIPayloadType:
+ * @GST_H265_SEI_BUF_PERIOD: Buffering Period SEI Message
+ * @GST_H265_SEI_PIC_TIMING: Picture Timing SEI Message
+ * @GST_H265_SEI_REGISTERED_USER_DATA: Registered user data (D.2.5)
+ * @GST_H265_SEI_RECOVERY_POINT: Recovery Point SEI Message (D.3.8)
+ * @GST_H265_SEI_TIME_CODE: Time code SEI message (D.2.27) (Since: 1.16)
+ * @GST_H265_SEI_MASTERING_DISPLAY_COLOUR_VOLUME: Mastering display colour volume information SEI message (D.2.28) (Since: 1.18)
+ * @GST_H265_SEI_CONTENT_LIGHT_LEVEL: Content light level information SEI message (D.2.35) (Since: 1.18)
+ * ...
+ *
+ * The type of SEI message.
+ */
+typedef enum
+{
+ GST_H265_SEI_BUF_PERIOD = 0,
+ GST_H265_SEI_PIC_TIMING = 1,
+ GST_H265_SEI_REGISTERED_USER_DATA = 4,
+ GST_H265_SEI_RECOVERY_POINT = 6,
+ GST_H265_SEI_TIME_CODE = 136,
+ GST_H265_SEI_MASTERING_DISPLAY_COLOUR_VOLUME = 137,
+ GST_H265_SEI_CONTENT_LIGHT_LEVEL = 144,
+ /* and more... */
+} GstH265SEIPayloadType;
+
+/**
+ * GstH265SEIPicStructType:
+ * @GST_H265_SEI_PIC_STRUCT_FRAME: Picture is a frame
+ * @GST_H265_SEI_PIC_STRUCT_TOP_FIELD: Top field of frame
+ * @GST_H265_SEI_PIC_STRUCT_BOTTOM_FIELD: Botom field of frame
+ * @GST_H265_SEI_PIC_STRUCT_TOP_BOTTOM: Top bottom field of frame
+ * @GST_H265_SEI_PIC_STRUCT_BOTTOM_TOP: bottom top field of frame
+ * @GST_H265_SEI_PIC_STRUCT_TOP_BOTTOM_TOP: top bottom top field of frame
+ * @GST_H265_SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM: bottom top bottom field of frame
+ * @GST_H265_SEI_PIC_STRUCT_FRAME_DOUBLING: indicates that the frame should
+ * be displayed two times consecutively
+ * @GST_H265_SEI_PIC_STRUCT_FRAME_TRIPLING: indicates that the frame should be
+ * displayed three times consecutively
+ * @GST_H265_SEI_PIC_STRUCT_TOP_PAIRED_PREVIOUS_BOTTOM: top field paired with
+ * previous bottom field in output order
+ * @GST_H265_SEI_PIC_STRUCT_BOTTOM_PAIRED_PREVIOUS_TOP: bottom field paried with
+ * previous top field in output order
+ * @GST_H265_SEI_PIC_STRUCT_TOP_PAIRED_NEXT_BOTTOM: top field paired with next
+ * bottom field in output order
+ * @GST_H265_SEI_PIC_STRUCT_BOTTOM_PAIRED_NEXT_TOP: bottom field paired with
+ * next top field in output order
+ *
+ * SEI pic_struct type
+ */
+typedef enum
+{
+ GST_H265_SEI_PIC_STRUCT_FRAME = 0,
+ GST_H265_SEI_PIC_STRUCT_TOP_FIELD = 1,
+ GST_H265_SEI_PIC_STRUCT_BOTTOM_FIELD = 2,
+ GST_H265_SEI_PIC_STRUCT_TOP_BOTTOM = 3,
+ GST_H265_SEI_PIC_STRUCT_BOTTOM_TOP = 4,
+ GST_H265_SEI_PIC_STRUCT_TOP_BOTTOM_TOP = 5,
+ GST_H265_SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM = 6,
+ GST_H265_SEI_PIC_STRUCT_FRAME_DOUBLING = 7,
+ GST_H265_SEI_PIC_STRUCT_FRAME_TRIPLING = 8,
+ GST_H265_SEI_PIC_STRUCT_TOP_PAIRED_PREVIOUS_BOTTOM = 9,
+ GST_H265_SEI_PIC_STRUCT_BOTTOM_PAIRED_PREVIOUS_TOP = 10,
+ GST_H265_SEI_PIC_STRUCT_TOP_PAIRED_NEXT_BOTTOM = 11,
+ GST_H265_SEI_PIC_STRUCT_BOTTOM_PAIRED_NEXT_TOP = 12
+} GstH265SEIPicStructType;
+
+/**
+ * GstH265SliceType:
+ *
+ * Type of Picture slice
+ */
+
+typedef enum
+{
+ GST_H265_B_SLICE = 0,
+ GST_H265_P_SLICE = 1,
+ GST_H265_I_SLICE = 2
+} GstH265SliceType;
+
+typedef enum
+{
+ GST_H265_QUANT_MATIX_4X4 = 0,
+ GST_H265_QUANT_MATIX_8X8 = 1,
+ GST_H265_QUANT_MATIX_16X16 = 2,
+ GST_H265_QUANT_MATIX_32X32 = 3
+} GstH265QuantMatrixSize;
+
+typedef struct _GstH265Parser GstH265Parser;
+
+typedef struct _GstH265NalUnit GstH265NalUnit;
+
+typedef struct _GstH265VPS GstH265VPS;
+typedef struct _GstH265SPS GstH265SPS;
+typedef struct _GstH265PPS GstH265PPS;
+typedef struct _GstH265ProfileTierLevel GstH265ProfileTierLevel;
+typedef struct _GstH265SubLayerHRDParams GstH265SubLayerHRDParams;
+typedef struct _GstH265HRDParams GstH265HRDParams;
+typedef struct _GstH265VUIParams GstH265VUIParams;
+typedef struct _GstH265SPSExtensionParams GstH265SPSExtensionParams;
+typedef struct _GstH265SPSSccExtensionParams GstH265SPSSccExtensionParams;
+typedef struct _GstH265PPSExtensionParams GstH265PPSExtensionParams;
+typedef struct _GstH265PPSSccExtensionParams GstH265PPSSccExtensionParams;
+
+typedef struct _GstH265ScalingList GstH265ScalingList;
+typedef struct _GstH265RefPicListModification GstH265RefPicListModification;
+typedef struct _GstH265PredWeightTable GstH265PredWeightTable;
+typedef struct _GstH265ShortTermRefPicSet GstH265ShortTermRefPicSet;
+typedef struct _GstH265SliceHdr GstH265SliceHdr;
+
+typedef struct _GstH265PicTiming GstH265PicTiming;
+typedef struct _GstH265RegisteredUserData GstH265RegisteredUserData;
+typedef struct _GstH265BufferingPeriod GstH265BufferingPeriod;
+typedef struct _GstH265RecoveryPoint GstH265RecoveryPoint;
+typedef struct _GstH265TimeCode GstH265TimeCode;
+typedef struct _GstH265MasteringDisplayColourVolume GstH265MasteringDisplayColourVolume;
+typedef struct _GstH265ContentLightLevel GstH265ContentLightLevel;
+typedef struct _GstH265SEIMessage GstH265SEIMessage;
+
+/**
+ * GstH265NalUnit:
+ * @type: A #GstH265NalUnitType
+ * @layer_id: A nal unit layer id
+ * @temporal_id_plus1: A nal unit temporal identifier
+ * @size: The size of the nal unit starting from @offset
+ * @offset: The offset of the actual start of the nal unit
+ * @sc_offset:The offset of the start code of the nal unit
+ * @valid: If the nal unit is valid, which mean it has
+ * already been parsed
+ * @data: The data from which the Nalu has been parsed
+ *
+ * Structure defining the Nal unit headers
+ */
+struct _GstH265NalUnit
+{
+ guint8 type;
+ guint8 layer_id;
+ guint8 temporal_id_plus1;
+
+ /* calculated values */
+ guint size;
+ guint offset;
+ guint sc_offset;
+ gboolean valid;
+
+ guint8 *data;
+ guint8 header_bytes;
+};
+
+/**
+ * GstH265ProfileTierLevel:
+ * @profile_space: specifies the context for the interpretation of
+ * general_profile_idc and general_profile_combatibility_flag
+ * @tier_flag: the tier context for the interpretation of general_level_idc
+ * @profile_idc: profile id
+ * @profile_compatibility_flag: compatibility flags
+ * @progressive_source_flag: flag to indicate the type of stream
+ * @interlaced_source_flag: flag to indicate the type of stream
+ * @non_packed_constraint_flag: indicate the presence of frame packing
+ * arrangement sei message
+ * @frame_only_constraint_flag: recognize the field_seq_flag
+ * @max_12bit_constraint_flag: used to define profile extensions, see Annex A
+ * @max_10bit_constraint_flag: used to define profile extensions, see Annex A
+ * @max_8bit_constraint_flag: used to define profile extensions, see Annex A
+ * @max_422chroma_constraint_flag: used to define profile extensions, see Annex A
+ * @max_420chroma_constraint_flag: used to define profile extensions, see Annex A
+ * @max_monochrome_constraint_flag: used to define profile extensions, see Annex A
+ * @intra_constraint_flag: used to define profile extensions, see Annex A
+ * @one_picture_only_constraint_flag: used to define profile extensions, see Annex A
+ * @lower_bit_rate_constraint_flag: used to define profile extensions, see Annex A
+ * @max_14bit_constraint_flag: used to define profile extensions, see Annex A
+ * @level idc: indicate the level which the CVS confirms
+ * @sub_layer_profile_present_flag: sublayer profile presence ind
+ * @sub_layer_level_present_flag:sublayer level presence indicator.
+ * @sub_layer_profile_space: profile space for sublayers
+ * @sub_layer_tier_flag: tier flags for sublayers.
+ * @sub_layer_profile_idc: conformant profile indicator for sublayers.
+ * @sub_layer_profile_compatibility_flag[6][32]: compatibility flags for sublayers
+ * @sub_layer_progressive_source_flag:progressive stream indicator for sublayer
+ * @sub_layer_interlaced_source_flag: interlaced stream indicator for sublayer
+ * @sub_layer_non_packed_constraint_flag: indicate the presence of
+ * frame packing arrangement sei message with in sublayers
+ * @sub_layer_frame_only_constraint_flag:recognize the sublayer
+ * specific field_seq_flag
+ * @sub_layer_level_idc:indicate the sublayer specific level
+ *
+ * Define ProfileTierLevel parameters
+ */
+struct _GstH265ProfileTierLevel {
+ guint8 profile_space;
+ guint8 tier_flag;
+ guint8 profile_idc;
+
+ guint8 profile_compatibility_flag[32];
+
+ guint8 progressive_source_flag;
+ guint8 interlaced_source_flag;
+ guint8 non_packed_constraint_flag;
+ guint8 frame_only_constraint_flag;
+
+ guint8 max_12bit_constraint_flag;
+ guint8 max_10bit_constraint_flag;
+ guint8 max_8bit_constraint_flag;
+ guint8 max_422chroma_constraint_flag;
+ guint8 max_420chroma_constraint_flag;
+ guint8 max_monochrome_constraint_flag;
+ guint8 intra_constraint_flag;
+ guint8 one_picture_only_constraint_flag;
+ guint8 lower_bit_rate_constraint_flag;
+ guint8 max_14bit_constraint_flag;
+
+ guint8 level_idc;
+
+ guint8 sub_layer_profile_present_flag[6];
+ guint8 sub_layer_level_present_flag[6];
+
+ guint8 sub_layer_profile_space[6];
+ guint8 sub_layer_tier_flag[6];
+ guint8 sub_layer_profile_idc[6];
+ guint8 sub_layer_profile_compatibility_flag[6][32];
+ guint8 sub_layer_progressive_source_flag[6];
+ guint8 sub_layer_interlaced_source_flag[6];
+ guint8 sub_layer_non_packed_constraint_flag[6];
+ guint8 sub_layer_frame_only_constraint_flag[6];
+ guint8 sub_layer_level_idc[6];
+};
+
+/**
+ * GstH265SubLayerHRDParams:
+ * @bit_rate_value_minus1:togeter with bit_rate_scale, it specifies
+ * the maximum input bitrate when the CPB operates at the access
+ * unit level
+ * @cpb_size_value_minus1: is used together with cpb_size_scale to
+ * specify the CPB size when the CPB operates at the access unit
+ * level
+ * @cpb_size_du_value_minus1: is used together with cpb_size_du_scale
+ * to specify the CPB size when the CPB operates at sub-picture
+ * level
+ * @bit_rate_du_value_minus1: together with bit_rate_scale, it
+ * specifies the maximum input bit rate when the CPB operates at the
+ * sub-picture level
+ * @cbr_flag: indicate whether HSS operates in intermittent bit rate
+ * mode or constant bit rate mode.
+ *
+ * Defines the Sublayer HRD parameters
+ */
+struct _GstH265SubLayerHRDParams
+{
+ guint32 bit_rate_value_minus1[32];
+ guint32 cpb_size_value_minus1[32];
+
+ guint32 cpb_size_du_value_minus1[32];
+ guint32 bit_rate_du_value_minus1[32];
+
+ guint8 cbr_flag[32];
+};
+
+/**
+ * GstH265HRDParams:
+ * @nal_hrd_parameters_present_flag: indicate the presence of NAL HRD parameters
+ * @vcl_hrd_parameters_present_flag: indicate the presence of VCL HRD parameters
+ * @sub_pic_hrd_params_present_flag: indicate the presence of sub_pic_hrd_params
+ * @tick_divisor_minus2: is used to specify the clock sub-tick
+ * @du_cpb_removal_delay_increment_length_minus1: specifies the length,
+ * in bits, of the nal_initial_cpb_removal_delay
+ * @sub_pic_cpb_params_in_pic_timing_sei_flag: specifies the length, in bits, of
+ * the cpb_delay_offset and the au_cpb_removal_delay_minus1 syntax elements.
+ * @dpb_output_delay_du_length_minu1: specifies the length, in bits, of the
+ * dpb_delay_offset and the pic_dpb_output_delay syntax elements
+ * @bit_rate_scale: maximum input bitrate
+ * @cpb_size_scale: CPB size when operates in access unit level
+ * @cpb_size_du_scale: CPB size when operates in sub-picture level
+ * @initial_cpb_removal_delay_length_minus1: specifies the length, in bits, of the
+ * nal_initial_cpb_removal_delay, nal_initial_cpb_removal_offset,
+ * vcl_initial_cpb_removal_delay and vcl_initial_cpb_removal_offset.
+ * @au_cpb_removal_delay_length_minus1: specifies the length, in bits, of the
+ * cpb_delay_offset and the au_cpb_removal_delay_minus1 syntax elements
+ * @dpb_output_delay_length_minus1: specifies the length, in bits, of the
+ * dpb_delay_offset and the pic_dpb_output_delay syntax elements
+ * @fixed_pic_rate_general_flag: flag to indicate the presence of constraint
+ * on the temporal distance between the HRD output times of consecutive
+ * pictures in output order
+ * @fixed_pic_rate_within_cvs_flag: same as fixed_pic_rate_general_flag
+ * @elemental_duration_in_tc_minus1: temporal distance in clock ticks
+ * @low_delay_hrd_flag: specifies the HRD operational mode
+ * @cpb_cnt_minus1:specifies the number of alternative CPS specifications.
+ * @sublayer_hrd_params: Sublayer HRD parameters.
+ *
+ * Defines the HRD parameters
+ */
+struct _GstH265HRDParams
+{
+ guint8 nal_hrd_parameters_present_flag;
+ guint8 vcl_hrd_parameters_present_flag;
+ guint8 sub_pic_hrd_params_present_flag;
+
+ guint8 tick_divisor_minus2;
+ guint8 du_cpb_removal_delay_increment_length_minus1;
+ guint8 sub_pic_cpb_params_in_pic_timing_sei_flag;
+ guint8 dpb_output_delay_du_length_minus1;
+
+ guint8 bit_rate_scale;
+ guint8 cpb_size_scale;
+ guint8 cpb_size_du_scale;
+
+ guint8 initial_cpb_removal_delay_length_minus1;
+ guint8 au_cpb_removal_delay_length_minus1;
+ guint8 dpb_output_delay_length_minus1;
+
+ guint8 fixed_pic_rate_general_flag [7];
+ guint8 fixed_pic_rate_within_cvs_flag [7];
+ guint16 elemental_duration_in_tc_minus1 [7];
+ guint8 low_delay_hrd_flag [7];
+ guint8 cpb_cnt_minus1[7];
+
+ GstH265SubLayerHRDParams sublayer_hrd_params[7];
+};
+
+/**
+ * GstH265VPS:
+ * @id: vps id
+ * @base_layer_internal_flag and @base_layer_available_flag:
+ * specify availability of base layer
+ * @max_layers_minus1: should be zero, but can be other values in future
+ * @max_sub_layers_minus1:specifies the maximum number of temporal sub-layers
+ * @temporal_id_nesting_flag: specifies whether inter prediction is
+ * additionally restricted
+ * @profile_tier_level: ProfileTierLevel info
+ * @sub_layer_ordering_info_present_flag: indicates the presence of
+ * vps_max_dec_pic_buffering_minus1, vps_max_num_reorder_pics and
+ * vps_max_latency_increase_plus1
+ * @max_dec_pic_buffering_minus1: specifies the maximum required size
+ * of the decoded picture buffer
+ * @max_num_reorder_pics: indicates the maximum allowed number of
+ * pictures that can precede any picture in the CVS in decoding
+ * order
+ * @max_latency_increase_plus1: is used to compute the value of
+ * VpsMaxLatencyPictures
+ * @max_layer_id: specifies the maximum allowed value of nuh_layer_id
+ * @num_layer_sets_minus1: specifies the number of layer sets
+ * @layer_id_included_flag: specifies whether a nuh_layer_id included
+ * in the layer identifier list
+ * @timing_info_present_flag: indicate the presence of
+ * num_units_in_tick, time_scale, poc_proportional_to_timing_flag
+ * and num_hrd_parameters
+ * @num_units_in_tick: number of time units in a tick
+ * @time_scale: number of time units that pass in one second
+ * @poc_proportional_to_timing_flag: indicate whether the picture
+ * order count is proportional to output timin
+ * @num_ticks_poc_diff_one_minus1: specifies the number of clock ticks
+ * corresponding to a difference of picture order count values equal
+ * to 1
+ * @num_hrd_parameters: number of hrd_parameters present
+ * @hrd_layer_set_idx: index to the list of layer hrd params.
+ * @hrd_params: the GstH265HRDParams list
+ *
+ * Defines the VPS parameters
+ */
+struct _GstH265VPS {
+ guint8 id;
+
+ guint8 base_layer_internal_flag;
+ guint8 base_layer_available_flag;
+
+ guint8 max_layers_minus1;
+ guint8 max_sub_layers_minus1;
+ guint8 temporal_id_nesting_flag;
+
+ GstH265ProfileTierLevel profile_tier_level;
+
+ guint8 sub_layer_ordering_info_present_flag;
+ guint8 max_dec_pic_buffering_minus1[GST_H265_MAX_SUB_LAYERS];
+ guint8 max_num_reorder_pics[GST_H265_MAX_SUB_LAYERS];
+ guint32 max_latency_increase_plus1[GST_H265_MAX_SUB_LAYERS];
+
+ guint8 max_layer_id;
+ guint16 num_layer_sets_minus1;
+
+ guint8 timing_info_present_flag;
+ guint32 num_units_in_tick;
+ guint32 time_scale;
+ guint8 poc_proportional_to_timing_flag;
+ guint32 num_ticks_poc_diff_one_minus1;
+
+ guint16 num_hrd_parameters;
+
+ /* FIXME: following HRD related info should be an array */
+ guint16 hrd_layer_set_idx;
+ guint8 cprms_present_flag;
+ GstH265HRDParams hrd_params;
+
+ guint8 vps_extension;
+
+ gboolean valid;
+};
+/**
+ * GstH265ShortTermRefPicSet:
+ * @inter_ref_pic_set_prediction_flag: %TRUE specifies that the stRpsIdx-th candidate
+ * short-term RPS is predicted from another candidate short-term RPS
+ * @delta_idx_minus1: plus 1 specifies the difference between the value of source and
+ * candidate short term RPS.
+ * @delta_rps_sign: delta_rps_sign and abs_delta_rps_minus1 together specify
+ * the value of the variable deltaRps.
+ * @abs_delta_rps_minus1: delta_rps_sign and abs_delta_rps_minus1 together specify
+ * the value of the variable deltaRps
+ * @NumDeltaPocs: sum of @NumNegativePics and @NumPositivePics.
+ * @NumNegativePics: Derived value depending on inter_ref_pic_set_prediction_flag.
+ * If inter_ref_pic_set_prediction_flag is equal to 0, this specifies
+ * the number of entries in the stRpsIdx-th candidate
+ * short-term RPS that have poc values less than the poc of the current picture.
+ * @NumPositivePics: Derived value depending on inter_ref_pic_set_prediction_flag.
+ * If inter_ref_pic_set_prediction_flag is equal to 0, this specifies
+ * the number of entires in the stRpsIdx-th candidate
+ * short-term RPS that have poc values greater than the poc value of the current picture.
+ * @UsedByCurrPicS0: Derived value depending on inter_ref_pic_set_prediction_flag.
+ * If inter_ref_pic_set_prediction_flag is equal to 0,
+ * equal to zero specifies that the i-th entry in the stRpsIdx-th
+ * candidate short-term RPS that has poc value less than of the current picture
+ * is not used for reference by the current picture
+ * @UsedByCurrPicS1: Derived value depending on inter_ref_pic_set_prediction_flag.
+ * If inter_ref_pic_set_prediction_flag is equal to 0,
+ * equal to zero specifies that the i-th entry in the current
+ * candidate short-term RPS that has poc value greater than that of the current picture
+ * is not used for reference by the current picture.
+ * @DeltaPocS0: Derived value depending on inter_ref_pic_set_prediction_flag.
+ * See 7.4.8 Short-term reference picture set semantics
+ * @DeltaPocS1: Derived value depending on inter_ref_pic_set_prediction_flag.
+ * See 7.4.8 Short-term reference picture set semantics
+ * @NumDeltaPocsOfRefRpsIdx: The value of NumDeltaPocs[RefRpsIdx].
+ * If inter_ref_pic_set_prediction_flag is equal to 0,
+ * this value should be ignored (Since: 1.18)
+ *
+ * Defines the #GstH265ShortTermRefPicSet params
+ */
+struct _GstH265ShortTermRefPicSet
+{
+ guint8 inter_ref_pic_set_prediction_flag;
+ guint8 delta_idx_minus1;
+ guint8 delta_rps_sign;
+ guint16 abs_delta_rps_minus1;
+
+ /* calculated values */
+ guint8 NumDeltaPocs;
+ guint8 NumNegativePics;
+ guint8 NumPositivePics;
+ guint8 UsedByCurrPicS0[16];
+ guint8 UsedByCurrPicS1[16];
+ gint32 DeltaPocS0[16];
+ gint32 DeltaPocS1[16];
+ guint8 NumDeltaPocsOfRefRpsIdx;
+};
+
+/**
+ * GstH265VUIParams:
+ * @aspect_ratio_info_present_flag: %TRUE specifies that aspect_ratio_idc is present.
+ * %FALSE specifies that aspect_ratio_idc is not present
+ * @aspect_ratio_idc specifies the value of the sample aspect ratio of the luma samples
+ * @sar_width indicates the horizontal size of the sample aspect ratio
+ * @sar_height indicates the vertical size of the sample aspect ratio
+ * @overscan_info_present_flag: %TRUE overscan_appropriate_flag is present %FALSE otherwise
+ * @overscan_appropriate_flag: %TRUE indicates that the cropped decoded pictures
+ * output are suitable for display using overscan. %FALSE the cropped decoded pictures
+ * output contain visually important information
+ * @video_signal_type_present_flag: %TRUE specifies that video_format, video_full_range_flag and
+ * colour_description_present_flag are present.
+ * @video_format: indicates the representation of the picture
+ * @video_full_range_flag: indicates the black level and range of the luma and chroma signals
+ * @colour_description_present_flag: %TRUE specifies that colour_primaries,
+ * transfer_characteristics and matrix_coefficients are present
+ * @colour_primaries: indicates the chromaticity coordinates of the source primaries
+ * @transfer_characteristics: indicates the opto-electronic transfer characteristic
+ * @matrix_coefficients: describes the matrix coefficients used in deriving luma and chroma signals
+ * @chroma_loc_info_present_flag: %TRUE specifies that chroma_sample_loc_type_top_field and
+ * chroma_sample_loc_type_bottom_field are present, %FALSE otherwise
+ * @chroma_sample_loc_type_top_field: specify the location of chroma for top field
+ * @chroma_sample_loc_type_bottom_field specify the location of chroma for bottom field
+ * @neutral_chroma_indication_flag: %TRUE indicate that the value of chroma samples is equla
+ * to 1<<(BitDepthchrom-1).
+ * @field_seq_flag: %TRUE indicate field and %FALSE indicate frame
+ * @frame_field_info_present_flag: %TRUE indicate picture timing SEI messages are present for every
+ * picture and include the pic_struct, source_scan_type, and duplicate_flag syntax elements.
+ * @default_display_window_flag: %TRUE indicate that the default display window parameters present
+ * def_disp_win_left_offset:left offset of display rect
+ * def_disp_win_right_offset: right offset of display rect
+ * def_disp_win_top_offset: top offset of display rect
+ * def_disp_win_bottom_offset: bottom offset of display rect
+ * @timing_info_present_flag: %TRUE specifies that num_units_in_tick,
+ * time_scale and fixed_frame_rate_flag are present in the bitstream
+ * @num_units_in_tick: is the number of time units of a clock operating at the frequency time_scale Hz
+ * @time_scale: is the number of time units that pass in one second
+ * @poc_proportional_to_timing_flag: %TRUE indicates that the picture order count value for each picture
+ * in the CVS that is not the first picture in the CVS, in decoding order, is proportional to the output
+ * time of the picture relative to the output time of the first picture in the CVS.
+ * @num_ticks_poc_diff_one_minus1: plus 1 specifies the number of clock ticks corresponding to a
+ * difference of picture order count values equal to 1
+ * @hrd_parameters_present_flag: %TRUE if hrd parameters present in the bitstream
+ * @bitstream_restriction_flag: %TRUE specifies that the following coded video sequence bitstream restriction
+ * parameters are present
+ * @tiles_fixed_structure_flag: %TRUE indicates that each PPS that is active in the CVS has the same value
+ * of the syntax elements num_tile_columns_minus1, num_tile_rows_minus1, uniform_spacing_flag,
+ * column_width_minus1, row_height_minus1 and loop_filter_across_tiles_enabled_flag, when present
+ * @motion_vectors_over_pic_boundaries_flag: %FALSE indicates that no sample outside the
+ * picture boundaries and no sample at a fractional sample position, %TRUE indicates that one or more
+ * samples outside picture boundaries may be used in inter prediction
+ * @restricted_ref_pic_list_flag: %TRUE indicates that all P and B slices (when present) that belong to
+ * the same picture have an identical reference picture list 0, and that all B slices (when present)
+ * that belong to the same picture have an identical reference picture list 1
+ * @min_spatial_segmentation_idc: when not equal to 0, establishes a bound on the maximum possible size
+ * of distinct coded spatial segmentation regions in the pictures of the CVS
+ * @max_bytes_per_pic_denom: indicates a number of bytes not exceeded by the sum of the sizes of
+ * the VCL NAL units associated with any coded picture in the coded video sequence.
+ * @max_bits_per_min_cu_denom: indicates an upper bound for the number of coded bits of coding_unit
+ * data for any coding block in any picture of the CVS
+ * @log2_max_mv_length_horizontal: indicate the maximum absolute value of a decoded horizontal
+ * motion vector component
+ * @log2_max_mv_length_vertical: indicate the maximum absolute value of a decoded vertical
+ * motion vector component
+ *
+ * The structure representing the VUI parameters.
+ */
+struct _GstH265VUIParams
+{
+ guint8 aspect_ratio_info_present_flag;
+ guint8 aspect_ratio_idc;
+ /* if aspect_ratio_idc == 255 */
+ guint16 sar_width;
+ guint16 sar_height;
+
+ guint8 overscan_info_present_flag;
+ /* if overscan_info_present_flag */
+ guint8 overscan_appropriate_flag;
+
+ guint8 video_signal_type_present_flag;
+ guint8 video_format;
+ guint8 video_full_range_flag;
+ guint8 colour_description_present_flag;
+ guint8 colour_primaries;
+ guint8 transfer_characteristics;
+ guint8 matrix_coefficients;
+
+ guint8 chroma_loc_info_present_flag;
+ guint8 chroma_sample_loc_type_top_field;
+ guint8 chroma_sample_loc_type_bottom_field;
+
+ guint8 neutral_chroma_indication_flag;
+ guint8 field_seq_flag;
+ guint8 frame_field_info_present_flag;
+ guint8 default_display_window_flag;
+ guint32 def_disp_win_left_offset;
+ guint32 def_disp_win_right_offset;
+ guint32 def_disp_win_top_offset;
+ guint32 def_disp_win_bottom_offset;
+
+ guint8 timing_info_present_flag;
+ /* if timing_info_present_flag */
+ guint32 num_units_in_tick;
+ guint32 time_scale;
+ guint8 poc_proportional_to_timing_flag;
+ /* if poc_proportional_to_timing_flag */
+ guint32 num_ticks_poc_diff_one_minus1;
+ guint8 hrd_parameters_present_flag;
+ /*if hrd_parameters_present_flat */
+ GstH265HRDParams hrd_params;
+
+ guint8 bitstream_restriction_flag;
+ /* if bitstream_restriction_flag */
+ guint8 tiles_fixed_structure_flag;
+ guint8 motion_vectors_over_pic_boundaries_flag;
+ guint8 restricted_ref_pic_lists_flag;
+ guint16 min_spatial_segmentation_idc;
+ guint8 max_bytes_per_pic_denom;
+ guint8 max_bits_per_min_cu_denom;
+ guint8 log2_max_mv_length_horizontal;
+ guint8 log2_max_mv_length_vertical;
+
+ /* calculated values */
+ guint par_n;
+ guint par_d;
+};
+
+/**
+ * GstH265SPSExtensionParams:
+ * @transform_skip_rotation_enabled_flag: %TRUE specifies that a rotation is applied to
+ * the residual data block from intra 4X4 blocks coded using a transform skip operation.
+ * @transform_skip_context_enabled_flag: %TRUE specifies tspecifies that a particular
+ * context is used for the parsing of the sig_coeff_flag for transform blocks with a skipped
+ * transform.
+ * @implicit_residual_dpcm_enabled_flag: %TRUE specifies that the residual modification process
+ * for blocks using a transform bypass may be used for intra blocks in the CVS
+ * @explicit_residual_dpcm_enabled_flag: %TRUE specifies that the residual modification process
+ * for blocks using a transform bypass may be used for inter blocks in the CVS
+ * @extended_precision_processing_flag: %TRUE specifies that an extended dynamic range is used
+ * for coefficient parsing and inverse transform processing
+ * @intra_smoothing_disabled_flag: %TRUE specifies that the filtering process of neighbouring
+ * samples is unconditionally disabled for intra prediction
+ * @high_precision_offsets_enabled_flag: %TRUE specifies that weighted prediction offset values
+ * are signalled using a bit-depth-dependent precision.
+ * @persistent_rice_adaptation_enabled_flag: %TRUE specifies that the Rice parameter derivation
+ * for the binarization of coeff_abs_level_remaining[] is initialized at the start of each
+ * sub-block using mode dependent statistics accumulated from previous sub-blocks.
+ * @cabac_bypass_alignment_enabled_flag: %TRUE specifies that a context-based adaptive binary
+ * arithmetic coding (CABAC) alignment process is used prior to bypass decoding of the syntax
+ * elements coeff_sign_flag[] and coeff_abs_level_remaining[]
+ *
+ * Defines the GstH265SPSExtensionParams
+ */
+struct _GstH265SPSExtensionParams {
+ guint8 transform_skip_rotation_enabled_flag;
+ guint8 transform_skip_context_enabled_flag;
+ guint8 implicit_rdpcm_enabled_flag;
+ guint8 explicit_rdpcm_enabled_flag;
+ guint8 extended_precision_processing_flag;
+ guint8 intra_smoothing_disabled_flag;
+ guint8 high_precision_offsets_enabled_flag;
+ guint8 persistent_rice_adaptation_enabled_flag;
+ guint8 cabac_bypass_alignment_enabled_flag;
+};
+
+/**
+ * GstH265SPSSccExtensionParams:
+ * @sps_curr_pic_ref_enabled_flag: equal to 1 specifies that a picture in the CVS may be
+ * included in a reference picture list of a slice of the picture itself.
+ * @palette_mode_enabled_flag: equal to 1 specifies that the decoding process for palette mode
+ * may be used for intra blocks. Equal to 0 specifies that the decoding process for palette
+ * mode is not applied.
+ * @palette_max_size: specifies the maximum allowed palette size.
+ * @delta_palette_max_predictor_size: specifies the difference between the maximum allowed
+ * palette predictor size and the maximum allowed palette size.
+ * @sps_palette_predictor_initializers_present_flag: equal to 1 specifies that the sequence
+ * palette predictors are initialized using the sps_palette_predictor_initializer specified
+ * in clause 7.3.2.2.3.
+ * @sps_num_palette_predictor_initializer_minus1: plus 1 specifies the number of entries in
+ * the sequence palette predictor initializer.
+ * @sps_palette_predictor_initializer: specifies the value of the comp-th component of the
+ * i-th palette entry in the SPS that is used to initialize the array PredictorPaletteEntries.
+ * @motion_vector_resolution_control_idc: controls the presence and inference of the
+ * use_integer_mv_flag that specifies the resolution of motion vectors for inter prediction.
+ * @intra_boundary_filtering_disabled_flag: equal to 1 specifies that the intra boundary
+ * filtering process is unconditionally disabled for intra prediction.
+ * Defines the _GstH265SPSSccExtensionParams
+ *
+ * Since: 1.18
+ */
+struct _GstH265SPSSccExtensionParams {
+ guint8 sps_curr_pic_ref_enabled_flag;
+ guint8 palette_mode_enabled_flag;
+ guint8 palette_max_size;
+ guint8 delta_palette_max_predictor_size;
+ guint8 sps_palette_predictor_initializers_present_flag;
+ guint8 sps_num_palette_predictor_initializer_minus1;
+ guint32 sps_palette_predictor_initializer[3][128];
+ guint8 motion_vector_resolution_control_idc;
+ guint8 intra_boundary_filtering_disabled_flag;
+};
+
+/**
+ * GstH265PPSExtensionParams:
+ * @log2_max_transform_skip_block_size_minus2: plus 2 specifies the maximum transform block size for which
+ * transform_skip_flag may be present in coded pictures referring to the PPS.
+ * @cross_component_prediction_enabled_flag: equal to 1 specifies that log2_res_scale_abs_plus1 and
+ * res_scale_sign_flag may be present in the transform unit syntax for pictures referring to the PPS.
+ * @chroma_qp_offset_list_enabled_flag: equal to 1 specifies that the cu_chroma_qp_offset_flag may be
+ * present in the transform unit syntax.
+ * @diff_cu_chroma_qp_offset_depth: specifies the difference between the luma coding tree block size and
+ * the minimum luma coding block size of coding units that convey cu_chroma_qp_offset_flag.
+ * @chroma_qp_offset_list_len_minus1: plus 1 specifies the number of cb_qp_offset_list[] and
+ * cr_qp_offset_list[] syntax elements that are present in the PPS.
+ * @cb_qp_offset_list: specify offsets used in the derivation of qp cb.
+ * @cr_qp_offset_list: specify offsets used in the derivation of qp cr.
+ * @log2_sao_offset_scale_luma: the base 2 logarithm of the scaling parameter that is used to scale sample
+ * adaptive offset (SAO) offset values for luma samples.
+ * @log2_sao_offset_scale_chroma: the base 2 logarithm of the scaling parameter that is used to scale SAO
+ * offset values for chroma samples.
+ *
+ * Defines the GstH265SPSExtensionParams
+ */
+struct _GstH265PPSExtensionParams {
+ guint32 log2_max_transform_skip_block_size_minus2;
+ guint8 cross_component_prediction_enabled_flag;
+ guint8 chroma_qp_offset_list_enabled_flag;
+ guint8 diff_cu_chroma_qp_offset_depth;
+ guint8 chroma_qp_offset_list_len_minus1;
+ gint8 cb_qp_offset_list[6];
+ gint8 cr_qp_offset_list[6];
+ guint8 log2_sao_offset_scale_luma;
+ guint8 log2_sao_offset_scale_chroma;
+};
+
+/**
+ * GstH265PPSSccExtensionParams:
+ * @pps_curr_pic_ref_enabled_flag: equal to 1 specifies that a picture referring to the PPS may
+ * be included in a reference picture list of a slice of the picture itself.
+ * @residual_adaptive_colour_transform_enabled_flag: equal to 1 specifies that an adaptive
+ * colour transform may be applied to the residual in the decoding process.
+ * @pps_slice_act_qp_offsets_present_flag: equal to 1 specifies that slice_act_y_qp_offset,
+ * slice_act_cb_qp_offset, slice_act_cr_qp_offset are present in the slice header.
+ * @pps_act_y_qp_offset_plus5 @pps_act_cb_qp_offset_plus5 @pps_act_cr_qp_offset_plus3:
+ * are used to determine the offsets that are applied to the quantization parameter values
+ * qp derived in clause 8.6.2 for the luma, Cb and Cr components, respectively, when
+ * tu_residual_act_flag[ xTbY ][ yTbY ] is equal to 1.
+ * @pps_palette_predictor_initializers_present_flag: equal to 1 specifies that the palette
+ * predictor initializers used for the pictures referring to the PPS are derived based on
+ * the palette predictor initializers specified by the PPS.
+ * @pps_num_palette_predictor_initializer: specifies the number of entries in the picture
+ * palette predictor initializer.
+ * @monochrome_palette_flag: equal to 1 specifies that the pictures that refer to this PPS
+ * are monochrome. Equal to 0 specifies that the pictures that refer to this PPS have
+ * multiple components.
+ * @luma_bit_depth_entry_minus8: plus 8 specifies the bit depth of the luma component of the
+ * entries of the palette predictor initializer.
+ * @chroma_bit_depth_entry_minus8: plus 8 specifies the bit depth of the chroma components of
+ * the entries of the palette predictor initializer.
+ * @pps_palette_predictor_initializer: specifies the value of the comp-th component of the
+ * i-th palette entry in the PPS that is used to initialize the array PredictorPaletteEntries.
+ * Defines the _GstH265PPSSccExtensionParams
+ *
+ * Since: 1.18
+ */
+struct _GstH265PPSSccExtensionParams {
+ guint8 pps_curr_pic_ref_enabled_flag;
+ guint8 residual_adaptive_colour_transform_enabled_flag;
+ guint8 pps_slice_act_qp_offsets_present_flag;
+ guint8 pps_act_y_qp_offset_plus5;
+ guint8 pps_act_cb_qp_offset_plus5;
+ guint8 pps_act_cr_qp_offset_plus3;
+ guint8 pps_palette_predictor_initializers_present_flag;
+ guint8 pps_num_palette_predictor_initializer;
+ guint8 monochrome_palette_flag;
+ guint8 luma_bit_depth_entry_minus8;
+ guint32 chroma_bit_depth_entry_minus8;
+ guint32 pps_palette_predictor_initializer[3][128];
+};
+
+/**
+ * GstH265ScalingList:
+ * @scaling_list_dc_coef_minus8_16x16: this plus 8 specifies the DC
+ * Coefficient values for 16x16 scaling list
+ * @scaling_list_dc_coef_minus8_32x32: this plus 8 specifies the DC
+ * Coefficient values for 32x32 scaling list
+ * @scaling_lists_4x4: 4x4 scaling list
+ * @scaling_lists_8x8: 8x8 scaling list
+ * @scaling_lists_16x16: 16x16 scaling list
+ * @guint8 scaling_lists_32x32: 32x32 scaling list
+ *
+ * Defines the GstH265ScalingList
+ */
+struct _GstH265ScalingList {
+
+ gint16 scaling_list_dc_coef_minus8_16x16[6];
+ gint16 scaling_list_dc_coef_minus8_32x32[2];
+
+ guint8 scaling_lists_4x4 [6][16];
+ guint8 scaling_lists_8x8 [6][64];
+ guint8 scaling_lists_16x16 [6][64];
+ guint8 scaling_lists_32x32 [2][64];
+};
+
+/**
+ * GstH265SPS:
+ * @id: The ID of the sequence parameter set
+ * @profile_idc: indicate the profile to which the coded video sequence conforms
+ *
+ * H265 Sequence Parameter Set (SPS)
+ */
+struct _GstH265SPS
+{
+ guint8 id;
+
+ GstH265VPS *vps;
+
+ guint8 max_sub_layers_minus1;
+ guint8 temporal_id_nesting_flag;
+
+ GstH265ProfileTierLevel profile_tier_level;
+
+ guint8 chroma_format_idc;
+ guint8 separate_colour_plane_flag;
+ guint16 pic_width_in_luma_samples;
+ guint16 pic_height_in_luma_samples;
+
+ guint8 conformance_window_flag;
+ /* if conformance_window_flag */
+ guint32 conf_win_left_offset;
+ guint32 conf_win_right_offset;
+ guint32 conf_win_top_offset;
+ guint32 conf_win_bottom_offset;
+
+ guint8 bit_depth_luma_minus8;
+ guint8 bit_depth_chroma_minus8;
+ guint8 log2_max_pic_order_cnt_lsb_minus4;
+
+ guint8 sub_layer_ordering_info_present_flag;
+ guint8 max_dec_pic_buffering_minus1[GST_H265_MAX_SUB_LAYERS];
+ guint8 max_num_reorder_pics[GST_H265_MAX_SUB_LAYERS];
+ guint8 max_latency_increase_plus1[GST_H265_MAX_SUB_LAYERS];
+
+ guint8 log2_min_luma_coding_block_size_minus3;
+ guint8 log2_diff_max_min_luma_coding_block_size;
+ guint8 log2_min_transform_block_size_minus2;
+ guint8 log2_diff_max_min_transform_block_size;
+ guint8 max_transform_hierarchy_depth_inter;
+ guint8 max_transform_hierarchy_depth_intra;
+
+ guint8 scaling_list_enabled_flag;
+ /* if scaling_list_enabled_flag */
+ guint8 scaling_list_data_present_flag;
+
+ GstH265ScalingList scaling_list;
+
+ guint8 amp_enabled_flag;
+ guint8 sample_adaptive_offset_enabled_flag;
+ guint8 pcm_enabled_flag;
+ /* if pcm_enabled_flag */
+ guint8 pcm_sample_bit_depth_luma_minus1;
+ guint8 pcm_sample_bit_depth_chroma_minus1;
+ guint8 log2_min_pcm_luma_coding_block_size_minus3;
+ guint8 log2_diff_max_min_pcm_luma_coding_block_size;
+ guint8 pcm_loop_filter_disabled_flag;
+
+ guint8 num_short_term_ref_pic_sets;
+ GstH265ShortTermRefPicSet short_term_ref_pic_set[65];
+
+ guint8 long_term_ref_pics_present_flag;
+ /* if long_term_ref_pics_present_flag */
+ guint8 num_long_term_ref_pics_sps;
+ guint16 lt_ref_pic_poc_lsb_sps[32];
+ guint8 used_by_curr_pic_lt_sps_flag[32];
+
+ guint8 temporal_mvp_enabled_flag;
+ guint8 strong_intra_smoothing_enabled_flag;
+ guint8 vui_parameters_present_flag;
+
+ /* if vui_parameters_present_flat */
+ GstH265VUIParams vui_params;
+
+ guint8 sps_extension_flag;
+
+ /* if sps_extension_present_flag */
+ guint8 sps_range_extension_flag;
+ guint8 sps_multilayer_extension_flag;
+ guint8 sps_3d_extension_flag;
+ guint8 sps_scc_extension_flag;
+ guint8 sps_extension_4bits;
+
+ /* if sps_range_extension_flag */
+ GstH265SPSExtensionParams sps_extnsion_params;
+ /* if sps_scc_extension_flag */
+ GstH265SPSSccExtensionParams sps_scc_extension_params;
+
+ /* calculated values */
+ guint8 chroma_array_type;
+ gint width, height;
+ gint crop_rect_width, crop_rect_height;
+ gint crop_rect_x, crop_rect_y;
+ gint fps_num, fps_den;
+ gboolean valid;
+};
+
+/**
+ * GstH265PPS:
+ *
+ * H265 Picture Parameter Set
+ */
+struct _GstH265PPS
+{
+ guint id;
+
+ GstH265SPS *sps;
+
+ guint8 dependent_slice_segments_enabled_flag;
+ guint8 output_flag_present_flag;
+ guint8 num_extra_slice_header_bits;
+ guint8 sign_data_hiding_enabled_flag;
+ guint8 cabac_init_present_flag;
+ guint8 num_ref_idx_l0_default_active_minus1;
+ guint8 num_ref_idx_l1_default_active_minus1;
+ gint8 init_qp_minus26;
+ guint8 constrained_intra_pred_flag;
+ guint8 transform_skip_enabled_flag;
+ guint8 cu_qp_delta_enabled_flag;
+ /*if cu_qp_delta_enabled_flag */
+ guint8 diff_cu_qp_delta_depth;
+
+ gint8 cb_qp_offset;
+ gint8 cr_qp_offset;
+ guint8 slice_chroma_qp_offsets_present_flag;
+ guint8 weighted_pred_flag;
+ guint8 weighted_bipred_flag;
+ guint8 transquant_bypass_enabled_flag;
+ guint8 tiles_enabled_flag;
+ guint8 entropy_coding_sync_enabled_flag;
+
+ guint8 num_tile_columns_minus1;
+ guint8 num_tile_rows_minus1;
+ guint8 uniform_spacing_flag;
+ guint32 column_width_minus1[20];
+ guint32 row_height_minus1[22];
+ guint8 loop_filter_across_tiles_enabled_flag;
+
+ guint8 loop_filter_across_slices_enabled_flag;
+ guint8 deblocking_filter_control_present_flag;
+ guint8 deblocking_filter_override_enabled_flag;
+ guint8 deblocking_filter_disabled_flag;
+ gint8 beta_offset_div2;
+ gint8 tc_offset_div2;
+
+ guint8 scaling_list_data_present_flag;
+
+ GstH265ScalingList scaling_list;
+
+ guint8 lists_modification_present_flag;
+ guint8 log2_parallel_merge_level_minus2;
+ guint8 slice_segment_header_extension_present_flag;
+
+ guint8 pps_extension_flag;
+
+ /* if pps_extension_flag*/
+ guint8 pps_range_extension_flag;
+ guint8 pps_multilayer_extension_flag;
+ guint8 pps_3d_extension_flag;
+ guint8 pps_scc_extension_flag;
+ guint8 pps_extension_4bits;
+
+ /* if pps_range_extension_flag*/
+ GstH265PPSExtensionParams pps_extension_params;
+ /* if pps_scc_extension_flag*/
+ GstH265PPSSccExtensionParams pps_scc_extension_params;
+
+ /* calculated values */
+ guint32 PicWidthInCtbsY;
+ guint32 PicHeightInCtbsY;
+ gboolean valid;
+};
+
+struct _GstH265RefPicListModification
+{
+ guint8 ref_pic_list_modification_flag_l0;
+ guint32 list_entry_l0[15];
+ guint8 ref_pic_list_modification_flag_l1;
+ guint32 list_entry_l1[15];
+};
+
+struct _GstH265PredWeightTable
+{
+ guint8 luma_log2_weight_denom;
+ gint8 delta_chroma_log2_weight_denom;
+
+ guint8 luma_weight_l0_flag[15];
+ guint8 chroma_weight_l0_flag[15];
+ gint8 delta_luma_weight_l0[15];
+ gint8 luma_offset_l0[15];
+ gint8 delta_chroma_weight_l0 [15][2];
+ gint16 delta_chroma_offset_l0 [15][2];
+
+ guint8 luma_weight_l1_flag[15];
+ guint8 chroma_weight_l1_flag[15];
+ gint8 delta_luma_weight_l1[15];
+ gint8 luma_offset_l1[15];
+ gint8 delta_chroma_weight_l1[15][2];
+ gint16 delta_chroma_offset_l1[15][2];
+};
+
+/**
+ * GstH265SliceHdr:
+ * @first_slice_segment_in_pic_flag: equal to 1 if this slice segment is
+ * the first slice segment of the picture in decoding order
+ * @no_output_of_prior_pics_flag: affects the output of previously-decoded pictures
+ * in the decoded picture buffer after the decoding of an IDR or a BLA picture
+ * that is not the first picture in the bitstream as specified in Annex C
+ * @pps: a #GstH265PPS
+ * @dependent_slice_segment_flag: equal to 1 if the value of each slice segment header
+ * syntax element that is not present is inferred to be equal to the value of corresponding
+ * slice segment header syntax element in the slice header.
+ * @segment_address: the address of the first CTB in the slice segment
+ * @type: slice type (B, P, or I)
+ * @pic_output_flag: affects the decoded picture output and removal processes
+ * as specified in Annex C.
+ * @colour_plane_id: specifies the colour plane associated with the current slice RBSP
+ * when separate_colour_plane_flag is equal to 1
+ * @pic_order_cnt_lsb: the picture order count modulo MaxPicOrderCntLsb for the current picture
+ * @short_term_ref_pic_set_sps_flag: equal to 1 specifies that the short-term RPS
+ * of the current picture is derived based on the active SPS.
+ * @short_term_ref_pic_sets: a #GstH265ShortTermRefPicSet structure
+ * @short_term_ref_pic_set_idx: the index of st_ref_pic_set syntax structure
+ * that is used for derivation of the short-term RPS of the current picture.
+ * @num_long_term_sps: the number of entries in the long-term RPS of current picture
+ * that are derived based on the syntax in active SPS.
+ * @num_long_term_pics: the number of entries in the long-term RPS of the current picture
+ * that are directly signalled in the slice header.
+ * @lt_idx_sps: the index of candidate long-term reference pictures
+ * specified in the active SPS.
+ * @poc_lsb_lt: the value of the picture order count modulo MaxPicOrderCntLsb
+ * of the each entry in the long-term RPS of the current picture.
+ * @used_by_curr_pic_lt_flag: equal to 0 if the entry in the long-term RPS
+ * of the current picture is not used for reference by the current picture.
+ * @delta_poc_msb_present_flag: equal to 1 if i-th delta_poc_msb_cycle_lt[] is present.
+ * @delta_poc_msb_cycle_lt: used to determine the value of the most significant bits
+ * of the picture order count value of the i-th entry in the long-term RPS of the current picture.
+ * @temporal_mvp_enabled_flag: whether temporal motion vector predictors can be used for inter prediction.
+ * @sao_luma_flag: equal to 1 if SAO is enabled for the luma component in the current slice.
+ * @sao_chroma_flag: equal to 1 if SAO is enabled for the chroma component in the current slice.
+ * @num_ref_idx_active_override_flag: equal to 1 specifies that the syntax elements
+ * num_ref_idx_l0_active_minus1 and num_ref_idx_l1_active_minus1 are present.
+ * @num_ref_idx_l0_active_minus1: the maximum reference index for reference picture list 0
+ * that may be used to decode the slice.
+ * @num_ref_idx_l1_active_minus1: the maximum reference index for reference picture list 1
+ * that may be used to decode the slice.
+ * @ref_pic_list_modification: a #GstH265RefPicListModification
+ * @mvd_l1_zero_flag: equal to 1 if the mvd_coding sytanx structure is not parsed
+ * @cabac_init_flag: specifies the method for determining the initialization table
+ * used in the initialization process for context variables.
+ * @collocated_from_l0_flag: equal to 1 specifies that the collocated picture
+ * used for temporal motion vector prediction is derived from reference picture list 0.
+ * @collocated_ref_idx: the reference index of the collocated picture
+ * used for temporal motion vector prediction.
+ * @pred_weight_table: a #GstH265PredWeightTable
+ * @five_minus_max_num_merge_cand: specifies the maximum number of merging motion vector prediction (MVP)
+ * candidates supported in the slice.
+ * @use_integer_mv_flag: equal to 1 specifies that the resolution of motion vectors for inter
+ * prediction in the current slice is integer. (Since: 1.18)
+ * @qp_delta: specifies the inital value of QPy to be used for the coding blocks in the slice.
+ * @cb_qp_offset: a difference to be added to the value of pps_cb_qp_offset.
+ * @cr_qp_offset: a difference to be added to the value of pps_cr_qp_offset.
+ * @slice_act_y_qp_offset: specify offsets to the quantization parameter values qP derived in
+ * clause 8.6.2 for luma components. (Since: 1.18)
+ * @slice_act_cb_qp_offset: specify offsets to the quantization parameter values qP derived in
+ * clause 8.6.2 for Cb components. (Since: 1.18)
+ * @slice_act_cr_qp_offset: specify offsets to the quantization parameter values qP derived in
+ * clause 8.6.2 for Cr components. (Since: 1.18)
+ * @cu_chroma_qp_offset_enabled_flag: equal to 1 if the cu_chroma_qp_offset_flag
+ * may be present in the transform unit syntax. (Since: 1.18)
+ * @deblocking_filter_override_flag: equal to 1 if deblocking paramertes are present in the slice header.
+ * @deblocking_filter_disabled_flag: equal to 1 specifies that the operation of
+ * the deblocking filter is not applied for the current slice.
+ * @beta_offset_div2: deblocking parameter offset for beta divided by 2 for the current slice.
+ * @tc_offset_div2: deblocking parameter offset for tC divided by 2 for the current slice.
+ * @loop_filter_across_slices_enabled_flag: equal to 1 specifies that in-loop filtering
+ * operation may be performed across the left and upper boundaries of the current slice.
+ * @num_entry_point_offsets: specifies the number of entry_point_offset_minus1 syntax elements
+ * in the slice header.
+ * @offset_len_minus1: specifies the length of the entry_point_minus1 syntax elements
+ * in bits.
+ * @entry_point_offset_minus1: the entry point offset in bytes.
+ * @NumPocTotalCurr: calculated NumPocTotalCurr which is used for
+ * decoding process for reference picture set
+ * @header_size: the calculated size of the slice_header\() in bits.
+ * @n_emulation_prevention_bytes: number of emulation prevention bytes (EPB)
+ * in this slice_header\()
+ * @short_term_ref_pic_set_size: the calculated size of short_term_ref_pic_set\()
+ * in bits. (Since: 1.18)
+ */
+struct _GstH265SliceHdr
+{
+ guint8 first_slice_segment_in_pic_flag;
+ guint8 no_output_of_prior_pics_flag;
+
+ GstH265PPS *pps;
+
+ guint8 dependent_slice_segment_flag;
+ guint32 segment_address;
+
+ guint8 type;
+
+ guint8 pic_output_flag;
+ guint8 colour_plane_id;
+ guint16 pic_order_cnt_lsb;
+
+ guint8 short_term_ref_pic_set_sps_flag;
+ GstH265ShortTermRefPicSet short_term_ref_pic_sets;
+ guint8 short_term_ref_pic_set_idx;
+
+ guint8 num_long_term_sps;
+ guint8 num_long_term_pics;
+ guint8 lt_idx_sps[16];
+ guint32 poc_lsb_lt[16];
+ guint8 used_by_curr_pic_lt_flag[16];
+ guint8 delta_poc_msb_present_flag[16];
+ guint32 delta_poc_msb_cycle_lt[16];
+
+ guint8 temporal_mvp_enabled_flag;
+ guint8 sao_luma_flag;
+ guint8 sao_chroma_flag;
+ guint8 num_ref_idx_active_override_flag;
+ guint8 num_ref_idx_l0_active_minus1;
+ guint8 num_ref_idx_l1_active_minus1;
+
+ GstH265RefPicListModification ref_pic_list_modification;
+
+ guint8 mvd_l1_zero_flag;
+ guint8 cabac_init_flag;
+ guint8 collocated_from_l0_flag;
+ guint8 collocated_ref_idx;
+
+ GstH265PredWeightTable pred_weight_table;
+
+ guint8 five_minus_max_num_merge_cand;
+ guint8 use_integer_mv_flag;
+
+ gint8 qp_delta;
+ gint8 cb_qp_offset;
+ gint8 cr_qp_offset;
+ gint8 slice_act_y_qp_offset;
+ gint8 slice_act_cb_qp_offset;
+ gint8 slice_act_cr_qp_offset;
+
+ guint8 cu_chroma_qp_offset_enabled_flag;
+
+ guint8 deblocking_filter_override_flag;
+ guint8 deblocking_filter_disabled_flag;
+ gint8 beta_offset_div2;
+ gint8 tc_offset_div2;
+
+ guint8 loop_filter_across_slices_enabled_flag;
+
+ guint32 num_entry_point_offsets;
+ guint8 offset_len_minus1;
+ guint32 *entry_point_offset_minus1;
+
+ /* calculated values */
+
+ gint NumPocTotalCurr;
+ /* Size of the slice_header() in bits */
+ guint header_size;
+ /* Number of emulation prevention bytes (EPB) in this slice_header() */
+ guint n_emulation_prevention_bytes;
+
+ /* Size of short_term_ref_pic_set() in bits */
+ guint short_term_ref_pic_set_size;
+};
+
+struct _GstH265PicTiming
+{
+ guint8 pic_struct;
+ guint8 source_scan_type;
+ guint8 duplicate_flag;
+
+ guint8 au_cpb_removal_delay_minus1;
+ guint8 pic_dpb_output_delay;
+ guint8 pic_dpb_output_du_delay;
+ guint32 num_decoding_units_minus1;
+ guint8 du_common_cpb_removal_delay_flag;
+ guint8 du_common_cpb_removal_delay_increment_minus1;
+ guint32 *num_nalus_in_du_minus1;
+ guint8 *du_cpb_removal_delay_increment_minus1;
+};
+
+struct _GstH265BufferingPeriod
+{
+ GstH265SPS *sps;
+
+ guint8 irap_cpb_params_present_flag;
+ guint8 cpb_delay_offset;
+ guint8 dpb_delay_offset;
+ guint8 concatenation_flag;
+ guint8 au_cpb_removal_delay_delta_minus1;
+
+ /* seq->vui_parameters->nal_hrd_parameters_present_flag */
+ guint8 nal_initial_cpb_removal_delay[32];
+ guint8 nal_initial_cpb_removal_offset[32];
+ guint8 nal_initial_alt_cpb_removal_delay[32];
+ guint8 nal_initial_alt_cpb_removal_offset [32];
+
+ /* seq->vui_parameters->vcl_hrd_parameters_present_flag */
+ guint8 vcl_initial_cpb_removal_delay[32];
+ guint8 vcl_initial_cpb_removal_offset[32];
+ guint8 vcl_initial_alt_cpb_removal_delay[32];
+ guint8 vcl_initial_alt_cpb_removal_offset[32];
+};
+
+struct _GstH265RecoveryPoint
+{
+ gint32 recovery_poc_cnt;
+ guint8 exact_match_flag;
+ guint8 broken_link_flag;
+};
+
+/**
+ * GstH265RegisteredUserData:
+ * The User data registered by Rec. ITU-T T.35 SEI message.
+ * @country_code: an itu_t_t35_country_code.
+ * @country_code_extension: an itu_t_t35_country_code_extension_byte.
+ * Should be ignored when @country_code is not 0xff
+ * @data: the data of itu_t_t35_payload_byte
+ * excluding @country_code and @country_code_extension
+ * @size: the size of @data in bytes
+ *
+ * Since: 1.18
+ */
+struct _GstH265RegisteredUserData
+{
+ guint8 country_code;
+ guint8 country_code_extension;
+ const guint8 *data;
+ guint size;
+};
+
+
+/**
+ * GstH265TimeCode:
+ * The time code SEI message provides time code information similar to that
+ * defined by SMPTE ST 12-1 (2014) for field(s) or frame(s) of the current
+ * picture.
+ *
+ * D.2.27
+ *
+ * Since: 1.16
+ */
+struct _GstH265TimeCode
+{
+ guint8 num_clock_ts;
+ guint8 clock_timestamp_flag[3];
+ guint8 units_field_based_flag[3];
+ guint8 counting_type[3];
+ guint8 full_timestamp_flag[3];
+ guint8 discontinuity_flag[3];
+ guint8 cnt_dropped_flag[3];
+ guint16 n_frames[3];
+ guint8 seconds_flag[3];
+ guint8 seconds_value[3];
+ guint8 minutes_flag[3];
+ guint8 minutes_value[3];
+ guint8 hours_flag[3];
+ guint8 hours_value[3];
+ guint8 time_offset_length[3];
+ guint32 time_offset_value[3];
+};
+
+/**
+ * GstH265MasteringDisplayColourVolume:
+ * The colour volume (primaries, white point and luminance range) of display
+ * defined by SMPTE ST 2086.
+ *
+ * D.2.28
+ *
+ * Since: 1.18
+ */
+struct _GstH265MasteringDisplayColourVolume
+{
+ guint16 display_primaries_x[3];
+ guint16 display_primaries_y[3];
+ guint16 white_point_x;
+ guint16 white_point_y;
+ guint32 max_display_mastering_luminance;
+ guint32 min_display_mastering_luminance;
+};
+
+/**
+ * GstH265ContentLightLevel:
+ * The upper bounds for the nominal target brightness light level
+ * as specified in CEA-861.3
+ *
+ * D.2.35
+ *
+ * Since: 1.18
+ */
+struct _GstH265ContentLightLevel
+{
+ guint16 max_content_light_level;
+ guint16 max_pic_average_light_level;
+};
+
+struct _GstH265SEIMessage
+{
+ GstH265SEIPayloadType payloadType;
+
+ union {
+ GstH265BufferingPeriod buffering_period;
+ GstH265PicTiming pic_timing;
+ GstH265RegisteredUserData registered_user_data;
+ GstH265RecoveryPoint recovery_point;
+ GstH265TimeCode time_code;
+ GstH265MasteringDisplayColourVolume mastering_display_colour_volume;
+ GstH265ContentLightLevel content_light_level;
+ /* ... could implement more */
+ } payload;
+};
+
+/**
+ * GstH265Parser:
+ *
+ * H265 NAL Parser (opaque structure).
+ */
+struct _GstH265Parser
+{
+ /*< private >*/
+ GstH265VPS vps[GST_H265_MAX_VPS_COUNT];
+ GstH265SPS sps[GST_H265_MAX_SPS_COUNT];
+ GstH265PPS pps[GST_H265_MAX_PPS_COUNT];
+ GstH265VPS *last_vps;
+ GstH265SPS *last_sps;
+ GstH265PPS *last_pps;
+};
+
+GST_CODEC_PARSERS_API
+GstH265Parser * gst_h265_parser_new (void);
+
+GST_CODEC_PARSERS_API
+GstH265ParserResult gst_h265_parser_identify_nalu (GstH265Parser * parser,
+ const guint8 * data,
+ guint offset,
+ gsize size,
+ GstH265NalUnit * nalu);
+
+GST_CODEC_PARSERS_API
+GstH265ParserResult gst_h265_parser_identify_nalu_unchecked (GstH265Parser * parser,
+ const guint8 * data,
+ guint offset,
+ gsize size,
+ GstH265NalUnit * nalu);
+
+GST_CODEC_PARSERS_API
+GstH265ParserResult gst_h265_parser_identify_nalu_hevc (GstH265Parser * parser,
+ const guint8 * data,
+ guint offset,
+ gsize size,
+ guint8 nal_length_size,
+ GstH265NalUnit * nalu);
+
+GST_CODEC_PARSERS_API
+GstH265ParserResult gst_h265_parser_parse_nal (GstH265Parser * parser,
+ GstH265NalUnit * nalu);
+
+GST_CODEC_PARSERS_API
+GstH265ParserResult gst_h265_parser_parse_slice_hdr (GstH265Parser * parser,
+ GstH265NalUnit * nalu,
+ GstH265SliceHdr * slice);
+
+GST_CODEC_PARSERS_API
+GstH265ParserResult gst_h265_parser_parse_vps (GstH265Parser * parser,
+ GstH265NalUnit * nalu,
+ GstH265VPS * vps);
+
+GST_CODEC_PARSERS_API
+GstH265ParserResult gst_h265_parser_parse_sps (GstH265Parser * parser,
+ GstH265NalUnit * nalu,
+ GstH265SPS * sps,
+ gboolean parse_vui_params);
+
+GST_CODEC_PARSERS_API
+GstH265ParserResult gst_h265_parser_parse_pps (GstH265Parser * parser,
+ GstH265NalUnit * nalu,
+ GstH265PPS * pps);
+
+GST_CODEC_PARSERS_API
+GstH265ParserResult gst_h265_parser_parse_sei (GstH265Parser * parser,
+ GstH265NalUnit * nalu,
+ GArray **messages);
+
+GST_CODEC_PARSERS_API
+GstH265ParserResult gst_h265_parser_update_vps (GstH265Parser * parser,
+ GstH265VPS * vps);
+
+GST_CODEC_PARSERS_API
+GstH265ParserResult gst_h265_parser_update_sps (GstH265Parser * parser,
+ GstH265SPS * sps);
+
+GST_CODEC_PARSERS_API
+GstH265ParserResult gst_h265_parser_update_pps (GstH265Parser * parser,
+ GstH265PPS * pps);
+
+GST_CODEC_PARSERS_API
+void gst_h265_parser_free (GstH265Parser * parser);
+
+GST_CODEC_PARSERS_API
+GstH265ParserResult gst_h265_parse_vps (GstH265NalUnit * nalu,
+ GstH265VPS * vps);
+
+GST_CODEC_PARSERS_API
+GstH265ParserResult gst_h265_parse_sps (GstH265Parser * parser,
+ GstH265NalUnit * nalu,
+ GstH265SPS * sps,
+ gboolean parse_vui_params);
+
+GST_CODEC_PARSERS_API
+GstH265ParserResult gst_h265_parse_pps (GstH265Parser * parser,
+ GstH265NalUnit * nalu,
+ GstH265PPS * pps);
+
+GST_CODEC_PARSERS_API
+gboolean gst_h265_slice_hdr_copy (GstH265SliceHdr * dst_slice,
+ const GstH265SliceHdr * src_slice);
+
+GST_CODEC_PARSERS_API
+void gst_h265_slice_hdr_free (GstH265SliceHdr * slice_hdr);
+
+GST_CODEC_PARSERS_API
+gboolean gst_h265_sei_copy (GstH265SEIMessage * dest_sei,
+ const GstH265SEIMessage * src_sei);
+
+GST_CODEC_PARSERS_API
+void gst_h265_sei_free (GstH265SEIMessage * sei);
+
+GST_CODEC_PARSERS_API
+void gst_h265_quant_matrix_4x4_get_zigzag_from_raster (guint8 out_quant[16],
+ const guint8 quant[16]);
+
+GST_CODEC_PARSERS_API
+void gst_h265_quant_matrix_4x4_get_raster_from_zigzag (guint8 out_quant[16],
+ const guint8 quant[16]);
+
+GST_CODEC_PARSERS_API
+void gst_h265_quant_matrix_8x8_get_zigzag_from_raster (guint8 out_quant[64],
+ const guint8 quant[64]);
+
+GST_CODEC_PARSERS_API
+void gst_h265_quant_matrix_8x8_get_raster_from_zigzag (guint8 out_quant[64],
+ const guint8 quant[64]);
+
+#define gst_h265_quant_matrix_16x16_get_zigzag_from_raster \
+ gst_h265_quant_matrix_8x8_get_zigzag_from_raster
+#define gst_h265_quant_matrix_16x16_get_raster_from_zigzag \
+ gst_h265_quant_matrix_8x8_get_raster_from_zigzag
+#define gst_h265_quant_matrix_32x32_get_zigzag_from_raster \
+ gst_h265_quant_matrix_8x8_get_zigzag_from_raster
+#define gst_h265_quant_matrix_32x32_get_raster_from_zigzag \
+ gst_h265_quant_matrix_8x8_get_raster_from_zigzag
+
+GST_CODEC_PARSERS_API
+void gst_h265_quant_matrix_4x4_get_uprightdiagonal_from_raster (guint8 out_quant[16],
+ const guint8 quant[16]);
+
+GST_CODEC_PARSERS_API
+void gst_h265_quant_matrix_4x4_get_raster_from_uprightdiagonal (guint8 out_quant[16],
+ const guint8 quant[16]);
+
+GST_CODEC_PARSERS_API
+void gst_h265_quant_matrix_8x8_get_uprightdiagonal_from_raster (guint8 out_quant[64],
+ const guint8 quant[64]);
+
+GST_CODEC_PARSERS_API
+void gst_h265_quant_matrix_8x8_get_raster_from_uprightdiagonal (guint8 out_quant[64],
+ const guint8 quant[64]);
+
+#define gst_h265_quant_matrix_16x16_get_uprightdiagonal_from_raster \
+ gst_h265_quant_matrix_8x8_get_uprightdiagonal_from_raster
+#define gst_h265_quant_matrix_16x16_get_raster_from_uprightdiagonal\
+ gst_h265_quant_matrix_8x8_get_raster_from_uprightdiagonal
+#define gst_h265_quant_matrix_32x32_get_uprightdiagonal_from_raster \
+ gst_h265_quant_matrix_8x8_get_uprightdiagonal_from_raster
+#define gst_h265_quant_matrix_32x32_get_raster_from_uprightdiagonal\
+ gst_h265_quant_matrix_8x8_get_raster_from_uprightdiagonal
+
+GST_CODEC_PARSERS_API
+GstH265Profile gst_h265_profile_tier_level_get_profile (const GstH265ProfileTierLevel * ptl);
+
+GST_CODEC_PARSERS_API
+const gchar * gst_h265_profile_to_string (GstH265Profile profile);
+
+GST_CODEC_PARSERS_API
+GstH265Profile gst_h265_profile_from_string (const gchar * string);
+
+GST_CODEC_PARSERS_API
+GstMemory * gst_h265_create_sei_memory (guint8 layer_id,
+ guint8 temporal_id_plus1,
+ guint8 start_code_prefix_length,
+ GArray * messages);
+
+GST_CODEC_PARSERS_API
+GstMemory * gst_h265_create_sei_memory_hevc (guint8 layer_id,
+ guint8 temporal_id_plus1,
+ guint8 nal_length_size,
+ GArray * messages);
+
+GST_CODEC_PARSERS_API
+GstBuffer * gst_h265_parser_insert_sei (GstH265Parser * parser,
+ GstBuffer * au,
+ GstMemory * sei);
+
+GST_CODEC_PARSERS_API
+GstBuffer * gst_h265_parser_insert_sei_hevc (GstH265Parser * parser,
+ guint8 nal_length_size,
+ GstBuffer * au,
+ GstMemory * sei);
+
+GST_CODEC_PARSERS_API
+GstH265Profile gst_h265_get_profile_from_sps (GstH265SPS * sps);
+
+G_END_DECLS
+#endif
diff --git a/include/gst/codecparsers/gstjpeg2000sampling.h b/include/gst/codecparsers/gstjpeg2000sampling.h
new file mode 100644
index 0000000000..4b5bea5a3c
--- /dev/null
+++ b/include/gst/codecparsers/gstjpeg2000sampling.h
@@ -0,0 +1,115 @@
+/* GStreamer JPEG 2000 Sampling
+ * Copyright (C) <2016> Grok Image Compression Inc.
+ * @author Aaron Boxer <boxerab@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_JPEG2000_SAMPLING_H__
+#define __GST_JPEG2000_SAMPLING_H__
+
+#include <gst/gst.h>
+#include <gst/codecparsers/codecparsers-prelude.h>
+
+/**
+ * GstJPEG2000Sampling:
+ * Sampling values from RF 5371 for JPEG 2000 over RTP : https://datatracker.ietf.org/doc/rfc5371/C
+ * Note: sampling extensions that are not listed in the RFC are signified by an _EXT at the end of the enum
+ *
+ * @GST_JPEG2000_SAMPLING_NONE: no sampling
+ * @GST_JPEG2000_SAMPLING_RGB: standard Red, Green, Blue color space.
+ * @GST_JPEG2000_SAMPLING_BGR: standard Blue, Green, Red color space.
+ * @GST_JPEG2000_SAMPLING_RGBA: standard Red, Green, Blue, Alpha color space.
+ * @GST_JPEG2000_SAMPLING_BGRA: standard Blue, Green, Red, Alpha color space.
+ * @GST_JPEG2000_SAMPLING_YBR444: standard YCbCr color space; no subsampling.
+ * @GST_JPEG2000_SAMPLING_YBR422: standard YCbCr color space; Cb and Cr are subsampled horizontally by 1/2.
+ * @GST_JPEG2000_SAMPLING_YBR420: standard YCbCr color space; Cb and Cr are subsampled horizontally and vertically by 1/2.
+ * @GST_JPEG2000_SAMPLING_YBR411: standard YCbCr color space; Cb and Cr are subsampled vertically by 1/4 (Since: 1.20).
+ * @GST_JPEG2000_SAMPLING_YBR410: standard YCbCr color space; Cb and Cr are subsampled vertically by 1/4 alternating the Cb and Cr component.
+ * @GST_JPEG2000_SAMPLING_GRAYSCALE: basically, a single component image of just multilevels of grey.
+ * @GST_JPEG2000_SAMPLING_YBRA4444_EXT: standard YCbCr color space, alpha channel, no subsampling,
+ */
+
+/**
+ * GST_JPEG2000_SAMPLING_YBR411:
+ *
+ * standard YCbCr color space; Cb and Cr are subsampled vertically by 1/4
+ *
+ * Since: 1.20
+ */
+typedef enum
+{
+ GST_JPEG2000_SAMPLING_NONE,
+ GST_JPEG2000_SAMPLING_RGB,
+ GST_JPEG2000_SAMPLING_BGR,
+ GST_JPEG2000_SAMPLING_RGBA,
+ GST_JPEG2000_SAMPLING_BGRA,
+ GST_JPEG2000_SAMPLING_YBR444,
+ GST_JPEG2000_SAMPLING_YBR422,
+ GST_JPEG2000_SAMPLING_YBR420,
+ GST_JPEG2000_SAMPLING_YBR410,
+ GST_JPEG2000_SAMPLING_GRAYSCALE,
+ GST_JPEG2000_SAMPLING_YBRA4444_EXT,
+ GST_JPEG2000_SAMPLING_YBR411
+} GstJPEG2000Sampling;
+
+/* GST_JPEG2000_SAMPLING_LIST: sampling strings in list form, for use in caps */
+#define GST_JPEG2000_SAMPLING_LIST "sampling = (string) {\"RGB\", \"BGR\", \"RGBA\", \"BGRA\", \"YCbCr-4:4:4\", \"YCbCr-4:2:2\", \"YCbCr-4:2:0\", \"YCbCr-4:1:1\", \"YCbCr-4:1:0\", \"GRAYSCALE\" , \"YCbCrA-4:4:4:4\"}"
+
+GST_CODEC_PARSERS_API
+const gchar *gst_jpeg2000_sampling_to_string (GstJPEG2000Sampling sampling);
+
+GST_CODEC_PARSERS_API
+GstJPEG2000Sampling gst_jpeg2000_sampling_from_string (const gchar *
+ sampling_string);
+
+GST_CODEC_PARSERS_API
+gboolean gst_jpeg2000_sampling_is_rgb (GstJPEG2000Sampling sampling);
+
+GST_CODEC_PARSERS_API
+gboolean gst_jpeg2000_sampling_is_yuv (GstJPEG2000Sampling sampling);
+
+GST_CODEC_PARSERS_API
+gboolean gst_jpeg2000_sampling_is_mono (GstJPEG2000Sampling sampling);
+
+
+/**
+ * GstJPEG2000Colorspace:
+ * @GST_JPEG2000_COLORSPACE_NONE: no color space
+ * @GST_JPEG2000_COLORSPACE_RGB: standard RGB color space
+ * @GST_JPEG2000_COLORSPACE_YUV: standard YUV color space
+ * @GST_JPEG2000_COLORSPACE_GRAY: monochrome color space
+ */
+typedef enum
+{
+ GST_JPEG2000_COLORSPACE_NONE,
+ GST_JPEG2000_COLORSPACE_RGB,
+ GST_JPEG2000_COLORSPACE_YUV,
+ GST_JPEG2000_COLORSPACE_GRAY
+} GstJPEG2000Colorspace;
+
+GST_CODEC_PARSERS_API
+const gchar *gst_jpeg2000_colorspace_to_string (GstJPEG2000Colorspace
+ colorspace);
+
+GST_CODEC_PARSERS_API
+GstJPEG2000Colorspace gst_jpeg2000_colorspace_from_string (const gchar *
+ colorspace_string);
+
+/* GST_JPEG2000_COLORSPACE_LIST: color space strings in list form, for use in caps */
+#define GST_JPEG2000_COLORSPACE_LIST "colorspace = (string) { \"sRGB\", \"sYUV\", \"GRAY\" }"
+
+#endif
diff --git a/include/gst/codecparsers/gstjpegparser.h b/include/gst/codecparsers/gstjpegparser.h
new file mode 100644
index 0000000000..ca96e89abb
--- /dev/null
+++ b/include/gst/codecparsers/gstjpegparser.h
@@ -0,0 +1,412 @@
+/* GStreamer JPEG parser
+ * Copyright (C) 2011-2012 Intel Corporation
+ * Copyright (C) 2015 Tim-Philipp Müller <tim@centricular.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA
+ */
+
+#ifndef GST_JPEG_PARSER_H
+#define GST_JPEG_PARSER_H
+
+#ifndef GST_USE_UNSTABLE_API
+# warning "The JPEG parsing library is unstable API and may change in future."
+# warning "You can define GST_USE_UNSTABLE_API to avoid this warning."
+#endif
+
+#include <gst/gst.h>
+#include <gst/codecparsers/codecparsers-prelude.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GST_JPEG_MAX_FRAME_COMPONENTS:
+ *
+ * Maximum number of image components in a frame (Nf).
+ *
+ * Since: 1.6
+ */
+#define GST_JPEG_MAX_FRAME_COMPONENTS 256
+
+/**
+ * GST_JPEG_MAX_SCAN_COMPONENTS:
+ *
+ * Maximum number of image components in a scan (Ns).
+ *
+ * Since: 1.6
+ */
+#define GST_JPEG_MAX_SCAN_COMPONENTS 4
+
+/**
+ * GST_JPEG_MAX_QUANT_ELEMENTS:
+ *
+ * Number of elements in the quantization table.
+ *
+ * Since: 1.6
+ */
+#define GST_JPEG_MAX_QUANT_ELEMENTS 64
+
+typedef struct _GstJpegQuantTable GstJpegQuantTable;
+typedef struct _GstJpegQuantTables GstJpegQuantTables;
+typedef struct _GstJpegHuffmanTable GstJpegHuffmanTable;
+typedef struct _GstJpegHuffmanTables GstJpegHuffmanTables;
+typedef struct _GstJpegScanComponent GstJpegScanComponent;
+typedef struct _GstJpegScanHdr GstJpegScanHdr;
+typedef struct _GstJpegFrameComponent GstJpegFrameComponent;
+typedef struct _GstJpegFrameHdr GstJpegFrameHdr;
+typedef struct _GstJpegSegment GstJpegSegment;
+
+/**
+ * GstJpegMarker:
+ * @GST_JPEG_MARKER_SOF0: Start of frame marker code (Baseline)
+ * @GST_JPEG_MARKER_SOF1: Start of frame marker code (Extended Sequential, Huffman)
+ * @GST_JPEG_MARKER_SOF2: Start of frame marker code (Progressive, Huffman)
+ * @GST_JPEG_MARKER_SOF3: Start of frame marker code (Lossless, Huffman)
+ * @GST_JPEG_MARKER_SOF5: Start of frame marker code (Differential Sequential, Huffman)
+ * @GST_JPEG_MARKER_SOF6: Start of frame marker code (Differential Progressive, Huffman)
+ * @GST_JPEG_MARKER_SOF7: Start of frame marker code (Differential Lossless, Huffman)
+ * @GST_JPEG_MARKER_SOF9: Start of frame marker code (Extended Sequential, Arithmetic)
+ * @GST_JPEG_MARKER_SOF10: Start of frame marker code (Progressive, Arithmetic)
+ * @GST_JPEG_MARKER_SOF11: Start of frame marker code (Lossless, Arithmetic)
+ * @GST_JPEG_MARKER_SOF13: Start of frame marker code (Differential Sequential, Arithmetic)
+ * @GST_JPEG_MARKER_SOF14: Start of frame marker code (Differential Progressive, Arithmetic)
+ * @GST_JPEG_MARKER_SOF15: Start of frame marker code (Differential Lossless, Arithmetic)
+ * @GST_JPEG_MARKER_DHT: Huffman table marker code
+ * @GST_JPEG_MARKER_DAC: Arithmetic coding marker code
+ * @GST_JPEG_MARKER_RST_MIN: Restart interval min marker code
+ * @GST_JPEG_MARKER_RST_MAX: Restart interval max marker code
+ * @GST_JPEG_MARKER_SOI: Start of image marker code
+ * @GST_JPEG_MARKER_EOI: End of image marker code
+ * @GST_JPEG_MARKER_SOS: Start of scan marker code
+ * @GST_JPEG_MARKER_DQT: Define quantization table marker code
+ * @GST_JPEG_MARKER_DNL: Define number of lines marker code
+ * @GST_JPEG_MARKER_DRI: Define restart interval marker code
+ * @GST_JPEG_MARKER_APP0: Application segment 0 marker code
+ * @GST_JPEG_MARKER_APP1: Application segment 1 marker code
+ * @GST_JPEG_MARKER_APP2: Application segment 2 marker code
+ * @GST_JPEG_MARKER_APP3: Application segment 3 marker code
+ * @GST_JPEG_MARKER_APP4: Application segment 4 marker code
+ * @GST_JPEG_MARKER_APP5: Application segment 5 marker code
+ * @GST_JPEG_MARKER_APP6: Application segment 6 marker code
+ * @GST_JPEG_MARKER_APP7: Application segment 7 marker code
+ * @GST_JPEG_MARKER_APP8: Application segment 8 marker code
+ * @GST_JPEG_MARKER_APP9: Application segment 9 marker code
+ * @GST_JPEG_MARKER_APP10: Application segment 10 marker code
+ * @GST_JPEG_MARKER_APP11: Application segment 11 marker code
+ * @GST_JPEG_MARKER_APP12: Application segment 12 marker code
+ * @GST_JPEG_MARKER_APP13: Application segment 13 marker code
+ * @GST_JPEG_MARKER_APP14: Application segment 14 marker code
+ * @GST_JPEG_MARKER_APP15: Application segment 15 marker code
+ * @GST_JPEG_MARKER_COM: Comment marker code
+ *
+ * Indicates the type of JPEG segment.
+ *
+ * Since: 1.6
+ */
+typedef enum {
+ GST_JPEG_MARKER_SOF0 = 0xC0,
+ GST_JPEG_MARKER_SOF1 = 0xC1,
+ GST_JPEG_MARKER_SOF2 = 0xC2,
+ GST_JPEG_MARKER_SOF3 = 0xC3,
+ /* 0xC4 = DHT see below */
+ GST_JPEG_MARKER_SOF5 = 0xC5,
+ GST_JPEG_MARKER_SOF6 = 0xC6,
+ GST_JPEG_MARKER_SOF7 = 0xC7,
+ /* 0xC8 = reserved */
+ GST_JPEG_MARKER_SOF9 = 0xC9,
+ GST_JPEG_MARKER_SOF10 = 0xCA,
+ GST_JPEG_MARKER_SOF11 = 0xCB,
+ /* 0xCC = DAC see below */
+ GST_JPEG_MARKER_SOF13 = 0xCD,
+ GST_JPEG_MARKER_SOF14 = 0xCE,
+ GST_JPEG_MARKER_SOF15 = 0xCF,
+ GST_JPEG_MARKER_DHT = 0xC4,
+ GST_JPEG_MARKER_DAC = 0xCC,
+ GST_JPEG_MARKER_RST0 = 0xD0,
+ GST_JPEG_MARKER_RST1 = 0xD1,
+ GST_JPEG_MARKER_RST2 = 0xD2,
+ GST_JPEG_MARKER_RST3 = 0xD3,
+ GST_JPEG_MARKER_RST4 = 0xD4,
+ GST_JPEG_MARKER_RST5 = 0xD5,
+ GST_JPEG_MARKER_RST6 = 0xD6,
+ GST_JPEG_MARKER_RST7 = 0xD7,
+ GST_JPEG_MARKER_SOI = 0xD8,
+ GST_JPEG_MARKER_EOI = 0xD9,
+ GST_JPEG_MARKER_SOS = 0xDA,
+ GST_JPEG_MARKER_DQT = 0xDB,
+ GST_JPEG_MARKER_DNL = 0xDC,
+ GST_JPEG_MARKER_DRI = 0xDD,
+ GST_JPEG_MARKER_APP0 = 0xE0,
+ GST_JPEG_MARKER_APP1 = 0xE1,
+ GST_JPEG_MARKER_APP2 = 0xE2,
+ GST_JPEG_MARKER_APP3 = 0xE3,
+ GST_JPEG_MARKER_APP4 = 0xE4,
+ GST_JPEG_MARKER_APP5 = 0xE5,
+ GST_JPEG_MARKER_APP6 = 0xE6,
+ GST_JPEG_MARKER_APP7 = 0xE7,
+ GST_JPEG_MARKER_APP8 = 0xE8,
+ GST_JPEG_MARKER_APP9 = 0xE9,
+ GST_JPEG_MARKER_APP10 = 0xEA,
+ GST_JPEG_MARKER_APP11 = 0xEB,
+ GST_JPEG_MARKER_APP12 = 0xEC,
+ GST_JPEG_MARKER_APP13 = 0xED,
+ GST_JPEG_MARKER_APP14 = 0xEE,
+ GST_JPEG_MARKER_APP15 = 0xEF,
+ GST_JPEG_MARKER_COM = 0xFE,
+} GstJpegMarker;
+
+#define GST_JPEG_MARKER_SOF_MIN GST_JPEG_MARKER_SOF0
+#define GST_JPEG_MARKER_SOF_MAX GST_JPEG_MARKER_SOF15
+
+#define GST_JPEG_MARKER_APP_MIN GST_JPEG_MARKER_APP0
+#define GST_JPEG_MARKER_APP_MAX GST_JPEG_MARKER_APP15
+
+#define GST_JPEG_MARKER_RST_MIN GST_JPEG_MARKER_RST0
+#define GST_JPEG_MARKER_RST_MAX GST_JPEG_MARKER_RST7
+
+/**
+ * GstJpegProfile:
+ * @GST_JPEG_PROFILE_BASELINE: Baseline DCT
+ * @GST_JPEG_PROFILE_EXTENDED: Extended sequential DCT
+ * @GST_JPEG_PROFILE_PROGRESSIVE: Progressive DCT
+ * @GST_JPEG_PROFILE_LOSSLESS: Lossless (sequential)
+ *
+ * JPEG encoding processes.
+ *
+ * Since: 1.6
+ */
+typedef enum {
+ GST_JPEG_PROFILE_BASELINE = 0x00,
+ GST_JPEG_PROFILE_EXTENDED = 0x01,
+ GST_JPEG_PROFILE_PROGRESSIVE = 0x02,
+ GST_JPEG_PROFILE_LOSSLESS = 0x03,
+} GstJpegProfile;
+
+/**
+ * GstJpegEntropyCodingMode:
+ * @GST_JPEG_ENTROPY_CODING_HUFFMAN: Huffman coding
+ * @GST_JPEG_ENTROPY_CODING_ARITHMETIC: arithmetic coding
+ *
+ * JPEG entropy coding mode.
+ *
+ * Since: 1.6
+ */
+typedef enum {
+ GST_JPEG_ENTROPY_CODING_HUFFMAN = 0x00,
+ GST_JPEG_ENTROPY_CODING_ARITHMETIC = 0x08
+} GstJpegEntropyCodingMode;
+
+/**
+ * GstJpegQuantTable:
+ * @quant_precision: Quantization table element precision (Pq)
+ * @quant_table: Quantization table elements (Qk)
+ * @valid: If the quantization table is valid, which means it has
+ * already been parsed
+ *
+ * Quantization table.
+ *
+ * Since: 1.6
+ */
+struct _GstJpegQuantTable
+{
+ guint8 quant_precision;
+ guint16 quant_table[GST_JPEG_MAX_QUANT_ELEMENTS];
+ gboolean valid;
+};
+
+/**
+ * GstJpegQuantTables:
+ * @quant_tables: All quantization tables
+ *
+ * Helper data structure that holds all quantization tables used to
+ * decode an image.
+ *
+ * Since: 1.6
+ */
+struct _GstJpegQuantTables
+{
+ GstJpegQuantTable quant_tables[GST_JPEG_MAX_SCAN_COMPONENTS];
+};
+
+/**
+ * GstJpegHuffmanTable:
+ * @huf_bits: Number of Huffman codes of length i + 1 (Li)
+ * @huf_vales: Value associated with each Huffman code (Vij)
+ * @valid: If the Huffman table is valid, which means it has already
+ * been parsed
+ *
+ * Huffman table.
+ *
+ * Since: 1.6
+ */
+struct _GstJpegHuffmanTable
+{
+ guint8 huf_bits[16];
+ guint8 huf_values[256];
+ gboolean valid;
+};
+
+/**
+ * GstJpegHuffmanTables:
+ * @dc_tables: DC Huffman tables
+ * @ac_tables: AC Huffman tables
+ *
+ * Helper data structure that holds all AC/DC Huffman tables used to
+ * decode an image.
+ *
+ * Since: 1.6
+ */
+struct _GstJpegHuffmanTables
+{
+ GstJpegHuffmanTable dc_tables[GST_JPEG_MAX_SCAN_COMPONENTS];
+ GstJpegHuffmanTable ac_tables[GST_JPEG_MAX_SCAN_COMPONENTS];
+};
+
+/**
+ * GstJpegScanComponent:
+ * @component_selector: Scan component selector (Csj)
+ * @dc_selector: DC entropy coding table destination selector (Tdj)
+ * @ac_selector: AC entropy coding table destination selector (Taj)
+
+ * Component-specification parameters.
+ *
+ * Since: 1.6
+ */
+struct _GstJpegScanComponent
+{
+ guint8 component_selector; /* 0 .. 255 */
+ guint8 dc_selector; /* 0 .. 3 */
+ guint8 ac_selector; /* 0 .. 3 */
+};
+
+/**
+ * GstJpegScanHdr:
+ * @num_components: Number of image components in scan (Ns)
+ * @components: Image components
+ *
+ * Scan header.
+ *
+ * Since: 1.6
+ */
+struct _GstJpegScanHdr
+{
+ guint8 num_components; /* 1 .. 4 */
+ GstJpegScanComponent components[GST_JPEG_MAX_SCAN_COMPONENTS];
+
+ /*< private >*/
+ guint8 _reserved1; /* Ss */
+ guint8 _reserved2; /* Se */
+ guint8 _reserved3; /* Al */
+ guint8 _reserved4; /* Ah */
+};
+
+/**
+ * GstJpegFrameComponent:
+ * @identifier: Component identifier (Ci)
+ * @horizontal_factor: Horizontal sampling factor (Hi)
+ * @vertical_factor: Vertical sampling factor (Vi)
+ * @quant_table_selector: Quantization table destination selector (Tqi)
+ *
+ * Component-specification parameters.
+ *
+ * Since: 1.6
+ */
+struct _GstJpegFrameComponent
+{
+ guint8 identifier; /* 0 .. 255 */
+ guint8 horizontal_factor; /* 1 .. 4 */
+ guint8 vertical_factor; /* 1 .. 4 */
+ guint8 quant_table_selector; /* 0 .. 3 */
+};
+
+/**
+ * GstJpegFrameHdr:
+ * @sample_precision: Sample precision (P)
+ * @height: Number of lines (Y)
+ * @width: Number of samples per line (X)
+ * @num_components: Number of image components in frame (Nf)
+ * @components: Image components
+ * @restart_interval: Number of MCU in the restart interval (Ri)
+ *
+ * Frame header.
+ *
+ * Since: 1.6
+ */
+struct _GstJpegFrameHdr
+{
+ guint8 sample_precision; /* 2 .. 16 */
+ guint16 width; /* 1 .. 65535 */
+ guint16 height; /* 0 .. 65535 */
+ guint8 num_components; /* 1 .. 255 */
+ GstJpegFrameComponent components[GST_JPEG_MAX_FRAME_COMPONENTS];
+};
+
+/**
+ * GstJpegSegment:
+ * @marker: The type of the segment that starts at @offset
+ * @data: the data containing the jpeg segment starting at @offset
+ * @offset: The offset to the segment start in bytes. This is the
+ * exact start of the segment, no marker code included
+ * @size: The size of the segment in bytes, or -1 if the end was not
+ * found. It is the exact size of the segment, without the sync byte and
+ * marker code but including any length bytes.
+ *
+ * A structure that contains the type of a segment, its offset and its size.
+ *
+ * Since: 1.6
+ */
+struct _GstJpegSegment
+{
+ GstJpegMarker marker;
+ const guint8 *data;
+ guint offset;
+ gssize size;
+};
+
+GST_CODEC_PARSERS_API
+gboolean gst_jpeg_parse (GstJpegSegment * seg,
+ const guint8 * data,
+ gsize size,
+ guint offset);
+
+GST_CODEC_PARSERS_API
+gboolean gst_jpeg_segment_parse_frame_header (const GstJpegSegment * segment,
+ GstJpegFrameHdr * frame_hdr);
+
+GST_CODEC_PARSERS_API
+gboolean gst_jpeg_segment_parse_scan_header (const GstJpegSegment * segment,
+ GstJpegScanHdr * scan_hdr);
+
+GST_CODEC_PARSERS_API
+gboolean gst_jpeg_segment_parse_huffman_table (const GstJpegSegment * segment,
+ GstJpegHuffmanTables * huff_tables);
+
+GST_CODEC_PARSERS_API
+gboolean gst_jpeg_segment_parse_restart_interval (const GstJpegSegment * segment,
+ guint * interval);
+
+GST_CODEC_PARSERS_API
+gboolean gst_jpeg_segment_parse_quantization_table (const GstJpegSegment * segment,
+ GstJpegQuantTables * quant_tables);
+
+GST_CODEC_PARSERS_API
+void gst_jpeg_get_default_quantization_tables (GstJpegQuantTables * quant_tables);
+
+GST_CODEC_PARSERS_API
+void gst_jpeg_get_default_huffman_tables (GstJpegHuffmanTables * huff_tables);
+
+G_END_DECLS
+
+#endif /* GST_JPEG_PARSER_H */
diff --git a/include/gst/codecparsers/gstmpeg4parser.h b/include/gst/codecparsers/gstmpeg4parser.h
new file mode 100644
index 0000000000..7916c28898
--- /dev/null
+++ b/include/gst/codecparsers/gstmpeg4parser.h
@@ -0,0 +1,592 @@
+/*
+ * GStreamer
+ * Copyright (C) 2009 Carl-Anton Ingmarsson <ca.ingmarsson@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_MPEG4UTIL_H__
+#define __GST_MPEG4UTIL_H__
+
+#include <gst/gst.h>
+#include <gst/codecparsers/codecparsers-prelude.h>
+
+#ifndef GST_USE_UNSTABLE_API
+#warning "The MPEG4 parsing library is unstable API and may change in future."
+#warning "You can define GST_USE_UNSTABLE_API to avoid this warning."
+#endif
+
+G_BEGIN_DECLS
+
+typedef struct _GstMpeg4VisualObjectSequence GstMpeg4VisualObjectSequence;
+typedef struct _GstMpeg4VisualObject GstMpeg4VisualObject;
+typedef struct _GstMpeg4VideoObjectLayer GstMpeg4VideoObjectLayer;
+typedef struct _GstMpeg4GroupOfVOP GstMpeg4GroupOfVOP;
+typedef struct _GstMpeg4VideoObjectPlane GstMpeg4VideoObjectPlane;
+typedef struct _GstMpeg4VideoSignalType GstMpeg4VideoSignalType;
+typedef struct _GstMpeg4VideoPlaneShortHdr GstMpeg4VideoPlaneShortHdr;
+typedef struct _GstMpeg4VideoPacketHdr GstMpeg4VideoPacketHdr;
+
+typedef struct _GstMpeg4SpriteTrajectory GstMpeg4SpriteTrajectory;
+
+typedef struct _GstMpeg4Packet GstMpeg4Packet;
+
+/**
+ * GstMpeg4StartCode:
+ *
+ * Defines the different startcodes present in the bitstream as
+ * defined in: Table 6-3 — Start code values
+ */
+typedef enum
+{
+ GST_MPEG4_VIDEO_OBJ_FIRST = 0x00,
+ GST_MPEG4_VIDEO_OBJ_LAST = 0x1f,
+ GST_MPEG4_VIDEO_LAYER_FIRST = 0x20,
+ GST_MPEG4_VIDEO_LAYER_LAST = 0x2f,
+ GST_MPEG4_VISUAL_OBJ_SEQ_START = 0xb0,
+ GST_MPEG4_VISUAL_OBJ_SEQ_END = 0xb1,
+ GST_MPEG4_USER_DATA = 0xb2,
+ GST_MPEG4_GROUP_OF_VOP = 0xb3,
+ GST_MPEG4_VIDEO_SESSION_ERR = 0xb4,
+ GST_MPEG4_VISUAL_OBJ = 0xb5,
+ GST_MPEG4_VIDEO_OBJ_PLANE = 0xb6,
+ GST_MPEG4_FBA = 0xba,
+ GST_MPEG4_FBA_PLAN = 0xbb,
+ GST_MPEG4_MESH = 0xbc,
+ GST_MPEG4_MESH_PLAN = 0xbd,
+ GST_MPEG4_STILL_TEXTURE_OBJ = 0xbe,
+ GST_MPEG4_TEXTURE_SPATIAL = 0xbf,
+ GST_MPEG4_TEXTURE_SNR_LAYER = 0xc0,
+ GST_MPEG4_TEXTURE_TILE = 0xc1,
+ GST_MPEG4_SHAPE_LAYER = 0xc2,
+ GST_MPEG4_STUFFING = 0xc3,
+ GST_MPEG4_SYSTEM_FIRST = 0xc6,
+ GST_MPEG4_SYSTEM_LAST = 0xff,
+ GST_MPEG4_RESYNC = 0xfff
+} GstMpeg4StartCode;
+
+/**
+ * GstMpeg4VisualObjectType:
+ *
+ * Defines the different visual object types as
+ * defined in: Table 6-5 -- Meaning of visual object type
+ */
+typedef enum {
+ GST_MPEG4_VIDEO_ID = 0x01,
+ GST_MPEG4_STILL_TEXTURE_ID = 0x02,
+ GST_MPEG4_STILL_MESH_ID = 0x03,
+ GST_MPEG4_STILL_FBA_ID = 0x04,
+ GST_MPEG4_STILL_3D_MESH_ID = 0x05,
+ /*... reserved */
+
+} GstMpeg4VisualObjectType;
+
+/**
+ * GstMpeg4AspectRatioInfo:
+ * @GST_MPEG4_SQUARE: 1:1 square
+ * @GST_MPEG4_625_TYPE_4_3: 12:11 (625-type for 4:3 picture)
+ * @GST_MPEG4_525_TYPE_4_3: 10:11 (525-type for 4:3 picture)
+ * @GST_MPEG4_625_TYPE_16_9: 16:11 (625-type stretched for 16:9 picture)
+ * @GST_MPEG4_525_TYPE_16_9: 40:33 (525-type stretched for 16:9 picture)
+ * @GST_MPEG4_EXTENDED_PAR: Extended par
+ *
+ * Defines the different pixel aspect ratios as
+ * defined in: Table 6-12 -- Meaning of pixel aspect ratio
+ */
+typedef enum {
+ GST_MPEG4_SQUARE = 0x01,
+ GST_MPEG4_625_TYPE_4_3 = 0x02,
+ GST_MPEG4_525_TYPE_4_3 = 0x03,
+ GST_MPEG4_625_TYPE_16_9 = 0x04,
+ GST_MPEG4_525_TYPE_16_9 = 0x05,
+ GST_MPEG4_EXTENDED_PAR = 0x0f,
+} GstMpeg4AspectRatioInfo;
+
+/**
+ * GstMpeg4ParseResult:
+ * @GST_MPEG4_PARSER_OK: The parsing went well
+ * @GST_MPEG4_PARSER_BROKEN_DATA: The bitstream was broken
+ * @GST_MPEG4_PARSER_NO_PACKET: There was no packet in the buffer
+ * @GST_MPEG4_PARSER_NO_PACKET_END: There was no packet end in the buffer
+ * @GST_MPEG4_PARSER_NO_PACKET_ERROR: An error accured durint the parsing
+ *
+ * Result type of any parsing function.
+ */
+typedef enum {
+ GST_MPEG4_PARSER_OK,
+ GST_MPEG4_PARSER_BROKEN_DATA,
+ GST_MPEG4_PARSER_NO_PACKET,
+ GST_MPEG4_PARSER_NO_PACKET_END,
+ GST_MPEG4_PARSER_ERROR,
+} GstMpeg4ParseResult;
+
+/**
+ * GstMpeg4VideoObjectCodingType:
+ * @GST_MPEG4_I_VOP: intra-coded (I)
+ * @GST_MPEG4_P_VOP: predictive-coded (P)
+ * @GST_MPEG4_B_VOP: bidirectionally-predictive-coded (B)
+ * @GST_MPEG4_S_VOP: sprite (S)
+ *
+ * The vop coding types as defined in:
+ * Table 6-20 -- Meaning of vop_coding_type
+ */
+typedef enum {
+ GST_MPEG4_I_VOP = 0x0,
+ GST_MPEG4_P_VOP = 0x1,
+ GST_MPEG4_B_VOP = 0x2,
+ GST_MPEG4_S_VOP = 0x3
+} GstMpeg4VideoObjectCodingType;
+
+/**
+ * GstMpeg4ChromaFormat:
+ *
+ * The chroma format in use as
+ * defined in: Table 6-13 -- Meaning of chroma_format
+ */
+typedef enum {
+ /* Other value are reserved */
+ GST_MPEG4_CHROMA_4_2_0 = 0x01
+} GstMpeg4ChromaFormat;
+
+/**
+ * GstMpeg4VideoObjectLayerShape:
+ *
+ * The different video object layer shapes as defined in:
+ * Table 6-16 — Video Object Layer shape type
+ */
+typedef enum {
+ GST_MPEG4_RECTANGULAR,
+ GST_MPEG4_BINARY,
+ GST_MPEG4_BINARY_ONLY,
+ GST_MPEG4_GRAYSCALE
+} GstMpeg4VideoObjectLayerShape;
+
+/**
+ * GstMpeg4SpriteEnable:
+ *
+ * Indicates the usage of static sprite coding
+ * or global motion compensation (GMC) as defined in:
+ * Table V2 - 2 -- Meaning of sprite_enable codewords
+ */
+typedef enum {
+ GST_MPEG4_SPRITE_UNUSED,
+ GST_MPEG4_SPRITE_STATIC,
+ GST_MPEG4_SPRITE_GMG
+} GstMpeg4SpriteEnable;
+
+/**
+ * GstMpeg4Profile:
+ *
+ * Different defined profiles as defined in:
+ * 9- Profiles and levels
+ *
+ * It is computed using:
+ * Table G.1 — FLC table for profile_and_level_indication
+ */
+typedef enum {
+ GST_MPEG4_PROFILE_CORE,
+ GST_MPEG4_PROFILE_MAIN,
+ GST_MPEG4_PROFILE_N_BIT,
+ GST_MPEG4_PROFILE_SIMPLE,
+ GST_MPEG4_PROFILE_HYBRID,
+ GST_MPEG4_PROFILE_RESERVED,
+ GST_MPEG4_PROFILE_SIMPLE_FBA,
+ GST_MPEG4_PROFILE_CORE_STUDIO,
+ GST_MPEG4_PROFILE_SIMPLE_STUDIO,
+ GST_MPEG4_PROFILE_CORE_SCALABLE,
+ GST_MPEG4_PROFILE_ADVANCED_CORE,
+ GST_MPEG4_PROFILE_ADVANCED_SIMPLE,
+ GST_MPEG4_PROFILE_SIMPLE_SCALABLE,
+ GST_MPEG4_PROFILE_SCALABLE_TEXTURE,
+ GST_MPEG4_PROFILE_SIMPLE_FACE_ANIMATION,
+ GST_MPEG4_PROFILE_BASIC_ANIMATED_TEXTURE,
+ GST_MPEG4_PROFILE_ADVANCED_REALTIME_SIMPLE,
+ GST_MPEG4_PROFILE_ADVANCED_SCALABLE_TEXTURE,
+ GST_MPEG4_PROFILE_FINE_GRANULARITY_SCALABLE,
+ GST_MPEG4_PROFILE_ADVANCED_CODING_EFFICIENCY
+} GstMpeg4Profile;
+
+/**
+ * GstMpeg4Level:
+ *
+ * Different levels as defined in:
+ * 9- Profiles and levels
+ *
+ * It is computed using:
+ * Table G.1 — FLC table for profile_and_level_indication
+ */
+typedef enum {
+ GST_MPEG4_LEVEL0,
+ GST_MPEG4_LEVEL1,
+ GST_MPEG4_LEVEL2,
+ GST_MPEG4_LEVEL3,
+ GST_MPEG4_LEVEL3b,
+ GST_MPEG4_LEVEL4,
+ GST_MPEG4_LEVEL5,
+ GST_MPEG4_LEVEL_RESERVED
+} GstMpeg4Level;
+
+/**
+ * GstMpeg4VisualObjectSequence:
+ *
+ * The visual object sequence structure as defined in:
+ * 6.2.2 Visual Object Sequence and Visual Object
+ */
+struct _GstMpeg4VisualObjectSequence {
+ guint8 profile_and_level_indication;
+
+ /* Computed according to:
+ * Table G.1 — FLC table for profile_and_level_indication */
+ GstMpeg4Level level;
+ GstMpeg4Profile profile;
+};
+
+/**
+ * GstMpeg4VisualObject:
+ *
+ * The visual object structure as defined in:
+ * 6.2.2 Visual Object Sequence and Visual Object
+ */
+struct _GstMpeg4VisualObject {
+ guint8 is_identifier;
+ /* If is_identifier */
+ guint8 verid;
+ guint8 priority;
+
+ GstMpeg4VisualObjectType type;
+};
+
+/**
+ * GstMpeg4VideoSignalType:
+ *
+ * The video signal type structure as defined in:
+ * 6.2.2 Visual Object Sequence and Visual Object.
+ */
+struct _GstMpeg4VideoSignalType {
+ guint8 type;
+
+ guint8 format;
+ guint8 range;
+ guint8 color_description;
+ guint8 color_primaries;
+ guint8 transfer_characteristics;
+ guint8 matrix_coefficients;
+};
+
+/**
+ * GstMpeg4VideoPlaneShortHdr:
+ *
+ * The video plane short header structure as defined in:
+ * 6.2.5.2 Video Plane with Short Header
+ */
+struct _GstMpeg4VideoPlaneShortHdr {
+ guint8 temporal_reference;
+ guint8 split_screen_indicator;
+ guint8 document_camera_indicator;
+ guint8 full_picture_freeze_release;
+ guint8 source_format;
+ guint8 picture_coding_type;
+ guint8 vop_quant;
+ guint8 pei;
+ guint8 psupp;
+
+ /* Gob layer specific fields */
+ guint8 gob_header_empty;
+ guint8 gob_number;
+ guint8 gob_frame_id;
+ guint8 quant_scale;
+
+ /* Computed
+ * If all the values are set to 0, then it is reserved
+ * Table 6-25 -- Parameters Defined by source_format Field
+ */
+ guint16 vop_width;
+ guint16 vop_height;
+ guint16 num_macroblocks_in_gob;
+ guint8 num_gobs_in_vop;
+
+ /* The size in bits */
+ guint size;
+};
+
+/**
+ * GstMpeg4VideoObjectLayer:
+ *
+ * The video object layer structure as defined in:
+ * 6.2.3 Video Object Layer
+ */
+struct _GstMpeg4VideoObjectLayer {
+ guint8 random_accessible_vol;
+ guint8 video_object_type_indication;
+
+ guint8 is_object_layer_identifier;
+ /* if is_object_layer_identifier */
+ guint8 verid;
+ guint8 priority;
+
+ GstMpeg4AspectRatioInfo aspect_ratio_info;
+ guint8 par_width;
+ guint8 par_height;
+
+ guint8 control_parameters;
+ /* if control_parameters */
+ GstMpeg4ChromaFormat chroma_format;
+ guint8 low_delay;
+ guint8 vbv_parameters;
+ /* if vbv_parameters */
+ guint16 first_half_bitrate;
+ guint16 latter_half_bitrate;
+ guint16 first_half_vbv_buffer_size;
+ guint16 latter_half_vbv_buffer_size;
+ guint16 first_half_vbv_occupancy;
+ guint16 latter_half_vbv_occupancy;
+
+ /* Computed values */
+ guint32 bit_rate;
+ guint32 vbv_buffer_size;
+
+ GstMpeg4VideoObjectLayerShape shape;
+ /* if shape == GST_MPEG4_GRAYSCALE && verid =! 1 */
+ guint8 shape_extension;
+
+ guint16 vop_time_increment_resolution;
+ guint8 vop_time_increment_bits;
+ guint8 fixed_vop_rate;
+ /* if fixed_vop_rate */
+ guint16 fixed_vop_time_increment;
+
+ guint16 width;
+ guint16 height;
+ guint8 interlaced;
+ guint8 obmc_disable;
+
+ GstMpeg4SpriteEnable sprite_enable;
+ /* if vol->sprite_enable == SPRITE_GMG or SPRITE_STATIC*/
+ /* if vol->sprite_enable != GST_MPEG4_SPRITE_GMG */
+ guint16 sprite_width;
+ guint16 sprite_height;
+ guint16 sprite_left_coordinate;
+ guint16 sprite_top_coordinate;
+
+ guint8 no_of_sprite_warping_points;
+ guint8 sprite_warping_accuracy;
+ guint8 sprite_brightness_change;
+ /* if vol->sprite_enable != GST_MPEG4_SPRITE_GMG */
+ guint8 low_latency_sprite_enable;
+
+ /* if shape != GST_MPEG4_RECTANGULAR */
+ guint8 sadct_disable;
+
+ guint8 not_8_bit;
+
+ /* if no_8_bit */
+ guint8 quant_precision;
+ guint8 bits_per_pixel;
+
+ /* if shape == GRAYSCALE */
+ guint8 no_gray_quant_update;
+ guint8 composition_method;
+ guint8 linear_composition;
+
+ guint8 quant_type;
+ /* if quant_type */
+ guint8 load_intra_quant_mat;
+ guint8 intra_quant_mat[64];
+ guint8 load_non_intra_quant_mat;
+ guint8 non_intra_quant_mat[64];
+
+ guint8 quarter_sample;
+ guint8 complexity_estimation_disable;
+ guint8 resync_marker_disable;
+ guint8 data_partitioned;
+ guint8 reversible_vlc;
+ guint8 newpred_enable;
+ guint8 reduced_resolution_vop_enable;
+ guint8 scalability;
+ guint8 enhancement_type;
+
+ GstMpeg4VideoPlaneShortHdr short_hdr;
+};
+
+/**
+ * GstMpeg4SpriteTrajectory:
+ *
+ * The sprite trajectory structure as defined in:
+ * 7.8.4 Sprite reference point decoding and
+ * 6.2.5.4 Sprite coding
+ */
+struct _GstMpeg4SpriteTrajectory {
+ guint16 vop_ref_points[63]; /* Defined as "du" in 6.2.5.4 */
+ guint16 sprite_ref_points[63]; /* Defined as "dv" in 6.2.5.4 */
+};
+
+/**
+ * GstMpeg4GroupOfVOP:
+ *
+ * The group of video object plane structure as defined in:
+ * 6.2.4 Group of Video Object Plane
+ */
+struct _GstMpeg4GroupOfVOP {
+ guint8 hours;
+ guint8 minutes;
+ guint8 seconds;
+
+ guint8 closed;
+ guint8 broken_link;
+};
+
+/**
+ * GstMpeg4VideoObjectPlane:
+ *
+ * The Video object plane structure as defined in:
+ * 6.2.5 Video Object Plane and Video Plane with Short Header
+ */
+struct _GstMpeg4VideoObjectPlane {
+ GstMpeg4VideoObjectCodingType coding_type;
+
+ guint8 modulo_time_base;
+ guint16 time_increment;
+
+ guint8 coded;
+ /* if newpred_enable */
+ guint16 id;
+ guint8 id_for_prediction_indication;
+ guint16 id_for_prediction;
+
+ guint16 width;
+ guint16 height;
+ guint16 horizontal_mc_spatial_ref;
+ guint16 vertical_mc_spatial_ref;
+
+ guint8 rounding_type;
+ /*if vol->shape != GST_MPEG4_RECTANGULAR */
+ guint8 background_composition;
+ guint8 change_conv_ratio_disable;
+ guint8 constant_alpha;
+ guint8 constant_alpha_value;
+ guint8 reduced_resolution;
+
+ guint8 intra_dc_vlc_thr;
+
+
+ guint8 top_field_first;
+ guint8 alternate_vertical_scan_flag;
+
+ guint16 quant;
+
+ guint8 fcode_forward;
+ guint8 fcode_backward;
+
+ guint8 shape_coding_type;
+ guint8 load_backward_shape;
+ guint8 ref_select_code;
+
+ /* Computed macroblock information */
+ guint16 mb_height;
+ guint16 mb_width;
+ guint mb_num;
+
+ /* The size of the header */
+ guint size;
+};
+
+/**
+ * GstMpeg4VideoPacketHdr:
+ * @size: Size of the header in bit.
+ *
+ * The video packet header structure as defined in:
+ * 6.2.5.2 Video Plane with Short Header
+ */
+struct _GstMpeg4VideoPacketHdr {
+ guint8 header_extension_code;
+ guint16 macroblock_number;
+ guint16 quant_scale;
+ guint size;
+};
+
+/**
+ * GstMpeg4Packet:
+ * @type: the type of the packet that start at @offset
+ * @data: the data containing packet starting at @offset
+ * @offset: offset of the start of the packet (without the 3 bytes startcode), but
+ * including the #GstMpeg4StartCode byte.
+ * @size: The size in bytes of the packet or %G_MAXUINT if the end wasn't found.
+ * @marker_size: The size in bit of the resync marker.
+ *
+ * A structure that contains the type of a packet, its offset and its size
+ */
+struct _GstMpeg4Packet
+{
+ const guint8 *data;
+ guint offset;
+ gsize size;
+ guint marker_size;
+
+ GstMpeg4StartCode type;
+};
+
+GST_CODEC_PARSERS_API
+GstMpeg4ParseResult gst_h263_parse (GstMpeg4Packet * packet,
+ const guint8 * data, guint offset,
+ gsize size);
+
+
+GST_CODEC_PARSERS_API
+GstMpeg4ParseResult gst_mpeg4_parse (GstMpeg4Packet * packet,
+ gboolean skip_user_data,
+ GstMpeg4VideoObjectPlane *vop,
+ const guint8 * data, guint offset,
+ gsize size);
+GST_CODEC_PARSERS_API
+GstMpeg4ParseResult
+gst_mpeg4_parse_video_object_plane (GstMpeg4VideoObjectPlane *vop,
+ GstMpeg4SpriteTrajectory *sprite_trajectory,
+ GstMpeg4VideoObjectLayer *vol,
+ const guint8 * data,
+ gsize size);
+GST_CODEC_PARSERS_API
+GstMpeg4ParseResult
+gst_mpeg4_parse_group_of_vop (GstMpeg4GroupOfVOP *gov,
+ const guint8 * data, gsize size);
+GST_CODEC_PARSERS_API
+GstMpeg4ParseResult
+gst_mpeg4_parse_video_object_layer (GstMpeg4VideoObjectLayer *vol,
+ GstMpeg4VisualObject *vo,
+ const guint8 * data, gsize size);
+GST_CODEC_PARSERS_API
+GstMpeg4ParseResult
+gst_mpeg4_parse_visual_object (GstMpeg4VisualObject *vo,
+ GstMpeg4VideoSignalType *signal_type,
+ const guint8 * data, gsize size);
+GST_CODEC_PARSERS_API
+GstMpeg4ParseResult
+gst_mpeg4_parse_visual_object_sequence (GstMpeg4VisualObjectSequence *vos,
+ const guint8 * data, gsize size);
+GST_CODEC_PARSERS_API
+GstMpeg4ParseResult
+gst_mpeg4_parse_video_plane_short_header (GstMpeg4VideoPlaneShortHdr * shorthdr,
+ const guint8 * data, gsize size);
+GST_CODEC_PARSERS_API
+GstMpeg4ParseResult
+gst_mpeg4_parse_video_packet_header (GstMpeg4VideoPacketHdr * videopackethdr,
+ GstMpeg4VideoObjectLayer * vol,
+ GstMpeg4VideoObjectPlane * vop,
+ GstMpeg4SpriteTrajectory * sprite_trajectory,
+ const guint8 * data, gsize size);
+
+G_END_DECLS
+
+#endif /* __GST_MPEG4UTIL_H__ */
diff --git a/include/gst/codecparsers/gstmpegvideometa.h b/include/gst/codecparsers/gstmpegvideometa.h
new file mode 100644
index 0000000000..df33d97666
--- /dev/null
+++ b/include/gst/codecparsers/gstmpegvideometa.h
@@ -0,0 +1,92 @@
+/* Gstreamer
+ * Copyright (C) <2012> Edward Hervey <edward@collabora.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GST_MPEG_VIDEO_META_H__
+#define __GST_MPEG_VIDEO_META_H__
+
+#ifndef GST_USE_UNSTABLE_API
+#warning "The Mpeg video parsing library is unstable API and may change in future."
+#warning "You can define GST_USE_UNSTABLE_API to avoid this warning."
+#endif
+
+#include <gst/gst.h>
+#include <gst/codecparsers/gstmpegvideoparser.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GstMpegVideoMeta GstMpegVideoMeta;
+
+GST_CODEC_PARSERS_API
+GType gst_mpeg_video_meta_api_get_type (void);
+#define GST_MPEG_VIDEO_META_API_TYPE (gst_mpeg_video_meta_api_get_type())
+#define GST_MPEG_VIDEO_META_INFO (gst_mpeg_video_meta_get_info())
+GST_CODEC_PARSERS_API
+const GstMetaInfo * gst_mpeg_video_meta_get_info (void);
+
+/**
+ * GstMpegVideoMeta:
+ * @meta: parent #GstMeta
+ * @sequencehdr: the #GstMpegVideoSequenceHdr if present in the buffer
+ * @sequenceext: the #GstMpegVideoSequenceExt if present in the buffer
+ * @sequencedispext: the #GstMpegVideoSequenceDisplayExt if present in the
+ * buffer.
+ * @pichdr: the #GstMpegVideoPictureHdr if present in the buffer.
+ * @picext: the #GstMpegVideoPictureExt if present in the buffer.
+ * @quantext: the #GstMpegVideoQuantMatrixExt if present in the buffer
+ *
+ * Extra buffer metadata describing the contents of a MPEG1/2 Video frame
+ *
+ * Can be used by elements (mainly decoders) to avoid having to parse
+ * Mpeg video 1/2 packets if it can be done upstream.
+ *
+ * The various fields are only valid during the lifetime of the #GstMpegVideoMeta.
+ * If elements wish to use those for longer, they are required to make a copy.
+ *
+ * Since: 1.2
+ */
+struct _GstMpegVideoMeta {
+ GstMeta meta;
+
+ GstMpegVideoSequenceHdr *sequencehdr;
+ GstMpegVideoSequenceExt *sequenceext;
+ GstMpegVideoSequenceDisplayExt *sequencedispext;
+ GstMpegVideoPictureHdr *pichdr;
+ GstMpegVideoPictureExt *picext;
+ GstMpegVideoQuantMatrixExt *quantext;
+
+ guint num_slices;
+ gsize slice_offset;
+};
+
+
+#define gst_buffer_get_mpeg_video_meta(b) ((GstMpegVideoMeta*)gst_buffer_get_meta((b),GST_MPEG_VIDEO_META_API_TYPE))
+
+GST_CODEC_PARSERS_API
+GstMpegVideoMeta *
+gst_buffer_add_mpeg_video_meta (GstBuffer * buffer,
+ const GstMpegVideoSequenceHdr *seq_hdr,
+ const GstMpegVideoSequenceExt *seq_ext,
+ const GstMpegVideoSequenceDisplayExt *disp_ext,
+ const GstMpegVideoPictureHdr *pic_hdr,
+ const GstMpegVideoPictureExt *pic_ext,
+ const GstMpegVideoQuantMatrixExt *quant_ext);
+
+G_END_DECLS
+
+#endif
diff --git a/include/gst/codecparsers/gstmpegvideoparser.h b/include/gst/codecparsers/gstmpegvideoparser.h
new file mode 100644
index 0000000000..008e67a150
--- /dev/null
+++ b/include/gst/codecparsers/gstmpegvideoparser.h
@@ -0,0 +1,570 @@
+/* Gstreamer
+ * Copyright (C) <2011> Intel Corporation
+ * Copyright (C) <2011> Collabora Ltd.
+ * Copyright (C) <2011> Thibault Saunier <thibault.saunier@collabora.com>
+ *
+ * From bad/sys/vdpau/mpeg/mpegutil.c:
+ * Copyright (C) <2007> Jan Schmidt <thaytan@mad.scientist.com>
+ * Copyright (C) <2009> Carl-Anton Ingmarsson <ca.ingmarsson@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_MPEG_VIDEO_UTILS_H__
+#define __GST_MPEG_VIDEO_UTILS_H__
+
+#ifndef GST_USE_UNSTABLE_API
+#warning "The Mpeg video parsing library is unstable API and may change in future."
+#warning "You can define GST_USE_UNSTABLE_API to avoid this warning."
+#endif
+
+#include <gst/gst.h>
+#include <gst/codecparsers/codecparsers-prelude.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GstMpegVideoPacketTypeCode:
+ * @GST_MPEG_VIDEO_PACKET_PICTURE: Picture packet starting code
+ * @GST_MPEG_VIDEO_PACKET_SLICE_MIN: Slice min packet starting code
+ * @GST_MPEG_VIDEO_PACKET_SLICE_MAX: Slice max packet starting code
+ * @GST_MPEG_VIDEO_PACKET_USER_DATA: User data packet starting code
+ * @GST_MPEG_VIDEO_PACKET_SEQUENCE : Sequence packet starting code
+ * @GST_MPEG_VIDEO_PACKET_EXTENSION: Extension packet starting code
+ * @GST_MPEG_VIDEO_PACKET_SEQUENCE_END: Sequence end packet code
+ * @GST_MPEG_VIDEO_PACKET_GOP: Group of Picture packet starting code
+ * @GST_MPEG_VIDEO_PACKET_NONE: None packet code
+ *
+ * Indicates the type of MPEG packet
+ */
+typedef enum {
+ GST_MPEG_VIDEO_PACKET_PICTURE = 0x00,
+ GST_MPEG_VIDEO_PACKET_SLICE_MIN = 0x01,
+ GST_MPEG_VIDEO_PACKET_SLICE_MAX = 0xaf,
+ GST_MPEG_VIDEO_PACKET_USER_DATA = 0xb2,
+ GST_MPEG_VIDEO_PACKET_SEQUENCE = 0xb3,
+ GST_MPEG_VIDEO_PACKET_EXTENSION = 0xb5,
+ GST_MPEG_VIDEO_PACKET_SEQUENCE_END = 0xb7,
+ GST_MPEG_VIDEO_PACKET_GOP = 0xb8,
+ GST_MPEG_VIDEO_PACKET_NONE = 0xff
+} GstMpegVideoPacketTypeCode;
+
+/**
+ * GST_MPEG_VIDEO_PACKET_IS_SLICE:
+ * @typecode: The MPEG video packet type code
+ *
+ * Checks whether a packet type code is a slice.
+ *
+ * Returns: %TRUE if the packet type code corresponds to a slice,
+ * else %FALSE.
+ */
+#define GST_MPEG_VIDEO_PACKET_IS_SLICE(typecode) ((typecode) >= GST_MPEG_VIDEO_PACKET_SLICE_MIN && \
+ (typecode) <= GST_MPEG_VIDEO_PACKET_SLICE_MAX)
+
+/**
+ * GstMpegVideoPacketExtensionCode:
+ * @GST_MPEG_VIDEO_PACKET_EXT_SEQUENCE: Sequence extension code
+ * @GST_MPEG_VIDEO_PACKET_EXT_SEQUENCE_DISPLAY: Sequence Display extension code
+ * @GST_MPEG_VIDEO_PACKET_EXT_QUANT_MATRIX: Quantization Matrix extension code
+ * @GST_MPEG_VIDEO_PACKET_EXT_SEQUENCE_SCALABLE: Sequence Scalable extension code
+ * @GST_MPEG_VIDEO_PACKET_EXT_PICTURE: Picture coding extension
+ *
+ * Indicates what type of packets are in this block, some are mutually
+ * exclusive though - ie, sequence packs are accumulated separately. GOP &
+ * Picture may occur together or separately.
+ */
+typedef enum {
+ GST_MPEG_VIDEO_PACKET_EXT_SEQUENCE = 0x01,
+ GST_MPEG_VIDEO_PACKET_EXT_SEQUENCE_DISPLAY = 0x02,
+ GST_MPEG_VIDEO_PACKET_EXT_QUANT_MATRIX = 0x03,
+ GST_MPEG_VIDEO_PACKET_EXT_SEQUENCE_SCALABLE = 0x05,
+ GST_MPEG_VIDEO_PACKET_EXT_PICTURE = 0x08
+} GstMpegVideoPacketExtensionCode;
+
+/**
+ * GstMpegVideoSequenceScalableMode:
+ * @GST_MPEG_VIDEO_SEQ_SCALABLE_MODE_DATA_PARTITIONING: Data partitioning
+ * @GST_MPEG_VIDEO_SEQ_SCALABLE_MODE_SPATIAL: Spatial Scalability
+ * @GST_MPEG_VIDEO_SEQ_SCALABLE_MODE_SNR: SNR Scalability
+ * @GST_MPEG_VIDEO_SEQ_SCALABLE_MODE_TEMPORAL: Temporal Scalability
+ */
+typedef enum {
+ GST_MPEG_VIDEO_SEQ_SCALABLE_MODE_DATA_PARTITIONING = 0x00,
+ GST_MPEG_VIDEO_SEQ_SCALABLE_MODE_SPATIAL = 0x01,
+ GST_MPEG_VIDEO_SEQ_SCALABLE_MODE_SNR = 0x02,
+ GST_MPEG_VIDEO_SEQ_SCALABLE_MODE_TEMPORAL = 0x03
+} GstMpegVideoSequenceScalableMode;
+
+/**
+ * GstMpegVideoLevel:
+ * @GST_MPEG_VIDEO_LEVEL_LOW: Low level (LL)
+ * @GST_MPEG_VIDEO_LEVEL_MAIN: Main level (ML)
+ * @GST_MPEG_VIDEO_LEVEL_HIGH_1440: High 1440 level (H-14)
+ * @GST_MPEG_VIDEO_LEVEL_HIGH: High level (HL)
+ * @GST_MPEG_VIDEO_LEVEL_HIGH_P: High-P level (HL Progressive)
+ *
+ * Mpeg-2 Levels.
+ **/
+typedef enum {
+ GST_MPEG_VIDEO_LEVEL_HIGH_P = 0x02,
+ GST_MPEG_VIDEO_LEVEL_HIGH = 0x04,
+ GST_MPEG_VIDEO_LEVEL_HIGH_1440 = 0x06,
+ GST_MPEG_VIDEO_LEVEL_MAIN = 0x08,
+ GST_MPEG_VIDEO_LEVEL_LOW = 0x0a
+} GstMpegVideoLevel;
+
+/**
+ * GstMpegVideoProfile:
+ * @GST_MPEG_VIDEO_PROFILE_422: 4:2:2 profile (422)
+ * @GST_MPEG_VIDEO_PROFILE_HIGH: High profile (HP)
+ * @GST_MPEG_VIDEO_PROFILE_SPATIALLY_SCALABLE: Spatially Scalable profile (Spatial)
+ * @GST_MPEG_VIDEO_PROFILE_SNR_SCALABLE: SNR Scalable profile (SNR)
+ * @GST_MPEG_VIDEO_PROFILE_MAIN: Main profile (MP)
+ * @GST_MPEG_VIDEO_PROFILE_SIMPLE: Simple profile (SP)
+ *
+ * Mpeg-2 Profiles.
+ **/
+typedef enum {
+ GST_MPEG_VIDEO_PROFILE_422 = 0x00,
+ GST_MPEG_VIDEO_PROFILE_HIGH = 0x01,
+ GST_MPEG_VIDEO_PROFILE_SPATIALLY_SCALABLE = 0x02,
+ GST_MPEG_VIDEO_PROFILE_SNR_SCALABLE = 0x03,
+ GST_MPEG_VIDEO_PROFILE_MAIN = 0x04,
+ GST_MPEG_VIDEO_PROFILE_SIMPLE = 0x05
+} GstMpegVideoProfile;
+
+/**
+ * GstMpegVideoChromaFormat:
+ * @GST_MPEG_VIDEO_CHROMA_RES: Invalid (reserved for future use)
+ * @GST_MPEG_VIDEO_CHROMA_420: 4:2:0 subsampling
+ * @GST_MPEG_VIDEO_CHROMA_422: 4:2:2 subsampling
+ * @GST_MPEG_VIDEO_CHROMA_444: 4:4:4 (non-subsampled)
+ *
+ * Chroma subsampling type.
+ */
+typedef enum {
+ GST_MPEG_VIDEO_CHROMA_RES = 0x00,
+ GST_MPEG_VIDEO_CHROMA_420 = 0x01,
+ GST_MPEG_VIDEO_CHROMA_422 = 0x02,
+ GST_MPEG_VIDEO_CHROMA_444 = 0x03,
+} GstMpegVideoChromaFormat;
+
+/**
+ * GstMpegVideoPictureType:
+ * @GST_MPEG_VIDEO_PICTURE_TYPE_I: Intra-coded (I) frame
+ * @GST_MPEG_VIDEO_PICTURE_TYPE_P: Predictive-codec (P) frame
+ * @GST_MPEG_VIDEO_PICTURE_TYPE_B: Bidirectionally predictive-coded (B) frame
+ * @GST_MPEG_VIDEO_PICTURE_TYPE_D: D frame
+ *
+ * Picture type.
+ */
+typedef enum {
+ GST_MPEG_VIDEO_PICTURE_TYPE_I = 0x01,
+ GST_MPEG_VIDEO_PICTURE_TYPE_P = 0x02,
+ GST_MPEG_VIDEO_PICTURE_TYPE_B = 0x03,
+ GST_MPEG_VIDEO_PICTURE_TYPE_D = 0x04
+} GstMpegVideoPictureType;
+
+/**
+ * GstMpegVideoPictureStructure:
+ * @GST_MPEG_VIDEO_PICTURE_STRUCTURE_TOP_FIELD: Top field
+ * @GST_MPEG_VIDEO_PICTURE_STRUCTURE_BOTTOM_FIELD: Bottom field
+ * @GST_MPEG_VIDEO_PICTURE_STRUCTURE_FRAME: Frame picture
+ *
+ * Picture structure type.
+ */
+typedef enum {
+ GST_MPEG_VIDEO_PICTURE_STRUCTURE_TOP_FIELD = 0x01,
+ GST_MPEG_VIDEO_PICTURE_STRUCTURE_BOTTOM_FIELD = 0x02,
+ GST_MPEG_VIDEO_PICTURE_STRUCTURE_FRAME = 0x03
+} GstMpegVideoPictureStructure;
+
+typedef struct _GstMpegVideoSequenceHdr GstMpegVideoSequenceHdr;
+typedef struct _GstMpegVideoSequenceExt GstMpegVideoSequenceExt;
+typedef struct _GstMpegVideoSequenceDisplayExt GstMpegVideoSequenceDisplayExt;
+typedef struct _GstMpegVideoSequenceScalableExt GstMpegVideoSequenceScalableExt;
+typedef struct _GstMpegVideoPictureHdr GstMpegVideoPictureHdr;
+typedef struct _GstMpegVideoGop GstMpegVideoGop;
+typedef struct _GstMpegVideoPictureExt GstMpegVideoPictureExt;
+typedef struct _GstMpegVideoQuantMatrixExt GstMpegVideoQuantMatrixExt;
+typedef struct _GstMpegVideoSliceHdr GstMpegVideoSliceHdr;
+typedef struct _GstMpegVideoPacket GstMpegVideoPacket;
+
+/**
+ * GstMpegVideoSequenceHdr:
+ * @width: Width of each frame
+ * @height: Height of each frame
+ * @par_w: Calculated Pixel Aspect Ratio width
+ * @par_h: Calculated Pixel Aspect Ratio height
+ * @fps_n: Calculated Framrate nominator
+ * @fps_d: Calculated Framerate denominator
+ * @bitrate_value: Value of the bitrate as is in the stream (400bps unit)
+ * @bitrate: the real bitrate of the Mpeg video stream in bits per second, 0 if VBR stream
+ * @constrained_parameters_flag: %TRUE if this stream uses constrained parameters.
+ * @load_intra_quantiser_matrix: %TRUE indicates the presence of intra_quantiser_matrix
+ * @intra_quantizer_matrix: intra-quantization table, in zigzag scan order
+ * @load_non_intra_quantiser_matrix: %TRUE indicates the presence of non_intra_quantiser_matrix
+ * @non_intra_quantizer_matrix: non-intra quantization table, in zigzag scan order
+ *
+ * The Mpeg2 Video Sequence Header structure.
+ */
+struct _GstMpegVideoSequenceHdr
+{
+ guint16 width, height;
+ guint8 aspect_ratio_info;
+ guint8 frame_rate_code;
+ guint32 bitrate_value;
+ guint16 vbv_buffer_size_value;
+
+ guint8 constrained_parameters_flag;
+
+ guint8 load_intra_quantiser_matrix;
+ guint8 intra_quantizer_matrix[64];
+ guint8 load_non_intra_quantiser_matrix;
+ guint8 non_intra_quantizer_matrix[64];
+
+ /* Calculated values */
+ guint par_w, par_h;
+ guint fps_n, fps_d;
+ guint bitrate;
+};
+
+/**
+ * GstMpegVideoSequenceExt:
+ * @profile: mpeg2 decoder profile
+ * @level: mpeg2 decoder level
+ * @progressive: %TRUE if the frames are progressive %FALSE otherwise
+ * @chroma_format: indicates the chrominance format
+ * @horiz_size_ext: Horizontal size
+ * @vert_size_ext: Vertical size
+ * @bitrate_ext: The bitrate
+ * @vbv_buffer_size_extension: VBV buffer size
+ * @low_delay: %TRUE if the sequence doesn't contain any B-pictures, %FALSE
+ * otherwise
+ * @fps_n_ext: Framerate nominator code
+ * @fps_d_ext: Framerate denominator code
+ * @profile_level_escape_bit: Escape bit. If set, the meaning of the
+ * @profile and @level fields is different.
+ *
+ * The Mpeg2 Video Sequence Extension structure.
+ **/
+struct _GstMpegVideoSequenceExt
+{
+ /* mpeg2 decoder profile */
+ guint8 profile;
+ /* mpeg2 decoder level */
+ guint8 level;
+
+ guint8 progressive;
+ guint8 chroma_format;
+
+ guint8 horiz_size_ext, vert_size_ext;
+
+ guint16 bitrate_ext;
+ guint8 vbv_buffer_size_extension;
+ guint8 low_delay;
+ guint8 fps_n_ext, fps_d_ext;
+
+ /* Additional information */
+ guint8 profile_level_escape_bit;
+};
+
+/**
+ * GstMpegVideoSequenceDisplayExt:
+ * @video_format: 3-bit video_format field indicating PAL/NTSC etc.
+ * @colour_description_flag: %TRUE if colour information was provided
+ * @colour_primaries: Valid if colour_description_flag is set
+ * @transfer_characteristics: Valid if colour_description_flag is set
+ * @matrix_coefficients: Valid if colour_description_flag is set
+ * @display_horizontal_size: width of decoded frame sub-region to display
+ * @display_vertical_size: height of decoded frame sub-region to display
+ */
+struct _GstMpegVideoSequenceDisplayExt
+{
+ guint8 video_format;
+ guint8 colour_description_flag;
+
+ /* if colour_description_flag: */
+ guint8 colour_primaries;
+ guint8 transfer_characteristics;
+ guint8 matrix_coefficients;
+
+ guint16 display_horizontal_size;
+ guint16 display_vertical_size;
+};
+
+/**
+ * GstMpegVideoSequenceScalableExt:
+ * @scalable_mode:
+ * @layer_id:
+ * @lower_layer_prediction_horizontal_size:
+ * @lower_layer_prediction_vertical_size:
+ * @horizontal_subsampling_factor_m:
+ * @horizontal_subsampling_factor_n:
+ * @vertical_subsampling_factor_m:
+ * @vertical_subsampling_factor_n:
+ * @picture_mux_enable:
+ * @mux_to_progressive_sequence:
+ * @picture_mux_order:
+ * @picture_mux_factor:
+ *
+ * The Sequence Scalable Extension structure.
+ *
+ * Since: 1.2
+ */
+struct _GstMpegVideoSequenceScalableExt
+{
+ guint8 scalable_mode;
+ guint8 layer_id;
+
+ /* if spatial scalability */
+ guint16 lower_layer_prediction_horizontal_size;
+ guint16 lower_layer_prediction_vertical_size;
+ guint8 horizontal_subsampling_factor_m;
+ guint8 horizontal_subsampling_factor_n;
+ guint8 vertical_subsampling_factor_m;
+ guint8 vertical_subsampling_factor_n;
+
+ /* if temporal scalability */
+ guint8 picture_mux_enable;
+ guint8 mux_to_progressive_sequence;
+ guint8 picture_mux_order;
+ guint8 picture_mux_factor;
+};
+
+/**
+ * GstMpegVideoQuantMatrixExt:
+ * @load_intra_quantiser_matrix:
+ * @intra_quantiser_matrix:
+ * @load_non_intra_quantiser_matrix:
+ * @non_intra_quantiser_matrix:
+ * @load_chroma_intra_quantiser_matrix:
+ * @chroma_intra_quantiser_matrix:
+ * @load_chroma_non_intra_quantiser_matrix:
+ * @chroma_non_intra_quantiser_matrix:
+ *
+ * The Quant Matrix Extension structure that exposes quantization
+ * matrices in zigzag scan order. i.e. the original encoded scan
+ * order.
+ */
+struct _GstMpegVideoQuantMatrixExt
+{
+ guint8 load_intra_quantiser_matrix;
+ guint8 intra_quantiser_matrix[64];
+ guint8 load_non_intra_quantiser_matrix;
+ guint8 non_intra_quantiser_matrix[64];
+ guint8 load_chroma_intra_quantiser_matrix;
+ guint8 chroma_intra_quantiser_matrix[64];
+ guint8 load_chroma_non_intra_quantiser_matrix;
+ guint8 chroma_non_intra_quantiser_matrix[64];
+};
+
+/**
+ * GstMpegVideoPictureHdr:
+ * @tsn: Temporal Sequence Number
+ * @pic_type: Type of the frame
+ * @full_pel_forward_vector: the full pel forward flag of
+ * the frame: 0 or 1.
+ * @full_pel_backward_vector: the full pel backward flag
+ * of the frame: 0 or 1.
+ * @f_code: F code
+ *
+ * The Mpeg2 Video Picture Header structure.
+ */
+struct _GstMpegVideoPictureHdr
+{
+ guint16 tsn;
+ guint8 pic_type;
+ guint16 vbv_delay;
+
+ guint8 full_pel_forward_vector, full_pel_backward_vector;
+
+ guint8 f_code[2][2];
+};
+
+/**
+ * GstMpegVideoPictureExt:
+ * @intra_dc_precision: Intra DC precision
+ * @picture_structure: Structure of the picture
+ * @top_field_first: Top field first
+ * @frame_pred_frame_dct: Frame
+ * @concealment_motion_vectors: Concealment Motion Vectors
+ * @q_scale_type: Q Scale Type
+ * @intra_vlc_format: Intra Vlc Format
+ * @alternate_scan: Alternate Scan
+ * @repeat_first_field: Repeat First Field
+ * @chroma_420_type: Chroma 420 Type
+ * @progressive_frame: %TRUE if the frame is progressive %FALSE otherwise
+ *
+ * The Mpeg2 Video Picture Extension structure.
+ */
+struct _GstMpegVideoPictureExt
+{
+ guint8 f_code[2][2];
+
+ guint8 intra_dc_precision;
+ guint8 picture_structure;
+ guint8 top_field_first;
+ guint8 frame_pred_frame_dct;
+ guint8 concealment_motion_vectors;
+ guint8 q_scale_type;
+ guint8 intra_vlc_format;
+ guint8 alternate_scan;
+ guint8 repeat_first_field;
+ guint8 chroma_420_type;
+ guint8 progressive_frame;
+ guint8 composite_display;
+ guint8 v_axis;
+ guint8 field_sequence;
+ guint8 sub_carrier;
+ guint8 burst_amplitude;
+ guint8 sub_carrier_phase;
+};
+
+/**
+ * GstMpegVideoGop:
+ * @drop_frame_flag: Drop Frame Flag
+ * @hour: Hour (0-23)
+ * @minute: Minute (O-59)
+ * @second: Second (0-59)
+ * @frame: Frame (0-59)
+ * @closed_gop: Closed Gop
+ * @broken_link: Broken link
+ *
+ * The Mpeg Video Group of Picture structure.
+ */
+struct _GstMpegVideoGop
+{
+ guint8 drop_frame_flag;
+
+ guint8 hour, minute, second, frame;
+
+ guint8 closed_gop;
+ guint8 broken_link;
+};
+
+/**
+ * GstMpegVideoSliceHdr:
+ * @vertical_position: slice vertical position
+ * @vertical_position_extension: Extension to slice_vertical_position
+ * @priority_breakpoint: Point where the bitstream shall be partitioned
+ * @quantiser_scale_code: Quantiser value (range: 1-31)
+ * @slice_ext_flag: Slice Extension flag
+ * @intra_slice: Equal to one if all the macroblocks are intra macro blocks.
+ * @slice_picture_id_enable: controls the semantics of slice_picture_id
+ * @slice_picture_id: Intended to aid recovery on severe bursts of
+ * errors for certain types of applications
+ *
+ * The Mpeg2 Video Slice Header structure.
+ *
+ * Since: 1.2
+ */
+struct _GstMpegVideoSliceHdr
+{
+ guint8 vertical_position;
+ guint8 vertical_position_ext;
+
+ guint8 priority_breakpoint;
+ guint8 quantiser_scale_code;
+ guint8 slice_ext_flag;
+ guint8 intra_slice;
+ guint8 slice_picture_id_enable;
+ guint8 slice_picture_id;
+
+ /* Calculated values */
+ guint header_size; /* slice_header size in bits */
+ gint mb_row; /* macroblock row */
+ gint mb_column; /* macroblock column */
+};
+
+/**
+ * GstMpegVideoPacket:
+ * @type: the type of the packet that start at @offset, as a #GstMpegVideoPacketTypeCode
+ * @data: the data containing the packet starting at @offset
+ * @offset: the offset of the packet start in bytes from @data. This is the
+ * start of the packet itself without the sync code
+ * @size: The size in bytes of the packet or -1 if the end wasn't found. This
+ * is the size of the packet itself without the sync code
+ *
+ * A structure that contains the type of a packet, its offset and its size
+ */
+struct _GstMpegVideoPacket
+{
+ const guint8 *data;
+ guint8 type;
+ guint offset;
+ gint size;
+};
+
+GST_CODEC_PARSERS_API
+gboolean gst_mpeg_video_parse (GstMpegVideoPacket * packet,
+ const guint8 * data, gsize size, guint offset);
+
+GST_CODEC_PARSERS_API
+gboolean gst_mpeg_video_packet_parse_sequence_header (const GstMpegVideoPacket * packet,
+ GstMpegVideoSequenceHdr * seqhdr);
+
+GST_CODEC_PARSERS_API
+gboolean gst_mpeg_video_packet_parse_sequence_extension (const GstMpegVideoPacket * packet,
+ GstMpegVideoSequenceExt * seqext);
+
+GST_CODEC_PARSERS_API
+gboolean gst_mpeg_video_packet_parse_sequence_display_extension (const GstMpegVideoPacket * packet,
+ GstMpegVideoSequenceDisplayExt * seqdisplayext);
+
+GST_CODEC_PARSERS_API
+gboolean gst_mpeg_video_packet_parse_sequence_scalable_extension (const GstMpegVideoPacket * packet,
+ GstMpegVideoSequenceScalableExt * seqscaleext);
+
+GST_CODEC_PARSERS_API
+gboolean gst_mpeg_video_packet_parse_picture_header (const GstMpegVideoPacket * packet,
+ GstMpegVideoPictureHdr* pichdr);
+
+GST_CODEC_PARSERS_API
+gboolean gst_mpeg_video_packet_parse_picture_extension (const GstMpegVideoPacket * packet,
+ GstMpegVideoPictureExt *picext);
+
+GST_CODEC_PARSERS_API
+gboolean gst_mpeg_video_packet_parse_gop (const GstMpegVideoPacket * packet,
+ GstMpegVideoGop * gop);
+
+GST_CODEC_PARSERS_API
+gboolean gst_mpeg_video_packet_parse_slice_header (const GstMpegVideoPacket * packet,
+ GstMpegVideoSliceHdr * slice_hdr,
+ GstMpegVideoSequenceHdr * seq_hdr,
+ GstMpegVideoSequenceScalableExt * seqscaleext);
+
+GST_CODEC_PARSERS_API
+gboolean gst_mpeg_video_packet_parse_quant_matrix_extension (const GstMpegVideoPacket * packet,
+ GstMpegVideoQuantMatrixExt * quant);
+
+/* seqext and displayext may be NULL if not received */
+
+GST_CODEC_PARSERS_API
+gboolean gst_mpeg_video_finalise_mpeg2_sequence_header (GstMpegVideoSequenceHdr *hdr,
+ GstMpegVideoSequenceExt *seqext, GstMpegVideoSequenceDisplayExt *displayext);
+
+GST_CODEC_PARSERS_API
+void gst_mpeg_video_quant_matrix_get_raster_from_zigzag (guint8 out_quant[64],
+ const guint8 quant[64]);
+
+GST_CODEC_PARSERS_API
+void gst_mpeg_video_quant_matrix_get_zigzag_from_raster (guint8 out_quant[64],
+ const guint8 quant[64]);
+
+G_END_DECLS
+
+#endif
diff --git a/include/gst/codecparsers/gstvc1parser.h b/include/gst/codecparsers/gstvc1parser.h
new file mode 100644
index 0000000000..47bfbd12b1
--- /dev/null
+++ b/include/gst/codecparsers/gstvc1parser.h
@@ -0,0 +1,656 @@
+/* Gstreamer
+ * Copyright (C) <2011> Intel
+ * Copyright (C) <2011> Collabora Ltd.
+ * Copyright (C) <2011> Thibault Saunier <thibault.saunier@collabora.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_VC1_PARSER_H__
+#define __GST_VC1_PARSER_H__
+
+#ifndef GST_USE_UNSTABLE_API
+#warning "The VC1 parsing library is unstable API and may change in future."
+#warning "You can define GST_USE_UNSTABLE_API to avoid this warning."
+#endif
+
+#include <gst/gst.h>
+#include <gst/codecparsers/codecparsers-prelude.h>
+
+G_BEGIN_DECLS
+
+#define MAX_HRD_NUM_LEAKY_BUCKETS 31
+
+/**
+ * GST_VC1_BFRACTION_BASIS:
+ * The @bfraction variable should be divided
+ * by this constant to have the actual value.
+ */
+#define GST_VC1_BFRACTION_BASIS 840
+
+#define GST_VC1_BFRACTION_RESERVED (GST_VC1_BFRACTION_BASIS + 1)
+#define GST_VC1_BFRACTION_PTYPE_BI (GST_VC1_BFRACTION_BASIS + 2)
+
+typedef enum {
+ GST_VC1_END_OF_SEQ = 0x0A,
+ GST_VC1_SLICE = 0x0B,
+ GST_VC1_FIELD = 0x0C,
+ GST_VC1_FRAME = 0x0D,
+ GST_VC1_ENTRYPOINT = 0x0E,
+ GST_VC1_SEQUENCE = 0x0F,
+ GST_VC1_SLICE_USER = 0x1B,
+ GST_VC1_FIELD_USER = 0x1C,
+ GST_VC1_FRAME_USER = 0x1D,
+ GST_VC1_ENTRY_POINT_USER = 0x1E,
+ GST_VC1_SEQUENCE_USER = 0x1F
+} GstVC1StartCode;
+
+typedef enum {
+ GST_VC1_PROFILE_SIMPLE,
+ GST_VC1_PROFILE_MAIN,
+ GST_VC1_PROFILE_RESERVED,
+ GST_VC1_PROFILE_ADVANCED
+} GstVC1Profile;
+
+typedef enum {
+ GST_VC1_PARSER_OK,
+ GST_VC1_PARSER_BROKEN_DATA,
+ GST_VC1_PARSER_NO_BDU,
+ GST_VC1_PARSER_NO_BDU_END,
+ GST_VC1_PARSER_ERROR,
+} GstVC1ParserResult;
+
+typedef enum
+{
+ GST_VC1_PICTURE_TYPE_P,
+ GST_VC1_PICTURE_TYPE_B,
+ GST_VC1_PICTURE_TYPE_I,
+ GST_VC1_PICTURE_TYPE_BI,
+ GST_VC1_PICTURE_TYPE_SKIPPED
+} GstVC1PictureType;
+
+typedef enum
+{
+ GST_VC1_LEVEL_LOW = 0, /* Simple/Main profile low level */
+ GST_VC1_LEVEL_MEDIUM = 2, /* Simple/Main profile medium level */
+ GST_VC1_LEVEL_HIGH = 4, /* Main profile high level */
+
+ GST_VC1_LEVEL_L0 = 0, /* Advanced profile level 0 */
+ GST_VC1_LEVEL_L1 = 1, /* Advanced profile level 1 */
+ GST_VC1_LEVEL_L2 = 2, /* Advanced profile level 2 */
+ GST_VC1_LEVEL_L3 = 3, /* Advanced profile level 3 */
+ GST_VC1_LEVEL_L4 = 4, /* Advanced profile level 4 */
+
+ /* 5 to 7 reserved */
+ GST_VC1_LEVEL_UNKNOWN = 255 /* Unknown profile */
+} GstVC1Level;
+
+typedef enum
+{
+ GST_VC1_QUANTIZER_IMPLICITLY,
+ GST_VC1_QUANTIZER_EXPLICITLY,
+ GST_VC1_QUANTIZER_NON_UNIFORM,
+ GST_VC1_QUANTIZER_UNIFORM
+} GstVC1QuantizerSpec;
+
+typedef enum {
+ GST_VC1_DQPROFILE_FOUR_EDGES,
+ GST_VC1_DQPROFILE_DOUBLE_EDGES,
+ GST_VC1_DQPROFILE_SINGLE_EDGE,
+ GST_VC1_DQPROFILE_ALL_MBS
+} GstVC1DQProfile;
+
+typedef enum {
+ GST_VC1_CONDOVER_NONE,
+ GST_VC1_CONDOVER_ALL,
+ GST_VC1_CONDOVER_SELECT
+} GstVC1Condover;
+
+/**
+ * GstVC1MvMode:
+ *
+ */
+typedef enum
+{
+ GST_VC1_MVMODE_1MV_HPEL_BILINEAR,
+ GST_VC1_MVMODE_1MV,
+ GST_VC1_MVMODE_1MV_HPEL,
+ GST_VC1_MVMODE_MIXED_MV,
+ GST_VC1_MVMODE_INTENSITY_COMP
+} GstVC1MvMode;
+
+typedef enum
+{
+ GST_VC1_FRAME_PROGRESSIVE = 0x0,
+ GST_VC1_FRAME_INTERLACE = 0x10,
+ GST_VC1_FIELD_INTERLACE = 0x11
+} GstVC1FrameCodingMode;
+
+typedef struct _GstVC1SeqHdr GstVC1SeqHdr;
+typedef struct _GstVC1AdvancedSeqHdr GstVC1AdvancedSeqHdr;
+typedef struct _GstVC1HrdParam GstVC1HrdParam;
+typedef struct _GstVC1EntryPointHdr GstVC1EntryPointHdr;
+
+typedef struct _GstVC1SeqLayer GstVC1SeqLayer;
+
+typedef struct _GstVC1SeqStructA GstVC1SeqStructA;
+typedef struct _GstVC1SeqStructB GstVC1SeqStructB;
+typedef struct _GstVC1SeqStructC GstVC1SeqStructC;
+
+/* Pictures Structures */
+typedef struct _GstVC1FrameLayer GstVC1FrameLayer;
+typedef struct _GstVC1FrameHdr GstVC1FrameHdr;
+typedef struct _GstVC1PicAdvanced GstVC1PicAdvanced;
+typedef struct _GstVC1PicSimpleMain GstVC1PicSimpleMain;
+typedef struct _GstVC1Picture GstVC1Picture;
+typedef struct _GstVC1SliceHdr GstVC1SliceHdr;
+
+typedef struct _GstVC1VopDquant GstVC1VopDquant;
+
+typedef struct _GstVC1BitPlanes GstVC1BitPlanes;
+
+typedef struct _GstVC1BDU GstVC1BDU;
+
+struct _GstVC1HrdParam
+{
+ guint8 hrd_num_leaky_buckets;
+ guint8 bit_rate_exponent;
+ guint8 buffer_size_exponent;
+ guint16 hrd_rate[MAX_HRD_NUM_LEAKY_BUCKETS];
+ guint16 hrd_buffer[MAX_HRD_NUM_LEAKY_BUCKETS];
+};
+
+/**
+ * GstVC1EntryPointHdr:
+ *
+ * Structure for entrypoint header, this will be used only in advanced profiles
+ */
+struct _GstVC1EntryPointHdr
+{
+ guint8 broken_link;
+ guint8 closed_entry;
+ guint8 panscan_flag;
+ guint8 refdist_flag;
+ guint8 loopfilter;
+ guint8 fastuvmc;
+ guint8 extended_mv;
+ guint8 dquant;
+ guint8 vstransform;
+ guint8 overlap;
+ guint8 quantizer;
+ guint8 coded_size_flag;
+ guint16 coded_width;
+ guint16 coded_height;
+ guint8 extended_dmv;
+ guint8 range_mapy_flag;
+ guint8 range_mapy;
+ guint8 range_mapuv_flag;
+ guint8 range_mapuv;
+
+ guint8 hrd_full[MAX_HRD_NUM_LEAKY_BUCKETS];
+};
+
+/**
+ * GstVC1AdvancedSeqHdr:
+ *
+ * Structure for the advanced profile sequence headers specific parameters.
+ */
+struct _GstVC1AdvancedSeqHdr
+{
+ GstVC1Level level;
+
+ guint8 frmrtq_postproc;
+ guint8 bitrtq_postproc;
+ guint8 postprocflag;
+ guint16 max_coded_width;
+ guint16 max_coded_height;
+ guint8 pulldown;
+ guint8 interlace;
+ guint8 tfcntrflag;
+ guint8 finterpflag;
+ guint8 psf;
+ guint8 display_ext;
+ guint16 disp_horiz_size;
+ guint16 disp_vert_size;
+ guint8 aspect_ratio_flag;
+ guint8 aspect_ratio;
+ guint8 aspect_horiz_size;
+ guint8 aspect_vert_size;
+ guint8 framerate_flag;
+ guint8 framerateind;
+ guint8 frameratenr;
+ guint8 frameratedr;
+ guint16 framerateexp;
+ guint8 color_format_flag;
+ guint8 color_prim;
+ guint8 transfer_char;
+ guint8 matrix_coef;
+ guint8 hrd_param_flag;
+ guint8 colordiff_format;
+
+ GstVC1HrdParam hrd_param;
+
+ /* computed */
+ guint framerate; /* Around in fps, 0 if unknown*/
+ guint bitrate; /* Around in kpbs, 0 if unknown*/
+ guint par_n;
+ guint par_d;
+ guint fps_n;
+ guint fps_d;
+
+ /* The last parsed entry point */
+ GstVC1EntryPointHdr entrypoint;
+};
+
+struct _GstVC1SeqStructA
+{
+ guint32 vert_size;
+ guint32 horiz_size;
+};
+
+struct _GstVC1SeqStructB
+{
+ GstVC1Level level;
+
+ guint8 cbr;
+ guint32 framerate;
+
+ /* In simple and main profiles only */
+ guint32 hrd_buffer;
+ guint32 hrd_rate;
+};
+
+struct _GstVC1SeqStructC
+{
+ GstVC1Profile profile;
+
+ /* Only in simple and main profiles */
+ guint8 frmrtq_postproc;
+ guint8 bitrtq_postproc;
+ guint8 res_sprite;
+ guint8 loop_filter;
+ guint8 multires;
+ guint8 fastuvmc;
+ guint8 extended_mv;
+ guint8 dquant;
+ guint8 vstransform;
+ guint8 overlap;
+ guint8 syncmarker;
+ guint8 rangered;
+ guint8 maxbframes;
+ guint8 quantizer;
+ guint8 finterpflag;
+
+ /* Computed */
+ guint framerate; /* Around in fps, 0 if unknown*/
+ guint bitrate; /* Around in kpbs, 0 if unknown*/
+
+ /* This should be filled by user if previously known */
+ guint16 coded_width;
+ /* This should be filled by user if previously known */
+ guint16 coded_height;
+
+ /* Wmvp specific */
+ guint8 wmvp; /* Specify if the stream is wmp or not */
+ /* In the wmvp case, the framerate is not computed but in the bitstream */
+ guint8 slice_code;
+};
+
+struct _GstVC1SeqLayer
+{
+ guint32 numframes;
+
+ GstVC1SeqStructA struct_a;
+ GstVC1SeqStructB struct_b;
+ GstVC1SeqStructC struct_c;
+};
+
+/**
+ * GstVC1SeqHdr:
+ *
+ * Structure for sequence headers in any profile.
+ */
+struct _GstVC1SeqHdr
+{
+ GstVC1Profile profile;
+
+ GstVC1SeqStructC struct_c;
+
+ /* calculated */
+ guint mb_height;
+ guint mb_width;
+ guint mb_stride;
+
+ GstVC1AdvancedSeqHdr advanced;
+
+};
+
+/**
+ * GstVC1PicSimpleMain:
+ * @bfaction: Should be divided by #GST_VC1_BFRACTION_BASIS
+ * to get the real value.
+ */
+struct _GstVC1PicSimpleMain
+{
+ guint8 frmcnt;
+ guint8 mvrange;
+ guint8 rangeredfrm;
+
+ /* I and P pic simple and main profiles only */
+ guint8 respic;
+
+ /* I and BI pic simple and main profiles only */
+ guint8 transacfrm2;
+ guint8 bf;
+
+ /* B and P pic simple and main profiles only */
+ guint8 mvmode;
+ guint8 mvtab;
+ guint8 ttmbf;
+
+ /* P pic simple and main profiles only */
+ guint8 mvmode2;
+ guint8 lumscale;
+ guint8 lumshift;
+
+ guint8 cbptab;
+ guint8 ttfrm;
+
+ /* B and BI picture only
+ * Should be divided by #GST_VC1_BFRACTION_BASIS
+ * to get the real value. */
+ guint16 bfraction;
+
+ /* Biplane value, those fields only mention the fact
+ * that the bitplane is in raw mode or not */
+ guint8 mvtypemb;
+ guint8 skipmb;
+ guint8 directmb; /* B pic main profile only */
+};
+
+/**
+ * GstVC1PicAdvanced:
+ * @bfaction: Should be divided by #GST_VC1_BFRACTION_BASIS
+ * to get the real value.
+ */
+struct _GstVC1PicAdvanced
+{
+ GstVC1FrameCodingMode fcm;
+ guint8 tfcntr;
+
+ guint8 rptfrm;
+ guint8 tff;
+ guint8 rff;
+ guint8 ps_present;
+ guint32 ps_hoffset;
+ guint32 ps_voffset;
+ guint16 ps_width;
+ guint16 ps_height;
+ guint8 rndctrl;
+ guint8 uvsamp;
+ guint8 postproc;
+
+ /* B and P picture specific */
+ guint8 mvrange;
+ guint8 mvmode;
+ guint8 mvtab;
+ guint8 cbptab;
+ guint8 ttmbf;
+ guint8 ttfrm;
+
+ /* B and BI picture only
+ * Should be divided by #GST_VC1_BFRACTION_BASIS
+ * to get the real value. */
+ guint16 bfraction;
+
+ /* ppic */
+ guint8 mvmode2;
+ guint8 lumscale;
+ guint8 lumshift;
+
+ /* bipic */
+ guint8 bf;
+ guint8 condover;
+ guint8 transacfrm2;
+
+ /* Biplane value, those fields only mention the fact
+ * that the bitplane is in raw mode or not */
+ guint8 acpred;
+ guint8 overflags;
+ guint8 mvtypemb;
+ guint8 skipmb;
+ guint8 directmb;
+ guint8 forwardmb; /* B pic interlace field only */
+
+ /* For interlaced pictures only */
+ guint8 fieldtx;
+
+ /* P and B pictures */
+ guint8 intcomp;
+ guint8 dmvrange;
+ guint8 mbmodetab;
+ guint8 imvtab;
+ guint8 icbptab;
+ guint8 mvbptab2;
+ guint8 mvbptab4; /* If 4mvswitch in ppic */
+
+ /* P picture */
+ guint8 mvswitch4;
+
+ /* For interlaced fields only */
+ guint16 refdist;
+ guint8 fptype; /* Raw value */
+
+ /* P pic */
+ guint8 numref;
+ guint8 reffield;
+ guint8 lumscale2;
+ guint8 lumshift2;
+ guint8 intcompfield;
+
+};
+
+struct _GstVC1BitPlanes
+{
+ guint8 *acpred;
+ guint8 *fieldtx;
+ guint8 *overflags;
+ guint8 *mvtypemb;
+ guint8 *skipmb;
+ guint8 *directmb;
+ guint8 *forwardmb;
+
+ guint size; /* Size of the arrays */
+};
+
+struct _GstVC1VopDquant
+{
+ guint8 pqdiff;
+ guint8 abspq;
+
+ /* Computed */
+ guint8 altpquant;
+
+ /* if dqant != 2*/
+ guint8 dquantfrm;
+ guint8 dqprofile;
+
+ /* Boundary edge selection. This represents DQSBEDGE
+ * if dqprofile == GST_VC1_DQPROFILE_SINGLE_EDGE or
+ * DQDBEDGE if dqprofile == GST_VC1_DQPROFILE_DOUBLE_EDGE */
+ guint8 dqbedge;
+
+ /* FIXME: remove */
+ guint8 unused;
+
+ /* if dqprofile == GST_VC1_DQPROFILE_ALL_MBS */
+ guint8 dqbilevel;
+
+};
+
+struct _GstVC1FrameLayer
+{
+ guint8 key;
+ guint32 framesize;
+
+ guint32 timestamp;
+
+ /* calculated */
+ guint32 next_framelayer_offset;
+ guint8 skiped_p_frame;
+};
+
+/**
+ * GstVC1FrameHdr:
+ *
+ * Structure that represent picture in any profile or mode.
+ * You should look at @ptype and @profile to know what is currently
+ * in use.
+ */
+struct _GstVC1FrameHdr
+{
+ /* common fields */
+ GstVC1PictureType ptype;
+ guint8 interpfrm;
+ guint8 halfqp;
+ guint8 transacfrm;
+ guint8 transdctab;
+ guint8 pqindex;
+ guint8 pquantizer;
+
+ /* Computed */
+ guint8 pquant;
+
+ /* Convenience fields */
+ guint8 profile;
+ guint8 dquant;
+
+ /* If dquant */
+ GstVC1VopDquant vopdquant;
+
+ union {
+ GstVC1PicSimpleMain simple;
+ GstVC1PicAdvanced advanced;
+ } pic;
+
+ /* Size of the picture layer in bits */
+ guint header_size;
+};
+
+/**
+ * GstVC1SliceHdr:
+ *
+ * Structure that represents slice layer in advanced profile.
+ */
+struct _GstVC1SliceHdr
+{
+ guint16 slice_addr;
+
+ /* Size of the slice layer in bits */
+ guint header_size;
+};
+
+/**
+ * GstVC1BDU:
+ *
+ * Structure that represents a Bitstream Data Unit.
+ */
+struct _GstVC1BDU
+{
+ GstVC1StartCode type;
+ guint size;
+ guint sc_offset;
+ guint offset;
+ guint8 * data;
+};
+
+GST_CODEC_PARSERS_API
+GstVC1ParserResult gst_vc1_identify_next_bdu (const guint8 *data,
+ gsize size,
+ GstVC1BDU *bdu);
+
+
+GST_CODEC_PARSERS_API
+GstVC1ParserResult gst_vc1_parse_sequence_header (const guint8 *data,
+ gsize size,
+ GstVC1SeqHdr * seqhdr);
+
+GST_CODEC_PARSERS_API
+GstVC1ParserResult gst_vc1_parse_entry_point_header (const guint8 *data,
+ gsize size,
+ GstVC1EntryPointHdr * entrypoint,
+ GstVC1SeqHdr *seqhdr);
+
+GST_CODEC_PARSERS_API
+GstVC1ParserResult gst_vc1_parse_sequence_layer (const guint8 *data,
+ gsize size,
+ GstVC1SeqLayer * seqlayer);
+GST_CODEC_PARSERS_API
+GstVC1ParserResult
+gst_vc1_parse_sequence_header_struct_a (const guint8 *data,
+ gsize size,
+ GstVC1SeqStructA *structa);
+GST_CODEC_PARSERS_API
+GstVC1ParserResult
+gst_vc1_parse_sequence_header_struct_b (const guint8 *data,
+ gsize size,
+ GstVC1SeqStructB *structb);
+GST_CODEC_PARSERS_API
+GstVC1ParserResult
+gst_vc1_parse_sequence_header_struct_c (const guint8 *data,
+ gsize size,
+ GstVC1SeqStructC *structc);
+
+GST_CODEC_PARSERS_API
+GstVC1ParserResult gst_vc1_parse_frame_layer (const guint8 *data,
+ gsize size,
+ GstVC1FrameLayer * framelayer);
+
+GST_CODEC_PARSERS_API
+GstVC1ParserResult gst_vc1_parse_frame_header (const guint8 *data,
+ gsize size,
+ GstVC1FrameHdr * framehdr,
+ GstVC1SeqHdr *seqhdr,
+ GstVC1BitPlanes *bitplanes);
+
+GST_CODEC_PARSERS_API
+GstVC1ParserResult gst_vc1_parse_field_header (const guint8 *data,
+ gsize size,
+ GstVC1FrameHdr * fieldhdr,
+ GstVC1SeqHdr *seqhdr,
+ GstVC1BitPlanes *bitplanes);
+
+GST_CODEC_PARSERS_API
+GstVC1ParserResult gst_vc1_parse_slice_header (const guint8 *data,
+ gsize size,
+ GstVC1SliceHdr *slicehdr,
+ GstVC1SeqHdr *seqhdr);
+
+GST_CODEC_PARSERS_API
+GstVC1BitPlanes * gst_vc1_bitplanes_new (void);
+
+GST_CODEC_PARSERS_API
+void gst_vc1_bitplanes_free (GstVC1BitPlanes *bitplanes);
+
+GST_CODEC_PARSERS_API
+void gst_vc1_bitplanes_free_1 (GstVC1BitPlanes *bitplanes);
+
+GST_CODEC_PARSERS_API
+gboolean gst_vc1_bitplanes_ensure_size (GstVC1BitPlanes *bitplanes,
+ GstVC1SeqHdr *seqhdr);
+
+G_END_DECLS
+#endif
diff --git a/include/gst/codecparsers/gstvp8parser.h b/include/gst/codecparsers/gstvp8parser.h
new file mode 100644
index 0000000000..2e56e6fb29
--- /dev/null
+++ b/include/gst/codecparsers/gstvp8parser.h
@@ -0,0 +1,346 @@
+/*
+ * gstvp8parser.h - VP8 parser
+ *
+ * Copyright (C) 2013-2014 Intel Corporation
+ * Author: Halley Zhao <halley.zhao@intel.com>
+ * Author: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef GST_VP8_PARSER_H
+#define GST_VP8_PARSER_H
+
+#include <gst/gst.h>
+#include <gst/codecparsers/codecparsers-prelude.h>
+
+#ifndef GST_USE_UNSTABLE_API
+#warning "The VP8 parsing library is unstable API and may change in future."
+#warning "You can define GST_USE_UNSTABLE_API to avoid this warning."
+#endif
+
+G_BEGIN_DECLS
+
+typedef struct _GstVp8FrameHdr GstVp8FrameHdr;
+typedef struct _GstVp8QuantIndices GstVp8QuantIndices;
+typedef struct _GstVp8Segmentation GstVp8Segmentation;
+typedef struct _GstVp8MbLfAdjustments GstVp8MbLfAdjustments;
+typedef struct _GstVp8TokenProbs GstVp8TokenProbs;
+typedef struct _GstVp8MvProbs GstVp8MvProbs;
+typedef struct _GstVp8ModeProbs GstVp8ModeProbs;
+typedef struct _GstVp8Parser GstVp8Parser;
+
+/**
+ * GstVp8ParserResult:
+ * @GST_VP8_PARSER_OK: The parsing succeeded
+ * @GST_VP8_PARSER_BROKEN_DATA: The data to parse is broken
+ * @GST_VP8_PARSER_ERROR: An error accured when parsing
+ *
+ * The result of parsing VP8 data.
+ */
+typedef enum {
+ GST_VP8_PARSER_OK,
+ GST_VP8_PARSER_BROKEN_DATA,
+ GST_VP8_PARSER_ERROR,
+} GstVp8ParserResult;
+
+/**
+ * GstVpQuantIndices:
+ * @y_ac_qi: indicates the dequantization table index used for the
+ * luma AC coefficients
+ * @y_dc_delta: indicates the delta value that is added to the
+ * baseline index to obtain the luma DC coefficient dequantization
+ * index
+ * @y2_dc_delta: indicates the delta value that is added to the
+ * baseline index to obtain the Y2 block DC coefficient dequantization
+ * index
+ * @y2_ac_delta: indicates the delta value that is added to the
+ * baseline index to obtain the Y2 block AC coefficient dequantization
+ * index
+ * @uv_dc_delta: indicates the delta value that is added to the
+ * baseline index to obtain the chroma DC coefficient dequantization
+ * index
+ * @uv_ac_delta: indicates the delta value that is added to the
+ * baseline index to obtain the chroma AC coefficient dequantization
+ * index
+ *
+ * Dequantization indices.
+ */
+struct _GstVp8QuantIndices
+{
+ guint8 y_ac_qi;
+ gint8 y_dc_delta;
+ gint8 y2_dc_delta;
+ gint8 y2_ac_delta;
+ gint8 uv_dc_delta;
+ gint8 uv_ac_delta;
+};
+
+/**
+ * GstVp8Segmentation:
+ * @segmentation_enabled: enables the segmentation feature for the
+ * current frame
+ * @update_mb_segmentation_map: determines if the MB segmentation map
+ * is updated in the current frame
+ * @update_segment_feature_data: indicates if the segment feature data
+ * is updated in the current frame
+ * @segment_feature_mode: indicates the feature data update mode (0:
+ * delta, 1: absolute value)
+ * @quantizer_update_value: indicates the update value for the segment
+ * quantizer
+ * @lf_update_value: indicates the update value for the loop filter level
+ * @segment_prob: indicates the branch probabilities of the segment_id
+ * decoding tree
+ *
+ * Segmentation feature data.
+ */
+struct _GstVp8Segmentation
+{
+ guint8 segmentation_enabled;
+ guint8 update_mb_segmentation_map;
+ guint8 update_segment_feature_data;
+
+ /* if update_segment_feature_data == 1 */
+ guint8 segment_feature_mode;
+ gint8 quantizer_update_value[4];
+ gint8 lf_update_value[4];
+
+ /* if update_mb_segmentation_map == 1 */
+ guint8 segment_prob[3];
+};
+
+/**
+ * GstVp8MbLfAdjustments:
+ * @loop_filter_adj_enable: indicates if the MB-level loop filter
+ * adjustment is on for the current frame
+ * @mode_ref_lf_delta_update: indicates if the delta values used in an
+ * adjustment are updated in the current frame
+ * @ref_frame_delta: indicates the adjustment delta value
+ * corresponding to a certain used reference frame
+ * @mb_mode_delta: indicates the adjustment delta value corresponding
+ * to a certain MB prediction mode
+ *
+ * MB-level loop filter adjustments.
+ */
+struct _GstVp8MbLfAdjustments
+{
+ guint8 loop_filter_adj_enable;
+ guint8 mode_ref_lf_delta_update;
+
+ /* if mode_ref_lf_delta_update == 1 */
+ gint8 ref_frame_delta[4];
+ gint8 mb_mode_delta[4];
+};
+
+/**
+ * GstVp8TokenProbs:
+ * @prob: token probability
+ *
+ * Token probabilities, with cumulative updates applied.
+ *
+ * Each probability value in this matrix is live across frames, until
+ * they are reset to their default values on key frame.
+ */
+struct _GstVp8TokenProbs
+{
+ guint8 prob[4][8][3][11];
+};
+
+/**
+ * GstVp8MvProbs:
+ * @prob: MV probability
+ *
+ * Probabilities used for motion vector decoding, with cumulative
+ * updates applied.
+ *
+ * Each probability value in this matrix is live across frames, until
+ * they are reset to their default values on key frame.
+ */
+struct _GstVp8MvProbs
+{
+ guint8 prob[2][19];
+};
+
+/**
+ * GstVp8ModeProbs:
+ * @y_prob: indicates the branch probabilities of the luma
+ * intra-prediction mode decoding tree
+ * @uv_prob: indicates the branch probabilities of the chroma
+ * intra-prediction mode decoding tree
+ *
+ * Probabilities used for intra-prediction mode decoding tree.
+ *
+ * Each probability value in thie structure is live across frames,
+ * until they are reset to their default values on key frame.
+ */
+struct _GstVp8ModeProbs
+{
+ guint8 y_prob[4];
+ guint8 uv_prob[3];
+};
+
+/**
+ * GstVp8FrameHdr:
+ * @key_frame: indicates whether the frame is a key frame (1), or an
+ * inter frame (0)
+ * @version: version number
+ * @show_frame: indicates whether the frame is meant to be displayed (1),
+ * or not (0)
+ * @data_chunk_size: the size in bytes of the Uncompressed Data Chunk
+ * @first_part_size: the size in bytes of the first partition (control
+ * partition), excluding the uncompressed data chunk
+ * @width: the frame width in pixels
+ * @height: the frame height in pixels
+ * @horiz_scale_code: horizontal scale code value
+ * @vert_scale_code: vertical scale code value
+ * @color_space: defines the YUV color space of the sequence
+ * @clamping_type: specifies if the decoder is required to clamp the
+ * reconstructed pixel values
+ * @filter_type: determines whether the normal or the simple loop
+ * filter is used
+ * @loop_filter_level: controls the deblocking filter
+ * @sharpness_level: controls the deblocking filter
+ * @log2_nbr_of_dct_partitions: determines the number of separate
+ * partitions containing the DCT coefficients of the macroblocks
+ * @partition_size: determines the size of each separate partition
+ * containing the DCT coefficients of the macroblocks, including the
+ * very last one (calculated size)
+ * @quant_indices: dequantization indices (see #GstVp8QuantIndices)
+ * @token_probs: token probabilities (see #GstVp8TokenProbs)
+ * @mv_probs: probabilities used for motion vector decoding
+ * (see #GstVp8MvProbs)
+ * @mode_probs: probabilities used for intra-prediction mode decoding
+ * tree (see #GstVp8ModeProbs)
+ * @refresh_entropy_probs: determines whether updated token
+ * probabilities are used only for this frame or until further update
+ * @refresh_golden_frame: determines if the current decoded frame
+ * refreshes the golden frame
+ * @refresh_alternate_frame: determines if the current decoded frame
+ * refreshes the alternate reference frame
+ * @copy_buffer_to_golden: determines if the golden reference is
+ * replaced by another reference
+ * @copy_buffer_to_alternate: determines if the alternate reference is
+ * replaced by another reference
+ * @sign_bias_golden: controls the sign of motion vectors when the
+ * golden frame is referenced
+ * @sign_bias_alternate: controls the sign of motion vectors when the
+ * alternate frame is referenced
+ * @refresh_last: determines if the current decoded frame refreshes
+ * the last frame reference buffer
+ * @mb_no_skip_coeff: enables (0) or disables (1) the skipping of
+ * macroblocks containing no non-zero coefficients
+ * @prob_skip_false: indicates the probability that the macroblock is
+ * not skipped
+ * @prob_intra: indicates the probability of an intra macroblock
+ * @prob_last: indicates the probability that the last reference frame
+ * is used for inter-prediction
+ * @prob_gf: indicates the probability that the golden reference frame
+ * is used for inter-prediction
+ * @rd_range: last range decoder value for "Range"
+ * @rd_value: last range decoder value for "Value"
+ * @rd_count: number of bits left in range decoder "Value" (@rd_value)
+ * @header_size: the size in bits of the Frame Header, thus excluding
+ * any Uncompressed Data Chunk bytes
+ *
+ * Frame header.
+ */
+struct _GstVp8FrameHdr
+{
+ guint8 key_frame;
+ guint8 version;
+ guint8 show_frame;
+ guint8 data_chunk_size;
+ guint32 first_part_size;
+
+ /* if key_frame == 1 */
+ guint16 width;
+ guint16 height;
+ guint8 horiz_scale_code;
+ guint8 vert_scale_code;
+ guint8 color_space;
+ guint8 clamping_type;
+
+ guint8 filter_type;
+ guint8 loop_filter_level;
+ guint8 sharpness_level;
+ guint8 log2_nbr_of_dct_partitions;
+ guint partition_size[8];
+
+ GstVp8QuantIndices quant_indices;
+ GstVp8TokenProbs token_probs;
+ GstVp8MvProbs mv_probs;
+ GstVp8ModeProbs mode_probs;
+
+ guint8 refresh_entropy_probs;
+ guint8 refresh_last;
+ /* if key_frame != 1 */
+ guint8 refresh_golden_frame;
+ guint8 refresh_alternate_frame;
+ guint8 copy_buffer_to_golden;
+ guint8 copy_buffer_to_alternate;
+ guint8 sign_bias_golden;
+ guint8 sign_bias_alternate;
+
+ guint8 mb_no_skip_coeff;
+ guint8 prob_skip_false;
+
+ /* if key_frame != 1 */
+ guint8 prob_intra;
+ guint8 prob_last;
+ guint8 prob_gf;
+
+ /* Range decoder state */
+ guint8 rd_range;
+ guint8 rd_value;
+ guint8 rd_count;
+
+ /* Size of the Frame Header in bits */
+ guint header_size;
+};
+
+/**
+ * GstVp8Parser:
+ * @segmentation: segmentation feature data
+ * @mb_lf_adjust: MB-level loop filter adjustments
+ * @token_probs: token probabilities
+ * @mv_probs: probabilities used for motion vector decoding
+ * @mode_probs: probabilities used for intra-prediction mode decoding tree.
+ *
+ * Parser context that needs to be live across frames. For instance
+ * the probabilities tables stored in #GstVp8FrameHdr may depend on
+ * the previous frames.
+ */
+struct _GstVp8Parser
+{
+ GstVp8Segmentation segmentation;
+ GstVp8MbLfAdjustments mb_lf_adjust;
+ GstVp8TokenProbs token_probs;
+ GstVp8MvProbs mv_probs;
+ GstVp8ModeProbs mode_probs;
+};
+
+GST_CODEC_PARSERS_API
+void gst_vp8_parser_init (GstVp8Parser * parser);
+
+GST_CODEC_PARSERS_API
+GstVp8ParserResult gst_vp8_parser_parse_frame_header (GstVp8Parser * parser,
+ GstVp8FrameHdr * frame_hdr,
+ const guint8 * data,
+ gsize size);
+
+G_END_DECLS
+
+#endif /* GST_VP8_PARSER_H */
diff --git a/include/gst/codecparsers/gstvp8rangedecoder.h b/include/gst/codecparsers/gstvp8rangedecoder.h
new file mode 100644
index 0000000000..510cff26d0
--- /dev/null
+++ b/include/gst/codecparsers/gstvp8rangedecoder.h
@@ -0,0 +1,80 @@
+/*
+ * gstvp8rangedecoder.h - VP8 range decoder interface
+ *
+ * Copyright (C) 2014 Intel Corporation
+ * Author: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef GST_VP8_RANGE_DECODER_H
+#define GST_VP8_RANGE_DECODER_H
+
+#include <glib.h>
+#include <gst/gstconfig.h>
+#include <gst/codecparsers/codecparsers-prelude.h>
+
+typedef struct _GstVp8RangeDecoder GstVp8RangeDecoder;
+typedef struct _GstVp8RangeDecoderState GstVp8RangeDecoderState;
+
+/**
+* GstVp8RangeDecoder:
+* @buf: the original bitstream buffer start
+* @buf_size: the original bitstream buffer size
+*
+* Range decoder.
+*/
+struct _GstVp8RangeDecoder {
+ const guchar *buf;
+ guint buf_size;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING_LARGE];
+};
+
+/**
+* GstVp8RangeDecoderState:
+* @range: current "Range" value
+* @value: current "Value" value
+* @count: number of bits left in "Value" for decoding
+*
+* Range decoder state.
+*/
+struct _GstVp8RangeDecoderState {
+ guint8 range;
+ guint8 value;
+ guint8 count;
+};
+
+GST_CODEC_PARSERS_API
+gboolean gst_vp8_range_decoder_init (GstVp8RangeDecoder * rd,
+ const guchar * buf,
+ guint buf_size);
+
+GST_CODEC_PARSERS_API
+gint gst_vp8_range_decoder_read (GstVp8RangeDecoder * rd, guint8 prob);
+
+GST_CODEC_PARSERS_API
+gint gst_vp8_range_decoder_read_literal (GstVp8RangeDecoder * rd, gint bits);
+
+GST_CODEC_PARSERS_API
+guint gst_vp8_range_decoder_get_pos (GstVp8RangeDecoder * rd);
+
+GST_CODEC_PARSERS_API
+void gst_vp8_range_decoder_get_state (GstVp8RangeDecoder * rd,
+ GstVp8RangeDecoderState * state);
+
+#endif /* GST_VP8_RANGE_DECODER_H */
diff --git a/include/gst/codecparsers/gstvp9parser.h b/include/gst/codecparsers/gstvp9parser.h
new file mode 100644
index 0000000000..3a0d67c08d
--- /dev/null
+++ b/include/gst/codecparsers/gstvp9parser.h
@@ -0,0 +1,521 @@
+/*
+ * gstvp9parser.h
+ *
+ * Copyright (C) 2013-2014 Intel Corporation
+ * Copyright (C) 2015 Intel Corporation
+ * Author: XuGuangxin<Guangxin.Xu@intel.com>
+ * Author: Sreerenj Balachandran<sreerenj.balachandran@intel.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef GST_VP9_PARSER_H
+#define GST_VP9_PARSER_H
+
+#ifndef GST_USE_UNSTABLE_API
+#warning "The VP9 parsing library is unstable API and may change in future."
+#warning "You can define GST_USE_UNSTABLE_API to avoid this warning."
+#endif
+
+#include <gst/gst.h>
+#include <gst/codecparsers/codecparsers-prelude.h>
+
+G_BEGIN_DECLS
+
+#define GST_VP9_FRAME_MARKER 0x02
+#define GST_VP9_SYNC_CODE 0x498342
+#define GST_VP9_SUPERFRAME_MARKER 0x06
+
+#define GST_VP9_MAX_LOOP_FILTER 63
+#define GST_VP9_MAX_PROB 255
+
+#define GST_VP9_REFS_PER_FRAME 3
+#define GST_VP9_REF_FRAMES_LOG2 3
+#define GST_VP9_REF_FRAMES (1 << GST_VP9_REF_FRAMES_LOG2)
+
+#define GST_VP9_FRAME_CONTEXTS_LOG2 2
+
+#define GST_VP9_MAX_SHARPNESS 7
+
+#define GST_VP9_MAX_REF_LF_DELTAS 4
+#define GST_VP9_MAX_MODE_LF_DELTAS 2
+
+#define GST_VP9_SEGMENT_DELTADATA 0
+#define GST_VP9_SEGMENT_ABSDATA 1
+
+#define GST_VP9_MAX_SEGMENTS 8
+#define GST_VP9_SEG_TREE_PROBS (GST_VP9_MAX_SEGMENTS-1)
+
+#define GST_VP9_PREDICTION_PROBS 3
+
+#define GST_VP9_MAX_FRAMES_IN_SUPERFRAME 8
+
+typedef struct _GstVp9Parser GstVp9Parser;
+typedef struct _GstVp9FrameHdr GstVp9FrameHdr;
+typedef struct _GstVp9LoopFilter GstVp9LoopFilter;
+typedef struct _GstVp9QuantIndices GstVp9QuantIndices;
+typedef struct _GstVp9Segmentation GstVp9Segmentation;
+typedef struct _GstVp9SegmentationInfo GstVp9SegmentationInfo;
+typedef struct _GstVp9SegmentationInfoData GstVp9SegmentationInfoData;
+typedef struct _GstVp9SuperframeInfo GstVp9SuperframeInfo;
+
+/**
+ * GstVp9ParseResult:
+ * @GST_VP9_PARSER_OK: The parsing went well
+ * @GST_VP9_PARSER_BROKEN_DATA: The data to parse is broken
+ * @GST_VP9_PARSER_NO_PACKET_ERROR: An error occurred during the parsing
+ *
+ * Result type of any parsing function.
+ *
+ * Since: 1.8
+ */
+typedef enum
+{
+ GST_VP9_PARSER_OK,
+ GST_VP9_PARSER_BROKEN_DATA,
+ GST_VP9_PARSER_ERROR,
+} GstVp9ParserResult;
+
+/**
+ * GstVp9Profile: Bitstream profiles indicated by 2-3 bits in the uncompressed header
+ * @GST_VP9_PROFILE_0: Profile 0, 8-bit 4:2:0 only.
+ * @GST_VP9_PROFILE_1: Profile 1, 8-bit 4:4:4, 4:2:2, and 4:4:0.
+ * @GST_VP9_PROFILE_2: Profile 2, 10-bit and 12-bit color only, with 4:2:0 sampling.
+ * @GST_VP9_PROFILE_3: Profile 3, 10-bit and 12-bit color only, with 4:2:2/4:4:4/4:4:0 sampling.
+ * @GST_VP9_PROFILE_UNDEFINED: Undefined profile
+ *
+ * VP9 Profiles
+ *
+ * Since: 1.8
+ */
+typedef enum {
+ GST_VP9_PROFILE_0,
+ GST_VP9_PROFILE_1,
+ GST_VP9_PROFILE_2,
+ GST_VP9_PROFILE_3,
+ GST_VP9_PROFILE_UNDEFINED
+} GstVP9Profile;
+
+/**
+ * GstVp9FrameType:
+ * @GST_VP9_KEY_FRAME: Key frame, only have intra blocks
+ * @GST_VP9_INTER_FRAME: Inter frame, both intra and inter blocks
+ *
+ * VP9 frame types
+ *
+ * Since: 1.8
+ */
+typedef enum {
+ GST_VP9_KEY_FRAME = 0,
+ GST_VP9_INTER_FRAME = 1
+} GstVp9FrameType;
+
+/**
+ * GstVp9BitDepth:
+ * @GST_VP9_BIT_DEPTH_8: Bit depth is 8
+ * @GST_VP9_BIT_DEPTH_10 Bit depth is 10
+ * @GST_VP9_BIT_DEPTH_12:Bit depth is 12
+ *
+ * Bit depths of encoded frames
+ *
+ * Since: 1.8
+ */
+typedef enum {
+ GST_VP9_BIT_DEPTH_8 = 8,
+ GST_VP9_BIT_DEPTH_10 = 10,
+ GST_VP9_BIT_DEPTH_12 = 12
+} GstVp9BitDepth;
+
+/**
+ * GstVp9ColorSpace:
+ * @GST_VP9_CS_UNKNOWN: Unknown color space
+ * @GST_VP9_CS_BT_601: BT.601
+ * @GST_VP9_CS_BT_709: BT.709
+ * @GST_VP9_CS_SMPTE_170: SMPTE.170
+ * @GST_VP9_CS_SMPTE_240: SMPTE.240
+ * @GST_VP9_CS_BT_2020: BT.2020
+ * @GST_VP9_CS_RESERVED: Reserved
+ * @GST_VP9_CS_SRGB: sRGB
+ *
+ * Supported ColorSpace standards
+ *
+ * Since: 1.8
+ */
+typedef enum {
+ GST_VP9_CS_UNKNOWN = 0,
+ GST_VP9_CS_BT_601 = 1,
+ GST_VP9_CS_BT_709 = 2,
+ GST_VP9_CS_SMPTE_170 = 3,
+ GST_VP9_CS_SMPTE_240 = 4,
+ GST_VP9_CS_BT_2020 = 5,
+ GST_VP9_CS_RESERVED_2 = 6,
+ GST_VP9_CS_SRGB = 7
+} GstVp9ColorSpace;
+
+/**
+ * GstVp9ColorRange:
+ * @GST_VP9_CR_LIMITED: Y range is [16-235], UV range is [16-240]
+ * @GST_VP9_CR_FULL: Full range for Y,U and V [0-255]
+ *
+ * Possible color value ranges
+ *
+ * Since: 1.8
+ */
+typedef enum {
+ GST_VP9_CR_LIMITED,
+ GST_VP9_CR_FULL
+} GstVp9ColorRange;
+
+/**
+ * GstVp9InterpolationFilter:
+ * @GST_VP9_INTERPOLATION_FILTER_EIGHTTAP: EightTap interpolation filter
+ * @GST_VP9_INTERPOLATION_FILTER_EIGHTTAP_SMOOTH: Smooth interpolation filter
+ * @GST_VP9_INTERPOLATION_FILTER_EIGHTTAP_SHARP: Shart interpolation filter
+ * @GST_VP9_INTERPOLATION_FILTER_BILINEAR: Bilinear interpolation filter
+ * @GST_VP9_INTERPOLATION_FILTER_SWITCHABLE: Selectable interpolation filter
+ *
+ * Interpolation Filters Types
+ *
+ * Since: 1.8
+ */
+typedef enum {
+ GST_VP9_INTERPOLATION_FILTER_EIGHTTAP = 0,
+ GST_VP9_INTERPOLATION_FILTER_EIGHTTAP_SMOOTH = 1,
+ GST_VP9_INTERPOLATION_FILTER_EIGHTTAP_SHARP = 2,
+ GST_VP9_INTERPOLATION_FILTER_BILINEAR = 3,
+ GST_VP9_INTERPOLATION_FILTER_SWITCHABLE = 4
+} GstVp9InterpolationFilter;
+
+/**
+ * GstVp9RefFrameType:
+ * @GST_VP9_REF_FRAME_INTRA: Intra reference frame
+ * @GST_VP9_REF_FRAME_LAST: Last Reference frame
+ * @GST_VP9_REF_FRAME_GOLDEN: Golden Reference frame
+ * @GST_VP9_REF_FRAME_ALTREF: Alternate Reference frame
+ * @GST_VP9_REF_FRAME_MAX:
+ *
+ * Reference Frame types
+ *
+ * Since: 1.8
+ */
+typedef enum {
+ GST_VP9_REF_FRAME_INTRA = 0,
+ GST_VP9_REF_FRAME_LAST = 1,
+ GST_VP9_REF_FRAME_GOLDEN = 2,
+ GST_VP9_REF_FRAME_ALTREF = 3,
+ GST_VP9_REF_FRAME_MAX = 4
+} GstVp9RefFrameType;
+
+/**
+ * GstVp9QuantIndices:
+ * @y_ac_qi: indicates the dequantization table index used for the
+ * luma AC coefficients
+ * @y_dc_delta: indicates the delta value that is added to the
+ * baseline index to obtain the luma DC coefficient dequantization
+ * index
+ * @uv_dc_delta: indicates the delta value that is added to the
+ * baseline index to obtain the chroma DC coefficient dequantization
+ * index
+ * @uv_ac_delta: indicates the delta value that is added to the
+ * baseline index to obtain the chroma AC coefficient dequantization
+ * index
+ *
+ * Dequantization indices.
+ *
+ * Since: 1.8
+ */
+struct _GstVp9QuantIndices
+{
+ guint8 y_ac_qi;
+ gint8 y_dc_delta;
+ gint8 uv_dc_delta;
+ gint8 uv_ac_delta;
+};
+
+/**
+ * GstVp9LoopFilter:
+ * @filter_level: indicates loop filter level for the current frame
+ * @sharpness_level: indicates sharpness level for thecurrent frame
+ * @mode_ref_delta_enabled: indicate if filter adjust is on
+ * @mode_ref_delta_update: indicates if the delta values used in an
+ * adjustment are updated in the current frame
+ * @update_ref_deltas: indicate which ref deltas are updated
+ * @ref_deltas: Loop filter strength adjustments based on
+ * frame type (intra, inter)
+ * @update_mode_deltas: indicate with mode deltas are updated
+ * @mode_deltas: Loop filter strength adjustments based on
+ * mode (zero, new mv)
+ *
+ * Loop filter values
+ *
+ * Since: 1.8
+ */
+struct _GstVp9LoopFilter {
+ gint filter_level;
+ gint sharpness_level;
+
+ guint8 mode_ref_delta_enabled;
+ guint8 mode_ref_delta_update;
+ guint8 update_ref_deltas[GST_VP9_MAX_REF_LF_DELTAS];
+ gint8 ref_deltas[GST_VP9_MAX_REF_LF_DELTAS];
+ guint8 update_mode_deltas[GST_VP9_MAX_MODE_LF_DELTAS];
+ gint8 mode_deltas[GST_VP9_MAX_MODE_LF_DELTAS];
+};
+
+/**
+ * GstVp9SegmentationInfoData:
+ * @alternate_quantizer_enabled: indicate alternate quantizer enabled at segment level
+ * @alternate_quantizer: alternate quantizer value
+ * @alternate_loop_filter_enabled: indicate alternate loop filter enabled at segment level
+ * @alternate_loop_filter: alternate loop filter
+ * @reference_frame_enabled: indicate alternate reference frame at segment level
+ * @reference_frame: alternate reference frame
+ * @reference_skip: a block skip mode that implies both the use of a (0,0)
+ * motion vector and that no residual will be coded.
+ *
+ * Segmentation info for each segment
+ *
+ * Since: 1.8
+ */
+struct _GstVp9SegmentationInfoData {
+ /* SEG_LVL_ALT_Q */
+ guint8 alternate_quantizer_enabled;
+ gint16 alternate_quantizer;
+
+ /* SEG_LVL_ALT_LF */
+ guint8 alternate_loop_filter_enabled;
+ gint8 alternate_loop_filter;
+
+ /* SEG_LVL_REF_FRAME */
+ guint8 reference_frame_enabled;
+ gint reference_frame;
+
+ guint8 reference_skip;
+};
+
+/**
+ * GstVp9SegmentationInfo:
+ * @enabled: enables the segmentation feature for the current frame
+ * @update_map: determines if segmentation is updated in the current frame
+ * @update_tree_probs: determines if tree probabilities updated or not
+ * @tree_probs: segment tree probabilities
+ * @update_pred_probs:determines if prediction probabilities updated or not
+ * @pred_probs: prediction probabilities
+ * @abs_delta: interpretation of segment data values
+ * @temporal_update: type of map update
+ * @update_data: indicates if the segment feature data
+ * is updated in the current frame
+ * @data: segment feature data
+ *
+ * Segmentation info
+ *
+ * Since: 1.8
+ */
+struct _GstVp9SegmentationInfo {
+ /* enable in setup_segmentation*/
+ guint8 enabled;
+ /* update_map in setup_segmentation*/
+ guint8 update_map;
+ /* tree_probs exist or not*/
+ guint8 update_tree_probs[GST_VP9_SEG_TREE_PROBS];
+ guint8 tree_probs[GST_VP9_SEG_TREE_PROBS];
+ /* pred_probs exist or not*/
+ guint8 update_pred_probs[GST_VP9_PREDICTION_PROBS];
+ guint8 pred_probs[GST_VP9_PREDICTION_PROBS];
+
+ /* abs_delta in setup_segmentation */
+ guint8 abs_delta;
+ /* temporal_update in setup_segmentation */
+ guint8 temporal_update;
+
+ /* update_data in setup_segmentation*/
+ guint8 update_data;
+ GstVp9SegmentationInfoData data[GST_VP9_MAX_SEGMENTS];
+};
+
+/**
+ * GstVp9FrameHdr:
+ * @profile: encoded profile
+ * @show_existing_frame: display already decoded frame instead of doing the decoding
+ * @frame_to_show: which frame to show if show_existing_frame is true
+ * @frame_type: frame type
+ * @show_frame: indicate whether it is a displayable frame or not
+ * @error_resilient_mode: error resilent mode
+ * @width: frame width
+ * @height: frame height
+ * @display_size_enabled: display size enabled (cropping)
+ * @display_width: display width
+ * @display_height: display height
+ * @frame_context_idx: frame context index
+ * @intra_only: intra only frame
+ * @reset_frame_context: reset frame context
+ * @refresh_frame_flags: refresh reference frame flags
+ * @ref_frame_indices: reference frame index
+ * @ref_frame_sign_bias: sign bias for selecting altref,last and golden frames
+ * @allow_high_precision_mv: allow hight precision motion vector
+ * @mcomp_filter_type: interpolation filter type
+ * @refresh_frame_context: refresh frame context indicator
+ * @frame_parallel_decoding_mode: enable or disable parallel decoding support.
+ * @loopfilter: loopfilter values
+ * @quant_indices: quantization indices
+ * @segmentation: segmentation info
+ * @log2_tile_rows: tile row indicator
+ * @log2_tile_columns: tile column indicator
+ * @first_partition_size: first partition size (after the uncompressed header)
+ * @lossless_flag: lossless mode decode
+ * @frame_header_length_in_bytes: length of uncompressed header
+ *
+ * Frame header
+ *
+ * Since: 1.8
+ */
+struct _GstVp9FrameHdr
+{
+ guint profile;
+ guint8 show_existing_frame;
+ gint frame_to_show;
+ guint frame_type;
+ guint8 show_frame;
+ guint8 error_resilient_mode;
+ guint32 width;
+ guint32 height;
+ guint8 display_size_enabled;
+ guint32 display_width;
+ guint32 display_height;
+ guint frame_context_idx;
+
+ guint8 intra_only;
+ gint reset_frame_context;
+ gint refresh_frame_flags;
+
+ gint ref_frame_indices[GST_VP9_REFS_PER_FRAME];
+ gint ref_frame_sign_bias[GST_VP9_REFS_PER_FRAME];
+ gint allow_high_precision_mv;
+ guint8 mcomp_filter_type;
+
+ gint refresh_frame_context;
+ /* frame_parallel_decoding_mode in vp9 code*/
+ gint frame_parallel_decoding_mode;
+
+ GstVp9LoopFilter loopfilter;
+ GstVp9QuantIndices quant_indices;
+ GstVp9SegmentationInfo segmentation;
+
+ gint log2_tile_rows;
+ gint log2_tile_columns;
+
+ guint32 first_partition_size;
+
+ /* calculated values */
+ guint lossless_flag;
+ guint32 frame_header_length_in_bytes;
+};
+
+/**
+ * GstVp9SuperframeInfo:
+ * @bytes_per_framesize: indicates the number of bytes needed to code each frame size
+ * @frames_in_superframe: indicates the number of frames within this superframe
+ * @frame_sizes: specifies the size in bytes of frame number i (zero indexed) within this superframe
+ * @superframe_index_size: indicates the total size of the superframe_index
+ *
+ * Superframe info
+ *
+ * Since: 1.18
+ */
+struct _GstVp9SuperframeInfo {
+ guint32 bytes_per_framesize;
+ guint32 frames_in_superframe;
+ guint32 frame_sizes[GST_VP9_MAX_FRAMES_IN_SUPERFRAME];
+ guint32 superframe_index_size;
+};
+
+/**
+ * GstVp9Segmentation:
+ * @filter_level: loop filter level
+ * @luma_ac_quant_scale: AC quant scale for luma(Y) component
+ * @luma_dc_quant_scale: DC quant scale for luma(Y) component
+ * @chroma_ac_quant_scale AC quant scale for chroma(U/V) component
+ * @chroma_dc_quant_scale: DC quant scale for chroma (U/V) component
+ * @reference_frame_enabled: alternate reference frame enablement
+ * @reference_frame: alternate reference frame
+ * @reference_skip: a block skip mode that implies both the use of a (0,0)
+ * motion vector and that no residual will be coded
+ *
+ * Segmentation info kept across multiple frames
+ *
+ * Since: 1.8
+ */
+struct _GstVp9Segmentation
+{
+ guint8 filter_level[GST_VP9_MAX_REF_LF_DELTAS][GST_VP9_MAX_MODE_LF_DELTAS];
+ gint16 luma_ac_quant_scale;
+ gint16 luma_dc_quant_scale;
+ gint16 chroma_ac_quant_scale;
+ gint16 chroma_dc_quant_scale;
+
+ guint8 reference_frame_enabled;
+ gint reference_frame;
+
+ guint8 reference_skip;
+};
+
+/**
+ * GstVp9Parser:
+ * @priv: GstVp9ParserPrivate struct to keep track of state variables
+ * @subsampling_x: horizontal subsampling
+ * @subsampling_y: vertical subsampling
+ * @bit_depth: bit depth of the stream
+ * @color_space: color space standard
+ * @color_range: color range standard
+ * @mb_segment_tree_probs: decoding tree probabilities
+ * @segment_pred_probs: segment prediction probabiilties
+ * @segmentation: Segmentation info
+ *
+ * Parser context that needs to be live across frames
+ *
+ * Since: 1.8
+ */
+struct _GstVp9Parser
+{
+ /* private struct for tracking state variables across frames */
+ void *priv;
+
+ gint subsampling_x;
+ gint subsampling_y;
+ guint bit_depth;
+ guint color_space;
+ guint color_range;
+
+ guint8 mb_segment_tree_probs[GST_VP9_SEG_TREE_PROBS];
+ guint8 segment_pred_probs[GST_VP9_PREDICTION_PROBS];
+ GstVp9Segmentation segmentation[GST_VP9_MAX_SEGMENTS];
+};
+
+GST_CODEC_PARSERS_API
+GstVp9Parser * gst_vp9_parser_new (void);
+
+GST_CODEC_PARSERS_API
+GstVp9ParserResult gst_vp9_parser_parse_frame_header (GstVp9Parser* parser, GstVp9FrameHdr * frame_hdr, const guint8 * data, gsize size);
+
+GST_CODEC_PARSERS_API
+GstVp9ParserResult gst_vp9_parser_parse_superframe_info (GstVp9Parser* parser, GstVp9SuperframeInfo * superframe_info, const guint8 * data, gsize size);
+
+GST_CODEC_PARSERS_API
+void gst_vp9_parser_free (GstVp9Parser * parser);
+
+G_END_DECLS
+
+#endif /* GST_VP9_PARSER_H */