diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/media/AudioRecord.h | 19 | ||||
-rw-r--r-- | include/media/IAudioFlinger.h | 2 | ||||
-rw-r--r-- | include/media/mediarecorder.h | 4 | ||||
-rw-r--r-- | include/ui/Point.h | 21 | ||||
-rw-r--r-- | include/ui/Rect.h | 40 |
5 files changed, 45 insertions, 41 deletions
diff --git a/include/media/AudioRecord.h b/include/media/AudioRecord.h index 6aa40d00..3694803 100644 --- a/include/media/AudioRecord.h +++ b/include/media/AudioRecord.h @@ -39,10 +39,15 @@ class AudioRecord { public: - enum stream_type { + // input sources values must always be defined in the range + // [AudioRecord::DEFAULT_INPUT, AudioRecord::NUM_INPUT_SOURCES[ + enum input_source { DEFAULT_INPUT =-1, MIC_INPUT = 0, - NUM_STREAM_TYPES + VOICE_UPLINK_INPUT = 1, + VOICE_DOWNLINK_INPUT = 2, + VOICE_CALL_INPUT = 3, + NUM_INPUT_SOURCES }; static const int DEFAULT_SAMPLE_RATE = 8000; @@ -118,7 +123,7 @@ public: * * Parameters: * - * streamType: Select the audio input to record to (e.g. AudioRecord::MIC_INPUT). + * inputSource: Select the audio input to record to (e.g. AudioRecord::MIC_INPUT). * sampleRate: Track sampling rate in Hz. * format: PCM sample format (e.g AudioSystem::PCM_16_BIT for signed * 16 bits per sample). @@ -140,7 +145,7 @@ public: RECORD_IIR_ENABLE = AudioSystem::TX_IIR_ENABLE }; - AudioRecord(int streamType, + AudioRecord(int inputSource, uint32_t sampleRate = 0, int format = 0, int channelCount = 0, @@ -165,7 +170,7 @@ public: * - NO_INIT: audio server or audio hardware not initialized * - PERMISSION_DENIED: recording is not allowed for the requesting process * */ - status_t set(int streamType = 0, + status_t set(int inputSource = 0, uint32_t sampleRate = 0, int format = 0, int channelCount = 0, @@ -197,6 +202,7 @@ public: int channelCount() const; uint32_t frameCount() const; int frameSize() const; + int inputSource() const; /* After it's created the track is not active. Call start() to @@ -323,7 +329,8 @@ private: audio_track_cblk_t* mCblk; uint8_t mFormat; uint8_t mChannelCount; - uint8_t mReserved[2]; + uint8_t mInputSource; + uint8_t mReserved; status_t mStatus; uint32_t mLatency; diff --git a/include/media/IAudioFlinger.h b/include/media/IAudioFlinger.h index 6f13fe0..3e59d85 100644 --- a/include/media/IAudioFlinger.h +++ b/include/media/IAudioFlinger.h @@ -54,7 +54,7 @@ public: virtual sp<IAudioRecord> openRecord( pid_t pid, - int streamType, + int inputSource, uint32_t sampleRate, int format, int channelCount, diff --git a/include/media/mediarecorder.h b/include/media/mediarecorder.h index b9ea0c6..aebe191 100644 --- a/include/media/mediarecorder.h +++ b/include/media/mediarecorder.h @@ -35,6 +35,10 @@ typedef void (*media_completion_f)(status_t status, void *cookie); enum audio_source { AUDIO_SOURCE_DEFAULT = 0, AUDIO_SOURCE_MIC = 1, + AUDIO_SOURCE_VOICE_UPLINK = 2, + AUDIO_SOURCE_VOICE_DOWNLINK = 3, + AUDIO_SOURCE_VOICE_CALL = 4, + AUDIO_SOURCE_MAX = AUDIO_SOURCE_VOICE_CALL }; enum video_source { diff --git a/include/ui/Point.h b/include/ui/Point.h index dbbad1e..1653120 100644 --- a/include/ui/Point.h +++ b/include/ui/Point.h @@ -31,12 +31,9 @@ public: // because we want the compiler generated versions // Default constructor doesn't initialize the Point - inline Point() - { + inline Point() { } - - inline Point(int _x, int _y) : x(_x), y(_y) - { + inline Point(int x, int y) : x(x), y(y) { } inline bool operator == (const Point& rhs) const { @@ -57,8 +54,8 @@ public: } inline Point& operator - () { - x=-x; - y=-y; + x = -x; + y = -y; return *this; } @@ -73,11 +70,13 @@ public: return *this; } - Point operator + (const Point& rhs) const { - return Point(x+rhs.x, y+rhs.y); + const Point operator + (const Point& rhs) const { + const Point result(x+rhs.x, y+rhs.y); + return result; } - Point operator - (const Point& rhs) const { - return Point(x-rhs.x, y-rhs.y); + const Point operator - (const Point& rhs) const { + const Point result(x-rhs.x, y-rhs.y); + return result; } }; diff --git a/include/ui/Rect.h b/include/ui/Rect.h index d232847..da72944 100644 --- a/include/ui/Rect.h +++ b/include/ui/Rect.h @@ -33,23 +33,16 @@ public: // we don't provide copy-ctor and operator= on purpose // because we want the compiler generated versions - inline Rect() - { + inline Rect() { } - inline Rect(int w, int h) - : left(0), top(0), right(w), bottom(h) - { + : left(0), top(0), right(w), bottom(h) { } - inline Rect(int l, int t, int r, int b) - : left(l), top(t), right(r), bottom(b) - { + : left(l), top(t), right(r), bottom(b) { } - inline Rect(const Point& lt, const Point& rb) - : left(lt.x), top(lt.y), right(rb.x), bottom(rb.y) - { + : left(lt.x), top(lt.y), right(rb.x), bottom(rb.y) { } void makeInvalid(); @@ -78,21 +71,22 @@ public: return bottom-top; } - // returns left-top Point non-const reference, can be assigned - inline Point& leftTop() { - return reinterpret_cast<Point&>(left); + void setLeftTop(const Point& lt) { + left = lt.x; + top = lt.y; } - // returns right bottom non-const reference, can be assigned - inline Point& rightBottom() { - return reinterpret_cast<Point&>(right); + + void setRightBottom(const Point& rb) { + right = rb.x; + bottom = rb.y; } // the following 4 functions return the 4 corners of the rect as Point - inline const Point& leftTop() const { - return reinterpret_cast<const Point&>(left); + Point leftTop() const { + return Point(left, top); } - inline const Point& rightBottom() const { - return reinterpret_cast<const Point&>(right); + Point rightBottom() const { + return Point(right, bottom); } Point rightTop() const { return Point(right, top); @@ -133,8 +127,8 @@ public: Rect& operator -= (const Point& rhs) { return offsetBy(-rhs.x, -rhs.y); } - Rect operator + (const Point& rhs) const; - Rect operator - (const Point& rhs) const; + const Rect operator + (const Point& rhs) const; + const Rect operator - (const Point& rhs) const; void translate(int dx, int dy) { // legacy, don't use. offsetBy(dx, dy); |