RTSPServerSupportingHTTPStreaming.hh 2.8 KB

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