UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
Loading...
Searching...
No Matches
BasicRTSPOnlySubsession.hh
Go to the documentation of this file.
1/*
2 * FILE: rtsp/BasicRTSPOnlySubsession.hh
3 * AUTHORS: David Cassany <david.cassany@i2cat.net>
4 * Gerard Castillo <gerard.castillo@i2cat.net>
5 *
6 * Copyright (c) 2005-2010 Fundació i2CAT, Internet I Innovació Digital a Catalunya
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, is permitted provided that the following conditions
10 * are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * 3. All advertising materials mentioning features or use of this software
20 * must display the following acknowledgement:
21 *
22 * This product includes software developed by the Fundació i2CAT,
23 * Internet I Innovació Digital a Catalunya. This product also includes
24 * software developed by CESNET z.s.p.o.
25 *
26 * 4. Neither the name of the University nor of the Institute may be used
27 * to endorse or promote products derived from this software without
28 * specific prior written permission.
29 *
30 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS
31 * "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
32 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
33 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
34 * EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
35 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
36 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
37 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
39 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
40 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
41 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42 *
43 */
44#ifndef _BASIC_RTSP_ONLY_SUBSESSION_HH
45#define _BASIC_RTSP_ONLY_SUBSESSION_HH
46
47#ifndef _SERVER_MEDIA_SESSION_HH
48#include <ServerMediaSession.hh>
49#endif
50
51#include <liveMedia_version.hh>
52
53#include "c_basicRTSPOnlyServer.h" // for rtsp_server_parameters
54#include "rtsp/rtsp_utils.h"
55
56// #ifndef _ON_DEMAND_SERVER_MEDIA_SUBSESSION_HH
57// #include <OnDemandServerMediaSubsession.hh>
58// #endif
59
61public:
62 Destinations(struct sockaddr_storage const& destAddr,
63 Port const& rtpDestPort,
64 Port const& rtcpDestPort)
65: isTCP(False), addr(destAddr), rtpPort(rtpDestPort), rtcpPort(rtcpDestPort),
67 {
68 }
69 Destinations(int tcpSockNum, unsigned char rtpChanId, unsigned char rtcpChanId)
70 : isTCP(True), rtpPort(0) /*dummy*/, rtcpPort(0) /*dummy*/,
71 tcpSocketNum(tcpSockNum), rtpChannelId(rtpChanId), rtcpChannelId(rtcpChanId) {
72 }
73
74public:
75 Boolean isTCP;
76 struct sockaddr_storage addr;
77 Port rtpPort;
81};
82
83#ifdef __clang__
84#define MAYBE_UNUSED_ATTRIBUTE [[maybe_unused]]
85#else
86#define MAYBE_UNUSED_ATTRIBUTE // GCC complains if [[maybe_used]] is used there
87#endif
88
89class BasicRTSPOnlySubsession: public ServerMediaSubsession {
90
91public:
93 createNew(UsageEnvironment& env,
94 Boolean reuseFirstSource,
96
97protected:
98
99 BasicRTSPOnlySubsession(UsageEnvironment& env, Boolean reuseFirstSource,
101
102 ~BasicRTSPOnlySubsession() override;
103
104 char const* sdpLines(int addressFamily) override;
105
106 void getStreamParameters(unsigned clientSessionId,
107 struct sockaddr_storage const &clientAddress,
108 Port const& clientRTPPort,
109 Port const& clientRTCPPort,
110 int tcpSocketNum,
111 unsigned char rtpChannelId,
112 unsigned char rtcpChannelId,
113 TLSState *tlsState,
114 struct sockaddr_storage &destinationAddress,
115 uint8_t& destinationTTL,
116 Boolean& isMulticast,
117 Port& serverRTPPort,
118 Port& serverRTCPPort,
119 void*& streamToken) override;
120
121 void startStream(unsigned clientSessionId, void* streamToken,
122 TaskFunc* rtcpRRHandler, void* rtcpRRHandlerClientData,
123 unsigned short& rtpSeqNum,
124 unsigned& rtpTimestamp,
125 ServerRequestAlternativeByteHandler* serverRequestAlternativeByteHandler,
126 void* serverRequestAlternativeByteHandlerClientData) override;
127
128 void deleteStream(unsigned clientSessionId, void*& streamToken) override;
129
130#if LIVEMEDIA_LIBRARY_VERSION_INT >= 1701302400 // 2023.11.30
131 void getRTPSinkandRTCP(void*, RTPSink*&, RTCPInstance*&) override {}
132#else
133 void getRTPSinkandRTCP(void *, const RTPSink *&,
134 const RTCPInstance *&) override
135 {
136 }
137#endif
138
139protected:
140
144
145private:
146
147 void setSDPLines(int addressFamily);
148
151 char fCNAME[100];
155};
156
157
158#endif
#define MAYBE_UNUSED_ATTRIBUTE
MAYBE_UNUSED_ATTRIBUTE Boolean fReuseFirstSource
void getStreamParameters(unsigned clientSessionId, struct sockaddr_storage const &clientAddress, Port const &clientRTPPort, Port const &clientRTCPPort, int tcpSocketNum, unsigned char rtpChannelId, unsigned char rtcpChannelId, TLSState *tlsState, struct sockaddr_storage &destinationAddress, uint8_t &destinationTTL, Boolean &isMulticast, Port &serverRTPPort, Port &serverRTCPPort, void *&streamToken) override
void setSDPLines(int addressFamily)
struct rtsp_server_parameters rtsp_params
static BasicRTSPOnlySubsession * createNew(UsageEnvironment &env, Boolean reuseFirstSource, rtsp_types_t avType, int rtpPort, struct rtsp_server_parameters)
char const * sdpLines(int addressFamily) override
void startStream(unsigned clientSessionId, void *streamToken, TaskFunc *rtcpRRHandler, void *rtcpRRHandlerClientData, unsigned short &rtpSeqNum, unsigned &rtpTimestamp, ServerRequestAlternativeByteHandler *serverRequestAlternativeByteHandler, void *serverRequestAlternativeByteHandlerClientData) override
BasicRTSPOnlySubsession(UsageEnvironment &env, Boolean reuseFirstSource, rtsp_types_t avType, int rtpPort, struct rtsp_server_parameters)
void getRTPSinkandRTCP(void *, const RTPSink *&, const RTCPInstance *&) override
MAYBE_UNUSED_ATTRIBUTE void * fLastStreamToken
void deleteStream(unsigned clientSessionId, void *&streamToken) override
Destinations(int tcpSockNum, unsigned char rtpChanId, unsigned char rtcpChanId)
unsigned char rtcpChannelId
unsigned char rtpChannelId
struct sockaddr_storage addr
Destinations(struct sockaddr_storage const &destAddr, Port const &rtpDestPort, Port const &rtcpDestPort)
rtsp_types_t
Definition rtsp_utils.h:4