media/omx-plugin/include/froyo/OMX.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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

mercurial