sipxmedialib  Version 3.3
MprVad.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2008-2014 SIPez LLC. All right reserved.
3 //
4 // Copyright (C) 2008 SIPfoundry Inc.
5 // Licensed by SIPfoundry under the LGPL license.
6 //
7 // $$
9 
10 // Author: Alexander Chemeris <Alexander DOT Chemeris AT SIPez DOT com>
11 
12 #ifndef _MprVad_h_
13 #define _MprVad_h_
14 
15 // SYSTEM INCLUDES
16 // APPLICATION INCLUDES
17 #include <mp/MpAudioResource.h>
18 #include <mp/MpResourceMsg.h>
19 #include <mp/MprDecode.h>
20 
21 // DEFINES
22 // MACROS
23 // EXTERNAL FUNCTIONS
24 // EXTERNAL VARIABLES
25 // STRUCTS
26 // TYPEDEFS
27 // FORWARD DECLARATIONS
28 class MpVadBase;
29 class UtlSerialized;
30 
36 class MprVad : public MpAudioResource
37 {
38 /* //////////////////////////////// PUBLIC //////////////////////////////// */
39 public:
40 
41 /* =============================== CREATORS =============================== */
43 
44 
46  MprVad(const UtlString& rName, const UtlString &vadAlgorithm = "");
51  ~MprVad();
53 
55 
56 /* ============================= MANIPULATORS ============================= */
58 
59 
61  static OsStatus setVadParameter(const UtlString& parameterName,
62  int parameterValue,
63  const UtlString& resourceName,
64  OsMsgQ& flowgraphQueue);
76  static OsStatus changeVadAlgorithm(const UtlString& namedResource,
78  OsMsgQ& fgQ,
79  const UtlString &vadAlgorithm);
87 
88 /* ============================== ACCESSORS =============================== */
90 
91 
92 
94 
95 /* =============================== INQUIRY ================================ */
97 
98 
99 
101 
102 /* ////////////////////////////// PROTECTED /////////////////////////////// */
103 protected:
104 
105  enum
106  {
108  // WARNING: be sure to not conflict with MprDecode::MPRM_SET_VAD_PARAM
109 
111  };
112 
114 
116  UtlBoolean doProcessFrame(MpBufPtr inBufs[],
117  MpBufPtr outBufs[],
118  int inBufsSize,
119  int outBufsSize,
120  UtlBoolean isEnabled,
121  int samplesPerFrame,
122  int samplesPerSecond);
123 
125  UtlBoolean handleMessage(MpResourceMsg& rMsg);
126 
128  UtlBoolean handleChageVadAlgorithm(const UtlString &vadAlgorithm);
129 
131  UtlBoolean handleSetVadParam(UtlSerialized& serialData);
132 
134  OsStatus setFlowGraph(MpFlowGraphBase* pFlowGraph);
135 
136 /* /////////////////////////////// PRIVATE //////////////////////////////// */
137 private:
138 
139 };
140 
141 /* ============================ INLINE METHODS ============================ */
142 
143 #endif // _MprVad_h_
Message object used to communicate with the media processing task.
Definition: MpResourceMsg.h:30
MprVad(const UtlString &rName, const UtlString &vadAlgorithm="")
Constructor.
Definition: MprVad.cpp:37
Definition: MprVad.h:110
UtlBoolean doProcessFrame(MpBufPtr inBufs[], MpBufPtr outBufs[], int inBufsSize, int outBufsSize, UtlBoolean isEnabled, int samplesPerFrame, int samplesPerSecond)
This method does the real work for the media processing resource and must be defined in each class de...
Definition: MprVad.cpp:92
int samplesPerFrame
Definition: MpVadBase.h:40
Definition: MpResourceMsg.h:56
UtlBoolean handleChageVadAlgorithm(const UtlString &vadAlgorithm)
Handle MPRM_CHANGE_VAD message.
Definition: MprVad.cpp:170
Definition: MprVad.h:107
static OsStatus changeVadAlgorithm(const UtlString &namedResource, OsMsgQ &fgQ, const UtlString &vadAlgorithm)
Change VAD algorithm to the given one.
Definition: MprVad.cpp:76
Flow graph for coordinating the execution of media processing resources.
Definition: MpFlowGraphBase.h:91
int samplesPerSecond
UtlBoolean handleSetVadParam(UtlSerialized &serialData)
Handle message to set VAD parameter.
Definition: MprVad.cpp:185
OsStatus setFlowGraph(MpFlowGraphBase *pFlowGraph)
Associates this resource with the indicated flow graph.
Definition: MprVad.cpp:199
UtlBoolean handleMessage(MpResourceMsg &rMsg)
Handles an incoming flowgraph message for this media processing object.
Definition: MprVad.cpp:141
Abstract base class for all audio processing objects.
Definition: MpAudioResource.h:38
Smart pointer to MpBuf.
Definition: MpBuf.h:160
MpVadBase * mpVad
Instance of the VAD algorithm to use.
Definition: MprVad.h:113
Definition: MprDecode.h:55
Voice Activity Detection resource.
Definition: MprVad.h:36
static OsStatus setVadParameter(const UtlString &parameterName, int parameterValue, const UtlString &resourceName, OsMsgQ &flowgraphQueue)
Set VAD parameter.
Definition: MprVad.cpp:55
~MprVad()
Destructor.
Definition: MprVad.cpp:46
UtlBoolean isEnabled() const
Returns TRUE is this resource is currently enabled, FALSE otherwise.
Definition: MpResource.cpp:440