Gst.Sample

Fields

None

Methods

class

new (buffer, caps, segment, info)

get_buffer ()

get_buffer_list ()

get_caps ()

get_info ()

get_segment ()

is_writable ()

make_writable ()

set_buffer (buffer)

set_buffer_list (buffer_list)

set_caps (caps)

set_info (info)

set_segment (segment)

Details

class Gst.Sample

A Gst.Sample is a small object containing data, a type, timing and extra arbitrary information.

classmethod new(buffer, caps, segment, info)[source]
Parameters:
Returns:

the new Gst.Sample. gst_sample_unref() after usage.

Return type:

Gst.Sample

Create a new Gst.Sample with the provided details.

Free-function: gst_sample_unref

get_buffer()[source]
Returns:

the buffer of self or None when there is no buffer. The buffer remains valid as long as self is valid. If you need to hold on to it for longer than that, take a ref to the buffer with gst_buffer_ref().

Return type:

Gst.Buffer or None

Get the buffer associated with self

get_buffer_list()[source]
Returns:

the buffer list of self or None when there is no buffer list. The buffer list remains valid as long as self is valid. If you need to hold on to it for longer than that, take a ref to the buffer list with gst_mini_object_ref ().

Return type:

Gst.BufferList or None

Get the buffer list associated with self

New in version 1.6.

get_caps()[source]
Returns:

the caps of self or None when there is no caps. The caps remain valid as long as self is valid. If you need to hold on to the caps for longer than that, take a ref to the caps with gst_caps_ref().

Return type:

Gst.Caps or None

Get the caps associated with self

get_info()[source]
Returns:

the extra info of self. The info remains valid as long as self is valid.

Return type:

Gst.Structure or None

Get extra information associated with self.

get_segment()[source]
Returns:

the segment of self. The segment remains valid as long as self is valid.

Return type:

Gst.Segment

Get the segment associated with self

is_writable()[source]
Return type:

bool

Tests if you can safely set the buffer and / or buffer list of self.

New in version 1.16.

make_writable()[source]
Returns:

a writable sample which may or may not be the same as self

Return type:

Gst.Sample

Returns a writable copy of self. If the source sample is already writable, this will simply return the same sample.

Use this function to ensure that a sample can be safely modified before making changes to it, for example before calling Gst.Sample.set_buffer()

If the reference count of the source sample self is exactly one, the caller is the sole owner and this function will return the sample object unchanged.

If there is more than one reference on the object, a copy will be made using gst_sample_copy(). The passed-in self will be unreffed in that case, and the caller will now own a reference to the new returned sample object.

In short, this function unrefs the sample in the argument and refs the sample that it returns. Don’t access the argument after calling this function unless you have an additional reference to it.

New in version 1.16.

set_buffer(buffer)[source]
Parameters:

buffer (Gst.Buffer) – A Gst.Buffer

Set the buffer associated with self. self must be writable.

New in version 1.16.

set_buffer_list(buffer_list)[source]
Parameters:

buffer_list (Gst.BufferList) – a Gst.BufferList

Set the buffer list associated with self. self must be writable.

New in version 1.6.

set_caps(caps)[source]
Parameters:

caps (Gst.Caps) – A Gst.Caps

Set the caps associated with self. self must be writable.

New in version 1.16.

set_info(info)[source]
Parameters:

info (Gst.Structure) – A Gst.Structure

Return type:

bool

Set the info structure associated with self. self must be writable, and info must not have a parent set already.

New in version 1.16.

set_segment(segment)[source]
Parameters:

segment (Gst.Segment) – A Gst.Segment

Set the segment associated with self. self must be writable.

New in version 1.16.