/* * Copyright (c) 2014 Amlogic, Inc. All rights reserved. * * This source code is subject to the terms and conditions defined in the * file 'LICENSE' which is part of this source code package. * * Description: c++ file */ #define LOG_MODULE_TAG "TV" #define LOG_CLASS_TAG "CTvDisplayadapter" #include #include #include "CTvLog.h" #include "tvutils.h" #include #include #include "CTvDisplayadapter.h" CTvDisplayadapter::CTvDisplayadapter(int source) { mIsEnabled = isDiBackend(); mSource = source; mDisplayId = -1; mLayerId = -1; mTunnelId = -1; } CTvDisplayadapter::~CTvDisplayadapter() { #ifdef USE_VIDEOCOMPOSER if (mDisplayId != -1 && mLayerId != -1) { dispAdptDestroyLayer(mDisplayId, mLayerId); } #endif } void CTvDisplayadapter::TV_setDisplayadapterParam(int displayId, int tunnelId) { #ifdef USE_VIDEOCOMPOSER if (!mIsEnabled) { LOGD("%s, not enable, return\n", __FUNCTION__); return; } mDisplayId = displayId; mTunnelId = tunnelId; LOGD("%s,source:[%d] displayId:%d, tunnelId:%d.\n", __FUNCTION__, mSource, displayId, tunnelId); #else LOGD("%s:source:[%d] unsupport videocompositor\n", __FUNCTION__, mSource); #endif } int CTvDisplayadapter::TV_dispAdptCreateLayer() { int ret = -1; #ifdef USE_VIDEOCOMPOSER if (!mIsEnabled) { LOGD("%s,source:[%d] not enable, return\n", __FUNCTION__, mSource); return ret; } ret = dispAdptCreateLayer(mDisplayId, &mLayerId); if (ret == MESON_ERROR_NONE) { ret = dispAdptSetTunnelId(mDisplayId, mLayerId, mTunnelId); LOGD("%s:source:[%d] tunnelId:%d\n", __FUNCTION__, mSource, mTunnelId); } #else LOGD("%s:source:[%d] unsupport videocompositor\n", __FUNCTION__, mSource); #endif return ret; } int CTvDisplayadapter::TV_dispAdptDestroyLayer() { int ret = -1; #ifdef USE_VIDEOCOMPOSER if (!mIsEnabled) { LOGD("%s,source:[%d] not enable, return\n", __FUNCTION__, mSource); return ret; } LOGD("%s:source:[%d] displayId:%d layerId:%d\n", __FUNCTION__, mSource, mDisplayId, mLayerId); ret = dispAdptDestroyLayer(mDisplayId, mLayerId); mDisplayId = -1; mLayerId = -1; mLayerId = -1; #else LOGD("%s:source:[%d] unsupport videocompositor\n", __FUNCTION__, mSource); #endif return ret; } int CTvDisplayadapter::TV_dispAdptSetLayerZorder(int zorder) { int ret = -1; #ifdef USE_VIDEOCOMPOSER if (!mIsEnabled) { LOGD("%s,source:[%d] not enable, return\n", __FUNCTION__, mSource); return ret; } LOGD("%s:source:[%d] displayId:%d layerId:%d, zorder:%d\n", __FUNCTION__, mSource, mDisplayId, mLayerId, zorder); ret = dispAdptSetLayerZorder(mDisplayId, mLayerId, zorder); #else LOGD("%s:source:[%d] unsupport videocompositor\n", __FUNCTION__, mSource); #endif return ret; } int CTvDisplayadapter::TV_dispAdptSetLayerSourceCrop(tv_rect crop) { int ret = -1; #ifdef USE_VIDEOCOMPOSER if (!mIsEnabled) { LOGD("%s,source:[%d] not enable, return\n", __FUNCTION__, mSource); return ret; } LOGD("%s:source:[%d] displayId:%d layerId:%d crop[x:%d,y:%d,w:%d,h:%d]\n", __FUNCTION__, mSource, mDisplayId, mLayerId, crop.x, crop.y, crop.w, crop.h); //rect DisplayCrop = crop; ret = dispAdptSetLayerSourceCrop(mDisplayId, mLayerId, crop); #else LOGD("%s:source:[%d] unsupport videocompositor\n", __FUNCTION__, mSource); #endif return ret; } int CTvDisplayadapter::TV_dispAdptSetLayerDispFrame(tv_rect frame) { int ret = -1; #ifdef USE_VIDEOCOMPOSER LOGD("%s:source:[%d] displayId:%d layerId:%d DispFrame[x:%d,y:%d,w:%d,h:%d]\n", __FUNCTION__, mSource, mDisplayId, mLayerId, frame.x, frame.y, frame.w, frame.h); //rect DisplayFrame = frame; ret = dispAdptSetLayerDispFrame(mDisplayId, mLayerId, frame); #else LOGD("%s:source:[%d] unsupport videocompositor\n", __FUNCTION__, mSource); #endif return ret; }