Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* |
michael@0 | 2 | * Copyright (C) 2009 The Android Open Source Project |
michael@0 | 3 | * |
michael@0 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
michael@0 | 5 | * you may not use this file except in compliance with the License. |
michael@0 | 6 | * You may obtain a copy of the License at |
michael@0 | 7 | * |
michael@0 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
michael@0 | 9 | * |
michael@0 | 10 | * Unless required by applicable law or agreed to in writing, software |
michael@0 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
michael@0 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
michael@0 | 13 | * See the License for the specific language governing permissions and |
michael@0 | 14 | * limitations under the License. |
michael@0 | 15 | */ |
michael@0 | 16 | |
michael@0 | 17 | #ifndef ANDROID_OMX_H_ |
michael@0 | 18 | #define ANDROID_OMX_H_ |
michael@0 | 19 | |
michael@0 | 20 | #include <media/IOMX.h> |
michael@0 | 21 | #include <utils/threads.h> |
michael@0 | 22 | #include <utils/KeyedVector.h> |
michael@0 | 23 | |
michael@0 | 24 | namespace android { |
michael@0 | 25 | |
michael@0 | 26 | struct OMXMaster; |
michael@0 | 27 | class OMXNodeInstance; |
michael@0 | 28 | |
michael@0 | 29 | class OMX : public BnOMX, |
michael@0 | 30 | public IBinder::DeathRecipient { |
michael@0 | 31 | public: |
michael@0 | 32 | OMX(); |
michael@0 | 33 | |
michael@0 | 34 | virtual bool livesLocally(pid_t pid); |
michael@0 | 35 | |
michael@0 | 36 | virtual status_t listNodes(List<ComponentInfo> *list); |
michael@0 | 37 | |
michael@0 | 38 | virtual status_t allocateNode( |
michael@0 | 39 | const char *name, const sp<IOMXObserver> &observer, node_id *node); |
michael@0 | 40 | |
michael@0 | 41 | virtual status_t freeNode(node_id node); |
michael@0 | 42 | |
michael@0 | 43 | virtual status_t sendCommand( |
michael@0 | 44 | node_id node, OMX_COMMANDTYPE cmd, OMX_S32 param); |
michael@0 | 45 | |
michael@0 | 46 | virtual status_t getParameter( |
michael@0 | 47 | node_id node, OMX_INDEXTYPE index, |
michael@0 | 48 | void *params, size_t size); |
michael@0 | 49 | |
michael@0 | 50 | virtual status_t setParameter( |
michael@0 | 51 | node_id node, OMX_INDEXTYPE index, |
michael@0 | 52 | const void *params, size_t size); |
michael@0 | 53 | |
michael@0 | 54 | virtual status_t getConfig( |
michael@0 | 55 | node_id node, OMX_INDEXTYPE index, |
michael@0 | 56 | void *params, size_t size); |
michael@0 | 57 | |
michael@0 | 58 | virtual status_t setConfig( |
michael@0 | 59 | node_id node, OMX_INDEXTYPE index, |
michael@0 | 60 | const void *params, size_t size); |
michael@0 | 61 | |
michael@0 | 62 | virtual status_t useBuffer( |
michael@0 | 63 | node_id node, OMX_U32 port_index, const sp<IMemory> ¶ms, |
michael@0 | 64 | buffer_id *buffer); |
michael@0 | 65 | |
michael@0 | 66 | virtual status_t allocateBuffer( |
michael@0 | 67 | node_id node, OMX_U32 port_index, size_t size, |
michael@0 | 68 | buffer_id *buffer, void **buffer_data); |
michael@0 | 69 | |
michael@0 | 70 | virtual status_t allocateBufferWithBackup( |
michael@0 | 71 | node_id node, OMX_U32 port_index, const sp<IMemory> ¶ms, |
michael@0 | 72 | buffer_id *buffer); |
michael@0 | 73 | |
michael@0 | 74 | virtual status_t freeBuffer( |
michael@0 | 75 | node_id node, OMX_U32 port_index, buffer_id buffer); |
michael@0 | 76 | |
michael@0 | 77 | virtual status_t fillBuffer(node_id node, buffer_id buffer); |
michael@0 | 78 | |
michael@0 | 79 | virtual status_t emptyBuffer( |
michael@0 | 80 | node_id node, |
michael@0 | 81 | buffer_id buffer, |
michael@0 | 82 | OMX_U32 range_offset, OMX_U32 range_length, |
michael@0 | 83 | OMX_U32 flags, OMX_TICKS timestamp); |
michael@0 | 84 | |
michael@0 | 85 | virtual status_t getExtensionIndex( |
michael@0 | 86 | node_id node, |
michael@0 | 87 | const char *parameter_name, |
michael@0 | 88 | OMX_INDEXTYPE *index); |
michael@0 | 89 | |
michael@0 | 90 | virtual sp<IOMXRenderer> createRenderer( |
michael@0 | 91 | const sp<ISurface> &surface, |
michael@0 | 92 | const char *componentName, |
michael@0 | 93 | OMX_COLOR_FORMATTYPE colorFormat, |
michael@0 | 94 | size_t encodedWidth, size_t encodedHeight, |
michael@0 | 95 | size_t displayWidth, size_t displayHeight, |
michael@0 | 96 | int32_t rotationDegrees); |
michael@0 | 97 | |
michael@0 | 98 | virtual void binderDied(const wp<IBinder> &the_late_who); |
michael@0 | 99 | |
michael@0 | 100 | OMX_ERRORTYPE OnEvent( |
michael@0 | 101 | node_id node, |
michael@0 | 102 | OMX_IN OMX_EVENTTYPE eEvent, |
michael@0 | 103 | OMX_IN OMX_U32 nData1, |
michael@0 | 104 | OMX_IN OMX_U32 nData2, |
michael@0 | 105 | OMX_IN OMX_PTR pEventData); |
michael@0 | 106 | |
michael@0 | 107 | OMX_ERRORTYPE OnEmptyBufferDone( |
michael@0 | 108 | node_id node, OMX_IN OMX_BUFFERHEADERTYPE *pBuffer); |
michael@0 | 109 | |
michael@0 | 110 | OMX_ERRORTYPE OnFillBufferDone( |
michael@0 | 111 | node_id node, OMX_IN OMX_BUFFERHEADERTYPE *pBuffer); |
michael@0 | 112 | |
michael@0 | 113 | void invalidateNodeID(node_id node); |
michael@0 | 114 | |
michael@0 | 115 | protected: |
michael@0 | 116 | virtual ~OMX(); |
michael@0 | 117 | |
michael@0 | 118 | private: |
michael@0 | 119 | struct CallbackDispatcher; |
michael@0 | 120 | |
michael@0 | 121 | Mutex mLock; |
michael@0 | 122 | OMXMaster *mMaster; |
michael@0 | 123 | int32_t mNodeCounter; |
michael@0 | 124 | |
michael@0 | 125 | KeyedVector<wp<IBinder>, OMXNodeInstance *> mLiveNodes; |
michael@0 | 126 | KeyedVector<node_id, OMXNodeInstance *> mNodeIDToInstance; |
michael@0 | 127 | KeyedVector<node_id, sp<CallbackDispatcher> > mDispatchers; |
michael@0 | 128 | |
michael@0 | 129 | node_id makeNodeID(OMXNodeInstance *instance); |
michael@0 | 130 | OMXNodeInstance *findInstance(node_id node); |
michael@0 | 131 | sp<CallbackDispatcher> findDispatcher(node_id node); |
michael@0 | 132 | |
michael@0 | 133 | void invalidateNodeID_l(node_id node); |
michael@0 | 134 | |
michael@0 | 135 | OMX(const OMX &); |
michael@0 | 136 | OMX &operator=(const OMX &); |
michael@0 | 137 | }; |
michael@0 | 138 | |
michael@0 | 139 | } // namespace android |
michael@0 | 140 | |
michael@0 | 141 | #endif // ANDROID_OMX_H_ |