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  * From bad/sys/vdpau/mpeg/mpegutil.c:
7  *   Copyright (C) <2007> Jan Schmidt <thaytan@mad.scientist.com>
8  *   Copyright (C) <2009> Carl-Anton Ingmarsson <ca.ingmarsson@gmail.com>
9  *
10  * This library is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Library General Public
12  * License as published by the Free Software Foundation; either
13  * version 2 of the License, or (at your option) any later version.
14  *
15  * This library is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18  * Library General Public License for more details.
19  *
20  * You should have received a copy of the GNU Library General Public
21  * License along with this library; if not, write to the
22  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
23  * Boston, MA 02110-1301, USA.
24  */
25 
26 #ifndef __GST_MPEG_VIDEO_UTILS_H__
27 #define __GST_MPEG_VIDEO_UTILS_H__
28 
29 #ifndef GST_USE_UNSTABLE_API
30 #warning "The Mpeg video parsing library is unstable API and may change in future."
31 #warning "You can define GST_USE_UNSTABLE_API to avoid this warning."
32 #endif
33 
34 #include <gst/gst.h>
35 #include <gst/codecparsers/codecparsers-prelude.h>
36 
37 G_BEGIN_DECLS
38 
39 /**
40  * GstMpegVideoPacketTypeCode:
41  * @GST_MPEG_VIDEO_PACKET_PICTURE: Picture packet starting code
42  * @GST_MPEG_VIDEO_PACKET_SLICE_MIN: Slice min packet starting code
43  * @GST_MPEG_VIDEO_PACKET_SLICE_MAX: Slice max packet starting code
44  * @GST_MPEG_VIDEO_PACKET_USER_DATA: User data packet starting code
45  * @GST_MPEG_VIDEO_PACKET_SEQUENCE : Sequence packet starting code
46  * @GST_MPEG_VIDEO_PACKET_EXTENSION: Extension packet starting code
47  * @GST_MPEG_VIDEO_PACKET_SEQUENCE_END: Sequence end packet code
48  * @GST_MPEG_VIDEO_PACKET_GOP: Group of Picture packet starting code
49  * @GST_MPEG_VIDEO_PACKET_NONE: None packet code
50  *
51  * Indicates the type of MPEG packet
52  */
53 typedef enum {
54   GST_MPEG_VIDEO_PACKET_PICTURE      = 0x00,
55   GST_MPEG_VIDEO_PACKET_SLICE_MIN    = 0x01,
56   GST_MPEG_VIDEO_PACKET_SLICE_MAX    = 0xaf,
57   GST_MPEG_VIDEO_PACKET_USER_DATA    = 0xb2,
58   GST_MPEG_VIDEO_PACKET_SEQUENCE     = 0xb3,
59   GST_MPEG_VIDEO_PACKET_EXTENSION    = 0xb5,
60   GST_MPEG_VIDEO_PACKET_SEQUENCE_END = 0xb7,
61   GST_MPEG_VIDEO_PACKET_GOP          = 0xb8,
62   GST_MPEG_VIDEO_PACKET_NONE         = 0xff
63 } GstMpegVideoPacketTypeCode;
64 
65 /**
66  * GST_MPEG_VIDEO_PACKET_IS_SLICE:
67  * @typecode: The MPEG video packet type code
68  *
69  * Checks whether a packet type code is a slice.
70  *
71  * Returns: %TRUE if the packet type code corresponds to a slice,
72  * else %FALSE.
73  */
74 #define GST_MPEG_VIDEO_PACKET_IS_SLICE(typecode) ((typecode) >= GST_MPEG_VIDEO_PACKET_SLICE_MIN && \
75                                                   (typecode) <= GST_MPEG_VIDEO_PACKET_SLICE_MAX)
76 
77 /**
78  * GstMpegVideoPacketExtensionCode:
79  * @GST_MPEG_VIDEO_PACKET_EXT_SEQUENCE: Sequence extension code
80  * @GST_MPEG_VIDEO_PACKET_EXT_SEQUENCE_DISPLAY: Sequence Display extension code
81  * @GST_MPEG_VIDEO_PACKET_EXT_QUANT_MATRIX: Quantization Matrix extension code
82  * @GST_MPEG_VIDEO_PACKET_EXT_SEQUENCE_SCALABLE: Sequence Scalable extension code
83  * @GST_MPEG_VIDEO_PACKET_EXT_PICTURE: Picture coding extension
84  *
85  * Indicates what type of packets are in this block, some are mutually
86  * exclusive though - ie, sequence packs are accumulated separately. GOP &
87  * Picture may occur together or separately.
88  */
89 typedef enum {
90   GST_MPEG_VIDEO_PACKET_EXT_SEQUENCE          = 0x01,
91   GST_MPEG_VIDEO_PACKET_EXT_SEQUENCE_DISPLAY  = 0x02,
92   GST_MPEG_VIDEO_PACKET_EXT_QUANT_MATRIX      = 0x03,
93   GST_MPEG_VIDEO_PACKET_EXT_SEQUENCE_SCALABLE = 0x05,
94   GST_MPEG_VIDEO_PACKET_EXT_PICTURE           = 0x08
95 } GstMpegVideoPacketExtensionCode;
96 
97 /**
98  * GstMpegVideoSequenceScalableMode:
99  * @GST_MPEG_VIDEO_SEQ_SCALABLE_MODE_DATA_PARTITIONING: Data partitioning
100  * @GST_MPEG_VIDEO_SEQ_SCALABLE_MODE_SPATIAL: Spatial Scalability
101  * @GST_MPEG_VIDEO_SEQ_SCALABLE_MODE_SNR: SNR Scalability
102  * @GST_MPEG_VIDEO_SEQ_SCALABLE_MODE_TEMPORAL: Temporal Scalability
103  */
104 typedef enum {
105   GST_MPEG_VIDEO_SEQ_SCALABLE_MODE_DATA_PARTITIONING  = 0x00,
106   GST_MPEG_VIDEO_SEQ_SCALABLE_MODE_SPATIAL            = 0x01,
107   GST_MPEG_VIDEO_SEQ_SCALABLE_MODE_SNR                = 0x02,
108   GST_MPEG_VIDEO_SEQ_SCALABLE_MODE_TEMPORAL           = 0x03
109 } GstMpegVideoSequenceScalableMode;
110 
111 /**
112  * GstMpegVideoLevel:
113  * @GST_MPEG_VIDEO_LEVEL_LOW: Low level (LL)
114  * @GST_MPEG_VIDEO_LEVEL_MAIN: Main level (ML)
115  * @GST_MPEG_VIDEO_LEVEL_HIGH_1440: High 1440 level (H-14)
116  * @GST_MPEG_VIDEO_LEVEL_HIGH: High level (HL)
117  *
118  * Mpeg-2 Levels.
119  **/
120 typedef enum {
121  GST_MPEG_VIDEO_LEVEL_HIGH      = 0x04,
122  GST_MPEG_VIDEO_LEVEL_HIGH_1440 = 0x06,
123  GST_MPEG_VIDEO_LEVEL_MAIN      = 0x08,
124  GST_MPEG_VIDEO_LEVEL_LOW       = 0x0a
125 } GstMpegVideoLevel;
126 
127 /**
128  * GstMpegVideoProfile:
129  * @GST_MPEG_VIDEO_PROFILE_422: 4:2:2 profile (422)
130  * @GST_MPEG_VIDEO_PROFILE_HIGH: High profile (HP)
131  * @GST_MPEG_VIDEO_PROFILE_SPATIALLY_SCALABLE: Spatially Scalable profile (Spatial)
132  * @GST_MPEG_VIDEO_PROFILE_SNR_SCALABLE: SNR Scalable profile (SNR)
133  * @GST_MPEG_VIDEO_PROFILE_MAIN: Main profile (MP)
134  * @GST_MPEG_VIDEO_PROFILE_SIMPLE: Simple profile (SP)
135  *
136  * Mpeg-2 Profiles.
137  **/
138 typedef enum {
139   GST_MPEG_VIDEO_PROFILE_422                 = 0x00,
140   GST_MPEG_VIDEO_PROFILE_HIGH                = 0x01,
141   GST_MPEG_VIDEO_PROFILE_SPATIALLY_SCALABLE  = 0x02,
142   GST_MPEG_VIDEO_PROFILE_SNR_SCALABLE        = 0x03,
143   GST_MPEG_VIDEO_PROFILE_MAIN                = 0x04,
144   GST_MPEG_VIDEO_PROFILE_SIMPLE              = 0x05
145 } GstMpegVideoProfile;
146 
147 /**
148  * GstMpegVideoChromaFormat:
149  * @GST_MPEG_VIDEO_CHROMA_RES: Invalid (reserved for future use)
150  * @GST_MPEG_VIDEO_CHROMA_420: 4:2:0 subsampling
151  * @GST_MPEG_VIDEO_CHROMA_422: 4:2:2 subsampling
152  * @GST_MPEG_VIDEO_CHROMA_444: 4:4:4 (non-subsampled)
153  *
154  * Chroma subsampling type.
155  */
156 typedef enum {
157   GST_MPEG_VIDEO_CHROMA_RES = 0x00,
158   GST_MPEG_VIDEO_CHROMA_420 = 0x01,
159   GST_MPEG_VIDEO_CHROMA_422 = 0x02,
160   GST_MPEG_VIDEO_CHROMA_444 = 0x03,
161 } GstMpegVideoChromaFormat;
162 
163 /**
164  * GstMpegVideoPictureType:
165  * @GST_MPEG_VIDEO_PICTURE_TYPE_I: Intra-coded (I) frame
166  * @GST_MPEG_VIDEO_PICTURE_TYPE_P: Predictive-codec (P) frame
167  * @GST_MPEG_VIDEO_PICTURE_TYPE_B: Bidirectionally predictive-coded (B) frame
168  * @GST_MPEG_VIDEO_PICTURE_TYPE_D: D frame
169  *
170  * Picture type.
171  */
172 typedef enum {
173   GST_MPEG_VIDEO_PICTURE_TYPE_I = 0x01,
174   GST_MPEG_VIDEO_PICTURE_TYPE_P = 0x02,
175   GST_MPEG_VIDEO_PICTURE_TYPE_B = 0x03,
176   GST_MPEG_VIDEO_PICTURE_TYPE_D = 0x04
177 } GstMpegVideoPictureType;
178 
179 /**
180  * GstMpegVideoPictureStructure:
181  * @GST_MPEG_VIDEO_PICTURE_STRUCTURE_TOP_FIELD: Top field
182  * @GST_MPEG_VIDEO_PICTURE_STRUCTURE_BOTTOM_FIELD: Bottom field
183  * @GST_MPEG_VIDEO_PICTURE_STRUCTURE_FRAME: Frame picture
184  *
185  * Picture structure type.
186  */
187 typedef enum {
188     GST_MPEG_VIDEO_PICTURE_STRUCTURE_TOP_FIELD    = 0x01,
189     GST_MPEG_VIDEO_PICTURE_STRUCTURE_BOTTOM_FIELD = 0x02,
190     GST_MPEG_VIDEO_PICTURE_STRUCTURE_FRAME        = 0x03
191 } GstMpegVideoPictureStructure;
192 
193 typedef struct _GstMpegVideoSequenceHdr     GstMpegVideoSequenceHdr;
194 typedef struct _GstMpegVideoSequenceExt     GstMpegVideoSequenceExt;
195 typedef struct _GstMpegVideoSequenceDisplayExt GstMpegVideoSequenceDisplayExt;
196 typedef struct _GstMpegVideoSequenceScalableExt GstMpegVideoSequenceScalableExt;
197 typedef struct _GstMpegVideoPictureHdr      GstMpegVideoPictureHdr;
198 typedef struct _GstMpegVideoGop             GstMpegVideoGop;
199 typedef struct _GstMpegVideoPictureExt      GstMpegVideoPictureExt;
200 typedef struct _GstMpegVideoQuantMatrixExt  GstMpegVideoQuantMatrixExt;
201 typedef struct _GstMpegVideoSliceHdr        GstMpegVideoSliceHdr;
202 typedef struct _GstMpegVideoPacket          GstMpegVideoPacket;
203 
204 /**
205  * GstMpegVideoSequenceHdr:
206  * @width: Width of each frame
207  * @height: Height of each frame
208  * @par_w: Calculated Pixel Aspect Ratio width
209  * @par_h: Calculated Pixel Aspect Ratio height
210  * @fps_n: Calculated Framrate nominator
211  * @fps_d: Calculated Framerate denominator
212  * @bitrate_value: Value of the bitrate as is in the stream (400bps unit)
213  * @bitrate: the real bitrate of the Mpeg video stream in bits per second, 0 if VBR stream
214  * @constrained_parameters_flag: %TRUE if this stream uses contrained parameters.
215  * @load_intra_quantiser_matrix: %TRUE indicates the presence of intra_quantiser_matrix
216  * @intra_quantizer_matrix: intra-quantization table, in zigzag scan order
217  * @load_non_intra_quantiser_matrix: %TRUE indicates the presence of non_intra_quantiser_matrix
218  * @non_intra_quantizer_matrix: non-intra quantization table, in zigzag scan order
219  *
220  * The Mpeg2 Video Sequence Header structure.
221  */
222 struct _GstMpegVideoSequenceHdr
223 {
224   guint16 width, height;
225   guint8  aspect_ratio_info;
226   guint8  frame_rate_code;
227   guint32 bitrate_value;
228   guint16 vbv_buffer_size_value;
229 
230   guint8  constrained_parameters_flag;
231 
232   guint8  load_intra_quantiser_matrix;
233   guint8  intra_quantizer_matrix[64];
234   guint8  load_non_intra_quantiser_matrix;
235   guint8  non_intra_quantizer_matrix[64];
236 
237   /* Calculated values */
238   guint   par_w, par_h;
239   guint   fps_n, fps_d;
240   guint   bitrate;
241 };
242 
243 /**
244  * GstMpegVideoSequenceExt:
245  * @profile: mpeg2 decoder profile
246  * @level: mpeg2 decoder level
247  * @progressive: %TRUE if the frames are progressive %FALSE otherwise
248  * @chroma_format: indicates the chrominance format
249  * @horiz_size_ext: Horizontal size
250  * @vert_size_ext: Vertical size
251  * @bitrate_ext: The bitrate
252  * @vbv_buffer_size_extension: VBV vuffer size
253  * @low_delay: %TRUE if the sequence doesn't contain any B-pictures, %FALSE
254  * otherwise
255  * @fps_n_ext: Framerate nominator code
256  * @fps_d_ext: Framerate denominator code
257  * @profile_level_escape_bit: Escape bit. If set, the meaning of the
258  *    @profile and @level fields is different.
259  *
260  * The Mpeg2 Video Sequence Extension structure.
261  **/
262 struct _GstMpegVideoSequenceExt
263 {
264   /* mpeg2 decoder profile */
265   guint8 profile;
266   /* mpeg2 decoder level */
267   guint8 level;
268 
269   guint8 progressive;
270   guint8 chroma_format;
271 
272   guint8 horiz_size_ext, vert_size_ext;
273 
274   guint16 bitrate_ext;
275   guint8 vbv_buffer_size_extension;
276   guint8 low_delay;
277   guint8 fps_n_ext, fps_d_ext;
278 
279   /* Additional information */
280   guint8 profile_level_escape_bit;
281 };
282 
283 /**
284  * GstMpegVideoSequenceDisplayExt:
285  * @profile: mpeg2 decoder profil
286 
287  */
288 struct _GstMpegVideoSequenceDisplayExt
289 {
290   guint8 video_format;
291   guint8 colour_description_flag;
292 
293   /* if colour_description_flag: */
294     guint8 colour_primaries;
295     guint8 transfer_characteristics;
296     guint8 matrix_coefficients;
297 
298   guint16 display_horizontal_size;
299   guint16 display_vertical_size;
300 };
301 
302 /**
303  * GstMpegVideoSequenceScalableExt:
304  * @scalable_mode:
305  * @layer_id:
306  * @lower_layer_prediction_horizontal_size:
307  * @lower_layer_prediction_vertical_size:
308  * @horizontal_subsampling_factor_m:
309  * @horizontal_subsampling_factor_n:
310  * @vertical_subsampling_factor_m:
311  * @vertical_subsampling_factor_n:
312  * @picture_mux_enable:
313  * @mux_to_progressive_sequence:
314  * @picture_mux_order:
315  * @picture_mux_factor:
316  *
317  * The Sequence Scalable Extension structure.
318  *
319  * Since: 1.2
320  */
321 struct _GstMpegVideoSequenceScalableExt
322 {
323   guint8 scalable_mode;
324   guint8 layer_id;
325 
326   /* if spatial scalability */
327   guint16 lower_layer_prediction_horizontal_size;
328   guint16 lower_layer_prediction_vertical_size;
329   guint8 horizontal_subsampling_factor_m;
330   guint8 horizontal_subsampling_factor_n;
331   guint8 vertical_subsampling_factor_m;
332   guint8 vertical_subsampling_factor_n;
333 
334   /* if temporal scalability */
335   guint8 picture_mux_enable;
336   guint8 mux_to_progressive_sequence;
337   guint8 picture_mux_order;
338   guint8 picture_mux_factor;
339 };
340 
341 /**
342  * GstMpegVideoQuantMatrixExt:
343  * @load_intra_quantiser_matrix:
344  * @intra_quantiser_matrix:
345  * @load_non_intra_quantiser_matrix:
346  * @non_intra_quantiser_matrix:
347  * @load_chroma_intra_quantiser_matrix:
348  * @chroma_intra_quantiser_matrix:
349  * @load_chroma_non_intra_quantiser_matrix:
350  * @chroma_non_intra_quantiser_matrix:
351  *
352  * The Quant Matrix Extension structure that exposes quantization
353  * matrices in zigzag scan order. i.e. the original encoded scan
354  * order.
355  */
356 struct _GstMpegVideoQuantMatrixExt
357 {
358  guint8 load_intra_quantiser_matrix;
359  guint8 intra_quantiser_matrix[64];
360  guint8 load_non_intra_quantiser_matrix;
361  guint8 non_intra_quantiser_matrix[64];
362  guint8 load_chroma_intra_quantiser_matrix;
363  guint8 chroma_intra_quantiser_matrix[64];
364  guint8 load_chroma_non_intra_quantiser_matrix;
365  guint8 chroma_non_intra_quantiser_matrix[64];
366 };
367 
368 /**
369  * GstMpegVideoPictureHdr:
370  * @tsn: Temporal Sequence Number
371  * @pic_type: Type of the frame
372  * @full_pel_forward_vector: the full pel forward flag of
373  *  the frame: 0 or 1.
374  * @full_pel_backward_vector: the full pel backward flag
375  *  of the frame: 0 or 1.
376  * @f_code: F code
377  *
378  * The Mpeg2 Video Picture Header structure.
379  */
380 struct _GstMpegVideoPictureHdr
381 {
382   guint16 tsn;
383   guint8 pic_type;
384   guint16 vbv_delay;
385 
386   guint8 full_pel_forward_vector, full_pel_backward_vector;
387 
388   guint8 f_code[2][2];
389 };
390 
391 /**
392  * GstMpegVideoPictureExt:
393  * @intra_dc_precision: Intra DC precision
394  * @picture_structure: Structure of the picture
395  * @top_field_first: Top field first
396  * @frame_pred_frame_dct: Frame
397  * @concealment_motion_vectors: Concealment Motion Vectors
398  * @q_scale_type: Q Scale Type
399  * @intra_vlc_format: Intra Vlc Format
400  * @alternate_scan: Alternate Scan
401  * @repeat_first_field: Repeat First Field
402  * @chroma_420_type: Chroma 420 Type
403  * @progressive_frame: %TRUE if the frame is progressive %FALSE otherwise
404  *
405  * The Mpeg2 Video Picture Extension structure.
406  */
407 struct _GstMpegVideoPictureExt
408 {
409   guint8 f_code[2][2];
410 
411   guint8 intra_dc_precision;
412   guint8 picture_structure;
413   guint8 top_field_first;
414   guint8 frame_pred_frame_dct;
415   guint8 concealment_motion_vectors;
416   guint8 q_scale_type;
417   guint8 intra_vlc_format;
418   guint8 alternate_scan;
419   guint8 repeat_first_field;
420   guint8 chroma_420_type;
421   guint8 progressive_frame;
422   guint8 composite_display;
423   guint8 v_axis;
424   guint8 field_sequence;
425   guint8 sub_carrier;
426   guint8 burst_amplitude;
427   guint8 sub_carrier_phase;
428 };
429 
430 /**
431  * GstMpegVideoGop:
432  * @drop_frame_flag: Drop Frame Flag
433  * @hour: Hour (0-23)
434  * @minute: Minute (O-59)
435  * @second: Second (0-59)
436  * @frame: Frame (0-59)
437  * @closed_gop: Closed Gop
438  * @broken_link: Broken link
439  *
440  * The Mpeg Video Group of Picture structure.
441  */
442 struct _GstMpegVideoGop
443 {
444   guint8 drop_frame_flag;
445 
446   guint8 hour, minute, second, frame;
447 
448   guint8 closed_gop;
449   guint8 broken_link;
450 };
451 
452 /**
453  * GstMpegVideoSliceHdr:
454  * @vertical_position: slice vertical position
455  * @vertical_position_extension: Extension to slice_vertical_position
456  * @priority_breakpoint: Point where the bitstream shall be partitioned
457  * @quantiser_scale_code: Quantiser value (range: 1-31)
458  * @slice_ext_flag: Slice Extension flag
459  * @intra_slice: Equal to one if all the macroblocks are intra macro blocks.
460  * @slice_picture_id_enable: controls the semantics of slice_picture_id
461  * @slice_picture_id: Intended to aid recovery on severe bursts of
462  *   errors for certain types of applications
463  *
464  * The Mpeg2 Video Slice Header structure.
465  *
466  * Since: 1.2
467  */
468 struct _GstMpegVideoSliceHdr
469 {
470   guint8 vertical_position;
471   guint8 vertical_position_ext;
472 
473   guint8 priority_breakpoint;
474   guint8 quantiser_scale_code;
475   guint8 slice_ext_flag;
476   guint8 intra_slice;
477   guint8 slice_picture_id_enable;
478   guint8 slice_picture_id;
479 
480   /* Calculated values */
481   guint header_size;            /* slice_header size in bits */
482   gint mb_row;                  /* macroblock row */
483   gint mb_column;               /* macroblock column */
484 };
485 
486 /**
487  * GstMpegVideoPacket:
488  * @type: the type of the packet that start at @offset, as a #GstMpegVideoPacketTypeCode
489  * @data: the data containing the packet starting at @offset
490  * @offset: the offset of the packet start in bytes from @data. This is the
491  *     start of the packet itself without the sync code
492  * @size: The size in bytes of the packet or -1 if the end wasn't found. This
493  *     is the size of the packet itself without the sync code
494  *
495  * A structure that contains the type of a packet, its offset and its size
496  */
497 struct _GstMpegVideoPacket
498 {
499   const guint8 *data;
500   guint8 type;
501   guint  offset;
502   gint   size;
503 };
504 
505 GST_CODEC_PARSERS_API
506 gboolean gst_mpeg_video_parse                         (GstMpegVideoPacket * packet,
507                                                        const guint8 * data, gsize size, guint offset);
508 
509 GST_CODEC_PARSERS_API
510 gboolean gst_mpeg_video_packet_parse_sequence_header    (const GstMpegVideoPacket * packet,
511                                                          GstMpegVideoSequenceHdr * seqhdr);
512 
513 GST_CODEC_PARSERS_API
514 gboolean gst_mpeg_video_packet_parse_sequence_extension (const GstMpegVideoPacket * packet,
515                                                          GstMpegVideoSequenceExt * seqext);
516 
517 GST_CODEC_PARSERS_API
518 gboolean gst_mpeg_video_packet_parse_sequence_display_extension (const GstMpegVideoPacket * packet,
519                                                          GstMpegVideoSequenceDisplayExt * seqdisplayext);
520 
521 GST_CODEC_PARSERS_API
522 gboolean gst_mpeg_video_packet_parse_sequence_scalable_extension (const GstMpegVideoPacket * packet,
523                                                          GstMpegVideoSequenceScalableExt * seqscaleext);
524 
525 GST_CODEC_PARSERS_API
526 gboolean gst_mpeg_video_packet_parse_picture_header     (const GstMpegVideoPacket * packet,
527                                                          GstMpegVideoPictureHdr* pichdr);
528 
529 GST_CODEC_PARSERS_API
530 gboolean gst_mpeg_video_packet_parse_picture_extension  (const GstMpegVideoPacket * packet,
531                                                          GstMpegVideoPictureExt *picext);
532 
533 GST_CODEC_PARSERS_API
534 gboolean gst_mpeg_video_packet_parse_gop                (const GstMpegVideoPacket * packet,
535                                                          GstMpegVideoGop * gop);
536 
537 GST_CODEC_PARSERS_API
538 gboolean gst_mpeg_video_packet_parse_slice_header       (const GstMpegVideoPacket * packet,
539                                                          GstMpegVideoSliceHdr * slice_hdr,
540                                                          GstMpegVideoSequenceHdr * seq_hdr,
541                                                          GstMpegVideoSequenceScalableExt * seqscaleext);
542 
543 GST_CODEC_PARSERS_API
544 gboolean gst_mpeg_video_packet_parse_quant_matrix_extension (const GstMpegVideoPacket * packet,
545                                                          GstMpegVideoQuantMatrixExt * quant);
546 
547 /* seqext and displayext may be NULL if not received */
548 
549 GST_CODEC_PARSERS_API
550 gboolean gst_mpeg_video_finalise_mpeg2_sequence_header (GstMpegVideoSequenceHdr *hdr,
551    GstMpegVideoSequenceExt *seqext, GstMpegVideoSequenceDisplayExt *displayext);
552 
553 GST_CODEC_PARSERS_API
554 void     gst_mpeg_video_quant_matrix_get_raster_from_zigzag (guint8 out_quant[64],
555                                                              const guint8 quant[64]);
556 
557 GST_CODEC_PARSERS_API
558 void     gst_mpeg_video_quant_matrix_get_zigzag_from_raster (guint8 out_quant[64],
559                                                              const guint8 quant[64]);
560 
561 G_END_DECLS
562 
563 #endif
564