1d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa/* 2d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa * Copyright 2016, The Android Open Source Project 3d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa * 4d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa * Licensed under the Apache License, Version 2.0 (the "License"); 5d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa * you may not use this file except in compliance with the License. 6d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa * You may obtain a copy of the License at 7d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa * 8d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa * http://www.apache.org/licenses/LICENSE-2.0 9d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa * 10d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa * Unless required by applicable law or agreed to in writing, software 11d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa * distributed under the License is distributed on an "AS IS" BASIS, 12d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa * See the License for the specific language governing permissions and 14d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa * limitations under the License. 15d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa */ 16d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa 17d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa#ifndef ANDROID_HARDWARE_MEDIA_OMX_V1_0_WOMXNODE_H 18d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa#define ANDROID_HARDWARE_MEDIA_OMX_V1_0_WOMXNODE_H 19d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa 20d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa#include <hidl/MQDescriptor.h> 21d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa#include <hidl/Status.h> 22d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa 23d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa#include <utils/Errors.h> 24d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa#include <media/IOMX.h> 25d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa#include <hidl/HybridInterface.h> 26d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa 27d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa#include <android/hardware/media/omx/1.0/IOmxNode.h> 28d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa#include <android/hardware/media/omx/1.0/IOmxObserver.h> 29d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa 30d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasanamespace android { 31d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasanamespace hardware { 32d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasanamespace media { 33d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasanamespace omx { 34d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasanamespace V1_0 { 35d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasanamespace utils { 36d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa 37d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasausing ::android::hardware::media::omx::V1_0::CodecBuffer; 38d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasausing ::android::hardware::media::omx::V1_0::IOmxBufferSource; 39d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasausing ::android::hardware::media::omx::V1_0::IOmxNode; 40d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasausing ::android::hardware::media::omx::V1_0::IOmxObserver; 41d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasausing ::android::hardware::media::omx::V1_0::Message; 42d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasausing ::android::hardware::media::omx::V1_0::PortMode; 43d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasausing ::android::hardware::media::omx::V1_0::Status; 44d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasausing ::android::hidl::base::V1_0::IBase; 45d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasausing ::android::hardware::hidl_array; 46d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasausing ::android::hardware::hidl_memory; 47d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasausing ::android::hardware::hidl_string; 48d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasausing ::android::hardware::hidl_vec; 49d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasausing ::android::hardware::Return; 50d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasausing ::android::hardware::Void; 51d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasausing ::android::sp; 52d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa 53d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa/** 54d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa * Wrapper classes for conversion 55d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa * ============================== 56d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa * 57d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa * Naming convention: 58d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa * - LW = Legacy Wrapper --- It wraps a Treble object inside a legacy object. 59d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa * - TW = Treble Wrapper --- It wraps a legacy object inside a Treble object. 60d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa */ 61d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa 62d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasastruct LWOmxNode : public H2BConverter<IOmxNode, IOMXNode, BnOMXNode> { 63d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa LWOmxNode(sp<IOmxNode> const& base) : CBase(base) {} 64d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa status_t freeNode() override; 65d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa status_t sendCommand( 66d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa OMX_COMMANDTYPE cmd, OMX_S32 param) override; 67d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa status_t getParameter( 68d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa OMX_INDEXTYPE index, void *params, size_t size) override; 69d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa status_t setParameter( 70d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa OMX_INDEXTYPE index, const void *params, size_t size) override; 71d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa status_t getConfig( 72d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa OMX_INDEXTYPE index, void *params, size_t size) override; 73d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa status_t setConfig( 74d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa OMX_INDEXTYPE index, const void *params, size_t size) override; 75d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa status_t setPortMode( 76d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa OMX_U32 port_index, IOMX::PortMode mode) override; 77d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa status_t prepareForAdaptivePlayback( 78d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa OMX_U32 portIndex, OMX_BOOL enable, 79d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa OMX_U32 maxFrameWidth, OMX_U32 maxFrameHeight) override; 80d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa status_t configureVideoTunnelMode( 81d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa OMX_U32 portIndex, OMX_BOOL tunneled, 82d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa OMX_U32 audioHwSync, native_handle_t **sidebandHandle) override; 83d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa status_t getGraphicBufferUsage( 84d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa OMX_U32 port_index, OMX_U32* usage) override; 85d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa status_t setInputSurface( 86d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa const sp<IOMXBufferSource> &bufferSource) override; 87d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa status_t allocateSecureBuffer( 88d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa OMX_U32 port_index, size_t size, buffer_id *buffer, 89d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa void **buffer_data, sp<NativeHandle> *native_handle) override; 90d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa status_t useBuffer( 91d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa OMX_U32 port_index, const OMXBuffer &omxBuf, 92d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa buffer_id *buffer) override; 93d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa status_t freeBuffer( 94d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa OMX_U32 port_index, buffer_id buffer) override; 95d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa status_t fillBuffer( 96d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa buffer_id buffer, const OMXBuffer &omxBuf, 97d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa int fenceFd = -1) override; 98d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa status_t emptyBuffer( 99d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa buffer_id buffer, const OMXBuffer &omxBuf, 100d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa OMX_U32 flags, OMX_TICKS timestamp, int fenceFd = -1) override; 101d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa status_t getExtensionIndex( 102d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa const char *parameter_name, 103d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa OMX_INDEXTYPE *index) override; 104d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa status_t dispatchMessage(const omx_message &msg) override; 105d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa}; 106d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa 107d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasastruct TWOmxNode : public IOmxNode { 108d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa sp<IOMXNode> mBase; 109d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa TWOmxNode(sp<IOMXNode> const& base); 110d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa 111d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa Return<Status> freeNode() override; 112d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa Return<Status> sendCommand(uint32_t cmd, int32_t param) override; 113d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa Return<void> getParameter( 114d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa uint32_t index, hidl_vec<uint8_t> const& inParams, 115d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa getParameter_cb _hidl_cb) override; 116d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa Return<Status> setParameter( 117d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa uint32_t index, hidl_vec<uint8_t> const& params) override; 118d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa Return<void> getConfig( 119d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa uint32_t index, hidl_vec<uint8_t> const& inConfig, 120d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa getConfig_cb _hidl_cb) override; 121d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa Return<Status> setConfig( 122d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa uint32_t index, hidl_vec<uint8_t> const& config) override; 123d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa Return<Status> setPortMode(uint32_t portIndex, PortMode mode) override; 124d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa Return<Status> prepareForAdaptivePlayback( 125d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa uint32_t portIndex, bool enable, 126d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa uint32_t maxFrameWidth, uint32_t maxFrameHeight) override; 127d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa Return<void> configureVideoTunnelMode( 128d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa uint32_t portIndex, bool tunneled, uint32_t audioHwSync, 129d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa configureVideoTunnelMode_cb _hidl_cb) override; 130d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa Return<void> getGraphicBufferUsage( 131d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa uint32_t portIndex, 132d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa getGraphicBufferUsage_cb _hidl_cb) override; 133d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa Return<Status> setInputSurface( 134d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa sp<IOmxBufferSource> const& bufferSource) override; 135d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa Return<void> allocateSecureBuffer( 136d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa uint32_t portIndex, uint64_t size, 137d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa allocateSecureBuffer_cb _hidl_cb) override; 138d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa Return<void> useBuffer( 139d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa uint32_t portIndex, CodecBuffer const& codecBuffer, 140d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa useBuffer_cb _hidl_cb) override; 141d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa Return<Status> freeBuffer(uint32_t portIndex, uint32_t buffer) override; 142d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa Return<Status> fillBuffer( 143d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa uint32_t buffer, CodecBuffer const& codecBuffer, 144d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa const hidl_handle& fence) override; 145d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa Return<Status> emptyBuffer( 146d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa uint32_t buffer, CodecBuffer const& codecBuffer, 147d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa uint32_t flags, uint64_t timestampUs, 148d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa hidl_handle const& fence) override; 149d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa Return<void> getExtensionIndex( 150d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa hidl_string const& parameterName, 151d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa getExtensionIndex_cb _hidl_cb) override; 152d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa Return<Status> dispatchMessage(Message const& msg) override; 153d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa}; 154d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa 155d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa} // namespace utils 156d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa} // namespace V1_0 157d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa} // namespace omx 158d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa} // namespace media 159d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa} // namespace hardware 160d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa} // namespace android 161d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa 162d2075e8b86dbf6d7c6af7de6f2f698b1acf4c6dfPawin Vongmasa#endif // ANDROID_HARDWARE_MEDIA_OMX_V1_0_WOMXNODE_H 163