Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff -b -u -r -N '--exclude=.git' xbmc_orig/configure.in xbmc_huceke/configure.in
- --- xbmc_orig/configure.in 2013-06-17 16:17:09.000000000 +0200
- +++ xbmc_huceke/configure.in 2013-06-17 16:16:23.000000000 +0200
- @@ -130,6 +130,8 @@
- vtbdecoder_disabled="== VTBDecoder support manually disabled. =="
- openmax_disabled="== OpenMax support manually disabled. =="
- openmax_not_found="== Could not find libnvomx. OpenMax support disabled. =="
- +cedar_disabled="== Cedar HW support enabled. =="
- +cedar_enabled="== Cedar HW support enabled. =="
- ssh_not_found="== Could not find libssh. =="
- ssh_disabled="== SSH SFTP disabled. =="
- librtmp_not_found="== Could not find libRTMP. RTMP support disabled. =="
- @@ -272,6 +274,12 @@
- [use_tegra=$enableval],
- [use_tegra=no])
- +AC_ARG_ENABLE([cedar],
- + [AS_HELP_STRING([--enable-cedar],
- + [enable Cedar HW decoding (default is no)])],
- + [use_cedar=$enableval],
- + [use_cedar=no])
- +
- AC_ARG_ENABLE([profiling],
- [AS_HELP_STRING([--enable-profiling],
- [enable gprof profiling (default is no)])],
- @@ -1815,6 +1823,18 @@
- fi
- fi
- +# Cedar HW decoder
- +if test "x$use_cedar" != "xno"; then
- + AC_DEFINE([HAVE_LIBCEDAR], [1], [Define to 1 if you have the 'cedar' librarie)])
- + AC_MSG_NOTICE($cedar_enabled)
- + use_cedar="yes"
- + USE_CEDAR=1
- +else
- + AC_MSG_NOTICE($cedar_disabled)
- + use_cedar="no"
- + USE_CEDAR=0
- +fi
- +
- # yajl version check (yajl_version.h was added in yajl 2.0)
- AC_CHECK_HEADERS([yajl/yajl_version.h], [], [
- AC_DEFINE(YAJL_MAJOR, 1, [yajl version 1])
- @@ -1981,6 +2001,12 @@
- final_message="$final_message\n OpenMax:\tNo"
- fi
- +if test "$use_cedar" != "no"; then
- + final_message="$final_message\n CedarHW:\tYes"
- +else
- + final_message="$final_message\n CedarHW:\tNo"
- +fi
- +
- if test "$use_joystick" = "yes"; then
- final_message="$final_message\n Joystick:\tYes"
- SDL_DEFINES="$SDL_DEFINES -DHAS_SDL_JOYSTICK"
- @@ -2442,6 +2468,7 @@
- AC_SUBST(USE_AIRPLAY)
- AC_SUBST(USE_VDA)
- AC_SUBST(USE_OPENMAX)
- +AC_SUBST(USE_CEDAR)
- AC_SUBST(USE_PULSE)
- AC_SUBST(USE_XRANDR)
- AC_SUBST(USE_ALSA)
- diff -b -u -r -N '--exclude=.git' xbmc_orig/docs/README.allwinner xbmc_huceke/docs/README.allwinner
- --- xbmc_orig/docs/README.allwinner 1970-01-01 01:00:00.000000000 +0100
- +++ xbmc_huceke/docs/README.allwinner 2013-06-17 16:16:23.000000000 +0200
- @@ -0,0 +1,21 @@
- +Required changes to your fex board file :
- +
- + disp_init_enable = 1
- + disp_mode = 0
- + screen0_output_type = 3
- +-screen0_output_mode = 5
- ++screen0_output_mode = 4
- + screen1_output_type = 2
- + screen1_output_mode = 11
- + fb0_framebuffer_num = 2
- + fb0_format = 10
- +-fb0_pixel_sequence = 0
- +-fb0_scaler_mode_enable = 1
- ++fb0_pixel_sequence = 1
- ++fb0_scaler_mode_enable = 0
- + fb1_framebuffer_num = 2
- + fb1_format = 10
- +-fb1_pixel_sequence = 0
- +-fb1_scaler_mode_enable = 1
- ++fb1_pixel_sequence = 1
- ++fb1_scaler_mode_enable = 0
- diff -b -u -r -N '--exclude=.git' xbmc_orig/tools/allwinner/depends/depends.mk xbmc_huceke/tools/allwinner/depends/depends.mk
- --- xbmc_orig/tools/allwinner/depends/depends.mk 1970-01-01 01:00:00.000000000 +0100
- +++ xbmc_huceke/tools/allwinner/depends/depends.mk 2013-06-17 16:16:23.000000000 +0200
- @@ -0,0 +1,54 @@
- +export CFLAGS=-pipe -O3 -mcpu=cortex-a8 -mtune=cortex-a8 -mfloat-abi=hard -mfpu=neon -mabi=aapcs-linux -Wno-psabi -Wa,-mno-warn-deprecated -Wno-deprecated-declarations -ftree-vectorize
- +ifeq ($(USE_BUILDROOT),1)
- + export HOST=arm-linux-gnueabihf
- + export BUILD=i686-linux
- + export PREFIX=$(XBMCPREFIX)
- + export SYSROOT=$(BUILDROOT)/output/host/usr/arm-unknown-linux-gnueabi/sysroot
- + export CFLAGS+=-isystem$(SYSROOT)/usr/include -isystem$(PREFIX)/include -isystem$(PREFIX)/usr/include/mysql --sysroot=$(SYSROOT)
- + export CXXFLAGS=$(CFLAGS) --sysroot=$(SYSROOT)
- + export CPPFLAGS=$(CFLAGS) --sysroot=$(SYSROOT)
- + export LDFLAGS=-L$(XBMCPREFIX)/lib
- + export LD=$(TOOLCHAIN)/bin/$(HOST)-ld
- + export CC=$(TOOLCHAIN)/bin/$(HOST)-gcc
- + export CXX=$(TOOLCHAIN)/bin/$(HOST)-g++
- + export OBJDUMP=$(TOOLCHAIN)/bin/$(HOST)-objdump
- + export RANLIB=$(TOOLCHAIN)/bin/$(HOST)-ranlib
- + export STRIP=$(TOOLCHAIN)/bin/$(HOST)-strip
- + export AR=$(TOOLCHAIN)/bin/$(HOST)-ar
- + export CXXCPP=$(CXX) -E
- + export PKG_CONFIG_PATH=$(PREFIX)/lib/pkgconfig
- + export PYTHON_VERSION=2.7
- + export PATH:=$(PREFIX)/bin:$(BUILDROOT)/output/host/usr/bin:$(PATH)
- + export TEXTUREPACKER_NATIVE_ROOT=/usr
- + export PYTHON_LDFLAGS=-L$(SDKSTAGE)/usr/lib -lpython$(PYTHON_VERSION) -lpthread -ldl -lutil -lm
- +else
- + export HOST=arm-bcm2708-linux-gnueabi
- + export BUILD=i686-linux
- + export PREFIX=${XBMCPREFIX}
- + export TARGETFS
- + export SYSROOT=/usr/local/bcm-gcc/arm-bcm2708-linux-gnueabi/sys-root
- + export RLINK_PATH=-Wl,-rpath-link,${SYSROOT}/lib -Wl,-rpath-link,${TARGETFS}/lib -Wl,-rpath-link,${TARGETFS}/usr/lib
- + export CFLAGS+=-isystem${XBMCPREFIX}/include -isystem${SDKSTAGE}/usr/include
- + export CFLAGS+=-L${XBMCPREFIX}/lib -L${SYSROOT}/lib -L${TARGETFS}/lib -L${TARGETFS}/usr/lib ${RLINK_PATH}
- + export CXXFLAGS=${CFLAGS}
- + export CPPFLAGS=${CFLAGS}
- + export LDFLAGS=${RLINK_PATH} -L${TARGETFS}/lib -L${TARGETFS}/usr/lib -L${XBMCPREFIX}/lib
- + export LD=${TOOLCHAIN}/bin/${HOST}-ld
- + export AR=${TOOLCHAIN}/bin/${HOST}-ar
- + export CC=${TOOLCHAIN}/bin/${HOST}-gcc
- + export CXX=${TOOLCHAIN}/bin/${HOST}-g++
- + export CXXCPP=${CXX} -E
- + export RANLIB=${TOOLCHAIN}/bin/${HOST}-ranlib
- + export STRIP=${TOOLCHAIN}/bin/${HOST}-strip
- + export OBJDUMP=${TOOLCHAIN}/bin/${HOST}-objdump
- + #export ACLOCAL=aclocal -I ${SDKSTAGE}/usr/share/aclocal -I ${TARGETFS}/usr/share/aclocal-1.11
- + export PKG_CONFIG_LIBDIR=${PREFIX}/lib/pkgconfig:${SDKSTAGE}/lib/pkgconfig:${SDKSTAGE}/usr/lib/pkgconfig
- + export PKG_CONFIG_PATH=$(PREFIX)/bin/pkg-config
- + export PYTHON_VERSION=2.6
- + export PATH:=${PREFIX}/bin:$(PATH):${TOOLCHAIN}/bin
- + export TEXTUREPACKER_NATIVE_ROOT=/usr
- + export PYTHON_LDFLAGS=-L$(SDKSTAGE)/usr/lib -lpython$(PYTHON_VERSION)
- +endif
- +export PYTHON_CPPFLAGS=-I$(SDKSTAGE)/usr/include/python$(PYTHON_VERSION)
- +export PYTHON_SITE_PKG=$(SDKSTAGE)/usr/lib/python$(PYTHON_VERSION)/site-packages
- +export PYTHON_NOVERSIONCHECK=no-check
- diff -b -u -r -N '--exclude=.git' xbmc_orig/tools/allwinner/depends/xbmc/Makefile xbmc_huceke/tools/allwinner/depends/xbmc/Makefile
- --- xbmc_orig/tools/allwinner/depends/xbmc/Makefile 1970-01-01 01:00:00.000000000 +0100
- +++ xbmc_huceke/tools/allwinner/depends/xbmc/Makefile 2013-06-17 16:16:23.000000000 +0200
- @@ -0,0 +1,27 @@
- +include ../../Makefile.include
- +include ../depends.mk
- +
- +SOURCE=../../../../
- +
- +ifeq ($(USE_BUILDROOT),1)
- + export PATH:=$(PREFIX)/bin:$(BUILDROOT)/output/host/usr/bin:$(SYSROOT)/usr/bin:$(PATH)
- +endif
- +
- +CONFIGURE=./configure --prefix=$(PREFIX) --build=$(BUILD) --host=$(HOST) \
- + --enable-gles --disable-sdl --disable-x11 --disable-xrandr --disable-openmax \
- + --disable-optical-drive --disable-dvdcss --disable-joystick --disable-debug \
- + --disable-crystalhd --disable-vtbdecoder --disable-vaapi --disable-vdpau \
- + --disable-pulse --disable-projectm --disable-optimizations --enable-cedar \
- + --enable-neon --disable-libcec
- +
- +all: configure
- +
- +clean:
- +distclean:
- + cd $(SOURCE);
- +
- +configure:
- + cd $(SOURCE); ./bootstrap
- + cd $(SOURCE); $(CONFIGURE)
- + #cd $(SOURCE); make -j $(JOBS)
- + #cd $(SOURCE); make install
- diff -b -u -r -N '--exclude=.git' xbmc_orig/tools/allwinner/setup-sdk.sh xbmc_huceke/tools/allwinner/setup-sdk.sh
- --- xbmc_orig/tools/allwinner/setup-sdk.sh 1970-01-01 01:00:00.000000000 +0100
- +++ xbmc_huceke/tools/allwinner/setup-sdk.sh 2013-06-17 16:16:23.000000000 +0200
- @@ -0,0 +1,41 @@
- +#!/bin/bash
- +
- +SCRIPT_PATH=$(cd `dirname $0` && pwd)
- +
- +USE_BUILDROOT=1
- +
- +if [ "$USE_BUILDROOT" = "1" ]; then
- + BUILDROOT=/media/usbdisk/xbmc/xbmc-alwinner/buildroot-allwinner
- + TARBALLS=/opt/xbmc-tarballs
- + XBMCPREFIX=/media/usbdisk/xbmc/xbmc-alwinner/xbmc-bin
- +
- + SDKSTAGE=$BUILDROOT/output/staging
- + TARGETFS=$BUILDROOT/output/target
- + TOOLCHAIN=$BUILDROOT/output/host/usr/
- +else
- + TARBALLS=/opt/xbmc-tarballs
- + SDKSTAGE=/opt/bcm-rootfs
- + XBMCPREFIX=/opt/xbmc-bcm/xbmc-bin
- + TARGETFS=/opt/bcm-rootfs
- + TOOLCHAIN=/usr/local/bcm-gcc
- + BUILDROOT=/opt/bcm-rootfs
- +fi
- +
- +sudo mkdir -p $XBMCPREFIX
- +sudo chmod 777 $XBMCPREFIX
- +mkdir -p $XBMCPREFIX/lib
- +mkdir -p $XBMCPREFIX/include
- +
- +echo "SDKSTAGE=$SDKSTAGE" > $SCRIPT_PATH/Makefile.include
- +echo "XBMCPREFIX=$XBMCPREFIX" >> $SCRIPT_PATH/Makefile.include
- +echo "TARGETFS=$TARGETFS" >> $SCRIPT_PATH/Makefile.include
- +echo "TOOLCHAIN=$TOOLCHAIN" >> $SCRIPT_PATH/Makefile.include
- +echo "BUILDROOT=$BUILDROOT" >> $SCRIPT_PATH/Makefile.include
- +echo "USE_BUILDROOT=$USE_BUILDROOT" >> $SCRIPT_PATH/Makefile.include
- +echo "BASE_URL=http://mirrors.xbmc.org/build-deps/darwin-libs" >> $SCRIPT_PATH/Makefile.include
- +echo "TARBALLS_LOCATION=$TARBALLS" >> $SCRIPT_PATH/Makefile.include
- +echo "RETRIEVE_TOOL=/usr/bin/curl" >> $SCRIPT_PATH/Makefile.include
- +echo "RETRIEVE_TOOL_FLAGS=-Ls --create-dirs --output \$(TARBALLS_LOCATION)/\$(ARCHIVE)" >> $SCRIPT_PATH/Makefile.include
- +echo "ARCHIVE_TOOL=/bin/tar" >> $SCRIPT_PATH/Makefile.include
- +echo "ARCHIVE_TOOL_FLAGS=xf" >> $SCRIPT_PATH/Makefile.include
- +echo "JOBS=$((`grep -c processor /proc/cpuinfo` -1))" >> $SCRIPT_PATH/Makefile.include
- diff -b -u -r -N '--exclude=.git' xbmc_orig/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp xbmc_huceke/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp
- --- xbmc_orig/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp 2013-06-17 16:17:17.000000000 +0200
- +++ xbmc_huceke/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp 2013-06-17 16:16:23.000000000 +0200
- @@ -756,6 +756,15 @@
- {
- EnumerateDevice(list, name, desc ? desc : name, config);
- }
- + else
- + {
- + /* sun4i whilelist */
- + std::string strDevice = std::string(name);
- + size_t found = strDevice.find("sun4i");
- +
- + if(found != std::string::npos)
- + EnumerateDevice(list, name, desc ? desc : name, config);
- + }
- }
- free(io);
- free(name);
- @@ -857,6 +866,10 @@
- else if (name.substr(0, 6) == "iec958" || name.substr(0, 5) == "spdif")
- return AE_DEVTYPE_IEC958;
- + /* sun4i hdmi device */
- + if(name.find("sun4isndhdmi") != std::string::npos)
- + return AE_DEVTYPE_HDMI;
- +
- return AE_DEVTYPE_PCM;
- }
- diff -b -u -r -N '--exclude=.git' xbmc_orig/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp xbmc_huceke/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp
- --- xbmc_orig/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp 2013-06-17 16:17:17.000000000 +0200
- +++ xbmc_huceke/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp 2013-06-17 16:16:23.000000000 +0200
- @@ -48,7 +48,9 @@
- #include "Overlay/DVDOverlayCodecText.h"
- #include "Overlay/DVDOverlayCodecTX3G.h"
- #include "Overlay/DVDOverlayCodecFFmpeg.h"
- -
- +#if defined(HAVE_LIBCEDAR)
- +#include "Video/DVDVideoCodecCedar.h"
- +#endif
- #include "DVDStreamInfo.h"
- #include "settings/GUISettings.h"
- @@ -169,9 +171,19 @@
- #elif defined(_LINUX) && !defined(TARGET_DARWIN)
- hwSupport += "VAAPI:no ";
- #endif
- +#if defined(HAVE_LIBCEDAR)
- + hwSupport += "CEDAR:yes ";
- +#else
- + hwSupport += "CEDAR:no ";
- +#endif
- CLog::Log(LOGDEBUG, "CDVDFactoryCodec: compiled in hardware support: %s", hwSupport.c_str());
- +#if defined(HAVE_LIBCEDAR)
- + CLog::Log(LOGINFO, "Trying Cedar Video Decoder...");
- + if ( (pCodec = OpenCodec(new CDVDVideoCodecCedar(), hint, options)) ) return pCodec;
- +#endif
- +
- // dvd's have weird still-frames in it, which is not fully supported in ffmpeg
- if(hint.stills && (hint.codec == CODEC_ID_MPEG2VIDEO || hint.codec == CODEC_ID_MPEG1VIDEO))
- {
- diff -b -u -r -N '--exclude=.git' xbmc_orig/xbmc/cores/dvdplayer/DVDCodecs/Video/CedarOverlayManager.cpp xbmc_huceke/xbmc/cores/dvdplayer/DVDCodecs/Video/CedarOverlayManager.cpp
- --- xbmc_orig/xbmc/cores/dvdplayer/DVDCodecs/Video/CedarOverlayManager.cpp 1970-01-01 01:00:00.000000000 +0100
- +++ xbmc_huceke/xbmc/cores/dvdplayer/DVDCodecs/Video/CedarOverlayManager.cpp 2013-06-17 16:16:23.000000000 +0200
- @@ -0,0 +1,580 @@
- +/*
- + * Copyright (C) 2010 Team XBMC
- + * http://www.xbmc.org
- + *
- + * This Program is free software; you can redistribute it and/or modify
- + * it under the terms of the GNU General Public License as published by
- + * the Free Software Foundation; either version 2, or (at your option)
- + * any later version.
- + *
- + * This Program is distributed in the hope that it will be useful,
- + * but WITHOUT ANY WARRANTY; without even the implied warranty of
- + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- + * GNU General Public License for more details.
- + *
- + * You should have received a copy of the GNU General Public License
- + * along with XBMC; see the file COPYING. If not, write to
- + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- + * http://www.gnu.org/copyleft/gpl.html
- + *
- + */
- +
- +#include "CedarOverlayManager.h"
- +
- +#if defined(HAVE_LIBCEDAR)
- +
- +#define CLASSNAME "CCedarOverlayManager"
- +
- +#include "utils/log.h"
- +#include <stdio.h>
- +#include <stdlib.h>
- +#include <sys/stat.h>
- +#include <sys/ioctl.h>
- +#include <fcntl.h>
- +#include <stropts.h>
- +#include <unistd.h>
- +#include <string.h>
- +
- +#define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32)
- +
- +CCedarOverlayManager::CCedarOverlayManager()
- +{
- + m_DisplayHandle = 0;
- + m_open = false;
- + m_videoLayer = 0;
- + m_videoLayerInit = false;
- + m_FrameBufferHandle = 0;
- + m_FrameBufferLayerHandle = 0;
- + m_screenId = 0;
- + memset(&ColorKey, 0x0, sizeof(__disp_colorkey_t));
- + m_format = RENDER_FMT_NONE;
- +}
- +
- +CCedarOverlayManager::~CCedarOverlayManager()
- +{
- + Close();
- +}
- +
- +void CCedarOverlayManager::Close()
- +{
- +
- + if(m_videoLayer)
- + {
- + /* stop video layer */
- + m_cedarArguments[0] = m_screenId;
- + m_cedarArguments[1] = m_videoLayer;
- + m_cedarArguments[2] = 0;
- + m_cedarArguments[3] = 0;
- + ioctl(m_DisplayHandle, DISP_CMD_VIDEO_STOP, m_cedarArguments);
- +
- + /* relase video layer */
- + m_cedarArguments[0] = m_screenId;
- + m_cedarArguments[1] = m_videoLayer;
- + m_cedarArguments[2] = 0;
- + m_cedarArguments[3] = 0;
- + ioctl(m_DisplayHandle, DISP_CMD_LAYER_RELEASE, m_cedarArguments);
- +
- + m_videoLayer = 0;
- + }
- +
- + if(m_DisplayHandle)
- + {
- + /*
- + m_cedarArguments[0] = m_screenId;
- + m_cedarArguments[1] = 0;
- + m_cedarArguments[2] = 0;
- + m_cedarArguments[3] = 0;
- + ioctl(m_DisplayHandle, DISP_CMD_EXECUTE_CMD_AND_STOP_CACHE, m_cedarArguments);
- + */
- + close(m_DisplayHandle);
- + }
- +
- + /* set alpha on */
- + if(m_FrameBufferLayerHandle)
- + {
- + m_cedarArguments[0] = m_screenId;
- + m_cedarArguments[1] = m_FrameBufferLayerHandle;
- + m_cedarArguments[2] = 0;
- + m_cedarArguments[3] = 0;
- + ioctl(m_DisplayHandle, DISP_CMD_LAYER_ALPHA_ON, m_cedarArguments);
- + }
- +
- + if(m_FrameBufferHandle);
- + close(m_FrameBufferHandle);
- +
- + m_DisplayHandle = 0;
- + m_videoLayer = 0;
- + m_FrameBufferHandle = 0;
- + m_open = false;
- + m_videoLayerInit = false;
- + m_format = RENDER_FMT_NONE;
- +
- + m_dllCedar.Unload();
- +}
- +
- +void CCedarOverlayManager::UpdatePos(CRect &destRect, CRect &sourceRect)
- +{
- + if(m_videoLayer)
- + {
- + m_destRect = destRect;
- + m_sourceRect = sourceRect;
- +
- + /*
- + memset(&m_videoLayerAttr, 0x0, sizeof(__disp_layer_info_t));
- + m_cedarArguments[0] = m_screenId;
- + m_cedarArguments[1] = m_videoLayer;
- + m_cedarArguments[2] = (unsigned long)(&m_videoLayerAttr);
- + m_cedarArguments[3] = 0;
- + ioctl(m_DisplayHandle, DISP_CMD_LAYER_GET_PARA, m_cedarArguments);
- +
- + m_videoLayerAttr.scn_win.x = m_destRect.x1;
- + m_videoLayerAttr.scn_win.y = m_destRect.y1;
- + m_videoLayerAttr.scn_win.width = m_destRect.x2 - m_destRect.x1;
- + m_videoLayerAttr.scn_win.height = m_destRect.y2 - m_destRect.y1;
- + m_videoLayerAttr.src_win.x = m_sourceRect.x1;
- + m_videoLayerAttr.src_win.y = m_sourceRect.y1;
- + m_videoLayerAttr.src_win.width = m_sourceRect.x2 - m_sourceRect.x1;
- + m_videoLayerAttr.src_win.height = m_sourceRect.y2 - m_sourceRect.y1;
- +
- + m_cedarArguments[0] = m_screenId;
- + m_cedarArguments[1] = m_videoLayer;
- + m_cedarArguments[2] = (unsigned long)(&m_videoLayerAttr);
- + m_cedarArguments[3] = 0;
- + ioctl(m_DisplayHandle, DISP_CMD_LAYER_SET_PARA, m_cedarArguments);
- + */
- +
- + /* setup video layer parameters */
- + __disp_rect_t scn_win;
- +
- + scn_win.x = m_destRect.x1;
- + scn_win.y = m_destRect.y1;
- + scn_win.width = m_destRect.x2 - m_destRect.x1;
- + scn_win.height = m_destRect.y2 - m_destRect.y1;
- +
- + m_cedarArguments[0] = m_screenId;
- + m_cedarArguments[1] = m_videoLayer;
- + m_cedarArguments[2] = (unsigned long)(&scn_win);
- + m_cedarArguments[3] = 0;
- + ioctl(m_DisplayHandle, DISP_CMD_LAYER_SET_SCN_WINDOW, m_cedarArguments);
- +
- + __disp_rect_t src_win;
- +
- + src_win.x = m_sourceRect.x1;
- + src_win.y = m_sourceRect.y1;
- + src_win.width = m_sourceRect.x2 - m_sourceRect.x1;
- + src_win.height = m_sourceRect.y2 - m_sourceRect.y1;
- +
- + m_cedarArguments[0] = m_screenId;
- + m_cedarArguments[1] = m_videoLayer;
- + m_cedarArguments[2] = (unsigned long)(&src_win);
- + m_cedarArguments[3] = 0;
- + ioctl(m_DisplayHandle, DISP_CMD_LAYER_SET_SRC_WINDOW, m_cedarArguments);
- + }
- +}
- +
- +void CCedarOverlayManager::SetColorKey()
- +{
- + if(m_videoLayer)
- + {
- + m_cedarArguments[0] = m_screenId;
- + m_cedarArguments[1] = m_videoLayer;
- + m_cedarArguments[2] = 0;
- + m_cedarArguments[3] = 0;
- + int ret = ioctl(m_DisplayHandle, DISP_CMD_LAYER_TOP, m_cedarArguments);
- + if(ret != 0)
- + {
- + CLog::Log(LOGERROR, "%s:%s Error iset layer top err(%d)\n", CLASSNAME, __func__, ret);
- + return;
- + }
- +
- + m_cedarArguments[0] = m_screenId;
- + m_cedarArguments[1] = m_videoLayer;
- + m_cedarArguments[2] = 0;
- + m_cedarArguments[3] = 0;
- + if(m_screenId == 0)
- + {
- + ioctl(m_DisplayHandle, DISP_CMD_LAYER_CK_OFF, m_cedarArguments);
- + }
- + else
- + {
- + ioctl(m_DisplayHandle, DISP_CMD_LAYER_CK_ON, m_cedarArguments);
- + }
- + }
- +
- + memset(&ColorKey, 0x0, sizeof(__disp_colorkey_t));
- +
- + if(m_screenId == 1)
- + {
- + ColorKey.ck_min.alpha = 0xFF;
- + ColorKey.ck_min.red = 0x05;
- + ColorKey.ck_min.green = 0x01;
- + ColorKey.ck_min.blue = 0x07;
- + ColorKey.ck_max.alpha = 0xFF;
- + ColorKey.ck_max.red = 0x05;
- + ColorKey.ck_max.green = 0x01;
- + ColorKey.ck_max.blue = 0x07;
- + }
- + else
- + {
- + ColorKey.ck_min.alpha = 0xFF;
- + ColorKey.ck_min.red = 0x00;
- + ColorKey.ck_min.green = 0x00;
- + ColorKey.ck_min.blue = 0x00;
- + ColorKey.ck_max.alpha = 0xFF;
- + ColorKey.ck_max.red = 0x00;
- + ColorKey.ck_max.green = 0x00;
- + ColorKey.ck_max.blue = 0x00;
- + }
- +
- + ColorKey.red_match_rule = 2;
- + ColorKey.green_match_rule = 2;
- + ColorKey.blue_match_rule = 2;
- +
- + m_cedarArguments[0] = 0;
- + m_cedarArguments[1] = (unsigned long) (&ColorKey);
- + m_cedarArguments[2] = 0;
- + m_cedarArguments[3] = 0;
- + ioctl(m_DisplayHandle, DISP_CMD_SET_COLORKEY, m_cedarArguments);
- +
- + m_cedarArguments[0] = 0;
- + m_cedarArguments[1] = (unsigned long) (&ColorKey);
- + m_cedarArguments[2] = 0;
- + m_cedarArguments[3] = 0;
- + ioctl(m_DisplayHandle, DISP_CMD_SET_BKCOLOR, m_cedarArguments);
- +
- + m_cedarArguments[0] = m_screenId;
- + m_cedarArguments[1] = m_FrameBufferLayerHandle;
- + m_cedarArguments[2] = 0;
- + m_cedarArguments[3] = 0;
- + ioctl(m_DisplayHandle, DISP_CMD_LAYER_SET_PIPE, m_cedarArguments);
- +
- + m_cedarArguments[0] = m_screenId;
- + m_cedarArguments[1] = m_FrameBufferLayerHandle;
- + m_cedarArguments[2] = 0;
- + m_cedarArguments[3] = 0;
- + ioctl(m_DisplayHandle, DISP_CMD_LAYER_TOP, m_cedarArguments);
- +
- + m_cedarArguments[0] = m_screenId;
- + m_cedarArguments[1] = m_FrameBufferLayerHandle;
- + m_cedarArguments[2] = 0xFF;
- + m_cedarArguments[3] = 0;
- + ioctl(m_DisplayHandle, DISP_CMD_LAYER_SET_ALPHA_VALUE, m_cedarArguments);
- +
- + m_cedarArguments[0] = m_screenId;
- + m_cedarArguments[1] = m_FrameBufferLayerHandle;
- + m_cedarArguments[2] = 0;
- + m_cedarArguments[3] = 0;
- + ioctl(m_DisplayHandle, DISP_CMD_LAYER_ALPHA_OFF, m_cedarArguments);
- +
- + m_cedarArguments[0] = m_screenId;
- + m_cedarArguments[1] = m_FrameBufferLayerHandle;
- + m_cedarArguments[2] = 0;
- + m_cedarArguments[3] = 0;
- + ioctl(m_DisplayHandle, DISP_CMD_LAYER_CK_OFF, m_cedarArguments);
- +}
- +
- +bool CCedarOverlayManager::Open(CRect &destRect, CRect &sourceRect, ERenderFormat format)
- +{
- + if(m_open)
- + Close();
- +
- + if(!m_dllCedar.Load())
- + return false;
- +
- + m_destRect = destRect;
- + m_sourceRect = sourceRect;
- + m_format = format;
- +
- + m_DisplayHandle = open("/dev/disp", O_RDWR);
- + if(m_DisplayHandle < 0)
- + {
- + CLog::Log(LOGERROR, "%s:%s Error opening display\n", CLASSNAME, __func__);
- + return false;
- + }
- +
- + /* get video layer */
- + m_cedarArguments[0] = m_screenId;
- + m_cedarArguments[1] = DISP_LAYER_WORK_MODE_NORMAL;
- + m_cedarArguments[2] = 0;
- + m_cedarArguments[3] = 0;
- +
- + m_videoLayer = ioctl(m_DisplayHandle, DISP_CMD_LAYER_REQUEST, m_cedarArguments);
- + if(m_videoLayer == 0)
- + {
- + CLog::Log(LOGERROR, "%s:%s Error getting video layer err(%d)\n", CLASSNAME, __func__, m_videoLayer);
- + return false;
- + }
- +
- + /* get display dimensions */
- + m_cedarArguments[0] = m_screenId;
- + m_cedarArguments[1] = m_videoLayer;
- + m_cedarArguments[2] = 0;
- + m_cedarArguments[3] = 0;
- +
- + m_displayWidth = ioctl(m_DisplayHandle, DISP_CMD_SCN_GET_WIDTH, m_cedarArguments);
- + m_displayHeight = ioctl(m_DisplayHandle, DISP_CMD_SCN_GET_HEIGHT, m_cedarArguments);
- +
- + m_FrameBufferHandle = open("/dev/fb0", O_RDWR);
- + if(m_FrameBufferHandle < 0)
- + {
- + CLog::Log(LOGERROR, "%s:%s Error opening framebuffer\n", CLASSNAME, __func__);
- + return false;
- + }
- + ioctl(m_FrameBufferHandle, FBIOGET_LAYER_HDL_0, &m_FrameBufferLayerHandle);
- +
- + CLog::Log(LOGINFO, "%s:%s Display %dx%d\n", CLASSNAME, __func__, m_displayWidth, m_displayHeight);
- +
- + /*
- + m_cedarArguments[0] = m_screenId;
- + m_cedarArguments[1] = 0;
- + m_cedarArguments[2] = 0;
- + m_cedarArguments[3] = 0;
- + ioctl(m_DisplayHandle, DISP_CMD_START_CMD_CACHE, m_cedarArguments);
- + */
- +
- + m_open = true;
- + return true;
- +}
- +
- +bool CCedarOverlayManager::InitVideoLayer(__disp_pixel_fmt_t fmt)
- +{
- + int ret = 0;
- +
- + if(!m_open)
- + {
- + CLog::Log(LOGERROR, "%s:%s Error Diplay not opened\n", CLASSNAME, __func__);
- + return false;
- + }
- +
- + memset(&m_videoLayerAttr, 0x0, sizeof(__disp_layer_info_t));
- +
- + /* setup video layer parameters */
- + m_videoLayerAttr.mode = DISP_LAYER_WORK_MODE_SCALER;
- + m_videoLayerAttr.pipe = 1;
- + m_videoLayerAttr.fb.addr[0] = 0;
- + m_videoLayerAttr.fb.addr[1] = 0;
- + m_videoLayerAttr.fb.size.width = m_sourceRect.x2 - m_sourceRect.x1; //m_displayWidth;
- + m_videoLayerAttr.fb.size.height = m_sourceRect.y2 - m_sourceRect.y1; //m_displayHeight;
- + m_videoLayerAttr.alpha_en = 1;
- + m_videoLayerAttr.alpha_val = 0xFF;
- + m_videoLayerAttr.scn_win.x = m_destRect.x1;
- + m_videoLayerAttr.scn_win.y = m_destRect.y1;
- + m_videoLayerAttr.scn_win.width = m_destRect.x2 - m_destRect.x1;
- + m_videoLayerAttr.scn_win.height = m_destRect.y2 - m_destRect.y1;
- + m_videoLayerAttr.prio = 0xff;
- + m_videoLayerAttr.src_win.x = m_sourceRect.x1;
- + m_videoLayerAttr.src_win.y = m_sourceRect.y1;
- + m_videoLayerAttr.src_win.width = m_sourceRect.x2 - m_sourceRect.x1;
- + m_videoLayerAttr.src_win.height = m_sourceRect.y2 - m_sourceRect.y1;
- + m_videoLayerAttr.fb.b_trd_src = false;
- + m_videoLayerAttr.b_trd_out = false;
- + m_videoLayerAttr.fb.trd_mode = DISP_3D_SRC_MODE_SSH;
- + m_videoLayerAttr.out_trd_mode = DISP_3D_OUT_MODE_FP;
- + m_videoLayerAttr.b_from_screen = false;
- +
- + if((m_destRect.x2 - m_destRect.x1) < 720)
- + m_videoLayerAttr.fb.cs_mode = DISP_BT601;
- + else
- + m_videoLayerAttr.fb.cs_mode = DISP_BT709;
- +
- + if(fmt == DISP_FORMAT_ARGB8888)
- + {
- + m_videoLayerAttr.fb.mode = DISP_MOD_NON_MB_PLANAR;
- + m_videoLayerAttr.fb.format = fmt;
- + m_videoLayerAttr.fb.br_swap = 0;
- + m_videoLayerAttr.fb.cs_mode = DISP_YCC;
- + m_videoLayerAttr.fb.seq = DISP_SEQ_P3210;
- + }
- + else if(m_format == RENDER_FMT_YUV420P)
- + {
- + m_videoLayerAttr.fb.mode = DISP_MOD_NON_MB_PLANAR;
- + m_videoLayerAttr.fb.format = DISP_FORMAT_YUV420;
- + m_videoLayerAttr.fb.br_swap = 0;
- + m_videoLayerAttr.fb.seq = DISP_SEQ_YUYV;
- + }
- + else if(fmt == DISP_FORMAT_YUV420)
- + {
- + m_videoLayerAttr.fb.mode = DISP_MOD_MB_UV_COMBINED;
- + m_videoLayerAttr.fb.format = fmt;
- + m_videoLayerAttr.fb.br_swap = 0;
- + m_videoLayerAttr.fb.seq = DISP_SEQ_UVUV;
- + }
- + else
- + {
- + return false;
- + }
- +
- + m_cedarArguments[0] = m_screenId;
- + m_cedarArguments[1] = m_videoLayer;
- + m_cedarArguments[2] = (unsigned long) (&m_videoLayerAttr);
- + m_cedarArguments[3] = 0;
- + ioctl(m_DisplayHandle, DISP_CMD_LAYER_SET_PARA, m_cedarArguments);
- +
- + m_cedarArguments[0] = m_screenId;
- + m_cedarArguments[1] = m_videoLayer;
- + m_cedarArguments[2] = 0;
- + m_cedarArguments[3] = 0;
- +
- + ret = ioctl(m_DisplayHandle, DISP_CMD_LAYER_BOTTOM, m_cedarArguments);
- + if(ret != 0)
- + {
- + CLog::Log(LOGERROR, "%s:%s Error configure video layer err(%d)\n", CLASSNAME, __func__, ret);
- + return false;
- + }
- +
- + SetColorKey();
- +
- + m_cedarArguments[0] = m_screenId;
- + m_cedarArguments[1] = m_videoLayer;
- + m_cedarArguments[2] = 0;
- + m_cedarArguments[3] = 0;
- +
- + ret = ioctl(m_DisplayHandle, DISP_CMD_LAYER_OPEN, m_cedarArguments);
- + if (ret != 0)
- + {
- + CLog::Log(LOGERROR, "%s:%s Error open display layer err(%d)\n", CLASSNAME, __func__, ret);
- + return false;
- + }
- +
- + /* start video layer */
- + m_cedarArguments[0] = m_screenId;
- + m_cedarArguments[1] = m_videoLayer;
- + m_cedarArguments[2] = 0;
- + m_cedarArguments[3] = 0;
- +
- + ret = ioctl(m_DisplayHandle, DISP_CMD_VIDEO_START, m_cedarArguments);
- + if(ret != 0)
- + {
- + CLog::Log(LOGERROR, "%s:%s Error starting video err(%d)\n", CLASSNAME, __func__, ret);
- + return false;
- + }
- +
- + m_videoLayerInit = true;
- + return true;
- +}
- +
- +bool CCedarOverlayManager::RenderFrame(unsigned int yAddr, unsigned int uAddr, unsigned int vAddr,
- + unsigned int ySize, unsigned int uSize, unsigned int vSize,
- + __disp_pixel_fmt_t fmt, int frame_rate, int frame)
- +{
- + __disp_video_fb_t frameBuffer;
- + __disp_layer_info_t layerInfo;
- + int ret = 0;
- +
- + memset(&frameBuffer, 0x0, sizeof(__disp_video_fb_t));
- +
- + //frameBuffer.top_field_first = display_info->top_field_first;
- + frameBuffer.interlace = 0;
- + frameBuffer.frame_rate = 60;
- +
- + m_dllCedar.MemFlushCache((u8 *)(yAddr), ySize);
- + m_dllCedar.MemFlushCache((u8 *)(uAddr), uSize);
- +
- + if(yAddr)
- + yAddr = m_dllCedar.MemGetPhyAddr(yAddr);
- + if(uAddr)
- + uAddr = m_dllCedar.MemGetPhyAddr(uAddr);
- + if(vAddr)
- + vAddr = m_dllCedar.MemGetPhyAddr(vAddr);
- +
- + frameBuffer.addr[0] = yAddr;
- + frameBuffer.addr[1] = uAddr;
- + frameBuffer.addr[2] = vAddr;
- +
- + frameBuffer.addr_right[0] = 0;
- + frameBuffer.addr_right[1] = 0;
- + frameBuffer.addr_right[2] = 0;
- +
- + frameBuffer.id = frame;
- +
- + if(!m_videoLayerInit)
- + {
- + /* setu pvideo layer */
- + if(!InitVideoLayer(fmt))
- + return false;
- +
- + memset(&layerInfo, 0x0, sizeof(__disp_layer_info_t));
- +
- + /* setup framebuffer address */
- + m_cedarArguments[0] = m_screenId;
- + m_cedarArguments[1] = m_videoLayer;
- + m_cedarArguments[2] = (unsigned long) (&layerInfo);
- + m_cedarArguments[3] = 0;
- + ioctl(m_DisplayHandle, DISP_CMD_LAYER_GET_PARA, m_cedarArguments);
- +
- + layerInfo.fb.addr[0] = frameBuffer.addr[0];
- + layerInfo.fb.addr[1] = frameBuffer.addr[1];
- + layerInfo.fb.addr[2] = frameBuffer.addr[2];
- +
- + layerInfo.fb.trd_right_addr[0] = frameBuffer.addr_right[0];
- + layerInfo.fb.trd_right_addr[1] = frameBuffer.addr_right[1];
- + layerInfo.fb.trd_right_addr[2] = frameBuffer.addr_right[2];
- +
- + m_cedarArguments[0] = m_screenId;
- + m_cedarArguments[1] = m_videoLayer;
- + m_cedarArguments[2] = (unsigned long) (&layerInfo);
- + m_cedarArguments[3] = 0;
- + ioctl(m_DisplayHandle, DISP_CMD_LAYER_SET_PARA, m_cedarArguments);
- +
- + /* open video layer */
- +#if 0
- + m_cedarArguments[0] = m_screenId;
- + m_cedarArguments[1] = m_videoLayer;
- + m_cedarArguments[2] = 0;
- + m_cedarArguments[3] = 0;
- +
- + ret = ioctl(m_DisplayHandle, DISP_CMD_LAYER_OPEN, m_cedarArguments);
- + if (ret != 0)
- + {
- + CLog::Log(LOGERROR, "%s:%s Error open display layer err(%d)\n", CLASSNAME, __func__, ret);
- + return false;
- + }
- +
- + /* start video layer */
- + m_cedarArguments[0] = m_screenId;
- + m_cedarArguments[1] = m_videoLayer;
- + m_cedarArguments[2] = 0;
- + m_cedarArguments[3] = 0;
- +
- + ret = ioctl(m_DisplayHandle, DISP_CMD_VIDEO_START, m_cedarArguments);
- + if(ret != 0)
- + {
- + CLog::Log(LOGERROR, "%s:%s Error starting video err(%d)\n", CLASSNAME, __func__, ret);
- + return false;
- + }
- +#endif
- + }
- + else
- + {
- + m_cedarArguments[0] = m_screenId;
- + m_cedarArguments[1] = m_videoLayer;
- + m_cedarArguments[2] = (unsigned long) (&frameBuffer);
- + m_cedarArguments[3] = 0;
- + ioctl(m_DisplayHandle, DISP_CMD_VIDEO_SET_FB, m_cedarArguments);
- + }
- +
- + return true;
- +}
- +
- +int CCedarOverlayManager::GetFrameID()
- +{
- + if(!m_open)
- + return -1;
- +
- + m_cedarArguments[0] = m_screenId;
- + m_cedarArguments[1] = m_videoLayer;
- + m_cedarArguments[2] = 0;
- + m_cedarArguments[3] = 0;
- +
- + return ioctl(m_DisplayHandle, DISP_CMD_VIDEO_GET_FRAME_ID, m_cedarArguments);
- +}
- +
- +bool CCedarOverlayManager::WaitVSYNC()
- +{
- + if(m_FrameBufferHandle)
- + ioctl(m_FrameBufferHandle, FBIO_WAITFORVSYNC, NULL);
- +
- + return true;
- +}
- +
- +#endif
- diff -b -u -r -N '--exclude=.git' xbmc_orig/xbmc/cores/dvdplayer/DVDCodecs/Video/CedarOverlayManager.h xbmc_huceke/xbmc/cores/dvdplayer/DVDCodecs/Video/CedarOverlayManager.h
- --- xbmc_orig/xbmc/cores/dvdplayer/DVDCodecs/Video/CedarOverlayManager.h 1970-01-01 01:00:00.000000000 +0100
- +++ xbmc_huceke/xbmc/cores/dvdplayer/DVDCodecs/Video/CedarOverlayManager.h 2013-06-17 16:16:23.000000000 +0200
- @@ -0,0 +1,76 @@
- +/*
- + * Copyright (C) 2010 Team XBMC
- + * http://www.xbmc.org
- + *
- + * This Program is free software; you can redistribute it and/or modify
- + * it under the terms of the GNU General Public License as published by
- + * the Free Software Foundation; either version 2, or (at your option)
- + * any later version.
- + *
- + * This Program is distributed in the hope that it will be useful,
- + * but WITHOUT ANY WARRANTY; without even the implied warranty of
- + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- + * GNU General Public License for more details.
- + *
- + * You should have received a copy of the GNU General Public License
- + * along with XBMC; see the file COPYING. If not, write to
- + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- + * http://www.gnu.org/copyleft/gpl.html
- + *
- + */
- +
- +#ifndef _OVERLAYRENDERCEDAR_H_
- +#define _OVERLAYRENDERCEDAR_H_
- +
- +#include "system.h"
- +
- +#if defined(HAVE_LIBCEDAR)
- +
- +#include <asm/types.h>
- +#include <drv_display_sun4i.h>
- +#include "guilib/Geometry.h"
- +#include "cores/VideoRenderers/RenderFlags.h"
- +#include "cores/VideoRenderers/RenderFormats.h"
- +#include "DllLibCedar.h"
- +
- +class CCedarOverlayManager
- +{
- +public:
- + CCedarOverlayManager();
- + ~CCedarOverlayManager();
- + void Close();
- + void UpdatePos(CRect &destRect, CRect &sourceRect);
- + void SetColorKey();
- + bool Open(CRect &destRect, CRect &sourceRect, ERenderFormat format);
- + bool InitVideoLayer(__disp_pixel_fmt_t fmt);
- + bool RenderFrame(unsigned int yAddr, unsigned int uAddr, unsigned int vAddr,
- + unsigned int ySize, unsigned int uSize, unsigned int vSize,
- + __disp_pixel_fmt_t fmt, int frame_rate, int frame);
- + int GetFrameID();
- + bool WaitVSYNC();
- + __disp_colorkey_t ColorKey;
- +private:
- +protected:
- + unsigned long m_cedarArguments[4];
- + unsigned int m_width;
- + unsigned int m_height;
- + int m_screenId;
- + int m_DisplayHandle;
- + int m_videoLayer;
- + int m_FrameBufferHandle;
- + int m_FrameBufferLayerHandle;
- + int m_displayLayer;
- + bool m_open;
- + bool m_videoLayerInit;
- + unsigned int m_displayWidth;
- + unsigned int m_displayHeight;
- + CRect m_destRect;
- + CRect m_sourceRect;
- + __disp_layer_info_t m_videoLayerAttr;
- + ERenderFormat m_format;
- + DllLibCedar m_dllCedar;
- +};
- +
- +#endif
- +
- +#endif
- diff -b -u -r -N '--exclude=.git' xbmc_orig/xbmc/cores/dvdplayer/DVDCodecs/Video/DllLibCedar.h xbmc_huceke/xbmc/cores/dvdplayer/DVDCodecs/Video/DllLibCedar.h
- --- xbmc_orig/xbmc/cores/dvdplayer/DVDCodecs/Video/DllLibCedar.h 1970-01-01 01:00:00.000000000 +0100
- +++ xbmc_huceke/xbmc/cores/dvdplayer/DVDCodecs/Video/DllLibCedar.h 2013-06-17 16:16:23.000000000 +0200
- @@ -0,0 +1,65 @@
- +#pragma once
- +
- +/*
- + * Copyright (C) 2005-2008 Team XBMC
- + * http://www.xbmc.org
- + *
- + * This Program is free software; you can redistribute it and/or modify
- + * it under the terms of the GNU General Public License as published by
- + * the Free Software Foundation; either version 2, or (at your option)
- + * any later version.
- + *
- + * This Program is distributed in the hope that it will be useful,
- + * but WITHOUT ANY WARRANTY; without even the implied warranty of
- + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- + * GNU General Public License for more details.
- + *
- + * You should have received a copy of the GNU General Public License
- + * along with XBMC; see the file COPYING. If not, write to
- + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- + * http://www.gnu.org/copyleft/gpl.html
- + *
- + */
- +
- +#if (defined HAVE_CONFIG_H) && (!defined WIN32)
- + #include "config.h"
- +#endif
- +extern "C" {
- +#include <libcedar/CedarDecoder.h>
- +}
- +#include "DynamicDll.h"
- +#include "utils/log.h"
- +
- +#define DLL_PATH_LIBCEDAR "/usr/lib/libcedar.so"
- +
- +class DllLibCedarInterface
- +{
- +public:
- + virtual ~DllLibCedarInterface() {}
- + virtual CCedarDecoder *AllocCedarDecoder() = 0;
- + virtual CCedarDecoder *FreeCedarDecoder(CCedarDecoder *decoder) = 0;
- + virtual unsigned int MemGetPhyAddr(unsigned int mem) = 0;
- + virtual void *MemPalloc(u32 size, u32 align) = 0;
- + virtual void MemPfree(void* p) = 0;
- + virtual void MemFlushCache(u8* mem, u32 size) = 0;
- +};
- +
- +class DllLibCedar : public DllDynamic, DllLibCedarInterface
- +{
- + DECLARE_DLL_WRAPPER(DllLibCedar, DLL_PATH_LIBCEDAR)
- + LOAD_SYMBOLS()
- + DEFINE_METHOD0(CCedarDecoder *, AllocCedarDecoder)
- + DEFINE_METHOD1(CCedarDecoder *, FreeCedarDecoder, (CCedarDecoder *p1))
- + DEFINE_METHOD1(unsigned int, MemGetPhyAddr, (unsigned int p1))
- + DEFINE_METHOD2(void *, MemPalloc, (u32 p1, u32 p2))
- + DEFINE_METHOD1(void , MemPfree, (void *p1))
- + DEFINE_METHOD2(void , MemFlushCache, (u8 *p1, u32 p2))
- + BEGIN_METHOD_RESOLVE()
- + RESOLVE_METHOD(AllocCedarDecoder)
- + RESOLVE_METHOD(FreeCedarDecoder)
- + RESOLVE_METHOD(MemGetPhyAddr)
- + RESOLVE_METHOD(MemPalloc)
- + RESOLVE_METHOD(MemPfree)
- + RESOLVE_METHOD(MemFlushCache)
- + END_METHOD_RESOLVE()
- +};
- diff -b -u -r -N '--exclude=.git' xbmc_orig/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecCedar.cpp xbmc_huceke/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecCedar.cpp
- --- xbmc_orig/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecCedar.cpp 1970-01-01 01:00:00.000000000 +0100
- +++ xbmc_huceke/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecCedar.cpp 2013-06-17 16:16:23.000000000 +0200
- @@ -0,0 +1,508 @@
- +/*
- + * Copyright (C) 2012 Team XBMC
- + * http://www.xbmc.org
- + *
- + * This Program is free software; you can redistribute it and/or modify
- + * it under the terms of the GNU General Public License as published by
- + * the Free Software Foundation; either version 2, or (at your option)
- + * any later version.
- + *
- + * This Program is distributed in the hope that it will be useful,
- + * but WITHOUT ANY WARRANTY; without even the implied warranty of
- + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- + * GNU General Public License for more details.
- + *
- + * You should have received a copy of the GNU General Public License
- + * along with XBMC; see the file COPYING. If not, write to
- + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- + * http://www.gnu.org/copyleft/gpl.html
- + *
- + */
- +
- +#if (defined HAVE_CONFIG_H) && (!defined WIN32)
- + #include "config.h"
- +#elif defined(_WIN32)
- +#include "system.h"
- +#endif
- +
- +#if defined(HAVE_LIBCEDAR)
- +
- +#include "DVDStreamInfo.h"
- +#include "DVDCodecs/DVDCodecUtils.h"
- +#include "DVDVideoCodecCedar.h"
- +#include "DynamicDll.h"
- +#include "cores/VideoRenderers/RenderFormats.h"
- +#include "utils/BitstreamConverter.h"
- +
- +#include "guilib/GraphicContext.h"
- +
- +#include "utils/log.h"
- +#include "linux/XMemUtils.h"
- +#include "DVDClock.h"
- +#include "threads/Atomics.h"
- +
- +#include <sys/time.h>
- +#include <inttypes.h>
- +
- +#ifdef CLASSNAME
- +#undef CLASSNAME
- +#endif
- +#define CLASSNAME "CDVDVideoCodecCedar"
- +
- +#define ALIGN(x, n) (((x) + (n) - 1) & (~((n) - 1)))
- +#define CODEC_4CC(c1,c2,c3,c4) (((u32)(c4)<<24)|((u32)(c3)<<16)|((u32)(c2)<<8)|(u32)(c1))
- +
- +static long g_cedaropen = 0;
- +
- +CDVDVideoCodecCedar::CDVDVideoCodecCedar()
- +{
- + m_video_codec_name = "";
- + m_cedarDecoder = NULL;
- + m_valid_pts = false;
- + m_packet_count = 0;
- + m_converter = NULL;
- + m_convert = false;
- + m_is_open = false;
- +
- + memset(&m_videobuffer, 0, sizeof(DVDVideoPicture));
- +}
- +
- +CDVDVideoCodecCedar::~CDVDVideoCodecCedar()
- +{
- + Dispose();
- +}
- +
- +bool CDVDVideoCodecCedar::NaluFormatStartCodes(enum CodecID codec, uint8_t *in_extradata, int in_extrasize)
- +{
- + switch(codec)
- + {
- + case CODEC_ID_H264:
- + if (in_extrasize < 7 || in_extradata == NULL)
- + return true;
- + // valid avcC atom data always starts with the value 1 (version), otherwise annexb
- + else if ( *in_extradata != 1 )
- + return true;
- + default: break;
- + }
- + return false;
- +}
- +
- +bool CDVDVideoCodecCedar::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options)
- +{
- + if (cas(&g_cedaropen, 0, 1) != 0)
- + {
- + CLog::Log(LOGERROR, "%s::%s decoder already in use\n", CLASSNAME, __func__);
- + return false;
- + }
- +
- + if(!m_dllCedar.Load())
- + return false;
- +
- + Dispose();
- +
- + m_decoded_width = hints.width;
- + m_decoded_height = hints.height;
- +
- + if(!m_decoded_width || !m_decoded_height)
- + {
- + CLog::Log(LOGERROR, "%s::%s unknown decoded size %dx%d\n", CLASSNAME, __func__, m_decoded_width, m_decoded_height);
- + return false;
- + }
- +
- + m_converter = new CBitstreamConverter();
- + if(!m_converter)
- + {
- + CLog::Log(LOGERROR, "%s::%s allocationg bistream converter\n", CLASSNAME, __func__);
- + return false;
- + }
- +
- + int extrasize = hints.extrasize;
- + uint8_t *extradata = (uint8_t *)hints.extradata;
- +
- + m_convert = m_converter->Open(hints.codec, (uint8_t *)hints.extradata, hints.extrasize, false);
- + if(m_convert)
- + {
- + extrasize = m_converter->GetExtraSize();
- + extradata = m_converter->GetExtraData();
- + }
- +
- + vstream_info_t stream_info;
- + memset(&stream_info, 0x0, sizeof(vstream_info_t));
- +
- + stream_info.container_format = CONTAINER_FORMAT_UNKNOW;
- +
- + /*
- + printf("extradata : ");
- + for(int i = 0; i < extrasize; i++)
- + {
- + uint8_t *p = (uint8_t *)extradata;
- + printf("%02x ", p[i]);
- + }
- + printf("\n");
- + */
- +
- + switch(hints.codec)
- + {
- + case CODEC_ID_H264:
- + stream_info.format = STREAM_FORMAT_H264;
- + stream_info.sub_format = STREAM_SUB_FORMAT_UNKNOW;
- + /*
- + if(hints.codec_tag == 27 || NaluFormatStartCodes(hints.codec, extradata, extrasize)) //M2TS and TS
- + {
- + printf("ts\n");
- + stream_info.container_format = CONTAINER_FORMAT_TS;
- + }
- + */
- + m_video_codec_name = "cedar-h264";
- + break;
- + case CODEC_ID_MPEG1VIDEO:
- + stream_info.format = STREAM_FORMAT_MPEG2;
- + stream_info.sub_format = MPEG2_SUB_FORMAT_MPEG1;
- + m_video_codec_name = "cedar-mpeg1";
- + break;
- + case CODEC_ID_MPEG2VIDEO:
- + stream_info.format = STREAM_FORMAT_MPEG2;
- + stream_info.sub_format = MPEG2_SUB_FORMAT_MPEG2;
- + extradata = NULL;
- + extrasize = 0;
- + m_video_codec_name = "cedar-mpeg2";
- + break;
- + case CODEC_ID_MSMPEG4V1:
- + stream_info.format = STREAM_FORMAT_MPEG4;
- + stream_info.sub_format = MPEG4_SUB_FORMAT_DIVX1;
- + m_video_codec_name = "cedar-divx1";
- + break;
- + break;
- + case CODEC_ID_MSMPEG4V2:
- + stream_info.format = STREAM_FORMAT_MPEG4;
- + stream_info.sub_format = MPEG4_SUB_FORMAT_DIVX2;
- + m_video_codec_name = "cedar-divx2";
- + break;
- + case CODEC_ID_MSMPEG4V3:
- + stream_info.format = STREAM_FORMAT_MPEG4;
- + stream_info.sub_format = MPEG4_SUB_FORMAT_DIVX3;
- + m_video_codec_name = "cedar-divx3";
- + break;
- + case CODEC_ID_MPEG4:
- + stream_info.format = STREAM_FORMAT_MPEG4;
- + switch(hints.codec_tag)
- + {
- + case CODEC_4CC('D','X','5','0'):
- + case CODEC_4CC('D','I','V','5'):
- + stream_info.sub_format = MPEG4_SUB_FORMAT_DIVX5;
- + m_video_codec_name = "cedar-divx5";
- + break;
- + case CODEC_4CC('X','V','I','D'):
- + case CODEC_4CC('M','P','4','V'):
- + case CODEC_4CC('P','M','P','4'):
- + case CODEC_4CC('F','M','P','4'):
- + stream_info.sub_format = MPEG4_SUB_FORMAT_XVID;
- + m_video_codec_name = "cedar-xvid";
- + break;
- + default:
- + return false;
- + }
- + break;
- + case CODEC_ID_VP6F:
- + stream_info.format = STREAM_FORMAT_MPEG4;
- + stream_info.sub_format = MPEG4_SUB_FORMAT_VP6;
- + m_video_codec_name = "cedar-vp6";
- + break;
- + case CODEC_ID_H263:
- + stream_info.format = STREAM_FORMAT_MPEG4;
- + stream_info.sub_format = MPEG4_SUB_FORMAT_H263;
- + m_video_codec_name = "cedar-h263";
- + break;
- + case CODEC_ID_VP8:
- + stream_info.format = STREAM_FORMAT_VP8;
- + stream_info.sub_format = STREAM_SUB_FORMAT_UNKNOW;
- + m_video_codec_name = "cedar-vp8";
- + break;
- + case CODEC_ID_VC1:
- + stream_info.format = STREAM_FORMAT_VC1;
- + stream_info.sub_format = STREAM_SUB_FORMAT_UNKNOW;
- + m_video_codec_name = "cedar-vc1";
- + break;
- + case CODEC_ID_WMV3:
- + stream_info.format = STREAM_FORMAT_VC1;
- + stream_info.sub_format = STREAM_SUB_FORMAT_UNKNOW;
- + m_video_codec_name = "cedar-wmv3";
- + break;
- + case CODEC_ID_WMV1:
- + stream_info.format = STREAM_FORMAT_MPEG4;
- + stream_info.sub_format = MPEG4_SUB_FORMAT_WMV1;
- + m_video_codec_name = "cedar-wmv1";
- + break;
- + case CODEC_ID_WMV2:
- + stream_info.format = STREAM_FORMAT_MPEG4;
- + stream_info.sub_format = MPEG4_SUB_FORMAT_WMV2;
- + m_video_codec_name = "cedar-wmv2";
- + break;
- + case CODEC_ID_FLV1:
- + stream_info.format = STREAM_FORMAT_MPEG4;
- + stream_info.sub_format = MPEG4_SUB_FORMAT_SORENSSON_H263;
- + m_video_codec_name = "cedar-sorensson";
- + break;
- + case CODEC_ID_MJPEG:
- + stream_info.format = STREAM_FORMAT_MJPEG;
- + stream_info.sub_format = STREAM_SUB_FORMAT_UNKNOW;
- + m_video_codec_name = "cedar-mjpeg";
- + break;
- + default:
- + CLog::Log(LOGERROR, "%s::%s CodecID 0x%08x not supported by Cedar decoder\n", CLASSNAME, __func__, hints.codec);
- + return false;
- + }
- +
- + stream_info.container_format = CONTAINER_FORMAT_UNKNOW;
- + stream_info.video_width = m_decoded_width;
- + stream_info.video_height = m_decoded_height;
- + if (hints.fpsrate && hints.fpsscale)
- + stream_info.frame_rate = DVD_TIME_BASE /
- + CDVDCodecUtils::NormalizeFrameduration((double)DVD_TIME_BASE *
- + hints.fpsscale / hints.fpsrate) * 1000;
- + else
- + stream_info.frame_rate = 25.0f * 1000;
- + stream_info.frame_duration = (double)DVD_TIME_BASE / stream_info.frame_rate * 1000.0f;
- + stream_info.is_pts_correct = 1;
- + stream_info.aspec_ratio = m_decoded_width / m_decoded_height * 1000;
- +
- + m_cedarDecoder = m_dllCedar.AllocCedarDecoder();
- +
- + if(!m_cedarDecoder)
- + {
- + CLog::Log(LOGERROR, "%s::%s Cedar create\n", CLASSNAME, __func__);
- + return false;
- + }
- +
- + if(!m_cedarDecoder->Open(&stream_info, extradata, extrasize))
- + {
- + CLog::Log(LOGERROR, "%s::%s Cedar decoder open\n", CLASSNAME, __func__);
- + m_cedarDecoder->Close();
- + return false;
- + }
- +
- + m_is_open = true;
- +
- + CLog::Log(LOGINFO, "%s::%s - Cedar Decoder opened with codec : %s [%dx%d]", CLASSNAME, __func__,
- + m_video_codec_name.c_str(), m_decoded_width, m_decoded_height);
- +
- + return true;
- +}
- +
- +void CDVDVideoCodecCedar::Dispose()
- +{
- + if(m_is_open)
- + m_cedarDecoder->Close();
- +
- + if(m_cedarDecoder)
- + {
- + cas(&g_cedaropen, 1, 0);
- + m_dllCedar.FreeCedarDecoder(m_cedarDecoder);
- + m_cedarDecoder = NULL;
- + }
- +
- + m_video_codec_name = "";
- +
- + memset(&m_videobuffer, 0, sizeof(DVDVideoPicture));
- +
- + while (!m_dts_queue.empty())
- + m_dts_queue.pop();
- +
- + m_valid_pts = false;
- +
- + m_packet_count = 0;
- +
- + delete m_converter;
- + m_converter = NULL;
- + m_convert = false;
- +
- + m_dllCedar.Unload();
- +
- + m_is_open = false;
- +}
- +
- +void CDVDVideoCodecCedar::SetDropState(bool bDrop)
- +{
- + m_drop_state = bDrop;
- +
- + /*
- + if(m_drop_state)
- + {
- + while(m_cedarDecoder->ReadyFrames())
- + {
- + vpicture_t *picture = m_cedarDecoder->GetDisplayFrame();
- + if(picture)
- + {
- + m_cedarDecoder->ReturnDisplayFrame(picture);
- + if(!m_dts_queue.empty())
- + m_dts_queue.pop();
- + }
- + else
- + break;
- + }
- + }
- + */
- +}
- +
- +int CDVDVideoCodecCedar::Decode(uint8_t *pData, int iSize, double dts, double pts)
- +{
- + if (!pData)
- + {
- + int ret = 0;
- + if(m_cedarDecoder->ReadyFrames() == 1)
- + ret = VC_PICTURE | VC_BUFFER;
- + else if(m_cedarDecoder->ReadyFrames() > 1)
- + ret = VC_PICTURE;
- + else
- + ret = VC_BUFFER;
- + return ret;
- + }
- +
- + int demuxer_bytes = 0;
- + uint8_t *demuxer_content = NULL;
- +
- + if(m_convert)
- + {
- + m_converter->Convert(pData, iSize);
- + demuxer_bytes = m_converter->GetConvertSize();
- + demuxer_content = m_converter->GetConvertBuffer();
- + }
- + else
- + {
- + demuxer_bytes = iSize;
- + demuxer_content = pData;
- + }
- +
- + if(demuxer_bytes && demuxer_content)
- + {
- + double pts_cedar = (pts == DVD_NOPTS_VALUE) ? 0 : pts / 1000;
- +
- + m_valid_pts = (pts != DVD_NOPTS_VALUE);
- +
- + vstream_data_t *streamData = m_cedarDecoder->AllocateBuffer(demuxer_bytes, pts_cedar);
- +
- + if(streamData)
- + {
- + m_cedarDecoder->AddBufferData(streamData, demuxer_content, demuxer_bytes);
- + m_cedarDecoder->AddBuffer(streamData);
- +
- + m_dts_queue.push(dts);
- +
- + m_packet_count++;
- + }
- + else
- + {
- + CLog::Log(LOGERROR, "%s::%s decoder buffer full. frame dropped\n" , CLASSNAME, __func__);
- + }
- + }
- +
- + int ret = 0;
- +
- + if(m_cedarDecoder->FreeFrames() > 1 && m_cedarDecoder->ReadyBuffers() && m_packet_count > 1)
- + {
- + //unsigned int start = XbmcThreads::SystemClockMillis();
- + s32 decoderRet = m_cedarDecoder->Decode(false, pts);
- + //int lastDecodeTime = XbmcThreads::SystemClockMillis() - start;
- + if(decoderRet == VRESULT_ERR_NO_MEMORY || decoderRet == VRESULT_ERR_UNSUPPORTED)
- + {
- + CLog::Log(LOGERROR, "%s::%s bitstream unsupported\n", CLASSNAME, __func__);
- + return VC_ERROR;
- + }
- + //if(lastDecodeTime > 40)
- + // printf("decode tooked %3d ms\n", lastDecodeTime);
- +
- + switch(decoderRet)
- + {
- + case VRESULT_OK:
- + case VRESULT_FRAME_DECODED:
- + case VRESULT_KEYFRAME_DECODED:
- + case VRESULT_NO_BITSTREAM:
- + ret |= VC_BUFFER;
- + break;
- + default:
- + break;
- + }
- + }
- +
- + if(m_cedarDecoder->ReadyFrames())
- + ret |= VC_PICTURE;
- +
- + return ret;
- +}
- +
- +bool CDVDVideoCodecCedar::GetPicture(DVDVideoPicture *pDvdVideoPicture)
- +{
- + // clone the video picture buffer settings.
- + bool bRet = false;
- +
- + vpicture_t *picture = m_cedarDecoder->GetDisplayFrame();
- + if(picture)
- + {
- + m_cedarPicture.Picture = picture;
- + m_videobuffer.cedarPicture = &m_cedarPicture;
- +
- + /* set ref on the frame */
- +
- + m_videobuffer.format = RENDER_FMT_BYPASS_CEDAR;
- + m_videobuffer.pts = DVD_NOPTS_VALUE;
- + m_videobuffer.dts = DVD_NOPTS_VALUE;
- +
- + if(m_valid_pts)
- + m_videobuffer.pts = m_cedarPicture.Picture->pts * 1000;
- +
- + if (!m_dts_queue.empty())
- + {
- + m_videobuffer.dts = m_dts_queue.front();
- + m_dts_queue.pop();
- + }
- +
- + //printf("pts %f dts %f\n", m_videobuffer.pts, m_videobuffer.dts);
- +
- + m_videobuffer.iDisplayWidth = m_decoded_width;
- + m_videobuffer.iDisplayHeight = m_decoded_height;
- + m_videobuffer.iWidth = m_cedarPicture.Picture->width;
- + m_videobuffer.iHeight = m_cedarPicture.Picture->height;
- +
- + m_videobuffer.data[0] = m_cedarPicture.Picture->y;
- + m_videobuffer.data[1] = m_cedarPicture.Picture->u;
- + m_videobuffer.data[2] = m_cedarPicture.Picture->u;
- + m_videobuffer.iLineSize[0] = m_cedarPicture.Picture->width;
- + m_videobuffer.iLineSize[1] = m_cedarPicture.Picture->height / 2;
- + m_videobuffer.iLineSize[2] = m_cedarPicture.Picture->height / 2;
- +
- + m_videobuffer.iFlags = DVP_FLAG_ALLOCATED;
- + /*
- + m_videobuffer.iFlags |= m_drop_state ? DVP_FLAG_DROPPED : 0;
- + */
- +
- + bRet = true;
- + }
- + else
- + {
- + m_videobuffer.cedarPicture = NULL;
- + m_videobuffer.iFlags = DVP_FLAG_DROPPED;
- + }
- +
- + *pDvdVideoPicture = m_videobuffer;
- +
- + return bRet;
- +}
- +
- +bool CDVDVideoCodecCedar::ClearPicture(DVDVideoPicture* pDvdVideoPicture)
- +{
- + if(pDvdVideoPicture->cedarPicture != NULL)
- + {
- + m_cedarDecoder->ReturnDisplayFrame(pDvdVideoPicture->cedarPicture->Picture);
- + }
- + pDvdVideoPicture->cedarPicture = NULL;
- +
- + return CDVDVideoCodec::ClearPicture(pDvdVideoPicture);
- +}
- +
- +void CDVDVideoCodecCedar::Reset(void)
- +{
- + if(m_cedarDecoder)
- + m_cedarDecoder->Flush();
- +}
- +
- +#endif
- diff -b -u -r -N '--exclude=.git' xbmc_orig/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecCedar.h xbmc_huceke/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecCedar.h
- --- xbmc_orig/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecCedar.h 1970-01-01 01:00:00.000000000 +0100
- +++ xbmc_huceke/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecCedar.h 2013-06-17 16:16:23.000000000 +0200
- @@ -0,0 +1,92 @@
- +/*
- + * Copyright (C) 2012 Team XBMC
- + * http://www.xbmc.org
- + *
- + * This Program is free software; you can redistribute it and/or modify
- + * it under the terms of the GNU General Public License as published by
- + * the Free Software Foundation; either version 2, or (at your option)
- + * any later version.
- + *
- + * This Program is distributed in the hope that it will be useful,
- + * but WITHOUT ANY WARRANTY; without even the implied warranty of
- + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- + * GNU General Public License for more details.
- + *
- + * You should have received a copy of the GNU General Public License
- + * along with XBMC; see the file COPYING. If not, write to
- + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- + * http://www.gnu.org/copyleft/gpl.html
- + *
- + */
- +
- +#pragma once
- +
- +#if (defined HAVE_CONFIG_H) && (!defined WIN32)
- + #include "config.h"
- +#elif defined(_WIN32)
- +#include "system.h"
- +#endif
- +
- +#if defined(HAVE_LIBCEDAR)
- +
- +#include "DVDVideoCodec.h"
- +#include <libcedar/CedarDecoder.h>
- +#include "DllLibCedar.h"
- +#include "threads/Thread.h"
- +#include "threads/SingleLock.h"
- +#include "DllAvFormat.h"
- +
- +#include <list>
- +#include <vector>
- +#include <queue>
- +#include <deque>
- +
- +class CDVDVideoCodecCedar;
- +class CBitstreamConverter;
- +
- +typedef struct CedarPicture
- +{
- + vpicture_t *Picture;
- +} CedarPicture;
- +
- +class CDVDVideoCodecCedar : public CDVDVideoCodec
- +{
- +public:
- + CDVDVideoCodecCedar();
- + ~CDVDVideoCodecCedar();
- +
- + // Required overrides
- + bool Open(CDVDStreamInfo &hints, CDVDCodecOptions &options);
- + void Dispose(void);
- + int Decode(uint8_t *pData, int iSize, double dts, double pts);
- + void Reset(void);
- + void SetDropState(bool bDrop);
- + bool GetPicture(DVDVideoPicture *pDvdVideoPicture);
- + bool ClearPicture(DVDVideoPicture* pDvdVideoPicture);
- + const char* GetName() { return m_video_codec_name.c_str(); };
- + void Process();
- +protected:
- + // Video format
- + bool m_drop_state;
- + unsigned int m_decoded_width;
- + unsigned int m_decoded_height;
- + CStdString m_video_codec_name;
- + bool m_valid_pts;
- + uint64_t m_packet_count;
- + bool m_is_open;
- +
- + unsigned int m_input_size;
- +
- + std::queue<double> m_dts_queue;
- +
- + CCedarDecoder *m_cedarDecoder;
- + CBitstreamConverter *m_converter;
- + bool m_convert;
- + DllLibCedar m_dllCedar;
- + DVDVideoPicture m_videobuffer;
- + CedarPicture m_cedarPicture;
- +
- + bool NaluFormatStartCodes(enum CodecID codec, uint8_t *in_extradata, int in_extrasize);
- +};
- +
- +#endif
- diff -b -u -r -N '--exclude=.git' xbmc_orig/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h xbmc_huceke/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h
- --- xbmc_orig/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h 2013-06-17 16:17:17.000000000 +0200
- +++ xbmc_huceke/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h 2013-06-17 16:16:23.000000000 +0200
- @@ -37,6 +37,7 @@
- class CVDPAU;
- class COpenMax;
- class COpenMaxVideo;
- +struct CedarPicture;
- struct OpenMaxVideoBuffer;
- // should be entirely filled by all codecs
- @@ -71,6 +72,8 @@
- };
- };
- + CedarPicture *cedarPicture;
- +
- unsigned int iFlags;
- double iRepeatPicture;
- diff -b -u -r -N '--exclude=.git' xbmc_orig/xbmc/cores/dvdplayer/DVDCodecs/Video/Makefile.in xbmc_huceke/xbmc/cores/dvdplayer/DVDCodecs/Video/Makefile.in
- --- xbmc_orig/xbmc/cores/dvdplayer/DVDCodecs/Video/Makefile.in 2013-06-17 16:17:17.000000000 +0200
- +++ xbmc_huceke/xbmc/cores/dvdplayer/DVDCodecs/Video/Makefile.in 2013-06-17 16:16:23.000000000 +0200
- @@ -22,6 +22,12 @@
- SRCS += OpenMaxVideo.cpp
- SRCS += DVDVideoCodecOpenMax.cpp
- endif
- +ifeq (@USE_CEDAR@,1)
- +SRCS += DVDVideoCodecCedar.cpp \
- + CedarOverlayManager.cpp \
- +
- +endif
- +
- LIB=Video.a
- diff -b -u -r -N '--exclude=.git' xbmc_orig/xbmc/cores/dvdplayer/DVDFileInfo.cpp xbmc_huceke/xbmc/cores/dvdplayer/DVDFileInfo.cpp
- --- xbmc_orig/xbmc/cores/dvdplayer/DVDFileInfo.cpp 2013-06-17 16:17:17.000000000 +0200
- +++ xbmc_huceke/xbmc/cores/dvdplayer/DVDFileInfo.cpp 2013-06-17 16:16:23.000000000 +0200
- @@ -162,6 +162,11 @@
- CDVDStreamInfo hint(*pDemuxer->GetStream(nVideoStream), true);
- hint.software = true;
- +#if defined(HAVE_LIBCEDAR)
- + // libmpeg2 is not thread safe so use ffmepg for mpeg2/mpeg1 thumb extraction
- + CDVDCodecOptions dvdOptions;
- + pVideoCodec = CDVDFactoryCodec::OpenCodec(new CDVDVideoCodecFFmpeg(), hint, dvdOptions);
- +#else
- if (hint.codec == CODEC_ID_MPEG2VIDEO || hint.codec == CODEC_ID_MPEG1VIDEO)
- {
- // libmpeg2 is not thread safe so use ffmepg for mpeg2/mpeg1 thumb extraction
- @@ -172,7 +177,7 @@
- {
- pVideoCodec = CDVDFactoryCodec::CreateVideoCodec( hint );
- }
- -
- +#endif
- if (pVideoCodec)
- {
- int nTotalLen = pDemuxer->GetStreamLength();
- diff -b -u -r -N '--exclude=.git' xbmc_orig/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp xbmc_huceke/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp
- --- xbmc_orig/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp 2013-06-17 16:17:17.000000000 +0200
- +++ xbmc_huceke/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp 2013-06-17 16:16:23.000000000 +0200
- @@ -280,6 +280,10 @@
- CLog::Log(LOGNOTICE, "deleting video codec");
- if (m_pVideoCodec)
- {
- +#if defined(HAS_VIDEO_PLAYBACK) && defined(HAVE_LIBCEDAR)
- + /* cose renderer before decoder, the renderer could hold data from the decoder */
- + g_renderManager.UnInit();
- +#endif
- m_pVideoCodec->Dispose();
- delete m_pVideoCodec;
- m_pVideoCodec = NULL;
- @@ -1127,6 +1131,9 @@
- case RENDER_FMT_BYPASS:
- formatstr = "BYPASS";
- break;
- + case RENDER_FMT_BYPASS_CEDAR:
- + formatstr = "BYPASS_CEDAR";
- + break;
- case RENDER_FMT_NONE:
- formatstr = "NONE";
- break;
- diff -b -u -r -N '--exclude=.git' xbmc_orig/xbmc/cores/VideoRenderers/Makefile.in xbmc_huceke/xbmc/cores/VideoRenderers/Makefile.in
- --- xbmc_orig/xbmc/cores/VideoRenderers/Makefile.in 2013-06-12 16:21:05.000000000 +0200
- +++ xbmc_huceke/xbmc/cores/VideoRenderers/Makefile.in 2013-06-17 16:16:23.000000000 +0200
- @@ -14,8 +14,11 @@
- endif
- ifeq (@USE_OPENGLES@,1)
- +SRCS += OverlayRendererGL.cpp \
- +ifeq (@USE_CEDAR@,1)
- +SRCS += OverlayRendererCedar.cpp \
- +else
- SRCS += LinuxRendererGLES.cpp
- -SRCS += OverlayRendererGL.cpp
- endif
- LIB = VideoRenderer.a
- diff -b -u -r -N '--exclude=.git' xbmc_orig/xbmc/cores/VideoRenderers/OverlayRendererCedar.cpp xbmc_huceke/xbmc/cores/VideoRenderers/OverlayRendererCedar.cpp
- --- xbmc_orig/xbmc/cores/VideoRenderers/OverlayRendererCedar.cpp 1970-01-01 01:00:00.000000000 +0100
- +++ xbmc_huceke/xbmc/cores/VideoRenderers/OverlayRendererCedar.cpp 2013-06-17 16:16:23.000000000 +0200
- @@ -0,0 +1,529 @@
- +/*
- + * Copyright (C) 2012 Team XBMC
- + * http://www.solid-run.com
- + *
- + * This Program is free software; you can redistribute it and/or modify
- + * it under the terms of the GNU General Public License as published by
- + * the Free Software Foundation; either version 2, or (at your option)
- + * any later version.
- + *
- + * This Program is distributed in the hope that it will be useful,
- + * but WITHOUT ANY WARRANTY; without even the implied warranty of
- + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- + * GNU General Public License for more details.
- + *
- + * You should have received a copy of the GNU General Public License
- + * along with XBMC; see the file COPYING. If not, write to
- + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- + * http://www.gnu.org/copyleft/gpl.html
- + *
- + * Original Dove Overlay Rendere written by Rabeeh Khoury from Solid-Run <support@solid-run.com>
- + *
- + */
- +
- +#include "system.h"
- +#if (defined HAVE_CONFIG_H) && (!defined WIN32)
- +#include "config.h"
- +#endif
- +
- +#if defined(HAVE_LIBCEDAR)
- +
- +#include "system_gl.h"
- +#include "OverlayRendererCedar.h"
- +#include "drv_display_sun4i.h"
- +#include "utils/log.h"
- +#include <stdlib.h>
- +#include <malloc.h>
- +#include "utils/fastmemcpy.h"
- +#include "guilib/GraphicContext.h"
- +#include "utils/GLUtils.h"
- +#include "threads/Thread.h"
- +
- +#if defined(CLASSNAME)
- +#undef CLASSNAME
- +#endif
- +
- +#define CLASSNAME "COverlayRendererCedar"
- +
- +COverlayRendererCedar::YUVBUFFER::YUVBUFFER()
- +{
- + memset(&image , 0, sizeof(image));
- + flipindex = 0;
- +}
- +
- +COverlayRendererCedar::YUVBUFFER::~YUVBUFFER()
- +{
- +}
- +
- +COverlayRendererCedar::COverlayRendererCedar()
- +{
- + for(int i = 0; i < NUM_BUFFERS; i++)
- + {
- + YV12Image &img = m_buffers[i].image;
- + img.plane[0] = NULL;
- + img.plane[1] = NULL;
- + img.plane[2] = NULL;
- + m_buffers[i].cedarPicture = NULL;
- + }
- + m_cedarDecoder = NULL;
- +
- + UnInit();
- +}
- +
- +COverlayRendererCedar::~COverlayRendererCedar()
- +{
- + UnInit();
- +}
- +
- +void COverlayRendererCedar::WaitFrame(int64_t frameId)
- +{
- + if (!m_bConfigured) return;
- +
- + unsigned int start = XbmcThreads::SystemClockMillis();
- + unsigned int end = 0;
- +
- + while(m_overlayCedar.GetFrameID() != frameId)
- + {
- + Sleep(10);
- + end = XbmcThreads::SystemClockMillis() - start;
- + if(end > 30)
- + break;
- + }
- +}
- +
- +void COverlayRendererCedar::ManageDisplay()
- +{
- + CRect view;
- +
- + view.x1 = (float)g_settings.m_ResInfo[m_resolution].Overscan.left;
- + view.y1 = (float)g_settings.m_ResInfo[m_resolution].Overscan.top;
- + view.x2 = (float)g_settings.m_ResInfo[m_resolution].Overscan.right;
- + view.y2 = (float)g_settings.m_ResInfo[m_resolution].Overscan.bottom;
- +
- + m_sourceRect.x1 = (float)g_settings.m_currentVideoSettings.m_CropLeft;
- + m_sourceRect.y1 = (float)g_settings.m_currentVideoSettings.m_CropTop;
- + m_sourceRect.x2 = (float)m_sourceWidth - g_settings.m_currentVideoSettings.m_CropRight;
- + m_sourceRect.y2 = (float)m_sourceHeight - g_settings.m_currentVideoSettings.m_CropBottom;
- +
- + CalcNormalDisplayRect(view.x1, view.y1, view.Width(), view.Height(), GetAspectRatio() * g_settings.m_fPixelRatio, g_settings.m_fZoomAmount, g_settings.m_fVerticalShift);
- +
- + m_glRect.x1 = 0.0f;
- + m_glRect.y1 = 0.0f;
- + m_glRect.x2 = (float)g_settings.m_ResInfo[m_resolution].iWidth;
- + m_glRect.y2 = (float)g_settings.m_ResInfo[m_resolution].iHeight;
- +
- + if(m_destRectOld != m_destRect || m_sourceRectOld != m_sourceRect)
- + {
- + m_destRectOld = m_destRect;
- + m_sourceRectOld = m_sourceRect;
- + m_overlayCedar.UpdatePos(m_destRect, m_sourceRect);
- + }
- +}
- +
- +bool COverlayRendererCedar::Configure(unsigned int width, unsigned int height, unsigned int d_width, unsigned int d_height, float fps, unsigned flags, ERenderFormat format, unsigned extended_format, unsigned int orientation)
- +{
- + m_format = format;
- + m_renderOrientation = orientation;
- +
- + if(!m_dllCedar.Load())
- + return false;
- +
- + if (m_format != RENDER_FMT_YUV420P && m_format != RENDER_FMT_BYPASS_CEDAR)
- + {
- + CLog::Log(LOGERROR, "%s::%s - Bad format\n", CLASSNAME, __func__);
- + return false;
- + }
- +
- + m_sourceWidth = width;
- + m_sourceHeight = height;
- + m_iFlags = flags;
- +
- + // Calculate the input frame aspect ratio.
- + CalculateFrameAspectRatio(d_width, d_height);
- + ChooseBestResolution(fps);
- + SetViewMode(g_settings.m_currentVideoSettings.m_ViewMode);
- + ManageDisplay();
- +
- + if(!m_overlayCedar.Open(m_destRect, m_sourceRect, m_format))
- + {
- + CLog::Log(LOGERROR, "%s::%s Cedar overlay open\n", CLASSNAME, __func__);
- + return false;
- + }
- +
- + CLog::Log(LOGDEBUG, "m_sourceRect.x1 %f m_sourceRect.x2 %f m_sourceRect.y1 %f m_sourceRect.y2 %f m_sourceFrameRatio %f\n",
- + m_sourceRect.x1, m_sourceRect.x2, m_sourceRect.y1, m_sourceRect.y2, m_sourceFrameRatio);
- + CLog::Log(LOGDEBUG, "m_destRect.x1 %f m_destRect.x2 %f m_destRect.y1 %f m_destRect.y2 %f\n",
- + m_destRect.x1, m_destRect.x2, m_destRect.y1, m_destRect.y2);
- +
- + m_enabled = 0;
- +
- + for (unsigned int i = 0; i < NUM_BUFFERS; i++)
- + {
- + FreeYV12Image(i);
- + CreateYV12Image(i, m_sourceWidth, m_sourceHeight);
- + }
- +
- + m_currentBuffer = 0;
- + m_bConfigured = true;
- +
- + CLog::Log(LOGDEBUG, "%s::%s - Proper format, continuing\n", CLASSNAME, __func__);
- +
- + return m_bConfigured;
- +}
- +
- +unsigned int COverlayRendererCedar::PreInit()
- +{
- + UnInit();
- +
- + m_currentBuffer = 0;
- +
- + m_resolution = g_guiSettings.m_LookAndFeelResolution;
- + if ( m_resolution == RES_WINDOW )
- + m_resolution = RES_DESKTOP;
- +
- + return true;
- +}
- +
- +int COverlayRendererCedar::GetImage(YV12Image *image, int source, bool readonly)
- +{
- + if(!image)
- + return -1;
- +
- + /* take next available buffer */
- + if( source == AUTOSOURCE)
- + source = NextYV12Image();
- +
- + YV12Image &im = m_buffers[source].image;
- +
- + for(int p = 0; p < MAX_PLANES; p++)
- + {
- + image->plane[p] = im.plane[p];
- + image->stride[p] = im.stride[p];
- + }
- +
- + image->width = im.width;
- + image->height = im.height;
- + image->flags = im.flags;
- + image->cshift_x = im.cshift_x;
- + image->cshift_y = im.cshift_y;
- +
- + return source;
- +}
- +
- +void COverlayRendererCedar::ReleaseImage(int source, bool preserve)
- +{
- + /*
- + CedarPicture *cedarPicture = m_buffers[source].cedarPicture;
- + if(cedarPicture)
- + {
- + m_buffers[source].cedarPicture = NULL;
- + }
- + */
- +}
- +
- +void COverlayRendererCedar::FlipPage(int source)
- +{
- + if (!m_bConfigured)
- + return;
- +
- + /*
- + CedarPicture *cedarPicture = NULL;
- + cedarPicture = m_buffers[m_currentBuffer].cedarPicture;
- + */
- +
- + /* switch source */
- + if( source >= 0 && source < NUM_BUFFERS )
- + m_currentBuffer = source;
- + else
- + m_currentBuffer = NextYV12Image();
- +
- + /*
- + if(cedarPicture && cedarPicture->Picture)
- + {
- + vpicture_t *picture = cedarPicture->Picture;
- +
- + __disp_pixel_fmt_t pixel_format = picture->pixel_format == PIXEL_FORMAT_AW_YUV422 ? DISP_FORMAT_YUV422 : DISP_FORMAT_YUV420;
- +
- + m_overlayCedar.RenderFrame((unsigned int)picture->y, (unsigned int)picture->u, (unsigned int)picture->v,
- + (unsigned int)picture->size_y, (unsigned int)picture->size_u, (unsigned int)picture->size_v,
- + pixel_format, picture->frame_rate, m_pictureCount);
- + m_overlayCedar.WaitVSYNC();
- + WaitFrame(m_pictureCount);
- + m_pictureCount++;
- + }
- + */
- +}
- +
- +void COverlayRendererCedar::Reset()
- +{
- +}
- +
- +void COverlayRendererCedar::Update(bool bPauseDrawing)
- +{
- + if (!m_bConfigured) return;
- + ManageDisplay();
- +}
- +
- +void COverlayRendererCedar::AddProcessor(DVDVideoPicture &pic)
- +{
- + if (!m_bConfigured) return;
- +
- + //printf("COverlayRendererCedar::AddProcessor %d\n", NextYV12Image());
- + YUVBUFFER &buf = m_buffers[NextYV12Image()];
- +
- + if(m_format == RENDER_FMT_YUV420P)
- + {
- + if(!m_cedarDecoder)
- + m_cedarDecoder = m_dllCedar.AllocCedarDecoder();
- +
- + /* allocate softpicture */
- + if(!buf.cedarPicture)
- + {
- + buf.cedarPicture = (CedarPicture*)malloc(sizeof(CedarPicture));
- + memset(buf.cedarPicture, 0, sizeof(CedarPicture));
- +
- + vpicture_t *softPicture = (vpicture_t*)malloc(sizeof(vpicture_t));
- + memset(softPicture, 0, sizeof(vpicture_t));
- +
- + buf.cedarPicture->Picture = softPicture;
- +
- + /* setup framebuffer picture */
- + softPicture->size_y = (pic.iWidth * pic.iHeight);
- + softPicture->size_u = pic.iWidth * pic.iHeight / 4;
- + softPicture->size_v = pic.iWidth * pic.iHeight / 4;
- +
- + softPicture->y = (u8*)m_cedarDecoder->MemPalloc(softPicture->size_y, 1024);
- + softPicture->u = (u8*)m_cedarDecoder->MemPalloc(softPicture->size_u, 1024);
- + softPicture->v = (u8*)m_cedarDecoder->MemPalloc(softPicture->size_v, 1024);
- +
- + softPicture->pixel_format = PIXEL_FORMAT_AW_YUV420;
- + softPicture->store_width = pic.iWidth;
- + softPicture->store_height = pic.iHeight;
- + softPicture->display_width = pic.iWidth;
- + softPicture->display_height = pic.iHeight;
- + softPicture->width = pic.iWidth;
- + softPicture->height = pic.iHeight;
- + softPicture->aspect_ratio = 1000;
- +
- + softPicture->id = m_pictureCount++;
- + }
- +
- + /* copy to virtual adress */
- +
- + int i = 0;
- + unsigned char *src = pic.data[0];
- + unsigned char *dst = buf.cedarPicture->Picture->y;
- + int w = pic.iWidth;
- + int h = pic.iHeight;
- + for(i = 0; i < h; i++)
- + {
- + fast_memcpy(dst, src, w);
- + src += pic.iLineSize[0];
- + dst += pic.iWidth;
- + }
- +
- + src = pic.data[1];
- + dst = buf.cedarPicture->Picture->u;
- +
- + w >>= 1;
- + h >>= 1;
- +
- + if(w == pic.iLineSize[1])
- + {
- + fast_memcpy(dst, src, w*h);
- + }
- + else
- + {
- + for(i = 0; i < h; i++)
- + {
- + fast_memcpy(dst, src, w);
- + dst += w;
- + src += pic.iLineSize[1];
- + }
- + }
- +
- + src = pic.data[2];
- + dst = buf.cedarPicture->Picture->v;
- +
- + if(w == pic.iLineSize[1])
- + {
- + fast_memcpy(dst, src, w*h);
- + }
- + else
- + {
- + for(i = 0; i < h; i++)
- + {
- + fast_memcpy(dst, src, w);
- + dst += w;
- + src += pic.iLineSize[2];
- + }
- + }
- + }
- + else
- + {
- + if(pic.cedarPicture)
- + buf.cedarPicture = pic.cedarPicture;
- + }
- +
- + CedarPicture *cedarPicture = buf.cedarPicture;
- + if(cedarPicture && cedarPicture->Picture)
- + {
- + vpicture_t *picture = cedarPicture->Picture;
- +
- + __disp_pixel_fmt_t pixel_format = picture->pixel_format == PIXEL_FORMAT_AW_YUV422 ? DISP_FORMAT_YUV422 : DISP_FORMAT_YUV420;
- +
- + m_overlayCedar.RenderFrame((unsigned int)picture->y, (unsigned int)picture->u, (unsigned int)picture->v,
- + (unsigned int)picture->size_y, (unsigned int)picture->size_u, (unsigned int)picture->size_v,
- + pixel_format, picture->frame_rate, m_pictureCount);
- + m_overlayCedar.WaitVSYNC();
- + //WaitFrame(m_pictureCount);
- + m_pictureCount++;
- + }
- +}
- +
- +void COverlayRendererCedar::RenderUpdate(bool clear, DWORD flags, DWORD alpha)
- +{
- + if (!m_bConfigured) return;
- +
- + g_graphicsContext.BeginPaint();
- +
- + glEnable(GL_BLEND);
- + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- + glClearColor(0, 0, 0, 0);
- + glClear(GL_COLOR_BUFFER_BIT);
- +
- + g_graphicsContext.EndPaint();
- +}
- +
- +bool COverlayRendererCedar::RenderCapture(CRenderCapture* capture)
- +{
- + CLog::Log(LOGERROR, "%s::%s - Not implemented\n", CLASSNAME, __func__);
- + return true;
- +}
- +
- +void COverlayRendererCedar::UnInit()
- +{
- + CLog::Log(LOGDEBUG, "%s::%s\n", CLASSNAME, __func__);
- +
- + WaitFrame(m_pictureCount);
- +
- + for(int i = 0; i < NUM_BUFFERS; i++)
- + FreeYV12Image(i);
- +
- + m_overlayCedar.Close();
- +
- + m_currentBuffer = 0;
- + m_iFlags = 0;
- + m_bConfigured = false;
- + m_sourceWidth = 0;
- + m_sourceHeight = 0;
- + m_pictureCount = 0;
- + m_timeOut = 0;
- + m_format = RENDER_FMT_NONE;
- +
- + if(m_cedarDecoder)
- + m_cedarDecoder = m_dllCedar.FreeCedarDecoder(m_cedarDecoder);
- +
- + m_dllCedar.Unload();
- +}
- +
- +void COverlayRendererCedar::CreateThumbnail(CBaseTexture* texture, unsigned int width, unsigned int height)
- +{
- + CLog::Log(LOGDEBUG, "%s::%s Was asked to create thumbnail (width = %d, height = %d\n",
- + CLASSNAME, __func__, width, height);
- +}
- +
- +bool COverlayRendererCedar::Supports(EDEINTERLACEMODE mode)
- +{
- + return false;
- +}
- +
- +bool COverlayRendererCedar::Supports(ERENDERFEATURE feature)
- +{
- + return false;
- +}
- +
- +bool COverlayRendererCedar::SupportsMultiPassRendering()
- +{
- + return false;
- +}
- +
- +bool COverlayRendererCedar::Supports(EINTERLACEMETHOD method)
- +{
- + return false;
- +}
- +
- +bool COverlayRendererCedar::Supports(ESCALINGMETHOD method)
- +{
- + if(method == VS_SCALINGMETHOD_NEAREST || method == VS_SCALINGMETHOD_LINEAR)
- + return true;
- +
- + return false;
- +}
- +
- +EINTERLACEMETHOD COverlayRendererCedar::AutoInterlaceMethod()
- +{
- + return VS_INTERLACEMETHOD_NONE;
- +}
- +
- +unsigned int COverlayRendererCedar::NextYV12Image()
- +{
- + return (m_currentBuffer + 1) % NUM_BUFFERS;
- +}
- +
- +bool COverlayRendererCedar::CreateYV12Image(unsigned int index, unsigned int width, unsigned int height)
- +{
- + YV12Image &im = m_buffers[index].image;
- +
- + im.width = width;
- + im.height = height;
- + im.cshift_x = 1;
- + im.cshift_y = 1;
- +
- + unsigned paddedWidth = (im.width + 15) & ~15;
- +
- + im.stride[0] = paddedWidth;
- + im.stride[1] = paddedWidth >> im.cshift_x;
- + im.stride[2] = paddedWidth >> im.cshift_x;
- +
- + im.planesize[0] = im.stride[0] * im.height;
- + im.planesize[1] = im.stride[1] * ( im.height >> im.cshift_y );
- + im.planesize[2] = im.stride[2] * ( im.height >> im.cshift_y );
- +
- + return true;
- +}
- +
- +bool COverlayRendererCedar::FreeYV12Image(unsigned int index)
- +{
- + YV12Image &im = m_buffers[index].image;
- +
- + for (int i = 0; i < MAX_PLANES; i++)
- + {
- + im.plane[i] = NULL;
- + }
- +
- + if(m_buffers[index].cedarPicture)
- + {
- + if(m_format == RENDER_FMT_YUV420P)
- + {
- + vpicture_t *picture = m_buffers[index].cedarPicture->Picture;
- +
- + if(picture->y)
- + m_cedarDecoder->MemPfree(picture->u);
- + if(picture->u)
- + m_cedarDecoder->MemPfree(picture->v);
- + if(picture->v)
- + m_cedarDecoder->MemPfree(picture->v);
- +
- + free(m_buffers[index].cedarPicture->Picture);
- + free(m_buffers[index].cedarPicture);
- + }
- + }
- + m_buffers[index].cedarPicture = NULL;
- +
- + memset(&im , 0, sizeof(YV12Image));
- +
- + return true;
- +}
- +
- +#endif
- diff -b -u -r -N '--exclude=.git' xbmc_orig/xbmc/cores/VideoRenderers/OverlayRendererCedar.h xbmc_huceke/xbmc/cores/VideoRenderers/OverlayRendererCedar.h
- --- xbmc_orig/xbmc/cores/VideoRenderers/OverlayRendererCedar.h 1970-01-01 01:00:00.000000000 +0100
- +++ xbmc_huceke/xbmc/cores/VideoRenderers/OverlayRendererCedar.h 2013-06-17 16:16:23.000000000 +0200
- @@ -0,0 +1,181 @@
- +/*
- + * Copyright (C) 2012 Team XBMC
- + * http://xbmc.org
- + *
- + * This Program is free software; you can redistribute it and/or modify
- + * it under the terms of the GNU General Public License as published by
- + * the Free Software Foundation; either version 2, or (at your option)
- + * any later version.
- + *
- + * This Program is distributed in the hope that it will be useful,
- + * but WITHOUT ANY WARRANTY; without even the implied warranty of
- + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- + * GNU General Public License for more details.
- + *
- + * You should have received a copy of the GNU General Public License
- + * along with XBMC; see the file COPYING. If not, write to
- + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- + * http://www.gnu.org/copyleft/gpl.html
- + *
- + */
- +
- +#pragma once
- +
- +#if (defined HAVE_CONFIG_H) && (!defined WIN32)
- + #include "config.h"
- +#elif defined(_WIN32)
- +#include "system.h"
- +#endif
- +
- +#if defined(HAVE_LIBCEDAR)
- +
- +#undef __u8
- +#undef byte
- +
- +#include "../../settings/VideoSettings.h"
- +#include "../dvdplayer/DVDCodecs/Video/DVDVideoCodec.h"
- +#include "RenderFlags.h"
- +#include "BaseRenderer.h"
- +#include "settings/GUISettings.h"
- +#include "settings/Settings.h"
- +
- +#include "cores/dvdplayer/DVDCodecs/Video/CedarOverlayManager.h"
- +#include "cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecCedar.h"
- +
- +class CRenderCapture;
- +class CBaseTexture;
- +
- +extern "C"
- +{
- +#include <sys/ioctl.h>
- +#include <linux/fb.h>
- +#include "drv_display_sun4i.h"
- +}
- +
- +struct DRAWRECT
- +{
- + float left;
- + float top;
- + float right;
- + float bottom;
- +};
- +
- +struct YUVRANGE
- +{
- + int y_min, y_max;
- + int u_min, u_max;
- + int v_min, v_max;
- +};
- +
- +struct YUVCOEF
- +{
- + float r_up, r_vp;
- + float g_up, g_vp;
- + float b_up, b_vp;
- +};
- +
- +#define AUTOSOURCE -1
- +
- +#define PLANE_Y 0
- +#define PLANE_U 1
- +#define PLANE_V 2
- +
- +#define FIELD_FULL 0
- +#define FIELD_ODD 1
- +#define FIELD_EVEN 2
- +
- +#define NUM_BUFFERS 2
- +
- +extern YUVRANGE yuv_range_lim;
- +extern YUVRANGE yuv_range_full;
- +extern YUVCOEF yuv_coef_bt601;
- +extern YUVCOEF yuv_coef_bt709;
- +extern YUVCOEF yuv_coef_ebu;
- +extern YUVCOEF yuv_coef_smtp240m;
- +
- +class COverlayRendererCedar : public CBaseRenderer
- +{
- + public:
- + COverlayRendererCedar();
- + virtual ~COverlayRendererCedar();
- +
- + virtual void Update(bool bPauseDrawing);
- + virtual void SetupScreenshot() {};
- +
- + bool RenderCapture(CRenderCapture* capture);
- +
- + void CreateThumbnail(CBaseTexture *texture, unsigned int width, unsigned int height);
- +
- + // Player functions
- + virtual void ManageDisplay();
- + bool Configure(unsigned int width, unsigned int height, unsigned int d_width, unsigned int d_height,
- + float fps, unsigned flags, ERenderFormat format, unsigned extended_format, unsigned int orientation);
- + virtual bool IsConfigured() { return m_bConfigured; }
- + virtual int GetImage(YV12Image *image, int source = AUTOSOURCE, bool readonly = false);
- + virtual void ReleaseImage(int source, bool preserve = false);
- + virtual void FlipPage(int source);
- + virtual unsigned int PreInit();
- + virtual void UnInit();
- + virtual void Reset(); /* resets renderer after seek for example */
- +
- + virtual void AddProcessor(DVDVideoPicture &pic);
- +
- + virtual void RenderUpdate(bool clear, DWORD flags = 0, DWORD alpha = 255);
- +
- + // Feature support
- + virtual bool SupportsMultiPassRendering();
- + virtual bool Supports(ERENDERFEATURE feature);
- + virtual bool Supports(EDEINTERLACEMODE mode);
- + virtual bool Supports(EINTERLACEMETHOD method);
- + virtual bool Supports(ESCALINGMETHOD method);
- +
- + virtual EINTERLACEMETHOD AutoInterlaceMethod();
- +
- + private:
- + void WaitFrame(int64_t frameId);
- +
- + unsigned int NextYV12Image();
- + bool CreateYV12Image(unsigned int index, unsigned int width, unsigned int height);
- + bool FreeYV12Image(unsigned int index);
- +
- + bool m_bConfigured;
- + unsigned int m_iFlags;
- +
- + struct YUVBUFFER
- + {
- + YUVBUFFER();
- + ~YUVBUFFER();
- +
- + YV12Image image;
- + unsigned flipindex;
- +
- + CedarPicture *cedarPicture;
- + };
- +
- + YUVBUFFER m_buffers[NUM_BUFFERS];
- + unsigned int m_currentBuffer;
- +
- + int m_enabled;
- +
- + CCedarOverlayManager m_overlayCedar;
- + CRect m_glRect;
- + CRect m_destRectOld;
- + CRect m_sourceRectOld;
- + int64_t m_pictureCount;
- + int m_timeOut;
- + ERenderFormat m_format;
- + DllLibCedar m_dllCedar;
- + CCedarDecoder *m_cedarDecoder;
- +};
- +
- +inline int NP2( unsigned x )
- +{
- + --x;
- + x |= x >> 1;
- + x |= x >> 2;
- + x |= x >> 4;
- + x |= x >> 8;
- + x |= x >> 16;
- + return ++x;
- +}
- +#endif
- diff -b -u -r -N '--exclude=.git' xbmc_orig/xbmc/cores/VideoRenderers/OverlayRendererGL.cpp xbmc_huceke/xbmc/cores/VideoRenderers/OverlayRendererGL.cpp
- --- xbmc_orig/xbmc/cores/VideoRenderers/OverlayRendererGL.cpp 2013-06-17 16:17:17.000000000 +0200
- +++ xbmc_huceke/xbmc/cores/VideoRenderers/OverlayRendererGL.cpp 2013-06-17 16:16:23.000000000 +0200
- @@ -26,7 +26,9 @@
- #ifdef HAS_GL
- #include "LinuxRendererGL.h"
- #elif HAS_GLES == 2
- +#if !defined(HAVE_LIBCEDAR)
- #include "LinuxRendererGLES.h"
- +#endif
- #include "guilib/MatrixGLES.h"
- #endif
- #include "RenderManager.h"
- diff -b -u -r -N '--exclude=.git' xbmc_orig/xbmc/cores/VideoRenderers/RenderFormats.h xbmc_huceke/xbmc/cores/VideoRenderers/RenderFormats.h
- --- xbmc_orig/xbmc/cores/VideoRenderers/RenderFormats.h 2013-06-17 16:17:17.000000000 +0200
- +++ xbmc_huceke/xbmc/cores/VideoRenderers/RenderFormats.h 2013-06-17 16:16:23.000000000 +0200
- @@ -34,6 +34,7 @@
- RENDER_FMT_OMXEGL,
- RENDER_FMT_CVBREF,
- RENDER_FMT_BYPASS,
- + RENDER_FMT_BYPASS_CEDAR,
- };
- #endif
- diff -b -u -r -N '--exclude=.git' xbmc_orig/xbmc/cores/VideoRenderers/RenderManager.cpp xbmc_huceke/xbmc/cores/VideoRenderers/RenderManager.cpp
- --- xbmc_orig/xbmc/cores/VideoRenderers/RenderManager.cpp 2013-06-17 16:17:17.000000000 +0200
- +++ xbmc_huceke/xbmc/cores/VideoRenderers/RenderManager.cpp 2013-06-17 16:16:23.000000000 +0200
- @@ -35,7 +35,9 @@
- #include "settings/GUISettings.h"
- #include "settings/AdvancedSettings.h"
- -#if defined(HAS_GL)
- +#if defined(HAVE_LIBCEDAR)
- + #include "OverlayRendererCedar.h"
- +#elif defined(HAS_GL)
- #include "LinuxRendererGL.h"
- #elif HAS_GLES == 2
- #include "LinuxRendererGLES.h"
- @@ -325,7 +327,9 @@
- m_bPauseDrawing = false;
- if (!m_pRenderer)
- {
- -#if defined(HAS_GL)
- +#if defined(HAVE_LIBCEDAR)
- + m_pRenderer = new COverlayRendererCedar();
- +#elif defined(HAS_GL)
- m_pRenderer = new CLinuxRendererGL();
- #elif HAS_GLES == 2
- m_pRenderer = new CLinuxRendererGLES();
- @@ -813,8 +817,18 @@
- || pic.format == RENDER_FMT_YUV420P10
- || pic.format == RENDER_FMT_YUV420P16)
- {
- +#ifdef HAVE_LIBCEDAR
- + m_pRenderer->AddProcessor(pic);
- +#else
- CDVDCodecUtils::CopyPicture(&image, &pic);
- +#endif
- + }
- +#ifdef HAVE_LIBCEDAR
- + else if(pic.format == RENDER_FMT_BYPASS_CEDAR)
- + {
- + m_pRenderer->AddProcessor(pic);
- }
- +#endif
- else if(pic.format == RENDER_FMT_NV12)
- {
- CDVDCodecUtils::CopyNV12Picture(&image, &pic);
- @@ -822,7 +836,11 @@
- else if(pic.format == RENDER_FMT_YUYV422
- || pic.format == RENDER_FMT_UYVY422)
- {
- +#ifdef HAVE_LIBCEDAR
- + m_pRenderer->AddProcessor(pic);
- +#else
- CDVDCodecUtils::CopyYUV422PackedPicture(&image, &pic);
- +#endif
- }
- else if(pic.format == RENDER_FMT_DXVA)
- {
- diff -b -u -r -N '--exclude=.git' xbmc_orig/xbmc/cores/VideoRenderers/RenderManager.h xbmc_huceke/xbmc/cores/VideoRenderers/RenderManager.h
- --- xbmc_orig/xbmc/cores/VideoRenderers/RenderManager.h 2013-06-17 16:17:17.000000000 +0200
- +++ xbmc_huceke/xbmc/cores/VideoRenderers/RenderManager.h 2013-06-17 16:16:23.000000000 +0200
- @@ -22,6 +22,12 @@
- #include <list>
- +#if (defined HAVE_CONFIG_H) && (!defined WIN32)
- + #include "config.h"
- +#elif defined(_WIN32)
- +#include "system.h"
- +#endif
- +
- #include "cores/VideoRenderers/BaseRenderer.h"
- #include "guilib/Geometry.h"
- #include "guilib/Resolution.h"
- @@ -29,6 +35,9 @@
- #include "threads/Thread.h"
- #include "settings/VideoSettings.h"
- #include "OverlayRenderer.h"
- +#if defined(HAVE_LIBCEDAR)
- + #include "OverlayRendererCedar.h"
- +#endif
- class CRenderCapture;
- @@ -43,6 +52,9 @@
- class CLinuxRenderer;
- class CLinuxRendererGL;
- class CLinuxRendererGLES;
- +#if defined(HAVE_LIBCEDAR)
- +class COverlayRenderCedar;
- +#endif
- class CXBMCRenderManager
- {
- @@ -110,7 +122,9 @@
- void UpdateResolution();
- -#ifdef HAS_GL
- +#if defined(HAVE_LIBCEDAR)
- + COverlayRendererCedar *m_pRenderer;
- +#elif HAS_GL
- CLinuxRendererGL *m_pRenderer;
- #elif HAS_GLES == 2
- CLinuxRendererGLES *m_pRenderer;
- diff -b -u -r -N '--exclude=.git' xbmc_orig/xbmc/utils/BitstreamConverter.cpp xbmc_huceke/xbmc/utils/BitstreamConverter.cpp
- --- xbmc_orig/xbmc/utils/BitstreamConverter.cpp 2013-06-17 16:17:18.000000000 +0200
- +++ xbmc_huceke/xbmc/utils/BitstreamConverter.cpp 2013-06-17 16:16:23.000000000 +0200
- @@ -460,7 +460,8 @@
- // valid avcC atom data always starts with the value 1 (version)
- if ( *in_extradata != 1 )
- {
- - if (in_extradata[0] == 0 && in_extradata[1] == 0 && in_extradata[2] == 0 && in_extradata[3] == 1)
- + if ( (in_extradata[0] == 0 && in_extradata[1] == 0 && in_extradata[2] == 0 && in_extradata[3] == 1) ||
- + (in_extradata[0] == 0 && in_extradata[1] == 0 && in_extradata[2] == 1) )
- {
- CLog::Log(LOGINFO, "CBitstreamConverter::Open annexb to bitstream init\n");
- // video content is from x264 or from bytestream h264 (AnnexB format)
- @@ -701,10 +702,16 @@
- uint8_t *CBitstreamConverter::GetExtraData()
- {
- + if(m_convert_bitstream)
- + return m_sps_pps_context.sps_pps_data;
- + else
- return m_extradata;
- }
- int CBitstreamConverter::GetExtraSize()
- {
- + if(m_convert_bitstream)
- + return m_sps_pps_context.size;
- + else
- return m_extrasize;
- }
- diff -b -u -r -N '--exclude=.git' xbmc_orig/xbmc/windowing/egl/EGLNativeTypeCedar.cpp xbmc_huceke/xbmc/windowing/egl/EGLNativeTypeCedar.cpp
- --- xbmc_orig/xbmc/windowing/egl/EGLNativeTypeCedar.cpp 1970-01-01 01:00:00.000000000 +0100
- +++ xbmc_huceke/xbmc/windowing/egl/EGLNativeTypeCedar.cpp 2013-06-17 16:16:23.000000000 +0200
- @@ -0,0 +1,237 @@
- +/*
- + * Copyright (C) 2011-2012 Team XBMC
- + * http://www.xbmc.org
- + *
- + * This Program is free software; you can redistribute it and/or modify
- + * it under the terms of the GNU General Public License as published by
- + * the Free Software Foundation; either version 2, or (at your option)
- + * any later version.
- + *
- + * This Program is distributed in the hope that it will be useful,
- + * but WITHOUT ANY WARRANTY; without even the implied warranty of
- + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- + * GNU General Public License for more details.
- + *
- + * You should have received a copy of the GNU General Public License
- + * along with XBMC; see the file COPYING. If not, see
- + * <http://www.gnu.org/licenses/>.
- + *
- + */
- +#include <EGL/egl.h>
- +#include "EGLNativeTypeCedar.h"
- +#include <stdlib.h>
- +#include <linux/fb.h>
- +#include <sys/ioctl.h>
- +#include "utils/StringUtils.h"
- +#include "guilib/gui3d.h"
- +
- +CEGLNativeTypeCedar::CEGLNativeTypeCedar()
- +{
- +}
- +
- +CEGLNativeTypeCedar::~CEGLNativeTypeCedar()
- +{
- +}
- +
- +bool CEGLNativeTypeCedar::CheckCompatibility()
- +{
- + int tmpfd = open("/dev/cedar_dev", O_RDONLY);
- +
- + if(tmpfd >= 0)
- + {
- + close(tmpfd);
- + return true;
- + }
- +
- + return false;
- +}
- +
- +void CEGLNativeTypeCedar::Initialize()
- +{
- + SetCpuMinLimit(true);
- + return;
- +}
- +void CEGLNativeTypeCedar::Destroy()
- +{
- + SetCpuMinLimit(false);
- + return;
- +}
- +
- +bool CEGLNativeTypeCedar::CreateNativeDisplay()
- +{
- + m_nativeDisplay = EGL_DEFAULT_DISPLAY;
- + return true;
- +}
- +
- +bool CEGLNativeTypeCedar::CreateNativeWindow()
- +{
- +#if defined(_FBDEV_WINDOW_H_)
- + fbdev_window *nativeWindow = new fbdev_window;
- + if (!nativeWindow)
- + return false;
- +
- + nativeWindow->width = 1280;
- + nativeWindow->height = 720;
- + m_nativeWindow = nativeWindow;
- + return true;
- +#else
- + return false;
- +#endif
- +}
- +
- +bool CEGLNativeTypeCedar::GetNativeDisplay(XBNativeDisplayType **nativeDisplay) const
- +{
- + if (!nativeDisplay)
- + return false;
- + *nativeDisplay = (XBNativeDisplayType*) &m_nativeDisplay;
- + return true;
- +}
- +
- +bool CEGLNativeTypeCedar::GetNativeWindow(XBNativeWindowType **nativeWindow) const
- +{
- + if (!nativeWindow)
- + return false;
- + *nativeWindow = (XBNativeWindowType*) &m_nativeWindow;
- + return true;
- +}
- +
- +bool CEGLNativeTypeCedar::DestroyNativeDisplay()
- +{
- + return true;
- +}
- +
- +bool CEGLNativeTypeCedar::DestroyNativeWindow()
- +{
- + free(m_nativeWindow);
- + return true;
- +}
- +
- +bool CEGLNativeTypeCedar::GetNativeResolution(RESOLUTION_INFO *res) const
- +{
- + res->iWidth = 1280;
- + res->iHeight = 720;
- + res->fRefreshRate = 60;
- + res->dwFlags= D3DPRESENTFLAG_PROGRESSIVE;
- + res->iScreen = 0;
- + res->bFullScreen = true;
- + res->iSubtitles = (int)(0.965 * res->iHeight);
- + res->fPixelRatio = 1.0f;
- + res->iScreenWidth = res->iWidth;
- + res->iScreenHeight = res->iHeight;
- + res->strMode.Format("%dx%d @ %.2f%s - Full Screen", res->iScreenWidth, res->iScreenHeight, res->fRefreshRate,
- + res->dwFlags & D3DPRESENTFLAG_INTERLACED ? "i" : "");
- + return true;
- +}
- +
- +bool CEGLNativeTypeCedar::SetNativeResolution(const RESOLUTION_INFO &res)
- +{
- + return false;
- +}
- +
- +bool CEGLNativeTypeCedar::ProbeResolutions(std::vector<RESOLUTION_INFO> &resolutions)
- +{
- + RESOLUTION_INFO res;
- +
- + res.iWidth = 1280;
- + res.iHeight = 720;
- + res.fRefreshRate = 60;
- + res.dwFlags= D3DPRESENTFLAG_PROGRESSIVE;
- + res.iScreen = 0;
- + res.bFullScreen = true;
- + res.iSubtitles = (int)(0.965 * res.iHeight);
- + res.fPixelRatio = 1.0f;
- + res.iScreenWidth = res.iWidth;
- + res.iScreenHeight = res.iHeight;
- + res.strMode.Format("%dx%d @ %.2f%s - Full Screen", res.iScreenWidth, res.iScreenHeight, res.fRefreshRate,
- + res.dwFlags & D3DPRESENTFLAG_INTERLACED ? "i" : "");
- +
- + resolutions.push_back(res);
- +
- + return resolutions.size() > 0;
- +}
- +
- +bool CEGLNativeTypeCedar::GetPreferredResolution(RESOLUTION_INFO *res) const
- +{
- + return false;
- +}
- +
- +bool CEGLNativeTypeCedar::ShowWindow(bool show)
- +{
- + return false;
- +}
- +
- +int CEGLNativeTypeCedar::get_sysfs_str(const char *path, char *valstr, const int size) const
- +{
- + int fd = open(path, O_RDONLY);
- + if (fd >= 0)
- + {
- + int len = read(fd, valstr, size - 1);
- + if (len != -1 )
- + valstr[len] = '\0';
- + close(fd);
- + }
- + else
- + {
- + sprintf(valstr, "%s", "fail");
- + return -1;
- + }
- + return 0;
- +}
- +
- +int CEGLNativeTypeCedar::set_sysfs_str(const char *path, const char *val) const
- +{
- + int fd = open(path, O_CREAT | O_RDWR | O_TRUNC, 0644);
- + if (fd >= 0)
- + {
- + write(fd, val, strlen(val));
- + close(fd);
- + return 0;
- + }
- + return -1;
- +}
- +
- +int CEGLNativeTypeCedar::set_sysfs_int(const char *path, const int val) const
- +{
- + char bcmd[16];
- + int fd = open(path, O_CREAT | O_RDWR | O_TRUNC, 0644);
- + if (fd >= 0)
- + {
- + sprintf(bcmd, "%d", val);
- + write(fd, bcmd, strlen(bcmd));
- + close(fd);
- + return 0;
- + }
- + return -1;
- +}
- +
- +int CEGLNativeTypeCedar::get_sysfs_int(const char *path) const
- +{
- + int val = 0;
- + char bcmd[16];
- + int fd = open(path, O_RDONLY);
- + if (fd >= 0)
- + {
- + memset(bcmd, 0, 16);
- + read(fd, bcmd, sizeof(bcmd));
- + val = strtol(bcmd, NULL, 0);
- + close(fd);
- + }
- + return val;
- +}
- +
- +void CEGLNativeTypeCedar::SetCpuMinLimit(bool limit)
- +{
- + // set performance governor, ondemand is optimized for powersave, not our needs
- + char scaling_governor[256] = {0};
- +
- + if(limit)
- + {
- + get_sysfs_str("/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor", scaling_governor, 255);
- + set_sysfs_str("/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor", "performance");
- + m_scaling_governor = scaling_governor;
- + }
- + else
- + {
- + set_sysfs_str("/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor", m_scaling_governor.c_str());
- + }
- +}
- diff -b -u -r -N '--exclude=.git' xbmc_orig/xbmc/windowing/egl/EGLNativeTypeCedar.h xbmc_huceke/xbmc/windowing/egl/EGLNativeTypeCedar.h
- --- xbmc_orig/xbmc/windowing/egl/EGLNativeTypeCedar.h 1970-01-01 01:00:00.000000000 +0100
- +++ xbmc_huceke/xbmc/windowing/egl/EGLNativeTypeCedar.h 2013-06-17 16:16:23.000000000 +0200
- @@ -0,0 +1,59 @@
- +#pragma once
- +
- +/*
- + * Copyright (C) 2011-2012 Team XBMC
- + * http://www.xbmc.org
- + *
- + * This Program is free software; you can redistribute it and/or modify
- + * it under the terms of the GNU General Public License as published by
- + * the Free Software Foundation; either version 2, or (at your option)
- + * any later version.
- + *
- + * This Program is distributed in the hope that it will be useful,
- + * but WITHOUT ANY WARRANTY; without even the implied warranty of
- + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- + * GNU General Public License for more details.
- + *
- + * You should have received a copy of the GNU General Public License
- + * along with XBMC; see the file COPYING. If not, see
- + * <http://www.gnu.org/licenses/>.
- + *
- + */
- +
- +#include "EGLNativeType.h"
- +class CEGLNativeTypeCedar : public CEGLNativeType
- +{
- +public:
- + CEGLNativeTypeCedar();
- + virtual ~CEGLNativeTypeCedar();
- + virtual std::string GetNativeName() const { return "cedar"; };
- + virtual bool CheckCompatibility();
- + virtual void Initialize();
- + virtual void Destroy();
- + virtual int GetQuirks() { return EGL_QUIRK_NONE; };
- +
- + virtual bool CreateNativeDisplay();
- + virtual bool CreateNativeWindow();
- + virtual bool GetNativeDisplay(XBNativeDisplayType **nativeDisplay) const;
- + virtual bool GetNativeWindow(XBNativeWindowType **nativeWindow) const;
- +
- + virtual bool DestroyNativeWindow();
- + virtual bool DestroyNativeDisplay();
- +
- + virtual bool GetNativeResolution(RESOLUTION_INFO *res) const;
- + virtual bool SetNativeResolution(const RESOLUTION_INFO &res);
- + virtual bool ProbeResolutions(std::vector<RESOLUTION_INFO> &resolutions);
- + virtual bool GetPreferredResolution(RESOLUTION_INFO *res) const;
- +
- + virtual bool ShowWindow(bool show);
- +
- +protected:
- + int get_sysfs_str(const char *path, char *valstr, const int size) const;
- + int set_sysfs_str(const char *path, const char *val) const;
- + int set_sysfs_int(const char *path, const int val) const;
- + int get_sysfs_int(const char *path) const;
- +
- + void SetCpuMinLimit(bool limit);
- +
- + std::string m_scaling_governor;
- +};
- diff -b -u -r -N '--exclude=.git' xbmc_orig/xbmc/windowing/egl/EGLNativeTypeGeneric.cpp xbmc_huceke/xbmc/windowing/egl/EGLNativeTypeGeneric.cpp
- --- xbmc_orig/xbmc/windowing/egl/EGLNativeTypeGeneric.cpp 1970-01-01 01:00:00.000000000 +0100
- +++ xbmc_huceke/xbmc/windowing/egl/EGLNativeTypeGeneric.cpp 2013-06-17 16:16:23.000000000 +0200
- @@ -0,0 +1,151 @@
- +/*
- + * Copyright (C) 2011-2012 Team XBMC
- + * http://www.xbmc.org
- + *
- + * This Program is free software; you can redistribute it and/or modify
- + * it under the terms of the GNU General Public License as published by
- + * the Free Software Foundation; either version 2, or (at your option)
- + * any later version.
- + *
- + * This Program is distributed in the hope that it will be useful,
- + * but WITHOUT ANY WARRANTY; without even the implied warranty of
- + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- + * GNU General Public License for more details.
- + *
- + * You should have received a copy of the GNU General Public License
- + * along with XBMC; see the file COPYING. If not, see
- + * <http://www.gnu.org/licenses/>.
- + *
- + */
- +#include <EGL/egl.h>
- +#include "EGLNativeTypeGeneric.h"
- +#include <stdlib.h>
- +#include <linux/fb.h>
- +#include <sys/ioctl.h>
- +#include "utils/StringUtils.h"
- +#include "guilib/gui3d.h"
- +
- +CEGLNativeTypeGeneric::CEGLNativeTypeGeneric()
- +{
- +}
- +
- +CEGLNativeTypeGeneric::~CEGLNativeTypeGeneric()
- +{
- +}
- +
- +bool CEGLNativeTypeGeneric::CheckCompatibility()
- +{
- + return true;
- +}
- +
- +void CEGLNativeTypeGeneric::Initialize()
- +{
- + return;
- +}
- +void CEGLNativeTypeGeneric::Destroy()
- +{
- + return;
- +}
- +
- +bool CEGLNativeTypeGeneric::CreateNativeDisplay()
- +{
- + m_nativeDisplay = EGL_DEFAULT_DISPLAY;
- + return true;
- +}
- +
- +bool CEGLNativeTypeGeneric::CreateNativeWindow()
- +{
- +#if defined(_FBDEV_WINDOW_H_)
- + fbdev_window *nativeWindow = new fbdev_window;
- + if (!nativeWindow)
- + return false;
- +
- + nativeWindow->width = 1280;
- + nativeWindow->height = 720;
- + m_nativeWindow = nativeWindow;
- + return true;
- +#else
- + return false;
- +#endif
- +}
- +
- +bool CEGLNativeTypeGeneric::GetNativeDisplay(XBNativeDisplayType **nativeDisplay) const
- +{
- + if (!nativeDisplay)
- + return false;
- + *nativeDisplay = (XBNativeDisplayType*) &m_nativeDisplay;
- + return true;
- +}
- +
- +bool CEGLNativeTypeGeneric::GetNativeWindow(XBNativeWindowType **nativeWindow) const
- +{
- + if (!nativeWindow)
- + return false;
- + *nativeWindow = (XBNativeWindowType*) &m_nativeWindow;
- + return true;
- +}
- +
- +bool CEGLNativeTypeGeneric::DestroyNativeDisplay()
- +{
- + return true;
- +}
- +
- +bool CEGLNativeTypeGeneric::DestroyNativeWindow()
- +{
- + free(m_nativeWindow);
- + return true;
- +}
- +
- +bool CEGLNativeTypeGeneric::GetNativeResolution(RESOLUTION_INFO *res) const
- +{
- + res->iWidth = 1280;
- + res->iHeight = 720;
- + res->fRefreshRate = 60;
- + res->dwFlags= D3DPRESENTFLAG_PROGRESSIVE;
- + res->iScreen = 0;
- + res->bFullScreen = true;
- + res->iSubtitles = (int)(0.965 * res->iHeight);
- + res->fPixelRatio = 1.0f;
- + res->iScreenWidth = res->iWidth;
- + res->iScreenHeight = res->iHeight;
- + res->strMode.Format("%dx%d @ %.2f%s - Full Screen", res->iScreenWidth, res->iScreenHeight, res->fRefreshRate,
- + res->dwFlags & D3DPRESENTFLAG_INTERLACED ? "i" : "");
- + return true;
- +}
- +
- +bool CEGLNativeTypeGeneric::SetNativeResolution(const RESOLUTION_INFO &res)
- +{
- + return false;
- +}
- +
- +bool CEGLNativeTypeGeneric::ProbeResolutions(std::vector<RESOLUTION_INFO> &resolutions)
- +{
- + RESOLUTION_INFO res;
- +
- + res.iWidth = 1280;
- + res.iHeight = 720;
- + res.fRefreshRate = 60;
- + res.dwFlags= D3DPRESENTFLAG_PROGRESSIVE;
- + res.iScreen = 0;
- + res.bFullScreen = true;
- + res.iSubtitles = (int)(0.965 * res.iHeight);
- + res.fPixelRatio = 1.0f;
- + res.iScreenWidth = res.iWidth;
- + res.iScreenHeight = res.iHeight;
- + res.strMode.Format("%dx%d @ %.2f%s - Full Screen", res.iScreenWidth, res.iScreenHeight, res.fRefreshRate,
- + res.dwFlags & D3DPRESENTFLAG_INTERLACED ? "i" : "");
- +
- + resolutions.push_back(res);
- +
- + return resolutions.size() > 0;
- +}
- +
- +bool CEGLNativeTypeGeneric::GetPreferredResolution(RESOLUTION_INFO *res) const
- +{
- + return false;
- +}
- +
- +bool CEGLNativeTypeGeneric::ShowWindow(bool show)
- +{
- + return false;
- +}
- diff -b -u -r -N '--exclude=.git' xbmc_orig/xbmc/windowing/egl/EGLNativeTypeGeneric.h xbmc_huceke/xbmc/windowing/egl/EGLNativeTypeGeneric.h
- --- xbmc_orig/xbmc/windowing/egl/EGLNativeTypeGeneric.h 1970-01-01 01:00:00.000000000 +0100
- +++ xbmc_huceke/xbmc/windowing/egl/EGLNativeTypeGeneric.h 2013-06-17 16:16:23.000000000 +0200
- @@ -0,0 +1,51 @@
- +#pragma once
- +
- +/*
- + * Copyright (C) 2011-2012 Team XBMC
- + * http://www.xbmc.org
- + *
- + * This Program is free software; you can redistribute it and/or modify
- + * it under the terms of the GNU General Public License as published by
- + * the Free Software Foundation; either version 2, or (at your option)
- + * any later version.
- + *
- + * This Program is distributed in the hope that it will be useful,
- + * but WITHOUT ANY WARRANTY; without even the implied warranty of
- + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- + * GNU General Public License for more details.
- + *
- + * You should have received a copy of the GNU General Public License
- + * along with XBMC; see the file COPYING. If not, see
- + * <http://www.gnu.org/licenses/>.
- + *
- + */
- +
- +#include "EGLNativeType.h"
- +class CEGLNativeTypeGeneric : public CEGLNativeType
- +{
- +public:
- + CEGLNativeTypeGeneric();
- + virtual ~CEGLNativeTypeGeneric();
- + virtual std::string GetNativeName() const { return "generic"; };
- + virtual bool CheckCompatibility();
- + virtual void Initialize();
- + virtual void Destroy();
- + virtual int GetQuirks() { return EGL_QUIRK_NONE; };
- +
- + virtual bool CreateNativeDisplay();
- + virtual bool CreateNativeWindow();
- + virtual bool GetNativeDisplay(XBNativeDisplayType **nativeDisplay) const;
- + virtual bool GetNativeWindow(XBNativeWindowType **nativeWindow) const;
- +
- + virtual bool DestroyNativeWindow();
- + virtual bool DestroyNativeDisplay();
- +
- + virtual bool GetNativeResolution(RESOLUTION_INFO *res) const;
- + virtual bool SetNativeResolution(const RESOLUTION_INFO &res);
- + virtual bool ProbeResolutions(std::vector<RESOLUTION_INFO> &resolutions);
- + virtual bool GetPreferredResolution(RESOLUTION_INFO *res) const;
- +
- + virtual bool ShowWindow(bool show);
- +
- +protected:
- +};
- diff -b -u -r -N '--exclude=.git' xbmc_orig/xbmc/windowing/egl/EGLWrapper.cpp xbmc_huceke/xbmc/windowing/egl/EGLWrapper.cpp
- --- xbmc_orig/xbmc/windowing/egl/EGLWrapper.cpp 2013-06-17 16:17:18.000000000 +0200
- +++ xbmc_huceke/xbmc/windowing/egl/EGLWrapper.cpp 2013-06-17 16:16:23.000000000 +0200
- @@ -25,6 +25,7 @@
- #include "utils/log.h"
- #include "EGLNativeTypeAndroid.h"
- #include "EGLNativeTypeAmlogic.h"
- +#include "EGLNativeTypeCedar.h"
- #include "EGLNativeTypeRaspberryPI.h"
- #include "EGLWrapper.h"
- @@ -77,6 +78,20 @@
- if (nativeGuess->CheckCompatibility())
- {
- if(implementation == nativeGuess->GetNativeName() || implementation == "auto")
- + {
- + m_nativeTypes = nativeGuess;
- + ret = true;
- + }
- + }
- + }
- +
- + if (!ret)
- + {
- + delete nativeGuess;
- + nativeGuess = new CEGLNativeTypeCedar;
- + if (nativeGuess->CheckCompatibility())
- + {
- + if(implementation == nativeGuess->GetNativeName() || implementation == "auto")
- {
- m_nativeTypes = nativeGuess;
- ret = true;
- diff -b -u -r -N '--exclude=.git' xbmc_orig/xbmc/windowing/egl/Makefile xbmc_huceke/xbmc/windowing/egl/Makefile
- --- xbmc_orig/xbmc/windowing/egl/Makefile 2013-06-12 16:21:09.000000000 +0200
- +++ xbmc_huceke/xbmc/windowing/egl/Makefile 2013-06-17 16:16:23.000000000 +0200
- @@ -3,6 +3,7 @@
- SRCS = WinSystemEGL.cpp
- SRCS+= EGLNativeTypeAmlogic.cpp
- SRCS+= EGLNativeTypeAndroid.cpp
- +SRCS+= EGLNativeTypeCedar.cpp
- SRCS+= EGLNativeTypeRaspberryPI.cpp
- SRCS+= EGLWrapper.cpp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement