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 MN_STREAMER_H
00025
#define MN_STREAMER_H
00026
00027
#include "MNString.h"
00028
#include "MNSocket.h"
00029
#include "MNValid.h"
00030
#include "dataPump.h"
00031
#include "sdp/PayloadTypes.h"
00032
#include "sdp/RetransTypes.h"
00033
#include "sdp/TransportTypes.h"
00034
00035
#include <vector>
00036
00037
class KomServer;
00038
00039
class FileStreamerGM;
00040
class SendBlockStreamerGM;
00041
class LCRTPFileRecorderGM;
00042
class LCRTPCachingReflectorGM;
00043
class RTPReflectorGM;
00044
class PatchGM;
00045
class MNUDPSocket;
00046
class SDPSessionDescription;
00047
class TranscodingGM;
00048
class ServerGM;
00049
class ClientSideReflectorGM;
00050
00051 class MNStreamer :
public dataPump
00052 {
00053 DECLARE_VALID
00054
typedef std::vector<int> IntVector;
00055
typedef std::vector<int32_t*> BwVector;
00056
typedef std::vector<MNSocket*> SocketVector;
00057
typedef std::vector<SDP::PayloadTypes*> PayloadTypeVector;
00058
private:
00063
union GMChoice
00064 {
00065
ServerGM* all;
00066
ServerGM* fs;
00067
LCRTPFileRecorderGM* lcrecord;
00068
LCRTPCachingReflectorGM* lcreflect;
00069
RTPReflectorGM* reflect;
00070
PatchGM* patch;
00071
TranscodingGM* trans;
00072
ClientSideReflectorGM* clientSideReflectorGM;
00073 };
00074
00075
int _bandwidth;
00076 BwVector _bandwidth_vec;
00077
long _BytesPerSecond;
00078 GMChoice RTPServer;
00079
int _ClientPortDesired;
00080 IntVector _ClientPortDesiredVec;
00081
struct DescFile
00082 {
00083
bool _useLCRTP;
00084
00086
int _plannedPort;
00087
00089
bool _mc;
00090
00091
00092
00093 PayloadTypeVector _payload_vec;
00094 PayloadTypeVector _payload_codec_vec;
00095 SDP::RetransTypes _retrans;
00096
00097
float _playtime;
00098
00099 DescFile( )
00100 {
00101 _useLCRTP =
false;
00102 _plannedPort = -1;
00103 _mc =
false;
00104
00105
00106
00107
00108 _retrans = SDP::NONE;
00109 }
00110 };
00111
00112 DescFile _d;
00113
00115
MNString _mcHost;
00116
00118
00119
00120
00121 SocketVector _remote_up_main_rtp_vec;
00122 SocketVector _remote_up_main_rtcp_vec;
00123
00125
bool _gleaning;
00126
00128
int _memThreshold;
00129
00131
int _bufferSize;
00132
00134 RTSP::TransportTypes _req_transport;
00135
00136
private:
00138
MNStreamer(
const MNStreamer& );
00139
00141
MNStreamer& operator=(
const MNStreamer& );
00142
00143
public:
00144
MNStreamer(
MNSelector& sel,
DataPumpResponse* resp );
00145
00147
MNStreamer(
MNSelector& sel,
DataPumpResponse* resp,
SDPSessionDescription* sdesc );
00148
00149
virtual ~MNStreamer ( );
00150
00151
int getBandwidth(
const MNString& DescFileName );
00152
int getBandwidth(
int idx,
const MNString& DescFileName);
00153
static bool check_time(
const MNString& DescFileName,
MNString& time );
00154
00155
virtual int init ( KomServer* streamer,
StreamingType type );
00156
00173
virtual bool createUpstreamSocks(
int idx,
00174
int& requested,
00175
RTPSockets::FactoryMode mode,
00176 RTSP::TransportTypes requested_transport = RTSP::RTP_AVP_UDP );
00177
00196
virtual bool createDownstreamSocks(
int idx,
00197
int& requested,
00198
RTPSockets::FactoryMode mode,
00199 RTSP::TransportTypes requested_transport = RTSP::RTP_AVP_UDP );
00200
00205
virtual bool fillTransportString(
int idx,
MNString& out,
bool mc )
const;
00206
00207
virtual int stream_start (
int idx,
00208
const MNString& filename,
00209
const MNString& DescFileName,
00210
const MNString& client,
00211
const MNString& server,
00212
int ClientPortAnnounced,
00213
int ServerPortAnnounced );
00214
virtual void setupNewServerSideReflectorGM(
int idx);
00215
virtual void setupExistingServerSideReflectorGM(
int idx);
00216
virtual int play (
int start,
int stop );
00217
virtual int stop ( );
00218
void detach();
00219
virtual int pause ( );
00220
virtual int jump (
int cont_time );
00221
virtual void fileComplete(
const char* filename,
bool comp );
00222
virtual long getFilePos();
00223
00224 virtual void set_client_port(
int a ) { _ClientPortDesired = a;} ;
00225 virtual void set_client_port(
int idx,
int a ) { _ClientPortDesiredVec[idx] = a;} ;
00226
00228
void examineSDP();
00229
00238
00239
00240
00241
00242
00243
virtual void setMulticastInformation(
int idx,
00244
MNString server,
00245
MNSocket* main_rtp,
00246
MNSocket* main_rtcp );
00247
virtual void setBufferInformation(
int threshold,
int size );
00248
00249 virtual bool isPatchingCapable()
const {
return true; }
00250
00251
virtual void setNptSeek(
int npt);
00252
virtual int getNptSeconds();
00253
virtual void setRTPTimestamp(
int idx,
u_int32 rtptime);
00254
00255
00256
private:
00258
int private_open_file(
int idx,
const MNString& FileName );
00259 };
00260
00261
#endif
00262