diff options
author | Lajos Molnar <lajos@google.com> | 2015-04-30 13:59:10 -0700 |
---|---|---|
committer | Lajos Molnar <lajos@google.com> | 2015-05-01 18:45:35 -0700 |
commit | 1dcdfead2971c1fa7c02f24ba86f706890c9f99e (patch) | |
tree | e07226a98400e308d1a82499fbdb76757603937c /include | |
parent | 64da6f045b1a1d1b8f01391b6e37287f77f85d1e (diff) | |
download | frameworks_av-1dcdfead2971c1fa7c02f24ba86f706890c9f99e.zip frameworks_av-1dcdfead2971c1fa7c02f24ba86f706890c9f99e.tar.gz frameworks_av-1dcdfead2971c1fa7c02f24ba86f706890c9f99e.tar.bz2 |
stagefright: add support for dynamically setting MediaCodec output surface
Bug: 11990461
Change-Id: I2aee89ef504234dc66eb5fcf6e62e1706088f758
Diffstat (limited to 'include')
-rw-r--r-- | include/media/stagefright/ACodec.h | 9 | ||||
-rw-r--r-- | include/media/stagefright/CodecBase.h | 2 | ||||
-rw-r--r-- | include/media/stagefright/MediaCodec.h | 8 |
3 files changed, 17 insertions, 2 deletions
diff --git a/include/media/stagefright/ACodec.h b/include/media/stagefright/ACodec.h index c14e6c0..3ae2a2a 100644 --- a/include/media/stagefright/ACodec.h +++ b/include/media/stagefright/ACodec.h @@ -47,6 +47,8 @@ struct ACodec : public AHierarchicalStateMachine, public CodecBase { virtual void initiateStart(); virtual void initiateShutdown(bool keepComponentAllocated = false); + virtual status_t setSurface(const sp<Surface> &surface); + virtual void signalFlush(); virtual void signalResume(); @@ -113,6 +115,7 @@ private: kWhatDrainDeferredMessages = 'drai', kWhatAllocateComponent = 'allo', kWhatConfigureComponent = 'conf', + kWhatSetSurface = 'setS', kWhatCreateInputSurface = 'cisf', kWhatSignalEndOfInputStream = 'eois', kWhatStart = 'star', @@ -229,6 +232,12 @@ private: status_t freeBuffersOnPort(OMX_U32 portIndex); status_t freeBuffer(OMX_U32 portIndex, size_t i); + status_t handleSetSurface(const sp<Surface> &surface); + status_t setNativeWindowSizeFormatAndUsage( + ANativeWindow *nativeWindow /* nonnull */, + int width, int height, int format, int rotation, int usage); + status_t setupNativeWindowSizeFormatAndUsage(ANativeWindow *nativeWindow /* nonnull */); + status_t configureOutputBuffersFromNativeWindow( OMX_U32 *nBufferCount, OMX_U32 *nBufferSize, OMX_U32 *nMinUndequeuedBuffers); diff --git a/include/media/stagefright/CodecBase.h b/include/media/stagefright/CodecBase.h index 1bf27a6..6dece58 100644 --- a/include/media/stagefright/CodecBase.h +++ b/include/media/stagefright/CodecBase.h @@ -54,6 +54,8 @@ struct CodecBase : public AHandler { // require an explicit message handler virtual void onMessageReceived(const sp<AMessage> &msg) = 0; + virtual status_t setSurface(const sp<Surface> &surface) { return INVALID_OPERATION; } + virtual void signalFlush() = 0; virtual void signalResume() = 0; diff --git a/include/media/stagefright/MediaCodec.h b/include/media/stagefright/MediaCodec.h index e232ce6..3187938 100644 --- a/include/media/stagefright/MediaCodec.h +++ b/include/media/stagefright/MediaCodec.h @@ -141,6 +141,8 @@ struct MediaCodec : public AHandler { status_t getOutputFormat(size_t index, sp<AMessage> *format); status_t getInputBuffer(size_t index, sp<ABuffer> *buffer); + status_t setSurface(const sp<Surface> &nativeWindow); + status_t requestIDRFrame(); // Notification will be posted once there "is something to do", i.e. @@ -179,6 +181,7 @@ private: enum { kWhatInit = 'init', kWhatConfigure = 'conf', + kWhatSetSurface = 'sSur', kWhatCreateInputSurface = 'cisf', kWhatStart = 'strt', kWhatStop = 'stop', @@ -334,8 +337,9 @@ private: void extractCSD(const sp<AMessage> &format); status_t queueCSDInputBuffer(size_t bufferIndex); - status_t handleSetSurface( - const sp<Surface> &surface); + status_t handleSetSurface(const sp<Surface> &surface); + status_t connectToSurface(const sp<Surface> &surface); + status_t disconnectFromSurface(); void postActivityNotificationIfPossible(); |