diff options
author | Chong Zhang <chz@google.com> | 2014-07-11 19:17:04 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-07-10 21:09:47 +0000 |
commit | 2db91ae0e6aa33b50cc924ad65d6dc01876d220f (patch) | |
tree | 64307e39e24244cfaa09f497067e393e5c59cc89 /include/media | |
parent | 2829edccd7d2bb8244246f316face82b650b8949 (diff) | |
parent | c5619c7a6dcc1137fde7520351ad5284e3e958ab (diff) | |
download | frameworks_av-2db91ae0e6aa33b50cc924ad65d6dc01876d220f.zip frameworks_av-2db91ae0e6aa33b50cc924ad65d6dc01876d220f.tar.gz frameworks_av-2db91ae0e6aa33b50cc924ad65d6dc01876d220f.tar.bz2 |
Merge "MediaCodec async callbacks"
Diffstat (limited to 'include/media')
-rw-r--r-- | include/media/stagefright/MediaCodec.h | 19 |
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> ¶ms); status_t amendOutputFormatWithCodecSpecificData(const sp<ABuffer> &buffer); |