summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLajos Molnar <lajos@google.com>2014-07-08 21:26:53 -0700
committerLajos Molnar <lajos@google.com>2014-07-11 01:41:46 -0700
commit7bad72237b49ac47e77ffe2a89fd26f3d171324c (patch)
tree1d6a75fe32fa096163ad055f2f9f98a4bbc0a7cd /include
parent94bda64006ed4b5c2c19634a206d29ea936fa81b (diff)
downloadframeworks_av-7bad72237b49ac47e77ffe2a89fd26f3d171324c.zip
frameworks_av-7bad72237b49ac47e77ffe2a89fd26f3d171324c.tar.gz
frameworks_av-7bad72237b49ac47e77ffe2a89fd26f3d171324c.tar.bz2
stagefright: add indexed buffer and format getters to MediaCodec
These are designed to be called from the same thread as the one calling dequeue?Buffer, and use a mutex to avoid switching context. All other calls of MediaCodec are designed to be blocking and synchronous. Bug: 14297827 Change-Id: If341c6e4407ca6f10f5e0d47008dddc0e20b0a50
Diffstat (limited to 'include')
-rw-r--r--include/media/stagefright/MediaCodec.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/media/stagefright/MediaCodec.h b/include/media/stagefright/MediaCodec.h
index 3e6eefb..3fa7b48 100644
--- a/include/media/stagefright/MediaCodec.h
+++ b/include/media/stagefright/MediaCodec.h
@@ -112,6 +112,10 @@ struct MediaCodec : public AHandler {
status_t getInputBuffers(Vector<sp<ABuffer> > *buffers) const;
status_t getOutputBuffers(Vector<sp<ABuffer> > *buffers) const;
+ status_t getOutputBuffer(size_t index, sp<ABuffer> *buffer);
+ status_t getOutputFormat(size_t index, sp<AMessage> *format);
+ status_t getInputBuffer(size_t index, sp<ABuffer> *buffer);
+
status_t requestIDRFrame();
// Notification will be posted once there "is something to do", i.e.
@@ -189,6 +193,7 @@ private:
sp<ABuffer> mData;
sp<ABuffer> mEncryptedData;
sp<AMessage> mNotify;
+ sp<AMessage> mFormat;
bool mOwnedByClient;
};
@@ -204,6 +209,12 @@ private:
sp<AMessage> mOutputFormat;
sp<AMessage> mInputFormat;
+ // Used only to synchronize asynchronous getBufferAndFormat
+ // across all the other (synchronous) buffer state change
+ // operations, such as de/queueIn/OutputBuffer, start and
+ // stop/flush/reset/release.
+ Mutex mBufferLock;
+
List<size_t> mAvailPortBuffers[2];
Vector<BufferInfo> mPortBuffers[2];
@@ -236,6 +247,10 @@ private:
status_t onReleaseOutputBuffer(const sp<AMessage> &msg);
ssize_t dequeuePortBuffer(int32_t portIndex);
+ status_t getBufferAndFormat(
+ size_t portIndex, size_t index,
+ sp<ABuffer> *buffer, sp<AMessage> *format);
+
bool handleDequeueInputBuffer(uint32_t replyID, bool newRequest = false);
bool handleDequeueOutputBuffer(uint32_t replyID, bool newRequest = false);
void cancelPendingDequeueOperations();