| 1 | /* Gstreamer |
| 2 | * Copyright (C) <2011> Intel Corporation |
| 3 | * Copyright (C) <2011> Collabora Ltd. |
| 4 | * Copyright (C) <2011> Thibault Saunier <thibault.saunier@collabora.com> |
| 5 | * |
| 6 | * Some bits C-c,C-v'ed and s/4/3 from h264parse and videoparsers/h264parse.c: |
| 7 | * Copyright (C) <2010> Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk> |
| 8 | * Copyright (C) <2010> Collabora Multimedia |
| 9 | * Copyright (C) <2010> Nokia Corporation |
| 10 | * |
| 11 | * (C) 2005 Michal Benes <michal.benes@itonis.tv> |
| 12 | * (C) 2008 Wim Taymans <wim.taymans@gmail.com> |
| 13 | * |
| 14 | * This library is free software; you can redistribute it and/or |
| 15 | * modify it under the terms of the GNU Library General Public |
| 16 | * License as published by the Free Software Foundation; either |
| 17 | * version 2 of the License, or (at your option) any later version. |
| 18 | * |
| 19 | * This library is distributed in the hope that it will be useful, |
| 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 22 | * Library General Public License for more details. |
| 23 | * |
| 24 | * You should have received a copy of the GNU Library General Public |
| 25 | * License along with this library; if not, write to the |
| 26 | * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, |
| 27 | * Boston, MA 02110-1301, USA. |
| 28 | */ |
| 29 | |
| 30 | #ifndef __GST_H264_PARSER_H__ |
| 31 | #define __GST_H264_PARSER_H__ |
| 32 | |
| 33 | #ifndef GST_USE_UNSTABLE_API |
| 34 | #warning "The H.264 parsing library is unstable API and may change in future." |
| 35 | #warning "You can define GST_USE_UNSTABLE_API to avoid this warning." |
| 36 | #endif |
| 37 | |
| 38 | #include <gst/gst.h> |
| 39 | #include <gst/codecparsers/codecparsers-prelude.h> |
| 40 | |
| 41 | G_BEGIN_DECLS |
| 42 | |
| 43 | #define GST_H264_MAX_SPS_COUNT 32 |
| 44 | #define GST_H264_MAX_PPS_COUNT 256 |
| 45 | #define GST_H264_MAX_VIEW_COUNT 1024 |
| 46 | #define GST_H264_MAX_VIEW_ID (GST_H264_MAX_VIEW_COUNT - 1) |
| 47 | |
| 48 | #define GST_H264_IS_P_SLICE(slice) (((slice)->type % 5) == GST_H264_P_SLICE) |
| 49 | #define GST_H264_IS_B_SLICE(slice) (((slice)->type % 5) == GST_H264_B_SLICE) |
| 50 | #define GST_H264_IS_I_SLICE(slice) (((slice)->type % 5) == GST_H264_I_SLICE) |
| 51 | #define GST_H264_IS_SP_SLICE(slice) (((slice)->type % 5) == GST_H264_SP_SLICE) |
| 52 | #define GST_H264_IS_SI_SLICE(slice) (((slice)->type % 5) == GST_H264_SI_SLICE) |
| 53 | |
| 54 | /** |
| 55 | * GST_H264_IS_SVC_NALU: |
| 56 | * @nalu: a #GstH264NalUnit |
| 57 | * |
| 58 | * Check if @nalu is a scalable extension NAL unit. |
| 59 | * |
| 60 | * Since: 1.6 |
| 61 | */ |
| 62 | #define GST_H264_IS_SVC_NALU(nalu) \ |
| 63 | ((nalu)->extension_type == GST_H264_NAL_EXTENSION_SVC) |
| 64 | |
| 65 | /** |
| 66 | * GST_H264_IS_MVC_NALU: |
| 67 | * @nalu: a #GstH264NalUnit |
| 68 | * |
| 69 | * Check if @nalu is a multiview extension NAL unit. |
| 70 | * |
| 71 | * Since: 1.6 |
| 72 | */ |
| 73 | #define GST_H264_IS_MVC_NALU(nalu) \ |
| 74 | ((nalu)->extension_type == GST_H264_NAL_EXTENSION_MVC) |
| 75 | |
| 76 | /** |
| 77 | * GstH264Profile: |
| 78 | * @GST_H264_PROFILE_BASELINE: Baseline profile (A.2.1) |
| 79 | * @GST_H264_PROFILE_MAIN: Main profile (A.2.2) |
| 80 | * @GST_H264_PROFILE_EXTENDED: Extended profile (A.2.3) |
| 81 | * @GST_H264_PROFILE_HIGH: High profile (A.2.4), |
| 82 | * or Progressive High profile (A.2.4.1), or Constrained High profile (A.2.4.2) |
| 83 | * depending on constraint_set4_flag and constraint_set5_flag |
| 84 | * @GST_H264_PROFILE_HIGH10: High 10 profile (A.2.5) or High 10 Intra |
| 85 | * profile (A.2.8), or Progressive High 10 profile (A.2.5.1) depending on |
| 86 | * constraint_set3_flag and constraint_set4_flag |
| 87 | * @GST_H264_PROFILE_HIGH_422: High 4:2:2 profile (A.2.6) or High |
| 88 | * 4:2:2 Intra profile (A.2.9), depending on constraint_set3_flag |
| 89 | * @GST_H264_PROFILE_HIGH_444: High 4:4:4 Predictive profile (A.2.7) |
| 90 | * or High 4:4:4 Intra profile (A.2.10), depending on the value of |
| 91 | * constraint_set3_flag |
| 92 | * @GST_H264_PROFILE_MULTIVIEW_HIGH: Multiview High profile (H.10.1.1) |
| 93 | * @GST_H264_PROFILE_STEREO_HIGH: Stereo High profile (H.10.1.2) |
| 94 | * @GST_H264_PROFILE_SCALABLE_BASELINE: Scalable Baseline profile (G.10.1.1) |
| 95 | * @GST_H264_PROFILE_SCALABLE_HIGH: Scalable High profile (G.10.1.2) |
| 96 | * or Scalable High Intra profile (G.10.1.3), depending on the value |
| 97 | * of constraint_set3_flag |
| 98 | * |
| 99 | * H.264 Profiles. |
| 100 | * |
| 101 | * Since: 1.2 |
| 102 | */ |
| 103 | typedef enum { |
| 104 | GST_H264_PROFILE_BASELINE = 66, |
| 105 | GST_H264_PROFILE_MAIN = 77, |
| 106 | GST_H264_PROFILE_EXTENDED = 88, |
| 107 | GST_H264_PROFILE_HIGH = 100, |
| 108 | GST_H264_PROFILE_HIGH10 = 110, |
| 109 | GST_H264_PROFILE_HIGH_422 = 122, |
| 110 | GST_H264_PROFILE_HIGH_444 = 244, |
| 111 | GST_H264_PROFILE_MULTIVIEW_HIGH = 118, |
| 112 | GST_H264_PROFILE_STEREO_HIGH = 128, |
| 113 | GST_H264_PROFILE_SCALABLE_BASELINE = 83, |
| 114 | GST_H264_PROFILE_SCALABLE_HIGH = 86 |
| 115 | } GstH264Profile; |
| 116 | |
| 117 | /** |
| 118 | * GstH264NalUnitType: |
| 119 | * @GST_H264_NAL_UNKNOWN: Unknown nal type |
| 120 | * @GST_H264_NAL_SLICE: Slice nal |
| 121 | * @GST_H264_NAL_SLICE_DPA: DPA slice nal |
| 122 | * @GST_H264_NAL_SLICE_DPB: DPB slice nal |
| 123 | * @GST_H264_NAL_SLICE_DPC: DPC slice nal |
| 124 | * @GST_H264_NAL_SLICE_IDR: DPR slice nal |
| 125 | * @GST_H264_NAL_SEI: Supplemental enhancement information (SEI) nal unit |
| 126 | * @GST_H264_NAL_SPS: Sequence parameter set (SPS) nal unit |
| 127 | * @GST_H264_NAL_PPS: Picture parameter set (PPS) nal unit |
| 128 | * @GST_H264_NAL_AU_DELIMITER: Access unit (AU) delimiter nal unit |
| 129 | * @GST_H264_NAL_SEQ_END: End of sequence nal unit |
| 130 | * @GST_H264_NAL_STREAM_END: End of stream nal unit |
| 131 | * @GST_H264_NAL_FILLER_DATA: Filler data nal lunit |
| 132 | * @GST_H264_NAL_SPS_EXT: Sequence parameter set (SPS) extension NAL unit |
| 133 | * @GST_H264_NAL_PREFIX_UNIT: Prefix NAL unit |
| 134 | * @GST_H264_NAL_SUBSET_SPS: Subset sequence parameter set (SSPS) NAL unit |
| 135 | * @GST_H264_NAL_DEPTH_SPS: Depth parameter set (DPS) NAL unit |
| 136 | * @GST_H264_NAL_SLICE_AUX: Auxiliary coded picture without partitioning NAL unit |
| 137 | * @GST_H264_NAL_SLICE_EXT: Coded slice extension NAL unit |
| 138 | * @GST_H264_NAL_SLICE_DEPTH: Coded slice extension for depth or 3D-AVC texture view |
| 139 | * |
| 140 | * Indicates the type of H264 Nal Units |
| 141 | */ |
| 142 | typedef enum |
| 143 | { |
| 144 | GST_H264_NAL_UNKNOWN = 0, |
| 145 | GST_H264_NAL_SLICE = 1, |
| 146 | GST_H264_NAL_SLICE_DPA = 2, |
| 147 | GST_H264_NAL_SLICE_DPB = 3, |
| 148 | GST_H264_NAL_SLICE_DPC = 4, |
| 149 | GST_H264_NAL_SLICE_IDR = 5, |
| 150 | GST_H264_NAL_SEI = 6, |
| 151 | GST_H264_NAL_SPS = 7, |
| 152 | GST_H264_NAL_PPS = 8, |
| 153 | GST_H264_NAL_AU_DELIMITER = 9, |
| 154 | GST_H264_NAL_SEQ_END = 10, |
| 155 | GST_H264_NAL_STREAM_END = 11, |
| 156 | GST_H264_NAL_FILLER_DATA = 12, |
| 157 | GST_H264_NAL_SPS_EXT = 13, |
| 158 | GST_H264_NAL_PREFIX_UNIT = 14, |
| 159 | GST_H264_NAL_SUBSET_SPS = 15, |
| 160 | GST_H264_NAL_DEPTH_SPS = 16, |
| 161 | GST_H264_NAL_SLICE_AUX = 19, |
| 162 | GST_H264_NAL_SLICE_EXT = 20, |
| 163 | GST_H264_NAL_SLICE_DEPTH = 21 |
| 164 | } GstH264NalUnitType; |
| 165 | |
| 166 | /** |
| 167 | * GstH264NalUnitExtensionType: |
| 168 | * @GST_H264_NAL_EXTENSION_NONE: No NAL unit header extension is available |
| 169 | * @GST_H264_NAL_EXTENSION_SVC: NAL unit header extension for SVC (Annex G) |
| 170 | * @GST_H264_NAL_EXTENSION_MVC: NAL unit header extension for MVC (Annex H) |
| 171 | * |
| 172 | * Indicates the type of H.264 NAL unit extension. |
| 173 | * |
| 174 | * Since: 1.6 |
| 175 | */ |
| 176 | typedef enum |
| 177 | { |
| 178 | GST_H264_NAL_EXTENSION_NONE = 0, |
| 179 | GST_H264_NAL_EXTENSION_SVC, |
| 180 | GST_H264_NAL_EXTENSION_MVC, |
| 181 | } GstH264NalUnitExtensionType; |
| 182 | |
| 183 | /** |
| 184 | * GstH264ParserResult: |
| 185 | * @GST_H264_PARSER_OK: The parsing succeeded |
| 186 | * @GST_H264_PARSER_BROKEN_DATA: The data to parse is broken |
| 187 | * @GST_H264_PARSER_BROKEN_LINK: The link to structure needed for the parsing couldn't be found |
| 188 | * @GST_H264_PARSER_ERROR: An error occurred when parsing |
| 189 | * @GST_H264_PARSER_NO_NAL: No NAL unit found during the parsing |
| 190 | * @GST_H264_PARSER_NO_NAL_END: Start of the NAL unit found, but not the end. |
| 191 | * This will be returned if no start/sync marker for the next NAL unit was |
| 192 | * found. In this case the parser will assume that the end of the data is |
| 193 | * also the end of the NAL unit. Whether this assumption is correct or not |
| 194 | * depends on the context, which only the caller can know, which is why a |
| 195 | * special result value is returned in this case. If the data is NAL-aligned |
| 196 | * then #GST_H264_PARSER_NO_NAL_END can be treated just like |
| 197 | * #GST_H264_PARSER_OK. If the data is not guaranteed to be NAL-aligned, |
| 198 | * then the caller probably wants to collect more data until there's another |
| 199 | * sync marker or the end of the stream has been reached. |
| 200 | * |
| 201 | * The result of parsing H264 data. |
| 202 | */ |
| 203 | typedef enum |
| 204 | { |
| 205 | GST_H264_PARSER_OK, |
| 206 | GST_H264_PARSER_BROKEN_DATA, |
| 207 | GST_H264_PARSER_BROKEN_LINK, |
| 208 | GST_H264_PARSER_ERROR, |
| 209 | GST_H264_PARSER_NO_NAL, |
| 210 | GST_H264_PARSER_NO_NAL_END |
| 211 | } GstH264ParserResult; |
| 212 | |
| 213 | /** |
| 214 | * GstH264FramePackingType: |
| 215 | * @GST_H264_FRAME_PACKING_NONE: A complete 2D frame without any frame packing |
| 216 | * @GST_H264_FRAME_PACKING_CHECKERBOARD_INTERLEAVING: Checkerboard |
| 217 | * based interleaving |
| 218 | * @GST_H264_FRAME_PACKING_COLUMN_INTERLEAVING: Column based interleaving |
| 219 | * @GST_H264_FRAME_PACKING_ROW_INTERLEAVING: Row based interleaving |
| 220 | * @GST_H264_FRAME_PACKING_SIDE_BY_SIDE: Side-by-side packing |
| 221 | * @GST_H264_FRMAE_PACKING_TOP_BOTTOM: Top-Bottom packing |
| 222 | * @GST_H264_FRAME_PACKING_TEMPORAL_INTERLEAVING: Temporal interleaving |
| 223 | * |
| 224 | * Frame packing arrangement types. |
| 225 | * |
| 226 | * Since: 1.6 |
| 227 | */ |
| 228 | typedef enum |
| 229 | { |
| 230 | GST_H264_FRAME_PACKING_NONE = 6, |
| 231 | GST_H264_FRAME_PACKING_CHECKERBOARD_INTERLEAVING = 0, |
| 232 | GST_H264_FRAME_PACKING_COLUMN_INTERLEAVING = 1, |
| 233 | GST_H264_FRAME_PACKING_ROW_INTERLEAVING = 2, |
| 234 | GST_H264_FRAME_PACKING_SIDE_BY_SIDE = 3, |
| 235 | GST_H264_FRMAE_PACKING_TOP_BOTTOM = 4, |
| 236 | GST_H264_FRAME_PACKING_TEMPORAL_INTERLEAVING = 5 |
| 237 | } GstH264FramePackingType; |
| 238 | |
| 239 | /** |
| 240 | * GstH264SEIPayloadType: |
| 241 | * @GST_H264_SEI_BUF_PERIOD: Buffering Period SEI Message |
| 242 | * @GST_H264_SEI_PIC_TIMING: Picture Timing SEI Message |
| 243 | * @GST_H264_SEI_REGISTERED_USER_DATA: Registered user data (D.2.5) |
| 244 | * @GST_H264_SEI_RECOVERY_POINT: Recovery Point SEI Message (D.2.7) |
| 245 | * @GST_H264_SEI_STEREO_VIDEO_INFO: stereo video info SEI message (Since: 1.6) |
| 246 | * @GST_H264_SEI_FRAME_PACKING: Frame Packing Arrangement (FPA) message that |
| 247 | * contains the 3D arrangement for stereoscopic 3D video (Since: 1.6) |
| 248 | * ... |
| 249 | * |
| 250 | * The type of SEI message. |
| 251 | */ |
| 252 | typedef enum |
| 253 | { |
| 254 | GST_H264_SEI_BUF_PERIOD = 0, |
| 255 | GST_H264_SEI_PIC_TIMING = 1, |
| 256 | GST_H264_SEI_REGISTERED_USER_DATA = 4, |
| 257 | GST_H264_SEI_RECOVERY_POINT = 6, |
| 258 | GST_H264_SEI_STEREO_VIDEO_INFO = 21, |
| 259 | GST_H264_SEI_FRAME_PACKING = 45 |
| 260 | /* and more... */ |
| 261 | } GstH264SEIPayloadType; |
| 262 | |
| 263 | /** |
| 264 | * GstH264SEIPicStructType: |
| 265 | * @GST_H264_SEI_PIC_STRUCT_FRAME: Picture is a frame |
| 266 | * @GST_H264_SEI_PIC_STRUCT_TOP_FIELD: Top field of frame |
| 267 | * @GST_H264_SEI_PIC_STRUCT_BOTTOM_FIELD: Bottom field of frame |
| 268 | * @GST_H264_SEI_PIC_STRUCT_TOP_BOTTOM: Top bottom field of frame |
| 269 | * @GST_H264_SEI_PIC_STRUCT_BOTTOM_TOP: bottom top field of frame |
| 270 | * @GST_H264_SEI_PIC_STRUCT_TOP_BOTTOM_TOP: top bottom top field of frame |
| 271 | * @GST_H264_SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM: bottom top bottom field of frame |
| 272 | * @GST_H264_SEI_PIC_STRUCT_FRAME_DOUBLING: indicates that the frame should |
| 273 | * be displayed two times consecutively |
| 274 | * @GST_H264_SEI_PIC_STRUCT_FRAME_TRIPLING: indicates that the frame should be |
| 275 | * displayed three times consecutively |
| 276 | * |
| 277 | * SEI pic_struct type |
| 278 | */ |
| 279 | typedef enum |
| 280 | { |
| 281 | GST_H264_SEI_PIC_STRUCT_FRAME = 0, |
| 282 | GST_H264_SEI_PIC_STRUCT_TOP_FIELD = 1, |
| 283 | GST_H264_SEI_PIC_STRUCT_BOTTOM_FIELD = 2, |
| 284 | GST_H264_SEI_PIC_STRUCT_TOP_BOTTOM = 3, |
| 285 | GST_H264_SEI_PIC_STRUCT_BOTTOM_TOP = 4, |
| 286 | GST_H264_SEI_PIC_STRUCT_TOP_BOTTOM_TOP = 5, |
| 287 | GST_H264_SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM = 6, |
| 288 | GST_H264_SEI_PIC_STRUCT_FRAME_DOUBLING = 7, |
| 289 | GST_H264_SEI_PIC_STRUCT_FRAME_TRIPLING = 8 |
| 290 | } GstH264SEIPicStructType; |
| 291 | |
| 292 | /** |
| 293 | * GstH264SliceType: |
| 294 | * |
| 295 | * Type of Picture slice |
| 296 | */ |
| 297 | |
| 298 | typedef enum |
| 299 | { |
| 300 | GST_H264_P_SLICE = 0, |
| 301 | GST_H264_B_SLICE = 1, |
| 302 | GST_H264_I_SLICE = 2, |
| 303 | GST_H264_SP_SLICE = 3, |
| 304 | GST_H264_SI_SLICE = 4, |
| 305 | GST_H264_S_P_SLICE = 5, |
| 306 | GST_H264_S_B_SLICE = 6, |
| 307 | GST_H264_S_I_SLICE = 7, |
| 308 | GST_H264_S_SP_SLICE = 8, |
| 309 | GST_H264_S_SI_SLICE = 9 |
| 310 | } GstH264SliceType; |
| 311 | |
| 312 | /** |
| 313 | * GstH264CtType |
| 314 | * |
| 315 | * Mapping of ct_type to source picture scan |
| 316 | * |
| 317 | * Since: 1.16 |
| 318 | */ |
| 319 | |
| 320 | typedef enum |
| 321 | { |
| 322 | GST_H264_CT_TYPE_PROGRESSIVE = 0, |
| 323 | GST_H264_CT_TYPE_INTERLACED = 1, |
| 324 | GST_H264_CT_TYPE_UNKNOWN = 2, |
| 325 | } GstCtType; |
| 326 | |
| 327 | typedef struct _GstH264NalParser GstH264NalParser; |
| 328 | |
| 329 | typedef struct _GstH264NalUnit GstH264NalUnit; |
| 330 | typedef struct _GstH264NalUnitExtensionMVC GstH264NalUnitExtensionMVC; |
| 331 | |
| 332 | typedef struct _GstH264SPSExtMVCView GstH264SPSExtMVCView; |
| 333 | typedef struct _GstH264SPSExtMVCLevelValue GstH264SPSExtMVCLevelValue; |
| 334 | typedef struct _GstH264SPSExtMVCLevelValueOp GstH264SPSExtMVCLevelValueOp; |
| 335 | typedef struct _GstH264SPSExtMVC GstH264SPSExtMVC; |
| 336 | |
| 337 | typedef struct _GstH264SPS GstH264SPS; |
| 338 | typedef struct _GstH264PPS GstH264PPS; |
| 339 | typedef struct _GstH264HRDParams GstH264HRDParams; |
| 340 | typedef struct _GstH264VUIParams GstH264VUIParams; |
| 341 | |
| 342 | typedef struct _GstH264RefPicListModification GstH264RefPicListModification; |
| 343 | typedef struct _GstH264DecRefPicMarking GstH264DecRefPicMarking; |
| 344 | typedef struct _GstH264RefPicMarking GstH264RefPicMarking; |
| 345 | typedef struct _GstH264PredWeightTable GstH264PredWeightTable; |
| 346 | typedef struct _GstH264SliceHdr GstH264SliceHdr; |
| 347 | |
| 348 | typedef struct _GstH264ClockTimestamp GstH264ClockTimestamp; |
| 349 | typedef struct _GstH264PicTiming GstH264PicTiming; |
| 350 | typedef struct _GstH264RegisteredUserData GstH264RegisteredUserData; |
| 351 | typedef struct _GstH264BufferingPeriod GstH264BufferingPeriod; |
| 352 | typedef struct _GstH264RecoveryPoint GstH264RecoveryPoint; |
| 353 | typedef struct _GstH264StereoVideoInfo GstH264StereoVideoInfo; |
| 354 | typedef struct _GstH264FramePacking GstH264FramePacking; |
| 355 | typedef struct _GstH264SEIMessage GstH264SEIMessage; |
| 356 | |
| 357 | /** |
| 358 | * GstH264NalUnitExtensionMVC: |
| 359 | * @non_idr_flag: If equal to 0, it specifies that the current access |
| 360 | * unit is an IDR access unit |
| 361 | * @priority_id: The priority identifier for the NAL unit |
| 362 | * @view_id: The view identifier for the NAL unit |
| 363 | * @temporal_id: The temporal identifier for the NAL unit |
| 364 | * @anchor_pic_flag: If equal to 1, it specifies that the current |
| 365 | * access unit is an anchor access unit |
| 366 | * @inter_view_flag: If equal to 0, it specifies that the current view |
| 367 | * component is not used for inter-view prediction by any other view |
| 368 | * component in the current access unit |
| 369 | * |
| 370 | * Since: 1.6 |
| 371 | */ |
| 372 | struct _GstH264NalUnitExtensionMVC |
| 373 | { |
| 374 | guint8 non_idr_flag; |
| 375 | guint8 priority_id; |
| 376 | guint16 view_id; |
| 377 | guint8 temporal_id; |
| 378 | guint8 anchor_pic_flag; |
| 379 | guint8 inter_view_flag; |
| 380 | }; |
| 381 | |
| 382 | /** |
| 383 | * GstH264NalUnit: |
| 384 | * @ref_idc: not equal to 0 specifies that the content of the NAL unit |
| 385 | * contains a sequence parameter set, a sequence parameter set |
| 386 | * extension, a subset sequence parameter set, a picture parameter |
| 387 | * set, a slice of a reference picture, a slice data partition of a |
| 388 | * reference picture, or a prefix NAL unit preceding a slice of a |
| 389 | * reference picture. |
| 390 | * @type: A #GstH264NalUnitType |
| 391 | * @idr_pic_flag: calculated idr_pic_flag |
| 392 | * @size: The size of the NAL unit starting from @offset, thus |
| 393 | * including the header bytes. e.g. @type (nal_unit_type) |
| 394 | * @offset: The offset of the actual start of the NAL unit, thus |
| 395 | * including the header bytes |
| 396 | * @sc_offset: The offset of the start code of the NAL unit |
| 397 | * @valid: If the NAL unit is valid, which means it has |
| 398 | * already been parsed |
| 399 | * @data: The data from which the NAL unit has been parsed |
| 400 | * @header_bytes: The size of the NALU header in bytes (Since 1.6) |
| 401 | * @extension_type: the extension type (Since 1.6) |
| 402 | * |
| 403 | * Structure defining the NAL unit headers |
| 404 | */ |
| 405 | struct _GstH264NalUnit |
| 406 | { |
| 407 | guint16 ref_idc; |
| 408 | guint16 type; |
| 409 | |
| 410 | /* calculated values */ |
| 411 | guint8 idr_pic_flag; |
| 412 | guint size; |
| 413 | guint offset; |
| 414 | guint sc_offset; |
| 415 | gboolean valid; |
| 416 | |
| 417 | guint8 *data; |
| 418 | |
| 419 | guint8 ; |
| 420 | guint8 extension_type; |
| 421 | union { |
| 422 | GstH264NalUnitExtensionMVC mvc; |
| 423 | } extension; |
| 424 | }; |
| 425 | |
| 426 | /** |
| 427 | * GstH264HRDParams: |
| 428 | * @cpb_cnt_minus1: plus 1 specifies the number of alternative |
| 429 | * CPB specifications in the bitstream |
| 430 | * @bit_rate_scale: specifies the maximum input bit rate of the |
| 431 | * SchedSelIdx-th CPB |
| 432 | * @cpb_size_scale: specifies the CPB size of the SchedSelIdx-th CPB |
| 433 | * @guint32 bit_rate_value_minus1: specifies the maximum input bit rate for the |
| 434 | * SchedSelIdx-th CPB |
| 435 | * @cpb_size_value_minus1: is used together with cpb_size_scale to specify the |
| 436 | * SchedSelIdx-th CPB size |
| 437 | * @cbr_flag: Specifies if running in constant or intermittent bit rate mode |
| 438 | * @initial_cpb_removal_delay_length_minus1: specifies the length in bits of |
| 439 | * the cpb_removal_delay syntax element |
| 440 | * @cpb_removal_delay_length_minus1: specifies the length in bits of the |
| 441 | * dpb_output_delay syntax element |
| 442 | * @dpb_output_delay_length_minus1: >0 specifies the length in bits of the time_offset syntax element. |
| 443 | * =0 specifies that the time_offset syntax element is not present |
| 444 | * @time_offset_length: Length of the time offset |
| 445 | * |
| 446 | * Defines the HRD parameters |
| 447 | */ |
| 448 | struct _GstH264HRDParams |
| 449 | { |
| 450 | guint8 cpb_cnt_minus1; |
| 451 | guint8 bit_rate_scale; |
| 452 | guint8 cpb_size_scale; |
| 453 | |
| 454 | guint32 bit_rate_value_minus1[32]; |
| 455 | guint32 cpb_size_value_minus1[32]; |
| 456 | guint8 cbr_flag[32]; |
| 457 | |
| 458 | guint8 initial_cpb_removal_delay_length_minus1; |
| 459 | guint8 cpb_removal_delay_length_minus1; |
| 460 | guint8 dpb_output_delay_length_minus1; |
| 461 | guint8 time_offset_length; |
| 462 | }; |
| 463 | |
| 464 | /** |
| 465 | * GstH264VUIParams: |
| 466 | * @aspect_ratio_info_present_flag: %TRUE specifies that aspect_ratio_idc is present. |
| 467 | * %FALSE specifies that aspect_ratio_idc is not present |
| 468 | * @aspect_ratio_idc specifies the value of the sample aspect ratio of the luma samples |
| 469 | * @sar_width indicates the horizontal size of the sample aspect ratio |
| 470 | * @sar_height indicates the vertical size of the sample aspect ratio |
| 471 | * @overscan_info_present_flag: %TRUE overscan_appropriate_flag is present %FALSE otherwise |
| 472 | * @overscan_appropriate_flag: %TRUE indicates that the cropped decoded pictures |
| 473 | * output are suitable for display using overscan. %FALSE the cropped decoded pictures |
| 474 | * output contain visually important information |
| 475 | * @video_signal_type_present_flag: %TRUE specifies that video_format, video_full_range_flag and |
| 476 | * colour_description_present_flag are present. |
| 477 | * @video_format: indicates the representation of the picture |
| 478 | * @video_full_range_flag: indicates the black level and range of the luma and chroma signals |
| 479 | * @colour_description_present_flag: %TRUE specifies that colour_primaries, |
| 480 | * transfer_characteristics and matrix_coefficients are present |
| 481 | * @colour_primaries: indicates the chromaticity coordinates of the source primaries |
| 482 | * @transfer_characteristics: indicates the opto-electronic transfer characteristic |
| 483 | * @matrix_coefficients: describes the matrix coefficients used in deriving luma and chroma signals |
| 484 | * @chroma_loc_info_present_flag: %TRUE specifies that chroma_sample_loc_type_top_field and |
| 485 | * chroma_sample_loc_type_bottom_field are present, %FALSE otherwise |
| 486 | * @chroma_sample_loc_type_top_field: specify the location of chroma for top field |
| 487 | * @chroma_sample_loc_type_bottom_field specify the location of chroma for bottom field |
| 488 | * @timing_info_present_flag: %TRUE specifies that num_units_in_tick, |
| 489 | * time_scale and fixed_frame_rate_flag are present in the bitstream |
| 490 | * @num_units_in_tick: is the number of time units of a clock operating at the frequency time_scale Hz |
| 491 | * time_scale: is the number of time units that pass in one second |
| 492 | * @fixed_frame_rate_flag: %TRUE indicates that the temporal distance between the HRD output times |
| 493 | * of any two consecutive pictures in output order is constrained as specified in the spec, %FALSE |
| 494 | * otherwise. |
| 495 | * @nal_hrd_parameters_present_flag: %TRUE if NAL HRD parameters exist in the bitstream |
| 496 | * @vcl_hrd_parameters_present_flag: %TRUE if VCL HRD parameters exist in the bitstream |
| 497 | * @low_delay_hrd_flag: specifies the HRD operational mode |
| 498 | * @pic_struct_present_flag: %TRUE specifies that picture timing SEI messages are present or not |
| 499 | * @bitstream_restriction_flag: %TRUE specifies that the following coded video sequence bitstream restriction |
| 500 | * parameters are present |
| 501 | * @motion_vectors_over_pic_boundaries_flag: %FALSE indicates that no sample outside the |
| 502 | * picture boundaries and no sample at a fractional sample position, %TRUE indicates that one or more |
| 503 | * samples outside picture boundaries may be used in inter prediction |
| 504 | * @max_bytes_per_pic_denom: indicates a number of bytes not exceeded by the sum of the sizes of |
| 505 | * the VCL NAL units associated with any coded picture in the coded video sequence. |
| 506 | * @max_bits_per_mb_denom: indicates the maximum number of coded bits of macroblock_layer |
| 507 | * @log2_max_mv_length_horizontal: indicate the maximum absolute value of a decoded horizontal |
| 508 | * motion vector component |
| 509 | * @log2_max_mv_length_vertical: indicate the maximum absolute value of a decoded vertical |
| 510 | * motion vector component |
| 511 | * @num_reorder_frames: indicates the maximum number of frames, complementary field pairs, |
| 512 | * or non-paired fields that precede any frame, |
| 513 | * @max_dec_frame_buffering: specifies the required size of the HRD decoded picture buffer in |
| 514 | * units of frame buffers. |
| 515 | * |
| 516 | * The structure representing the VUI parameters. |
| 517 | */ |
| 518 | struct _GstH264VUIParams |
| 519 | { |
| 520 | guint8 aspect_ratio_info_present_flag; |
| 521 | guint8 aspect_ratio_idc; |
| 522 | /* if aspect_ratio_idc == 255 */ |
| 523 | guint16 sar_width; |
| 524 | guint16 sar_height; |
| 525 | |
| 526 | guint8 overscan_info_present_flag; |
| 527 | /* if overscan_info_present_flag */ |
| 528 | guint8 overscan_appropriate_flag; |
| 529 | |
| 530 | guint8 video_signal_type_present_flag; |
| 531 | guint8 video_format; |
| 532 | guint8 video_full_range_flag; |
| 533 | guint8 colour_description_present_flag; |
| 534 | guint8 colour_primaries; |
| 535 | guint8 transfer_characteristics; |
| 536 | guint8 matrix_coefficients; |
| 537 | |
| 538 | guint8 chroma_loc_info_present_flag; |
| 539 | guint8 chroma_sample_loc_type_top_field; |
| 540 | guint8 chroma_sample_loc_type_bottom_field; |
| 541 | |
| 542 | guint8 timing_info_present_flag; |
| 543 | /* if timing_info_present_flag */ |
| 544 | guint32 num_units_in_tick; |
| 545 | guint32 time_scale; |
| 546 | guint8 fixed_frame_rate_flag; |
| 547 | |
| 548 | guint8 nal_hrd_parameters_present_flag; |
| 549 | /* if nal_hrd_parameters_present_flag */ |
| 550 | GstH264HRDParams nal_hrd_parameters; |
| 551 | |
| 552 | guint8 vcl_hrd_parameters_present_flag; |
| 553 | /* if vcl_hrd_parameters_present_flag */ |
| 554 | GstH264HRDParams vcl_hrd_parameters; |
| 555 | |
| 556 | guint8 low_delay_hrd_flag; |
| 557 | guint8 pic_struct_present_flag; |
| 558 | |
| 559 | guint8 bitstream_restriction_flag; |
| 560 | /* if bitstream_restriction_flag */ |
| 561 | guint8 motion_vectors_over_pic_boundaries_flag; |
| 562 | guint32 max_bytes_per_pic_denom; |
| 563 | guint32 max_bits_per_mb_denom; |
| 564 | guint32 log2_max_mv_length_horizontal; |
| 565 | guint32 log2_max_mv_length_vertical; |
| 566 | guint32 num_reorder_frames; |
| 567 | guint32 max_dec_frame_buffering; |
| 568 | |
| 569 | /* calculated values */ |
| 570 | guint par_n; |
| 571 | guint par_d; |
| 572 | }; |
| 573 | |
| 574 | /** |
| 575 | * GstH264SPSExtMVCView: |
| 576 | * @num_anchor_refs_l0: specifies the number of view components for |
| 577 | * inter-view prediction in the initialized RefPicList0 in decoding |
| 578 | * anchor view components. |
| 579 | * @anchor_ref_l0: specifies the view_id for inter-view prediction in |
| 580 | * the initialized RefPicList0 in decoding anchor view components. |
| 581 | * @num_anchor_refs_l1: specifies the number of view components for |
| 582 | * inter-view prediction in the initialized RefPicList1 in decoding |
| 583 | * anchor view components. |
| 584 | * @anchor_ref_l1: specifies the view_id for inter-view prediction in |
| 585 | * the initialized RefPicList1 in decoding anchor view components. |
| 586 | * @num_non_anchor_refs_l0: specifies the number of view components |
| 587 | * for inter-view prediction in the initialized RefPicList0 in |
| 588 | * decoding non-anchor view components. |
| 589 | * @non_anchor_ref_l0: specifies the view_id for inter-view prediction |
| 590 | * in the initialized RefPicList0 in decoding non-anchor view |
| 591 | * components. |
| 592 | * @num_non_anchor_refs_l1: specifies the number of view components |
| 593 | * for inter-view prediction in the initialized RefPicList1 in |
| 594 | * decoding non-anchor view components. |
| 595 | * @non_anchor_ref_l1: specifies the view_id for inter-view prediction |
| 596 | * in the initialized RefPicList1 in decoding non-anchor view |
| 597 | * components. |
| 598 | * |
| 599 | * Represents inter-view dependency relationships for the coded video |
| 600 | * sequence. |
| 601 | * |
| 602 | * Since: 1.6 |
| 603 | */ |
| 604 | struct _GstH264SPSExtMVCView |
| 605 | { |
| 606 | guint16 view_id; |
| 607 | guint8 num_anchor_refs_l0; |
| 608 | guint16 anchor_ref_l0[15]; |
| 609 | guint8 num_anchor_refs_l1; |
| 610 | guint16 anchor_ref_l1[15]; |
| 611 | guint8 num_non_anchor_refs_l0; |
| 612 | guint16 non_anchor_ref_l0[15]; |
| 613 | guint8 num_non_anchor_refs_l1; |
| 614 | guint16 non_anchor_ref_l1[15]; |
| 615 | }; |
| 616 | |
| 617 | /** |
| 618 | * GstH264SPSExtMVCLevelValueOp: |
| 619 | * |
| 620 | * Represents an operation point for the coded video sequence. |
| 621 | * |
| 622 | * Since: 1.6 |
| 623 | */ |
| 624 | struct _GstH264SPSExtMVCLevelValueOp |
| 625 | { |
| 626 | guint8 temporal_id; |
| 627 | guint16 num_target_views_minus1; |
| 628 | guint16 *target_view_id; |
| 629 | guint16 num_views_minus1; |
| 630 | }; |
| 631 | |
| 632 | /** |
| 633 | * GstH264SPSExtMVCLevelValue: |
| 634 | * @level_idc: specifies the level value signalled for the coded video |
| 635 | * sequence |
| 636 | * @num_applicable_ops_minus1: plus 1 specifies the number of |
| 637 | * operation points to which the level indicated by level_idc applies |
| 638 | * @applicable_op: specifies the applicable operation point |
| 639 | * |
| 640 | * Represents level values for a subset of the operation points for |
| 641 | * the coded video sequence. |
| 642 | * |
| 643 | * Since: 1.6 |
| 644 | */ |
| 645 | struct _GstH264SPSExtMVCLevelValue |
| 646 | { |
| 647 | guint8 level_idc; |
| 648 | guint16 num_applicable_ops_minus1; |
| 649 | GstH264SPSExtMVCLevelValueOp *applicable_op; |
| 650 | }; |
| 651 | |
| 652 | /** |
| 653 | * GstH264SPSExtMVC: |
| 654 | * @num_views_minus1: plus 1 specifies the maximum number of coded |
| 655 | * views in the coded video sequence |
| 656 | * @view: array of #GstH264SPSExtMVCView |
| 657 | * @num_level_values_signalled_minus1: plus 1 specifies the number of |
| 658 | * level values signalled for the coded video sequence. |
| 659 | * @level_value: array of #GstH264SPSExtMVCLevelValue |
| 660 | * |
| 661 | * Represents the parsed seq_parameter_set_mvc_extension(). |
| 662 | * |
| 663 | * Since: 1.6 |
| 664 | */ |
| 665 | struct _GstH264SPSExtMVC |
| 666 | { |
| 667 | guint16 num_views_minus1; |
| 668 | GstH264SPSExtMVCView *view; |
| 669 | guint8 num_level_values_signalled_minus1; |
| 670 | GstH264SPSExtMVCLevelValue *level_value; |
| 671 | }; |
| 672 | |
| 673 | /** |
| 674 | * GstH264SPS: |
| 675 | * @id: The ID of the sequence parameter set |
| 676 | * @profile_idc: indicate the profile to which the coded video sequence conforms |
| 677 | * |
| 678 | * H264 Sequence Parameter Set (SPS) |
| 679 | */ |
| 680 | struct _GstH264SPS |
| 681 | { |
| 682 | gint id; |
| 683 | |
| 684 | guint8 profile_idc; |
| 685 | guint8 constraint_set0_flag; |
| 686 | guint8 constraint_set1_flag; |
| 687 | guint8 constraint_set2_flag; |
| 688 | guint8 constraint_set3_flag; |
| 689 | guint8 constraint_set4_flag; |
| 690 | guint8 constraint_set5_flag; |
| 691 | guint8 level_idc; |
| 692 | |
| 693 | guint8 chroma_format_idc; |
| 694 | guint8 separate_colour_plane_flag; |
| 695 | guint8 bit_depth_luma_minus8; |
| 696 | guint8 bit_depth_chroma_minus8; |
| 697 | guint8 qpprime_y_zero_transform_bypass_flag; |
| 698 | |
| 699 | guint8 scaling_matrix_present_flag; |
| 700 | guint8 scaling_lists_4x4[6][16]; |
| 701 | guint8 scaling_lists_8x8[6][64]; |
| 702 | |
| 703 | guint8 log2_max_frame_num_minus4; |
| 704 | guint8 pic_order_cnt_type; |
| 705 | |
| 706 | /* if pic_order_cnt_type == 0 */ |
| 707 | guint8 log2_max_pic_order_cnt_lsb_minus4; |
| 708 | |
| 709 | /* else if pic_order_cnt_type == 1 */ |
| 710 | guint8 delta_pic_order_always_zero_flag; |
| 711 | gint32 offset_for_non_ref_pic; |
| 712 | gint32 offset_for_top_to_bottom_field; |
| 713 | guint8 num_ref_frames_in_pic_order_cnt_cycle; |
| 714 | gint32 offset_for_ref_frame[255]; |
| 715 | |
| 716 | guint32 num_ref_frames; |
| 717 | guint8 gaps_in_frame_num_value_allowed_flag; |
| 718 | guint32 pic_width_in_mbs_minus1; |
| 719 | guint32 pic_height_in_map_units_minus1; |
| 720 | guint8 frame_mbs_only_flag; |
| 721 | |
| 722 | guint8 mb_adaptive_frame_field_flag; |
| 723 | |
| 724 | guint8 direct_8x8_inference_flag; |
| 725 | |
| 726 | guint8 frame_cropping_flag; |
| 727 | |
| 728 | /* if frame_cropping_flag */ |
| 729 | guint32 frame_crop_left_offset; |
| 730 | guint32 frame_crop_right_offset; |
| 731 | guint32 frame_crop_top_offset; |
| 732 | guint32 frame_crop_bottom_offset; |
| 733 | |
| 734 | guint8 vui_parameters_present_flag; |
| 735 | /* if vui_parameters_present_flag */ |
| 736 | GstH264VUIParams vui_parameters; |
| 737 | |
| 738 | /* calculated values */ |
| 739 | guint8 chroma_array_type; |
| 740 | guint32 max_frame_num; |
| 741 | gint width, height; |
| 742 | gint crop_rect_width, crop_rect_height; |
| 743 | gint crop_rect_x, crop_rect_y; |
| 744 | gint fps_num_removed, fps_den_removed; /* FIXME: remove */ |
| 745 | gboolean valid; |
| 746 | |
| 747 | /* Subset SPS extensions */ |
| 748 | guint8 extension_type; |
| 749 | union { |
| 750 | GstH264SPSExtMVC mvc; |
| 751 | } extension; |
| 752 | }; |
| 753 | |
| 754 | /** |
| 755 | * GstH264PPS: |
| 756 | * |
| 757 | * H264 Picture Parameter Set |
| 758 | */ |
| 759 | struct _GstH264PPS |
| 760 | { |
| 761 | gint id; |
| 762 | |
| 763 | GstH264SPS *sequence; |
| 764 | |
| 765 | guint8 entropy_coding_mode_flag; |
| 766 | guint8 pic_order_present_flag; |
| 767 | |
| 768 | guint32 num_slice_groups_minus1; |
| 769 | |
| 770 | /* if num_slice_groups_minus1 > 0 */ |
| 771 | guint8 slice_group_map_type; |
| 772 | /* and if slice_group_map_type == 0 */ |
| 773 | guint32 run_length_minus1[8]; |
| 774 | /* or if slice_group_map_type == 2 */ |
| 775 | guint32 top_left[8]; |
| 776 | guint32 bottom_right[8]; |
| 777 | /* or if slice_group_map_type == (3, 4, 5) */ |
| 778 | guint8 slice_group_change_direction_flag; |
| 779 | guint32 slice_group_change_rate_minus1; |
| 780 | /* or if slice_group_map_type == 6 */ |
| 781 | guint32 pic_size_in_map_units_minus1; |
| 782 | guint8 *slice_group_id; |
| 783 | |
| 784 | guint8 num_ref_idx_l0_active_minus1; |
| 785 | guint8 num_ref_idx_l1_active_minus1; |
| 786 | guint8 weighted_pred_flag; |
| 787 | guint8 weighted_bipred_idc; |
| 788 | gint8 pic_init_qp_minus26; |
| 789 | gint8 pic_init_qs_minus26; |
| 790 | gint8 chroma_qp_index_offset; |
| 791 | guint8 deblocking_filter_control_present_flag; |
| 792 | guint8 constrained_intra_pred_flag; |
| 793 | guint8 redundant_pic_cnt_present_flag; |
| 794 | |
| 795 | guint8 transform_8x8_mode_flag; |
| 796 | |
| 797 | guint8 scaling_lists_4x4[6][16]; |
| 798 | guint8 scaling_lists_8x8[6][64]; |
| 799 | |
| 800 | guint8 second_chroma_qp_index_offset; |
| 801 | |
| 802 | gboolean valid; |
| 803 | }; |
| 804 | |
| 805 | struct _GstH264RefPicListModification |
| 806 | { |
| 807 | guint8 modification_of_pic_nums_idc; |
| 808 | union |
| 809 | { |
| 810 | /* if modification_of_pic_nums_idc == 0 || 1 */ |
| 811 | guint32 abs_diff_pic_num_minus1; |
| 812 | /* if modification_of_pic_nums_idc == 2 */ |
| 813 | guint32 long_term_pic_num; |
| 814 | /* if modification_of_pic_nums_idc == 4 || 5 */ |
| 815 | guint32 abs_diff_view_idx_minus1; |
| 816 | } value; |
| 817 | }; |
| 818 | |
| 819 | struct _GstH264PredWeightTable |
| 820 | { |
| 821 | guint8 luma_log2_weight_denom; |
| 822 | guint8 chroma_log2_weight_denom; |
| 823 | |
| 824 | gint16 luma_weight_l0[32]; |
| 825 | gint8 luma_offset_l0[32]; |
| 826 | |
| 827 | /* if seq->ChromaArrayType != 0 */ |
| 828 | gint16 chroma_weight_l0[32][2]; |
| 829 | gint8 chroma_offset_l0[32][2]; |
| 830 | |
| 831 | /* if slice->slice_type % 5 == 1 */ |
| 832 | gint16 luma_weight_l1[32]; |
| 833 | gint8 luma_offset_l1[32]; |
| 834 | |
| 835 | /* and if seq->ChromaArrayType != 0 */ |
| 836 | gint16 chroma_weight_l1[32][2]; |
| 837 | gint8 chroma_offset_l1[32][2]; |
| 838 | }; |
| 839 | |
| 840 | struct _GstH264RefPicMarking |
| 841 | { |
| 842 | guint8 memory_management_control_operation; |
| 843 | |
| 844 | guint32 difference_of_pic_nums_minus1; |
| 845 | guint32 long_term_pic_num; |
| 846 | guint32 long_term_frame_idx; |
| 847 | guint32 max_long_term_frame_idx_plus1; |
| 848 | }; |
| 849 | |
| 850 | struct _GstH264DecRefPicMarking |
| 851 | { |
| 852 | /* if slice->nal_unit.IdrPicFlag */ |
| 853 | guint8 no_output_of_prior_pics_flag; |
| 854 | guint8 long_term_reference_flag; |
| 855 | |
| 856 | guint8 adaptive_ref_pic_marking_mode_flag; |
| 857 | GstH264RefPicMarking ref_pic_marking[10]; |
| 858 | guint8 n_ref_pic_marking; |
| 859 | }; |
| 860 | |
| 861 | |
| 862 | struct _GstH264SliceHdr |
| 863 | { |
| 864 | guint32 first_mb_in_slice; |
| 865 | guint32 type; |
| 866 | GstH264PPS *pps; |
| 867 | |
| 868 | /* if seq->separate_colour_plane_flag */ |
| 869 | guint8 colour_plane_id; |
| 870 | |
| 871 | guint16 frame_num; |
| 872 | |
| 873 | guint8 field_pic_flag; |
| 874 | guint8 bottom_field_flag; |
| 875 | |
| 876 | /* if nal_unit.type == 5 */ |
| 877 | guint16 idr_pic_id; |
| 878 | |
| 879 | /* if seq->pic_order_cnt_type == 0 */ |
| 880 | guint16 pic_order_cnt_lsb; |
| 881 | /* if seq->pic_order_present_flag && !field_pic_flag */ |
| 882 | gint32 delta_pic_order_cnt_bottom; |
| 883 | |
| 884 | gint32 delta_pic_order_cnt[2]; |
| 885 | guint8 redundant_pic_cnt; |
| 886 | |
| 887 | /* if slice_type == B_SLICE */ |
| 888 | guint8 direct_spatial_mv_pred_flag; |
| 889 | |
| 890 | guint8 num_ref_idx_l0_active_minus1; |
| 891 | guint8 num_ref_idx_l1_active_minus1; |
| 892 | |
| 893 | guint8 ref_pic_list_modification_flag_l0; |
| 894 | guint8 n_ref_pic_list_modification_l0; |
| 895 | GstH264RefPicListModification ref_pic_list_modification_l0[32]; |
| 896 | guint8 ref_pic_list_modification_flag_l1; |
| 897 | guint8 n_ref_pic_list_modification_l1; |
| 898 | GstH264RefPicListModification ref_pic_list_modification_l1[32]; |
| 899 | |
| 900 | GstH264PredWeightTable pred_weight_table; |
| 901 | /* if nal_unit.ref_idc != 0 */ |
| 902 | GstH264DecRefPicMarking dec_ref_pic_marking; |
| 903 | |
| 904 | guint8 cabac_init_idc; |
| 905 | gint8 slice_qp_delta; |
| 906 | gint8 slice_qs_delta; |
| 907 | |
| 908 | guint8 disable_deblocking_filter_idc; |
| 909 | gint8 slice_alpha_c0_offset_div2; |
| 910 | gint8 slice_beta_offset_div2; |
| 911 | |
| 912 | guint16 slice_group_change_cycle; |
| 913 | |
| 914 | /* calculated values */ |
| 915 | guint32 max_pic_num; |
| 916 | gboolean valid; |
| 917 | |
| 918 | /* Size of the slice_header() in bits */ |
| 919 | guint ; |
| 920 | |
| 921 | /* Number of emulation prevention bytes (EPB) in this slice_header() */ |
| 922 | guint n_emulation_prevention_bytes; |
| 923 | }; |
| 924 | |
| 925 | |
| 926 | struct _GstH264ClockTimestamp |
| 927 | { |
| 928 | guint8 ct_type; |
| 929 | guint8 nuit_field_based_flag; |
| 930 | guint8 counting_type; |
| 931 | guint8 discontinuity_flag; |
| 932 | guint8 cnt_dropped_flag; |
| 933 | guint8 n_frames; |
| 934 | |
| 935 | guint8 seconds_flag; |
| 936 | guint8 seconds_value; |
| 937 | |
| 938 | guint8 minutes_flag; |
| 939 | guint8 minutes_value; |
| 940 | |
| 941 | guint8 hours_flag; |
| 942 | guint8 hours_value; |
| 943 | |
| 944 | guint32 time_offset; |
| 945 | }; |
| 946 | |
| 947 | /** |
| 948 | * GstH264FramePacking: |
| 949 | * |
| 950 | * Since: 1.6 |
| 951 | */ |
| 952 | struct _GstH264FramePacking |
| 953 | { |
| 954 | guint32 frame_packing_id; |
| 955 | guint8 frame_packing_cancel_flag; |
| 956 | guint8 frame_packing_type; /* GstH264FramePackingType */ |
| 957 | guint8 quincunx_sampling_flag; |
| 958 | guint8 content_interpretation_type; |
| 959 | guint8 spatial_flipping_flag; |
| 960 | guint8 frame0_flipped_flag; |
| 961 | guint8 field_views_flag; |
| 962 | guint8 current_frame_is_frame0_flag; |
| 963 | guint8 frame0_self_contained_flag; |
| 964 | guint8 frame1_self_contained_flag; |
| 965 | guint8 frame0_grid_position_x; |
| 966 | guint8 frame0_grid_position_y; |
| 967 | guint8 frame1_grid_position_x; |
| 968 | guint8 frame1_grid_position_y; |
| 969 | guint16 frame_packing_repetition_period; |
| 970 | }; |
| 971 | |
| 972 | /** |
| 973 | * GstH264StereoVideoInfo: |
| 974 | * |
| 975 | * Since: 1.6 |
| 976 | */ |
| 977 | struct _GstH264StereoVideoInfo |
| 978 | { |
| 979 | guint8 field_views_flag; |
| 980 | guint8 top_field_is_left_view_flag; |
| 981 | guint8 current_frame_is_left_view_flag; |
| 982 | guint8 next_frame_is_second_view_flag; |
| 983 | guint8 left_view_self_contained_flag; |
| 984 | guint8 right_view_self_contained_flag; |
| 985 | }; |
| 986 | |
| 987 | struct _GstH264PicTiming |
| 988 | { |
| 989 | guint32 cpb_removal_delay; |
| 990 | guint32 dpb_output_delay; |
| 991 | |
| 992 | guint8 pic_struct_present_flag; |
| 993 | /* if pic_struct_present_flag */ |
| 994 | guint8 pic_struct; |
| 995 | |
| 996 | guint8 clock_timestamp_flag[3]; |
| 997 | GstH264ClockTimestamp clock_timestamp[3]; |
| 998 | }; |
| 999 | |
| 1000 | struct _GstH264RegisteredUserData |
| 1001 | { |
| 1002 | guint8 country_code; |
| 1003 | guint8 country_code_extension; |
| 1004 | const guint8 *data; |
| 1005 | guint size; |
| 1006 | }; |
| 1007 | |
| 1008 | struct _GstH264BufferingPeriod |
| 1009 | { |
| 1010 | GstH264SPS *sps; |
| 1011 | |
| 1012 | /* seq->vui_parameters->nal_hrd_parameters_present_flag */ |
| 1013 | guint32 nal_initial_cpb_removal_delay[32]; |
| 1014 | guint32 nal_initial_cpb_removal_delay_offset[32]; |
| 1015 | |
| 1016 | /* seq->vui_parameters->vcl_hrd_parameters_present_flag */ |
| 1017 | guint32 vcl_initial_cpb_removal_delay[32]; |
| 1018 | guint32 vcl_initial_cpb_removal_delay_offset[32]; |
| 1019 | }; |
| 1020 | |
| 1021 | struct _GstH264RecoveryPoint |
| 1022 | { |
| 1023 | guint32 recovery_frame_cnt; |
| 1024 | guint8 exact_match_flag; |
| 1025 | guint8 broken_link_flag; |
| 1026 | guint8 changing_slice_group_idc; |
| 1027 | }; |
| 1028 | |
| 1029 | struct _GstH264SEIMessage |
| 1030 | { |
| 1031 | GstH264SEIPayloadType payloadType; |
| 1032 | |
| 1033 | union { |
| 1034 | GstH264BufferingPeriod buffering_period; |
| 1035 | GstH264PicTiming pic_timing; |
| 1036 | GstH264RegisteredUserData registered_user_data; |
| 1037 | GstH264RecoveryPoint recovery_point; |
| 1038 | GstH264StereoVideoInfo stereo_video_info; |
| 1039 | GstH264FramePacking frame_packing; |
| 1040 | /* ... could implement more */ |
| 1041 | } payload; |
| 1042 | }; |
| 1043 | |
| 1044 | /** |
| 1045 | * GstH264NalParser: |
| 1046 | * |
| 1047 | * H264 NAL Parser (opaque structure). |
| 1048 | */ |
| 1049 | struct _GstH264NalParser |
| 1050 | { |
| 1051 | /*< private >*/ |
| 1052 | GstH264SPS sps[GST_H264_MAX_SPS_COUNT]; |
| 1053 | GstH264PPS pps[GST_H264_MAX_PPS_COUNT]; |
| 1054 | GstH264SPS *last_sps; |
| 1055 | GstH264PPS *last_pps; |
| 1056 | }; |
| 1057 | |
| 1058 | GST_CODEC_PARSERS_API |
| 1059 | GstH264NalParser *gst_h264_nal_parser_new (void); |
| 1060 | |
| 1061 | GST_CODEC_PARSERS_API |
| 1062 | GstH264ParserResult gst_h264_parser_identify_nalu (GstH264NalParser *nalparser, |
| 1063 | const guint8 *data, guint offset, |
| 1064 | gsize size, GstH264NalUnit *nalu); |
| 1065 | |
| 1066 | GST_CODEC_PARSERS_API |
| 1067 | GstH264ParserResult gst_h264_parser_identify_nalu_unchecked (GstH264NalParser *nalparser, |
| 1068 | const guint8 *data, guint offset, |
| 1069 | gsize size, GstH264NalUnit *nalu); |
| 1070 | |
| 1071 | GST_CODEC_PARSERS_API |
| 1072 | GstH264ParserResult gst_h264_parser_identify_nalu_avc (GstH264NalParser *nalparser, const guint8 *data, |
| 1073 | guint offset, gsize size, guint8 nal_length_size, |
| 1074 | GstH264NalUnit *nalu); |
| 1075 | |
| 1076 | GST_CODEC_PARSERS_API |
| 1077 | GstH264ParserResult gst_h264_parser_parse_nal (GstH264NalParser *nalparser, |
| 1078 | GstH264NalUnit *nalu); |
| 1079 | |
| 1080 | GST_CODEC_PARSERS_API |
| 1081 | GstH264ParserResult gst_h264_parser_parse_slice_hdr (GstH264NalParser *nalparser, GstH264NalUnit *nalu, |
| 1082 | GstH264SliceHdr *slice, gboolean parse_pred_weight_table, |
| 1083 | gboolean parse_dec_ref_pic_marking); |
| 1084 | |
| 1085 | GST_CODEC_PARSERS_API |
| 1086 | GstH264ParserResult gst_h264_parser_parse_subset_sps (GstH264NalParser *nalparser, GstH264NalUnit *nalu, |
| 1087 | GstH264SPS *sps, gboolean parse_vui_params); |
| 1088 | |
| 1089 | GST_CODEC_PARSERS_API |
| 1090 | GstH264ParserResult gst_h264_parser_parse_sps (GstH264NalParser *nalparser, GstH264NalUnit *nalu, |
| 1091 | GstH264SPS *sps, gboolean parse_vui_params); |
| 1092 | |
| 1093 | GST_CODEC_PARSERS_API |
| 1094 | GstH264ParserResult gst_h264_parser_parse_pps (GstH264NalParser *nalparser, |
| 1095 | GstH264NalUnit *nalu, GstH264PPS *pps); |
| 1096 | |
| 1097 | GST_CODEC_PARSERS_API |
| 1098 | GstH264ParserResult gst_h264_parser_parse_sei (GstH264NalParser *nalparser, |
| 1099 | GstH264NalUnit *nalu, GArray ** messages); |
| 1100 | |
| 1101 | GST_CODEC_PARSERS_API |
| 1102 | void gst_h264_nal_parser_free (GstH264NalParser *nalparser); |
| 1103 | |
| 1104 | GST_CODEC_PARSERS_API |
| 1105 | GstH264ParserResult gst_h264_parse_subset_sps (GstH264NalUnit *nalu, |
| 1106 | GstH264SPS *sps, gboolean parse_vui_params); |
| 1107 | |
| 1108 | GST_CODEC_PARSERS_API |
| 1109 | GstH264ParserResult gst_h264_parse_sps (GstH264NalUnit *nalu, |
| 1110 | GstH264SPS *sps, gboolean parse_vui_params); |
| 1111 | |
| 1112 | GST_CODEC_PARSERS_API |
| 1113 | GstH264ParserResult gst_h264_parse_pps (GstH264NalParser *nalparser, |
| 1114 | GstH264NalUnit *nalu, GstH264PPS *pps); |
| 1115 | |
| 1116 | GST_CODEC_PARSERS_API |
| 1117 | void gst_h264_sps_clear (GstH264SPS *sps); |
| 1118 | |
| 1119 | GST_CODEC_PARSERS_API |
| 1120 | void gst_h264_pps_clear (GstH264PPS *pps); |
| 1121 | |
| 1122 | GST_CODEC_PARSERS_API |
| 1123 | void gst_h264_quant_matrix_8x8_get_zigzag_from_raster (guint8 out_quant[64], |
| 1124 | const guint8 quant[64]); |
| 1125 | |
| 1126 | GST_CODEC_PARSERS_API |
| 1127 | void gst_h264_quant_matrix_8x8_get_raster_from_zigzag (guint8 out_quant[64], |
| 1128 | const guint8 quant[64]); |
| 1129 | |
| 1130 | GST_CODEC_PARSERS_API |
| 1131 | void gst_h264_quant_matrix_4x4_get_zigzag_from_raster (guint8 out_quant[16], |
| 1132 | const guint8 quant[16]); |
| 1133 | |
| 1134 | GST_CODEC_PARSERS_API |
| 1135 | void gst_h264_quant_matrix_4x4_get_raster_from_zigzag (guint8 out_quant[16], |
| 1136 | const guint8 quant[16]); |
| 1137 | |
| 1138 | GST_CODEC_PARSERS_API |
| 1139 | void gst_h264_video_calculate_framerate (const GstH264SPS * sps, guint field_pic_flag, |
| 1140 | guint pic_struct, gint * fps_num, gint * fps_den); |
| 1141 | |
| 1142 | G_END_DECLS |
| 1143 | |
| 1144 | #endif |
| 1145 | |