14 #ifndef _MpResource_h_ 15 #define _MpResource_h_ 19 #include "os/OsDefs.h" 20 #include "os/OsRWMutex.h" 21 #include "os/OsStatus.h" 22 #include "os/OsMsgQ.h" 23 #include "utl/UtlContainable.h" 24 #include "utl/UtlString.h" 78 static const UtlContainableType
TYPE;
115 static OsStatus
disable(
const UtlString& namedResource,
136 virtual UtlBoolean
enable();
155 static OsStatus
enable(
const UtlString& namedResource,
176 virtual void reset();
182 const UtlString& namedResource,
297 int& rUpstreamPortIdx);
308 const UtlString &
getName()
const;
313 int& rDownstreamPortIdx);
378 virtual OsStatus
getCurrentLatency(
int &latency,
int input=0,
int output=0)
const;
596 void setName(
const UtlString& rName);
612 #endif // _MpResource_h_ UtlBoolean isInputConnected(int portIdx)
Returns TRUE if portIdx is valid and the indicated input is connected, FALSE otherwise.
Definition: MpResource.cpp:447
VisitState
Graph traversal states that are used when running a topological sort to order resources within a flow...
Definition: MpResource.h:65
Message object used to communicate with the media processing task.
Definition: MpFlowGraphMsg.h:33
OsRWMutex mRWMutex
reader/writer lock for synchronization
Definition: MpResource.h:473
Message object used to communicate with the media processing task.
Definition: MpResourceMsg.h:30
UtlBoolean isOutputConnected(int portIdx)
Returns TRUE if portIdx is valid and the indicated output is connected, FALSE otherwise.
Definition: MpResource.cpp:471
int minInputs() const
Returns the minimum number of inputs required by this resource.
Definition: MpResource.cpp:363
MpFlowGraphBase * mpFlowGraph
flow graph this resource belongs to
Definition: MpResource.h:467
int minOutputs() const
Returns the minimum number of outputs required by this resource.
Definition: MpResource.cpp:369
UtlBoolean areNotificationsEnabled() const
Returns TRUE if notification sending is enabled on this resource.
Definition: MpResource.cpp:493
MpBufPtr * mpInBufs
input buffers for this resource
Definition: MpResource.h:475
void setInputBuffer(int inPortIdx, const MpBufPtr &pBuf)
If there already is a buffer stored for this input port, delete it. Then store pBuf for the indicated...
Definition: MpResource.cpp:635
void getInputInfo(int inPortIdx, MpResource *&rpUpstreamResource, int &rUpstreamPortIdx)
Returns information about the upstream end of a connection.
Definition: MpResource.cpp:301
The Conn object maintains information about the "far end" of a connection.
Definition: MpResource.h:460
MpFlowGraphBase * getFlowGraph() const
Returns parent flowgraph.
Definition: MpResource.cpp:293
int reserveFirstUnconnectedInput()
Find the first unconnected input port and reserve it.
Definition: MpResource.cpp:386
Flow graph for coordinating the execution of media processing resources.
Definition: MpFlowGraphBase.h:91
void getOutputInfo(int outPortIdx, MpResource *&rpDownstreamResource, int &rDownstreamPortIdx)
Returns information about the downstream end of a connection.
Definition: MpResource.cpp:326
int mMinInputs
number of required inputs
Definition: MpResource.h:481
UtlBoolean isOutputUnconnected(int portIdx)
Returns TRUE if portIdx is valid and the indicated output is not connected, FALSE otherwise...
Definition: MpResource.cpp:483
virtual int getStreamId(void)
Get the ID of a stream within the connection this resource belongs to.
Definition: MpResource.cpp:224
MpConnectionID mConnectionId
The ID of connection this resource belongs to.
Definition: MpResource.h:468
UtlBoolean handleMessages(OsMsgQ &msgQ)
Handles a queue full of incoming messages for this media processing object.
Definition: MpResource.cpp:561
UtlBoolean pushBufferDownsream(int outPortIdx, const MpBufPtr &pBuf)
Makes pBuf available to resource connected to the outPortIdx output port of this resource.
Definition: MpResource.cpp:650
UtlBoolean mNotificationsEnabled
Whether we should send notifications or not.
Definition: MpResource.h:486
Get input or output latency, associated with a resource.
Definition: MpResource.h:74
void setName(const UtlString &rName)
Sets the name that is associated with this resource.
Definition: MpResource.cpp:813
Conn * mpInConns
input connections for this resource
Definition: MpResource.h:477
UtlBoolean reserved
this port is reserved to be used
Definition: MpResource.h:464
virtual OsStatus getCurrentLatency(int &latency, int input=0, int output=0) const
Get current input to output latency (in samples)
Definition: MpResource.cpp:425
virtual OsStatus setFlowGraph(MpFlowGraphBase *pFlowGraph)
Associates this resource with the indicated flow graph.
Definition: MpResource.cpp:796
virtual void setStreamId(int streamId)
Set the ID of a stream inside of the connection this resource belongs to.
Definition: MpResource.cpp:219
int portIndex
Port number on the other end of the connection.
Definition: MpResource.h:463
UtlBoolean isInputUnconnected(int portIdx)
Returns TRUE if portIdx is valid and the indicated input is not connected, FALSE otherwise.
Definition: MpResource.cpp:459
int mMaxInputs
maximum number of inputs
Definition: MpResource.h:479
virtual UtlBoolean isAsynchInput(int inputIndex)
Takes asynchronous input (pushBuffer).
Definition: MpResource.cpp:499
virtual void reassignSSRC(void)
Broadcast announcement that we are changing our SSRC.
Definition: MpResource.cpp:234
Conn * mpOutConns
output connections for this resource
Definition: MpResource.h:478
virtual UtlBoolean connectInput(MpResource &rFrom, int fromPortIdx, int toPortIdx)
Connects the toPortIdx input port on this resource to the fromPortIdx output port of the rFrom resour...
Definition: MpResource.cpp:715
int mMinOutputs
number of required outputs
Definition: MpResource.h:482
static void resourceInfo(MpResource *pResource, int index)
Displays information on the console about the specified resource.
Definition: MpResource.cpp:240
static const OsTime sOperationQueueTimeout
The timeout for message operations for all resources when posting to the flowgraph queue...
Definition: MpResource.h:489
virtual UtlBoolean disable()
Disable this resource.
Definition: MpResource.cpp:121
int numInputs() const
Returns the number of resource inputs that are currently connected.
Definition: MpResource.cpp:375
virtual ~MpResource()
Destructor.
Definition: MpResource.cpp:91
virtual UtlBoolean connectOutput(MpResource &rTo, int toPortIdx, int fromPortIdx)
Connects the fromPortIdx output port on this resource to the toPortIdx input port of the rTo resource...
Definition: MpResource.cpp:736
MpResource * pResource
Other end of the connection.
Definition: MpResource.h:462
int mMaxOutputs
maximum number of outputs
Definition: MpResource.h:480
Infinite latency, i.e. data from the input is not sent to the output.
Definition: MpResource.h:75
virtual UtlBoolean disconnectInput(int inPortIdx)
Removes the connection to the inPortIdx input port of this resource.
Definition: MpResource.cpp:756
MpBufPtr * mpOutBufs
output buffers for this resource
Definition: MpResource.h:476
int getVisitState()
Returns the current visit state for this resource.
Definition: MpResource.cpp:345
Definition: MpResource.h:68
const UtlString & getName() const
Returns the name associated with this resource.
Definition: MpResource.cpp:318
static OsStatus setNotificationsEnabled(UtlBoolean enable, const UtlString &namedResource, OsMsgQ &fgQ)
Post a message to enable or disable resource notifications on the named resource. ...
Definition: MpResource.cpp:165
Definition: MpResource.h:69
Definition: MpResNotificationMsg.h:31
UtlContainableType getContainableType() const
Get the ContainableType for a UtlContainable derived class.
Definition: MpResource.cpp:420
MpResource & operator=(const MpResource &rhs)
Assignment operator (not implemented for this class)
MpResource(const UtlString &rName, int minInputs, int maxInputs, int minOutputs, int maxOutputs)
Constructor.
Definition: MpResource.cpp:39
int mVisitState
(used by flow graph topological sort alg.)
Definition: MpResource.h:485
int reserveFirstUnconnectedOutput()
Find the first unconnected output port and reserve it.
Definition: MpResource.cpp:403
virtual UtlBoolean handleEnable()
perform the enable operation on the resource
Definition: MpResource.cpp:611
virtual UtlBoolean enable()
Enable this resource.
Definition: MpResource.cpp:145
Smart pointer to MpBuf.
Definition: MpBuf.h:160
int maxOutputs() const
Returns the maximum number of outputs supported by this resource.
Definition: MpResource.cpp:357
virtual UtlBoolean disconnectOutput(int outPortIdx)
Removes the connection to the outPortIdx output port of this resource.
Definition: MpResource.cpp:776
int mNumActualInputs
actual number of connected inputs
Definition: MpResource.h:483
int MpConnectionID
Flowgraph connection ID.
Definition: MpTypes.h:56
OsBSem mLock
used mainly to make safe changes to ports
Definition: MpResource.h:487
int maxInputs() const
Returns the maximum number of inputs supported by this resource.
Definition: MpResource.cpp:351
virtual OsStatus pushBuffer(int inputPort, MpBufPtr &inputBuffer)
Receive buffer asynchronously from resource at given input port.
Definition: MpResource.cpp:229
virtual void reset()
This method is invoked for resources that care about stream discontinuities.
Definition: MpResource.cpp:161
RNMsgType
Phone set message types.
Definition: MpResNotificationMsg.h:37
int mStreamId
Definition: MpResource.h:469
void setVisitState(int newState)
Sets the visit state for this resource.
Definition: MpResource.cpp:178
Definition: MpResource.h:67
int numOutputs() const
Returns the number of resource outputs that are currently connected.
Definition: MpResource.cpp:381
int mNumActualOutputs
actual number of connected outputs
Definition: MpResource.h:484
Abstract base class for all media processing objects.
Definition: MpResource.h:56
virtual UtlBoolean handleDisable()
perform the disable operation on the resource
Definition: MpResource.cpp:622
OsStatus sendNotification(MpResNotificationMsg::RNMsgType msgType)
Send a notification with the given message type if notifications are enabled.
Definition: MpResource.cpp:186
static const UtlContainableType TYPE
Class name, used for run-time checks.
Definition: MpResource.h:78
virtual void setConnectionId(MpConnectionID connectionId)
Set the ID of a connection this resource belongs to.
Definition: MpResource.cpp:209
UtlBoolean mIsEnabled
TRUE if resource is enabled, FALSE otherwise.
Definition: MpResource.h:471
virtual MpConnectionID getConnectionId(void) const
Get the ID of a connection this resource belongs to.
Definition: MpResource.cpp:214
virtual UtlBoolean processFrame()=0
This method is called in every flowgraph processing cycle.
OsStatus postMessage(MpFlowGraphMsg &rMsg)
Post a message from this resource.
Definition: MpResource.cpp:678
UtlBoolean isEnabled() const
Returns TRUE is this resource is currently enabled, FALSE otherwise.
Definition: MpResource.cpp:440
virtual UtlBoolean handleMessage(MpFlowGraphMsg &fgMsg)
Handles an incoming flowgraph message for this media processing object.
Definition: MpResource.cpp:508