00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef _MPEG2_TRANSPORT_FILE_SERVER_MEDIA_SUBSESSION_HH
00023 #define _MPEG2_TRANSPORT_FILE_SERVER_MEDIA_SUBSESSION_HH
00024
00025 #ifndef _FILE_SERVER_MEDIA_SUBSESSION_HH
00026 #include "FileServerMediaSubsession.hh"
00027 #endif
00028 #ifndef _MPEG2_TRANSPORT_STREAM_FRAMER_HH
00029 #include "MPEG2TransportStreamFramer.hh"
00030 #endif
00031 #ifndef _BYTE_STREAM_FILE_SOURCE_HH
00032 #include "ByteStreamFileSource.hh"
00033 #endif
00034 #ifndef _MPEG2_TRANSPORT_STREAM_TRICK_MODE_FILTER_HH
00035 #include "MPEG2TransportStreamTrickModeFilter.hh"
00036 #endif
00037 #ifndef _MPEG2_TRANSPORT_STREAM_FROM_ES_SOURCE_HH
00038 #include "MPEG2TransportStreamFromESSource.hh"
00039 #endif
00040
00041 class ClientTrickPlayState;
00042
00043 class MPEG2TransportFileServerMediaSubsession: public FileServerMediaSubsession{
00044 public:
00045 static MPEG2TransportFileServerMediaSubsession*
00046 createNew(UsageEnvironment& env,
00047 char const* dataFileName, char const* indexFileName,
00048 Boolean reuseFirstSource);
00049
00050 protected:
00051 MPEG2TransportFileServerMediaSubsession(UsageEnvironment& env,
00052 char const* fileName,
00053 MPEG2TransportStreamIndexFile* indexFile,
00054 Boolean reuseFirstSource);
00055
00056 virtual ~MPEG2TransportFileServerMediaSubsession();
00057
00058 virtual ClientTrickPlayState* newClientTrickPlayState();
00059
00060 private:
00061
00062
00063
00064
00065 virtual void startStream(unsigned clientSessionId, void* streamToken,
00066 TaskFunc* rtcpRRHandler,
00067 void* rtcpRRHandlerClientData,
00068 unsigned short& rtpSeqNum,
00069 unsigned& rtpTimestamp,
00070 ServerRequestAlternativeByteHandler* serverRequestAlternativeByteHandler,
00071 void* serverRequestAlternativeByteHandlerClientData);
00072 virtual void pauseStream(unsigned clientSessionId, void* streamToken);
00073 virtual void seekStream(unsigned clientSessionId, void* streamToken, double& seekNPT, double streamDuration, u_int64_t& numBytes);
00074 virtual void setStreamScale(unsigned clientSessionId, void* streamToken, float scale);
00075 virtual void deleteStream(unsigned clientSessionId, void*& streamToken);
00076
00077
00078 virtual FramedSource* createNewStreamSource(unsigned clientSessionId,
00079 unsigned& estBitrate);
00080 virtual RTPSink* createNewRTPSink(Groupsock* rtpGroupsock,
00081 unsigned char rtpPayloadTypeIfDynamic,
00082 FramedSource* inputSource);
00083
00084 virtual void testScaleFactor(float& scale);
00085 virtual float duration() const;
00086
00087 private:
00088 ClientTrickPlayState* lookupClient(unsigned clientSessionId);
00089
00090 private:
00091 MPEG2TransportStreamIndexFile* fIndexFile;
00092 float fDuration;
00093 HashTable* fClientSessionHashTable;
00094 };
00095
00096
00097
00098
00099
00100
00101
00102 class ClientTrickPlayState {
00103 public:
00104 ClientTrickPlayState(MPEG2TransportStreamIndexFile* indexFile);
00105
00106
00107 unsigned long updateStateFromNPT(double npt, double seekDuration);
00108 void updateStateOnScaleChange();
00109 void updateStateOnPlayChange(Boolean reverseToPreviousVSH);
00110
00111 void handleStreamDeletion();
00112 void setSource(MPEG2TransportStreamFramer* framer);
00113
00114 void setNextScale(float nextScale) { fNextScale = nextScale; }
00115 Boolean areChangingScale() const { return fNextScale != fScale; }
00116
00117 protected:
00118 void updateTSRecordNum();
00119 void reseekOriginalTransportStreamSource();
00120
00121 protected:
00122 MPEG2TransportStreamIndexFile* fIndexFile;
00123 ByteStreamFileSource* fOriginalTransportStreamSource;
00124 MPEG2TransportStreamTrickModeFilter* fTrickModeFilter;
00125 MPEG2TransportStreamFromESSource* fTrickPlaySource;
00126 MPEG2TransportStreamFramer* fFramer;
00127 float fScale, fNextScale, fNPT;
00128 unsigned long fTSRecordNum, fIxRecordNum;
00129 };
00130
00131 #endif