# GstVideo Codec utility function

## GstVideoCodecFrame

A GstVideoCodecFrame represents a video frame both in raw and encoded form.

### Members

`system_frame_number` (guint32) –

Unique identifier for the frame. Use this if you need to get hold of the frame later (like when data is being decoded). Typical usage in decoders is to set this on the opaque value provided to the library and get back the frame using gst_video_decoder_get_frame

`dts` (GstClockTime) –

Decoding timestamp

`pts` (GstClockTime) –

Presentation timestamp

`duration` (GstClockTime) –

Duration of the frame

`distance_from_sync` (int) –

Distance in frames from the last synchronization point.

`input_buffer` (GstBuffer *) –

the input GstBuffer that created this frame. The buffer is owned by the frame and references to the frame instead of the buffer should be kept.

`output_buffer` (GstBuffer *) –

the output GstBuffer. Implementations should set this either directly, or by using the gst_video_decoder_allocate_output_frame or gst_video_decoder_allocate_output_buffer methods. The buffer is owned by the frame and references to the frame instead of the buffer should be kept.

`deadline` (GstClockTime) –

Running time when the frame will be used.

## GstVideo.VideoCodecFrame

A GstVideo.VideoCodecFrame represents a video frame both in raw and encoded form.

### Members

`system_frame_number` (Number) –

Unique identifier for the frame. Use this if you need to get hold of the frame later (like when data is being decoded). Typical usage in decoders is to set this on the opaque value provided to the library and get back the frame using GstVideo.VideoDecoder.prototype.get_frame

`dts` (Number) –

Decoding timestamp

`pts` (Number) –

Presentation timestamp

`duration` (Number) –

Duration of the frame

`distance_from_sync` (Number) –

Distance in frames from the last synchronization point.

`input_buffer` (Gst.Buffer) –

the input Gst.Buffer that created this frame. The buffer is owned by the frame and references to the frame instead of the buffer should be kept.

`output_buffer` (Gst.Buffer) –

the output Gst.Buffer. Implementations should set this either directly, or by using the GstVideo.VideoDecoder.prototype.allocate_output_frame or GstVideo.VideoDecoder.prototype.allocate_output_buffer methods. The buffer is owned by the frame and references to the frame instead of the buffer should be kept.

`deadline` (Number) –

Running time when the frame will be used.

## GstVideo.VideoCodecFrame

A GstVideo.VideoCodecFrame represents a video frame both in raw and encoded form.

### Members

`system_frame_number` (int) –

Unique identifier for the frame. Use this if you need to get hold of the frame later (like when data is being decoded). Typical usage in decoders is to set this on the opaque value provided to the library and get back the frame using GstVideo.VideoDecoder.get_frame

`dts` (int) –

Decoding timestamp

`pts` (int) –

Presentation timestamp

`duration` (int) –

Duration of the frame

`distance_from_sync` (int) –

Distance in frames from the last synchronization point.

`input_buffer` (Gst.Buffer) –

the input Gst.Buffer that created this frame. The buffer is owned by the frame and references to the frame instead of the buffer should be kept.

`output_buffer` (Gst.Buffer) –

the output Gst.Buffer. Implementations should set this either directly, or by using the GstVideo.VideoDecoder.allocate_output_frame or GstVideo.VideoDecoder.allocate_output_buffer methods. The buffer is owned by the frame and references to the frame instead of the buffer should be kept.

`deadline` (int) –

Running time when the frame will be used.

### Methods

#### gst_video_codec_frame_get_user_data

    gpointer
    gst_video_codec_frame_get_user_data (GstVideoCodecFrame * frame)

Gets private data set on the frame by the subclass via gst_video_codec_frame_set_user_data previously.

Parameters:

`frame` –

a GstVideoCodecFrame

Returns ( [transfer: none]) –

The previously set user_data

#### GstVideo.VideoCodecFrame.prototype.get_user_data

    function GstVideo.VideoCodecFrame.prototype.get_user_data(): {
        // javascript wrapper for 'gst_video_codec_frame_get_user_data'
    }

Gets private data set on the frame by the subclass via GstVideo.VideoCodecFrame.prototype.set_user_data previously.

Parameters:

`frame` (GstVideo.VideoCodecFrame) –

a GstVideo.VideoCodecFrame

Returns (Object) –

The previously set user_data

#### GstVideo.VideoCodecFrame.get_user_data

    def GstVideo.VideoCodecFrame.get_user_data (self):
        #python wrapper for 'gst_video_codec_frame_get_user_data'

Gets private data set on the frame by the subclass via GstVideo.VideoCodecFrame.set_user_data previously.

Parameters:

`frame` (GstVideo.VideoCodecFrame) –

a GstVideo.VideoCodecFrame

Returns (object) –

The previously set user_data

#### gst_video_codec_frame_ref

    GstVideoCodecFrame *
    gst_video_codec_frame_ref (GstVideoCodecFrame * frame)

Increases the refcount of the given frame by one.

Parameters:

`frame` –

a GstVideoCodecFrame

Returns –

buf

#### GstVideo.VideoCodecFrame.prototype.ref

    function GstVideo.VideoCodecFrame.prototype.ref(): {
        // javascript wrapper for 'gst_video_codec_frame_ref'
    }

Increases the refcount of the given frame by one.

Parameters:

`frame` (GstVideo.VideoCodecFrame) –

a GstVideo.VideoCodecFrame

Returns (GstVideo.VideoCodecFrame) –

buf

#### GstVideo.VideoCodecFrame.ref

    def GstVideo.VideoCodecFrame.ref (self):
        #python wrapper for 'gst_video_codec_frame_ref'

Increases the refcount of the given frame by one.

Parameters:

`frame` (GstVideo.VideoCodecFrame) –

a GstVideo.VideoCodecFrame

Returns (GstVideo.VideoCodecFrame) –

buf

#### gst_video_codec_frame_set_user_data

    gst_video_codec_frame_set_user_data (GstVideoCodecFrame * frame,
                                         gpointer user_data,
                                         GDestroyNotify notify)

Sets user_data on the frame and the GDestroyNotify that will be called when the frame is freed. Allows to attach private data by the subclass to frames.

If a user_data was previously set, then the previous set notify will be called before the user_data is replaced.

Parameters:

`frame` –

a GstVideoCodecFrame

`user_data` –

private data

`notify` ( [closure]) –

a GDestroyNotify

#### GstVideo.VideoCodecFrame.prototype.set_user_data

    function GstVideo.VideoCodecFrame.prototype.set_user_data(user_data: Object, notify: GLib.DestroyNotify): {
        // javascript wrapper for 'gst_video_codec_frame_set_user_data'
    }

Sets user_data on the frame and the GDestroyNotify that will be called when the frame is freed. Allows to attach private data by the subclass to frames.

If a user_data was previously set, then the previous set notify will be called before the user_data is replaced.

Parameters:

`frame` (GstVideo.VideoCodecFrame) –

a GstVideo.VideoCodecFrame

`user_data` (Object) –

private data

`notify` (GLib.DestroyNotify) –

a GDestroyNotify

#### GstVideo.VideoCodecFrame.set_user_data

    def GstVideo.VideoCodecFrame.set_user_data (self, *user_data, notify):
        #python wrapper for 'gst_video_codec_frame_set_user_data'

Sets user_data on the frame and the GDestroyNotify that will be called when the frame is freed. Allows to attach private data by the subclass to frames.

If a user_data was previously set, then the previous set notify will be called before the user_data is replaced.

Parameters:

`frame` (GstVideo.VideoCodecFrame) –

a GstVideo.VideoCodecFrame

`user_data` (variadic) –

private data

`notify` (GLib.DestroyNotify) –

a GDestroyNotify

#### gst_video_codec_frame_unref

    gst_video_codec_frame_unref (GstVideoCodecFrame * frame)

Decreases the refcount of the frame. If the refcount reaches 0, the frame will be freed.

Parameters:

`frame` –

a GstVideoCodecFrame

#### GstVideo.VideoCodecFrame.prototype.unref

    function GstVideo.VideoCodecFrame.prototype.unref(): {
        // javascript wrapper for 'gst_video_codec_frame_unref'
    }

Decreases the refcount of the frame. If the refcount reaches 0, the frame will be freed.

Parameters:

`frame` (GstVideo.VideoCodecFrame) –

a GstVideo.VideoCodecFrame

#### GstVideo.VideoCodecFrame.unref

    def GstVideo.VideoCodecFrame.unref (self):
        #python wrapper for 'gst_video_codec_frame_unref'

Decreases the refcount of the frame. If the refcount reaches 0, the frame will be freed.

Parameters:

`frame` (GstVideo.VideoCodecFrame) –

a GstVideo.VideoCodecFrame

## GstVideoCodecState

Structure representing the state of an incoming or outgoing video stream for encoders and decoders.

Decoders and encoders will receive such a state through their respective set_format vmethods.

Decoders and encoders can set the downstream state, by using the gst_video_decoder_set_output_state or gst_video_encoder_set_output_state methods.

### Members

`info` (GstVideoInfo) –

The GstVideoInfo describing the stream

`caps` (GstCaps *) –

The GstCaps used in the caps negotiation of the pad.

`codec_data` (GstBuffer *) –

a GstBuffer corresponding to the 'codec_data' field of a stream, or NULL.

`allocation_caps` (GstCaps *) –

The GstCaps for allocation query and pool negotiation. Since: 1.10

`mastering_display_info` (GstVideoMasteringDisplayInfo *) –

Mastering display color volume information (HDR metadata) for the stream.

`content_light_level` (GstVideoContentLightLevel *) –

Content light level information for the stream.

## GstVideo.VideoCodecState

Structure representing the state of an incoming or outgoing video stream for encoders and decoders.

Decoders and encoders will receive such a state through their respective set_format vmethods.

Decoders and encoders can set the downstream state, by using the GstVideo.VideoDecoder.prototype.set_output_state or GstVideo.VideoEncoder.prototype.set_output_state methods.

### Members

`info` (GstVideo.VideoInfo) –

The GstVideo.VideoInfo describing the stream

`caps` (Gst.Caps) –

The Gst.Caps used in the caps negotiation of the pad.

`codec_data` (Gst.Buffer) –

a Gst.Buffer corresponding to the 'codec_data' field of a stream, or NULL.

`allocation_caps` (Gst.Caps) –

The Gst.Caps for allocation query and pool negotiation. Since: 1.10

`mastering_display_info` (GstVideo.VideoMasteringDisplayInfo) –

Mastering display color volume information (HDR metadata) for the stream.

`content_light_level` (GstVideo.VideoContentLightLevel) –

Content light level information for the stream.

## GstVideo.VideoCodecState

Structure representing the state of an incoming or outgoing video stream for encoders and decoders.

Decoders and encoders will receive such a state through their respective set_format vmethods.

Decoders and encoders can set the downstream state, by using the GstVideo.VideoDecoder.set_output_state or GstVideo.VideoEncoder.set_output_state methods.

### Members

`info` (GstVideo.VideoInfo) –

The GstVideo.VideoInfo describing the stream

`caps` (Gst.Caps) –

The Gst.Caps used in the caps negotiation of the pad.

`codec_data` (Gst.Buffer) –

a Gst.Buffer corresponding to the 'codec_data' field of a stream, or NULL.

`allocation_caps` (Gst.Caps) –

The Gst.Caps for allocation query and pool negotiation. Since: 1.10

`mastering_display_info` (GstVideo.VideoMasteringDisplayInfo) –

Mastering display color volume information (HDR metadata) for the stream.

`content_light_level` (GstVideo.VideoContentLightLevel) –

Content light level information for the stream.

### Methods

#### gst_video_codec_state_ref

    GstVideoCodecState *
    gst_video_codec_state_ref (GstVideoCodecState * state)

Increases the refcount of the given state by one.

Parameters:

`state` –

a GstVideoCodecState

Returns –

buf

#### GstVideo.VideoCodecState.prototype.ref

    function GstVideo.VideoCodecState.prototype.ref(): {
        // javascript wrapper for 'gst_video_codec_state_ref'
    }

Increases the refcount of the given state by one.

Parameters:

`state` (GstVideo.VideoCodecState) –

a GstVideo.VideoCodecState

Returns (GstVideo.VideoCodecState) –

buf

#### GstVideo.VideoCodecState.ref

    def GstVideo.VideoCodecState.ref (self):
        #python wrapper for 'gst_video_codec_state_ref'

Increases the refcount of the given state by one.

Parameters:

`state` (GstVideo.VideoCodecState) –

a GstVideo.VideoCodecState

Returns (GstVideo.VideoCodecState) –

buf

#### gst_video_codec_state_unref

    gst_video_codec_state_unref (GstVideoCodecState * state)

Decreases the refcount of the state. If the refcount reaches 0, the state will be freed.

Parameters:

`state` –

a GstVideoCodecState

#### GstVideo.VideoCodecState.prototype.unref

    function GstVideo.VideoCodecState.prototype.unref(): {
        // javascript wrapper for 'gst_video_codec_state_unref'
    }

Decreases the refcount of the state. If the refcount reaches 0, the state will be freed.

Parameters:

`state` (GstVideo.VideoCodecState) –

a GstVideo.VideoCodecState

#### GstVideo.VideoCodecState.unref

    def GstVideo.VideoCodecState.unref (self):
        #python wrapper for 'gst_video_codec_state_unref'

Decreases the refcount of the state. If the refcount reaches 0, the state will be freed.

Parameters:

`state` (GstVideo.VideoCodecState) –

a GstVideo.VideoCodecState

## Function Macros

### GST_VIDEO_CODEC_FRAME_FLAGS

    #define GST_VIDEO_CODEC_FRAME_FLAGS(frame) ((frame)->flags)

The entire set of flags for the frame

Parameters:

`frame` –

a GstVideoCodecFrame

### GST_VIDEO_CODEC_FRAME_FLAG_IS_SET

    #define GST_VIDEO_CODEC_FRAME_FLAG_IS_SET(frame,flag)   !!(GST_VIDEO_CODEC_FRAME_FLAGS(frame) & (flag))

Checks whether the given flag is set

Parameters:

`frame` –

a GstVideoCodecFrame

`flag` –

a flag to check for

### GST_VIDEO_CODEC_FRAME_FLAG_SET

    #define GST_VIDEO_CODEC_FRAME_FLAG_SET(frame,flag)     (GST_VIDEO_CODEC_FRAME_FLAGS(frame) |= (flag))

This macro sets the given bits

Parameters:

`frame` –

a GstVideoCodecFrame

`flag` –

Flag to set, can be any number of bits in guint32.

### GST_VIDEO_CODEC_FRAME_FLAG_UNSET

    #define GST_VIDEO_CODEC_FRAME_FLAG_UNSET(frame,flag)   (GST_VIDEO_CODEC_FRAME_FLAGS(frame) &= ~(flag))

This macro usets the given bits.

Parameters:

`frame` –

a GstVideoCodecFrame

`flag` –

Flag to unset

### GST_VIDEO_CODEC_FRAME_IS_DECODE_ONLY

    #define GST_VIDEO_CODEC_FRAME_IS_DECODE_ONLY(frame)     (GST_VIDEO_CODEC_FRAME_FLAG_IS_SET(frame, GST_VIDEO_CODEC_FRAME_FLAG_DECODE_ONLY))

Tests if the buffer should only be decoded but not sent downstream.

Parameters:

`frame` –

a GstVideoCodecFrame

### GST_VIDEO_CODEC_FRAME_IS_FORCE_KEYFRAME

    #define GST_VIDEO_CODEC_FRAME_IS_FORCE_KEYFRAME(frame)      (GST_VIDEO_CODEC_FRAME_FLAG_IS_SET(frame, GST_VIDEO_CODEC_FRAME_FLAG_FORCE_KEYFRAME))

Tests if the frame must be encoded as a keyframe. Applies only to frames provided to encoders. Decoders can safely ignore this field.

Parameters:

`frame` –

a GstVideoCodecFrame

### GST_VIDEO_CODEC_FRAME_IS_FORCE_KEYFRAME_HEADERS

    #define GST_VIDEO_CODEC_FRAME_IS_FORCE_KEYFRAME_HEADERS(frame)      (GST_VIDEO_CODEC_FRAME_FLAG_IS_SET(frame, GST_VIDEO_CODEC_FRAME_FLAG_FORCE_KEYFRAME_HEADERS))

Tests if encoder should output stream headers before outputting the resulting encoded buffer for the given frame.

Applies only to frames provided to encoders. Decoders can safely ignore this field.

Parameters:

`frame` –

a GstVideoCodecFrame

### GST_VIDEO_CODEC_FRAME_IS_SYNC_POINT

    #define GST_VIDEO_CODEC_FRAME_IS_SYNC_POINT(frame)      (GST_VIDEO_CODEC_FRAME_FLAG_IS_SET(frame, GST_VIDEO_CODEC_FRAME_FLAG_SYNC_POINT))

Tests if the frame is a synchronization point (like a keyframe).

Decoder implementations can use this to detect keyframes.

Parameters:

`frame` –

a GstVideoCodecFrame

### GST_VIDEO_CODEC_FRAME_SET_DECODE_ONLY

    #define GST_VIDEO_CODEC_FRAME_SET_DECODE_ONLY(frame)    (GST_VIDEO_CODEC_FRAME_FLAG_SET(frame, GST_VIDEO_CODEC_FRAME_FLAG_DECODE_ONLY))

Sets the buffer to not be sent downstream.

Decoder implementation can use this if they have frames that are not meant to be displayed.

Encoder implementation can safely ignore this field.

Parameters:

`frame` –

a GstVideoCodecFrame

### GST_VIDEO_CODEC_FRAME_SET_FORCE_KEYFRAME

    #define GST_VIDEO_CODEC_FRAME_SET_FORCE_KEYFRAME(frame)     (GST_VIDEO_CODEC_FRAME_FLAG_SET(frame, GST_VIDEO_CODEC_FRAME_FLAG_FORCE_KEYFRAME))

### GST_VIDEO_CODEC_FRAME_SET_FORCE_KEYFRAME_HEADERS

    #define GST_VIDEO_CODEC_FRAME_SET_FORCE_KEYFRAME_HEADERS(frame)     (GST_VIDEO_CODEC_FRAME_FLAG_SET(frame, GST_VIDEO_CODEC_FRAME_FLAG_FORCE_KEYFRAME_HEADERS))

### GST_VIDEO_CODEC_FRAME_SET_SYNC_POINT

    #define GST_VIDEO_CODEC_FRAME_SET_SYNC_POINT(frame)     (GST_VIDEO_CODEC_FRAME_FLAG_SET(frame, GST_VIDEO_CODEC_FRAME_FLAG_SYNC_POINT))

Sets the frame to be a synchronization point (like a keyframe).

Encoder implementations should set this accordingly.

Decoder implementing parsing features should set this when they detect such a synchronization point.

Parameters:

`frame` –

a GstVideoCodecFrame

### GST_VIDEO_CODEC_FRAME_UNSET_FORCE_KEYFRAME

    #define GST_VIDEO_CODEC_FRAME_UNSET_FORCE_KEYFRAME(frame)   (GST_VIDEO_CODEC_FRAME_FLAG_UNSET(frame, GST_VIDEO_CODEC_FRAME_FLAG_FORCE_KEYFRAME))

### GST_VIDEO_CODEC_FRAME_UNSET_FORCE_KEYFRAME_HEADERS

    #define GST_VIDEO_CODEC_FRAME_UNSET_FORCE_KEYFRAME_HEADERS(frame)   (GST_VIDEO_CODEC_FRAME_FLAG_UNSET(frame, GST_VIDEO_CODEC_FRAME_FLAG_FORCE_KEYFRAME_HEADERS))

### GST_VIDEO_CODEC_FRAME_UNSET_SYNC_POINT

    #define GST_VIDEO_CODEC_FRAME_UNSET_SYNC_POINT(frame)   (GST_VIDEO_CODEC_FRAME_FLAG_UNSET(frame, GST_VIDEO_CODEC_FRAME_FLAG_SYNC_POINT))

## Enumerations

### GstVideoCodecFrameFlags

Flags for GstVideoCodecFrame

##### Members

`GST_VIDEO_CODEC_FRAME_FLAG_DECODE_ONLY` (1) –

is the frame only meant to be decoded

`GST_VIDEO_CODEC_FRAME_FLAG_SYNC_POINT` (2) –

is the frame a synchronization point (keyframe)

`GST_VIDEO_CODEC_FRAME_FLAG_FORCE_KEYFRAME` (4) –

should the output frame be made a keyframe

`GST_VIDEO_CODEC_FRAME_FLAG_FORCE_KEYFRAME_HEADERS` (8) –

should the encoder output stream headers

`GST_VIDEO_CODEC_FRAME_FLAG_CORRUPTED` (16) –

The buffer data is corrupted.

(Since: 1.20)

### GstVideo.VideoCodecFrameFlags

Flags for GstVideo.VideoCodecFrame

##### Members

`GstVideo.VideoCodecFrameFlags.DECODE_ONLY` (1) –

is the frame only meant to be decoded

`GstVideo.VideoCodecFrameFlags.SYNC_POINT` (2) –

is the frame a synchronization point (keyframe)

`GstVideo.VideoCodecFrameFlags.FORCE_KEYFRAME` (4) –

should the output frame be made a keyframe

`GstVideo.VideoCodecFrameFlags.FORCE_KEYFRAME_HEADERS` (8) –

should the encoder output stream headers

`GstVideo.VideoCodecFrameFlags.CORRUPTED` (16) –

The buffer data is corrupted.

(Since: 1.20)

### GstVideo.VideoCodecFrameFlags

Flags for GstVideo.VideoCodecFrame

##### Members

`GstVideo.VideoCodecFrameFlags.DECODE_ONLY` (1) –

is the frame only meant to be decoded

`GstVideo.VideoCodecFrameFlags.SYNC_POINT` (2) –

is the frame a synchronization point (keyframe)

`GstVideo.VideoCodecFrameFlags.FORCE_KEYFRAME` (4) –

should the output frame be made a keyframe

`GstVideo.VideoCodecFrameFlags.FORCE_KEYFRAME_HEADERS` (8) –

should the encoder output stream headers

`GstVideo.VideoCodecFrameFlags.CORRUPTED` (16) –

The buffer data is corrupted.

(Since: 1.20)

## Constants

### GST_TYPE_VIDEO_CODEC_FRAME

    #define GST_TYPE_VIDEO_CODEC_FRAME \
      (gst_video_codec_frame_get_type())

### GST_TYPE_VIDEO_CODEC_STATE

    #define GST_TYPE_VIDEO_CODEC_STATE \
      (gst_video_codec_state_get_type())

The results of the search are