sipxmedialib  Version 3.3
MpTopologyGraph.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2006-2008 SIPfoundry Inc.
3 // Licensed by SIPfoundry under the LGPL license.
4 //
5 // Copyright (C) 2006-2008 SIPez LLC.
6 // Licensed to SIPfoundry under a Contributor Agreement.
7 //
8 // $$
10 
11 // Author: Dan Petrie <dpetrie AT SIPez DOT com>
12 
13 #ifndef _MpTopologyGraph_h_
14 #define _MpTopologyGraph_h_
15 
16 // SYSTEM INCLUDES
17 // APPLICATION INCLUDES
18 #include <mp/MpFlowGraphBase.h>
19 
20 // DEFINES
21 // MACROS
22 // EXTERNAL FUNCTIONS
23 // EXTERNAL VARIABLES
24 // CONSTANTS
25 // STRUCTS
26 // TYPEDEFS
27 // FORWARD DECLARATIONS
28 class MpResourceTopology;
29 class MpResourceFactory;
30 
49 {
50 /* //////////////////////////// PUBLIC //////////////////////////////////// */
51 public:
52 
53 /* ============================ CREATORS ================================== */
55 
56 
59  int samplesPerSec,
60  MpResourceTopology& initialResourceTopology,
61  MpResourceFactory& resourceFactory,
62  OsMsgDispatcher *pNotifDispatcher = NULL);
63 
65  virtual ~MpTopologyGraph();
66 
68 
69 /* ============================ MANIPULATORS ============================== */
71 
72 
75  OsStatus addResources(MpResourceTopology& incrementalTopology,
76  MpResourceFactory* resourceFactory,
77  int resourceInstanceId);
93  OsStatus destroyResources(MpResourceTopology& resourceTopology,
96  int resourceInstanceId);
110  virtual OsStatus processNextFrame();
112 
114  virtual OsStatus gainFocus();
115 
117  virtual OsStatus loseFocus();
118 
120 
121 /* ============================ ACCESSORS ================================= */
123 
124 
127 
129  OsStatus lookupVirtualInput(const UtlString& virtualName,
130  int virtualPortIdx,
131  MpResource*& rpResource,
132  int &portIdx);
147  OsStatus lookupVirtualOutput(const UtlString& virtualName,
149  int virtualPortIdx,
150  MpResource*& rpResource,
151  int &portIdx);
166  OsStatus lookupInput(const UtlString& resourceName,
168  int portIdx,
169  MpResource*& pFoundResource,
170  int &foundPortIdx);
187  OsStatus lookupOutput(const UtlString& resourceName,
189  int portIdx,
190  MpResource*& pFoundResource,
191  int &foundPortIdx);
209 
210 /* ============================ INQUIRY =================================== */
212 
213 
215 
216 /* //////////////////////////// PROTECTED ///////////////////////////////// */
217 protected:
218 
220  virtual OsStatus postMessage(const MpFlowGraphMsg& message,
221  const OsTime& waitTime = OsTime::OS_INFINITY);
222 
223 
225  virtual UtlBoolean handleMessage(OsMsg& message);
226 
227 /* //////////////////////////// PRIVATE /////////////////////////////////// */
228 private:
229 
231  UtlHashMap mVirtualInputs;
232  UtlHashMap mVirtualOutputs;
233 
235  int addTopologyResources(MpResourceTopology& resourceTopology,
236  MpResourceFactory& resourceFactory,
237  UtlHashBag& newResources,
238  UtlBoolean replaceNumInName = FALSE,
239  int resourceNum = -1);
240 
242  int addVirtualInputs(MpResourceTopology& resourceTopology,
243  UtlHashBag& newResources,
244  UtlBoolean replaceNumInName = FALSE,
245  int resourceNum = -1);
246 
248  int removeVirtualInputs(MpResourceTopology& resourceTopology,
249  UtlBoolean replaceNumInName,
250  int resourceNum);
251 
253  int addVirtualOutputs(MpResourceTopology& resourceTopology,
254  UtlHashBag& newResources,
255  UtlBoolean replaceNumInName = FALSE,
256  int resourceNum = -1);
257 
259  int removeVirtualOutputs(MpResourceTopology& resourceTopology,
260  UtlBoolean replaceNumInName,
261  int resourceNum);
262 
264  int linkTopologyResources(MpResourceTopology& resourceTopology,
265  UtlHashBag& newResources,
266  UtlBoolean replaceNumInName = FALSE,
267  int resourceNum = -1);
268 
269 
271  MpTopologyGraph(const MpTopologyGraph& rMpTopologyGraph);
272 
273 
276 };
277 
278 /* ============================ INLINE METHODS ============================ */
279 
280 #endif // _MpTopologyGraph_h_
Message object used to communicate with the media processing task.
Definition: MpFlowGraphMsg.h:33
virtual OsStatus processNextFrame()
Extended processNextFrame() for diagnostic reasons.
Definition: MpTopologyGraph.cpp:179
int samplesPerFrame
int linkTopologyResources(MpResourceTopology &resourceTopology, UtlHashBag &newResources, UtlBoolean replaceNumInName=FALSE, int resourceNum=-1)
Adds links defined for resources in resource topology.
Definition: MpTopologyGraph.cpp:694
int addTopologyResources(MpResourceTopology &resourceTopology, MpResourceFactory &resourceFactory, UtlHashBag &newResources, UtlBoolean replaceNumInName=FALSE, int resourceNum=-1)
Adds all new resources defined in a topology.
Definition: MpTopologyGraph.cpp:434
virtual OsStatus gainFocus()
Informs the flow graph that it now has the MpMediaTask focus.
Definition: MpTopologyGraph.cpp:187
int addVirtualOutputs(MpResourceTopology &resourceTopology, UtlHashBag &newResources, UtlBoolean replaceNumInName=FALSE, int resourceNum=-1)
Adds all virtual outputs defined in a topology.
Definition: MpTopologyGraph.cpp:599
MpTopologyGraph & operator=(const MpTopologyGraph &rhs)
Disable assignment operator.
virtual UtlBoolean handleMessage(OsMsg &message)
Handle a message for this flowgraph.
Definition: MpTopologyGraph.cpp:173
Flow graph for coordinating the execution of media processing resources.
Definition: MpFlowGraphBase.h:91
OsStatus lookupInput(const UtlString &resourceName, int portIdx, MpResource *&pFoundResource, int &foundPortIdx)
Lookup real or virtual input port.
Definition: MpTopologyGraph.cpp:360
OsStatus destroyResources(void)
Stops the flow graph, removes all of the resources in the flow graph and destroys them...
Definition: MpFlowGraphBase.cpp:270
MpFlowGraphBase::FlowGraphType getType()
Definition: MpTopologyGraph.cpp:273
FlowGraphType
Definition: MpFlowGraphBase.h:107
int removeVirtualInputs(MpResourceTopology &resourceTopology, UtlBoolean replaceNumInName, int resourceNum)
Remove all virtual inputs defined in a topology from the flowgraph.
Definition: MpTopologyGraph.cpp:559
virtual ~MpTopologyGraph()
Destructor.
Definition: MpTopologyGraph.cpp:86
MpResourceFactory is used to construct resources by type name.
Definition: MpResourceFactory.h:61
OsStatus lookupVirtualOutput(const UtlString &virtualName, int virtualPortIdx, MpResource *&rpResource, int &portIdx)
Lookup real output port corresponding to given virtual one.
Definition: MpTopologyGraph.cpp:319
int removeVirtualOutputs(MpResourceTopology &resourceTopology, UtlBoolean replaceNumInName, int resourceNum)
Remove all virtual outputs defined in a topology from the flowgraph.
Definition: MpTopologyGraph.cpp:654
OsStatus lookupVirtualInput(const UtlString &virtualName, int virtualPortIdx, MpResource *&rpResource, int &portIdx)
Lookup real input port corresponding to given virtual one.
Definition: MpTopologyGraph.cpp:278
MpTopologyGraph(int samplesPerFrame, int samplesPerSec, MpResourceTopology &initialResourceTopology, MpResourceFactory &resourceFactory, OsMsgDispatcher *pNotifDispatcher=NULL)
Constructor.
Definition: MpTopologyGraph.cpp:41
Flowgraph with resources wired as defined in given topology and factory.
Definition: MpTopologyGraph.h:48
UtlHashMap mVirtualInputs
Virtual inputs mapping to real inputs.
Definition: MpTopologyGraph.h:231
OsStatus lookupOutput(const UtlString &resourceName, int portIdx, MpResource *&pFoundResource, int &foundPortIdx)
Lookup real or virtual output port.
Definition: MpTopologyGraph.cpp:394
virtual OsStatus loseFocus()
Informs the flow graph that it has lost the MpMediaTask focus.
Definition: MpTopologyGraph.cpp:230
OsStatus addResources(MpResourceTopology &incrementalTopology, MpResourceFactory *resourceFactory, int resourceInstanceId)
Add resource to the existing flowgraph as defined by given topology and optional factory.
Definition: MpTopologyGraph.cpp:105
MpResourceTopology is used to define a set of resources and how they are to be connected in a flowgra...
Definition: MpResourceTopology.h:123
int addVirtualInputs(MpResourceTopology &resourceTopology, UtlHashBag &newResources, UtlBoolean replaceNumInName=FALSE, int resourceNum=-1)
Adds all virtual inputs defined in a topology.
Definition: MpTopologyGraph.cpp:504
Abstract base class for all media processing objects.
Definition: MpResource.h:56
MpResourceFactory * mpResourceFactory
Factory for resources.
Definition: MpTopologyGraph.h:230
#define FALSE
Definition: PlgDefsV1.h:37
UtlHashMap mVirtualOutputs
Virtual outputs mapping to real outputs.
Definition: MpTopologyGraph.h:232
virtual OsStatus postMessage(const MpFlowGraphMsg &message, const OsTime &waitTime=OsTime::OS_INFINITY)
Post a message to be handled by this flowgraph.
Definition: MpTopologyGraph.cpp:166