liveMedia/include/OnDemandServerMediaSubsession.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.
00020 // C++ header
00021 
00022 #ifndef _ON_DEMAND_SERVER_MEDIA_SUBSESSION_HH
00023 #define _ON_DEMAND_SERVER_MEDIA_SUBSESSION_HH
00024 
00025 #ifndef _SERVER_MEDIA_SESSION_HH
00026 #include "ServerMediaSession.hh"
00027 #endif
00028 #ifndef _RTP_SINK_HH
00029 #include "RTPSink.hh"
00030 #endif
00031 
00032 class OnDemandServerMediaSubsession: public ServerMediaSubsession {
00033 protected: // we're a virtual base class
00034   OnDemandServerMediaSubsession(UsageEnvironment& env, Boolean reuseFirstSource,
00035                                 portNumBits initialPortNum = 6970);
00036   virtual ~OnDemandServerMediaSubsession();
00037 
00038 protected: // redefined virtual functions
00039   virtual char const* sdpLines();
00040   virtual void getStreamParameters(unsigned clientSessionId,
00041                                    netAddressBits clientAddress,
00042                                    Port const& clientRTPPort,
00043                                    Port const& clientRTCPPort,
00044                                    int tcpSocketNum,
00045                                    unsigned char rtpChannelId,
00046                                    unsigned char rtcpChannelId,
00047                                    netAddressBits& destinationAddress,
00048                                    u_int8_t& destinationTTL,
00049                                    Boolean& isMulticast,
00050                                    Port& serverRTPPort,
00051                                    Port& serverRTCPPort,
00052                                    void*& streamToken);
00053   virtual void startStream(unsigned clientSessionId, void* streamToken,
00054                            TaskFunc* rtcpRRHandler,
00055                            void* rtcpRRHandlerClientData,
00056                            unsigned short& rtpSeqNum,
00057                            unsigned& rtpTimestamp);
00058   virtual void pauseStream(unsigned clientSessionId, void* streamToken);
00059   virtual void seekStream(unsigned clientSessionId, void* streamToken, float seekNPT);
00060   virtual void setStreamScale(unsigned clientSessionId, void* streamToken, float scale);
00061   virtual void deleteStream(unsigned clientSessionId, void*& streamToken);
00062 
00063 protected: // new virtual functions, possibly redefined by subclasses
00064   virtual char const* getAuxSDPLine(RTPSink* rtpSink,
00065                                     FramedSource* inputSource);
00066   virtual void seekStreamSource(FramedSource* inputSource, float seekNPT);
00067   virtual void setStreamSourceScale(FramedSource* inputSource, float scale);
00068   virtual void closeStreamSource(FramedSource *inputSource);
00069 
00070 protected: // new virtual functions, defined by all subclasses
00071   virtual FramedSource* createNewStreamSource(unsigned clientSessionId,
00072                                               unsigned& estBitrate) = 0;
00073       // "estBitrate" is the stream's estimated bitrate, in kbps
00074   virtual RTPSink* createNewRTPSink(Groupsock* rtpGroupsock,
00075                                     unsigned char rtpPayloadTypeIfDynamic,
00076                                     FramedSource* inputSource) = 0;
00077 
00078 private:
00079   void setSDPLinesFromRTPSink(RTPSink* rtpSink, FramedSource* inputSource);
00080       // used to implement "sdpLines()"
00081 
00082 private:
00083   Boolean fReuseFirstSource;
00084   portNumBits fInitialPortNum;
00085   HashTable* fDestinationsHashTable; // indexed by client session id
00086   void* fLastStreamToken;
00087   char* fSDPLines;
00088   char fCNAME[100]; // for RTCP
00089   friend class StreamState;
00090 };
00091 
00092 #endif

Generated on Tue Oct 7 15:38:09 2008 for live by  doxygen 1.5.2