Jetson Inference
DNN Vision Library
RTSPServer.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20  * DEALINGS IN THE SOFTWARE.
21  */
22 
23 #ifndef __RTSP_SERVER_H__
24 #define __RTSP_SERVER_H__
25 
26 #include <stdint.h>
27 
28 
29 // forward declarations
30 class Thread;
31 
32 struct _GMainLoop;
33 struct _GstRTSPServer;
34 struct _GstElement;
35 
36 
41 #define RTSP_DEFAULT_PORT 8554
42 
47 #define LOG_RTSP "[rtsp] "
48 
49 
56 {
57 public:
62  static RTSPServer* Create( uint16_t port=RTSP_DEFAULT_PORT );
63 
68  void Release();
69 
74  bool AddRoute( const char* path, _GstElement* pipeline );
75 
80  bool AddRoute( const char* path, const char* pipeline );
81 
82 protected:
83  RTSPServer( uint16_t port );
84  ~RTSPServer();
85 
86  bool init();
87 
88  static void* runThread( void* user_data );
89 
90  uint16_t mPort;
91  uint32_t mRefCount;
92 
94  bool mRunning;
95 
96  _GMainLoop* mMainLoop;
97  _GstRTSPServer* mServer;
98 };
99 
100 #endif
RTSPServer
RTSP server for transmitting encoded GStreamer pipelines to client devices.
Definition: RTSPServer.h:55
RTSPServer::AddRoute
bool AddRoute(const char *path, _GstElement *pipeline)
Register a GStreamer pipeline to be served at the specified path.
RTSP_DEFAULT_PORT
#define RTSP_DEFAULT_PORT
Default port used by RTSP server.
Definition: RTSPServer.h:41
RTSPServer::mMainLoop
_GMainLoop * mMainLoop
Definition: RTSPServer.h:96
RTSPServer::init
bool init()
RTSPServer::RTSPServer
RTSPServer(uint16_t port)
RTSPServer::mRunning
bool mRunning
Definition: RTSPServer.h:94
RTSPServer::mThread
Thread * mThread
Definition: RTSPServer.h:93
RTSPServer::mPort
uint16_t mPort
Definition: RTSPServer.h:90
RTSPServer::mServer
_GstRTSPServer * mServer
Definition: RTSPServer.h:97
RTSPServer::Create
static RTSPServer * Create(uint16_t port=RTSP_DEFAULT_PORT)
Create a RTSP server on this port.
RTSPServer::runThread
static void * runThread(void *user_data)
Thread
Thread class for launching an asynchronous operating-system dependent thread.
Definition: Thread.h:44
RTSPServer::Release
void Release()
Release a reference to the server instance.
RTSPServer::~RTSPServer
~RTSPServer()
RTSPServer::mRefCount
uint32_t mRefCount
Definition: RTSPServer.h:91