|
|
NVIDIA DeepStream SDK API Reference
|
8.0 Release
|
Go to the documentation of this file.
28 #include <unordered_map>
46 struct RecordingInfo {
73 operator bool()
const {
74 return data_ !=
nullptr;
91 class Pipeline :
public Object {
121 class EOSMessage :
public Message {
129 class DynamicSourceMessage :
public Message {
150 class StateTransitionMessage :
public Message {
167 Pipeline(
const char* name,
const std::string& config_file);
173 template<
typename... Args>
174 Pipeline&
add(
const std::string& element_type,
const std::string& element_name,
const Args&... args) {
176 if constexpr (
sizeof...(args) > 0) {
177 element.
set(args...);
179 return this->
add(element);
192 throw std::runtime_error(name +
" Not found");
204 std::pair<std::string, std::string> route,
205 std::pair<std::string, std::string> tips
209 template <
typename... Args>
210 Pipeline &
link(
const std::string &arg1,
const std::string arg2,
const Args &...args)
212 link(std::make_pair(arg1, arg2), std::make_pair(
"",
""));
213 if constexpr (
sizeof...(args) > 0) {
214 return this->
link(arg2, args...);
244 const std::string& element_name,
245 const std::string& plugin_name,
246 const std::string& object_name,
247 const std::string tip=
"");
250 template<
typename... Args>
252 const std::string& element_name,
253 const std::string& plugin_name,
254 const std::string& object_name,
255 const std::string tip,
256 const Args&... args) {
257 attach(element_name, plugin_name, object_name, tip);
258 if (
sizeof...(args) > 0) {
259 auto& element = (*this)[element_name];
260 if (
auto handler = element.getSignalHandler(object_name)) {
261 handler->set(args...);
262 }
else if (
auto probe = element.getProbe(object_name)) {
278 int prepare(std::function<
void(
Pipeline &,
const Message &)> listener);
302 uint32_t
startRTSP(uint16_t rtsp_port, uint16_t udp_port, uint32_t buffer_size=0);
313 uint32_t startTime = 0,
314 uint32_t duration = 0,
316 printf(
"\nSource recorded at %s/%s. Duration %.2f sec\n",
317 info.getFileDirectory().c_str(), info.getFileName().c_str(),
318 info.getDuration() / 1000.0);
320 void* userData =
nullptr);
353 std::map<std::string, Element>
elements_;
355 std::map<std::string, std::unique_ptr<SignalEmitter>>
action_owners_;
bool containsVideo() const
Get the recording file contains video.
std::unordered_map< uint32_t, std::string > session_id_to_element
std::string getContainerType() const
Get the recording file container type.
std::map< std::string, std::unique_ptr< SignalEmitter > > action_owners_
Base class for all the custom objects.
const std::string & getName() const
Object & set(const YAML::Node ¶ms)
Set the properties from key/value pairs in the yaml format.
Element class definition.
int prepare()
Intialize the pipeline.
Pipeline & add(const std::string &element_type, const std::string &element_name, const Args &... args)
Template function for creating and adding element with properties.
std::map< std::string, Element > elements_
StateTransitionMessage(void *)
const std::string & getSensorName() const
unsigned int getDuration() const
Get the recording file duration.
unsigned int getHeight() const
Get the recording file height.
Pipeline class definition.
Pipeline & install(std::function< void(Pipeline &, int key)> keyboard_listener)
install a callback to capture keyboard events
const std::string & getSensorId() const
void getState(State &old_state, State &new_state) const
Pipeline & link(std::pair< std::string, std::string > route, std::pair< std::string, std::string > tips)
Link two elements within the pipeline.
std::unordered_map< std::string, uint32_t > element_to_session_id
Pipeline & attach(const std::string &elmenent_name, CustomObject *object, const std::string tip="")
Attach a custom object to an element within the pipeline.
std::function< void(Pipeline &, int key)> keyboard_listener_
uint32_t getSourceId() const
Element & operator[](const std::string &name)
Operator for accessing elements in a pipeline.
unsigned int getSessionId() const
Get the recording session id.
unsigned int getWidth() const
Get the recording file width.
Element * find(const ::std::string &name)
Find an element within the pipeline by name.
Pipeline & wait()
Wait until the pipeline ends.
uint32_t startRecording(const std::string &element_name, uint32_t startTime=0, uint32_t duration=0, std::function< void(const RecordingInfo &)> callback=[](const RecordingInfo &info) { printf("\nSource recorded at %s/%s. Duration %.2f sec\n", info.getFileDirectory().c_str(), info.getFileName().c_str(), info.getDuration()/1000.0);}, void *userData=nullptr)
Send Smart Record start signal to an nvurisrcbin element.
uint32_t startRTSP(uint16_t rtsp_port, uint16_t udp_port, uint32_t buffer_size=0)
Start an RTSP server.
virtual ~Pipeline()
Destructor.
Holds information about a recording session.
bool stopRecording(const std::string &element_name)
Send Smart Record stop signal to an nvurisrcbin element.
Pipeline & start()
Start the pipeline.
Pipeline & resume()
Resume the pipeline.
Pipeline & activate()
Start the pipeline after it is already intialized.
RecordingInfo(void *data=nullptr)
Pipeline & pause()
Pause the pipeline.
std::string getFileName() const
Get the recording file name.
bool containsAudio() const
Get the recording file contains audio.
DynamicSourceMessage(void *)
std::string getFileDirectory() const
Get the recording file directory.
unsigned int getSamplingRate() const
Get the recording file sampling rate.
Pipeline & seek(uint64_t timestamp)
Seek to a specified position for processing data within the pipeline.
Pipeline & stop()
Stop the pipeline.
Pipeline & link(const std::string &arg1, const std::string arg2, const Args &...args)
Template function for linking elements in the simplest way.
unsigned int getChannels() const
Get the recording file channels.
const std::string & getUri() const
bool isSourceAdded() const
Pipeline & attach(const std::string &element_name, const std::string &plugin_name, const std::string &object_name, const std::string tip, const Args &... args)
Template function for creating and attaching custom object with properties.