.. index:: pair: class; GVA::AudioFrame .. _doxid-class_g_v_a_1_1_audio_frame: class GVA::AudioFrame ===================== .. toctree:: :hidden: Overview ~~~~~~~~ This class represents audio frame - object for working with :ref:`AudioEvent ` and :ref:`Tensor ` objects which belong to this audio frame . :ref:`AudioEvent ` describes detected object (segments) and its :ref:`Tensor ` objects (inference results on :ref:`AudioEvent ` level). :ref:`Tensor ` describes inference results on :ref:`AudioFrame ` level. :ref:`AudioFrame ` also provides access to underlying GstBuffer and GstAudioInfo describing frame's audio information (such as format, channels, etc.). :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include class AudioFrame { public: // construction :ref:`AudioFrame`(GstBuffer* buffer, GstAudioInfo* info); :ref:`AudioFrame`(GstBuffer* buffer, const GstCaps* caps); :ref:`AudioFrame`(GstBuffer* buffer); // methods GstAudioMeta* :ref:`audio_meta`(); GstAudioInfo* :ref:`audio_info`(); std::vector<:ref:`AudioEvent`> :ref:`events`(); const std::vector<:ref:`AudioEvent`> :ref:`events`() const; std::vector<:ref:`Tensor`> :ref:`tensors`(); const std::vector<:ref:`Tensor`> :ref:`tensors`() const; std::vector :ref:`messages`(); :ref:`AudioEvent` :ref:`add_event`( long start_time, long end_time, std::string label = std::string(), double confidence = 0.0 ); :ref:`Tensor` :ref:`add_tensor`(); void :ref:`add_message`(const std::string& message); void :ref:`remove_event`(const :ref:`AudioEvent`& event); void :ref:`remove_tensor`(const :ref:`Tensor`& tensor); }; .. _details-class_g_v_a_1_1_audio_frame: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ This class represents audio frame - object for working with :ref:`AudioEvent ` and :ref:`Tensor ` objects which belong to this audio frame . :ref:`AudioEvent ` describes detected object (segments) and its :ref:`Tensor ` objects (inference results on :ref:`AudioEvent ` level). :ref:`Tensor ` describes inference results on :ref:`AudioFrame ` level. :ref:`AudioFrame ` also provides access to underlying GstBuffer and GstAudioInfo describing frame's audio information (such as format, channels, etc.). Construction ------------ .. index:: pair: function; AudioFrame .. _doxid-class_g_v_a_1_1_audio_frame_1a7b8bc05023783e62cf640486a55f816f: .. ref-code-block:: cpp :class: doxyrest-title-code-block AudioFrame(GstBuffer* buffer, GstAudioInfo* info) Construct :ref:`AudioFrame ` instance from GstBuffer and GstAudioInfo. This is preferred way of creating :ref:`AudioFrame `. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - buffer - GstBuffer* to which metadata is attached and retrieved * - info - GstAudioInfo* containing audio information .. index:: pair: function; AudioFrame .. _doxid-class_g_v_a_1_1_audio_frame_1aa6cf5ebb87d3919bb4120add9f72e7ec: .. ref-code-block:: cpp :class: doxyrest-title-code-block AudioFrame(GstBuffer* buffer, const GstCaps* caps) Construct :ref:`AudioFrame ` instance from GstBuffer and GstCaps. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - buffer - GstBuffer* to which metadata is attached and retrieved * - caps - GstCaps* from which audio information is obtained .. index:: pair: function; AudioFrame .. _doxid-class_g_v_a_1_1_audio_frame_1a2ab8ecdcf4e5a14169af7cc212b4e498: .. ref-code-block:: cpp :class: doxyrest-title-code-block AudioFrame(GstBuffer* buffer) Construct :ref:`AudioFrame ` instance from GstBuffer. Audio information will be obtained from buffer. This is not recommended way of creating :ref:`AudioFrame `, because it relies on GstAudioMeta which can be absent for the buffer. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - buffer - GstBuffer* to which metadata is attached and retrieved Methods ------- .. index:: pair: function; audio_meta .. _doxid-class_g_v_a_1_1_audio_frame_1afb8e875e122bebe45c4109080390c822: .. ref-code-block:: cpp :class: doxyrest-title-code-block GstAudioMeta* audio_meta() Get audio metadata of buffer. .. rubric:: Returns: GstAudioMeta of buffer, nullptr if no GstAudioMeta available .. index:: pair: function; audio_info .. _doxid-class_g_v_a_1_1_audio_frame_1aaf43c4e3c8ab1aa3e395757a7941bce0: .. ref-code-block:: cpp :class: doxyrest-title-code-block GstAudioInfo* audio_info() Get GstAudioInfo of this :ref:`AudioFrame `. This is preferrable way of getting audio information. .. rubric:: Returns: GstAudioInfo of this :ref:`AudioFrame ` .. index:: pair: function; events .. _doxid-class_g_v_a_1_1_audio_frame_1a056c170570e72444c4d845fda3a57830: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::vector<:ref:`AudioEvent`> events() Get :ref:`AudioEvent ` objects attached to :ref:`AudioFrame `. .. rubric:: Returns: vector of :ref:`AudioEvent ` objects attached to :ref:`AudioFrame ` .. index:: pair: function; events .. _doxid-class_g_v_a_1_1_audio_frame_1a82e5eeb3901441dab9f8efe5aa970acc: .. ref-code-block:: cpp :class: doxyrest-title-code-block const std::vector<:ref:`AudioEvent`> events() const Get :ref:`AudioEvent ` objects attached to :ref:`AudioFrame `. .. rubric:: Returns: vector of :ref:`AudioEvent ` objects attached to :ref:`AudioFrame ` .. index:: pair: function; tensors .. _doxid-class_g_v_a_1_1_audio_frame_1a8697986008fda3eed381fda6005ed3bb: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::vector<:ref:`Tensor`> tensors() Get :ref:`Tensor ` objects attached to :ref:`AudioFrame `. .. rubric:: Returns: vector of :ref:`Tensor ` objects attached to :ref:`AudioFrame ` .. index:: pair: function; tensors .. _doxid-class_g_v_a_1_1_audio_frame_1a94bbf4039396346b017de7d869b60714: .. ref-code-block:: cpp :class: doxyrest-title-code-block const std::vector<:ref:`Tensor`> tensors() const Get :ref:`Tensor ` objects attached to :ref:`AudioFrame `. .. rubric:: Returns: vector of :ref:`Tensor ` objects attached to :ref:`AudioFrame ` .. index:: pair: function; messages .. _doxid-class_g_v_a_1_1_audio_frame_1a736df4f005ba9e7e803fa8e22660aa35: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::vector messages() Get messages attached to this :ref:`AudioFrame `. .. rubric:: Returns: messages attached to this :ref:`AudioFrame ` .. index:: pair: function; add_event .. _doxid-class_g_v_a_1_1_audio_frame_1a20db0d03b167751a4b148151904de3d3: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`AudioEvent` add_event( long start_time, long end_time, std::string label = std::string(), double confidence = 0.0 ) Attach :ref:`AudioEvent ` to this :ref:`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. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - label - object label * - confidence - detection confidence .. rubric:: Returns: new :ref:`AudioEvent ` instance .. index:: pair: function; add_tensor .. _doxid-class_g_v_a_1_1_audio_frame_1a841fc1b3078aaed9cb90058c8ed98bdc: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`Tensor` add_tensor() Attach empty :ref:`Tensor ` to this :ref:`AudioFrame `. .. rubric:: Returns: new :ref:`Tensor ` instance .. index:: pair: function; add_message .. _doxid-class_g_v_a_1_1_audio_frame_1a9c76ec652e45683a8a9cd78dd36bb7eb: .. ref-code-block:: cpp :class: doxyrest-title-code-block void add_message(const std::string& message) Attach message to this :ref:`AudioFrame `. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - message - message to attach to this :ref:`AudioFrame ` .. index:: pair: function; remove_event .. _doxid-class_g_v_a_1_1_audio_frame_1ae90638b83ffa426c593835cac6259a55: .. ref-code-block:: cpp :class: doxyrest-title-code-block void remove_event(const :ref:`AudioEvent`& event) Remove :ref:`AudioEvent `. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - event - the :ref:`AudioEvent ` to remove .. index:: pair: function; remove_tensor .. _doxid-class_g_v_a_1_1_audio_frame_1ac33ff0f02ee4ee09eea0fccb47cac240: .. ref-code-block:: cpp :class: doxyrest-title-code-block void remove_tensor(const :ref:`Tensor`& tensor) Remove :ref:`Tensor `. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - tensor - the :ref:`Tensor ` to remove