120111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber/*
220111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber * Copyright (C) 2009 The Android Open Source Project
320111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber *
420111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber * Licensed under the Apache License, Version 2.0 (the "License");
520111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber * you may not use this file except in compliance with the License.
620111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber * You may obtain a copy of the License at
720111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber *
820111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber *      http://www.apache.org/licenses/LICENSE-2.0
920111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber *
1020111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber * Unless required by applicable law or agreed to in writing, software
1120111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber * distributed under the License is distributed on an "AS IS" BASIS,
1220111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1320111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber * See the License for the specific language governing permissions and
1420111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber * limitations under the License.
1520111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber */
1620111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber
1720111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber#ifndef ANDROID_OMX_H_
1820111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber#define ANDROID_OMX_H_
1920111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber
2020111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber#include <media/IOMX.h>
2120111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber#include <utils/threads.h>
22318ad9c1d9d6515026dfc2c021359d27decaa7a1Andreas Huber#include <utils/KeyedVector.h>
236ed07dc02d4240f94e7fb0786fb263bdc7a610baPawin Vongmasa#include <media/vndk/xmlparser/1.0/MediaCodecsXmlParser.h>
24d3ed3883c2d7bf3fb871be512055ed72cea964daPawin Vongmasa#include "OmxNodeOwner.h"
25d3ed3883c2d7bf3fb871be512055ed72cea964daPawin Vongmasa
2620111aa043c5f404472bc63b90bc5aad906b1101Andreas Hubernamespace android {
2720111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber
28e3ec3cec3a2e27033249ff82964d2cbd441d9873Andreas Huberstruct OMXMaster;
29ee4e1b1a63758941460ae79a064249d3a5189443Lajos Molnarstruct OMXNodeInstance;
3020111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber
31318ad9c1d9d6515026dfc2c021359d27decaa7a1Andreas Huberclass OMX : public BnOMX,
32d3ed3883c2d7bf3fb871be512055ed72cea964daPawin Vongmasa            public OmxNodeOwner,
33318ad9c1d9d6515026dfc2c021359d27decaa7a1Andreas Huber            public IBinder::DeathRecipient {
3420111aa043c5f404472bc63b90bc5aad906b1101Andreas Huberpublic:
3520111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber    OMX();
3620111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber
37134ee6a324c35f39e3576172e4eae4c6de6eb9dcAndreas Huber    virtual status_t listNodes(List<ComponentInfo> *list);
3820111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber
39318ad9c1d9d6515026dfc2c021359d27decaa7a1Andreas Huber    virtual status_t allocateNode(
4023858874bbce68fb5ac83250087fa7788c97dd12Marco Nelissen            const char *name, const sp<IOMXObserver> &observer,
411d2e9cfbe3f2db16ecafd2adafb4c60d7235a2ceChong Zhang            sp<IOMXNode> *omxNode);
427cd58537932ef6f481f68be0b9c597a89cebdfecAndy McFadden
43addf2cbb120346ae42e78fa739245a353db5edadChong Zhang    virtual status_t createInputSurface(
44d291c222357303b9611cab89d0c3b047584ef377Chong Zhang            sp<IGraphicBufferProducer> *bufferProducer,
45addf2cbb120346ae42e78fa739245a353db5edadChong Zhang            sp<IGraphicBufferSource> *bufferSource);
46d291c222357303b9611cab89d0c3b047584ef377Chong Zhang
47318ad9c1d9d6515026dfc2c021359d27decaa7a1Andreas Huber    virtual void binderDied(const wp<IBinder> &the_late_who);
4820111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber
49d3ed3883c2d7bf3fb871be512055ed72cea964daPawin Vongmasa    virtual status_t freeNode(const sp<OMXNodeInstance>& instance);
50318ad9c1d9d6515026dfc2c021359d27decaa7a1Andreas Huber
51e3ec3cec3a2e27033249ff82964d2cbd441d9873Andreas Huberprotected:
52e3ec3cec3a2e27033249ff82964d2cbd441d9873Andreas Huber    virtual ~OMX();
53e3ec3cec3a2e27033249ff82964d2cbd441d9873Andreas Huber
54318ad9c1d9d6515026dfc2c021359d27decaa7a1Andreas Huberprivate:
5578d26445a7dfe8f49d7005185f28b01cffe80adfJames Dong    Mutex mLock;
5678d26445a7dfe8f49d7005185f28b01cffe80adfJames Dong    OMXMaster *mMaster;
576ed07dc02d4240f94e7fb0786fb263bdc7a610baPawin Vongmasa    MediaCodecsXmlParser mParser;
58318ad9c1d9d6515026dfc2c021359d27decaa7a1Andreas Huber
59d59b97223424a3974d2ac31cff998d02eecf2eedChong Zhang    KeyedVector<wp<IBinder>, sp<OMXNodeInstance> > mLiveNodes;
6020111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber
6120111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber    OMX(const OMX &);
6220111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber    OMX &operator=(const OMX &);
6320111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber};
6420111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber
6520111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber}  // namespace android
6620111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber
6720111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber#endif  // ANDROID_OMX_H_
68