00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
#ifndef MN_PatchGM_H
00027
#define MN_PatchGM_H
00028
00029
#include <sys/types.h>
00030
#include "var_type.h"
00031
00032
#include "ServerGM.h"
00033
#include "MNSem.h"
00034
#include "MNMutex.h"
00035
#include "MNString.h"
00036
#include "MNRTPutildefs.h"
00037
#include "sdp/PayloadTypes.h"
00038
00039
namespace SH
00040 {
00041
class Base;
00042
class RTPSourceSH;
00043
class RTPSinkSH;
00044
class RTPDecoderSH;
00045
class RTPEncoderSH;
00046
class ConcatinizerSH;
00047
class FileSinkSH;
00048
class PushPullSH;
00049 };
00050
00055 class PatchGM :
public ServerGM
00056 {
00057
struct timeval* _tv;
00058
00059
SH::RTPSourceSH* _patchSource;
00060
SH::RTPDecoderSH* _patchDecoder;
00061
SH::PushPullSH* _patchQueue;
00062
SH::RTPSourceSH* _mainSource;
00063
SH::RTPDecoderSH* _mainDecoder;
00064
SH::PushPullSH* _mainQueue;
00065
SH::ConcatinizerSH* _concatinizer;
00066
SH::FileSinkSH* _fileCache;
00067
SH::PushPullSH* _netQueue;
00068
SH::RTPEncoderSH* _netEncoder;
00069
SH::RTPSinkSH* _netSink;
00070
00071
MediaState _streamer_state;
00072
MNSem _eof_sig;
00073
MNMutex _eof_lock;
00074
00075
MNMutex _notifyLock;
00076
00077
MNString _mainServer;
00078
MNString _patchServer;
00079
MNString _client;
00080
00081
00082
int _DistantPortUp;
00083
00084
00085
int _DistantPortDown;
00086
00087
MNSocket* _local_upstream_main_rtp;
00088
MNSocket* _local_upstream_main_rtcp;
00089
MNSocket* _local_upstream_patch_rtp;
00090
MNSocket* _local_upstream_patch_rtcp;
00091
MNSocket* _local_down_rtp;
00092
MNSocket* _local_down_rtcp;
00093
00094
bool _cachingEnabled;
00095
bool _patchComplete;
00096
bool _mainComplete;
00097
bool _netComplete;
00098
00099
public:
00100
PatchGM(
GMUser* user,
MNSelector& sel,
bool cachingEnabled );
00101
00102
virtual ~PatchGM();
00103
00104
virtual void init(
int idx);
00105
00106
virtual void uninit();
00107
virtual void start();
00108
00109
virtual void set_hostnames(
const MNString& Client,
const MNString& Server );
00110
virtual void set_ports(
int idx,
00111
MNSocket* locDownRtp,
00112
MNSocket* locDownRtcp,
00113
int distDown,
00114
MNSocket* locUpRtp,
00115
MNSocket* locUpRtcp,
00116
int distUp );
00117
00118
private:
00119
virtual int start_streamer(
int idx,
int bandwidth );
00120
public:
00121
virtual int open_file(
int idx,
00122
const char* name,
00123
int rtp_pt,
00124 SDP::PayloadTypes int_pt,
00125
u_int32 bw,
00126 SDP::RetransTypes int_rt,
00127
int packetsize );
00128
virtual int play(
int startp,
int stopp );
00129
virtual int stop( );
00130
virtual int pause( );
00131
virtual int jump (
long pos );
00132
00133
virtual bool graphManNotify(
int idx,
00134
SH::Base* caller,
00135 SH::Notification attribute,
00136
void* msg );
00137
00138
void setMainSource(
MNString hostname,
00139
MNSocket* mainRtp,
00140
MNSocket* mainRtcp );
00141
void setBufferOptions(
int threshold,
int size);
00142 };
00143
00145
00146
#endif