diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/camera/CameraHardwareInterface.h | 1 | ||||
| -rw-r--r-- | include/media/stagefright/AMRWriter.h | 6 | ||||
| -rw-r--r-- | include/media/stagefright/MPEG4Writer.h | 4 | ||||
| -rw-r--r-- | include/media/stagefright/MediaWriter.h | 5 | ||||
| -rw-r--r-- | include/media/stagefright/foundation/ABitReader.h | 53 | ||||
| -rw-r--r-- | include/ui/InputDispatcher.h | 19 | ||||
| -rw-r--r-- | include/utils/ObbFile.h | 35 |
7 files changed, 112 insertions, 11 deletions
diff --git a/include/camera/CameraHardwareInterface.h b/include/camera/CameraHardwareInterface.h index 1529db7..6a66e3c 100644 --- a/include/camera/CameraHardwareInterface.h +++ b/include/camera/CameraHardwareInterface.h @@ -221,6 +221,7 @@ public: */ extern "C" int HAL_getNumberOfCameras(); extern "C" void HAL_getCameraInfo(int cameraId, struct CameraInfo* cameraInfo); +/* HAL should return NULL if it fails to open camera hardware. */ extern "C" sp<CameraHardwareInterface> HAL_openCameraHardware(int cameraId); }; // namespace android diff --git a/include/media/stagefright/AMRWriter.h b/include/media/stagefright/AMRWriter.h index 813dd43..aa965e1 100644 --- a/include/media/stagefright/AMRWriter.h +++ b/include/media/stagefright/AMRWriter.h @@ -37,8 +37,8 @@ struct AMRWriter : public MediaWriter { virtual status_t addSource(const sp<MediaSource> &source); virtual bool reachedEOS(); virtual status_t start(MetaData *params = NULL); - virtual void stop(); - virtual void pause(); + virtual status_t stop(); + virtual status_t pause(); protected: virtual ~AMRWriter(); @@ -57,7 +57,7 @@ private: int64_t mEstimatedDurationUs; static void *ThreadWrapper(void *); - void threadFunc(); + status_t threadFunc(); bool exceedsFileSizeLimit(); bool exceedsFileDurationLimit(); diff --git a/include/media/stagefright/MPEG4Writer.h b/include/media/stagefright/MPEG4Writer.h index be96935..de82b38 100644 --- a/include/media/stagefright/MPEG4Writer.h +++ b/include/media/stagefright/MPEG4Writer.h @@ -37,9 +37,9 @@ public: virtual status_t addSource(const sp<MediaSource> &source); virtual status_t start(MetaData *param = NULL); + virtual status_t stop(); + virtual status_t pause(); virtual bool reachedEOS(); - virtual void stop(); - virtual void pause(); void beginBox(const char *fourcc); void writeInt8(int8_t x); diff --git a/include/media/stagefright/MediaWriter.h b/include/media/stagefright/MediaWriter.h index 8d3a9df..151bf16 100644 --- a/include/media/stagefright/MediaWriter.h +++ b/include/media/stagefright/MediaWriter.h @@ -35,8 +35,9 @@ struct MediaWriter : public RefBase { virtual status_t addSource(const sp<MediaSource> &source) = 0; virtual bool reachedEOS() = 0; virtual status_t start(MetaData *params = NULL) = 0; - virtual void stop() = 0; - virtual void pause() = 0; + virtual status_t stop() = 0; + virtual status_t pause() = 0; + virtual void setMaxFileSize(int64_t bytes) { mMaxFileSizeLimitBytes = bytes; } virtual void setMaxFileDuration(int64_t durationUs) { mMaxFileDurationLimitUs = durationUs; } virtual void setListener(const sp<IMediaRecorderClient>& listener) { diff --git a/include/media/stagefright/foundation/ABitReader.h b/include/media/stagefright/foundation/ABitReader.h new file mode 100644 index 0000000..5135211 --- /dev/null +++ b/include/media/stagefright/foundation/ABitReader.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef A_BIT_READER_H_ + +#define A_BIT_READER_H_ + +#include <media/stagefright/foundation/ABase.h> + +#include <sys/types.h> +#include <stdint.h> + +namespace android { + +struct ABitReader { + ABitReader(const uint8_t *data, size_t size); + + uint32_t getBits(size_t n); + void skipBits(size_t n); + + size_t numBitsLeft() const; + + const uint8_t *data() const; + +private: + const uint8_t *mData; + size_t mSize; + + uint32_t mReservoir; // left-aligned bits + size_t mNumBitsLeft; + + void fillReservoir(); + void putBits(uint32_t x, size_t n); + + DISALLOW_EVIL_CONSTRUCTORS(ABitReader); +}; + +} // namespace android + +#endif // A_BIT_READER_H_ diff --git a/include/ui/InputDispatcher.h b/include/ui/InputDispatcher.h index 2505cb0..aed4fa1 100644 --- a/include/ui/InputDispatcher.h +++ b/include/ui/InputDispatcher.h @@ -159,6 +159,12 @@ public: virtual int32_t waitForMotionEventTargets(MotionEvent* motionEvent, uint32_t policyFlags, int32_t injectorPid, int32_t injectorUid, Vector<InputTarget>& outTargets) = 0; + + /* Gets the maximum suggested event delivery rate per second. + * This value is used to throttle motion event movement actions on a per-device + * basis. It is not intended to be a hard limit. + */ + virtual int32_t getMaxEventsPerSecond() = 0; }; @@ -332,6 +338,8 @@ private: // Linked list of motion samples associated with this motion event. MotionSample firstSample; MotionSample* lastSample; + + uint32_t countSamples() const; }; // Tracks the progress of dispatching a particular event to a particular connection. @@ -587,6 +595,17 @@ private: Condition mInjectionSyncFinishedCondition; void decrementPendingSyncDispatchesLocked(EventEntry* entry); + // Throttling state. + struct ThrottleState { + nsecs_t minTimeBetweenEvents; + + nsecs_t lastEventTime; + int32_t lastDeviceId; + uint32_t lastSource; + + uint32_t originalSampleCount; // only collected during debugging + } mThrottleState; + // Key repeat tracking. // XXX Move this up to the input reader instead. struct KeyRepeatState { diff --git a/include/utils/ObbFile.h b/include/utils/ObbFile.h index d2ca82e..5243f50 100644 --- a/include/utils/ObbFile.h +++ b/include/utils/ObbFile.h @@ -18,12 +18,16 @@ #define OBBFILE_H_ #include <stdint.h> +#include <strings.h> #include <utils/RefBase.h> #include <utils/String8.h> namespace android { +// OBB flags (bit 0) +#define OBB_OVERLAY (1 << 0) + class ObbFile : public RefBase { protected: virtual ~ObbFile(); @@ -46,18 +50,38 @@ public: return mPackageName; } - int32_t getVersion() const { - return mVersion; - } - void setPackageName(String8 packageName) { mPackageName = packageName; } + int32_t getVersion() const { + return mVersion; + } + void setVersion(int32_t version) { mVersion = version; } + int32_t getFlags() const { + return mFlags; + } + + void setFlags(int32_t flags) { + mFlags = flags; + } + + bool isOverlay() { + return (mFlags & OBB_OVERLAY) == OBB_OVERLAY; + } + + void setOverlay(bool overlay) { + if (overlay) { + mFlags |= OBB_OVERLAY; + } else { + mFlags &= ~OBB_OVERLAY; + } + } + static inline uint32_t get4LE(const unsigned char* buf) { return buf[0] | (buf[1] << 8) | (buf[2] << 16) | (buf[3] << 24); } @@ -76,6 +100,9 @@ private: /* Package version this ObbFile is associated with */ int32_t mVersion; + /* Flags for this OBB type. */ + int32_t mFlags; + const char* mFileName; size_t mFileSize; |
