diff options
author | Andreas Huber <andih@google.com> | 2009-10-15 13:46:54 -0700 |
---|---|---|
committer | Andreas Huber <andih@google.com> | 2009-10-16 11:22:43 -0700 |
commit | 318ad9c1d9d6515026dfc2c021359d27decaa7a1 (patch) | |
tree | 28a58c4e3f20528b01c2abd08ba5f62d8755650c /media/libstagefright/include/OMXNodeInstance.h | |
parent | 89e69da4d86348409994c9dafbbb2634ccd7c196 (diff) | |
download | frameworks_av-318ad9c1d9d6515026dfc2c021359d27decaa7a1.zip frameworks_av-318ad9c1d9d6515026dfc2c021359d27decaa7a1.tar.gz frameworks_av-318ad9c1d9d6515026dfc2c021359d27decaa7a1.tar.bz2 |
Reimplement the OMX backend for stagefright.
Besides a major cleanup and refactoring, OMX is now a singleton living in the media server, it listens for death notifications of node observers/clients that allocated OMX nodes and performs/attempts cleanup.
Changed APIs to conform to the rest of the system.
Diffstat (limited to 'media/libstagefright/include/OMXNodeInstance.h')
-rw-r--r-- | media/libstagefright/include/OMXNodeInstance.h | 115 |
1 files changed, 115 insertions, 0 deletions
diff --git a/media/libstagefright/include/OMXNodeInstance.h b/media/libstagefright/include/OMXNodeInstance.h new file mode 100644 index 0000000..181742e --- /dev/null +++ b/media/libstagefright/include/OMXNodeInstance.h @@ -0,0 +1,115 @@ +/* + * Copyright (C) 2009 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OMX_NODE_INSTANCE_H_ + +#define OMX_NODE_INSTANCE_H_ + +#include "OMX.h" + +#include <utils/RefBase.h> +#include <utils/threads.h> + +namespace android { + +class IOMXObserver; + +struct OMXNodeInstance { + OMXNodeInstance( + OMX *owner, const sp<IOMXObserver> &observer); + + void setHandle(OMX::node_id node_id, OMX_HANDLETYPE handle); + + OMX *owner(); + sp<IOMXObserver> observer(); + OMX::node_id nodeID(); + + status_t freeNode(); + + status_t sendCommand(OMX_COMMANDTYPE cmd, OMX_S32 param); + status_t getParameter(OMX_INDEXTYPE index, void *params, size_t size); + + status_t setParameter( + OMX_INDEXTYPE index, const void *params, size_t size); + + status_t getConfig(OMX_INDEXTYPE index, void *params, size_t size); + status_t setConfig(OMX_INDEXTYPE index, const void *params, size_t size); + + status_t useBuffer( + OMX_U32 portIndex, const sp<IMemory> ¶ms, + OMX::buffer_id *buffer); + + status_t allocateBuffer( + OMX_U32 portIndex, size_t size, OMX::buffer_id *buffer); + + status_t allocateBufferWithBackup( + OMX_U32 portIndex, const sp<IMemory> ¶ms, + OMX::buffer_id *buffer); + + status_t freeBuffer(OMX_U32 portIndex, OMX::buffer_id buffer); + + status_t fillBuffer(OMX::buffer_id buffer); + + status_t emptyBuffer( + OMX::buffer_id buffer, + OMX_U32 rangeOffset, OMX_U32 rangeLength, + OMX_U32 flags, OMX_TICKS timestamp); + + status_t getExtensionIndex( + const char *parameterName, OMX_INDEXTYPE *index); + + void onMessage(const omx_message &msg); + void onObserverDied(); + void onGetHandleFailed(); + + static OMX_CALLBACKTYPE kCallbacks; + +private: + Mutex mLock; + + OMX *mOwner; + OMX::node_id mNodeID; + OMX_HANDLETYPE mHandle; + sp<IOMXObserver> mObserver; + + ~OMXNodeInstance(); + + static OMX_ERRORTYPE OnEvent( + OMX_IN OMX_HANDLETYPE hComponent, + OMX_IN OMX_PTR pAppData, + OMX_IN OMX_EVENTTYPE eEvent, + OMX_IN OMX_U32 nData1, + OMX_IN OMX_U32 nData2, + OMX_IN OMX_PTR pEventData); + + static OMX_ERRORTYPE OnEmptyBufferDone( + OMX_IN OMX_HANDLETYPE hComponent, + OMX_IN OMX_PTR pAppData, + OMX_IN OMX_BUFFERHEADERTYPE *pBuffer); + + static OMX_ERRORTYPE OnFillBufferDone( + OMX_IN OMX_HANDLETYPE hComponent, + OMX_IN OMX_PTR pAppData, + OMX_IN OMX_BUFFERHEADERTYPE *pBuffer); + + OMXNodeInstance(const OMXNodeInstance &); + OMXNodeInstance &operator=(const OMXNodeInstance &); +}; + +} // namespace android + +#endif // OMX_NODE_INSTANCE_H_ + |