liveMedia/include/MPEG2TransportFileServerMediaSubsession.hh

Go to the documentation of this file.
00001 /**********
00002 This library is free software; you can redistribute it and/or modify it under
00003 the terms of the GNU Lesser General Public License as published by the
00004 Free Software Foundation; either version 2.1 of the License, or (at your
00005 option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.)
00006 
00007 This library is distributed in the hope that it will be useful, but WITHOUT
00008 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00009 FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for
00010 more details.
00011 
00012 You should have received a copy of the GNU Lesser General Public License
00013 along with this library; if not, write to the Free Software Foundation, Inc.,
00014 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
00015 **********/
00016 // "liveMedia"
00017 // Copyright (c) 1996-2008 Live Networks, Inc.  All rights reserved.
00018 // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s
00019 // on demand, from a MPEG-2 Transport Stream file.
00020 // C++ header
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_INDEX_FILE_HH
00029 #include "MPEG2TransportStreamIndexFile.hh"
00030 #endif
00031 
00032 class ClientTrickPlayState; // forward
00033 
00034 class MPEG2TransportFileServerMediaSubsession: public FileServerMediaSubsession{
00035 public:
00036   static MPEG2TransportFileServerMediaSubsession*
00037   createNew(UsageEnvironment& env,
00038             char const* dataFileName, char const* indexFileName,
00039             Boolean reuseFirstSource);
00040 
00041 protected:
00042   MPEG2TransportFileServerMediaSubsession(UsageEnvironment& env,
00043                                           char const* fileName,
00044                                           MPEG2TransportStreamIndexFile* indexFile,
00045                                           Boolean reuseFirstSource);
00046       // called only by createNew();
00047   virtual ~MPEG2TransportFileServerMediaSubsession();
00048 
00049 private: // redefined virtual functions
00050   // Note that because - to implement 'trick play' operations - we're operating on
00051   // more than just the input source, we reimplement some functions that are
00052   // already implemented in "OnDemandServerMediaSubsession", rather than
00053   // reimplementing "seekStreamSource()" and "setStreamSourceScale()":
00054   virtual void startStream(unsigned clientSessionId, void* streamToken,
00055                            TaskFunc* rtcpRRHandler,
00056                            void* rtcpRRHandlerClientData,
00057                            unsigned short& rtpSeqNum,
00058                            unsigned& rtpTimestamp);
00059   virtual void pauseStream(unsigned clientSessionId, void* streamToken);
00060   virtual void seekStream(unsigned clientSessionId, void* streamToken, double seekNPT);
00061   virtual void setStreamScale(unsigned clientSessionId, void* streamToken, float scale);
00062   virtual void deleteStream(unsigned clientSessionId, void*& streamToken);
00063 
00064   // The virtual functions thare are usually implemented by "ServerMediaSubsession"s:
00065   virtual FramedSource* createNewStreamSource(unsigned clientSessionId,
00066                                               unsigned& estBitrate);
00067   virtual RTPSink* createNewRTPSink(Groupsock* rtpGroupsock,
00068                                     unsigned char rtpPayloadTypeIfDynamic,
00069                                     FramedSource* inputSource);
00070 
00071   virtual void testScaleFactor(float& scale);
00072   virtual float duration() const;
00073 
00074 private:
00075   ClientTrickPlayState* lookupClient(unsigned clientSessionId);
00076 
00077 private:
00078   MPEG2TransportStreamIndexFile* fIndexFile;
00079   float fDuration;
00080   HashTable* fClientSessionHashTable; // indexed by client session id
00081 };
00082 
00083 #endif

Generated on Fri Dec 19 21:58:18 2008 for live by  doxygen 1.5.2