sipxmedialib  Version 3.3
MprToOutputDevice.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2007-2013 SIPez LLC. All rights reserved.
3 //
4 // Copyright (C) 2007-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 _MprToOutputDevice_h_
13 #define _MprToOutputDevice_h_
14 
15 // SYSTEM INCLUDES
16 
17 // APPLICATION INCLUDES
18 #include <mp/MpAudioResource.h>
19 #include <mp/MpResourceMsg.h>
20 #include <mp/MpResampler.h>
21 #include <os/OsMsgPool.h>
22 
23 // DEFINES
24 // MACROS
25 // EXTERNAL FUNCTIONS
26 // EXTERNAL VARIABLES
27 // CONSTANTS
28 // STRUCTS
29 // TYPEDEFS
30 // FORWARD DECLARATIONS
32 class MpIntResourceMsg;
33 
51 {
52 /* //////////////////////////// PUBLIC //////////////////////////////////// */
53 public:
54 
55 /* ============================ CREATORS ================================== */
57 
58 
60  MprToOutputDevice(const UtlString& rName,
61  MpOutputDeviceManager* deviceManager,
62  MpOutputDeviceHandle deviceId);
63 
65  virtual
67 
69 
70 /* ============================ MANIPULATORS ============================== */
72 
73 
75  static OsStatus setDeviceId(const UtlString& resourceName,
76  OsMsgQ& flowgraphMessageQueue,
77  MpOutputDeviceHandle deviceId);
86  static OsStatus enableCopyQ(const UtlString& namedResource,
88  OsMsgQ& fgQ,
89  UtlBoolean enable);
98  OsStatus enableCopyQ(UtlBoolean enable);
106 
107 /* ============================ ACCESSORS ================================= */
109 
110 
112  inline OsMsgQ *getCopyQ();
113 
115 
116 /* ============================ INQUIRY =================================== */
118 
119 
121 
122 /* //////////////////////////// PROTECTED ///////////////////////////////// */
123 protected:
124  UtlBoolean handleSetOutputDeviceId(const MpIntResourceMsg& message);
125 
126 /* //////////////////////////// PRIVATE /////////////////////////////////// */
127 private:
128 
129  typedef enum
130  {
134  } AddlResMsgTypes;
135 
136  virtual UtlBoolean doProcessFrame(MpBufPtr inBufs[],
137  MpBufPtr outBufs[],
138  int inBufsSize,
139  int outBufsSize,
140  UtlBoolean isEnabled,
141  int samplesPerFrame,
142  int samplesPerSecond);
143 
151 
152  OsMsgQ mCopyQ;
153  OsMsgPool mCopyQPool;
155  UtlBoolean mIsCopyQEnabled;
156 
158  virtual UtlBoolean handleMessage(MpResourceMsg& rMsg);
159 
161  virtual UtlBoolean handleEnable();
162 
164  MprToOutputDevice(const MprToOutputDevice& rMprToOutputDevice);
165 
168 
169 };
170 
171 /* ============================ INLINE METHODS ============================ */
172 
174 {
175  return &mCopyQ;
176 }
177 
178 #endif // _MprToOutputDevice_h_
virtual ~MprToOutputDevice()
Destructor.
Definition: MprToOutputDevice.cpp:100
static OsStatus setDeviceId(const UtlString &resourceName, OsMsgQ &flowgraphMessageQueue, MpOutputDeviceHandle deviceId)
Send a message to the named MprToOutputDevice in the given flowgraph, to set the output device...
Definition: MprToOutputDevice.cpp:107
OsMsgQ * getCopyQ()
Get pointer to the copy queue.
Definition: MprToOutputDevice.h:173
Message object used to communicate with the media processing task.
Definition: MpResourceMsg.h:30
MprToOutputDevice(const UtlString &rName, MpOutputDeviceManager *deviceManager, MpOutputDeviceHandle deviceId)
Default constructor.
Definition: MprToOutputDevice.cpp:77
int samplesPerFrame
UtlBoolean mIsCopyQEnabled
Should we copy data to mCopyQ or not?
Definition: MprToOutputDevice.h:155
Generic audio resampler.
Definition: MpResampler.h:34
Definition: MpResourceMsg.h:56
uint32_t MpFrameTime
Definition: MpTypes.h:53
Definition: MprToOutputDevice.h:133
OsMsgPool mCopyQPool
Pool for messages to be sent to mCopyQ.
Definition: MprToOutputDevice.h:154
MpResamplerBase * mpResampler
Definition: MprToOutputDevice.h:150
MpFrameTime mLastPushedTime
Definition: MprToOutputDevice.h:148
virtual 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: MprToOutputDevice.cpp:144
Definition: MprToOutputDevice.h:132
int samplesPerSecond
UtlBoolean mFrameTimeInitialized
Definition: MprToOutputDevice.h:145
MpOutputDeviceManager * mpOutputDeviceManager
Definition: MprToOutputDevice.h:144
OsMsgQ mCopyQ
Definition: MprToOutputDevice.h:152
MpFrameTime mFrameTime
Definition: MprToOutputDevice.h:146
Resource in which input media from source outside the flowgraph is introduced.
Definition: MprToOutputDevice.h:50
virtual UtlBoolean handleMessage(MpResourceMsg &rMsg)
Handles an incoming flowgraph message for this media processing object.
Definition: MprToOutputDevice.cpp:418
Abstract base class for all audio processing objects.
Definition: MpAudioResource.h:38
int MpOutputDeviceHandle
Definition: MpTypes.h:50
AddlResMsgTypes
Definition: MprToOutputDevice.h:129
MpFrameTime mMixerBufferPosition
Definition: MprToOutputDevice.h:147
Message used to pass an integer value to resource.
Definition: MpIntResourceMsg.h:29
MpOutputDeviceHandle mDeviceId
Definition: MprToOutputDevice.h:149
virtual UtlBoolean handleEnable()
perform the enable operation on the resource
Definition: MprToOutputDevice.cpp:447
UtlBoolean handleSetOutputDeviceId(const MpIntResourceMsg &message)
Definition: MprToOutputDevice.cpp:455
virtual UtlBoolean enable()
Enable this resource.
Definition: MpResource.cpp:145
Smart pointer to MpBuf.
Definition: MpBuf.h:160
Container of output devices.
Definition: MpOutputDeviceManager.h:66
static OsStatus enableCopyQ(const UtlString &namedResource, OsMsgQ &fgQ, UtlBoolean enable)
Send message to enable/disable copy queue.
Definition: MprToOutputDevice.cpp:117
MprToOutputDevice & operator=(const MprToOutputDevice &rhs)
Assignment operator (not implemented for this class)
Definition: MprToOutputDevice.h:131
UtlBoolean isEnabled() const
Returns TRUE is this resource is currently enabled, FALSE otherwise.
Definition: MpResource.cpp:440