diff options
Diffstat (limited to 'include/media/stagefright/MediaCodec.h')
-rw-r--r-- | include/media/stagefright/MediaCodec.h | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/include/media/stagefright/MediaCodec.h b/include/media/stagefright/MediaCodec.h index b1e57cf..76aa503 100644 --- a/include/media/stagefright/MediaCodec.h +++ b/include/media/stagefright/MediaCodec.h @@ -18,7 +18,7 @@ #define MEDIA_CODEC_H_ -#include <gui/ISurfaceTexture.h> +#include <gui/IGraphicBufferProducer.h> #include <media/hardware/CryptoAPI.h> #include <media/stagefright/foundation/AHandler.h> #include <utils/Vector.h> @@ -31,7 +31,7 @@ struct AMessage; struct AString; struct ICrypto; struct SoftwareRenderer; -struct SurfaceTextureClient; +struct Surface; struct MediaCodec : public AHandler { enum ConfigureFlags { @@ -52,10 +52,12 @@ struct MediaCodec : public AHandler { status_t configure( const sp<AMessage> &format, - const sp<SurfaceTextureClient> &nativeWindow, + const sp<Surface> &nativeWindow, const sp<ICrypto> &crypto, uint32_t flags); + status_t createInputSurface(sp<IGraphicBufferProducer>* bufferProducer); + status_t start(); // Returns to a state in which the component remains allocated but @@ -101,6 +103,8 @@ struct MediaCodec : public AHandler { status_t renderOutputBufferAndRelease(size_t index); status_t releaseOutputBuffer(size_t index); + status_t signalEndOfInputStream(); + status_t getOutputFormat(sp<AMessage> *format) const; status_t getInputBuffers(Vector<sp<ABuffer> > *buffers) const; @@ -115,6 +119,8 @@ struct MediaCodec : public AHandler { status_t getName(AString *componentName) const; + status_t setParameters(const sp<AMessage> ¶ms); + protected: virtual ~MediaCodec(); virtual void onMessageReceived(const sp<AMessage> &msg); @@ -141,6 +147,7 @@ private: enum { kWhatInit = 'init', kWhatConfigure = 'conf', + kWhatCreateInputSurface = 'cisf', kWhatStart = 'strt', kWhatStop = 'stop', kWhatRelease = 'rele', @@ -148,6 +155,7 @@ private: kWhatQueueInputBuffer = 'queI', kWhatDequeueOutputBuffer = 'deqO', kWhatReleaseOutputBuffer = 'relO', + kWhatSignalEndOfInputStream = 'eois', kWhatGetBuffers = 'getB', kWhatFlush = 'flus', kWhatGetOutputFormat = 'getO', @@ -157,6 +165,7 @@ private: kWhatRequestIDRFrame = 'ridr', kWhatRequestActivityNotification = 'racN', kWhatGetName = 'getN', + kWhatSetParameters = 'setP', }; enum { @@ -167,6 +176,9 @@ private: kFlagDequeueInputPending = 16, kFlagDequeueOutputPending = 32, kFlagIsSecure = 64, + kFlagSawMediaServerDie = 128, + kFlagIsEncoder = 256, + kFlagGatherCodecSpecificData = 512, }; struct BufferInfo { @@ -184,7 +196,7 @@ private: AString mComponentName; uint32_t mReplyID; uint32_t mFlags; - sp<SurfaceTextureClient> mNativeWindow; + sp<Surface> mNativeWindow; SoftwareRenderer *mSoftRenderer; sp<AMessage> mOutputFormat; @@ -203,6 +215,8 @@ private: sp<AMessage> mActivityNotify; + bool mHaveInputSurface; + MediaCodec(const sp<ALooper> &looper); static status_t PostAndAwaitResponse( @@ -226,10 +240,14 @@ private: status_t queueCSDInputBuffer(size_t bufferIndex); status_t setNativeWindow( - const sp<SurfaceTextureClient> &surfaceTextureClient); + const sp<Surface> &surface); void postActivityNotificationIfPossible(); + status_t onSetParameters(const sp<AMessage> ¶ms); + + status_t amendOutputFormatWithCodecSpecificData(const sp<ABuffer> &buffer); + DISALLOW_EVIL_CONSTRUCTORS(MediaCodec); }; |