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
#ifndef MN_FileStreamerGM_H
00026
#define MN_FileStreamerGM_H
00027
00028
#include <sys/types.h>
00029
#include "var_type.h"
00030
00031
#include "ServerGM.h"
00032
#include "MNFileSourceSH.h"
00033
#include "MNSem.h"
00034
#include "MNMutex.h"
00035
#include "MNRTPutildefs.h"
00036
00037
#define min(a, b) (((a) < (b))? (a): (b))
00038
00039
namespace SH
00040 {
00041
class Base;
00042
class RTPEncoderSH;
00043
class DummyLayerSourceSH;
00044 };
00045
00046
class MNUDPSocket;
00047
00052 class FileStreamerGM :
public ServerGM
00053 {
00054
struct timeval* _tv;
00055
00056
union
00057
{
00058
SH::Base* a;
00059
SH::FileSourceSH* f;
00060
SH::DummyLayerSourceSH* d;
00061 } _fsh;
00062
SH::RTPEncoderSH* _esh;
00063
SH::Base* _ssh;
00064
MNString _client;
00065
00066
MediaState _streamer_state;
00067
MNSem _eof_sig;
00068
MNMutex _eof_lock;
00069
bool _initialized;
00070
00073
bool _udl;
00074
00075
MNSocket* _local_down_rtp;
00076
MNSocket* _local_down_rtcp;
00077
int _DistantPortDown;
00078
00079 RTSP::TransportTypes _requested_transport;
00080
00081
public:
00099
FileStreamerGM(
GMUser* user,
00100
MNSelector& sel,
00101
bool useDummyLayerSource =
false,
00102 RTSP::TransportTypes requested_transport = RTSP::RTP_AVP_UDP );
00103
00107
virtual ~FileStreamerGM();
00108
00114
virtual void init(
int idx);
00115
00118
virtual void uninit();
00119
00120
virtual u_int32 getSsrc();
00121
00126
virtual void start();
00127
00136
virtual void set_hostnames(
const MNString& client,
const MNString& server );
00137
virtual void set_ports(
int idx,
00138
MNSocket* locDownRtp,
00139
MNSocket* locDownRtcp,
00140
int distDown,
00141
MNSocket* locUpRtp,
00142
MNSocket* locUpRtcp,
00143
int distUp );
00144
virtual bool graphManNotify(
int idx,
SH::Base* caller, SH::Notification attribute,
void* msg );
00145
00146
private:
00147
virtual int start_streamer(
int idx,
int bandwidth );
00148
00149
public:
00150
00173
virtual int open_file(
int idx,
00174
const char* name,
00175
int rtp_pt,
00176 SDP::PayloadTypes int_pt,
00177
u_int32 bw,
00178 SDP::RetransTypes int_rt,
00179
int packetsize );
00180
virtual int play(
int startp,
int stopp );
00181
virtual int stop( );
00182
virtual int pause( );
00183
virtual int jump (
long pos );
00184
virtual long getFilePos();
00185
00198
void send_forced( size_t timeout, size_t packetsize );
00199
00203
void stop_forced( );
00204
00208
void recv_forced( );
00209
00211
virtual bool synchronousGet( GetValue what,
u_int32& outVar );
00212
00213
00214
00215
00221 void set_repeat_times(
u_int32 ) { }
00222 };
00223
00225
00226
#endif
00227