diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/gui/SurfaceTexture.h | 65 | ||||
-rw-r--r-- | include/media/IMediaMetadataRetriever.h | 1 | ||||
-rw-r--r-- | include/media/MediaMetadataRetrieverInterface.h | 26 | ||||
-rw-r--r-- | include/media/mediametadataretriever.h | 34 | ||||
-rw-r--r-- | include/storage/IMountService.h | 1 | ||||
-rw-r--r-- | include/surfaceflinger/IGraphicBufferAlloc.h | 64 | ||||
-rw-r--r-- | include/surfaceflinger/ISurfaceComposer.h | 14 |
7 files changed, 142 insertions, 63 deletions
diff --git a/include/gui/SurfaceTexture.h b/include/gui/SurfaceTexture.h index cbc15d8..002e48b 100644 --- a/include/gui/SurfaceTexture.h +++ b/include/gui/SurfaceTexture.h @@ -26,12 +26,15 @@ #include <ui/GraphicBuffer.h> #include <utils/threads.h> +#include <utils/Vector.h> #define ANDROID_GRAPHICS_SURFACETEXTURE_JNI_ID "mSurfaceTexture" namespace android { // ---------------------------------------------------------------------------- +class IGraphicBufferAlloc; + class SurfaceTexture : public BnSurfaceTexture { public: enum { MIN_BUFFER_SLOTS = 3 }; @@ -70,6 +73,26 @@ public: // target texture belongs is bound to the calling thread. status_t updateTexImage(); + // getTransformMatrix retrieves the 4x4 texture coordinate transform matrix + // associated with the texture image set by the most recent call to + // updateTexImage. + // + // This transform matrix maps 2D homogeneous texture coordinates of the form + // (s, t, 0, 1) with s and t in the inclusive range [0, 1] to the texture + // coordinate that should be used to sample that location from the texture. + // Sampling the texture outside of the range of this transform is undefined. + // + // This transform is necessary to compensate for transforms that the stream + // content producer may implicitly apply to the content. By forcing users of + // a SurfaceTexture to apply this transform we avoid performing an extra + // copy of the data that would be needed to hide the transform from the + // user. + // + // The matrix is stored in column-major order so that it may be passed + // directly to OpenGL ES via the glLoadMatrixf or glUniformMatrix4fv + // functions. + void getTransformMatrix(float mtx[16]); + private: // freeAllBuffers frees the resources (both GraphicBuffer and EGLImage) for @@ -120,16 +143,58 @@ private: // reset mCurrentTexture to INVALID_BUFFER_SLOT. int mCurrentTexture; + // mCurrentTextureBuf is the graphic buffer of the current texture. It's + // possible that this buffer is not associated with any buffer slot, so we + // must track it separately in order to properly use + // IGraphicBufferAlloc::freeAllGraphicBuffersExcept. + sp<GraphicBuffer> mCurrentTextureBuf; + + // mCurrentCrop is the crop rectangle that applies to the current texture. + // It gets set to mLastQueuedCrop each time updateTexImage is called. + Rect mCurrentCrop; + + // mCurrentTransform is the transform identifier for the current texture. It + // gets set to mLastQueuedTransform each time updateTexImage is called. + uint32_t mCurrentTransform; + // mLastQueued is the buffer slot index of the most recently enqueued buffer. // At construction time it is initialized to INVALID_BUFFER_SLOT, and is // updated each time queueBuffer is called. int mLastQueued; + // mLastQueuedCrop is the crop rectangle for the buffer that was most + // recently queued. This gets set to mNextCrop each time queueBuffer gets + // called. + Rect mLastQueuedCrop; + + // mLastQueuedTransform is the transform identifier for the buffer that was + // most recently queued. This gets set to mNextTransform each time + // queueBuffer gets called. + uint32_t mLastQueuedTransform; + + // mNextCrop is the crop rectangle that will be used for the next buffer + // that gets queued. It is set by calling setCrop. + Rect mNextCrop; + + // mNextTransform is the transform identifier that will be used for the next + // buffer that gets queued. It is set by calling setTransform. + uint32_t mNextTransform; + // mTexName is the name of the OpenGL texture to which streamed images will // be bound when updateTexImage is called. It is set at construction time // changed with a call to setTexName. const GLuint mTexName; + // mGraphicBufferAlloc is the connection to SurfaceFlinger that is used to + // allocate new GraphicBuffer objects. + sp<IGraphicBufferAlloc> mGraphicBufferAlloc; + + // mAllocdBuffers is mirror of the list of buffers that SurfaceFlinger is + // referencing. This is kept so that gralloc implementations do not need to + // properly handle the case where SurfaceFlinger no longer holds a reference + // to a buffer, but other processes do. + Vector<sp<GraphicBuffer> > mAllocdBuffers; + // mMutex is the mutex used to prevent concurrent access to the member // variables of SurfaceTexture objects. It must be locked whenever the // member variables are accessed. diff --git a/include/media/IMediaMetadataRetriever.h b/include/media/IMediaMetadataRetriever.h index e517cf0..8e3cdbb 100644 --- a/include/media/IMediaMetadataRetriever.h +++ b/include/media/IMediaMetadataRetriever.h @@ -32,7 +32,6 @@ public: virtual void disconnect() = 0; virtual status_t setDataSource(const char* srcUrl) = 0; virtual status_t setDataSource(int fd, int64_t offset, int64_t length) = 0; - virtual status_t setMode(int mode) = 0; virtual sp<IMemory> getFrameAtTime(int64_t timeUs, int option) = 0; virtual sp<IMemory> extractAlbumArt() = 0; virtual const char* extractMetadata(int keyCode) = 0; diff --git a/include/media/MediaMetadataRetrieverInterface.h b/include/media/MediaMetadataRetrieverInterface.h index 717849d..0449122 100644 --- a/include/media/MediaMetadataRetrieverInterface.h +++ b/include/media/MediaMetadataRetrieverInterface.h @@ -32,7 +32,6 @@ public: virtual ~MediaMetadataRetrieverBase() {} virtual status_t setDataSource(const char *url) = 0; virtual status_t setDataSource(int fd, int64_t offset, int64_t length) = 0; - virtual status_t setMode(int mode) = 0; virtual VideoFrame* getFrameAtTime(int64_t timeUs, int option) = 0; virtual MediaAlbumArt* extractAlbumArt() = 0; virtual const char* extractMetadata(int keyCode) = 0; @@ -42,35 +41,12 @@ public: class MediaMetadataRetrieverInterface : public MediaMetadataRetrieverBase { public: - MediaMetadataRetrieverInterface() - : mMode(0) { - } + MediaMetadataRetrieverInterface() {} virtual ~MediaMetadataRetrieverInterface() {} - - // @param mode The intended mode of operations: - // can be any of the following: - // METADATA_MODE_NOOP: Experimental - just add and remove data source. - // METADATA_MODE_FRAME_CAPTURE_ONLY: For capture frame/thumbnail only. - // METADATA_MODE_METADATA_RETRIEVAL_ONLY: For meta data retrieval only. - // METADATA_MODE_FRAME_CAPTURE_AND_METADATA_RETRIEVAL: For both frame - // capture and meta data retrieval. - virtual status_t setMode(int mode) { - if (mode < METADATA_MODE_NOOP || - mode > METADATA_MODE_FRAME_CAPTURE_AND_METADATA_RETRIEVAL) { - return BAD_VALUE; - } - - mMode = mode; - return NO_ERROR; - } - - virtual status_t getMode(int* mode) const { *mode = mMode; return NO_ERROR; } virtual VideoFrame* getFrameAtTime(int64_t timeUs, int option) { return NULL; } virtual MediaAlbumArt* extractAlbumArt() { return NULL; } virtual const char* extractMetadata(int keyCode) { return NULL; } - - uint32_t mMode; }; }; // namespace android diff --git a/include/media/mediametadataretriever.h b/include/media/mediametadataretriever.h index 03dd52d..e905006 100644 --- a/include/media/mediametadataretriever.h +++ b/include/media/mediametadataretriever.h @@ -42,37 +42,14 @@ enum { METADATA_KEY_YEAR = 8, METADATA_KEY_DURATION = 9, METADATA_KEY_NUM_TRACKS = 10, - METADATA_KEY_IS_DRM_CRIPPLED = 11, - METADATA_KEY_CODEC = 12, - METADATA_KEY_RATING = 13, - METADATA_KEY_COMMENT = 14, - METADATA_KEY_COPYRIGHT = 15, - METADATA_KEY_BIT_RATE = 16, - METADATA_KEY_FRAME_RATE = 17, - METADATA_KEY_VIDEO_FORMAT = 18, - METADATA_KEY_VIDEO_HEIGHT = 19, - METADATA_KEY_VIDEO_WIDTH = 20, - METADATA_KEY_WRITER = 21, - METADATA_KEY_MIMETYPE = 22, - METADATA_KEY_DISC_NUMBER = 23, - METADATA_KEY_ALBUMARTIST = 24, - METADATA_KEY_COMPILATION = 25, + METADATA_KEY_WRITER = 11, + METADATA_KEY_MIMETYPE = 12, + METADATA_KEY_ALBUMARTIST = 13, + METADATA_KEY_DISC_NUMBER = 14, + METADATA_KEY_COMPILATION = 15, // Add more here... }; -// The intended mode of operations:$ -// METADATA_MODE_NOOP: Experimental - just add and remove data source.$ -// METADATA_MODE_FRAME_CAPTURE_ONLY: For capture frame/thumbnail only.$ -// METADATA_MODE_METADATA_RETRIEVAL_ONLY: For meta data retrieval only.$ -// METADATA_MODE_FRAME_CAPTURE_AND_METADATA_RETRIEVAL: For both frame capture -// and meta data retrieval.$ -enum { - METADATA_MODE_NOOP = 0x00, - METADATA_MODE_METADATA_RETRIEVAL_ONLY = 0x01, - METADATA_MODE_FRAME_CAPTURE_ONLY = 0x02, - METADATA_MODE_FRAME_CAPTURE_AND_METADATA_RETRIEVAL = 0x03 -}; - class MediaMetadataRetriever: public RefBase { public: @@ -81,7 +58,6 @@ public: void disconnect(); status_t setDataSource(const char* dataSourceUrl); status_t setDataSource(int fd, int64_t offset, int64_t length); - status_t setMode(int mode); sp<IMemory> getFrameAtTime(int64_t timeUs, int option); sp<IMemory> extractAlbumArt(); const char* extractMetadata(int keyCode); diff --git a/include/storage/IMountService.h b/include/storage/IMountService.h index 68ccd95..472d8e5 100644 --- a/include/storage/IMountService.h +++ b/include/storage/IMountService.h @@ -67,6 +67,7 @@ public: virtual bool isObbMounted(const String16& filename) = 0; virtual bool getMountedObbPath(const String16& filename, String16& path) = 0; virtual int32_t decryptStorage(const String16& password) = 0; + virtual int32_t encryptStorage(const String16& password) = 0; }; // ---------------------------------------------------------------------------- diff --git a/include/surfaceflinger/IGraphicBufferAlloc.h b/include/surfaceflinger/IGraphicBufferAlloc.h new file mode 100644 index 0000000..d996af7 --- /dev/null +++ b/include/surfaceflinger/IGraphicBufferAlloc.h @@ -0,0 +1,64 @@ +/* + * 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 ANDROID_SF_IGRAPHIC_BUFFER_ALLOC_H +#define ANDROID_SF_IGRAPHIC_BUFFER_ALLOC_H + +#include <stdint.h> +#include <sys/types.h> + +#include <utils/RefBase.h> + +#include <binder/IInterface.h> + +namespace android { +// ---------------------------------------------------------------------------- + +class IGraphicBufferAlloc : public IInterface +{ +public: + DECLARE_META_INTERFACE(GraphicBufferAlloc); + + /* Create a new GraphicBuffer for the client to use. The server will + * maintain a reference to the newly created GraphicBuffer until + * freeAllGraphicBuffers is called. + */ + virtual sp<GraphicBuffer> createGraphicBuffer(uint32_t w, uint32_t h, + PixelFormat format, uint32_t usage) = 0; + + /* Free all but one of the GraphicBuffer objects that the server is + * currently referencing. If bufIndex is not a valid index of the buffers + * the server is referencing, then all buffers are freed. + */ + virtual void freeAllGraphicBuffersExcept(int bufIndex) = 0; +}; + +// ---------------------------------------------------------------------------- + +class BnGraphicBufferAlloc : public BnInterface<IGraphicBufferAlloc> +{ +public: + virtual status_t onTransact( uint32_t code, + const Parcel& data, + Parcel* reply, + uint32_t flags = 0); +}; + +// ---------------------------------------------------------------------------- + +}; // namespace android + +#endif // ANDROID_SF_IGRAPHIC_BUFFER_ALLOC_H diff --git a/include/surfaceflinger/ISurfaceComposer.h b/include/surfaceflinger/ISurfaceComposer.h index 1bab7d7..56ed3a4 100644 --- a/include/surfaceflinger/ISurfaceComposer.h +++ b/include/surfaceflinger/ISurfaceComposer.h @@ -28,6 +28,7 @@ #include <ui/PixelFormat.h> #include <surfaceflinger/ISurfaceComposerClient.h> +#include <surfaceflinger/IGraphicBufferAlloc.h> namespace android { // ---------------------------------------------------------------------------- @@ -96,6 +97,10 @@ public: */ virtual sp<ISurfaceComposerClient> createClientConnection() = 0; + /* create a graphic buffer allocator + */ + virtual sp<IGraphicBufferAlloc> createGraphicBufferAlloc() = 0; + /* retrieve the control block */ virtual sp<IMemoryHeap> getCblk() const = 0; @@ -131,13 +136,6 @@ public: * This is an ASYNCHRONOUS call. */ virtual void signal() const = 0; - - /* Create a new GraphicBuffer for the client to use. SurfaceFlinger will - * not maintain a reference to the GraphicBuffer, so the underlying native - * handle will be freed once the client references are released. - */ - virtual sp<GraphicBuffer> createGraphicBuffer(uint32_t w, uint32_t h, - PixelFormat format, uint32_t usage) const = 0; }; // ---------------------------------------------------------------------------- @@ -151,7 +149,7 @@ public: BOOT_FINISHED = IBinder::FIRST_CALL_TRANSACTION, CREATE_CONNECTION, CREATE_CLIENT_CONNECTION, - CREATE_GRAPHIC_BUFFER, + CREATE_GRAPHIC_BUFFER_ALLOC, GET_CBLK, OPEN_GLOBAL_TRANSACTION, CLOSE_GLOBAL_TRANSACTION, |