diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/drm/DrmInfoEvent.h | 6 | ||||
-rw-r--r-- | include/drm/DrmManagerClient.h | 21 | ||||
-rw-r--r-- | include/drm/drm_framework_common.h | 10 | ||||
-rw-r--r-- | include/media/IMediaMetadataRetriever.h | 9 | ||||
-rw-r--r-- | include/media/MediaMetadataRetrieverInterface.h | 6 | ||||
-rw-r--r-- | include/media/MemoryLeakTrackUtil.h | 28 | ||||
-rw-r--r-- | include/media/mediametadataretriever.h | 12 | ||||
-rw-r--r-- | include/media/mediarecorder.h | 63 | ||||
-rw-r--r-- | include/media/stagefright/DataSource.h | 4 | ||||
-rw-r--r-- | include/media/stagefright/FileSource.h | 6 | ||||
-rw-r--r-- | include/media/stagefright/MPEG4Writer.h | 2 |
11 files changed, 127 insertions, 40 deletions
diff --git a/include/drm/DrmInfoEvent.h b/include/drm/DrmInfoEvent.h index add33d3..dfca228 100644 --- a/include/drm/DrmInfoEvent.h +++ b/include/drm/DrmInfoEvent.h @@ -77,7 +77,7 @@ public: * @param[in] infoType Type of information * @param[in] message Message description */ - DrmInfoEvent(int uniqueId, int infoType, const String8& message); + DrmInfoEvent(int uniqueId, int infoType, const String8 message); /** * Destructor for DrmInfoEvent @@ -104,12 +104,12 @@ public: * * @return Message description */ - const String8& getMessage() const; + const String8 getMessage() const; private: int mUniqueId; int mInfoType; - const String8& mMessage; + const String8 mMessage; }; }; diff --git a/include/drm/DrmManagerClient.h b/include/drm/DrmManagerClient.h index 12142bc..5011137 100644 --- a/include/drm/DrmManagerClient.h +++ b/include/drm/DrmManagerClient.h @@ -69,7 +69,7 @@ public: * @return * Handle for the decryption session */ - DecryptHandle* openDecryptSession(int fd, off64_t offset, off64_t length); + sp<DecryptHandle> openDecryptSession(int fd, off64_t offset, off64_t length); /** * Open the decrypt session to decrypt the given protected content @@ -78,7 +78,7 @@ public: * @return * Handle for the decryption session */ - DecryptHandle* openDecryptSession(const char* uri); + sp<DecryptHandle> openDecryptSession(const char* uri); /** * Close the decrypt session for the given handle @@ -87,7 +87,7 @@ public: * @return status_t * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ - status_t closeDecryptSession(DecryptHandle* decryptHandle); + status_t closeDecryptSession(sp<DecryptHandle> &decryptHandle); /** * Consumes the rights for a content. @@ -101,7 +101,7 @@ public: * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure. * In case license has been expired, DRM_ERROR_LICENSE_EXPIRED will be returned. */ - status_t consumeRights(DecryptHandle* decryptHandle, int action, bool reserve); + status_t consumeRights(sp<DecryptHandle> &decryptHandle, int action, bool reserve); /** * Informs the DRM engine about the playback actions performed on the DRM files. @@ -113,7 +113,8 @@ public: * @return status_t * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ - status_t setPlaybackStatus(DecryptHandle* decryptHandle, int playbackStatus, int64_t position); + status_t setPlaybackStatus( + sp<DecryptHandle> &decryptHandle, int playbackStatus, int64_t position); /** * Initialize decryption for the given unit of the protected content @@ -125,7 +126,7 @@ public: * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ status_t initializeDecryptUnit( - DecryptHandle* decryptHandle, int decryptUnitId, const DrmBuffer* headerInfo); + sp<DecryptHandle> &decryptHandle, int decryptUnitId, const DrmBuffer* headerInfo); /** * Decrypt the protected content buffers for the given unit @@ -144,7 +145,7 @@ public: * DRM_ERROR_DECRYPT for failure. */ status_t decrypt( - DecryptHandle* decryptHandle, int decryptUnitId, + sp<DecryptHandle> &decryptHandle, int decryptUnitId, const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV = NULL); /** @@ -155,7 +156,8 @@ public: * @return status_t * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ - status_t finalizeDecryptUnit(DecryptHandle* decryptHandle, int decryptUnitId); + status_t finalizeDecryptUnit( + sp<DecryptHandle> &decryptHandle, int decryptUnitId); /** * Reads the specified number of bytes from an open DRM file. @@ -167,7 +169,8 @@ public: * * @return Number of bytes read. Returns -1 for Failure. */ - ssize_t pread(DecryptHandle* decryptHandle, void* buffer, ssize_t numBytes, off64_t offset); + ssize_t pread(sp<DecryptHandle> &decryptHandle, + void* buffer, ssize_t numBytes, off64_t offset); /** * Validates whether an action on the DRM content is allowed or not. diff --git a/include/drm/drm_framework_common.h b/include/drm/drm_framework_common.h index 454fc99..d2d1d7e 100644 --- a/include/drm/drm_framework_common.h +++ b/include/drm/drm_framework_common.h @@ -19,6 +19,7 @@ #include <utils/Vector.h> #include <utils/KeyedVector.h> +#include <utils/RefBase.h> #include <utils/String8.h> #include <utils/Errors.h> @@ -251,7 +252,7 @@ public: /** * Defines decryption handle */ -class DecryptHandle { +class DecryptHandle : public RefBase { public: /** * Decryption session Handle @@ -307,10 +308,15 @@ public: decryptId(INVALID_VALUE), mimeType(""), decryptApiType(INVALID_VALUE), - status(INVALID_VALUE) { + status(INVALID_VALUE), + decryptInfo(NULL) { } + ~DecryptHandle() { + delete decryptInfo; decryptInfo = NULL; + } + bool operator<(const DecryptHandle& handle) const { return (decryptId < handle.decryptId); } diff --git a/include/media/IMediaMetadataRetriever.h b/include/media/IMediaMetadataRetriever.h index 8e3cdbb..1c1c268 100644 --- a/include/media/IMediaMetadataRetriever.h +++ b/include/media/IMediaMetadataRetriever.h @@ -18,10 +18,11 @@ #ifndef ANDROID_IMEDIAMETADATARETRIEVER_H #define ANDROID_IMEDIAMETADATARETRIEVER_H -#include <utils/RefBase.h> #include <binder/IInterface.h> #include <binder/Parcel.h> #include <binder/IMemory.h> +#include <utils/KeyedVector.h> +#include <utils/RefBase.h> namespace android { @@ -30,7 +31,11 @@ class IMediaMetadataRetriever: public IInterface public: DECLARE_META_INTERFACE(MediaMetadataRetriever); virtual void disconnect() = 0; - virtual status_t setDataSource(const char* srcUrl) = 0; + + virtual status_t setDataSource( + const char *srcUrl, + const KeyedVector<String8, String8> *headers = NULL) = 0; + virtual status_t setDataSource(int fd, int64_t offset, int64_t length) = 0; virtual sp<IMemory> getFrameAtTime(int64_t timeUs, int option) = 0; virtual sp<IMemory> extractAlbumArt() = 0; diff --git a/include/media/MediaMetadataRetrieverInterface.h b/include/media/MediaMetadataRetrieverInterface.h index 0449122..27b7e4d 100644 --- a/include/media/MediaMetadataRetrieverInterface.h +++ b/include/media/MediaMetadataRetrieverInterface.h @@ -30,7 +30,11 @@ class MediaMetadataRetrieverBase : public RefBase public: MediaMetadataRetrieverBase() {} virtual ~MediaMetadataRetrieverBase() {} - virtual status_t setDataSource(const char *url) = 0; + + virtual status_t setDataSource( + const char *url, + const KeyedVector<String8, String8> *headers = NULL) = 0; + virtual status_t setDataSource(int fd, int64_t offset, int64_t length) = 0; virtual VideoFrame* getFrameAtTime(int64_t timeUs, int option) = 0; virtual MediaAlbumArt* extractAlbumArt() = 0; diff --git a/include/media/MemoryLeakTrackUtil.h b/include/media/MemoryLeakTrackUtil.h new file mode 100644 index 0000000..290b748 --- /dev/null +++ b/include/media/MemoryLeakTrackUtil.h @@ -0,0 +1,28 @@ + +/* + * Copyright 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 MEMORY_LEAK_TRACK_UTIL_H +#define MEMORY_LEAK_TRACK_UTIL_H + +namespace android { +/* + * Dump the memory adddress of the calling process to the given fd. + */ +extern void dumpMemoryAddresses(int fd); + +}; + +#endif // MEMORY_LEAK_TRACK_UTIL_H diff --git a/include/media/mediametadataretriever.h b/include/media/mediametadataretriever.h index e905006..3e343e0 100644 --- a/include/media/mediametadataretriever.h +++ b/include/media/mediametadataretriever.h @@ -47,6 +47,12 @@ enum { METADATA_KEY_ALBUMARTIST = 13, METADATA_KEY_DISC_NUMBER = 14, METADATA_KEY_COMPILATION = 15, + METADATA_KEY_HAS_AUDIO = 16, + METADATA_KEY_HAS_VIDEO = 17, + METADATA_KEY_VIDEO_WIDTH = 18, + METADATA_KEY_VIDEO_HEIGHT = 19, + METADATA_KEY_BITRATE = 20, + // Add more here... }; @@ -56,7 +62,11 @@ public: MediaMetadataRetriever(); ~MediaMetadataRetriever(); void disconnect(); - status_t setDataSource(const char* dataSourceUrl); + + status_t setDataSource( + const char *dataSourceUrl, + const KeyedVector<String8, String8> *headers = NULL); + status_t setDataSource(int fd, int64_t offset, int64_t length); sp<IMemory> getFrameAtTime(int64_t timeUs, int option); sp<IMemory> extractAlbumArt(); diff --git a/include/media/mediarecorder.h b/include/media/mediarecorder.h index a710546..67d940b 100644 --- a/include/media/mediarecorder.h +++ b/include/media/mediarecorder.h @@ -104,35 +104,62 @@ enum video_encoder { }; /* - * The state machine of the media_recorder uses a set of different state names. - * The mapping between the media_recorder and the pvauthorengine is shown below: - * - * mediarecorder pvauthorengine - * ---------------------------------------------------------------- - * MEDIA_RECORDER_ERROR ERROR - * MEDIA_RECORDER_IDLE IDLE - * MEDIA_RECORDER_INITIALIZED OPENED - * MEDIA_RECORDER_DATASOURCE_CONFIGURED - * MEDIA_RECORDER_PREPARED INITIALIZED - * MEDIA_RECORDER_RECORDING RECORDING + * The state machine of the media_recorder. */ enum media_recorder_states { + // Error state. MEDIA_RECORDER_ERROR = 0, + + // Recorder was just created. MEDIA_RECORDER_IDLE = 1 << 0, + + // Recorder has been initialized. MEDIA_RECORDER_INITIALIZED = 1 << 1, + + // Configuration of the recorder has been completed. MEDIA_RECORDER_DATASOURCE_CONFIGURED = 1 << 2, + + // Recorder is ready to start. MEDIA_RECORDER_PREPARED = 1 << 3, + + // Recording is in progress. MEDIA_RECORDER_RECORDING = 1 << 4, }; // The "msg" code passed to the listener in notify. enum media_recorder_event_type { + MEDIA_RECORDER_EVENT_LIST_START = 1, MEDIA_RECORDER_EVENT_ERROR = 1, - MEDIA_RECORDER_EVENT_INFO = 2 + MEDIA_RECORDER_EVENT_INFO = 2, + MEDIA_RECORDER_EVENT_LIST_END = 99, + + // Track related event types + MEDIA_RECORDER_TRACK_EVENT_LIST_START = 100, + MEDIA_RECORDER_TRACK_EVENT_ERROR = 100, + MEDIA_RECORDER_TRACK_EVENT_INFO = 101, + MEDIA_RECORDER_TRACK_EVENT_LIST_END = 1000, }; +/* + * The (part of) "what" code passed to the listener in notify. + * When the error or info type is track specific, the what has + * the following layout: + * the left-most 16-bit is meant for error or info type. + * the right-most 4-bit is meant for track id. + * the rest is reserved. + * + * | track id | reserved | error or info type | + * 31 28 16 0 + * + */ enum media_recorder_error_type { - MEDIA_RECORDER_ERROR_UNKNOWN = 1 + MEDIA_RECORDER_ERROR_UNKNOWN = 1, + + // Track related error type + MEDIA_RECORDER_TRACK_ERROR_LIST_START = 100, + MEDIA_RECORDER_TRACK_ERROR_GENERAL = 100, + MEDIA_RECORDER_ERROR_VIDEO_NO_SYNC_FRAME = 200, + MEDIA_RECORDER_TRACK_ERROR_LIST_END = 1000, }; // The codes are distributed as follow: @@ -141,11 +168,15 @@ enum media_recorder_error_type { // enum media_recorder_info_type { MEDIA_RECORDER_INFO_UNKNOWN = 1, + MEDIA_RECORDER_INFO_MAX_DURATION_REACHED = 800, MEDIA_RECORDER_INFO_MAX_FILESIZE_REACHED = 801, - MEDIA_RECORDER_INFO_COMPLETION_STATUS = 802, - MEDIA_RECORDER_INFO_PROGRESS_FRAME_STATUS = 803, - MEDIA_RECORDER_INFO_PROGRESS_TIME_STATUS = 804, + + // All track related informtional events start here + MEDIA_RECORDER_TRACK_INFO_LIST_START = 1000, + MEDIA_RECORDER_TRACK_INFO_COMPLETION_STATUS = 1000, + MEDIA_RECORDER_TRACK_INFO_PROGRESS_IN_TIME = 1001, + MEDIA_RECORDER_TRACK_INFO_LIST_END = 2000, }; // ---------------------------------------------------------------------------- diff --git a/include/media/stagefright/DataSource.h b/include/media/stagefright/DataSource.h index f95e56a..d30e908 100644 --- a/include/media/stagefright/DataSource.h +++ b/include/media/stagefright/DataSource.h @@ -75,10 +75,10 @@ public: static void RegisterDefaultSniffers(); // for DRM - virtual DecryptHandle* DrmInitialization() { + virtual sp<DecryptHandle> DrmInitialization() { return NULL; } - virtual void getDrmInfo(DecryptHandle **handle, DrmManagerClient **client) {}; + virtual void getDrmInfo(sp<DecryptHandle> &handle, DrmManagerClient **client) {}; virtual String8 getUri() { return String8(); diff --git a/include/media/stagefright/FileSource.h b/include/media/stagefright/FileSource.h index 51a4343..6cf86dc 100644 --- a/include/media/stagefright/FileSource.h +++ b/include/media/stagefright/FileSource.h @@ -38,9 +38,9 @@ public: virtual status_t getSize(off64_t *size); - virtual DecryptHandle* DrmInitialization(); + virtual sp<DecryptHandle> DrmInitialization(); - virtual void getDrmInfo(DecryptHandle **handle, DrmManagerClient **client); + virtual void getDrmInfo(sp<DecryptHandle> &handle, DrmManagerClient **client); protected: virtual ~FileSource(); @@ -52,7 +52,7 @@ private: Mutex mLock; /*for DRM*/ - DecryptHandle *mDecryptHandle; + sp<DecryptHandle> mDecryptHandle; DrmManagerClient *mDrmManagerClient; int64_t mDrmBufOffset; int64_t mDrmBufSize; diff --git a/include/media/stagefright/MPEG4Writer.h b/include/media/stagefright/MPEG4Writer.h index 5c5229d..15f86ea 100644 --- a/include/media/stagefright/MPEG4Writer.h +++ b/include/media/stagefright/MPEG4Writer.h @@ -157,7 +157,7 @@ private: bool use32BitFileOffset() const; bool exceedsFileDurationLimit(); bool isFileStreamable() const; - void trackProgressStatus(const Track* track, int64_t timeUs, status_t err = OK); + void trackProgressStatus(size_t trackId, int64_t timeUs, status_t err = OK); void writeCompositionMatrix(int32_t degrees); MPEG4Writer(const MPEG4Writer &); |