diff options
Diffstat (limited to 'include')
30 files changed, 230 insertions, 1289 deletions
diff --git a/include/android_runtime/AndroidRuntime.h b/include/android_runtime/AndroidRuntime.h index fd33d59..0b3ce9a 100644 --- a/include/android_runtime/AndroidRuntime.h +++ b/include/android_runtime/AndroidRuntime.h @@ -66,6 +66,12 @@ public: void start(const char *classname, const char* options); + void exit(int code); + + void setExitWithoutCleanup(bool exitWithoutCleanup) { + mExitWithoutCleanup = exitWithoutCleanup; + } + static AndroidRuntime* getRuntime(); /** @@ -86,14 +92,13 @@ public: * fork. Override it to initialize threads, etc. Upon return, the * correct static main will be invoked. */ - virtual void onZygoteInit() {}; - + virtual void onZygoteInit() { } /** - * Called when the Java application exits. The default - * implementation calls exit(code). + * Called when the Java application exits to perform additional cleanup actions + * before the process is terminated. */ - virtual void onExit(int code); + virtual void onExit(int code) { } /** create a new thread that is visible from Java */ static android_thread_id_t createJavaThread(const char* name, void (*start)(void *), @@ -114,6 +119,7 @@ private: int startVm(JavaVM** pJavaVM, JNIEnv** pEnv); Vector<JavaVMOption> mOptions; + bool mExitWithoutCleanup; /* JNI JavaVM pointer */ static JavaVM* mJavaVM; diff --git a/include/androidfw/AssetManager.h b/include/androidfw/AssetManager.h index d95b45e..d153c31 100644 --- a/include/androidfw/AssetManager.h +++ b/include/androidfw/AssetManager.h @@ -22,13 +22,13 @@ #include <androidfw/Asset.h> #include <androidfw/AssetDir.h> -#include <androidfw/ZipFileRO.h> #include <utils/KeyedVector.h> #include <utils/SortedVector.h> #include <utils/String16.h> #include <utils/String8.h> #include <utils/threads.h> #include <utils/Vector.h> +#include <utils/ZipFileRO.h> /* * Native-app access is via the opaque typedef struct AAssetManager in the C namespace. diff --git a/include/androidfw/ZipFileCRO.h b/include/androidfw/ZipFileCRO.h deleted file mode 100644 index 3e42a95..0000000 --- a/include/androidfw/ZipFileCRO.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2008 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. - */ - -// -// C API for ead-only access to Zip archives, with minimal heap allocation. -// -#ifndef __LIBS_ZIPFILECRO_H -#define __LIBS_ZIPFILECRO_H - -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> - -#include <utils/Compat.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Trivial typedef to ensure that ZipFileCRO is not treated as a simple integer. - */ -typedef void* ZipFileCRO; - -/* - * Trivial typedef to ensure that ZipEntryCRO is not treated as a simple - * integer. We use NULL to indicate an invalid value. - */ -typedef void* ZipEntryCRO; - -extern ZipFileCRO ZipFileXRO_open(const char* path); - -extern void ZipFileCRO_destroy(ZipFileCRO zip); - -extern ZipEntryCRO ZipFileCRO_findEntryByName(ZipFileCRO zip, - const char* fileName); - -extern bool ZipFileCRO_getEntryInfo(ZipFileCRO zip, ZipEntryCRO entry, - int* pMethod, size_t* pUncompLen, - size_t* pCompLen, off64_t* pOffset, long* pModWhen, long* pCrc32); - -extern bool ZipFileCRO_uncompressEntry(ZipFileCRO zip, ZipEntryCRO entry, int fd); - -#ifdef __cplusplus -} -#endif - -#endif /*__LIBS_ZIPFILECRO_H*/ diff --git a/include/androidfw/ZipFileRO.h b/include/androidfw/ZipFileRO.h deleted file mode 100644 index 547e36a..0000000 --- a/include/androidfw/ZipFileRO.h +++ /dev/null @@ -1,262 +0,0 @@ -/* - * Copyright (C) 2007 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. - */ - -/* - * Read-only access to Zip archives, with minimal heap allocation. - * - * This is similar to the more-complete ZipFile class, but no attempt - * has been made to make them interchangeable. This class operates under - * a very different set of assumptions and constraints. - * - * One such assumption is that if you're getting file descriptors for - * use with this class as a child of a fork() operation, you must be on - * a pread() to guarantee correct operation. This is because pread() can - * atomically read at a file offset without worrying about a lock around an - * lseek() + read() pair. - */ -#ifndef __LIBS_ZIPFILERO_H -#define __LIBS_ZIPFILERO_H - -#include <utils/Compat.h> -#include <utils/Errors.h> -#include <utils/FileMap.h> -#include <utils/threads.h> - -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <time.h> - -namespace android { - -/* - * Trivial typedef to ensure that ZipEntryRO is not treated as a simple - * integer. We use NULL to indicate an invalid value. - */ -typedef void* ZipEntryRO; - -/* - * Open a Zip archive for reading. - * - * We want "open" and "find entry by name" to be fast operations, and we - * want to use as little memory as possible. We memory-map the file, - * and load a hash table with pointers to the filenames (which aren't - * null-terminated). The other fields are at a fixed offset from the - * filename, so we don't need to extract those (but we do need to byte-read - * and endian-swap them every time we want them). - * - * To speed comparisons when doing a lookup by name, we could make the mapping - * "private" (copy-on-write) and null-terminate the filenames after verifying - * the record structure. However, this requires a private mapping of - * every page that the Central Directory touches. Easier to tuck a copy - * of the string length into the hash table entry. - * - * NOTE: If this is used on file descriptors inherited from a fork() operation, - * you must be on a platform that implements pread() to guarantee correctness - * on the shared file descriptors. - */ -class ZipFileRO { -public: - ZipFileRO() - : mFd(-1), mFileName(NULL), mFileLength(-1), - mDirectoryMap(NULL), - mNumEntries(-1), mDirectoryOffset(-1), - mHashTableSize(-1), mHashTable(NULL) - {} - - ~ZipFileRO(); - - /* - * Open an archive. - */ - status_t open(const char* zipFileName); - - /* - * Find an entry, by name. Returns the entry identifier, or NULL if - * not found. - * - * If two entries have the same name, one will be chosen at semi-random. - */ - ZipEntryRO findEntryByName(const char* fileName) const; - - /* - * Return the #of entries in the Zip archive. - */ - int getNumEntries(void) const { - return mNumEntries; - } - - /* - * Return the Nth entry. Zip file entries are not stored in sorted - * order, and updated entries may appear at the end, so anyone walking - * the archive needs to avoid making ordering assumptions. We take - * that further by returning the Nth non-empty entry in the hash table - * rather than the Nth entry in the archive. - * - * Valid values are [0..numEntries). - * - * [This is currently O(n). If it needs to be fast we can allocate an - * additional data structure or provide an iterator interface.] - */ - ZipEntryRO findEntryByIndex(int idx) const; - - /* - * Copy the filename into the supplied buffer. Returns 0 on success, - * -1 if "entry" is invalid, or the filename length if it didn't fit. The - * length, and the returned string, include the null-termination. - */ - int getEntryFileName(ZipEntryRO entry, char* buffer, int bufLen) const; - - /* - * Get the vital stats for an entry. Pass in NULL pointers for anything - * you don't need. - * - * "*pOffset" holds the Zip file offset of the entry's data. - * - * Returns "false" if "entry" is bogus or if the data in the Zip file - * appears to be bad. - */ - bool getEntryInfo(ZipEntryRO entry, int* pMethod, size_t* pUncompLen, - size_t* pCompLen, off64_t* pOffset, long* pModWhen, long* pCrc32) const; - - /* - * Create a new FileMap object that maps a subset of the archive. For - * an uncompressed entry this effectively provides a pointer to the - * actual data, for a compressed entry this provides the input buffer - * for inflate(). - */ - FileMap* createEntryFileMap(ZipEntryRO entry) const; - - /* - * Uncompress the data into a buffer. Depending on the compression - * format, this is either an "inflate" operation or a memcpy. - * - * Use "uncompLen" from getEntryInfo() to determine the required - * buffer size. - * - * Returns "true" on success. - */ - bool uncompressEntry(ZipEntryRO entry, void* buffer) const; - - /* - * Uncompress the data to an open file descriptor. - */ - bool uncompressEntry(ZipEntryRO entry, int fd) const; - - /* Zip compression methods we support */ - enum { - kCompressStored = 0, // no compression - kCompressDeflated = 8, // standard deflate - }; - - /* - * Utility function: uncompress deflated data, buffer to buffer. - */ - static bool inflateBuffer(void* outBuf, const void* inBuf, - size_t uncompLen, size_t compLen); - - /* - * Utility function: uncompress deflated data, buffer to fd. - */ - static bool inflateBuffer(int fd, const void* inBuf, - size_t uncompLen, size_t compLen); - - /* - * Utility function to convert ZIP's time format to a timespec struct. - */ - static inline void zipTimeToTimespec(long when, struct tm* timespec) { - const long date = when >> 16; - timespec->tm_year = ((date >> 9) & 0x7F) + 80; // Zip is years since 1980 - timespec->tm_mon = (date >> 5) & 0x0F; - timespec->tm_mday = date & 0x1F; - - timespec->tm_hour = (when >> 11) & 0x1F; - timespec->tm_min = (when >> 5) & 0x3F; - timespec->tm_sec = (when & 0x1F) << 1; - } - - /* - * Some basic functions for raw data manipulation. "LE" means - * Little Endian. - */ - static inline unsigned short get2LE(const unsigned char* buf) { - return buf[0] | (buf[1] << 8); - } - static inline unsigned long get4LE(const unsigned char* buf) { - return buf[0] | (buf[1] << 8) | (buf[2] << 16) | (buf[3] << 24); - } - -private: - /* these are private and not defined */ - ZipFileRO(const ZipFileRO& src); - ZipFileRO& operator=(const ZipFileRO& src); - - /* locate and parse the central directory */ - bool mapCentralDirectory(void); - - /* parse the archive, prepping internal structures */ - bool parseZipArchive(void); - - /* add a new entry to the hash table */ - void addToHash(const char* str, int strLen, unsigned int hash); - - /* compute string hash code */ - static unsigned int computeHash(const char* str, int len); - - /* convert a ZipEntryRO back to a hash table index */ - int entryToIndex(const ZipEntryRO entry) const; - - /* - * One entry in the hash table. - */ - typedef struct HashEntry { - const char* name; - unsigned short nameLen; - //unsigned int hash; - } HashEntry; - - /* open Zip archive */ - int mFd; - - /* Lock for handling the file descriptor (seeks, etc) */ - mutable Mutex mFdLock; - - /* zip file name */ - char* mFileName; - - /* length of file */ - size_t mFileLength; - - /* mapped file */ - FileMap* mDirectoryMap; - - /* number of entries in the Zip archive */ - int mNumEntries; - - /* CD directory offset in the Zip archive */ - off64_t mDirectoryOffset; - - /* - * We know how many entries are in the Zip archive, so we have a - * fixed-size hash table. We probe for an empty slot. - */ - int mHashTableSize; - HashEntry* mHashTable; -}; - -}; // namespace android - -#endif /*__LIBS_ZIPFILERO_H*/ diff --git a/include/androidfw/ZipUtils.h b/include/androidfw/ZipUtils.h deleted file mode 100644 index 42c42b6..0000000 --- a/include/androidfw/ZipUtils.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2007 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. - */ - -// -// Miscellaneous zip/gzip utility functions. -// -#ifndef __LIBS_ZIPUTILS_H -#define __LIBS_ZIPUTILS_H - -#include <stdio.h> - -namespace android { - -/* - * Container class for utility functions, primarily for namespace reasons. - */ -class ZipUtils { -public: - /* - * General utility function for uncompressing "deflate" data from a file - * to a buffer. - */ - static bool inflateToBuffer(int fd, void* buf, long uncompressedLen, - long compressedLen); - static bool inflateToBuffer(FILE* fp, void* buf, long uncompressedLen, - long compressedLen); - - /* - * Someday we might want to make this generic and handle bzip2 ".bz2" - * files too. - * - * We could declare gzip to be a sub-class of zip that has exactly - * one always-compressed entry, but we currently want to treat Zip - * and gzip as distinct, so there's no value. - * - * The zlib library has some gzip utilities, but it has no interface - * for extracting the uncompressed length of the file (you do *not* - * want to gzseek to the end). - * - * Pass in a seeked file pointer for the gzip file. If this is a gzip - * file, we set our return values appropriately and return "true" with - * the file seeked to the start of the compressed data. - */ - static bool examineGzip(FILE* fp, int* pCompressionMethod, - long* pUncompressedLen, long* pCompressedLen, unsigned long* pCRC32); - -private: - ZipUtils() {} - ~ZipUtils() {} -}; - -}; // namespace android - -#endif /*__LIBS_ZIPUTILS_H*/ diff --git a/include/camera/Camera.h b/include/camera/Camera.h index 234e165..3fedea0 100644 --- a/include/camera/Camera.h +++ b/include/camera/Camera.h @@ -72,7 +72,7 @@ public: static int32_t getNumberOfCameras(); static status_t getCameraInfo(int cameraId, struct CameraInfo* cameraInfo); - static sp<Camera> connect(int cameraId); + static sp<Camera> connect(int cameraId, bool force, bool keep); virtual ~Camera(); void init(); diff --git a/include/camera/CameraParameters.h b/include/camera/CameraParameters.h deleted file mode 100644 index 7edf6b4..0000000 --- a/include/camera/CameraParameters.h +++ /dev/null @@ -1,666 +0,0 @@ -/* - * Copyright (C) 2008 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 ANDROID_HARDWARE_CAMERA_PARAMETERS_H -#define ANDROID_HARDWARE_CAMERA_PARAMETERS_H - -#include <utils/KeyedVector.h> -#include <utils/String8.h> - -namespace android { - -struct Size { - int width; - int height; - - Size() { - width = 0; - height = 0; - } - - Size(int w, int h) { - width = w; - height = h; - } -}; - -class CameraParameters -{ -public: - CameraParameters(); - CameraParameters(const String8 ¶ms) { unflatten(params); } - ~CameraParameters(); - - String8 flatten() const; - void unflatten(const String8 ¶ms); - - void set(const char *key, const char *value); - void set(const char *key, int value); - void setFloat(const char *key, float value); - const char *get(const char *key) const; - int getInt(const char *key) const; - float getFloat(const char *key) const; - - void remove(const char *key); - - void setPreviewSize(int width, int height); - void getPreviewSize(int *width, int *height) const; - void getSupportedPreviewSizes(Vector<Size> &sizes) const; - - // Set the dimensions in pixels to the given width and height - // for video frames. The given width and height must be one - // of the supported dimensions returned from - // getSupportedVideoSizes(). Must not be called if - // getSupportedVideoSizes() returns an empty Vector of Size. - void setVideoSize(int width, int height); - // Retrieve the current dimensions (width and height) - // in pixels for video frames, which must be one of the - // supported dimensions returned from getSupportedVideoSizes(). - // Must not be called if getSupportedVideoSizes() returns an - // empty Vector of Size. - void getVideoSize(int *width, int *height) const; - // Retrieve a Vector of supported dimensions (width and height) - // in pixels for video frames. If sizes returned from the method - // is empty, the camera does not support calls to setVideoSize() - // or getVideoSize(). In adddition, it also indicates that - // the camera only has a single output, and does not have - // separate output for video frames and preview frame. - void getSupportedVideoSizes(Vector<Size> &sizes) const; - // Retrieve the preferred preview size (width and height) in pixels - // for video recording. The given width and height must be one of - // supported preview sizes returned from getSupportedPreviewSizes(). - // Must not be called if getSupportedVideoSizes() returns an empty - // Vector of Size. If getSupportedVideoSizes() returns an empty - // Vector of Size, the width and height returned from this method - // is invalid, and is "-1x-1". - void getPreferredPreviewSizeForVideo(int *width, int *height) const; - - void setPreviewFrameRate(int fps); - int getPreviewFrameRate() const; - void getPreviewFpsRange(int *min_fps, int *max_fps) const; - void setPreviewFormat(const char *format); - const char *getPreviewFormat() const; - void setPictureSize(int width, int height); - void getPictureSize(int *width, int *height) const; - void getSupportedPictureSizes(Vector<Size> &sizes) const; - void setPictureFormat(const char *format); - const char *getPictureFormat() const; - - void dump() const; - status_t dump(int fd, const Vector<String16>& args) const; - - // Parameter keys to communicate between camera application and driver. - // The access (read/write, read only, or write only) is viewed from the - // perspective of applications, not driver. - - // Preview frame size in pixels (width x height). - // Example value: "480x320". Read/Write. - static const char KEY_PREVIEW_SIZE[]; - // Supported preview frame sizes in pixels. - // Example value: "800x600,480x320". Read only. - static const char KEY_SUPPORTED_PREVIEW_SIZES[]; - // The current minimum and maximum preview fps. This controls the rate of - // preview frames received (CAMERA_MSG_PREVIEW_FRAME). The minimum and - // maximum fps must be one of the elements from - // KEY_SUPPORTED_PREVIEW_FPS_RANGE parameter. - // Example value: "10500,26623" - static const char KEY_PREVIEW_FPS_RANGE[]; - // The supported preview fps (frame-per-second) ranges. Each range contains - // a minimum fps and maximum fps. If minimum fps equals to maximum fps, the - // camera outputs frames in fixed frame rate. If not, the camera outputs - // frames in auto frame rate. The actual frame rate fluctuates between the - // minimum and the maximum. The list has at least one element. The list is - // sorted from small to large (first by maximum fps and then minimum fps). - // Example value: "(10500,26623),(15000,26623),(30000,30000)" - static const char KEY_SUPPORTED_PREVIEW_FPS_RANGE[]; - // The image format for preview frames. See CAMERA_MSG_PREVIEW_FRAME in - // frameworks/base/include/camera/Camera.h. - // Example value: "yuv420sp" or PIXEL_FORMAT_XXX constants. Read/write. - static const char KEY_PREVIEW_FORMAT[]; - // Supported image formats for preview frames. - // Example value: "yuv420sp,yuv422i-yuyv". Read only. - static const char KEY_SUPPORTED_PREVIEW_FORMATS[]; - // Number of preview frames per second. This is the target frame rate. The - // actual frame rate depends on the driver. - // Example value: "15". Read/write. - static const char KEY_PREVIEW_FRAME_RATE[]; - // Supported number of preview frames per second. - // Example value: "24,15,10". Read. - static const char KEY_SUPPORTED_PREVIEW_FRAME_RATES[]; - // The dimensions for captured pictures in pixels (width x height). - // Example value: "1024x768". Read/write. - static const char KEY_PICTURE_SIZE[]; - // Supported dimensions for captured pictures in pixels. - // Example value: "2048x1536,1024x768". Read only. - static const char KEY_SUPPORTED_PICTURE_SIZES[]; - // The image format for captured pictures. See CAMERA_MSG_COMPRESSED_IMAGE - // in frameworks/base/include/camera/Camera.h. - // Example value: "jpeg" or PIXEL_FORMAT_XXX constants. Read/write. - static const char KEY_PICTURE_FORMAT[]; - // Supported image formats for captured pictures. - // Example value: "jpeg,rgb565". Read only. - static const char KEY_SUPPORTED_PICTURE_FORMATS[]; - // The width (in pixels) of EXIF thumbnail in Jpeg picture. - // Example value: "512". Read/write. - static const char KEY_JPEG_THUMBNAIL_WIDTH[]; - // The height (in pixels) of EXIF thumbnail in Jpeg picture. - // Example value: "384". Read/write. - static const char KEY_JPEG_THUMBNAIL_HEIGHT[]; - // Supported EXIF thumbnail sizes (width x height). 0x0 means not thumbnail - // in EXIF. - // Example value: "512x384,320x240,0x0". Read only. - static const char KEY_SUPPORTED_JPEG_THUMBNAIL_SIZES[]; - // The quality of the EXIF thumbnail in Jpeg picture. The range is 1 to 100, - // with 100 being the best. - // Example value: "90". Read/write. - static const char KEY_JPEG_THUMBNAIL_QUALITY[]; - // Jpeg quality of captured picture. The range is 1 to 100, with 100 being - // the best. - // Example value: "90". Read/write. - static const char KEY_JPEG_QUALITY[]; - // The rotation angle in degrees relative to the orientation of the camera. - // This affects the pictures returned from CAMERA_MSG_COMPRESSED_IMAGE. The - // camera driver may set orientation in the EXIF header without rotating the - // picture. Or the driver may rotate the picture and the EXIF thumbnail. If - // the Jpeg picture is rotated, the orientation in the EXIF header will be - // missing or 1 (row #0 is top and column #0 is left side). - // - // Note that the JPEG pictures of front-facing cameras are not mirrored - // as in preview display. - // - // For example, suppose the natural orientation of the device is portrait. - // The device is rotated 270 degrees clockwise, so the device orientation is - // 270. Suppose a back-facing camera sensor is mounted in landscape and the - // top side of the camera sensor is aligned with the right edge of the - // display in natural orientation. So the camera orientation is 90. The - // rotation should be set to 0 (270 + 90). - // - // Example value: "0" or "90" or "180" or "270". Write only. - static const char KEY_ROTATION[]; - // GPS latitude coordinate. GPSLatitude and GPSLatitudeRef will be stored in - // JPEG EXIF header. - // Example value: "25.032146" or "-33.462809". Write only. - static const char KEY_GPS_LATITUDE[]; - // GPS longitude coordinate. GPSLongitude and GPSLongitudeRef will be stored - // in JPEG EXIF header. - // Example value: "121.564448" or "-70.660286". Write only. - static const char KEY_GPS_LONGITUDE[]; - // GPS altitude. GPSAltitude and GPSAltitudeRef will be stored in JPEG EXIF - // header. - // Example value: "21.0" or "-5". Write only. - static const char KEY_GPS_ALTITUDE[]; - // GPS timestamp (UTC in seconds since January 1, 1970). This should be - // stored in JPEG EXIF header. - // Example value: "1251192757". Write only. - static const char KEY_GPS_TIMESTAMP[]; - // GPS Processing Method - // Example value: "GPS" or "NETWORK". Write only. - static const char KEY_GPS_PROCESSING_METHOD[]; - // Current white balance setting. - // Example value: "auto" or WHITE_BALANCE_XXX constants. Read/write. - static const char KEY_WHITE_BALANCE[]; - // Supported white balance settings. - // Example value: "auto,incandescent,daylight". Read only. - static const char KEY_SUPPORTED_WHITE_BALANCE[]; - // Current color effect setting. - // Example value: "none" or EFFECT_XXX constants. Read/write. - static const char KEY_EFFECT[]; - // Supported color effect settings. - // Example value: "none,mono,sepia". Read only. - static const char KEY_SUPPORTED_EFFECTS[]; - // Current antibanding setting. - // Example value: "auto" or ANTIBANDING_XXX constants. Read/write. - static const char KEY_ANTIBANDING[]; - // Supported antibanding settings. - // Example value: "auto,50hz,60hz,off". Read only. - static const char KEY_SUPPORTED_ANTIBANDING[]; - // Current scene mode. - // Example value: "auto" or SCENE_MODE_XXX constants. Read/write. - static const char KEY_SCENE_MODE[]; - // Supported scene mode settings. - // Example value: "auto,night,fireworks". Read only. - static const char KEY_SUPPORTED_SCENE_MODES[]; - // Current flash mode. - // Example value: "auto" or FLASH_MODE_XXX constants. Read/write. - static const char KEY_FLASH_MODE[]; - // Supported flash modes. - // Example value: "auto,on,off". Read only. - static const char KEY_SUPPORTED_FLASH_MODES[]; - // Current focus mode. This will not be empty. Applications should call - // CameraHardwareInterface.autoFocus to start the focus if focus mode is - // FOCUS_MODE_AUTO or FOCUS_MODE_MACRO. - // Example value: "auto" or FOCUS_MODE_XXX constants. Read/write. - static const char KEY_FOCUS_MODE[]; - // Supported focus modes. - // Example value: "auto,macro,fixed". Read only. - static const char KEY_SUPPORTED_FOCUS_MODES[]; - // The maximum number of focus areas supported. This is the maximum length - // of KEY_FOCUS_AREAS. - // Example value: "0" or "2". Read only. - static const char KEY_MAX_NUM_FOCUS_AREAS[]; - // Current focus areas. - // - // Before accessing this parameter, apps should check - // KEY_MAX_NUM_FOCUS_AREAS first to know the maximum number of focus areas - // first. If the value is 0, focus area is not supported. - // - // Each focus area is a five-element int array. The first four elements are - // the rectangle of the area (left, top, right, bottom). The direction is - // relative to the sensor orientation, that is, what the sensor sees. The - // direction is not affected by the rotation or mirroring of - // CAMERA_CMD_SET_DISPLAY_ORIENTATION. Coordinates range from -1000 to 1000. - // (-1000,-1000) is the upper left point. (1000, 1000) is the lower right - // point. The width and height of focus areas cannot be 0 or negative. - // - // The fifth element is the weight. Values for weight must range from 1 to - // 1000. The weight should be interpreted as a per-pixel weight - all - // pixels in the area have the specified weight. This means a small area - // with the same weight as a larger area will have less influence on the - // focusing than the larger area. Focus areas can partially overlap and the - // driver will add the weights in the overlap region. - // - // A special case of single focus area (0,0,0,0,0) means driver to decide - // the focus area. For example, the driver may use more signals to decide - // focus areas and change them dynamically. Apps can set (0,0,0,0,0) if they - // want the driver to decide focus areas. - // - // Focus areas are relative to the current field of view (KEY_ZOOM). No - // matter what the zoom level is, (-1000,-1000) represents the top of the - // currently visible camera frame. The focus area cannot be set to be - // outside the current field of view, even when using zoom. - // - // Focus area only has effect if the current focus mode is FOCUS_MODE_AUTO, - // FOCUS_MODE_MACRO, FOCUS_MODE_CONTINUOUS_VIDEO, or - // FOCUS_MODE_CONTINUOUS_PICTURE. - // Example value: "(-10,-10,0,0,300),(0,0,10,10,700)". Read/write. - static const char KEY_FOCUS_AREAS[]; - // Focal length in millimeter. - // Example value: "4.31". Read only. - static const char KEY_FOCAL_LENGTH[]; - // Horizontal angle of view in degrees. - // Example value: "54.8". Read only. - static const char KEY_HORIZONTAL_VIEW_ANGLE[]; - // Vertical angle of view in degrees. - // Example value: "42.5". Read only. - static const char KEY_VERTICAL_VIEW_ANGLE[]; - // Exposure compensation index. 0 means exposure is not adjusted. - // Example value: "0" or "5". Read/write. - static const char KEY_EXPOSURE_COMPENSATION[]; - // The maximum exposure compensation index (>=0). - // Example value: "6". Read only. - static const char KEY_MAX_EXPOSURE_COMPENSATION[]; - // The minimum exposure compensation index (<=0). - // Example value: "-6". Read only. - static const char KEY_MIN_EXPOSURE_COMPENSATION[]; - // The exposure compensation step. Exposure compensation index multiply by - // step eqals to EV. Ex: if exposure compensation index is 6 and step is - // 0.3333, EV is -2. - // Example value: "0.333333333" or "0.5". Read only. - static const char KEY_EXPOSURE_COMPENSATION_STEP[]; - // The state of the auto-exposure lock. "true" means that - // auto-exposure is locked to its current value and will not - // change. "false" means the auto-exposure routine is free to - // change exposure values. If auto-exposure is already locked, - // setting this to true again has no effect (the driver will not - // recalculate exposure values). Changing exposure compensation - // settings will still affect the exposure settings while - // auto-exposure is locked. Stopping preview or taking a still - // image will not change the lock. In conjunction with - // exposure compensation, this allows for capturing multi-exposure - // brackets with known relative exposure values. Locking - // auto-exposure after open but before the first call to - // startPreview may result in severely over- or under-exposed - // images. The driver will not change the AE lock after - // auto-focus completes. - static const char KEY_AUTO_EXPOSURE_LOCK[]; - // Whether locking the auto-exposure is supported. "true" means it is, and - // "false" or this key not existing means it is not supported. - static const char KEY_AUTO_EXPOSURE_LOCK_SUPPORTED[]; - // The state of the auto-white balance lock. "true" means that - // auto-white balance is locked to its current value and will not - // change. "false" means the auto-white balance routine is free to - // change white balance values. If auto-white balance is already - // locked, setting this to true again has no effect (the driver - // will not recalculate white balance values). Stopping preview or - // taking a still image will not change the lock. In conjunction - // with exposure compensation, this allows for capturing - // multi-exposure brackets with fixed white balance. Locking - // auto-white balance after open but before the first call to - // startPreview may result in severely incorrect color. The - // driver will not change the AWB lock after auto-focus - // completes. - static const char KEY_AUTO_WHITEBALANCE_LOCK[]; - // Whether locking the auto-white balance is supported. "true" - // means it is, and "false" or this key not existing means it is - // not supported. - static const char KEY_AUTO_WHITEBALANCE_LOCK_SUPPORTED[]; - - // The maximum number of metering areas supported. This is the maximum - // length of KEY_METERING_AREAS. - // Example value: "0" or "2". Read only. - static const char KEY_MAX_NUM_METERING_AREAS[]; - // Current metering areas. Camera driver uses these areas to decide - // exposure. - // - // Before accessing this parameter, apps should check - // KEY_MAX_NUM_METERING_AREAS first to know the maximum number of metering - // areas first. If the value is 0, metering area is not supported. - // - // Each metering area is a rectangle with specified weight. The direction is - // relative to the sensor orientation, that is, what the sensor sees. The - // direction is not affected by the rotation or mirroring of - // CAMERA_CMD_SET_DISPLAY_ORIENTATION. Coordinates of the rectangle range - // from -1000 to 1000. (-1000, -1000) is the upper left point. (1000, 1000) - // is the lower right point. The width and height of metering areas cannot - // be 0 or negative. - // - // The fifth element is the weight. Values for weight must range from 1 to - // 1000. The weight should be interpreted as a per-pixel weight - all - // pixels in the area have the specified weight. This means a small area - // with the same weight as a larger area will have less influence on the - // metering than the larger area. Metering areas can partially overlap and - // the driver will add the weights in the overlap region. - // - // A special case of all-zero single metering area means driver to decide - // the metering area. For example, the driver may use more signals to decide - // metering areas and change them dynamically. Apps can set all-zero if they - // want the driver to decide metering areas. - // - // Metering areas are relative to the current field of view (KEY_ZOOM). - // No matter what the zoom level is, (-1000,-1000) represents the top of the - // currently visible camera frame. The metering area cannot be set to be - // outside the current field of view, even when using zoom. - // - // No matter what metering areas are, the final exposure are compensated - // by KEY_EXPOSURE_COMPENSATION. - // Example value: "(-10,-10,0,0,300),(0,0,10,10,700)". Read/write. - static const char KEY_METERING_AREAS[]; - // Current zoom value. - // Example value: "0" or "6". Read/write. - static const char KEY_ZOOM[]; - // Maximum zoom value. - // Example value: "6". Read only. - static const char KEY_MAX_ZOOM[]; - // The zoom ratios of all zoom values. The zoom ratio is in 1/100 - // increments. Ex: a zoom of 3.2x is returned as 320. The number of list - // elements is KEY_MAX_ZOOM + 1. The first element is always 100. The last - // element is the zoom ratio of zoom value KEY_MAX_ZOOM. - // Example value: "100,150,200,250,300,350,400". Read only. - static const char KEY_ZOOM_RATIOS[]; - // Whether zoom is supported. Zoom is supported if the value is "true". Zoom - // is not supported if the value is not "true" or the key does not exist. - // Example value: "true". Read only. - static const char KEY_ZOOM_SUPPORTED[]; - // Whether if smooth zoom is supported. Smooth zoom is supported if the - // value is "true". It is not supported if the value is not "true" or the - // key does not exist. - // See CAMERA_CMD_START_SMOOTH_ZOOM, CAMERA_CMD_STOP_SMOOTH_ZOOM, and - // CAMERA_MSG_ZOOM in frameworks/base/include/camera/Camera.h. - // Example value: "true". Read only. - static const char KEY_SMOOTH_ZOOM_SUPPORTED[]; - - // The distances (in meters) from the camera to where an object appears to - // be in focus. The object is sharpest at the optimal focus distance. The - // depth of field is the far focus distance minus near focus distance. - // - // Focus distances may change after starting auto focus, canceling auto - // focus, or starting the preview. Applications can read this anytime to get - // the latest focus distances. If the focus mode is FOCUS_MODE_CONTINUOUS, - // focus distances may change from time to time. - // - // This is intended to estimate the distance between the camera and the - // subject. After autofocus, the subject distance may be within near and far - // focus distance. However, the precision depends on the camera hardware, - // autofocus algorithm, the focus area, and the scene. The error can be - // large and it should be only used as a reference. - // - // Far focus distance > optimal focus distance > near focus distance. If - // the far focus distance is infinity, the value should be "Infinity" (case - // sensitive). The format is three float values separated by commas. The - // first is near focus distance. The second is optimal focus distance. The - // third is far focus distance. - // Example value: "0.95,1.9,Infinity" or "0.049,0.05,0.051". Read only. - static const char KEY_FOCUS_DISTANCES[]; - - // The current dimensions in pixels (width x height) for video frames. - // The width and height must be one of the supported sizes retrieved - // via KEY_SUPPORTED_VIDEO_SIZES. - // Example value: "1280x720". Read/write. - static const char KEY_VIDEO_SIZE[]; - // A list of the supported dimensions in pixels (width x height) - // for video frames. See CAMERA_MSG_VIDEO_FRAME for details in - // frameworks/base/include/camera/Camera.h. - // Example: "176x144,1280x720". Read only. - static const char KEY_SUPPORTED_VIDEO_SIZES[]; - - // The maximum number of detected faces supported by hardware face - // detection. If the value is 0, hardware face detection is not supported. - // Example: "5". Read only - static const char KEY_MAX_NUM_DETECTED_FACES_HW[]; - - // The maximum number of detected faces supported by software face - // detection. If the value is 0, software face detection is not supported. - // Example: "5". Read only - static const char KEY_MAX_NUM_DETECTED_FACES_SW[]; - - // Preferred preview frame size in pixels for video recording. - // The width and height must be one of the supported sizes retrieved - // via KEY_SUPPORTED_PREVIEW_SIZES. This key can be used only when - // getSupportedVideoSizes() does not return an empty Vector of Size. - // Camcorder applications are recommended to set the preview size - // to a value that is not larger than the preferred preview size. - // In other words, the product of the width and height of the - // preview size should not be larger than that of the preferred - // preview size. In addition, we recommend to choos a preview size - // that has the same aspect ratio as the resolution of video to be - // recorded. - // Example value: "800x600". Read only. - static const char KEY_PREFERRED_PREVIEW_SIZE_FOR_VIDEO[]; - - // The image format for video frames. See CAMERA_MSG_VIDEO_FRAME in - // frameworks/base/include/camera/Camera.h. - // Example value: "yuv420sp" or PIXEL_FORMAT_XXX constants. Read only. - static const char KEY_VIDEO_FRAME_FORMAT[]; - - // Sets the hint of the recording mode. If this is true, MediaRecorder.start - // may be faster or has less glitches. This should be called before starting - // the preview for the best result. But it is allowed to change the hint - // while the preview is active. The default value is false. - // - // The apps can still call Camera.takePicture when the hint is true. The - // apps can call MediaRecorder.start when the hint is false. But the - // performance may be worse. - // Example value: "true" or "false". Read/write. - static const char KEY_RECORDING_HINT[]; - - // Returns true if video snapshot is supported. That is, applications - // can call Camera.takePicture during recording. Applications do not need to - // call Camera.startPreview after taking a picture. The preview will be - // still active. Other than that, taking a picture during recording is - // identical to taking a picture normally. All settings and methods related - // to takePicture work identically. Ex: KEY_PICTURE_SIZE, - // KEY_SUPPORTED_PICTURE_SIZES, KEY_JPEG_QUALITY, KEY_ROTATION, and etc. - // The picture will have an EXIF header. FLASH_MODE_AUTO and FLASH_MODE_ON - // also still work, but the video will record the flash. - // - // Applications can set shutter callback as null to avoid the shutter - // sound. It is also recommended to set raw picture and post view callbacks - // to null to avoid the interrupt of preview display. - // - // Field-of-view of the recorded video may be different from that of the - // captured pictures. - // Example value: "true" or "false". Read only. - static const char KEY_VIDEO_SNAPSHOT_SUPPORTED[]; - - // The state of the video stabilization. If set to true, both the - // preview stream and the recorded video stream are stabilized by - // the camera. Only valid to set if KEY_VIDEO_STABILIZATION_SUPPORTED is - // set to true. - // - // The value of this key can be changed any time the camera is - // open. If preview or recording is active, it is acceptable for - // there to be a slight video glitch when video stabilization is - // toggled on and off. - // - // This only stabilizes video streams (between-frames stabilization), and - // has no effect on still image capture. - static const char KEY_VIDEO_STABILIZATION[]; - - // Returns true if video stabilization is supported. That is, applications - // can set KEY_VIDEO_STABILIZATION to true and have a stabilized preview - // stream and record stabilized videos. - static const char KEY_VIDEO_STABILIZATION_SUPPORTED[]; - - // Value for KEY_ZOOM_SUPPORTED or KEY_SMOOTH_ZOOM_SUPPORTED. - static const char TRUE[]; - static const char FALSE[]; - - // Value for KEY_FOCUS_DISTANCES. - static const char FOCUS_DISTANCE_INFINITY[]; - - // Values for white balance settings. - static const char WHITE_BALANCE_AUTO[]; - static const char WHITE_BALANCE_INCANDESCENT[]; - static const char WHITE_BALANCE_FLUORESCENT[]; - static const char WHITE_BALANCE_WARM_FLUORESCENT[]; - static const char WHITE_BALANCE_DAYLIGHT[]; - static const char WHITE_BALANCE_CLOUDY_DAYLIGHT[]; - static const char WHITE_BALANCE_TWILIGHT[]; - static const char WHITE_BALANCE_SHADE[]; - - // Values for effect settings. - static const char EFFECT_NONE[]; - static const char EFFECT_MONO[]; - static const char EFFECT_NEGATIVE[]; - static const char EFFECT_SOLARIZE[]; - static const char EFFECT_SEPIA[]; - static const char EFFECT_POSTERIZE[]; - static const char EFFECT_WHITEBOARD[]; - static const char EFFECT_BLACKBOARD[]; - static const char EFFECT_AQUA[]; - - // Values for antibanding settings. - static const char ANTIBANDING_AUTO[]; - static const char ANTIBANDING_50HZ[]; - static const char ANTIBANDING_60HZ[]; - static const char ANTIBANDING_OFF[]; - - // Values for flash mode settings. - // Flash will not be fired. - static const char FLASH_MODE_OFF[]; - // Flash will be fired automatically when required. The flash may be fired - // during preview, auto-focus, or snapshot depending on the driver. - static const char FLASH_MODE_AUTO[]; - // Flash will always be fired during snapshot. The flash may also be - // fired during preview or auto-focus depending on the driver. - static const char FLASH_MODE_ON[]; - // Flash will be fired in red-eye reduction mode. - static const char FLASH_MODE_RED_EYE[]; - // Constant emission of light during preview, auto-focus and snapshot. - // This can also be used for video recording. - static const char FLASH_MODE_TORCH[]; - - // Values for scene mode settings. - static const char SCENE_MODE_AUTO[]; - static const char SCENE_MODE_ACTION[]; - static const char SCENE_MODE_PORTRAIT[]; - static const char SCENE_MODE_LANDSCAPE[]; - static const char SCENE_MODE_NIGHT[]; - static const char SCENE_MODE_NIGHT_PORTRAIT[]; - static const char SCENE_MODE_THEATRE[]; - static const char SCENE_MODE_BEACH[]; - static const char SCENE_MODE_SNOW[]; - static const char SCENE_MODE_SUNSET[]; - static const char SCENE_MODE_STEADYPHOTO[]; - static const char SCENE_MODE_FIREWORKS[]; - static const char SCENE_MODE_SPORTS[]; - static const char SCENE_MODE_PARTY[]; - static const char SCENE_MODE_CANDLELIGHT[]; - // Applications are looking for a barcode. Camera driver will be optimized - // for barcode reading. - static const char SCENE_MODE_BARCODE[]; - - // Pixel color formats for KEY_PREVIEW_FORMAT, KEY_PICTURE_FORMAT, - // and KEY_VIDEO_FRAME_FORMAT - static const char PIXEL_FORMAT_YUV422SP[]; - static const char PIXEL_FORMAT_YUV420SP[]; // NV21 - static const char PIXEL_FORMAT_YUV422I[]; // YUY2 - static const char PIXEL_FORMAT_YUV420P[]; // YV12 - static const char PIXEL_FORMAT_RGB565[]; - static const char PIXEL_FORMAT_RGBA8888[]; - static const char PIXEL_FORMAT_JPEG[]; - // Raw bayer format used for images, which is 10 bit precision samples - // stored in 16 bit words. The filter pattern is RGGB. - static const char PIXEL_FORMAT_BAYER_RGGB[]; - - // Values for focus mode settings. - // Auto-focus mode. Applications should call - // CameraHardwareInterface.autoFocus to start the focus in this mode. - static const char FOCUS_MODE_AUTO[]; - // Focus is set at infinity. Applications should not call - // CameraHardwareInterface.autoFocus in this mode. - static const char FOCUS_MODE_INFINITY[]; - // Macro (close-up) focus mode. Applications should call - // CameraHardwareInterface.autoFocus to start the focus in this mode. - static const char FOCUS_MODE_MACRO[]; - // Focus is fixed. The camera is always in this mode if the focus is not - // adjustable. If the camera has auto-focus, this mode can fix the - // focus, which is usually at hyperfocal distance. Applications should - // not call CameraHardwareInterface.autoFocus in this mode. - static const char FOCUS_MODE_FIXED[]; - // Extended depth of field (EDOF). Focusing is done digitally and - // continuously. Applications should not call - // CameraHardwareInterface.autoFocus in this mode. - static const char FOCUS_MODE_EDOF[]; - // Continuous auto focus mode intended for video recording. The camera - // continuously tries to focus. This is the best choice for video - // recording because the focus changes smoothly . Applications still can - // call CameraHardwareInterface.takePicture in this mode but the subject may - // not be in focus. Auto focus starts when the parameter is set. - // - // Applications can call CameraHardwareInterface.autoFocus in this mode. The - // focus callback will immediately return with a boolean that indicates - // whether the focus is sharp or not. The focus position is locked after - // autoFocus call. If applications want to resume the continuous focus, - // cancelAutoFocus must be called. Restarting the preview will not resume - // the continuous autofocus. To stop continuous focus, applications should - // change the focus mode to other modes. - static const char FOCUS_MODE_CONTINUOUS_VIDEO[]; - // Continuous auto focus mode intended for taking pictures. The camera - // continuously tries to focus. The speed of focus change is more aggressive - // than FOCUS_MODE_CONTINUOUS_VIDEO. Auto focus starts when the parameter is - // set. - // - // Applications can call CameraHardwareInterface.autoFocus in this mode. If - // the autofocus is in the middle of scanning, the focus callback will - // return when it completes. If the autofocus is not scanning, focus - // callback will immediately return with a boolean that indicates whether - // the focus is sharp or not. The apps can then decide if they want to take - // a picture immediately or to change the focus mode to auto, and run a full - // autofocus cycle. The focus position is locked after autoFocus call. If - // applications want to resume the continuous focus, cancelAutoFocus must be - // called. Restarting the preview will not resume the continuous autofocus. - // To stop continuous focus, applications should change the focus mode to - // other modes. - static const char FOCUS_MODE_CONTINUOUS_PICTURE[]; - -private: - DefaultKeyedVector<String8,String8> mMap; -}; - -}; // namespace android - -#endif diff --git a/include/camera/ICameraService.h b/include/camera/ICameraService.h index 7d70c1e..97e3169 100644 --- a/include/camera/ICameraService.h +++ b/include/camera/ICameraService.h @@ -42,7 +42,7 @@ public: virtual status_t getCameraInfo(int cameraId, struct CameraInfo* cameraInfo) = 0; virtual sp<ICamera> connect(const sp<ICameraClient>& cameraClient, - int cameraId) = 0; + int cameraId, bool force, bool keep) = 0; }; // ---------------------------------------------------------------------------- diff --git a/include/common_time/local_clock.h b/include/common_time/local_clock.h index 845d1c2..384c3de 100644 --- a/include/common_time/local_clock.h +++ b/include/common_time/local_clock.h @@ -28,7 +28,7 @@ namespace android { class LocalClock { public: - LocalClock(); + LocalClock(); bool initCheck(); diff --git a/include/cpustats/CentralTendencyStatistics.h b/include/cpustats/CentralTendencyStatistics.h deleted file mode 100644 index 21b6981..0000000 --- a/include/cpustats/CentralTendencyStatistics.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (C) 2011 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 _CENTRAL_TENDENCY_STATISTICS_H -#define _CENTRAL_TENDENCY_STATISTICS_H - -#include <math.h> - -// Not multithread safe -class CentralTendencyStatistics { - -public: - - CentralTendencyStatistics() : - mMean(NAN), mMedian(NAN), mMinimum(INFINITY), mMaximum(-INFINITY), mN(0), mM2(0), - mVariance(NAN), mVarianceKnownForN(0), mStddev(NAN), mStddevKnownForN(0) { } - - ~CentralTendencyStatistics() { } - - // add x to the set of samples - void sample(double x); - - // return the arithmetic mean of all samples so far - double mean() const { return mMean; } - - // return the minimum of all samples so far - double minimum() const { return mMinimum; } - - // return the maximum of all samples so far - double maximum() const { return mMaximum; } - - // return the variance of all samples so far - double variance() const; - - // return the standard deviation of all samples so far - double stddev() const; - - // return the number of samples added so far - unsigned n() const { return mN; } - - // reset the set of samples to be empty - void reset(); - -private: - double mMean; - double mMedian; - double mMinimum; - double mMaximum; - unsigned mN; // number of samples so far - double mM2; - - // cached variance, and n at time of caching - mutable double mVariance; - mutable unsigned mVarianceKnownForN; - - // cached standard deviation, and n at time of caching - mutable double mStddev; - mutable unsigned mStddevKnownForN; - -}; - -#endif // _CENTRAL_TENDENCY_STATISTICS_H diff --git a/include/cpustats/README.txt b/include/cpustats/README.txt deleted file mode 100644 index 14439f0..0000000 --- a/include/cpustats/README.txt +++ /dev/null @@ -1,6 +0,0 @@ -This is a static library of CPU usage statistics, originally written -for audio but most are not actually specific to audio. - -Requirements to be here: - * should be related to CPU usage statistics - * should be portable to host; avoid Android OS dependencies without a conditional diff --git a/include/cpustats/ThreadCpuUsage.h b/include/cpustats/ThreadCpuUsage.h deleted file mode 100644 index 24012a4..0000000 --- a/include/cpustats/ThreadCpuUsage.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (C) 2011 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 _THREAD_CPU_USAGE_H -#define _THREAD_CPU_USAGE_H - -#include <cpustats/CentralTendencyStatistics.h> - -// Track CPU usage for the current thread, and maintain statistics on -// the CPU usage. Units are in per-thread CPU ns, as reported by -// clock_gettime(CLOCK_THREAD_CPUTIME_ID). Simple usage: for cyclic -// threads where you want to measure the execution time of the whole -// cycle, just call sampleAndEnable() at the start of each cycle. -// Then call statistics() to get the results, and resetStatistics() -// to start a new set of measurements. -// For acyclic threads, or for cyclic threads where you want to measure -// only part of each cycle, call enable(), disable(), and/or setEnabled() -// to demarcate the region(s) of interest, and then call sample() periodically. -// This class is not thread-safe for concurrent calls from multiple threads; -// the methods of this class may only be called by the current thread -// which constructed the object. - -class ThreadCpuUsage -{ - -public: - ThreadCpuUsage() : - mIsEnabled(false), - mWasEverEnabled(false), - mAccumulator(0), - // mPreviousTs - // mMonotonicTs - mMonotonicKnown(false) - // mStatistics - { } - - ~ThreadCpuUsage() { } - - // Return whether currently tracking CPU usage by current thread - bool isEnabled() { return mIsEnabled; } - - // Enable tracking of CPU usage by current thread; - // any CPU used from this point forward will be tracked. - // Returns the previous enabled status. - bool enable() { return setEnabled(true); } - - // Disable tracking of CPU usage by current thread; - // any CPU used from this point forward will be ignored. - // Returns the previous enabled status. - bool disable() { return setEnabled(false); } - - // Set the enabled status and return the previous enabled status. - // This method is intended to be used for safe nested enable/disabling. - bool setEnabled(bool isEnabled); - - // Add a sample point for central tendency statistics, and also - // enable tracking if needed. If tracking has never been enabled, then - // enables tracking but does not add a sample (it is not possible to add - // a sample the first time because no previous). Otherwise if tracking is - // enabled, then adds a sample for tracked CPU ns since the previous - // sample, or since the first call to sampleAndEnable(), enable(), or - // setEnabled(true). If there was a previous sample but tracking is - // now disabled, then adds a sample for the tracked CPU ns accumulated - // up until the most recent disable(), resets this accumulator, and then - // enables tracking. Calling this method rather than enable() followed - // by sample() avoids a race condition for the first sample. - void sampleAndEnable(); - - // Add a sample point for central tendency statistics, but do not - // change the tracking enabled status. If tracking has either never been - // enabled, or has never been enabled since the last sample, then log a warning - // and don't add sample. Otherwise, adds a sample for tracked CPU ns since - // the previous sample or since the first call to sampleAndEnable(), - // enable(), or setEnabled(true) if no previous sample. - void sample(); - - // Return the elapsed delta wall clock ns since initial enable or statistics reset, - // as reported by clock_gettime(CLOCK_MONOTONIC). - long long elapsed() const; - - // Reset statistics and elapsed. Has no effect on tracking or accumulator. - void resetStatistics(); - - // Return a const reference to the central tendency statistics. - // Note that only the const methods can be called on this object. - const CentralTendencyStatistics& statistics() const { - return mStatistics; - } - -private: - bool mIsEnabled; // whether tracking is currently enabled - bool mWasEverEnabled; // whether tracking was ever enabled - long long mAccumulator; // accumulated thread CPU time since last sample, in ns - struct timespec mPreviousTs; // most recent thread CPU time, valid only if mIsEnabled is true - struct timespec mMonotonicTs; // most recent monotonic time - bool mMonotonicKnown; // whether mMonotonicTs has been set - CentralTendencyStatistics mStatistics; -}; - -#endif // _THREAD_CPU_USAGE_H diff --git a/include/media/AudioRecord.h b/include/media/AudioRecord.h index 7df6668..5bfb65b 100644 --- a/include/media/AudioRecord.h +++ b/include/media/AudioRecord.h @@ -354,7 +354,6 @@ private: audio_format_t format, uint32_t channelMask, int frameCount, - uint32_t flags, audio_io_handle_t input); audio_io_handle_t getInput_l(); status_t restoreRecord_l(audio_track_cblk_t*& cblk); diff --git a/include/media/AudioTrack.h b/include/media/AudioTrack.h index 552e829..7d5d772 100644 --- a/include/media/AudioTrack.h +++ b/include/media/AudioTrack.h @@ -169,7 +169,7 @@ public: callback_t cbf = 0, void* user = 0, int notificationFrames = 0, - int sessionId = 0); + int sessionId = 0); /* Creates an audio track and registers it with AudioFlinger. With this constructor, * the PCM data to be rendered by AudioTrack is passed in a shared memory buffer @@ -215,7 +215,7 @@ public: int notificationFrames = 0, const sp<IMemory>& sharedBuffer = 0, bool threadCanCallJava = false, - int sessionId = 0); + int sessionId = 0); /* Result of constructing the AudioTrack. This must be checked @@ -468,6 +468,7 @@ protected: // body of AudioTrackThread::threadLoop() bool processAudioBuffer(const sp<AudioTrackThread>& thread); + status_t createTrack_l(audio_stream_type_t streamType, uint32_t sampleRate, audio_format_t format, @@ -475,8 +476,7 @@ protected: int frameCount, audio_policy_output_flags_t flags, const sp<IMemory>& sharedBuffer, - audio_io_handle_t output, - bool enforceFrameCount); + audio_io_handle_t output); void flush_l(); status_t setLoop_l(uint32_t loopStart, uint32_t loopEnd, int loopCount); audio_io_handle_t getOutput_l(); diff --git a/include/media/IAudioFlinger.h b/include/media/IAudioFlinger.h index 0f39cf3..8239b0e 100644 --- a/include/media/IAudioFlinger.h +++ b/include/media/IAudioFlinger.h @@ -43,6 +43,14 @@ class IAudioFlinger : public IInterface public: DECLARE_META_INTERFACE(AudioFlinger); + // or-able bits shared by createTrack and openRecord, but not all combinations make sense + enum { + TRACK_DEFAULT = 0, // client requests a default AudioTrack + TRACK_TIMED = 1, // client requests a TimedAudioTrack + TRACK_FAST = 2, // client requests a fast AudioTrack + }; + typedef uint32_t track_flags_t; + /* create an audio track and registers it with AudioFlinger. * return null if the track cannot be created. */ @@ -53,10 +61,9 @@ public: audio_format_t format, uint32_t channelMask, int frameCount, - uint32_t flags, + track_flags_t flags, const sp<IMemory>& sharedBuffer, audio_io_handle_t output, - bool isTimed, int *sessionId, status_t *status) = 0; @@ -67,7 +74,7 @@ public: audio_format_t format, uint32_t channelMask, int frameCount, - uint32_t flags, + track_flags_t flags, int *sessionId, status_t *status) = 0; diff --git a/include/media/ICrypto.h b/include/media/ICrypto.h new file mode 100644 index 0000000..916abe0 --- /dev/null +++ b/include/media/ICrypto.h @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2012 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. + */ + +#include <binder/IInterface.h> +#include <media/stagefright/foundation/ABase.h> + +#ifndef ANDROID_ICRYPTO_H_ + +#define ANDROID_ICRYPTO_H_ + +namespace android { + +struct ICrypto : public IInterface { + DECLARE_META_INTERFACE(Crypto); + + virtual status_t initialize() = 0; + virtual status_t terminate() = 0; + + virtual status_t setEntitlementKey( + const void *key, size_t keyLength) = 0; + + virtual status_t setEntitlementControlMessage( + const void *msg, size_t msgLength) = 0; + + // "dstData" is in media_server's address space (but inaccessible). + virtual ssize_t decryptVideo( + const void *iv, size_t ivLength, + const void *srcData, size_t srcDataSize, + void *dstData, size_t dstDataOffset) = 0; + + // "dstData" is in the calling process' address space. + virtual ssize_t decryptAudio( + const void *iv, size_t ivLength, + const void *srcData, size_t srcDataSize, + void *dstData, size_t dstDataSize) = 0; + +private: + DISALLOW_EVIL_CONSTRUCTORS(ICrypto); +}; + +struct BnCrypto : public BnInterface<ICrypto> { + virtual status_t onTransact( + uint32_t code, const Parcel &data, Parcel *reply, + uint32_t flags = 0); +}; + +} // namespace android + +#endif // ANDROID_ICRYPTO_H_ + diff --git a/include/media/IMediaPlayerService.h b/include/media/IMediaPlayerService.h index 4f46fcd..76c45a0 100644 --- a/include/media/IMediaPlayerService.h +++ b/include/media/IMediaPlayerService.h @@ -31,6 +31,7 @@ namespace android { +struct ICrypto; class IMediaRecorder; class IOMX; struct IStreamSource; @@ -47,6 +48,7 @@ public: virtual sp<IMemory> decode(const char* url, uint32_t *pSampleRate, int* pNumChannels, audio_format_t* pFormat) = 0; virtual sp<IMemory> decode(int fd, int64_t offset, int64_t length, uint32_t *pSampleRate, int* pNumChannels, audio_format_t* pFormat) = 0; virtual sp<IOMX> getOMX() = 0; + virtual sp<ICrypto> makeCrypto() = 0; // codecs and audio devices usage tracking for the battery app enum BatteryDataBits { diff --git a/include/media/IOMX.h b/include/media/IOMX.h index a295e9a..be1b2fc 100644 --- a/include/media/IOMX.h +++ b/include/media/IOMX.h @@ -26,8 +26,6 @@ #include <OMX_Core.h> #include <OMX_Video.h> -#include "jni.h" - namespace android { class IMemory; diff --git a/include/media/JetPlayer.h b/include/media/JetPlayer.h index 38a3e44..0616bf0 100644 --- a/include/media/JetPlayer.h +++ b/include/media/JetPlayer.h @@ -18,7 +18,6 @@ #define JETPLAYER_H_ #include <utils/threads.h> -#include <nativehelper/jni.h> #include <libsonivox/jet.h> #include <libsonivox/eas_types.h> @@ -40,7 +39,7 @@ public: static const int JET_NUMQUEUEDSEGMENT_UPDATE = 3; static const int JET_PAUSE_UPDATE = 4; - JetPlayer(jobject javaJetPlayer, + JetPlayer(void *javaJetPlayer, int maxTracks = 32, int trackBufferSize = 1200); ~JetPlayer(); @@ -75,7 +74,7 @@ private: jetevent_callback mEventCallback; - jobject mJavaJetPlayerRef; + void* mJavaJetPlayerRef; Mutex mMutex; // mutex to sync the render and playback thread with the JET calls pid_t mTid; Condition mCondition; diff --git a/include/media/mediaplayer.h b/include/media/mediaplayer.h index 662dd13..a68ab4e 100644 --- a/include/media/mediaplayer.h +++ b/include/media/mediaplayer.h @@ -120,6 +120,9 @@ enum media_info_type { MEDIA_INFO_NOT_SEEKABLE = 801, // New media metadata is available. MEDIA_INFO_METADATA_UPDATE = 802, + + //9xx + MEDIA_INFO_TIMED_TEXT_ERROR = 900, }; @@ -140,9 +143,6 @@ enum media_player_states { // The same enum space is used for both set and get, in case there are future keys that // can be both set and get. But as of now, all parameters are either set only or get only. enum media_parameter_keys { - KEY_PARAMETER_TIMED_TEXT_TRACK_INDEX = 1000, // set only - KEY_PARAMETER_TIMED_TEXT_ADD_OUT_OF_BAND_SOURCE = 1001, // set only - // Streaming/buffering parameters KEY_PARAMETER_CACHE_STAT_COLLECT_FREQ_MS = 1100, // set only @@ -155,6 +155,23 @@ enum media_parameter_keys { KEY_PARAMETER_PLAYBACK_RATE_PERMILLE = 1300, // set only }; +// Keep INVOKE_ID_* in sync with MediaPlayer.java. +enum media_player_invoke_ids { + INVOKE_ID_GET_TRACK_INFO = 1, + INVOKE_ID_ADD_EXTERNAL_SOURCE = 2, + INVOKE_ID_ADD_EXTERNAL_SOURCE_FD = 3, + INVOKE_ID_SELECT_TRACK = 4, + INVOKE_ID_UNSELECT_TRACK = 5, +}; + +// Keep MEDIA_TRACK_TYPE_* in sync with MediaPlayer.java. +enum media_track_type { + MEDIA_TRACK_TYPE_UNKNOWN = 0, + MEDIA_TRACK_TYPE_VIDEO = 1, + MEDIA_TRACK_TYPE_AUDIO = 2, + MEDIA_TRACK_TYPE_TIMEDTEXT = 3, +}; + // ---------------------------------------------------------------------------- // ref-counted object for callbacks class MediaPlayerListener: virtual public RefBase diff --git a/include/media/stagefright/ACodec.h b/include/media/stagefright/ACodec.h index fa1a416..7d7af63 100644 --- a/include/media/stagefright/ACodec.h +++ b/include/media/stagefright/ACodec.h @@ -89,6 +89,10 @@ private: kPortIndexOutput = 1 }; + enum { + kFlagIsSecure = 1, + }; + struct BufferInfo { enum Status { OWNED_BY_US, @@ -118,6 +122,7 @@ private: sp<FlushingState> mFlushingState; AString mComponentName; + uint32_t mFlags; uint32_t mQuirks; sp<IOMX> mOMX; IOMX::node_id mNode; @@ -176,7 +181,8 @@ private: status_t setupAACCodec( bool encoder, - int32_t numChannels, int32_t sampleRate, int32_t bitRate); + int32_t numChannels, int32_t sampleRate, int32_t bitRate, + bool isADTS); status_t selectAudioPortFormat( OMX_U32 portIndex, OMX_AUDIO_CODINGTYPE desiredFormat); diff --git a/include/media/stagefright/MediaCodec.h b/include/media/stagefright/MediaCodec.h index 72ac56a..0fc88e1 100644 --- a/include/media/stagefright/MediaCodec.h +++ b/include/media/stagefright/MediaCodec.h @@ -27,18 +27,21 @@ namespace android { struct ABuffer; struct ACodec; struct AMessage; +struct ICrypto; struct SoftwareRenderer; struct SurfaceTextureClient; struct MediaCodec : public AHandler { enum ConfigureFlags { CONFIGURE_FLAG_ENCODE = 1, + CONFIGURE_FLAG_SECURE = 2, }; enum BufferFlags { BUFFER_FLAG_SYNCFRAME = 1, BUFFER_FLAG_CODECCONFIG = 2, BUFFER_FLAG_EOS = 4, + BUFFER_FLAG_ENCRYPTED = 8, }; static sp<MediaCodec> CreateByType( @@ -137,11 +140,13 @@ private: kFlagStickyError = 8, kFlagDequeueInputPending = 16, kFlagDequeueOutputPending = 32, + kFlagIsSecure = 64, }; struct BufferInfo { void *mBufferID; sp<ABuffer> mData; + sp<ABuffer> mEncryptedData; sp<AMessage> mNotify; bool mOwnedByClient; }; @@ -165,6 +170,8 @@ private: int32_t mDequeueOutputTimeoutGeneration; uint32_t mDequeueOutputReplyID; + sp<ICrypto> mCrypto; + MediaCodec(const sp<ALooper> &looper); static status_t PostAndAwaitResponse( diff --git a/include/media/stagefright/MediaDefs.h b/include/media/stagefright/MediaDefs.h index 2eb259e..457d5d7 100644 --- a/include/media/stagefright/MediaDefs.h +++ b/include/media/stagefright/MediaDefs.h @@ -54,6 +54,7 @@ extern const char *MEDIA_MIMETYPE_CONTAINER_MPEG2PS; extern const char *MEDIA_MIMETYPE_CONTAINER_WVM; extern const char *MEDIA_MIMETYPE_TEXT_3GPP; +extern const char *MEDIA_MIMETYPE_TEXT_SUBRIP; } // namespace android diff --git a/include/media/stagefright/MetaData.h b/include/media/stagefright/MetaData.h index 8b4b8ed..639446e 100644 --- a/include/media/stagefright/MetaData.h +++ b/include/media/stagefright/MetaData.h @@ -24,6 +24,7 @@ #include <utils/RefBase.h> #include <utils/KeyedVector.h> +#include <utils/String8.h> namespace android { @@ -70,6 +71,8 @@ enum { kKeyThumbnailTime = 'thbT', // int64_t (usecs) kKeyTrackID = 'trID', kKeyIsDRM = 'idrm', // int32_t (bool) + kKeyEncoderDelay = 'encd', // int32_t (frames) + kKeyEncoderPadding = 'encp', // int32_t (frames) kKeyAlbum = 'albu', // cstring kKeyArtist = 'arti', // cstring @@ -125,6 +128,12 @@ enum { kKeyTextFormatData = 'text', // raw data kKeyRequiresSecureBuffers = 'secu', // bool (int32_t) + + kKeyScrambling = 'scrm', // int32_t + kKeyEMM = 'emm ', // raw data + kKeyECM = 'ecm ', // raw data + + kKeyIsADTS = 'adts', // bool (int32_t) }; enum { @@ -178,6 +187,8 @@ public: bool findData(uint32_t key, uint32_t *type, const void **data, size_t *size) const; + void dumpToLog() const; + protected: virtual ~MetaData(); @@ -192,6 +203,7 @@ private: void clear(); void setData(uint32_t type, const void *data, size_t size); void getData(uint32_t *type, const void **data, size_t *size) const; + String8 asString() const; private: uint32_t mType; diff --git a/include/media/stagefright/NuMediaExtractor.h b/include/media/stagefright/NuMediaExtractor.h index 96efdff..07c7be5 100644 --- a/include/media/stagefright/NuMediaExtractor.h +++ b/include/media/stagefright/NuMediaExtractor.h @@ -31,6 +31,11 @@ struct MediaExtractor; struct MediaSource; struct NuMediaExtractor : public RefBase { + enum SampleFlags { + SAMPLE_FLAG_SYNC = 1, + SAMPLE_FLAG_ENCRYPTED = 2, + }; + NuMediaExtractor(); status_t setDataSource(const char *path); @@ -46,6 +51,7 @@ struct NuMediaExtractor : public RefBase { status_t readSampleData(const sp<ABuffer> &buffer); status_t getSampleTrackIndex(size_t *trackIndex); status_t getSampleTime(int64_t *sampleTimeUs); + status_t getSampleFlags(uint32_t *sampleFlags); protected: virtual ~NuMediaExtractor(); @@ -61,7 +67,9 @@ private: status_t mFinalResult; MediaBuffer *mSample; int64_t mSampleTimeUs; - uint32_t mFlags; // bitmask of "TrackFlags" + uint32_t mSampleFlags; + + uint32_t mTrackFlags; // bitmask of "TrackFlags" }; sp<MediaExtractor> mImpl; diff --git a/include/media/stagefright/OMXCodec.h b/include/media/stagefright/OMXCodec.h index 392ea87..7d51dee 100644 --- a/include/media/stagefright/OMXCodec.h +++ b/include/media/stagefright/OMXCodec.h @@ -30,6 +30,7 @@ struct MediaCodecList; class MemoryDealer; struct OMXCodecObserver; struct CodecProfileLevel; +class SkipCutBuffer; struct OMXCodec : public MediaSource, public MediaBufferObserver { @@ -201,6 +202,7 @@ private: ReadOptions::SeekMode mSeekMode; int64_t mTargetTimeUs; bool mOutputPortSettingsChangedPending; + SkipCutBuffer *mSkipCutBuffer; MediaBuffer *mLeftOverBuffer; @@ -236,7 +238,11 @@ private: void setComponentRole(); void setAMRFormat(bool isWAMR, int32_t bitRate); - status_t setAACFormat(int32_t numChannels, int32_t sampleRate, int32_t bitRate); + + status_t setAACFormat( + int32_t numChannels, int32_t sampleRate, int32_t bitRate, + bool isADTS); + void setG711Format(int32_t numChannels); status_t setVideoPortFormatType( @@ -378,6 +384,7 @@ status_t QueryCodecs( const char *mimeType, bool queryDecoders, Vector<CodecCapabilities> *results); + } // namespace android #endif // OMX_CODEC_H_ diff --git a/include/media/stagefright/SkipCutBuffer.h b/include/media/stagefright/SkipCutBuffer.h new file mode 100644 index 0000000..5c7cd47 --- /dev/null +++ b/include/media/stagefright/SkipCutBuffer.h @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2012 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 SKIP_CUT_BUFFER_H_ + +#define SKIP_CUT_BUFFER_H_ + +#include <media/stagefright/MediaBuffer.h> + +namespace android { + +/** + * utility class to cut the start and end off a stream of data in MediaBuffers + * + */ +class SkipCutBuffer { + public: + // 'skip' is the number of bytes to skip from the beginning + // 'cut' is the number of bytes to cut from the end + // 'output_size' is the size in bytes of the MediaBuffers that will be used + SkipCutBuffer(int32_t skip, int32_t cut, int32_t output_size); + virtual ~SkipCutBuffer(); + + // Submit one MediaBuffer for skipping and cutting. This may consume all or + // some of the data in the buffer, or it may add data to it. + // After this, the caller should continue processing the buffer as usual. + void submit(MediaBuffer *buffer); + void clear(); + size_t size(); // how many bytes are currently stored in the buffer + + private: + void write(const char *src, size_t num); + size_t read(char *dst, size_t num); + int32_t mFrontPadding; + int32_t mBackPadding; + int32_t mWriteHead; + int32_t mReadHead; + int32_t mCapacity; + char* mCutBuffer; + DISALLOW_EVIL_CONSTRUCTORS(SkipCutBuffer); +}; + +} // namespace android + +#endif // OMX_CODEC_H_ diff --git a/include/media/stagefright/SurfaceMediaSource.h b/include/media/stagefright/SurfaceMediaSource.h index 54baab6..936b057 100644 --- a/include/media/stagefright/SurfaceMediaSource.h +++ b/include/media/stagefright/SurfaceMediaSource.h @@ -111,7 +111,7 @@ public: // Make sure this is called when the mutex is locked virtual status_t onFrameReceivedLocked(); - virtual status_t setScalingMode(int mode) { } // no op for encoding + virtual status_t setScalingMode(int mode) { return OK; } // no op for encoding virtual int query(int what, int* value); // Just confirming to the ISurfaceTexture interface as of now diff --git a/include/media/stagefright/foundation/AString.h b/include/media/stagefright/foundation/AString.h index 55ade64..0f8f1e1 100644 --- a/include/media/stagefright/foundation/AString.h +++ b/include/media/stagefright/foundation/AString.h @@ -73,6 +73,7 @@ struct AString { int compare(const AString &other) const; bool startsWith(const char *prefix) const; + bool endsWith(const char *suffix) const; void tolower(); diff --git a/include/media/stagefright/timedtext/TimedTextDriver.h b/include/media/stagefright/timedtext/TimedTextDriver.h index efedb6e..b9752df 100644 --- a/include/media/stagefright/timedtext/TimedTextDriver.h +++ b/include/media/stagefright/timedtext/TimedTextDriver.h @@ -37,26 +37,26 @@ public: ~TimedTextDriver(); - // TODO: pause-resume pair seems equivalent to stop-start pair. - // Check if it is replaceable with stop-start. status_t start(); - status_t stop(); status_t pause(); - status_t resume(); + status_t selectTrack(int32_t index); + status_t unselectTrack(int32_t index); status_t seekToAsync(int64_t timeUs); status_t addInBandTextSource(const sp<MediaSource>& source); - status_t addOutOfBandTextSource(const Parcel &request); + status_t addOutOfBandTextSource(const char *uri, const char *mimeType); + // Caller owns the file desriptor and caller is responsible for closing it. + status_t addOutOfBandTextSource( + int fd, off64_t offset, size_t length, const char *mimeType); - status_t setTimedTextTrackIndex(int32_t index); + void getTrackInfo(Parcel *parcel); private: Mutex mLock; enum State { UNINITIALIZED, - STOPPED, PLAYING, PAUSED, }; @@ -67,11 +67,11 @@ private: // Variables to be guarded by mLock. State mState; - Vector<sp<TimedTextSource> > mTextInBandVector; - Vector<sp<TimedTextSource> > mTextOutOfBandVector; + int32_t mCurrentTrackIndex; + Vector<sp<TimedTextSource> > mTextSourceVector; // -- End of variables to be guarded by mLock - status_t setTimedTextTrackIndex_l(int32_t index); + status_t selectTrack_l(int32_t index); DISALLOW_EVIL_CONSTRUCTORS(TimedTextDriver); }; |