sipxmedialib  Version 3.3
MprFromInputDevice.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: Dan Petrie <dpetrie AT SIPez DOT com>
11 
12 #ifndef _MprFromInputDevice_h_
13 #define _MprFromInputDevice_h_
14 
15 // SYSTEM INCLUDES
16 
17 // APPLICATION INCLUDES
18 #include <mp/MpAudioResource.h>
19 #include <mp/MpResampler.h>
20 #include <mp/MpResourceMsg.h>
21 #include <mp/MpBridgeAlgBase.h> // For MpBridgeGain type
22 
23 // DEFINES
24 // MACROS
25 // EXTERNAL FUNCTIONS
26 // EXTERNAL VARIABLES
27 // CONSTANTS
28 // STRUCTS
29 // TYPEDEFS
30 // FORWARD DECLARATIONS
32 class MpIntResourceMsg;
33 
46 {
47 /* //////////////////////////// PUBLIC //////////////////////////////////// */
48 public:
49 
50 /* ============================ CREATORS ================================== */
52 
53 
55  MprFromInputDevice(const UtlString& rName,
56  MpInputDeviceManager* deviceManager,
57  MpInputDeviceHandle deviceId);
58 
60  virtual
62 
64 
65 /* ============================ MANIPULATORS ============================== */
67 
68 
70  static OsStatus setDeviceId(const UtlString& resourceName,
71  OsMsgQ& flowgraphMessageQueue,
72  MpInputDeviceHandle deviceId);
81  static OsStatus setGain(const UtlString& namedResource,
83  OsMsgQ& fgQ,
84  MpBridgeGain gain);
92 
93 /* ============================ ACCESSORS ================================= */
95 
96 
98 
99 /* ============================ INQUIRY =================================== */
101 
102 
104 
105 /* //////////////////////////// PROTECTED ///////////////////////////////// */
106 protected:
107  UtlBoolean handleSetInputDeviceId(const MpIntResourceMsg& message);
108 
109 /* //////////////////////////// PRIVATE /////////////////////////////////// */
110 private:
111 
112  typedef enum
113  {
116  } AddlMsgTypes;
117 
118  virtual UtlBoolean doProcessFrame(MpBufPtr inBufs[],
119  MpBufPtr outBufs[],
120  int inBufsSize,
121  int outBufsSize,
122  UtlBoolean isEnabled,
123  int samplesPerFrame,
124  int samplesPerSecond);
125 
133 
135  virtual UtlBoolean handleMessage(MpResourceMsg& rMsg);
136 
138  virtual UtlBoolean handleSetGain(MpBridgeGain gain);
143  MprFromInputDevice(const MprFromInputDevice& rMprFromInputDevice);
145 
148 
149 };
150 
151 /* ============================ INLINE METHODS ============================ */
152 
153 #endif // _MprFromInputDevice_h_
Message object used to communicate with the media processing task.
Definition: MpResourceMsg.h:30
Definition: MprFromInputDevice.h:114
virtual ~MprFromInputDevice()
Destructor.
Definition: MprFromInputDevice.cpp:103
int samplesPerFrame
Generic audio resampler.
Definition: MpResampler.h:34
Definition: MpResourceMsg.h:56
uint32_t MpFrameTime
Definition: MpTypes.h:53
MpInputDeviceHandle mDeviceId
Definition: MprFromInputDevice.h:129
MprFromInputDevice(const UtlString &rName, MpInputDeviceManager *deviceManager, MpInputDeviceHandle deviceId)
Default constructor.
Definition: MprFromInputDevice.cpp:80
UtlBoolean mFrameTimeInitialized
Definition: MprFromInputDevice.h:127
MpResamplerBase * mpResampler
Definition: MprFromInputDevice.h:130
float MpBridgeAccum
Definition: MpBridgeAlgBase.h:48
int samplesPerSecond
MpBridgeAccum * mpGainBuffer
Definition: MprFromInputDevice.h:132
MprFromInputDevice & operator=(const MprFromInputDevice &rhs)
Assignment operator (not implemented for this class)
Container of input devices for input drivers and resources.
Definition: MpInputDeviceManager.h:79
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: MprFromInputDevice.cpp:138
Abstract base class for all audio processing objects.
Definition: MpAudioResource.h:38
static OsStatus setDeviceId(const UtlString &resourceName, OsMsgQ &flowgraphMessageQueue, MpInputDeviceHandle deviceId)
Send a message to the named MprFromInputDevice in the given flowgraph, to set the input device...
Definition: MprFromInputDevice.cpp:112
Definition: MprFromInputDevice.h:115
virtual UtlBoolean handleMessage(MpResourceMsg &rMsg)
Handle resource messages for this resource.
Definition: MprFromInputDevice.cpp:346
Message used to pass an integer value to resource.
Definition: MpIntResourceMsg.h:29
UtlBoolean handleSetInputDeviceId(const MpIntResourceMsg &message)
Definition: MprFromInputDevice.cpp:378
Resource in which input media from source outside the flowgraph is introduced.
Definition: MprFromInputDevice.h:45
MpBridgeGain mGain
Definition: MprFromInputDevice.h:131
virtual UtlBoolean handleSetGain(MpBridgeGain gain)
Actually set gain to apply to incoming audio.
Definition: MprFromInputDevice.cpp:372
Smart pointer to MpBuf.
Definition: MpBuf.h:160
MpInputDeviceManager * mpInputDeviceManager
Definition: MprFromInputDevice.h:126
int MpInputDeviceHandle
Definition: MpTypes.h:48
float MpBridgeGain
Definition: MpBridgeAlgBase.h:54
static OsStatus setGain(const UtlString &namedResource, OsMsgQ &fgQ, MpBridgeGain gain)
Send message to set gain to apply to the audio.
Definition: MprFromInputDevice.cpp:122
AddlMsgTypes
Definition: MprFromInputDevice.h:112
MpFrameTime mPreviousFrameTime
Definition: MprFromInputDevice.h:128
UtlBoolean isEnabled() const
Returns TRUE is this resource is currently enabled, FALSE otherwise.
Definition: MpResource.cpp:440