1/**********
2This library is free software; you can redistribute it and/or modify it under
3the terms of the GNU Lesser General Public License as published by the
4Free Software Foundation; either version 3 of the License, or (at your
5option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.)
6
7This library is distributed in the hope that it will be useful, but WITHOUT
8ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
9FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
10more details.
11
12You should have received a copy of the GNU Lesser General Public License
13along with this library; if not, write to the Free Software Foundation, Inc.,
1451 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15**********/
16// "liveMedia"
17// Copyright (c) 1996-2020 Live Networks, Inc. All rights reserved.
18// A server that supports both RTSP, and HTTP streaming (using Apple's "HTTP Live Streaming" protocol)
19// C++ header
20
21#ifndef _RTSP_SERVER_SUPPORTING_HTTP_STREAMING_HH
22#define _RTSP_SERVER_SUPPORTING_HTTP_STREAMING_HH
23
24#ifndef _RTSP_SERVER_HH
25#include "RTSPServer.hh"
26#endif
27#ifndef _BYTE_STREAM_MEMORY_BUFFER_SOURCE_HH
28#include "ByteStreamMemoryBufferSource.hh"
29#endif
30#ifndef _TCP_STREAM_SINK_HH
31#include "TCPStreamSink.hh"
32#endif
33
34class RTSPServerSupportingHTTPStreaming: public RTSPServer {
35public:
36 static RTSPServerSupportingHTTPStreaming* createNew(UsageEnvironment& env, Port rtspPort = 554,
37 UserAuthenticationDatabase* authDatabase = NULL,
38 unsigned reclamationTestSeconds = 65);
39
40 Boolean setHTTPPort(Port httpPort) { return setUpTunnelingOverHTTP(httpPort); }
41
42protected:
43 RTSPServerSupportingHTTPStreaming(UsageEnvironment& env,
44 int ourSocket, Port ourPort,
45 UserAuthenticationDatabase* authDatabase,
46 unsigned reclamationTestSeconds);
47 // called only by createNew();
48 virtual ~RTSPServerSupportingHTTPStreaming();
49
50protected: // redefined virtual functions
51 virtual ClientConnection* createNewClientConnection(int clientSocket, struct sockaddr_in clientAddr);
52
53public: // should be protected, but some old compilers complain otherwise
54 class RTSPClientConnectionSupportingHTTPStreaming: public RTSPServer::RTSPClientConnection {
55 public:
56 RTSPClientConnectionSupportingHTTPStreaming(RTSPServer& ourServer, int clientSocket, struct sockaddr_in clientAddr);
57 virtual ~RTSPClientConnectionSupportingHTTPStreaming();
58
59 protected: // redefined virtual functions
60 virtual void handleHTTPCmd_StreamingGET(char const* urlSuffix, char const* fullRequestStr);
61
62 protected:
63 static void afterStreaming(void* clientData);
64
65 private:
66 u_int32_t fClientSessionId;
67 FramedSource* fStreamSource;
68 ByteStreamMemoryBufferSource* fPlaylistSource;
69 TCPStreamSink* fTCPSink;
70 };
71};
72
73#endif
74