NVIDIA DeepStream SDK API Reference
9.1 Release
sources/gst-plugins/gst-nvmultistream2/gstnvstreammux_audio.h
Go to the documentation of this file.
1
/*
2
* SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
* SPDX-License-Identifier: Apache-2.0
4
*
5
* Licensed under the Apache License, Version 2.0 (the "License");
6
* you may not use this file except in compliance with the License.
7
* You may obtain a copy of the License at
8
*
9
* http://www.apache.org/licenses/LICENSE-2.0
10
*
11
* Unless required by applicable law or agreed to in writing, software
12
* distributed under the License is distributed on an "AS IS" BASIS,
13
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
* See the License for the specific language governing permissions and
15
* limitations under the License.
16
*/
17
18
#ifndef __GST_NVSTREAMMUX_AUDIO_H__
19
#define __GST_NVSTREAMMUX_AUDIO_H__
20
21
#include "
gstnvstreammux_impl.h
"
22
#include "nvbufaudio.h"
23
24
#define NVSTREAMMUX_BYTES_TO_AUDIOSAMPLESIZE(bytes, channels, bpf) \
25
((bytes) / ( (channels) * (bpf)))
26
27
#define NVSTREAMMUX_AUDIOSAMPLESIZE_TO_BYTES(samples, channels, bpf) \
28
((samples) * (channels) * (bpf))
29
30
31
extern
"C"
32
{
33
static
void
34
audio_mem_buf_unref_callback
(gpointer data);
35
}
36
37
43
class
GstAudioBatchBufferWrapper
:
public
NvDsBatchBufferWrapper
44
{
45
46
public :
47
GstAudioBatchBufferWrapper
(
GstNvStreamMux
*
mux
,
unsigned
int
size,
bool
is_raw
) :
NvDsBatchBufferWrapper
(size) ,
is_raw
(
is_raw
),
mux
(
mux
), api((GstElement*)
mux
)
48
{
49
50
batch
= malloc(
sizeof
(
NvBufAudio
));
51
memset (
batch
, 0 ,
sizeof
(
NvBufAudio
));
52
((
NvBufAudio
*)
batch
)->audioBuffers = (
NvBufAudioParams
*)malloc(
sizeof
(
NvBufAudioParams
) * size);
53
((
NvBufAudio
*)
batch
)->numFilled = 0;
54
((
NvBufAudio
*)
batch
)->batchSize = size;
55
if
(!
is_raw
)
56
{
57
gst_buffer
=
58
gst_buffer_new_wrapped_full (GST_MEMORY_FLAG_READONLY, (
NvBufAudio
*)
batch
,
sizeof
(
NvBufAudio
),
59
0,
sizeof
(
NvBufAudio
), (
void
*)
this
,
audio_mem_buf_unref_callback
);
60
//gst_buffer_ref(gst_buffer);
61
}
62
else
63
{
64
raw_batch
= gst_buffer_list_new_sized (size);
65
}
66
}
67
68
void
unref
()
override
;
69
void
reset_batch
();
70
void
dummy
(){}
71
void
copy_meta
(
unsigned
int
id
, std::shared_ptr<BufferWrapper> src_buffer,
unsigned
int
batch_id,
unsigned
int
frame_number,
unsigned
int
num_surfaces_per_frame,
NvDsBatchMeta
* dest_batch_meta,
unsigned
int
source_id)
override
;
72
unsigned
int
copy_buf
(std::shared_ptr<BufferWrapper> src,
unsigned
int
pos)
override
;
73
bool
push
(
SourcePad
* src_pad,
TimePoint
current_play_start,
NanoSecondsType
accum_dur)
override
;
74
bool
push
(
SourcePad
* src_pad,
unsigned
long
pts)
override
;
75
void
unref_gst_bufs
();
76
77
GstBufferList *
raw_batch
;
78
GstBuffer
*
gst_buffer
;
79
bool
is_raw
;
80
GstNvStreamMux
*
mux
;
81
std::vector<std::shared_ptr<GstBufferWrapper> >
gst_in_bufs
;
82
83
private
:
84
85
unsigned
int
copy_buf_impl(std::shared_ptr<BufferWrapper> buf,
unsigned
int
pos);
86
87
private
:
88
GstCommonBufferAPI
api;
89
90
};
91
92
extern
"C"
93
{
94
static
void
95
audio_mem_buf_unref_callback
(gpointer data)
96
{
97
98
if
(data != NULL)
99
{
100
GstAudioBatchBufferWrapper
* batch = (
GstAudioBatchBufferWrapper
*)data;
101
batch->
unref_gst_bufs
();
102
delete
batch;
103
}
104
105
}
106
}
107
108
109
#endif
GstAudioBatchBufferWrapper::unref_gst_bufs
void unref_gst_bufs()
_GstNvStreamMux
Definition:
sources/gst-plugins/gst-nvmultistream2/gstnvstreammux.h:47
GstAudioBatchBufferWrapper::copy_buf
unsigned int copy_buf(std::shared_ptr< BufferWrapper > src, unsigned int pos) override
NvBufAudioParams
Definition:
sources/includes/nvbufaudio.h:87
GstAudioBatchBufferWrapper::dummy
void dummy()
Definition:
sources/gst-plugins/gst-nvmultistream2/gstnvstreammux_audio.h:70
NvDsBatchBufferWrapper
Definition:
sources/libs/nvstreammux/include/nvstreammux_batch.h:113
GstCommonBufferAPI
Definition:
sources/gst-plugins/gst-nvmultistream2/gstnvstreammux_impl.h:37
GstAudioBatchBufferWrapper::gst_buffer
GstBuffer * gst_buffer
Definition:
sources/gst-plugins/gst-nvmultistream2/gstnvstreammux_audio.h:78
TimePoint
std::chrono::time_point< std::chrono::steady_clock, NanoSecondsType > TimePoint
Definition:
sources/libs/nvstreammux/include/nvstreammux_batch.h:42
SourcePad
Definition:
sources/libs/nvstreammux/include/nvstreammux_pads.h:145
GstAudioBatchBufferWrapper::raw_batch
GstBufferList * raw_batch
Definition:
sources/gst-plugins/gst-nvmultistream2/gstnvstreammux_audio.h:77
NvBufAudio
Definition:
sources/includes/nvbufaudio.h:114
GstAudioBatchBufferWrapper::reset_batch
void reset_batch()
_NvDsBatchMeta
Holds information about a formed batch containing frames from different sources.
Definition:
sources/includes/nvdsmeta.h:262
GstAudioBatchBufferWrapper::gst_in_bufs
std::vector< std::shared_ptr< GstBufferWrapper > > gst_in_bufs
Definition:
sources/gst-plugins/gst-nvmultistream2/gstnvstreammux_audio.h:81
GstAudioBatchBufferWrapper::mux
GstNvStreamMux * mux
Definition:
sources/gst-plugins/gst-nvmultistream2/gstnvstreammux_audio.h:80
NanoSecondsType
std::chrono::duration< double, std::nano > NanoSecondsType
Definition:
sources/libs/nvstreammux/include/nvstreammux_pads.h:27
GstAudioBatchBufferWrapper::copy_meta
void copy_meta(unsigned int id, std::shared_ptr< BufferWrapper > src_buffer, unsigned int batch_id, unsigned int frame_number, unsigned int num_surfaces_per_frame, NvDsBatchMeta *dest_batch_meta, unsigned int source_id) override
audio_mem_buf_unref_callback
static void audio_mem_buf_unref_callback(gpointer data)
Definition:
sources/gst-plugins/gst-nvmultistream2/gstnvstreammux_audio.h:95
GstAudioBatchBufferWrapper
The GStreamer wrapper code for NvDsBatchBufferWrapper which represent one batched buffer.
Definition:
sources/gst-plugins/gst-nvmultistream2/gstnvstreammux_audio.h:43
GstAudioBatchBufferWrapper::is_raw
bool is_raw
Definition:
sources/gst-plugins/gst-nvmultistream2/gstnvstreammux_audio.h:79
BatchBufferWrapper::batch
void * batch
Definition:
sources/libs/nvstreammux/include/nvstreammux_batch.h:107
GstAudioBatchBufferWrapper::GstAudioBatchBufferWrapper
GstAudioBatchBufferWrapper(GstNvStreamMux *mux, unsigned int size, bool is_raw)
Definition:
sources/gst-plugins/gst-nvmultistream2/gstnvstreammux_audio.h:47
gstnvstreammux_impl.h
GstAudioBatchBufferWrapper::push
bool push(SourcePad *src_pad, TimePoint current_play_start, NanoSecondsType accum_dur) override
GstBuffer
struct _GstBuffer GstBuffer
Definition:
sources/includes/ds3d/common/idatatype.h:24
GstAudioBatchBufferWrapper::unref
void unref() override
Privacy Policy
|
Manage My Privacy
|
Do Not Sell or Share My Data
|
Terms of Service
|
Accessibility
|
Corporate Policies
|
Product Security
|
Contact
© 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
NVIDIA Confidential | Subject to Change | For test and development only.
Thu Jul 9 2026 11:48:19 | PR-09318-R32