GStreamer Video Analytics (GVA) Plugin
Public Member Functions | Protected Attributes | List of all members
GVA::AudioFrame Class Reference

This class represents audio frame - object for working with AudioEvent and Tensor objects which belong to this audio frame . AudioEvent describes detected object (segments) and its Tensor objects (inference results on AudioEvent level). Tensor describes inference results on AudioFrame level. AudioFrame also provides access to underlying GstBuffer and GstAudioInfo describing frame's audio information (such as format, channels, etc.). More...

#include <audio_frame.h>

Public Member Functions

 AudioFrame (GstBuffer *buffer, GstAudioInfo *info)
 Construct AudioFrame instance from GstBuffer and GstAudioInfo. This is preferred way of creating AudioFrame. More...
 
 AudioFrame (GstBuffer *buffer, const GstCaps *caps)
 Construct AudioFrame instance from GstBuffer and GstCaps. More...
 
 AudioFrame (GstBuffer *buffer)
 Construct AudioFrame instance from GstBuffer. Audio information will be obtained from buffer. This is not recommended way of creating AudioFrame, because it relies on GstAudioMeta which can be absent for the buffer. More...
 
GstAudioMeta * audio_meta ()
 Get audio metadata of buffer. More...
 
GstAudioInfo * audio_info ()
 Get GstAudioInfo of this AudioFrame. This is preferrable way of getting audio information. More...
 
std::vector< AudioEventevents ()
 Get AudioEvent objects attached to AudioFrame. More...
 
const std::vector< AudioEventevents () const
 Get AudioEvent objects attached to AudioFrame. More...
 
std::vector< Tensortensors ()
 Get Tensor objects attached to AudioFrame. More...
 
const std::vector< Tensortensors () const
 Get Tensor objects attached to AudioFrame. More...
 
std::vector< std::string > messages ()
 Get messages attached to this AudioFrame. More...
 
AudioEvent add_event (long start_time, long end_time, std::string label=std::string(), double confidence=0.0)
 Attach AudioEvent to this AudioFrame. This function takes ownership of event_tensor, if passed @start_time: start time stamp of the segment @end_time: end time stamp of the segment. More...
 
Tensor add_tensor ()
 Attach empty Tensor to this AudioFrame. More...
 
void add_message (const std::string &message)
 Attach message to this AudioFrame. More...
 
void remove_event (const AudioEvent &event)
 Remove AudioEvent. More...
 
void remove_tensor (const Tensor &tensor)
 Remove Tensor. More...
 

Protected Attributes

GstBuffer * buffer
 GstBuffer with inference results metadata attached (Gstreamer pipeline's GstBuffer, which is output of GVA inference elements, such as gvaaudiodetect)
 
std::unique_ptr< GstAudioInfo, std::function< void(GstAudioInfo *)> > info
 GstAudioInfo containing actual audio information for this AudioFrame.
 

Detailed Description

This class represents audio frame - object for working with AudioEvent and Tensor objects which belong to this audio frame . AudioEvent describes detected object (segments) and its Tensor objects (inference results on AudioEvent level). Tensor describes inference results on AudioFrame level. AudioFrame also provides access to underlying GstBuffer and GstAudioInfo describing frame's audio information (such as format, channels, etc.).

Constructor & Destructor Documentation

◆ AudioFrame() [1/3]

GVA::AudioFrame::AudioFrame ( GstBuffer *  buffer,
GstAudioInfo *  info 
)
inline

Construct AudioFrame instance from GstBuffer and GstAudioInfo. This is preferred way of creating AudioFrame.

Parameters
bufferGstBuffer* to which metadata is attached and retrieved
infoGstAudioInfo* containing audio information

◆ AudioFrame() [2/3]

GVA::AudioFrame::AudioFrame ( GstBuffer *  buffer,
const GstCaps *  caps 
)
inline

Construct AudioFrame instance from GstBuffer and GstCaps.

Parameters
bufferGstBuffer* to which metadata is attached and retrieved
capsGstCaps* from which audio information is obtained

◆ AudioFrame() [3/3]

GVA::AudioFrame::AudioFrame ( GstBuffer *  buffer)
inline

Construct AudioFrame instance from GstBuffer. Audio information will be obtained from buffer. This is not recommended way of creating AudioFrame, because it relies on GstAudioMeta which can be absent for the buffer.

Parameters
bufferGstBuffer* to which metadata is attached and retrieved

Member Function Documentation

◆ add_event()

AudioEvent GVA::AudioFrame::add_event ( long  start_time,
long  end_time,
std::string  label = std::string(),
double  confidence = 0.0 
)
inline

Attach AudioEvent to this AudioFrame. This function takes ownership of event_tensor, if passed @start_time: start time stamp of the segment @end_time: end time stamp of the segment.

Parameters
labelobject label
confidencedetection confidence
Returns
new AudioEvent instance

◆ add_message()

void GVA::AudioFrame::add_message ( const std::string &  message)
inline

Attach message to this AudioFrame.

Parameters
messagemessage to attach to this AudioFrame

◆ add_tensor()

Tensor GVA::AudioFrame::add_tensor ( )
inline

Attach empty Tensor to this AudioFrame.

Returns
new Tensor instance

◆ audio_info()

GstAudioInfo* GVA::AudioFrame::audio_info ( )
inline

Get GstAudioInfo of this AudioFrame. This is preferrable way of getting audio information.

Returns
GstAudioInfo of this AudioFrame

◆ audio_meta()

GstAudioMeta* GVA::AudioFrame::audio_meta ( )
inline

Get audio metadata of buffer.

Returns
GstAudioMeta of buffer, nullptr if no GstAudioMeta available

◆ events() [1/2]

std::vector<AudioEvent> GVA::AudioFrame::events ( )
inline

Get AudioEvent objects attached to AudioFrame.

Returns
vector of AudioEvent objects attached to AudioFrame

◆ events() [2/2]

const std::vector<AudioEvent> GVA::AudioFrame::events ( ) const
inline

Get AudioEvent objects attached to AudioFrame.

Returns
vector of AudioEvent objects attached to AudioFrame

◆ messages()

std::vector<std::string> GVA::AudioFrame::messages ( )
inline

Get messages attached to this AudioFrame.

Returns
messages attached to this AudioFrame

◆ remove_event()

void GVA::AudioFrame::remove_event ( const AudioEvent event)
inline

Remove AudioEvent.

Parameters
eventthe AudioEvent to remove

◆ remove_tensor()

void GVA::AudioFrame::remove_tensor ( const Tensor tensor)
inline

Remove Tensor.

Parameters
tensorthe Tensor to remove

◆ tensors() [1/2]

std::vector<Tensor> GVA::AudioFrame::tensors ( )
inline

Get Tensor objects attached to AudioFrame.

Returns
vector of Tensor objects attached to AudioFrame

◆ tensors() [2/2]

const std::vector<Tensor> GVA::AudioFrame::tensors ( ) const
inline

Get Tensor objects attached to AudioFrame.

Returns
vector of Tensor objects attached to AudioFrame

The documentation for this class was generated from the following file: