michael@0: /* michael@0: * Copyright (C) 2009 The Android Open Source Project michael@0: * michael@0: * Licensed under the Apache License, Version 2.0 (the "License"); michael@0: * you may not use this file except in compliance with the License. michael@0: * You may obtain a copy of the License at michael@0: * michael@0: * http://www.apache.org/licenses/LICENSE-2.0 michael@0: * michael@0: * Unless required by applicable law or agreed to in writing, software michael@0: * distributed under the License is distributed on an "AS IS" BASIS, michael@0: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. michael@0: * See the License for the specific language governing permissions and michael@0: * limitations under the License. michael@0: */ michael@0: michael@0: #ifndef ANDROID_OMX_H_ michael@0: #define ANDROID_OMX_H_ michael@0: michael@0: #include michael@0: #include michael@0: #include michael@0: michael@0: namespace android { michael@0: michael@0: struct OMXMaster; michael@0: class OMXNodeInstance; michael@0: michael@0: class OMX : public BnOMX, michael@0: public IBinder::DeathRecipient { michael@0: public: michael@0: OMX(); michael@0: michael@0: virtual bool livesLocally(pid_t pid); michael@0: michael@0: virtual status_t listNodes(List *list); michael@0: michael@0: virtual status_t allocateNode( michael@0: const char *name, const sp &observer, node_id *node); michael@0: michael@0: virtual status_t freeNode(node_id node); michael@0: michael@0: virtual status_t sendCommand( michael@0: node_id node, OMX_COMMANDTYPE cmd, OMX_S32 param); michael@0: michael@0: virtual status_t getParameter( michael@0: node_id node, OMX_INDEXTYPE index, michael@0: void *params, size_t size); michael@0: michael@0: virtual status_t setParameter( michael@0: node_id node, OMX_INDEXTYPE index, michael@0: const void *params, size_t size); michael@0: michael@0: virtual status_t getConfig( michael@0: node_id node, OMX_INDEXTYPE index, michael@0: void *params, size_t size); michael@0: michael@0: virtual status_t setConfig( michael@0: node_id node, OMX_INDEXTYPE index, michael@0: const void *params, size_t size); michael@0: michael@0: virtual status_t useBuffer( michael@0: node_id node, OMX_U32 port_index, const sp ¶ms, michael@0: buffer_id *buffer); michael@0: michael@0: virtual status_t allocateBuffer( michael@0: node_id node, OMX_U32 port_index, size_t size, michael@0: buffer_id *buffer, void **buffer_data); michael@0: michael@0: virtual status_t allocateBufferWithBackup( michael@0: node_id node, OMX_U32 port_index, const sp ¶ms, michael@0: buffer_id *buffer); michael@0: michael@0: virtual status_t freeBuffer( michael@0: node_id node, OMX_U32 port_index, buffer_id buffer); michael@0: michael@0: virtual status_t fillBuffer(node_id node, buffer_id buffer); michael@0: michael@0: virtual status_t emptyBuffer( michael@0: node_id node, michael@0: buffer_id buffer, michael@0: OMX_U32 range_offset, OMX_U32 range_length, michael@0: OMX_U32 flags, OMX_TICKS timestamp); michael@0: michael@0: virtual status_t getExtensionIndex( michael@0: node_id node, michael@0: const char *parameter_name, michael@0: OMX_INDEXTYPE *index); michael@0: michael@0: virtual sp createRenderer( michael@0: const sp &surface, michael@0: const char *componentName, michael@0: OMX_COLOR_FORMATTYPE colorFormat, michael@0: size_t encodedWidth, size_t encodedHeight, michael@0: size_t displayWidth, size_t displayHeight); michael@0: michael@0: virtual void binderDied(const wp &the_late_who); michael@0: michael@0: OMX_ERRORTYPE OnEvent( michael@0: node_id node, michael@0: OMX_IN OMX_EVENTTYPE eEvent, michael@0: OMX_IN OMX_U32 nData1, michael@0: OMX_IN OMX_U32 nData2, michael@0: OMX_IN OMX_PTR pEventData); michael@0: michael@0: OMX_ERRORTYPE OnEmptyBufferDone( michael@0: node_id node, OMX_IN OMX_BUFFERHEADERTYPE *pBuffer); michael@0: michael@0: OMX_ERRORTYPE OnFillBufferDone( michael@0: node_id node, OMX_IN OMX_BUFFERHEADERTYPE *pBuffer); michael@0: michael@0: void invalidateNodeID(node_id node); michael@0: michael@0: protected: michael@0: virtual ~OMX(); michael@0: michael@0: private: michael@0: Mutex mLock; michael@0: michael@0: OMXMaster *mMaster; michael@0: michael@0: struct CallbackDispatcher; michael@0: sp mDispatcher; michael@0: michael@0: int32_t mNodeCounter; michael@0: michael@0: KeyedVector, OMXNodeInstance *> mLiveNodes; michael@0: KeyedVector mNodeIDToInstance; michael@0: michael@0: node_id makeNodeID(OMXNodeInstance *instance); michael@0: OMXNodeInstance *findInstance(node_id node); michael@0: michael@0: void invalidateNodeID_l(node_id node); michael@0: michael@0: OMX(const OMX &); michael@0: OMX &operator=(const OMX &); michael@0: }; michael@0: michael@0: } // namespace android michael@0: michael@0: #endif // ANDROID_OMX_H_