![]() |
![]() |
![]() |
gstlal Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Properties |
#include <gstlal/gstaudioadapter.h> #define GST_AUDIODAPATER_GET_CLASS (obj) struct GstAudioAdapter; struct GstAudioAdapterClass; gboolean gst_audioadapter_is_empty (GstAudioAdapter *adapter
); GstClockTime gst_audioadapter_expected_timestamp (GstAudioAdapter *adapter
); guint64 gst_audioadapter_expected_offset (GstAudioAdapter *adapter
); void gst_audioadapter_clear (GstAudioAdapter *adapter
); void gst_audioadapter_push (GstAudioAdapter *adapter
,GstBuffer *buf
); gboolean gst_audioadapter_is_gap (GstAudioAdapter *adapter
); guint gst_audioadapter_head_gap_length (GstAudioAdapter *adapter
); guint gst_audioadapter_tail_gap_length (GstAudioAdapter *adapter
); guint gst_audioadapter_head_nongap_length (GstAudioAdapter *adapter
); guint gst_audioadapter_tail_nongap_length (GstAudioAdapter *adapter
); void gst_audioadapter_copy_samples (GstAudioAdapter *adapter
,void *dst
,guint samples
,gboolean *copied_gap
,gboolean *copied_nongap
); GList * gst_audioadapter_get_list_samples (GstAudioAdapter *adapter
,guint samples
); void gst_audioadapter_flush_samples (GstAudioAdapter *adapter
,guint samples
);
GstAudioAdapter provides a queue to accumulate time series data and facilitate its ingestion by code that requires or prefers to process data in blocks of some size. GStreamer provides GstAdapter, which is a similar class but is not specifically tailored to time series data.
After a GstAudioAdapter is created, and one or more GstBuffer objects
inserted into it with gst_audioadapter_push()
, its size (in samples) can
be checked by checking the "size" property, buffers
retrieved with gst_audioadapter_get_list_samples()
, and then data
flushed from it with gst_audioadapter_flush_samples()
.
gboolean gst_audioadapter_is_empty (GstAudioAdapter *adapter
);
TRUE
if the GstAudioAdapter is empty, FALSE
otherwise.
|
a GstAudioAdapter |
Returns : |
gboolean |
GstClockTime gst_audioadapter_expected_timestamp (GstAudioAdapter *adapter
);
If the GstAudioAdapter is not empty, returns the GstClockTime of the next buffer that should be pushed into the adapter if the next buffer is to be contiguous with the data in the GstAudioAdapter. Returns GST_CLOCK_TIME_NONE if the GstAudioAdapter is empty.
See also: gst_audioadapter_expected_offset()
|
a GstAudioAdapter |
Returns : |
GstClockTime |
guint64 gst_audioadapter_expected_offset (GstAudioAdapter *adapter
);
If the GstAudioAdapter is not empty, returns the offset of the next GstBuffer that should be pushed into the adapter if the next GstBuffer is to be contiguous with the data in the GstAudioAdapter. Returns GST_BUFFER_OFFSET_NONE if the GstAudioAdapter is empty.
See also: gst_audioadapter_expected_timestamp()
|
a GstAudioAdapter |
Returns : |
guint64 |
void gst_audioadapter_clear (GstAudioAdapter *adapter
);
Empty the GstAudioAdapter. All buffers are unref'ed and the "size" is set to 0.
|
a GstAudioAdapter |
void gst_audioadapter_push (GstAudioAdapter *adapter
,GstBuffer *buf
);
The GstBuffer is pushed into the GstAudioAdapter's tail and the
"size" is updated. The GstAudioAdapter takes ownership
of the GstBuffer. If the calling code wishes to continue to access the
GstBuffer's contents it must gst_buffer_ref()
it before calling this
function. The GstBuffer's timestamp, duration, offset and offset end
must all be valid.
|
a GstAudioAdapter |
|
the GstBuffer to push into (append to) the GstAudioAdapter |
gboolean gst_audioadapter_is_gap (GstAudioAdapter *adapter
);
TRUE
if all GstBuffers in the adapter are gaps or are zero length.
FALSE
if the GstAudioAdapter contains a non-zero length of non-gap
GstBuffers.
|
a GstAudioAdapter |
Returns : |
gboolean |
guint gst_audioadapter_head_gap_length (GstAudioAdapter *adapter
);
Return the number of contiguous gap samples at the head (samples to be pulled out first) of the GstAudioAdapter.
|
a GstAudioAdapter |
Returns : |
guint |
guint gst_audioadapter_tail_gap_length (GstAudioAdapter *adapter
);
Return the number of contiguous gap samples at the tail (samples to be pulled out last) of the GstAudioAdapter.
|
a GstAudioAdapter |
Returns : |
guint |
guint gst_audioadapter_head_nongap_length (GstAudioAdapter *adapter
);
Return the number of contiguous non-gap samples at the head (samples to be pulled out first) of the GstAudioAdapter.
|
a GstAudioAdapter |
Returns : |
guint |
guint gst_audioadapter_tail_nongap_length (GstAudioAdapter *adapter
);
Return the number of contiguous non-gap samples at the tail (samples to be pulled out last) of the GstAudioAdapter.
|
a GstAudioAdapter |
Returns : |
guint |
void gst_audioadapter_copy_samples (GstAudioAdapter *adapter
,void *dst
,guint samples
,gboolean *copied_gap
,gboolean *copied_nongap
);
Copies samples
from the GstAudioAdapter's head to a contiguous region
of memory. Samples taken from GstBuffers that have their
GST_BUFFER_FLAG_GAP
set to TRUE
are set to 0 in the target buffer.
|
a GstAudioAdapter |
|
start of the memory region to which to copy the samples, it must be large enough to accomodate them |
|
the number of samples to copy |
|
if not NULL , the address of a gboolean that will be set to
TRUE if any gap samples were among the samples copied or FALSE
if all samples were not gap samples. |
|
if not NULL , the address of a gboolean that will be set
to TRUE if any non-gap samples were among the samples copied or FALSE
if all samples were gaps. |
GList * gst_audioadapter_get_list_samples (GstAudioAdapter *adapter
,guint samples
);
Construct and return a GList of GstBuffer objects containing the first
samples
from GstAudioAdapter's head. The list contains references to
the GstBuffer objects in the GstAudioAdapter (or sub-buffers thereof
depending on how the number of samples requested aligns with GstBuffer
boundaries).
All metadata from the original GstBuffer objects is preserved, including GstCaps, the GstBufferFlags, etc..
|
a GstAudioAdapter |
|
the number of samples to copy |
Returns : |
GList of GstBuffers. Calling code owns a reference to each
GstBuffer in the list; call gst_buffer_unref() on each when done. |
void gst_audioadapter_flush_samples (GstAudioAdapter *adapter
,guint samples
);
Flush samples
from the head of the GstAudioAdapter, and update the
"size".
|
a GstAudioAdapter |
|
the number of samples to flush |