00001
00002
#ifndef MN_STREAM_HANDLER_H
00003
#define MN_STREAM_HANDLER_H
00004
00005
#include <sys/types.h>
00006
00007
#include "MNMutex.h"
00008
#include "MNAttr.h"
00009
#include "MNdictionary.h"
00010
#include "MNSelector.h"
00011
#include "dictionary.h"
00012
#include "SHReturnCodes.h"
00013
#include "SHStates.h"
00014
#include "SHEndpoint.h"
00015
#include "SHAttr.h"
00016
#include "SHStatus.h"
00017
#include "SHReport.h"
00018
#include "var_type.h"
00019
00024
class SHGraphManager;
00025
00026
namespace SH
00027 {
00028
00029
00030
00031
00032
00039 class Base
00040 :
public Status
00041 ,
public AttributeStore
00042 {
00043
public:
00064
Base(
SHGraphManager*
mgr,
u_int32_t runtimeId,
MNSelector& sel );
00065
00072
virtual ~Base();
00073
00076
SHGraphManager*
mgr();
00077
00078
MNSelector&
mainSelector();
00079
00091
virtual SH_RC initSH();
00092
00097
virtual SH_RC uninitSH();
00098
00105
virtual SH_RC startStreaming();
00106
00113
virtual SH_RC stopStreaming();
00114
00115
virtual u_int16 get_rtp_seq();
00116
virtual u_int32 get_rtp_time();
00117
00118
virtual SH_RC changePos(
u_int64 bytepos );
00119
00120
private:
00121
00126
Base(
const Base& );
00127
00132
Base& operator=(
const Base& );
00133
00134
00135
00136
00137
protected:
00138
friend class Endpoint;
00139
friend class SinkEndpoint;
00140
friend class SourceEndpoint;
00141
00142
public:
00143 enum Direction
00144 {
00145
ReportUpstream,
00146
ReportDownstream
00147 };
00148
00149
protected:
00160
virtual void pushReport(
ReportPtr report, Direction d );
00161
00162
00163
00164
00165
public:
00180 class SHSide
00181 {
00182
protected:
00183
friend class Base;
00184
00185 class EndpointTable
00186 :
public MNdictionary<Endpoint*,Endpoint*>
00187 {
00188
public:
00189
virtual int compare(
Endpoint*
const& l,
00190
Endpoint*
const& r )
const;
00191 };
00192
00195
SHSide();
00196
00199
~SHSide();
00200
00218
SH_RC validateUnconnected(
Endpoint* dp );
00219
00236
SH_RC connected(
Endpoint* dp );
00237
00238
private:
00243
MNMutex _instantiation_lock;
00244
00249 size_t _count;
00250
00251
00257
EndpointTable _unconnected;
00258
00261
EndpointTable _connected;
00262 };
00263
00264
bool match(
Base* downstream );
00265
bool match(
SourceEndpoint* ep,
Base* otherSH,
SinkEndpoint* otherEP );
00266
00267
public:
00280
00281
00282
00289
SH_RC connectSourceEndpoint(
Endpoint* ep,
Base* otherSH,
Endpoint* otherEP );
00290
SH_RC connectSinkEndpoint(
Endpoint* ep,
Base* otherSH,
Endpoint* otherEP ) ;
00291
00295
SH_RC releaseSourceEndpoint(
Endpoint* ep );
00296
SH_RC releaseSinkEndpoint(
Endpoint* ep );
00297
00298
private:
00304
SHGraphManager* _manager;
00305
00310
const u_int32_t _runtime_id;
00311
00316
MNSelector& _main_selector;
00317
00323
State _state;
00324
00329
bool _invalid;
00330
00334
SHSide _sink_side;
00335
00339
SHSide _source_side;
00340
00341
protected:
00344 inline u_int32_t runtimeId()
const {
return _runtime_id; };
00345 };
00346
00347 };
00348
00350
00351
#endif
00352