# GstMpegvideoParser

Provides useful functions for mpeg videos bitstream parsing.

## Functions

### gst_mpeg_video_finalise_mpeg2_sequence_header

    gboolean
    gst_mpeg_video_finalise_mpeg2_sequence_header (GstMpegVideoSequenceHdr * hdr,
                                                   GstMpegVideoSequenceExt * seqext,
                                                   GstMpegVideoSequenceDisplayExt * displayext)

Parameters:

`hdr` –
No description available
`seqext` –
No description available
`displayext` –
No description available
Returns (gboolean) –
No description available

### gst_mpeg_video_packet_parse_gop

    gboolean
    gst_mpeg_video_packet_parse_gop (GstMpegVideoPacket * packet,
                                     GstMpegVideoGop * gop)

Parses the gop MPEG Video Group of Picture structure members from video packet

Parameters:

`packet` –

The GstMpegVideoPacket that carries the data

`gop` –

The GstMpegVideoGop structure to fill

Returns (gboolean) –

TRUE if the gop could be parsed correctly, FALSE otherwise.

Since : 1.2

### gst_mpeg_video_packet_parse_picture_extension

    gboolean
    gst_mpeg_video_packet_parse_picture_extension (GstMpegVideoPacket * packet,
                                                   GstMpegVideoPictureExt * picext)

Parse the ext MPEG Video Picture Extension structure members from video packet

Parameters:

`packet` –

The GstMpegVideoPacket that carries the data

`picext` –
No description available
Returns (gboolean) –

TRUE if the picture extension could be parsed correctly, FALSE otherwise.

Since : 1.2

### gst_mpeg_video_packet_parse_picture_header

    gboolean
    gst_mpeg_video_packet_parse_picture_header (GstMpegVideoPacket * packet,
                                                GstMpegVideoPictureHdr * pichdr)

Parsers the pichdr MPEG Video Picture Header structure members from video packet

Parameters:

`packet` –

The GstMpegVideoPacket that carries the data

`pichdr` –

The GstMpegVideoPictureHdr structure to fill

Returns (gboolean) –

TRUE if the picture sequence could be parsed correctly, FALSE otherwise.

Since : 1.2

### gst_mpeg_video_packet_parse_quant_matrix_extension

    gboolean
    gst_mpeg_video_packet_parse_quant_matrix_extension (GstMpegVideoPacket * packet,
                                                        GstMpegVideoQuantMatrixExt * quant)

Parses the quant MPEG Video Quantization Matrix Extension structure members from video packet

Parameters:

`packet` –

The GstMpegVideoPacket that carries the data

`quant` –

The GstMpegVideoQuantMatrixExt structure to fill

Returns (gboolean) –

TRUE if the quant matrix extension could be parsed correctly, FALSE otherwise.

Since : 1.2

### gst_mpeg_video_packet_parse_sequence_display_extension

    gboolean
    gst_mpeg_video_packet_parse_sequence_display_extension (GstMpegVideoPacket * packet,
                                                            GstMpegVideoSequenceDisplayExt * seqdisplayext)

Parses the seqext MPEG Video Sequence Display Extension structure members from video packet

Parameters:

`packet` –

The GstMpegVideoPacket that carries the data

`seqdisplayext` –

The GstMpegVideoSequenceDisplayExt structure to fill

Returns (gboolean) –

TRUE if the seqext could be parsed correctly, FALSE otherwise.

Since : 1.2

### gst_mpeg_video_packet_parse_sequence_extension

    gboolean
    gst_mpeg_video_packet_parse_sequence_extension (GstMpegVideoPacket * packet,
                                                    GstMpegVideoSequenceExt * seqext)

Parses the seqext MPEG Video Sequence Extension structure members from video packet

Parameters:

`packet` –

The GstMpegVideoPacket that carries the data

`seqext` –

The GstMpegVideoSequenceExt structure to fill

Returns (gboolean) –

TRUE if the seqext could be parsed correctly, FALSE otherwise.

Since : 1.2

### gst_mpeg_video_packet_parse_sequence_header

    gboolean
    gst_mpeg_video_packet_parse_sequence_header (GstMpegVideoPacket * packet,
                                                 GstMpegVideoSequenceHdr * seqhdr)

Parses the seqhdr MPEG Video Sequence Header structure members from video packet

Parameters:

`packet` –

The GstMpegVideoPacket that carries the data

`seqhdr` –

The GstMpegVideoSequenceHdr structure to fill

Returns (gboolean) –

TRUE if the seqhdr could be parsed correctly, FALSE otherwise.

Since : 1.2

### gst_mpeg_video_packet_parse_sequence_scalable_extension

    gboolean
    gst_mpeg_video_packet_parse_sequence_scalable_extension (GstMpegVideoPacket * packet,
                                                             GstMpegVideoSequenceScalableExt * seqscaleext)

Parses the seqscaleext MPEG Video Sequence Scalable Extension structure members from video packet

Parameters:

`packet` –

The GstMpegVideoPacket that carries the data

`seqscaleext` –

The GstMpegVideoSequenceScalableExt structure to fill

Returns (gboolean) –

TRUE if the seqext could be parsed correctly, FALSE otherwise.

Since : 1.2

### gst_mpeg_video_packet_parse_slice_header

    gboolean
    gst_mpeg_video_packet_parse_slice_header (GstMpegVideoPacket * packet,
                                              GstMpegVideoSliceHdr * slice_hdr,
                                              GstMpegVideoSequenceHdr * seq_hdr,
                                              GstMpegVideoSequenceScalableExt * seqscaleext)

Parses the GstMpegVideoSliceHdr structure members from data

Parameters:

`packet` –

The GstMpegVideoPacket that carries the data

`slice_hdr` –

The GstMpegVideoSliceHdr structure to fill

`seq_hdr` –
No description available
`seqscaleext` –

The GstMpegVideoSequenceScalableExt header

Returns (gboolean) –

TRUE if the slice could be parsed correctly, FALSE otherwise.

Since : 1.2

### gst_mpeg_video_parse

    gboolean
    gst_mpeg_video_parse (GstMpegVideoPacket * packet,
                          guint8 * data,
                          gsize size,
                          guint offset)

Parses the MPEG 1/2 video bitstream contained in data, and returns the offset, and if known also the size, in packet. This function will scan the data to find the next packet if needed.

Parameters:

`packet` –

a GstMpegVideoPacket to fill with the data and offset of the next packet found

`data` –

The data to parse

`size` –

The size of data

`offset` –

The offset from which to start parsing

Returns (gboolean) –

TRUE if a packet start code was found, otherwise FALSE.

### gst_mpeg_video_quant_matrix_get_raster_from_zigzag

    void
    gst_mpeg_video_quant_matrix_get_raster_from_zigzag (guint8[64]  out_quant,
                                                        const guint8[64]  quant)

Converts quantization matrix quant from zigzag scan order to raster scan order and store the resulting factors into out_quant.

Note: it is an error to pass the same table in both quant and out_quant arguments.

Parameters:

`out_quant` –

The resulting quantization matrix

`quant` –

The source quantization matrix

Returns (void ) –
No description available

Since : 1.2

### gst_mpeg_video_quant_matrix_get_zigzag_from_raster

    void
    gst_mpeg_video_quant_matrix_get_zigzag_from_raster (guint8[64]  out_quant,
                                                        const guint8[64]  quant)

Converts quantization matrix quant from raster scan order to zigzag scan order and store the resulting factors into out_quant.

Note: it is an error to pass the same table in both quant and out_quant arguments.

Parameters:

`out_quant` –

The resulting quantization matrix

`quant` –

The source quantization matrix

Returns (void ) –
No description available

Since : 1.2

## Structures

### GstMpegVideoGop

    struct _GstMpegVideoGop
    {
      guint8 drop_frame_flag;

      guint8 hour, minute, second, frame;

      guint8 closed_gop;
      guint8 broken_link;
    };

The Mpeg Video Group of Picture structure.

#### Fields

`drop_frame_flag` (guint8) –

Drop Frame Flag

`hour` (guint8) –

Hour (0-23)

`minute` (guint8) –

Minute (O-59)

`second` (guint8) –

Second (0-59)

`frame` (guint8) –

Frame (0-59)

`closed_gop` (guint8) –

Closed Gop

`broken_link` (guint8) –

Broken link

### GstMpegVideoPacket

    struct _GstMpegVideoPacket
    {
      const guint8 *data;
      guint8 type;
      guint  offset;
      gint   size;
    };

A structure that contains the type of a packet, its offset and its size

#### Fields

`data` (guint8 *) –

the data containing the packet starting at offset

`type` (guint8) –

the type of the packet that start at offset, as a GstMpegVideoPacketTypeCode

`offset` (guint) –

the offset of the packet start in bytes from data. This is the start of the packet itself without the sync code

`size` (gint) –

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

### GstMpegVideoPictureExt

    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;
    };

The Mpeg2 Video Picture Extension structure.

#### Fields

`f_code` (guint8[2][2] ) –
No description available
`intra_dc_precision` (guint8) –

Intra DC precision

`picture_structure` (guint8) –

Structure of the picture

`top_field_first` (guint8) –

Top field first

`frame_pred_frame_dct` (guint8) –

Frame

`concealment_motion_vectors` (guint8) –

Concealment Motion Vectors

`q_scale_type` (guint8) –

Q Scale Type

`intra_vlc_format` (guint8) –

Intra Vlc Format

`alternate_scan` (guint8) –

Alternate Scan

`repeat_first_field` (guint8) –

Repeat First Field

`chroma_420_type` (guint8) –

Chroma 420 Type

`progressive_frame` (guint8) –

TRUE if the frame is progressive FALSE otherwise

`composite_display` (guint8) –
No description available
`v_axis` (guint8) –
No description available
`field_sequence` (guint8) –
No description available
`sub_carrier` (guint8) –
No description available
`burst_amplitude` (guint8) –
No description available
`sub_carrier_phase` (guint8) –
No description available

### GstMpegVideoPictureHdr

    struct _GstMpegVideoPictureHdr
    {
      guint16 tsn;
      guint8 pic_type;
      guint16 vbv_delay;

      guint8 full_pel_forward_vector, full_pel_backward_vector;

      guint8 f_code[2][2];
    };

The Mpeg2 Video Picture Header structure.

#### Fields

`tsn` (guint16) –

Temporal Sequence Number

`pic_type` (guint8) –

Type of the frame

`vbv_delay` (guint16) –
No description available
`full_pel_forward_vector` (guint8) –

the full pel forward flag of the frame: 0 or 1.

`full_pel_backward_vector` (guint8) –

the full pel backward flag of the frame: 0 or 1.

`f_code` (guint8[2][2] ) –

F code

### GstMpegVideoQuantMatrixExt

    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];
    };

The Quant Matrix Extension structure that exposes quantization matrices in zigzag scan order. i.e. the original encoded scan order.

#### Fields

`load_intra_quantiser_matrix` (guint8) –
No description available
`intra_quantiser_matrix` (guint8[64] ) –
No description available
`load_non_intra_quantiser_matrix` (guint8) –
No description available
`non_intra_quantiser_matrix` (guint8[64] ) –
No description available
`load_chroma_intra_quantiser_matrix` (guint8) –
No description available
`chroma_intra_quantiser_matrix` (guint8[64] ) –
No description available
`load_chroma_non_intra_quantiser_matrix` (guint8) –
No description available
`chroma_non_intra_quantiser_matrix` (guint8[64] ) –
No description available

### GstMpegVideoSequenceDisplayExt

    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;
    };

#### Fields

`video_format` (guint8) –

3-bit video_format field indicating PAL/NTSC etc.

`colour_description_flag` (guint8) –

TRUE if colour information was provided

`colour_primaries` (guint8) –

Valid if colour_description_flag is set

`transfer_characteristics` (guint8) –

Valid if colour_description_flag is set

`matrix_coefficients` (guint8) –

Valid if colour_description_flag is set

`display_horizontal_size` (guint16) –

width of decoded frame sub-region to display

`display_vertical_size` (guint16) –

height of decoded frame sub-region to display

### GstMpegVideoSequenceExt

    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;
    };

The Mpeg2 Video Sequence Extension structure.

#### Fields

`profile` (guint8) –

mpeg2 decoder profile

`level` (guint8) –

mpeg2 decoder level

`progressive` (guint8) –

TRUE if the frames are progressive FALSE otherwise

`chroma_format` (guint8) –

indicates the chrominance format

`horiz_size_ext` (guint8) –

Horizontal size

`vert_size_ext` (guint8) –

Vertical size

`bitrate_ext` (guint16) –

The bitrate

`vbv_buffer_size_extension` (guint8) –

VBV buffer size

`low_delay` (guint8) –

TRUE if the sequence doesn't contain any B-pictures, FALSE otherwise

`fps_n_ext` (guint8) –

Framerate nominator code

`fps_d_ext` (guint8) –

Framerate denominator code

`profile_level_escape_bit` (guint8) –

Escape bit. If set, the meaning of the profile and level fields is different.

### GstMpegVideoSequenceHdr

    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;
    };

The Mpeg2 Video Sequence Header structure.

#### Fields

`width` (guint16) –

Width of each frame

`height` (guint16) –

Height of each frame

`aspect_ratio_info` (guint8) –
No description available
`frame_rate_code` (guint8) –
No description available
`bitrate_value` (guint32) –

Value of the bitrate as is in the stream (400bps unit)

`vbv_buffer_size_value` (guint16) –
No description available
`constrained_parameters_flag` (guint8) –

TRUE if this stream uses constrained parameters.

`load_intra_quantiser_matrix` (guint8) –

TRUE indicates the presence of intra_quantiser_matrix

`intra_quantizer_matrix` (guint8[64] ) –

intra-quantization table, in zigzag scan order

`load_non_intra_quantiser_matrix` (guint8) –

TRUE indicates the presence of non_intra_quantiser_matrix

`non_intra_quantizer_matrix` (guint8[64] ) –

non-intra quantization table, in zigzag scan order

`par_w` (guint) –

Calculated Pixel Aspect Ratio width

`par_h` (guint) –

Calculated Pixel Aspect Ratio height

`fps_n` (guint) –

Calculated Framrate nominator

`fps_d` (guint) –

Calculated Framerate denominator

`bitrate` (guint) –

the real bitrate of the Mpeg video stream in bits per second, 0 if VBR stream

### GstMpegVideoSequenceScalableExt

    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;
    };

The Sequence Scalable Extension structure.

#### Fields

`scalable_mode` (guint8) –
No description available
`layer_id` (guint8) –
No description available
`lower_layer_prediction_horizontal_size` (guint16) –
No description available
`lower_layer_prediction_vertical_size` (guint16) –
No description available
`horizontal_subsampling_factor_m` (guint8) –
No description available
`horizontal_subsampling_factor_n` (guint8) –
No description available
`vertical_subsampling_factor_m` (guint8) –
No description available
`vertical_subsampling_factor_n` (guint8) –
No description available
`picture_mux_enable` (guint8) –
No description available
`mux_to_progressive_sequence` (guint8) –
No description available
`picture_mux_order` (guint8) –
No description available
`picture_mux_factor` (guint8) –
No description available

Since : 1.2

### GstMpegVideoSliceHdr

    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 */
    };

The Mpeg2 Video Slice Header structure.

#### Fields

`vertical_position` (guint8) –

slice vertical position

`vertical_position_ext` (guint8) –
No description available
`priority_breakpoint` (guint8) –

Point where the bitstream shall be partitioned

`quantiser_scale_code` (guint8) –

Quantiser value (range: 1-31)

`slice_ext_flag` (guint8) –

Slice Extension flag

`intra_slice` (guint8) –

Equal to one if all the macroblocks are intra macro blocks.

`slice_picture_id_enable` (guint8) –

controls the semantics of slice_picture_id

`slice_picture_id` (guint8) –

Intended to aid recovery on severe bursts of errors for certain types of applications

`header_size` (guint) –
No description available
`mb_row` (gint) –
No description available
`mb_column` (gint) –
No description available

Since : 1.2

## Aliases

### GstMpegVideoChromaFormat

    typedef enum GstMpegVideoChromaFormat GstMpegVideoChromaFormat

Chroma subsampling type.

### GstMpegVideoLevel

    typedef enum GstMpegVideoLevel GstMpegVideoLevel

Mpeg-2 Levels.

### GstMpegVideoPacketExtensionCode

    typedef enum GstMpegVideoPacketExtensionCode GstMpegVideoPacketExtensionCode

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.

### GstMpegVideoPacketTypeCode

    typedef enum GstMpegVideoPacketTypeCode GstMpegVideoPacketTypeCode

Indicates the type of MPEG packet

### GstMpegVideoPictureStructure

    typedef enum GstMpegVideoPictureStructure GstMpegVideoPictureStructure

Picture structure type.

### GstMpegVideoPictureType

    typedef enum GstMpegVideoPictureType GstMpegVideoPictureType

Picture type.

### GstMpegVideoProfile

    typedef enum GstMpegVideoProfile GstMpegVideoProfile

Mpeg-2 Profiles.

### GstMpegVideoSequenceScalableMode

    typedef enum GstMpegVideoSequenceScalableMode GstMpegVideoSequenceScalableMode

The results of the search are