00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
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
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
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344 };
00345
00346 #endif