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 */
16
17#ifndef ANDROID_OMX_H_
18#define ANDROID_OMX_H_
19
20#include <media/IOMX.h>
21#include <utils/threads.h>
22#include <utils/KeyedVector.h>
23#include <media/vndk/xmlparser/1.0/MediaCodecsXmlParser.h>
24#include "OmxNodeOwner.h"
25
26namespace android {
27
28struct OMXMaster;
29struct OMXNodeInstance;
30
31class OMX : public BnOMX,
32            public OmxNodeOwner,
33            public IBinder::DeathRecipient {
34public:
35    OMX();
36
37    virtual status_t listNodes(List<ComponentInfo> *list);
38
39    virtual status_t allocateNode(
40            const char *name, const sp<IOMXObserver> &observer,
41            sp<IOMXNode> *omxNode);
42
43    virtual status_t createInputSurface(
44            sp<IGraphicBufferProducer> *bufferProducer,
45            sp<IGraphicBufferSource> *bufferSource);
46
47    virtual void binderDied(const wp<IBinder> &the_late_who);
48
49    virtual status_t freeNode(const sp<OMXNodeInstance>& instance);
50
51protected:
52    virtual ~OMX();
53
54private:
55    Mutex mLock;
56    OMXMaster *mMaster;
57    MediaCodecsXmlParser mParser;
58
59    KeyedVector<wp<IBinder>, sp<OMXNodeInstance> > mLiveNodes;
60
61    OMX(const OMX &);
62    OMX &operator=(const OMX &);
63};
64
65}  // namespace android
66
67#endif  // ANDROID_OMX_H_
68