NVIDIA DeepStream SDK API Reference
9.0 Release
sources/gst-plugins/gst-nvmultistream2/gstnvstreammux_audio.h
Go to the documentation of this file.
1
/*
2
* SPDX-FileCopyrightText: Copyright (c) 2021-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
* SPDX-License-Identifier: LicenseRef-NvidiaProprietary
4
*
5
* NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
6
* property and proprietary rights in and to this material, related
7
* documentation and any modifications thereto. Any use, reproduction,
8
* disclosure or distribution of this material and related documentation
9
* without an express license agreement from NVIDIA CORPORATION or
10
* its affiliates is strictly prohibited.
11
*/
12
13
#ifndef __GST_NVSTREAMMUX_AUDIO_H__
14
#define __GST_NVSTREAMMUX_AUDIO_H__
15
16
#include "
gstnvstreammux_impl.h
"
17
#include "nvbufaudio.h"
18
19
#define NVSTREAMMUX_BYTES_TO_AUDIOSAMPLESIZE(bytes, channels, bpf) \
20
((bytes) / ( (channels) * (bpf)))
21
22
#define NVSTREAMMUX_AUDIOSAMPLESIZE_TO_BYTES(samples, channels, bpf) \
23
((samples) * (channels) * (bpf))
24
25
26
extern
"C"
27
{
28
static
void
29
audio_mem_buf_unref_callback
(gpointer data);
30
}
31
32
38
class
GstAudioBatchBufferWrapper
:
public
NvDsBatchBufferWrapper
39
{
40
41
public :
42
GstAudioBatchBufferWrapper
(
GstNvStreamMux
*
mux
,
unsigned
int
size,
bool
is_raw
) :
NvDsBatchBufferWrapper
(size) ,
is_raw
(
is_raw
),
mux
(
mux
), api((GstElement*)
mux
)
43
{
44
45
batch
= malloc(
sizeof
(
NvBufAudio
));
46
memset (
batch
, 0 ,
sizeof
(
NvBufAudio
));
47
((
NvBufAudio
*)
batch
)->audioBuffers = (
NvBufAudioParams
*)malloc(
sizeof
(
NvBufAudioParams
) * size);
48
((
NvBufAudio
*)
batch
)->numFilled = 0;
49
((
NvBufAudio
*)
batch
)->batchSize = size;
50
if
(!
is_raw
)
51
{
52
gst_buffer
=
53
gst_buffer_new_wrapped_full (GST_MEMORY_FLAG_READONLY, (
NvBufAudio
*)
batch
,
sizeof
(
NvBufAudio
),
54
0,
sizeof
(
NvBufAudio
), (
void
*)
this
,
audio_mem_buf_unref_callback
);
55
//gst_buffer_ref(gst_buffer);
56
}
57
else
58
{
59
raw_batch
= gst_buffer_list_new_sized (size);
60
}
61
}
62
63
void
unref
()
override
;
64
void
reset_batch
();
65
void
dummy
(){}
66
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
;
67
unsigned
int
copy_buf
(std::shared_ptr<BufferWrapper> src,
unsigned
int
pos)
override
;
68
bool
push
(
SourcePad
* src_pad,
TimePoint
current_play_start,
NanoSecondsType
accum_dur)
override
;
69
bool
push
(
SourcePad
* src_pad,
unsigned
long
pts)
override
;
70
void
unref_gst_bufs
();
71
72
GstBufferList *
raw_batch
;
73
GstBuffer
*
gst_buffer
;
74
bool
is_raw
;
75
GstNvStreamMux
*
mux
;
76
std::vector<std::shared_ptr<GstBufferWrapper> >
gst_in_bufs
;
77
78
private
:
79
80
unsigned
int
copy_buf_impl(std::shared_ptr<BufferWrapper> buf,
unsigned
int
pos);
81
82
private
:
83
GstCommonBufferAPI
api;
84
85
};
86
87
extern
"C"
88
{
89
static
void
90
audio_mem_buf_unref_callback
(gpointer data)
91
{
92
93
if
(data != NULL)
94
{
95
GstAudioBatchBufferWrapper
* batch = (
GstAudioBatchBufferWrapper
*)data;
96
batch->
unref_gst_bufs
();
97
delete
batch;
98
}
99
100
}
101
}
102
103
104
#endif
GstAudioBatchBufferWrapper::unref_gst_bufs
void unref_gst_bufs()
_GstNvStreamMux
Definition:
sources/gst-plugins/gst-nvmultistream2/gstnvstreammux.h:42
GstAudioBatchBufferWrapper::copy_buf
unsigned int copy_buf(std::shared_ptr< BufferWrapper > src, unsigned int pos) override
NvBufAudioParams
Definition:
sources/includes/nvbufaudio.h:82
GstAudioBatchBufferWrapper::dummy
void dummy()
Definition:
sources/gst-plugins/gst-nvmultistream2/gstnvstreammux_audio.h:65
NvDsBatchBufferWrapper
Definition:
sources/libs/nvstreammux/include/nvstreammux_batch.h:108
GstCommonBufferAPI
Definition:
sources/gst-plugins/gst-nvmultistream2/gstnvstreammux_impl.h:32
GstAudioBatchBufferWrapper::gst_buffer
GstBuffer * gst_buffer
Definition:
sources/gst-plugins/gst-nvmultistream2/gstnvstreammux_audio.h:73
TimePoint
std::chrono::time_point< std::chrono::steady_clock, NanoSecondsType > TimePoint
Definition:
sources/libs/nvstreammux/include/nvstreammux_batch.h:37
SourcePad
Definition:
sources/libs/nvstreammux/include/nvstreammux_pads.h:140
GstAudioBatchBufferWrapper::raw_batch
GstBufferList * raw_batch
Definition:
sources/gst-plugins/gst-nvmultistream2/gstnvstreammux_audio.h:72
NvBufAudio
Definition:
sources/includes/nvbufaudio.h:109
GstAudioBatchBufferWrapper::reset_batch
void reset_batch()
_NvDsBatchMeta
Holds information about a formed batch containing frames from different sources.
Definition:
sources/includes/nvdsmeta.h:257
GstAudioBatchBufferWrapper::gst_in_bufs
std::vector< std::shared_ptr< GstBufferWrapper > > gst_in_bufs
Definition:
sources/gst-plugins/gst-nvmultistream2/gstnvstreammux_audio.h:76
GstAudioBatchBufferWrapper::mux
GstNvStreamMux * mux
Definition:
sources/gst-plugins/gst-nvmultistream2/gstnvstreammux_audio.h:75
NanoSecondsType
std::chrono::duration< double, std::nano > NanoSecondsType
Definition:
sources/libs/nvstreammux/include/nvstreammux_pads.h:22
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:90
GstAudioBatchBufferWrapper
The GStreamer wrapper code for NvDsBatchBufferWrapper which represent one batched buffer.
Definition:
sources/gst-plugins/gst-nvmultistream2/gstnvstreammux_audio.h:38
GstAudioBatchBufferWrapper::is_raw
bool is_raw
Definition:
sources/gst-plugins/gst-nvmultistream2/gstnvstreammux_audio.h:74
BatchBufferWrapper::batch
void * batch
Definition:
sources/libs/nvstreammux/include/nvstreammux_batch.h:102
GstAudioBatchBufferWrapper::GstAudioBatchBufferWrapper
GstAudioBatchBufferWrapper(GstNvStreamMux *mux, unsigned int size, bool is_raw)
Definition:
sources/gst-plugins/gst-nvmultistream2/gstnvstreammux_audio.h:42
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:19
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.
Fri Mar 20 2026 14:36:59 | PR-09318-R32