author | jintao.xu <jintao.xu@amlogic.com> | 2014-07-08 06:45:20 (GMT) |
---|---|---|
committer | tao.dong <tao.dong@amlogic.com> | 2014-07-11 08:08:05 (GMT) |
commit | b2b58450de6464be65d83459687ad86222c885d9 (patch) | |
tree | 784db32699d36a664f8661611d2f6202c3efffcd | |
parent | 83172d301c9d31c904f89f31062fcbb13b0bde72 (diff) | |
download | hwcomposer-b2b58450de6464be65d83459687ad86222c885d9.zip hwcomposer-b2b58450de6464be65d83459687ad86222c885d9.tar.gz hwcomposer-b2b58450de6464be65d83459687ad86222c885d9.tar.bz2 |
PD #92195 omx decoder 4k2k video display
-rwxr-xr-x | Android.mk | 2 | ||||
-rwxr-xr-x | hwcomposer.cpp | 33 | ||||
-rwxr-xr-x | tvp/Android.mk | 11 | ||||
-rwxr-xr-x | tvp/OmxUtil.cpp | 45 | ||||
-rwxr-xr-x | tvp/OmxUtil.h | 15 |
5 files changed, 106 insertions, 0 deletions
@@ -10,6 +10,7 @@ include $(CLEAR_VARS) LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw LOCAL_SHARED_LIBRARIES := liblog libEGL libutils libcutils +LOCAL_STATIC_LIBRARIES := libomxutil LOCAL_SRC_FILES := hwcomposer.cpp ifneq (,$(wildcard hardware/amlogic/gralloc)) @@ -33,3 +34,4 @@ LOCAL_MODULE := hwcomposer.amlogic LOCAL_CFLAGS += -DLOG_TAG=\"hwcomposer\" LOCAL_MODULE_TAGS := optional include $(BUILD_SHARED_LIBRARY) +include $(call all-makefiles-under,$(LOCAL_PATH)) diff --git a/hwcomposer.cpp b/hwcomposer.cpp index 7d58fa8..2788099 100755 --- a/hwcomposer.cpp +++ b/hwcomposer.cpp @@ -58,6 +58,11 @@ #ifndef LOGD #define LOGD ALOGD #endif +#include "tvp/OmxUtil.h" + +#define TVP_SECRET "amlogic_omx_decoder,pts=" +#define TVP_SECRET_RENDER "is rendered = true" +static int Amvideo_Handle = 0; extern "C" int clock_nanosleep(clockid_t clock_id, int flags, const struct timespec *request, @@ -293,6 +298,7 @@ static int hwc_set(struct hwc_composer_device_1 *dev, if (numDisplays != 1) { return 0; } + bool istvp = false; #if WITH_LIBPLAYER_MODULE hwc_display_contents_1_t *list = displays[0]; @@ -300,11 +306,38 @@ static int hwc_set(struct hwc_composer_device_1 *dev, hwc_layer_1_t* l = &list->hwLayers[i]; if (l->handle) { private_handle_t const* hnd = reinterpret_cast<private_handle_t const*>(l->handle); + if (hnd->flags & private_handle_t::PRIV_FLAGS_VIDEO_OMX) { + if (strncmp((char*)hnd->base, TVP_SECRET, strlen(TVP_SECRET))==0) { + hwc_overlay_compose(dev, l); + char* data = (char*)hnd->base; + if (Amvideo_Handle==0 && istvp==false) { + Amvideo_Handle = openamvideo(); + if (Amvideo_Handle == 0) + ALOGW("can not open amvideo"); + } + if (strncmp((char*)hnd->base+sizeof(TVP_SECRET)+sizeof(signed long long), TVP_SECRET_RENDER, strlen(TVP_SECRET_RENDER))!=0) { + signed long long time; + memcpy(&time, (char*)data+sizeof(TVP_SECRET), sizeof(signed long long)); + int time_video = time * 9 / 100 + 1; + //ALOGW("render____time=%lld,time_video=%d",time,time_video); + int ret = setomxpts(time_video); + if (ret < 0) { + ALOGW("setomxpts error, ret =%d",ret); + } + } + memcpy((char*)data+sizeof(TVP_SECRET)+sizeof(signed long long), TVP_SECRET_RENDER, sizeof(TVP_SECRET_RENDER)); + istvp = true; + } + } if (hnd->flags & private_handle_t::PRIV_FLAGS_VIDEO_OVERLAY) { hwc_overlay_compose(dev, l); } } } + if (istvp == false && Amvideo_Handle!=0) { + closeamvideo(); + Amvideo_Handle = 0; + } #endif diff --git a/tvp/Android.mk b/tvp/Android.mk new file mode 100755 index 0000000..068106e --- a/dev/null +++ b/tvp/Android.mk @@ -0,0 +1,11 @@ +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_SRC_FILES:= \ + OmxUtil.cpp \ + +LOCAL_C_INCLUDES := \ + +LOCAL_MODULE:= libomxutil + +include $(BUILD_STATIC_LIBRARY) diff --git a/tvp/OmxUtil.cpp b/tvp/OmxUtil.cpp new file mode 100755 index 0000000..69d3dec --- a/dev/null +++ b/tvp/OmxUtil.cpp @@ -0,0 +1,45 @@ +/* + * AMLOGIC IOCTL WRAPPER + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the BSD Licence, GNU General Public License + * as published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version + */ + +#define LOG_NDEBUG 0 +#define LOG_TAG "omxutil" + +#include <fcntl.h> +#include <sys/ioctl.h> +#include <media/stagefright/foundation/ADebug.h> + +#define AMSTREAM_IOC_MAGIC 'S' + +#define AMSTREAM_IOC_SET_OMX_VPTS _IOW(AMSTREAM_IOC_MAGIC, 0xaf, unsigned long) +#define AMSTREAM_IOC_SET_VIDEO_DISABLE _IOW(AMSTREAM_IOC_MAGIC, 0x49, unsigned long) + +static int amvideo_handle = 0; +int openamvideo() { + amvideo_handle = open("/dev/amvideo",O_RDWR | O_NONBLOCK); + return amvideo_handle; +} + +void closeamvideo() { + if (amvideo_handle != 0) { + int ret = close(amvideo_handle); + amvideo_handle = 0; + if (ret < 0) + ALOGE("close Amvideo error"); + } +} + +int setomxdisplaymode() { + return ioctl(amvideo_handle, AMSTREAM_IOC_SET_VIDEO_DISABLE, 2); + +} +int setomxpts(int time_video) { + return ioctl(amvideo_handle, AMSTREAM_IOC_SET_OMX_VPTS, (unsigned long)&time_video); +} + + diff --git a/tvp/OmxUtil.h b/tvp/OmxUtil.h new file mode 100755 index 0000000..26060a9 --- a/dev/null +++ b/tvp/OmxUtil.h @@ -0,0 +1,15 @@ +/* + * AMLOGIC IOCTL WRAPPER + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the BSD Licence, GNU General Public License + * as published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version + */ + +int openamvideo(); +void closeamvideo(); +int setomxdisplaymode(); +int setomxpts(int time_video); + + |