live
MPEG2TransportFileServerMediaSubsession.hh
Go to the documentation of this file.
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-2026 Live Networks, Inc. All rights reserved.
18// A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s
19// on demand, from a MPEG-2 Transport Stream file.
20// C++ header
21
22#ifndef _MPEG2_TRANSPORT_FILE_SERVER_MEDIA_SUBSESSION_HH
23#define _MPEG2_TRANSPORT_FILE_SERVER_MEDIA_SUBSESSION_HH
24
25#ifndef _FILE_SERVER_MEDIA_SUBSESSION_HH
27#endif
28#ifndef _MPEG2_TRANSPORT_STREAM_FRAMER_HH
30#endif
31#ifndef _BYTE_STREAM_FILE_SOURCE_HH
33#endif
34#ifndef _MPEG2_TRANSPORT_STREAM_TRICK_MODE_FILTER_HH
36#endif
37#ifndef _MPEG2_TRANSPORT_STREAM_FROM_ES_SOURCE_HH
39#endif
40
41class ClientTrickPlayState; // forward
42
44public:
47 char const* dataFileName, char const* indexFileName,
48 Boolean reuseFirstSource);
49
50protected:
52 char const* fileName,
54 Boolean reuseFirstSource);
55 // called only by createNew();
57
59
60private: // redefined virtual functions
61 // Note that because - to implement 'trick play' operations - we're operating on
62 // more than just the input source, we reimplement some functions that are
63 // already implemented in "OnDemandServerMediaSubsession", rather than
64 // reimplementing "seekStreamSource()" and "setStreamSourceScale()":
65 virtual void startStream(unsigned clientSessionId, void* streamToken, int tcpSocketNum,
66 TaskFunc* rtcpRRHandler, void* rtcpRRHandlerClientData,
67 unsigned short& rtpSeqNum,
68 unsigned& rtpTimestamp,
69 ServerRequestAlternativeByteHandler* serverRequestAlternativeByteHandler,
70 void* serverRequestAlternativeByteHandlerClientData);
71 virtual void pauseStream(unsigned clientSessionId, void* streamToken);
72 virtual void seekStream(unsigned clientSessionId, void* streamToken, double& seekNPT, double streamDuration, u_int64_t& numBytes);
73 virtual void setStreamScale(unsigned clientSessionId, void* streamToken, float scale);
74 virtual void deleteStream(unsigned clientSessionId, void*& streamToken);
75
76 // The virtual functions that are usually implemented by "ServerMediaSubsession"s:
77 virtual FramedSource* createNewStreamSource(unsigned clientSessionId,
78 unsigned& estBitrate);
79 virtual RTPSink* createNewRTPSink(Groupsock* rtpGroupsock,
80 unsigned char rtpPayloadTypeIfDynamic,
81 FramedSource* inputSource);
82
83 virtual void testScaleFactor(float& scale);
84 virtual float duration() const;
85
86private:
87 ClientTrickPlayState* lookupClient(unsigned clientSessionId);
88
89private:
91 float fDuration;
92 HashTable* fClientSessionHashTable; // indexed by client session id
93};
94
95
96// This class encapsulates the 'trick play' state for each current client (for
97// a given "MPEG2TransportFileServerMediaSubsession" - i.e., Transport Stream file).
98// It is used only within the implementation of "MPEG2TransportFileServerMediaSubsession", but is included here,
99// in case subclasses of "MPEG2TransportFileServerMediaSubsession" want to use it.
100
129
130#endif
unsigned char Boolean
Definition Boolean.hh:25
void ServerRequestAlternativeByteHandler(void *instance, u_int8_t requestByte)
void TaskFunc(void *clientData)
void reseekOriginalTransportStreamSource()
void updateStateOnScaleChange()
MPEG2TransportStreamTrickModeFilter * fTrickModeFilter
void setSource(MPEG2TransportStreamFramer *framer)
unsigned long updateStateFromNPT(double npt, double seekDuration)
ClientTrickPlayState(MPEG2TransportStreamIndexFile *indexFile)
void updateStateOnPlayChange(Boolean reverseToPreviousVSH)
MPEG2TransportStreamIndexFile * fIndexFile
MPEG2TransportStreamFromESSource * fTrickPlaySource
FileServerMediaSubsession(UsageEnvironment &env, char const *fileName, Boolean reuseFirstSource)
ClientTrickPlayState * lookupClient(unsigned clientSessionId)
MPEG2TransportFileServerMediaSubsession(UsageEnvironment &env, char const *fileName, MPEG2TransportStreamIndexFile *indexFile, Boolean reuseFirstSource)
virtual RTPSink * createNewRTPSink(Groupsock *rtpGroupsock, unsigned char rtpPayloadTypeIfDynamic, FramedSource *inputSource)
virtual void testScaleFactor(float &scale)
virtual void setStreamScale(unsigned clientSessionId, void *streamToken, float scale)
virtual FramedSource * createNewStreamSource(unsigned clientSessionId, unsigned &estBitrate)
static MPEG2TransportFileServerMediaSubsession * createNew(UsageEnvironment &env, char const *dataFileName, char const *indexFileName, Boolean reuseFirstSource)
virtual void deleteStream(unsigned clientSessionId, void *&streamToken)
virtual void startStream(unsigned clientSessionId, void *streamToken, int tcpSocketNum, TaskFunc *rtcpRRHandler, void *rtcpRRHandlerClientData, unsigned short &rtpSeqNum, unsigned &rtpTimestamp, ServerRequestAlternativeByteHandler *serverRequestAlternativeByteHandler, void *serverRequestAlternativeByteHandlerClientData)
virtual void seekStream(unsigned clientSessionId, void *streamToken, double &seekNPT, double streamDuration, u_int64_t &numBytes)
virtual ClientTrickPlayState * newClientTrickPlayState()
virtual void pauseStream(unsigned clientSessionId, void *streamToken)