summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorChong Zhang <chz@google.com>2014-07-08 18:50:05 -0700
committerChong Zhang <chz@google.com>2014-07-11 11:36:39 -0700
commitc5619c7a6dcc1137fde7520351ad5284e3e958ab (patch)
tree715a422369125ca8ee8d2a939309ee7afa13ae50 /include
parent7bad72237b49ac47e77ffe2a89fd26f3d171324c (diff)
downloadframeworks_av-c5619c7a6dcc1137fde7520351ad5284e3e958ab.zip
frameworks_av-c5619c7a6dcc1137fde7520351ad5284e3e958ab.tar.gz
frameworks_av-c5619c7a6dcc1137fde7520351ad5284e3e958ab.tar.bz2
MediaCodec async callbacks
Bug: 11990118 Change-Id: I6fe4b407d9c85cddec8d958620d5d356735273cf
Diffstat (limited to 'include')
-rw-r--r--include/media/stagefright/MediaCodec.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/media/stagefright/MediaCodec.h b/include/media/stagefright/MediaCodec.h
index 3fa7b48..046496c 100644
--- a/include/media/stagefright/MediaCodec.h
+++ b/include/media/stagefright/MediaCodec.h
@@ -44,6 +44,13 @@ struct MediaCodec : public AHandler {
BUFFER_FLAG_EOS = 4,
};
+ enum {
+ CB_INPUT_AVAILABLE = 1,
+ CB_OUTPUT_AVAILABLE = 2,
+ CB_ERROR = 3,
+ CB_OUTPUT_FORMAT_CHANGED = 4,
+ };
+
static sp<MediaCodec> CreateByType(
const sp<ALooper> &looper, const char *mime, bool encoder);
@@ -56,6 +63,8 @@ struct MediaCodec : public AHandler {
const sp<ICrypto> &crypto,
uint32_t flags);
+ status_t setCallback(const sp<AMessage> &callback);
+
status_t createInputSurface(sp<IGraphicBufferProducer>* bufferProducer);
status_t start();
@@ -173,6 +182,7 @@ private:
kWhatRequestActivityNotification = 'racN',
kWhatGetName = 'getN',
kWhatSetParameters = 'setP',
+ kWhatSetCallback = 'setC',
};
enum {
@@ -186,6 +196,7 @@ private:
kFlagSawMediaServerDie = 128,
kFlagIsEncoder = 256,
kFlagGatherCodecSpecificData = 512,
+ kFlagIsAsync = 1024,
};
struct BufferInfo {
@@ -208,6 +219,7 @@ private:
SoftwareRenderer *mSoftRenderer;
sp<AMessage> mOutputFormat;
sp<AMessage> mInputFormat;
+ sp<AMessage> mCallback;
// Used only to synchronize asynchronous getBufferAndFormat
// across all the other (synchronous) buffer state change
@@ -237,6 +249,8 @@ private:
static status_t PostAndAwaitResponse(
const sp<AMessage> &msg, sp<AMessage> *response);
+ static void PostReplyWithError(int32_t replyID, int32_t err);
+
status_t init(const char *name, bool nameIsType, bool encoder);
void setState(State newState);
@@ -263,6 +277,11 @@ private:
void postActivityNotificationIfPossible();
+ void onInputBufferAvailable();
+ void onOutputBufferAvailable();
+ void onError(int32_t actionCode, status_t err);
+ void onOutputFormatChanged();
+
status_t onSetParameters(const sp<AMessage> &params);
status_t amendOutputFormatWithCodecSpecificData(const sp<ABuffer> &buffer);