00001
00002
00003
00004
#ifndef MN_TranscodingGM_H
00005
#define MN_TranscodingGM_H
00006
00007
#include <sys/types.h>
00008
#include "var_type.h"
00009
00010
#include "MNSem.h"
00011
#include "MNMutex.h"
00012
00013
#include "MNRTPutildefs.h"
00014
00015
#include "ServerGM.h"
00016
#include "SubGraphSH.h"
00017
#include "PullResizeSH.h"
00018
#include "SubGraphFactory.h"
00019
00020
namespace SH
00021 {
00022
class PushPullSH;
00023
class RTPDecoderSH;
00024
class RTPEncoderSH;
00025
class RTPSourceSH;
00026
class RTPSinkSH;
00027
class SubGraphSH;
00028
class PullResizeSH;
00029 };
00030
00035 class TranscodingGM :
public ServerGM{
00036
00037
00038
00039
class SelectorThread :
public MNThread,
public MNSelector{
00040
bool _running;
00041
public:
00042 SelectorThread();
00043 ~SelectorThread();
00044
void run();
00045
void stop();
00046 };
00047
00048
00049
00050
SH::RTPSourceSH* rtpSourceSH;
00051
SH::RTPDecoderSH* decoderSH;
00052
SH::PushPullSH* preBufferSH;
00053
00054
00055
SH::SubGraphSH* subGraphSH;
00056
SubGraphFactory subGraphFactory;
00057
00058
SH::PushPullSH* postBufferSH;
00059
SH::PullResizeSH* pullResizeSH;
00060
SH::RTPEncoderSH* encoderSH;
00061
SH::RTPSinkSH* rtpSinkSH;
00062
00063
MediaState streamer_state;
00064
MNSem eof_sig;
00065
MNMutex eof_lock;
00066
00067 SelectorThread rtpEncThread;
00068 SelectorThread subGraphThread;
00069
00070
MNString client;
00071
MNString server;
00072
00073
MNSocket* local_down_rtp;
00074
MNSocket* local_down_rtcp;
00075
MNSocket* local_up_rtp;
00076
MNSocket* local_up_rtcp;
00077
int DistantPortDown;
00078
int DistantPortUp;
00079
bool initialized;
00080
int requested_transport;
00081
bool runningEmpty;
00082
bool gotEOF;
00083
MNTimer _timer;
00084
00085
public:
00086
TranscodingGM(
GMUser* user,
MNSelector& sel, RTSP::TransportTypes _requested_transport = RTSP::RTP_AVP_UDP );
00087
virtual ~TranscodingGM();
00088
00089
virtual void init(
int idx);
00090
virtual void uninit();
00091
virtual void set_hostnames(
const MNString& Client,
const MNString& Server );
00092
virtual void set_ports(
int idx,
00093
MNSocket* locDownRtp,
00094
MNSocket* locDownRtcp,
00095
int distDown,
00096
MNSocket* locUpRtp,
00097
MNSocket* locUpRtcp,
00098
int distUp );
00099
virtual void start();
00100
virtual bool graphManNotify(
int idx,
SH::Base* caller, SH::Notification attribute,
void* msg );
00101
virtual bool synchronousGet( GetValue what,
u_int32& outVar );
00102
private:
00103
virtual int start_streamer(
int ,
int ){
00104
return 0;
00105 }
00106
00107
00108
public:
00109
virtual int open_file(
int idx,
00110
const char* name ,
00111
int rtp_pt,
00112 SDP::PayloadTypes int_pt,
00113
u_int32 bw,
00114 SDP::RetransTypes int_rt,
00115
int packetsize );
00116
virtual int play(
int startp,
int stopp );
00117
virtual int stop( );
00118
virtual int pause( );
00119
virtual int jump (
long pos );
00120
void set_write_to_file(
bool yes );
00121 };
00122
00124
00125
#endif