Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

PlayerGM.h

Go to the documentation of this file.
00001 /* Copyright (C) 2000 KOM/Darmstadt University of Technology 00002 * 00003 * You are allowed to use all other parts of the code under the following terms: 00004 * 00005 * For non-commercial use, code may be used in unmodified form provided 00006 * that this copyright notice and this permission notice appear in 00007 * supporting documentation. 00008 * 00009 * This software is provided "as is" and without any express or implied 00010 * warranties, including, without limitation, the implied warranty of 00011 * fitness for a particular purpose. 00012 * 00013 * The code may be subjected to the GNU General Public License, Version 2, 00014 * and re-distributed under the terms of this license. 00015 * As a special exception, permission is granted to link this code 00016 * with the Qt library and distribute executables, as long as you 00017 * follow the requirements of the GNU GPL in regard to all of the 00018 * software in the executable aside from Qt. 00019 * 00020 * Commercial use other than under the terms of the GNU General Public 00021 * License is allowed only after express negotiation of conditions 00022 * with the authors. 00023 */ 00024 #ifndef PLAYER_GM_H 00025 #define PLAYER_GM_H 00026 00027 #include <sys/types.h> 00028 #include <sys/time.h> 00029 00030 #include "sh/SHGraphManager.h" 00031 #include "SDPMediaDescription.h" 00032 #include "MNUDPSocket.h" 00033 #include "MNRTPSockets.h" 00034 00035 class MpeglibPlayer; 00036 namespace SH 00037 { 00038 class SH; 00039 class RTPSourceSH; 00040 class RTPDecoderSH; 00041 class PushPullSH; 00042 class DataPopSinkSH; 00043 }; 00044 00045 class PlayerGM : public SHGraphManager 00046 { 00047 public: 00048 enum SourceMode 00049 { 00050 Uninitialized, 00051 RtpAny, 00052 RtpUnicastUDP, 00053 RtpMulticast 00054 }; 00055 00056 /******************************************************************* 00057 * PlayerGM::RtpPlay 00058 *******************************************************************/ 00059 00060 struct RtpPlay 00061 { 00062 RTPSockets* socks; 00063 MNSocket* rtpUdpSocket; 00064 MNSocket* rtcpUdpSocket; 00065 SH::RTPSourceSH* rtp; 00066 SH::RTPDecoderSH* rtpDecoder; 00067 int reqRtpPort; 00068 int rtpSenderPort; 00069 MNString rtpSenderHostname; 00070 bool multicast; 00071 00072 void init( ); 00073 void uninit( ); 00074 }; 00075 00080 struct Subsession { 00081 size_t _bandwidth; 00082 MDescPtr _mdesc; 00083 RtpPlay _r; 00084 SH::PushPullSH* _pushPullSH; 00085 SH::DataPopSinkSH* _popSinkSH; 00086 MNRope* _lastRope; 00087 struct timeval _lastPresentationTime; 00088 bool _synchronized; 00089 00090 }; 00091 00092 00093 private: 00101 MNList<struct Subsession*>* _subsessions; 00106 size_t _bandwidth; 00107 MDescPtr _mdesc; 00108 RtpPlay _r; 00109 SH::PushPullSH* _pushPullSH; 00110 SH::DataPopSinkSH* _popSinkSH; 00111 MNRope* _lastRope; 00112 00113 private: 00117 PlayerGM(const PlayerGM & orig); 00118 00122 PlayerGM& operator=( const PlayerGM& orig ); 00123 00124 public: 00127 PlayerGM(GMUser* user, MNSelector& sel ); 00128 00131 virtual ~PlayerGM( ); 00132 00135 void clear( ); 00136 00140 void addSubsession(Subsession* s); 00143 void addSubsession(); 00144 00163 virtual bool graphManNotify( int idx, 00164 SH::Base* caller, 00165 SH::Notification attribute, 00166 void* msg ); 00167 00179 void setMediaDesc( MDescPtr mdesc ); 00180 void setMediaDesc(int idx, MDescPtr mdesc); 00181 00188 void setRtpBandwidth( size_t bandwidth ); 00189 void setRtpBandwidth(int idx, size_t bandwidth); 00190 00198 void setRequestedPort( int port ); 00199 00200 void setRequestedPort(int idx, int port); 00201 00222 bool open( SourceMode sourceMode ); 00226 bool openall(SourceMode sourceMode); 00227 00237 int getOpenRtpPort( ) const; 00238 int getOpenRtpPort(int startPort) const; 00239 int getOpenRtpPort(Subsession* s) const; 00240 00243 void setRtpSenderPort( int port ); 00244 void setRtpSenderPort( int idx, int port); 00245 00248 void setRtpSenderHostname( const MNString& name ); 00249 void setRtpSenderHostname( int idx, const MNString& name ); 00250 00256 void getPT(int idx, struct timeval& presentationTime); 00257 00258 void resetSyncTime(); 00259 00266 bool hasBeenSynchronized(int idx); 00267 00276 bool start( ); 00279 bool startall( ); 00280 00283 void stop( ); 00287 void stopall( ); 00288 00289 int checkBuffer( ); 00293 int checkBuffer(int idx); 00294 int fillBuffer( unsigned char* buffer, int length ); 00297 int fillBuffer( int idx, unsigned char* buffer, int length ); 00298 00299 // /** The player has died, either completely unexpectedly or duing 00300 // * teardown due to a race condition in clearing the notifications. 00301 // * Report its demise to the automaton in the first case. 00302 // * @pre caller is Player<BR> 00303 // * state == Initializing || state == Initialized || 00304 // * state == Opening || state == Open 00305 // * state == Clear 00306 // */ 00307 // void ll_player_died( ); 00308 // 00309 // void teardown( ); 00310 // 00311 // inline void setVolume( double vol ) 00312 // { 00313 // if ( _llAsync ) _llAsync->DownSetVolume ( vol ); 00314 // } 00315 // 00316 // inline void setBalance( double bal ) 00317 // { 00318 // if ( _llAsync ) _llAsync->DownSetBalance ( bal ); 00319 // } 00320 // 00321 // inline void getFramesReport( ) 00322 // { 00323 // if ( _llAsync ) _llAsync->DownGetFrames ( ); 00324 // } 00325 // 00326 // inline void getPosReport( ) 00327 // { 00328 // if ( _llAsync ) _llAsync->DownGetPos ( ); 00329 // } 00330 // 00331 // inline void unpause( ) 00332 // { 00333 // // if ( _llAsync ) _llAsync->DownPlay( ); 00334 // if ( _llAsync ) _llAsync->DownCont( ); 00335 // } 00336 // 00337 // inline void pause( ) 00338 // { 00339 // if ( _llAsync ) _llAsync->DownPause ( ); 00340 // } 00341 // 00342 // friend ostream& operator<< ( ostream& ostr, State sm ); 00343 // friend ostream& operator<< ( ostream& ostr, SourceMode sm ); 00344 }; 00345 00346 #endif /* PLAYER_GM_H */

Generated on Sun Mar 6 13:35:49 2005 for Komssys by doxygen 1.3.8