diff options
Diffstat (limited to 'media/libstagefright/include')
3 files changed, 61 insertions, 3 deletions
diff --git a/media/libstagefright/include/OMXNodeInstance.h b/media/libstagefright/include/OMXNodeInstance.h index 24d431c..104dcfc 100644 --- a/media/libstagefright/include/OMXNodeInstance.h +++ b/media/libstagefright/include/OMXNodeInstance.h @@ -31,7 +31,7 @@ struct GraphicBufferSource; struct OMXNodeInstance { OMXNodeInstance( - OMX *owner, const sp<IOMXObserver> &observer); + OMX *owner, const sp<IOMXObserver> &observer, const char *name); void setHandle(OMX::node_id node_id, OMX_HANDLETYPE handle); @@ -149,6 +149,18 @@ private: KeyedVector<OMX_BUFFERHEADERTYPE *, OMX::buffer_id> mBufferHeaderToBufferID; #endif + // For debug support + char *mName; + int DEBUG; + size_t mNumPortBuffers[2]; // modified under mLock, read outside for debug + Mutex mDebugLock; + // following are modified and read under mDebugLock + int DEBUG_BUMP; + SortedVector<OMX_BUFFERHEADERTYPE *> mInputBuffersWithCodec, mOutputBuffersWithCodec; + size_t mDebugLevelBumpPendingBuffers[2]; + void bumpDebugLevel_l(size_t numInputBuffers, size_t numOutputBuffers); + void unbumpDebugLevel_l(size_t portIndex); + ~OMXNodeInstance(); void addActiveBuffer(OMX_U32 portIndex, OMX::buffer_id id); @@ -186,6 +198,10 @@ private: OMX_U32 portIndex, OMX_BOOL enable, OMX_BOOL useGraphicBuffer, OMX_BOOL *usingGraphicBufferInMeta); + status_t emptyBuffer_l( + OMX_BUFFERHEADERTYPE *header, + OMX_U32 flags, OMX_TICKS timestamp, intptr_t debugAddr); + sp<GraphicBufferSource> getGraphicBufferSource(); void setGraphicBufferSource(const sp<GraphicBufferSource>& bufferSource); diff --git a/media/libstagefright/include/SoftVideoDecoderOMXComponent.h b/media/libstagefright/include/SoftVideoDecoderOMXComponent.h index 9e97ebd..4529007 100644 --- a/media/libstagefright/include/SoftVideoDecoderOMXComponent.h +++ b/media/libstagefright/include/SoftVideoDecoderOMXComponent.h @@ -61,9 +61,10 @@ protected: void initPorts(OMX_U32 numInputBuffers, OMX_U32 inputBufferSize, OMX_U32 numOutputBuffers, - const char *mimeType); + const char *mimeType, + OMX_U32 minCompressionRatio = 1u); - virtual void updatePortDefinitions(bool updateCrop = true); + virtual void updatePortDefinitions(bool updateCrop = true, bool updateInputSize = false); uint32_t outputBufferWidth(); uint32_t outputBufferHeight(); @@ -99,6 +100,9 @@ protected: } mOutputPortSettingsChange; private: + uint32_t mMinInputBufferSize; + uint32_t mMinCompressionRatio; + const char *mComponentRole; OMX_VIDEO_CODINGTYPE mCodingType; const CodecProfileLevel *mProfileLevels; diff --git a/media/libstagefright/include/SoftVideoEncoderOMXComponent.h b/media/libstagefright/include/SoftVideoEncoderOMXComponent.h index b3b810d..b43635d 100644 --- a/media/libstagefright/include/SoftVideoEncoderOMXComponent.h +++ b/media/libstagefright/include/SoftVideoEncoderOMXComponent.h @@ -18,6 +18,8 @@ #define SOFT_VIDEO_ENCODER_OMX_COMPONENT_H_ +#include <media/IOMX.h> + #include "SimpleSoftOMXComponent.h" #include <system/window.h> @@ -28,11 +30,26 @@ namespace android { struct SoftVideoEncoderOMXComponent : public SimpleSoftOMXComponent { SoftVideoEncoderOMXComponent( const char *name, + const char *componentRole, + OMX_VIDEO_CODINGTYPE codingType, + const CodecProfileLevel *profileLevels, + size_t numProfileLevels, + int32_t width, + int32_t height, const OMX_CALLBACKTYPE *callbacks, OMX_PTR appData, OMX_COMPONENTTYPE **component); + virtual OMX_ERRORTYPE internalSetParameter(OMX_INDEXTYPE index, const OMX_PTR param); + virtual OMX_ERRORTYPE internalGetParameter(OMX_INDEXTYPE index, OMX_PTR params); + protected: + void initPorts( + OMX_U32 numInputBuffers, OMX_U32 numOutputBuffers, OMX_U32 outputBufferSize, + const char *mime, OMX_U32 minCompressionRatio = 1); + + static void setRawVideoSize(OMX_PARAM_PORTDEFINITIONTYPE *def); + static void ConvertFlexYUVToPlanar( uint8_t *dst, size_t dstStride, size_t dstVStride, struct android_ycbcr *ycbcr, int32_t width, int32_t height); @@ -56,9 +73,30 @@ protected: kOutputPortIndex = 1, }; + bool mInputDataIsMeta; + int32_t mWidth; // width of the input frames + int32_t mHeight; // height of the input frames + uint32_t mBitrate; // target bitrate set for the encoder, in bits per second + uint32_t mFramerate; // target framerate set for the encoder, in Q16 format + OMX_COLOR_FORMATTYPE mColorFormat; // Color format for the input port + private: + void updatePortParams(); + OMX_ERRORTYPE internalSetPortParams(const OMX_PARAM_PORTDEFINITIONTYPE* port); + + static const uint32_t kInputBufferAlignment = 1; + static const uint32_t kOutputBufferAlignment = 2; + mutable const hw_module_t *mGrallocModule; + uint32_t mMinOutputBufferSize; + uint32_t mMinCompressionRatio; + + const char *mComponentRole; + OMX_VIDEO_CODINGTYPE mCodingType; + const CodecProfileLevel *mProfileLevels; + size_t mNumProfileLevels; + DISALLOW_EVIL_CONSTRUCTORS(SoftVideoEncoderOMXComponent); }; |