GstBadAudio.PlanarAudioAdapter

g GObject.Object GObject.Object GstBadAudio.PlanarAudioAdapter GstBadAudio.PlanarAudioAdapter GObject.Object->GstBadAudio.PlanarAudioAdapter

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new ()

available ()

clear ()

configure (info)

distance_from_discont ()

dts_at_discont ()

flush (to_flush)

get_buffer (nsamples, flags)

offset_at_discont ()

prev_dts ()

prev_offset ()

prev_pts ()

pts_at_discont ()

push (buf)

take_buffer (nsamples, flags)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

None

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Class Details

class GstBadAudio.PlanarAudioAdapter(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

GstBadAudio.PlanarAudioAdapterClass

This class is similar to GstBase.Adapter, but it is made to work with non-interleaved (planar) audio buffers. Before using, an audio format must be configured with GstBadAudio.PlanarAudioAdapter.configure()

classmethod new()
Returns:

a new GstBadAudio.PlanarAudioAdapter

Return type:

GstBadAudio.PlanarAudioAdapter

Creates a new GstBadAudio.PlanarAudioAdapter. Free with GObject.Object.unref().

available()
Returns:

number of samples available in self

Return type:

int

Gets the maximum amount of samples available, that is it returns the maximum value that can be supplied to GstBadAudio.PlanarAudioAdapter.get_buffer() without that function returning None.

clear()

Removes all buffers from self.

configure(info)
Parameters:

info (GstAudio.AudioInfo) – a GstAudio.AudioInfo describing the format of the audio data

Sets up the self to handle audio data of the specified audio format. Note that this will internally clear the adapter and re-initialize it.

distance_from_discont()
Return type:

int

dts_at_discont()
Returns:

The DTS at the last discont or Gst.CLOCK_TIME_NONE.

Return type:

int

Get the DTS that was on the last buffer with the Gst.BufferFlags.DISCONT flag, or Gst.CLOCK_TIME_NONE.

flush(to_flush)
Parameters:

to_flush (int) – the number of samples to flush

Flushes the first to_flush samples in the self. The caller must ensure that at least this many samples are available.

get_buffer(nsamples, flags)
Parameters:
  • nsamples (int) – the number of samples to get

  • flags (Gst.MapFlags) – hint the intended use of the returned buffer

Returns:

a Gst.Buffer containing the first nsamples of the adapter, or None if nsamples samples are not available. gst_buffer_unref() when no longer needed.

Return type:

Gst.Buffer or None

Returns a Gst.Buffer containing the first nsamples of the self, but does not flush them from the adapter. Use GstBadAudio.PlanarAudioAdapter.take_buffer() for flushing at the same time.

The map flags can be used to give an optimization hint to this function. When the requested buffer is meant to be mapped only for reading, it might be possible to avoid copying memory in some cases.

Caller owns a reference to the returned buffer. gst_buffer_unref() after usage.

Free-function: gst_buffer_unref

offset_at_discont()
Returns:

The offset at the last discont or Gst.BUFFER_OFFSET_NONE.

Return type:

int

Get the offset that was on the last buffer with the Gst.BufferFlags.DISCONT flag, or Gst.BUFFER_OFFSET_NONE.

prev_dts()
Returns:

The previously seen dts.

distance:

pointer to location for distance, or None

Return type:

(int, distance: int)

Get the dts that was before the current sample in the adapter. When distance is given, the amount of bytes between the dts and the current position is returned.

The dts is reset to Gst.CLOCK_TIME_NONE and the distance is set to 0 when the adapter is first created or when it is cleared. This also means that before the first sample with a dts is removed from the adapter, the dts and distance returned are Gst.CLOCK_TIME_NONE and 0 respectively.

prev_offset()
Returns:

The previous seen offset.

distance:

pointer to a location for distance, or None

Return type:

(int, distance: int)

Get the offset that was before the current sample in the adapter. When distance is given, the amount of samples between the offset and the current position is returned.

The offset is reset to Gst.BUFFER_OFFSET_NONE and the distance is set to 0 when the adapter is first created or when it is cleared. This also means that before the first sample with an offset is removed from the adapter, the offset and distance returned are Gst.BUFFER_OFFSET_NONE and 0 respectively.

prev_pts()
Returns:

The previously seen pts.

distance:

pointer to location for distance, or None

Return type:

(int, distance: int)

Get the pts that was before the current sample in the adapter. When distance is given, the amount of samples between the pts and the current position is returned.

The pts is reset to Gst.CLOCK_TIME_NONE and the distance is set to 0 when the adapter is first created or when it is cleared. This also means that before the first sample with a pts is removed from the adapter, the pts and distance returned are Gst.CLOCK_TIME_NONE and 0 respectively.

pts_at_discont()
Returns:

The PTS at the last discont or Gst.CLOCK_TIME_NONE.

Return type:

int

Get the PTS that was on the last buffer with the Gst.BufferFlags.DISCONT flag, or Gst.CLOCK_TIME_NONE.

push(buf)
Parameters:

buf (Gst.Buffer) – a Gst.Buffer to queue in the adapter

Adds the data from buf to the data stored inside self and takes ownership of the buffer.

take_buffer(nsamples, flags)
Parameters:
  • nsamples (int) – the number of samples to take

  • flags (Gst.MapFlags) – hint the intended use of the returned buffer

Returns:

a Gst.Buffer containing the first nsamples of the adapter, or None if nsamples samples are not available. gst_buffer_unref() when no longer needed.

Return type:

Gst.Buffer or None

Returns a Gst.Buffer containing the first nsamples bytes of the self. The returned bytes will be flushed from the adapter.

See GstBadAudio.PlanarAudioAdapter.get_buffer() for more details.

Caller owns a reference to the returned buffer. gst_buffer_unref() after usage.

Free-function: gst_buffer_unref