:right-sidebar: True Sample =================================================================== .. currentmodule:: gi.repository.Gst .. class:: Sample(**kwargs) :no-contents-entry: A :obj:`~gi.repository.Gst.Sample` is a small object containing data, a type, timing and extra arbitrary information. Constructors ------------ .. rst-class:: interim-class .. class:: Sample :no-index: .. classmethod:: new(buffer: ~gi.repository.Gst.Buffer | None = None, caps: ~gi.repository.Gst.Caps | None = None, segment: ~gi.repository.Gst.Segment | None = None, info: ~gi.repository.Gst.Structure | None = None) -> ~gi.repository.Gst.Sample Create a new :obj:`~gi.repository.Gst.Sample` with the provided details. Free-function: gst_sample_unref :param buffer: a :obj:`~gi.repository.Gst.Buffer`\, or :const:`None` :param caps: a :obj:`~gi.repository.Gst.Caps`\, or :const:`None` :param segment: a :obj:`~gi.repository.Gst.Segment`\, or :const:`None` :param info: a :obj:`~gi.repository.Gst.Structure`\, or :const:`None` Methods ------- .. rst-class:: interim-class .. class:: Sample :no-index: .. method:: get_buffer() -> ~gi.repository.Gst.Buffer | None Get the buffer associated with ``sample`` .. method:: get_buffer_list() -> ~gi.repository.Gst.BufferList | None Get the buffer list associated with ``sample`` .. versionadded:: 1.6 .. method:: get_caps() -> ~gi.repository.Gst.Caps | None Get the caps associated with ``sample`` .. method:: get_info() -> ~gi.repository.Gst.Structure | None Get extra information associated with ``sample``\. .. method:: get_segment() -> ~gi.repository.Gst.Segment Get the segment associated with ``sample`` .. method:: is_writable() -> bool Tests if you can safely set the buffer and / or buffer list of ``sample``\. .. versionadded:: 1.16 .. method:: make_writable() -> ~gi.repository.Gst.Sample Returns a writable copy of ``sample``\. 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 :func:`~gi.repository.Gst.Sample.set_buffer` If the reference count of the source sample ``sample`` 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 :func:`~gi.repository.Gst.Sample.copy`. The passed-in ``sample`` 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. .. versionadded:: 1.16 .. method:: set_buffer(buffer: ~gi.repository.Gst.Buffer) -> None Set the buffer associated with ``sample``\. ``sample`` must be writable. .. versionadded:: 1.16 :param buffer: A :obj:`~gi.repository.Gst.Buffer` .. method:: set_buffer_list(buffer_list: ~gi.repository.Gst.BufferList) -> None Set the buffer list associated with ``sample``\. ``sample`` must be writable. .. versionadded:: 1.6 :param buffer_list: a :obj:`~gi.repository.Gst.BufferList` .. method:: set_caps(caps: ~gi.repository.Gst.Caps) -> None Set the caps associated with ``sample``\. ``sample`` must be writable. .. versionadded:: 1.16 :param caps: A :obj:`~gi.repository.Gst.Caps` .. method:: set_info(info: ~gi.repository.Gst.Structure) -> bool Set the info structure associated with ``sample``\. ``sample`` must be writable, and ``info`` must not have a parent set already. .. versionadded:: 1.16 :param info: A :obj:`~gi.repository.Gst.Structure` .. method:: set_segment(segment: ~gi.repository.Gst.Segment) -> None Set the segment associated with ``sample``\. ``sample`` must be writable. .. versionadded:: 1.16 :param segment: A :obj:`~gi.repository.Gst.Segment`