diff --git a/config/functions b/config/functions index 6c687ecc59..1532100303 100644 --- a/config/functions +++ b/config/functions @@ -328,7 +328,7 @@ show_config() { config_message="$config_message\n - XBMC Airtunes support:\t\t $AIRTUNES_SUPPORT" config_message="$config_message\n - XBMC AFP support:\t\t\t $AFP_SUPPORT" config_message="$config_message\n - XBMC NFS support:\t\t\t $NFS_SUPPORT" - config_message="$config_message\n - XBMC SAMBA client support:\t\t $SAMBA_CLIENT" + config_message="$config_message\n - XBMC SAMBA client support:\t\t $SAMBA_SUPPORT" config_message="$config_message\n - XBMC Webserver support:\t\t $WEBSERVER" # OS configuration diff --git a/config/path b/config/path index 9b6c22fe11..ef991cc402 100644 --- a/config/path +++ b/config/path @@ -32,6 +32,10 @@ TARGET_PREFIX=$ROOT/$TOOLCHAIN/bin/$TARGET_NAME- FAKEROOT_SCRIPT=$ROOT/.fakeroot.$PROJECT.$TARGET_ARCH +if [ -z "$INSTALL" ]; then + INSTALL=$BUILD/image/system +fi + . config/sources MAKE="$ROOT/$TOOLCHAIN/bin/make" @@ -56,14 +60,14 @@ SED="sed -i" if [ -n "$1" ]; then FOUND=0 - for DIR in `find $PACKAGES -type d -name $1 ! -wholename \*\/source\/\* 2>/dev/null` ; do + for DIR in $ROOT/`find $PACKAGES -type d -name $(echo $1| awk -F : '{print $1}') ! -wholename \*\/source\/\* 2>/dev/null` ; do # keep track of dirs with meta for debugging if [ -z "$ALL_DIRS" ] ; then ALL_DIRS="$DIR" else ALL_DIRS="$ALL_DIRS\\n$DIR" fi - if [ -f "$DIR/meta" -o -f "$DIR/install" -o -f "$DIR/build" ] ; then + if [ -f "$DIR/package.mk" -o -f "$DIR/meta" -o -f "$DIR/install" -o -f "$DIR/build" ] ; then FOUND=$((FOUND+1)) # found first. set $PKG_DIR PKG_DIR="$DIR" @@ -77,13 +81,27 @@ SED="sed -i" done fi - [ -r $PKG_DIR/meta ] && . $PKG_DIR/meta + if [ -r $PKG_DIR/package.mk ]; then + . $PKG_DIR/package.mk + elif [ -r $PKG_DIR/meta ]; then + . $PKG_DIR/meta + fi + if [ "$PKG_IS_ADDON" = "yes" ] ; then [ -z $PKG_SECTION ] && PKG_ADDON_ID="$PKG_NAME" || PKG_ADDON_ID="`echo $PKG_SECTION | sed 's,/,.,g'`.$PKG_NAME" fi - [ -d $BUILD/${PKG_NAME}[-_.]${PKG_VERSION} ] && PKG_BUILD=`ls -d $BUILD/${PKG_NAME}[-_.]${PKG_VERSION}` - [ -d $BUILD/${PKG_NAME}${PKG_VERSION} ] && PKG_BUILD=`ls -d $BUILD/${PKG_NAME}${PKG_VERSION}` + if [ -d "$BUILD/${PKG_NAME}-${PKG_VERSION}" ]; then + PKG_BUILD="$BUILD/${PKG_NAME}-${PKG_VERSION}" + elif [ -d "$BUILD/${PKG_NAME}_${PKG_VERSION}" ]; then + PKG_BUILD="$BUILD/${PKG_NAME}_${PKG_VERSION}" + elif [ -d "$BUILD/${PKG_NAME}.${PKG_VERSION}" ]; then + PKG_BUILD="$BUILD/${PKG_NAME}.${PKG_VERSION}" + elif [ -d "$BUILD/${PKG_NAME}${PKG_VERSION}" ]; then + PKG_BUILD="$BUILD/${PKG_NAME}${PKG_VERSION}" + elif [ -d "$BUILD/${PKG_NAME}" ]; then + PKG_BUILD="$BUILD/${PKG_NAME}" + fi XORG_PATH_DRI=/usr/lib/dri XORG_PATH_XKB=/usr/share/X11/xkb @@ -161,3 +179,6 @@ else exec 4>/dev/null fi BUILD_INDENT_SIZE=4 + +# multilib? nah +unset CONFIG_SITE diff --git a/packages/addons/driver/hdhomerun/changelog.txt b/packages/addons/driver/hdhomerun/changelog.txt index c943d655a5..badeaa5eda 100644 --- a/packages/addons/driver/hdhomerun/changelog.txt +++ b/packages/addons/driver/hdhomerun/changelog.txt @@ -1,3 +1,7 @@ +3.1.4 + get tuner id from /var/log/messages +3.1.3 + fixed parsing dvbhdhomerun.log file with timestamp 3.1.2 new addon settings option to enable suspend/resume driver actions new addon settings option to enable logging diff --git a/packages/addons/driver/hdhomerun/meta b/packages/addons/driver/hdhomerun/meta index a88e62bd81..4c62f59453 100644 --- a/packages/addons/driver/hdhomerun/meta +++ b/packages/addons/driver/hdhomerun/meta @@ -20,7 +20,7 @@ PKG_NAME="hdhomerun" PKG_VERSION="3.2" -PKG_REV="2" +PKG_REV="4" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.silicondust.com/products/hdhomerun/dvbt/" diff --git a/packages/addons/driver/hdhomerun/source/resources/lib/functions.py b/packages/addons/driver/hdhomerun/source/resources/lib/functions.py index 421a3d108d..5681920097 100644 --- a/packages/addons/driver/hdhomerun/source/resources/lib/functions.py +++ b/packages/addons/driver/hdhomerun/source/resources/lib/functions.py @@ -20,6 +20,8 @@ import os import sys +import re +import subprocess import shutil import xmlpp from xml.dom import minidom @@ -47,22 +49,22 @@ def settings_restore(settings_xml): def get_devices_hdhomerun(hdhomerun_log): tuners = [] try: - for line in open(hdhomerun_log, 'r'): + for line in open('/var/log/messages', 'r'): + if line.find('HDHomeRun'): line = line.strip() - if line.startswith('Registered tuner'): - name = line.split(':'); - name = name[2].strip() + #Jul 17 19:22:46 user user.info kernel: [ 10.587811] HDHomeRun HDHomeRun.0: DVB: registering adapter 0 frontend 0 (HDHomeRun DVB-C 12345678-0)... + match = re.search(r'.*\[.+\] HDHomeRun .+ registering adapter .+ \(HDHomeRun .+ (.+)\).+', line) + if match: + name = match.group(1) tuners.append(name) except IOError: - print 'Error reading hdhomerun log file', hdhomerun_log + print 'Error reading hdhomerun log file /var/log/messages' return tuners """ -root ~ # grep "Registered tuner" /var/log/dvbhdhomerun.log -Registered tuner, id from kernel: 0 name: 101ADD2B-0 -Registered tuner, id from kernel: 1 name: 101ADD2B-1 -Registered tuner, id from kernel: 2 name: 1031D75A-0 -Registered tuner, id from kernel: 3 name: 1031D75A-1 +root ~ # grep HDHomeRun /var/log/messages +Jul 17 19:22:46 user user.info kernel: [ 10.587811] HDHomeRun HDHomeRun.0: DVB: registering adapter 0 frontend 0 (HDHomeRun DVB-C 12345678-0)... +Jul 17 19:22:46 user user.info kernel: [ 10.588602] HDHomeRun HDHomeRun.1: DVB: registering adapter 1 frontend 0 (HDHomeRun DVB-C 12345678-1)... """ ###################################################################################################### diff --git a/packages/audio/alsa-lib/build b/packages/audio/alsa-lib/build deleted file mode 100755 index f28bb575af..0000000000 --- a/packages/audio/alsa-lib/build +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -# alsa-lib fails building with LTO support - strip_lto - -#CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=32 -fPIC -DPIC" -CFLAGS="$CFLAGS -fPIC -DPIC" - -cd $PKG_BUILD - -./configure --host=$TARGET_NAME \ - --build=$HOST_NAME \ - --prefix=/usr \ - --sysconfdir=/etc \ - --with-plugindir=/usr/lib/alsa \ - --localstatedir=/var \ - --disable-static \ - --enable-shared \ - --disable-python \ - --disable-dependency-tracking \ - -sed -i 's/.*PKGLIBDIR.*/#define PKGLIBDIR ""/' include/config.h - -$MAKE - -$MAKE -C include DESTDIR=$SYSROOT_PREFIX install-data -$MAKE -C src DESTDIR=$SYSROOT_PREFIX install-exec -$MAKE -C utils DESTDIR=$SYSROOT_PREFIX install-pkgconfigDATA - -mkdir -p $SYSROOT_PREFIX/usr/share/aclocal - cp utils/alsa.m4 $SYSROOT_PREFIX/usr/share/aclocal - diff --git a/packages/audio/alsa-lib/install b/packages/audio/alsa-lib/install deleted file mode 100755 index bcf9a5f1c5..0000000000 --- a/packages/audio/alsa-lib/install +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -add_group audio 63 - -mkdir -p $INSTALL/usr/lib - cp -PR $PKG_BUILD/src/.libs/libasound.so* $INSTALL/usr/lib - -mkdir -p $INSTALL/usr/lib/alsa - cp -PR $PKG_BUILD/modules/mixer/simple/.libs/*.so $INSTALL/usr/lib/alsa - -mkdir -p $INSTALL/usr/share/alsa -# sed 's%~/\.asoundrc%/storage/\.config/asound.conf%' \ -# $PKG_BUILD/src/conf/alsa.conf > $INSTALL/usr/share/alsa/alsa.conf - cp -P $PKG_BUILD/src/conf/alsa.conf $INSTALL/usr/share/alsa - cp -P $PKG_BUILD/src/conf/smixer.conf $INSTALL/usr/share/alsa - cp -P $PKG_BUILD/src/conf/*.alisp $INSTALL/usr/share/alsa - cp -PR $PKG_BUILD/src/conf/cards $INSTALL/usr/share/alsa/ - cp -PR $PKG_BUILD/src/conf/pcm $INSTALL/usr/share/alsa/ - rm -f $INSTALL/usr/share/alsa/cards/Makefile* - rm -f $INSTALL/usr/share/alsa/pcm/Makefile* diff --git a/packages/audio/alsa-plugins/build b/packages/audio/alsa-plugins/build deleted file mode 100755 index bf72192b16..0000000000 --- a/packages/audio/alsa-plugins/build +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -if [ "$PULSEAUDIO_SUPPORT" = yes ]; then - ALSA_PULSEAUDIO="--enable-pulseaudio" -else - ALSA_PULSEAUDIO="--disable-pulseaudio" -fi - -cd $PKG_BUILD - -./configure --host=$TARGET_NAME \ - --build=$HOST_NAME \ - --prefix=/usr \ - --sysconfdir=/etc \ - --with-plugindir=/usr/lib/alsa \ - --localstatedir=/var \ - --disable-static \ - --enable-shared \ - --disable-jack \ - --enable-samplerate \ - --disable-avcodec \ - $ALSA_PULSEAUDIO \ - --with-speex=lib \ - -$MAKE diff --git a/packages/audio/alsa-utils/build b/packages/audio/alsa-utils/build deleted file mode 100755 index d4199011f4..0000000000 --- a/packages/audio/alsa-utils/build +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -cd $PKG_BUILD -./configure --host=$TARGET_NAME \ - --build=$HOST_NAME \ - --prefix=/usr \ - --sysconfdir=/etc \ - --localstatedir=/var \ - --disable-dependency-tracking \ - --disable-xmlto \ - --disable-alsamixer \ - --enable-alsatest \ - --disable-nls - -make -C amixer -make -C alsactl -make -C aplay -make -C iecset -make -C speaker-test diff --git a/packages/audio/alsa/config/alsa-base.conf b/packages/audio/alsa/alsa-lib/config/alsa-base.conf similarity index 100% rename from packages/audio/alsa/config/alsa-base.conf rename to packages/audio/alsa/alsa-lib/config/alsa-base.conf diff --git a/packages/audio/alsa/config/modprobe.d/disable-spdif-for-hd-audio.conf b/packages/audio/alsa/alsa-lib/config/modprobe.d/disable-spdif-for-hd-audio.conf similarity index 100% rename from packages/audio/alsa/config/modprobe.d/disable-spdif-for-hd-audio.conf rename to packages/audio/alsa/alsa-lib/config/modprobe.d/disable-spdif-for-hd-audio.conf diff --git a/packages/audio/alsa-lib/meta b/packages/audio/alsa/alsa-lib/package.mk similarity index 67% rename from packages/audio/alsa-lib/meta rename to packages/audio/alsa/alsa-lib/package.mk index 250e3ef235..cbee8a4887 100644 --- a/packages/audio/alsa-lib/meta +++ b/packages/audio/alsa/alsa-lib/package.mk @@ -25,12 +25,45 @@ PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.alsa-project.org/" PKG_URL="ftp://ftp.alsa-project.org/pub/lib/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS="" -PKG_BUILD_DEPENDS="toolchain" +PKG_DEPENDS="alsa-utils" +PKG_BUILD_DEPENDS_TARGET="toolchain" PKG_PRIORITY="optional" PKG_SECTION="audio" PKG_SHORTDESC="alsa-lib: Advanced Linux Sound Architecture library" PKG_LONGDESC="ALSA (Advanced Linux Sound Architecture) is the next generation Linux Sound API. It provides much finer (->better) access to the sound hardware, has a unbeatable mixer API and supports stuff like multi channel hardware, digital outs and ins, uninterleaved sound data access, and an oss emulation layer (for the old applications). It is the prefered API for professional sound apps under Linux." -PKG_IS_ADDON="no" +PKG_IS_ADDON="no" PKG_AUTORECONF="yes" + +if [ "$PULSEAUDIO_SUPPORT" = yes ]; then + PKG_DEPENDS="$PKG_DEPENDS alsa-plugins" +fi + +# package specific configure options +PKG_CONFIGURE_OPTS_TARGET="--with-plugindir=/usr/lib/alsa \ + --disable-python \ + --disable-dependency-tracking" + +pre_configure_target() { + CFLAGS="$CFLAGS -fPIC -DPIC" + + # alsa-lib fails building with LTO support + strip_lto +} + +post_configure_target() { + sed -i 's/.*PKGLIBDIR.*/#define PKGLIBDIR ""/' include/config.h +} + +post_makeinstall_target() { + rm -rf $INSTALL/usr/bin + + mkdir -p $INSTALL/etc/modprobe.d + cp -PR $PKG_DIR/config/alsa-base.conf $INSTALL/etc/modprobe.d + mkdir -p $INSTALL/usr/config + cp -PR $PKG_DIR/config/modprobe.d $INSTALL/usr/config +} + +post_install_target() { + add_group audio 63 +} diff --git a/packages/audio/alsa-lib/patches/alsa-lib-asound.conf_configdir.patch b/packages/audio/alsa/alsa-lib/patches/alsa-lib-asound.conf_configdir.patch similarity index 100% rename from packages/audio/alsa-lib/patches/alsa-lib-asound.conf_configdir.patch rename to packages/audio/alsa/alsa-lib/patches/alsa-lib-asound.conf_configdir.patch diff --git a/packages/audio/alsa-plugins/config/samplerate.conf b/packages/audio/alsa/alsa-plugins/config/samplerate.conf similarity index 100% rename from packages/audio/alsa-plugins/config/samplerate.conf rename to packages/audio/alsa/alsa-plugins/config/samplerate.conf diff --git a/packages/audio/alsa-plugins/config/speex.conf b/packages/audio/alsa/alsa-plugins/config/speex.conf similarity index 100% rename from packages/audio/alsa-plugins/config/speex.conf rename to packages/audio/alsa/alsa-plugins/config/speex.conf diff --git a/packages/audio/alsa-plugins/config/upmix.conf b/packages/audio/alsa/alsa-plugins/config/upmix.conf similarity index 100% rename from packages/audio/alsa-plugins/config/upmix.conf rename to packages/audio/alsa/alsa-plugins/config/upmix.conf diff --git a/packages/audio/alsa-plugins/config/vdownmix.conf b/packages/audio/alsa/alsa-plugins/config/vdownmix.conf similarity index 100% rename from packages/audio/alsa-plugins/config/vdownmix.conf rename to packages/audio/alsa/alsa-plugins/config/vdownmix.conf diff --git a/packages/audio/alsa-plugins/meta b/packages/audio/alsa/alsa-plugins/package.mk similarity index 72% rename from packages/audio/alsa-plugins/meta rename to packages/audio/alsa/alsa-plugins/package.mk index cb6ffbd29f..70f38d8b62 100644 --- a/packages/audio/alsa-plugins/meta +++ b/packages/audio/alsa/alsa-plugins/package.mk @@ -25,17 +25,32 @@ PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.alsa-project.org/" PKG_URL="ftp://ftp.alsa-project.org/pub/plugins/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS="alsa-lib speex" -PKG_BUILD_DEPENDS="toolchain alsa-lib speex libsamplerate" +PKG_DEPENDS="speex" +PKG_BUILD_DEPENDS_TARGET="toolchain speex libsamplerate" PKG_PRIORITY="optional" PKG_SECTION="audio" PKG_SHORTDESC="alsa-plugins: Advanced Linux Sound Architecture Plugins" PKG_LONGDESC="ALSA (Advanced Linux Sound Architecture) is the next generation Linux Sound API. It provides much finer (->better) access to the sound hardware, has a unbeatable mixer API and supports stuff like multi channel hardware, digital outs and ins, uninterleaved sound data access, and an oss emulation layer (for the old applications). It is the prefered API for professional sound apps under Linux." -PKG_IS_ADDON="no" +PKG_IS_ADDON="no" PKG_AUTORECONF="yes" +# package specific configure options +PKG_CONFIGURE_OPTS_TARGET="--with-plugindir=/usr/lib/alsa \ + --disable-jack \ + --enable-samplerate \ + --disable-avcodec \ + --with-speex=lib" + if [ "$PULSEAUDIO_SUPPORT" = yes ]; then PKG_DEPENDS="$PKG_DEPENDS pulseaudio" - PKG_BUILD_DEPENDS="$PKG_BUILD_DEPENDS pulseaudio" + PKG_BUILD_DEPENDS_TARGET="$PKG_BUILD_DEPENDS_TARGET pulseaudio" + PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET --enable-pulseaudio" +else + PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET --disable-pulseaudio" fi + +post_makeinstall_target() { + mkdir -p $INSTALL/usr/share/alsa/pcm + cp -R $PKG_DIR/config/*.conf $INSTALL/usr/share/alsa/pcm +} diff --git a/packages/audio/alsa-utils/meta b/packages/audio/alsa/alsa-utils/package.mk similarity index 65% rename from packages/audio/alsa-utils/meta rename to packages/audio/alsa/alsa-utils/package.mk index 0aa67a0ee4..bed0427726 100644 --- a/packages/audio/alsa-utils/meta +++ b/packages/audio/alsa/alsa-utils/package.mk @@ -25,12 +25,35 @@ PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.alsa-project.org/" PKG_URL="ftp://ftp.alsa-project.org/pub/utils/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS="alsa-lib" -PKG_BUILD_DEPENDS="toolchain alsa-lib" +PKG_DEPENDS="" +PKG_BUILD_DEPENDS_TARGET="toolchain" PKG_PRIORITY="optional" PKG_SECTION="audio" PKG_SHORTDESC="alsa-utils: Advanced Linux Sound Architecture utilities" PKG_LONGDESC="This package includes the utilities for ALSA, like alsamixer, aplay, arecord, alsactl, iecset and speaker-test." -PKG_IS_ADDON="no" +PKG_IS_ADDON="no" PKG_AUTORECONF="yes" + +# package specific configure options +PKG_CONFIGURE_OPTS_TARGET="--disable-dependency-tracking \ + --disable-xmlto \ + --disable-alsamixer \ + --disable-alsaconf \ + --disable-alsaloop \ + --enable-alsatest \ + --disable-nls" + + +post_makeinstall_target() { + rm -rf $INSTALL/lib $INSTALL/var + rm -rf $INSTALL/usr/share/alsa/speaker-test + rm -rf $INSTALL/usr/share/sounds + + for i in aconnect alsaucm amidi aplaymidi arecord arecordmidi aseqdump aseqnet iecset; do + rm -rf $INSTALL/usr/bin/$i + done + + mkdir -p $INSTALL/lib/udev + cp $PKG_DIR/scripts/soundconfig $INSTALL/lib/udev +} diff --git a/packages/audio/alsa-utils/scripts/soundconfig b/packages/audio/alsa/alsa-utils/scripts/soundconfig similarity index 100% rename from packages/audio/alsa-utils/scripts/soundconfig rename to packages/audio/alsa/alsa-utils/scripts/soundconfig diff --git a/packages/audio/alsa-utils/udev.d/40-alsa.rules b/packages/audio/alsa/alsa-utils/udev.d/40-alsa.rules similarity index 100% rename from packages/audio/alsa-utils/udev.d/40-alsa.rules rename to packages/audio/alsa/alsa-utils/udev.d/40-alsa.rules diff --git a/packages/audio/alsa/install b/packages/audio/alsa/install deleted file mode 100755 index 861ad5839f..0000000000 --- a/packages/audio/alsa/install +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -mkdir -p $INSTALL/etc/modprobe.d - cp -P $PKG_DIR/config/alsa-base.conf $INSTALL/etc/modprobe.d - -mkdir -p $INSTALL/usr/config - cp -R $PKG_DIR/config/modprobe.d $INSTALL/usr/config diff --git a/packages/audio/alsa/meta b/packages/audio/alsa/meta deleted file mode 100644 index 2d55d61fd7..0000000000 --- a/packages/audio/alsa/meta +++ /dev/null @@ -1,42 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -PKG_NAME="alsa" -PKG_VERSION="" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="GPL" -PKG_SITE="http://www.alsa-project.org/" -PKG_URL="" -PKG_DEPENDS="alsa-lib alsa-utils" -PKG_BUILD_DEPENDS="toolchain" -PKG_PRIORITY="optional" -PKG_SECTION="audio" -PKG_SHORTDESC="alsa: Matapackage to install all alsa components" -PKG_LONGDESC="ALSA (Advanced Linux Sound Architecture) is the next generation Linux Sound API. It provides much finer (->better) access to the sound hardware, has a unbeatable mixer API and supports stuff like multi channel hardware, digital outs and ins, uninterleaved sound data access, and an oss emulation layer (for the old applications). It is the prefered API for professional sound apps under Linux." -PKG_IS_ADDON="no" - -PKG_AUTORECONF="no" - -if [ "$PULSEAUDIO_SUPPORT" = yes ]; then - PKG_DEPENDS="$PKG_DEPENDS alsa-plugins" - PKG_BUILD_DEPENDS="$PKG_BUILD_DEPENDS alsa-plugins" -fi - diff --git a/packages/audio/faad2/install b/packages/audio/faad2/install deleted file mode 100755 index 10b1c6f0f1..0000000000 --- a/packages/audio/faad2/install +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -mkdir -p $INSTALL/usr/lib - cp -P $PKG_BUILD/libfaad/.libs/*.so* $INSTALL/usr/lib diff --git a/packages/audio/faad2/meta b/packages/audio/faad2/package.mk similarity index 84% rename from packages/audio/faad2/meta rename to packages/audio/faad2/package.mk index 787b7bfaa1..d0c4ce86ce 100644 --- a/packages/audio/faad2/meta +++ b/packages/audio/faad2/package.mk @@ -26,11 +26,22 @@ PKG_LICENSE="GPL" PKG_SITE="http://www.audiocoding.com/" PKG_URL="$SOURCEFORGE_SRC/faac/faad2-src/$PKG_NAME-$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS="" -PKG_BUILD_DEPENDS="toolchain" +PKG_BUILD_DEPENDS_TARGET="toolchain" PKG_PRIORITY="optional" PKG_SECTION="audio" PKG_SHORTDESC="faad: An MPEG-4 AAC decoder" PKG_LONGDESC="The FAAD project includes the AAC decoder FAAD2. It supports several MPEG-4 object types (LC, Main, LTP, HE AAC, PS) and file formats (ADTS AAC, raw AAC, MP4), multichannel and gapless decoding as well as MP4 metadata tags. The codecs are compatible with standard-compliant audio applications using one or more of these profiles." -PKG_IS_ADDON="no" +PKG_IS_ADDON="no" PKG_AUTORECONF="yes" + +# package specific configure options +PKG_CONFIGURE_OPTS_TARGET="--without-xmms \ + --without-drm \ + --without-mpeg4ip \ + --with-gnu-ld" + + +post_makeinstall_target() { + rm -rf $INSTALL/usr/bin +} diff --git a/packages/audio/flac/build b/packages/audio/flac/build deleted file mode 100755 index 77d2fc89d6..0000000000 --- a/packages/audio/flac/build +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -cd $PKG_BUILD -./configure --host=$TARGET_NAME \ - --build=$HOST_NAME \ - --prefix=/usr \ - --disable-static \ - --enable-shared \ - --disable-rpath \ - --disable-altivec \ - --disable-doxygen-docs \ - --disable-thorough-tests \ - --disable-cpplibs \ - --disable-xmms-plugin \ - --disable-oggtest \ - --with-ogg="$SYSROOT_PREFIX/usr" \ - --with-gnu-ld - -make -$MAKEINSTALL diff --git a/packages/audio/flac/install b/packages/audio/flac/install deleted file mode 100755 index c33e7b8d4a..0000000000 --- a/packages/audio/flac/install +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -mkdir -p $INSTALL/usr/lib - cp -P $PKG_BUILD/src/libFLAC/.libs/libFLAC.so* $INSTALL/usr/lib diff --git a/packages/audio/flac/meta b/packages/audio/flac/package.mk similarity index 72% rename from packages/audio/flac/meta rename to packages/audio/flac/package.mk index 1d2094fd45..5bc3fc106b 100644 --- a/packages/audio/flac/meta +++ b/packages/audio/flac/package.mk @@ -26,11 +26,31 @@ PKG_LICENSE="LGPL" PKG_SITE="http://flac.sourceforge.net/" PKG_URL="http://downloads.xiph.org/releases/flac/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS="libogg" -PKG_BUILD_DEPENDS="toolchain libogg" +PKG_BUILD_DEPENDS_TARGET="toolchain libogg" PKG_PRIORITY="optional" PKG_SECTION="audio" PKG_SHORTDESC="flac: An Free Lossless Audio Codec" PKG_LONGDESC="Grossly oversimplified, FLAC is similar to MP3, but lossless, meaning that audio is compressed in FLAC without throwing away any information. This is similar to how Zip works, except with FLAC you will get much better compression because it is designed specifically for audio." -PKG_IS_ADDON="no" +PKG_IS_ADDON="no" PKG_AUTORECONF="yes" + +# package specific configure options +PKG_CONFIGURE_OPTS_TARGET="--disable-rpath \ + --disable-altivec \ + --disable-doxygen-docs \ + --disable-thorough-tests \ + --disable-cpplibs \ + --disable-xmms-plugin \ + --disable-oggtest \ + --with-ogg=$SYSROOT_PREFIX/usr \ + --with-gnu-ld" + +pre_make_target() { + # hack + cp -R ../doc/* ./doc +} + +post_makeinstall_target() { + rm -rf $INSTALL/usr/bin +} diff --git a/packages/audio/lame/build b/packages/audio/lame/build deleted file mode 100755 index 330a8491eb..0000000000 --- a/packages/audio/lame/build +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -# dont build parallel - MAKEFLAGS=-j1 - -cd $PKG_BUILD -#ac_cv_c_stack_direction=-1 \ -#alex_cv_ieee854_float80=no \ -GTK_CONFIG='no' \ -./configure --host=$TARGET_NAME \ - --build=$HOST_NAME \ - --prefix=/usr \ - --disable-static \ - --enable-shared \ - --enable-nasm \ - --disable-rpath \ - --disable-cpml \ - --disable-gtktest \ - --disable-efence \ - --disable-analyzer-hooks \ - --enable-decoder \ - --disable-frontend \ - --disable-mp3x \ - --disable-mp3rtp \ - --disable-dynamic-frontends \ - --enable-expopt=no \ - --enable-debug=no \ - --with-gnu-ld \ - --with-fileio=lame - -make -$MAKEINSTALL diff --git a/packages/audio/lame/install b/packages/audio/lame/install deleted file mode 100755 index dcb45b3592..0000000000 --- a/packages/audio/lame/install +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -mkdir -p $INSTALL/usr/lib - cp -P $PKG_BUILD/libmp3lame/.libs/libmp3lame.so* $INSTALL/usr/lib diff --git a/packages/audio/lame/meta b/packages/audio/lame/package.mk similarity index 65% rename from packages/audio/lame/meta rename to packages/audio/lame/package.mk index 5240445410..c800b600b7 100644 --- a/packages/audio/lame/meta +++ b/packages/audio/lame/package.mk @@ -26,11 +26,34 @@ PKG_LICENSE="LGPL" PKG_SITE="http://lame.sourceforge.net/" PKG_URL="$SOURCEFORGE_SRC/lame/lame/3.99/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS="" -PKG_BUILD_DEPENDS="toolchain" +PKG_BUILD_DEPENDS_TARGET="toolchain" PKG_PRIORITY="optional" PKG_SECTION="audio" PKG_SHORTDESC="lame: LAME Ain't an Mp3 Encoder" PKG_LONGDESC="LAME originally stood for LAME Ain't an Mp3 Encoder. The goal of the LAME project is to use the open source model to improve the psycho acoustics, noise shaping and speed of MP3. Another goal of the LAME project is to use these improvements for the basis of a patent free audio compression codec for the GNU project." -PKG_IS_ADDON="no" +PKG_IS_ADDON="no" PKG_AUTORECONF="yes" + +# package specific configure options +PKG_CONFIGURE_OPTS_TARGET="--enable-nasm \ + --disable-rpath \ + --disable-cpml \ + --disable-gtktest \ + --disable-efence \ + --disable-analyzer-hooks \ + --enable-decoder \ + --disable-frontend \ + --disable-mp3x \ + --disable-mp3rtp \ + --disable-dynamic-frontends \ + --enable-expopt=no \ + --enable-debug=no \ + --with-gnu-ld \ + --with-fileio=lame \ + GTK_CONFIG=no" + +post_make_target() { + # dont build parallel + MAKEFLAGS=-j1 +} diff --git a/packages/audio/libcdio/build b/packages/audio/libcdio/build deleted file mode 100755 index 42e246ed53..0000000000 --- a/packages/audio/libcdio/build +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -CFLAGS="$CFLAGS -fPIC -DPIC" - -cd $PKG_BUILD -./configure --host=$TARGET_NAME \ - --build=$HOST_NAME \ - --prefix=/usr \ - --sysconfdir=/etc \ - --enable-cxx \ - --disable-cpp-progs \ - --disable-shared \ - --enable-static \ - --enable-joliet \ - --disable-rpath \ - --enable-rock \ - --disable-cddb \ - --disable-vcd-info \ - --without-cd-drive \ - --without-cd-info \ - --with-cd-paranoia \ - --without-cdda-player \ - --without-cd-read \ - --without-iso-info \ - --without-iso-read \ - --with-gnu-ld - -make -$MAKEINSTALL diff --git a/packages/audio/libcdio/meta b/packages/audio/libcdio/package.mk similarity index 64% rename from packages/audio/libcdio/meta rename to packages/audio/libcdio/package.mk index 4ef3412511..fcbb9dc6c6 100644 --- a/packages/audio/libcdio/meta +++ b/packages/audio/libcdio/package.mk @@ -26,11 +26,38 @@ PKG_LICENSE="GPL" PKG_SITE="http://www.gnu.org/software/libcdio/" PKG_URL="http://ftp.gnu.org/gnu/libcdio/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS="" -PKG_BUILD_DEPENDS="toolchain" +PKG_BUILD_DEPENDS_TARGET="toolchain" PKG_PRIORITY="optional" PKG_SECTION="audio" PKG_SHORTDESC="libcdio: A CD-ROM reading and control library" PKG_LONGDESC="This library is to encapsulate CD-ROM reading and control. Applications wishing to be oblivious of the OS- and device-dependant properties of a CD-ROM can use this library. Some support for disk image types like BIN/CUE and NRG is available, so applications that use this library also have the ability to read disc images as though they were CD's." -PKG_IS_ADDON="no" +PKG_IS_ADDON="no" PKG_AUTORECONF="yes" + +# package specific configure options +PKG_CONFIGURE_OPTS_TARGET="--enable-cxx \ + --disable-cpp-progs \ + --disable-shared \ + --enable-static \ + --enable-joliet \ + --disable-rpath \ + --enable-rock \ + --disable-cddb \ + --disable-vcd-info \ + --without-cd-drive \ + --without-cd-info \ + --with-cd-paranoia \ + --without-cdda-player \ + --without-cd-read \ + --without-iso-info \ + --without-iso-read \ + --with-gnu-ld" + +pre_configure_target() { + CFLAGS="$CFLAGS -fPIC -DPIC" +} + +post_makeinstall_target() { + rm -rf $INSTALL/usr/bin +} diff --git a/packages/audio/libmad/build b/packages/audio/libmad/build deleted file mode 100755 index b880500515..0000000000 --- a/packages/audio/libmad/build +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -cd $PKG_BUILD - -if [ $TARGET_ARCH == "x86_64" ] ; then - MAD_OPTIONS="--enable-accuracy --enable-fpm=64bit" -fi - -# some fixes for autoreconf - touch NEWS AUTHORS ChangeLog - do_autoreconf - -./configure --host=$TARGET_NAME \ - --build=$HOST_NAME \ - --prefix=/usr \ - --disable-static \ - --enable-shared \ - $MAD_OPTIONS - -make - -$MAKEINSTALL - -mkdir -p $SYSROOT_PREFIX/usr/lib/pkgconfig -cat > $SYSROOT_PREFIX/usr/lib/pkgconfig/mad.pc << "EOF" -prefix=/usr -exec_prefix=${prefix} -libdir=${exec_prefix}/lib -includedir=${prefix}/include - -Name: mad -Description: MPEG audio decoder -Requires: -Version: 0.15.1b -Libs: -L${libdir} -lmad -Cflags: -I${includedir} -EOF diff --git a/packages/audio/libmad/install b/packages/audio/libmad/install deleted file mode 100755 index 32163a5b62..0000000000 --- a/packages/audio/libmad/install +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -mkdir -p $INSTALL/usr/lib - cp -P $PKG_BUILD/.libs/*.so* $INSTALL/usr/lib diff --git a/packages/audio/libmad/meta b/packages/audio/libmad/package.mk similarity index 71% rename from packages/audio/libmad/meta rename to packages/audio/libmad/package.mk index 1b2e637b70..97917fa23e 100644 --- a/packages/audio/libmad/meta +++ b/packages/audio/libmad/package.mk @@ -26,11 +26,39 @@ PKG_LICENSE="GPL" PKG_SITE="http://www.mars.org/home/rob/proj/mpeg/" PKG_URL="$SOURCEFORGE_SRC/mad/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS="" -PKG_BUILD_DEPENDS="toolchain" +PKG_BUILD_DEPENDS_TARGET="toolchain" PKG_PRIORITY="optional" PKG_SECTION="audio" PKG_SHORTDESC="libmad: MPEG Audio Decoder" PKG_LONGDESC="MAD is a high-quality MPEG audio decoder. It currently supports MPEG-1 and the MPEG-2 extension to Lower Sampling Frequencies, as well as the so-called MPEG 2.5 format. All three audio layers (Layer I, Layer II, and Layer III a.k.a. MP3) are fully implemented." -PKG_IS_ADDON="no" +PKG_IS_ADDON="no" PKG_AUTORECONF="no" + +# package specific configure options +if [ $TARGET_ARCH == "x86_64" ] ; then + PKG_CONFIGURE_OPTS_TARGET="--enable-accuracy --enable-fpm=64bit" +fi + +pre_configure_target() { + # some fixes for autoreconf + touch ../NEWS ../AUTHORS ../ChangeLog + do_autoreconf ../ +} + +post_makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/pkgconfig + cat > $SYSROOT_PREFIX/usr/lib/pkgconfig/mad.pc << "EOF" +prefix=/usr +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include + +Name: mad +Description: MPEG audio decoder +Requires: +Version: 0.15.1b +Libs: -L${libdir} -lmad +Cflags: -I${includedir} +EOF +} diff --git a/packages/audio/libmodplug/install b/packages/audio/libmodplug/install deleted file mode 100755 index 3ce726b405..0000000000 --- a/packages/audio/libmodplug/install +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -mkdir -p $INSTALL/usr/lib - cp -P $PKG_BUILD/src/.libs/*.so* $INSTALL/usr/lib diff --git a/packages/audio/libmodplug/meta b/packages/audio/libmodplug/package.mk similarity index 98% rename from packages/audio/libmodplug/meta rename to packages/audio/libmodplug/package.mk index 902480b897..d8ef638b07 100644 --- a/packages/audio/libmodplug/meta +++ b/packages/audio/libmodplug/package.mk @@ -26,11 +26,11 @@ PKG_LICENSE="GPL" PKG_SITE="http://modplug-xmms.sourceforge.net/" PKG_URL="$SOURCEFORGE_SRC/modplug-xmms/libmodplug/$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS="" -PKG_BUILD_DEPENDS="toolchain" +PKG_BUILD_DEPENDS_TARGET="toolchain" PKG_PRIORITY="optional" PKG_SECTION="audio" PKG_SHORTDESC="libmodplug: renders mod music files as raw audio data, for playing or conversion." PKG_LONGDESC="libmodplug renders mod music files as raw audio data, for playing or conversion. libmodplug is based on the fast and high quality mod playing code written and released to the public domain by Olivier Lapicque. mod, .s3m, .it, .xm, and a number of lesser-known formats are supported. Optional features include high-quality resampling, bass expansion, surround and reverb." -PKG_IS_ADDON="no" +PKG_IS_ADDON="no" PKG_AUTORECONF="yes" diff --git a/packages/audio/libogg/build b/packages/audio/libogg/build deleted file mode 100755 index 191d480e3c..0000000000 --- a/packages/audio/libogg/build +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -cd $PKG_BUILD -./configure --host=$TARGET_NAME \ - --build=$HOST_NAME \ - --prefix=/usr \ - --sysconfdir=/etc \ - --disable-static \ - --enable-shared \ - -make - -$MAKEINSTALL \ No newline at end of file diff --git a/packages/audio/libogg/install b/packages/audio/libogg/install deleted file mode 100755 index da9ebcfd99..0000000000 --- a/packages/audio/libogg/install +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -mkdir -p $INSTALL/usr/lib - cp -P $PKG_BUILD/src/.libs/libogg*.so* $INSTALL/usr/lib diff --git a/packages/audio/libogg/meta b/packages/audio/libogg/package.mk similarity index 97% rename from packages/audio/libogg/meta rename to packages/audio/libogg/package.mk index e47041f350..52b829304a 100644 --- a/packages/audio/libogg/meta +++ b/packages/audio/libogg/package.mk @@ -26,11 +26,11 @@ PKG_LICENSE="BSD" PKG_SITE="http://www.xiph.org/ogg/" PKG_URL="http://downloads.xiph.org/releases/ogg/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS="" -PKG_BUILD_DEPENDS="toolchain" +PKG_BUILD_DEPENDS_TARGET="toolchain" PKG_PRIORITY="optional" PKG_SECTION="audio" PKG_SHORTDESC="libogg: Open source bitstream container format" PKG_LONGDESC="Libogg contains necessary functionality to create, decode, and work with Ogg bitstreams." -PKG_IS_ADDON="no" +PKG_IS_ADDON="no" PKG_AUTORECONF="yes" diff --git a/packages/audio/libsamplerate/build b/packages/audio/libsamplerate/build deleted file mode 100755 index fd92e549ea..0000000000 --- a/packages/audio/libsamplerate/build +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -cd $PKG_BUILD -./configure --host=$TARGET_NAME \ - --build=$HOST_NAME \ - --prefix=/usr \ - --exec-prefix=/usr \ - --sysconfdir=/etc \ - --disable-shared \ - --enable-static \ - --datadir=/usr/share \ - --disable-fftw \ - --disable-sndfile \ - -make -$MAKEINSTALL \ No newline at end of file diff --git a/packages/audio/libsamplerate/meta b/packages/audio/libsamplerate/package.mk similarity index 81% rename from packages/audio/libsamplerate/meta rename to packages/audio/libsamplerate/package.mk index 37630191b4..90ee3c4ebe 100644 --- a/packages/audio/libsamplerate/meta +++ b/packages/audio/libsamplerate/package.mk @@ -26,11 +26,22 @@ PKG_LICENSE="GPL" PKG_SITE="http://www.mega-nerd.com/SRC/" PKG_URL="http://www.mega-nerd.com/SRC/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS="" -PKG_BUILD_DEPENDS="toolchain" +PKG_BUILD_DEPENDS_TARGET="toolchain" PKG_PRIORITY="optional" PKG_SECTION="audio" PKG_SHORTDESC="libsamplerate: A Sample Rate Converter library for audio" PKG_LONGDESC="Libsamplerate is a Sample Rate Converter for audio. One example of where such a thing would be useful is converting audio from the CD sample rate of 44.1kHz to the 48kHz sample rate used by DAT players." -PKG_IS_ADDON="no" +PKG_IS_ADDON="no" PKG_AUTORECONF="no" # ToDo + +# package specific configure options +PKG_CONFIGURE_OPTS_TARGET="--disable-shared \ + --enable-static \ + --datadir=/usr/share \ + --disable-fftw \ + --disable-sndfile" + +post_makeinstall_target() { + rm -rf $INSTALL/usr/bin +} diff --git a/packages/audio/libsndfile/build b/packages/audio/libsndfile/build deleted file mode 100755 index 7dc02aea38..0000000000 --- a/packages/audio/libsndfile/build +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -cd $PKG_BUILD -./configure --host=$TARGET_NAME \ - --build=$HOST_NAME \ - --prefix=/usr \ - --disable-static \ - --enable-shared \ - --disable-silent-rules \ - --disable-sqlite \ - --enable-alsa \ - --enable-external-libs \ - --disable-experimental \ - --disable-test-coverage \ - --enable-largefile \ - --with-gnu-ld - -make -C src -cp sndfile.pc $SYSROOT_PREFIX/usr/lib/pkgconfig - -$MAKEINSTALL -C src diff --git a/packages/audio/libsndfile/install b/packages/audio/libsndfile/install deleted file mode 100755 index 9a1692eb11..0000000000 --- a/packages/audio/libsndfile/install +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -mkdir -p $INSTALL/usr/lib - cp -P $PKG_BUILD/src/.libs/*.so* $INSTALL/usr/lib diff --git a/packages/audio/libsndfile/meta b/packages/audio/libsndfile/package.mk similarity index 76% rename from packages/audio/libsndfile/meta rename to packages/audio/libsndfile/package.mk index bfb6a489b3..0b488e7e97 100644 --- a/packages/audio/libsndfile/meta +++ b/packages/audio/libsndfile/package.mk @@ -26,11 +26,25 @@ PKG_LICENSE="LGPL" PKG_SITE="http://www.mega-nerd.com/libsndfile/" PKG_URL="http://www.mega-nerd.com/$PKG_NAME/files/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS="alsa-lib flac libvorbis libogg" -PKG_BUILD_DEPENDS="toolchain alsa-lib flac libvorbis libogg" +PKG_BUILD_DEPENDS_TARGET="toolchain alsa-lib flac libvorbis libogg" PKG_PRIORITY="optional" PKG_SECTION="audio" PKG_SHORTDESC="libsndfile: A library for accessing various audio file formats" PKG_LONGDESC="libsndfile is a C library for reading and writing sound files such as AIFF, AU, WAV, and others through one standard interface. It can currently read/write 8, 16, 24 and 32-bit PCM files as well as 32 and 64-bit floating point WAV files and a number of compressed formats. It compiles and runs on *nix, MacOS, and Win32." -PKG_IS_ADDON="no" +PKG_IS_ADDON="no" PKG_AUTORECONF="yes" + +# package specific configure options +PKG_CONFIGURE_OPTS_TARGET="--disable-silent-rules \ + --disable-sqlite \ + --enable-alsa \ + --enable-external-libs \ + --disable-experimental \ + --disable-test-coverage \ + --enable-largefile \ + --with-gnu-ld" + +post_makeinstall_target() { + rm -rf $INSTALL/usr/bin +} diff --git a/packages/audio/libvorbis/build b/packages/audio/libvorbis/build deleted file mode 100755 index db0fc862d8..0000000000 --- a/packages/audio/libvorbis/build +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -cd $PKG_BUILD -./configure --host=$TARGET_NAME \ - --build=$HOST_NAME \ - --prefix=/usr \ - --sysconfdir=/etc \ - --disable-static \ - --enable-shared \ - --with-ogg=$SYSROOT_PREFIX/usr - -make -$MAKEINSTALL diff --git a/packages/audio/libvorbis/install b/packages/audio/libvorbis/install deleted file mode 100755 index b5654c3284..0000000000 --- a/packages/audio/libvorbis/install +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -mkdir -p $INSTALL/usr/lib - cp -P $PKG_BUILD/lib/.libs/libvorbis*.so*[.0-9] $INSTALL/usr/lib diff --git a/packages/audio/libvorbis/meta b/packages/audio/libvorbis/package.mk similarity index 93% rename from packages/audio/libvorbis/meta rename to packages/audio/libvorbis/package.mk index a79234e5d0..750611ac9d 100644 --- a/packages/audio/libvorbis/meta +++ b/packages/audio/libvorbis/package.mk @@ -26,11 +26,14 @@ PKG_LICENSE="BSD" PKG_SITE="http://www.vorbis.com/" PKG_URL="http://downloads.xiph.org/releases/vorbis/$PKG_NAME-$PKG_VERSION.tar.xz" PKG_DEPENDS="libogg" -PKG_BUILD_DEPENDS="toolchain libogg" +PKG_BUILD_DEPENDS_TARGET="toolchain libogg" PKG_PRIORITY="optional" PKG_SECTION="audio" PKG_SHORTDESC="libvorbis: Lossless audio compression tools using the ogg-vorbis algorithms" PKG_LONGDESC="Ogg Vorbis is a fully open, non-proprietary, patent-and-royalty-free, general-purpose compressed audio format for mid to high quality (8kHz-48.0kHz, 16+ bit, polyphonic) audio and music at fixed and variable bitrates from 16 to 128 kbps/channel. This places Vorbis in the same competitive class as audio representations such as MPEG-4 (AAC), and similar to, but higher performance than MPEG-1/2 audio layer 3, MPEG-4 audio (TwinVQ), WMA and PAC." -PKG_IS_ADDON="no" +PKG_IS_ADDON="no" PKG_AUTORECONF="yes" + +# package specific configure options +PKG_CONFIGURE_OPTS_TARGET="--with-ogg=$SYSROOT_PREFIX/usr" diff --git a/packages/audio/pulseaudio/build b/packages/audio/pulseaudio/build deleted file mode 100755 index baf5c314cb..0000000000 --- a/packages/audio/pulseaudio/build +++ /dev/null @@ -1,94 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -# pulseaudio fails to build with LTO support - strip_lto - -if [ "$AVAHI_DAEMON" = yes ]; then - PULSEAUDIO_AVAHI="--enable-avahi" -else - PULSEAUDIO_AVAHI="--disable-avahi" -fi - -cd $PKG_BUILD - -./configure --host=$TARGET_NAME \ - --build=$HOST_NAME \ - --prefix=/usr \ - --sysconfdir=/etc \ - --localstatedir=/var \ - --disable-static \ - --enable-shared \ - --disable-silent-rules \ - --disable-nls \ - --enable-largefile \ - --disable-rpath \ - --disable-x11 \ - --enable-samplerate \ - --disable-oss-output \ - --disable-oss-wrapper \ - --disable-coreaudio-output \ - --enable-alsa \ - --disable-esound \ - --disable-solaris \ - --disable-waveout \ - --disable-glib2 \ - --disable-gtk2 \ - --disable-gconf \ - $PULSEAUDIO_AVAHI \ - --disable-jack \ - --disable-asyncns \ - --disable-tcpwrap \ - --disable-lirc \ - --enable-dbus \ - --disable-hal \ - --disable-bluez \ - --enable-udev \ - --disable-hal-compat \ - --enable-ipv6 \ - --enable-openssl \ - --disable-orc \ - --disable-manpages \ - --disable-per-user-esound-socket \ - --disable-legacy-runtime-dir \ - --disable-legacy-database-entry-format \ - --with-system-user=root \ - --with-system-group=root \ - --with-access-group=root \ - --with-module-dir="/usr/lib/pulse" \ - -make - -mkdir -p $SYSROOT_PREFIX/usr/lib - cp -P src/.libs/libpulse.so* $SYSROOT_PREFIX/usr/lib - cp -P src/.libs/libpulse-simple.so* $SYSROOT_PREFIX/usr/lib - cp -P src/.libs/libpulsecommon-*.so* $SYSROOT_PREFIX/usr/lib - cp -P src/.libs/libpulsecore-*.so $SYSROOT_PREFIX/usr/lib - -mkdir -p $SYSROOT_PREFIX/usr/lib/pkgconfig - cp libpulse.pc $SYSROOT_PREFIX/usr/lib/pkgconfig - cp libpulse-simple.pc $SYSROOT_PREFIX/usr/lib/pkgconfig - -make DESTDIR="$SYSROOT_PREFIX" -C src install-pulseincludeHEADERS - diff --git a/packages/audio/pulseaudio/install b/packages/audio/pulseaudio/install deleted file mode 100755 index 7eb8d21747..0000000000 --- a/packages/audio/pulseaudio/install +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/sh - -. config/options $1 - -# add_user pulse x 499 498 "PulseAudio System Daemon" "/var/run/pulse" "/bin/sh" -# add_group pulse 498 -# add_group pulse-access 497 - -mkdir -p $INSTALL/etc/dbus-1/system.d - cp $PKG_BUILD/src/daemon/pulseaudio-system.conf $INSTALL/etc/dbus-1/system.d - sed -e 's%user="pulse"%user="root"%g' -i $INSTALL/etc/dbus-1/system.d/pulseaudio-system.conf - -mkdir -p $INSTALL/etc - cp $PKG_DIR/config/asound.conf $INSTALL/etc - -mkdir -p $INSTALL/etc/alsa - cp $PKG_DIR/config/pulse-default.conf $INSTALL/etc/alsa - -mkdir -p $INSTALL/etc/pulse - cp $PKG_BUILD/src/client.conf $INSTALL/etc/pulse - cp $PKG_BUILD/src/daemon.conf $INSTALL/etc/pulse -# cp $PKG_BUILD/src/default.pa $INSTALL/etc/pulse -# cp $PKG_DIR/config/default.pa $INSTALL/etc/pulse - cp $PKG_BUILD/src/system.pa $INSTALL/etc/pulse - -mkdir -p $INSTALL/lib/udev/rules.d - cp $PKG_BUILD/src/modules/alsa/mixer/profile-sets/90-pulseaudio.rules $INSTALL/lib/udev/rules.d - -mkdir -p $INSTALL/usr/bin - cp $PKG_BUILD/src/.libs/pacat $INSTALL/usr/bin - cp $PKG_BUILD/src/.libs/pacmd $INSTALL/usr/bin - cp $PKG_BUILD/src/.libs/pactl $INSTALL/usr/bin - ln -sf pactl $INSTALL/usr/bin/pamon - ln -sf pactl $INSTALL/usr/bin/paplay - ln -sf pactl $INSTALL/usr/bin/parec - ln -sf pactl $INSTALL/usr/bin/parecord - cp $PKG_BUILD/src/.libs/pasuspender $INSTALL/usr/bin -# cp $PKG_BUILD/src/.libs/pax11publish $INSTALL/usr/bin - cp $PKG_BUILD/src/.libs/pulseaudio $INSTALL/usr/bin -# cp $PKG_BUILD/src/start-pulseaudio-x11 $INSTALL/usr/bin - -mkdir -p $INSTALL/usr/lib - cp -P $PKG_BUILD/src/.libs/libpulse*.so* $INSTALL/usr/lib - rm -rf $INSTALL/usr/lib/libpulse*.so*T - -mkdir -p $INSTALL/usr/lib/pulse - cp -P $PKG_BUILD/src/.libs/libalsa-util.so $INSTALL/usr/lib/pulse - cp -P $PKG_BUILD/src/.libs/libavahi-wrap.so $INSTALL/usr/lib/pulse - cp -P $PKG_BUILD/src/.libs/libcli.so $INSTALL/usr/lib/pulse - cp -P $PKG_BUILD/src/.libs/libprotocol-cli.so $INSTALL/usr/lib/pulse -# cp -P $PKG_BUILD/src/.libs/libprotocol-esound.so $INSTALL/usr/lib/pulse - cp -P $PKG_BUILD/src/.libs/libprotocol-http.so $INSTALL/usr/lib/pulse - cp -P $PKG_BUILD/src/.libs/libprotocol-native.so $INSTALL/usr/lib/pulse - cp -P $PKG_BUILD/src/.libs/libprotocol-simple.so $INSTALL/usr/lib/pulse - cp -P $PKG_BUILD/src/.libs/libraop.so $INSTALL/usr/lib/pulse - cp -P $PKG_BUILD/src/.libs/librtp.so $INSTALL/usr/lib/pulse - cp -P $PKG_BUILD/src/.libs/module-*.so $INSTALL/usr/lib/pulse - -mkdir -p $INSTALL/usr/share/pulseaudio/alsa-mixer/paths - cp $PKG_BUILD/src/modules/alsa/mixer/paths/* $INSTALL/usr/share/pulseaudio/alsa-mixer/paths - -mkdir -p $INSTALL/usr/share/pulseaudio/alsa-mixer/profile-sets - cp $PKG_BUILD/src/modules/alsa/mixer/profile-sets/*.conf $INSTALL/usr/share/pulseaudio/alsa-mixer/profile-sets diff --git a/packages/audio/pulseaudio/meta b/packages/audio/pulseaudio/meta deleted file mode 100644 index 95586f253b..0000000000 --- a/packages/audio/pulseaudio/meta +++ /dev/null @@ -1,42 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -PKG_NAME="pulseaudio" -PKG_VERSION="2.1" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="GPL" -PKG_SITE="http://pulseaudio.org/" -PKG_URL="http://freedesktop.org/software/pulseaudio/releases/$PKG_NAME-$PKG_VERSION.tar.xz" -PKG_DEPENDS="libtool json-c alsa-lib libsndfile libsamplerate speex dbus systemd openssl" -PKG_BUILD_DEPENDS="toolchain libtool json-c alsa-lib libsndfile libsamplerate speex dbus systemd openssl libcap" -PKG_PRIORITY="optional" -PKG_SECTION="audio" -PKG_SHORTDESC="pulseaudio: Yet another sound server for Unix" -PKG_LONGDESC="PulseAudio is a sound server for Linux and other Unix-like operating systems. It is intended to be an improved drop-in replacement for the Enlightened Sound Daemon (esound or esd). In addition to the features esound provides, PulseAudio has an extensible plugin architecture, support for more than one sink per source, better low-latency behavior, the ability to be embedded into other software, a completely asynchronous C API, a simple command line interface for reconfiguring the daemon while running, flexible and implicit sample type conversion and resampling, and a "Zero-Copy" architecture." -PKG_IS_ADDON="no" - -PKG_AUTORECONF="no" - -if [ "$AVAHI_DAEMON" = yes ]; then - PKG_DEPENDS="$PKG_DEPENDS avahi" - PKG_BUILD_DEPENDS="$PKG_BUILD_DEPENDS avahi" -fi - diff --git a/packages/audio/pulseaudio/package.mk b/packages/audio/pulseaudio/package.mk new file mode 100644 index 0000000000..7395ae22c1 --- /dev/null +++ b/packages/audio/pulseaudio/package.mk @@ -0,0 +1,109 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) +# +# 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 OpenELEC.tv; see the file COPYING. If not, write to +# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ + +PKG_NAME="pulseaudio" +PKG_VERSION="2.1" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://pulseaudio.org/" +PKG_URL="http://freedesktop.org/software/pulseaudio/releases/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_DEPENDS="libtool json-c alsa-lib libsndfile libsamplerate speex dbus systemd openssl" +PKG_BUILD_DEPENDS_TARGET="toolchain libtool json-c alsa-lib libsndfile libsamplerate speex dbus systemd openssl libcap" +PKG_PRIORITY="optional" +PKG_SECTION="audio" +PKG_SHORTDESC="pulseaudio: Yet another sound server for Unix" +PKG_LONGDESC="PulseAudio is a sound server for Linux and other Unix-like operating systems. It is intended to be an improved drop-in replacement for the Enlightened Sound Daemon (esound or esd). In addition to the features esound provides, PulseAudio has an extensible plugin architecture, support for more than one sink per source, better low-latency behavior, the ability to be embedded into other software, a completely asynchronous C API, a simple command line interface for reconfiguring the daemon while running, flexible and implicit sample type conversion and resampling, and a "Zero-Copy" architecture." + +PKG_IS_ADDON="no" +PKG_AUTORECONF="yes" + +# package specific configure options +PKG_CONFIGURE_OPTS_TARGET="--disable-silent-rules \ + --disable-nls \ + --enable-largefile \ + --disable-rpath \ + --disable-x11 \ + --enable-samplerate \ + --disable-oss-output \ + --disable-oss-wrapper \ + --disable-coreaudio-output \ + --enable-alsa \ + --disable-esound \ + --disable-solaris \ + --disable-waveout \ + --disable-glib2 \ + --disable-gtk2 \ + --disable-gconf \ + --disable-jack \ + --disable-asyncns \ + --disable-tcpwrap \ + --disable-lirc \ + --enable-dbus \ + --disable-hal \ + --disable-bluez \ + --enable-udev \ + --disable-hal-compat \ + --enable-ipv6 \ + --enable-openssl \ + --disable-orc \ + --disable-manpages \ + --disable-per-user-esound-socket \ + --disable-legacy-runtime-dir \ + --disable-legacy-database-entry-format \ + --with-system-user=root \ + --with-system-group=root \ + --with-access-group=root \ + --with-module-dir=/usr/lib/pulse" + +if [ "$AVAHI_DAEMON" = yes ]; then + PKG_DEPENDS="$PKG_DEPENDS avahi" + PKG_BUILD_DEPENDS_TARGET="$PKG_BUILD_DEPENDS_TARGET avahi" + PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET --enable-avahi" +else + PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET --disable-avahi" +fi + +pre_configure_target() { + # pulseaudio fails to build with LTO support + strip_lto +} + +pre_make_target() { + MAKEFLAGS=-j1 +} + +post_makeinstall_target() { +# add_user pulse x 499 498 "PulseAudio System Daemon" "/var/run/pulse" "/bin/sh" +# add_group pulse 498 +# add_group pulse-access 497 + + sed -e 's%user="pulse"%user="root"%g' -i $INSTALL/etc/dbus-1/system.d/pulseaudio-system.conf + + mkdir -p $INSTALL/etc + cp $PKG_DIR/config/asound.conf $INSTALL/etc + + mkdir -p $INSTALL/etc/alsa + cp $PKG_DIR/config/pulse-default.conf $INSTALL/etc/alsa + + rm -rf $INSTALL/usr/bin/esdcompat + rm -rf $INSTALL/usr/lib/cmake + rm -rf $INSTALL/usr/share/vala +} diff --git a/packages/audio/speex/build b/packages/audio/speex/build deleted file mode 100755 index e2dab98e0b..0000000000 --- a/packages/audio/speex/build +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -cd $PKG_BUILD -./configure --host=$TARGET_NAME \ - --build=$HOST_NAME \ - --prefix=/usr \ - --sysconfdir=/etc \ - --localstatedir=/var \ - --disable-static \ - --enable-shared \ - --with-ogg=$SYSROOT_PREFIX/usr \ - --enable-fixed-point \ - --disable-oggtest \ - --disable-float-api \ - --disable-vbr \ - -make - -$MAKEINSTALL \ No newline at end of file diff --git a/packages/audio/speex/install b/packages/audio/speex/install deleted file mode 100755 index 8637a091ec..0000000000 --- a/packages/audio/speex/install +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -mkdir -p $INSTALL/usr/lib - cp -P $PKG_BUILD/libspeex/.libs/libspeexdsp.so* $INSTALL/usr/lib diff --git a/packages/audio/speex/meta b/packages/audio/speex/package.mk similarity index 81% rename from packages/audio/speex/meta rename to packages/audio/speex/package.mk index 5e1f80085e..ebea343c7c 100644 --- a/packages/audio/speex/meta +++ b/packages/audio/speex/package.mk @@ -26,11 +26,22 @@ PKG_LICENSE="BSD" PKG_SITE="http://www.speex.org" PKG_URL="http://downloads.xiph.org/releases/$PKG_NAME/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS="libogg" -PKG_BUILD_DEPENDS="toolchain libogg" +PKG_BUILD_DEPENDS_TARGET="toolchain libogg" PKG_PRIORITY="optional" PKG_SECTION="audio" PKG_SHORTDESC="speex: A free Audio Codec optimized for speech" PKG_LONGDESC="Speex is a patent-free compression format designed especially for speech. It is specialized for voice communications at low bit-rates in the 2-45 kbps range. Possible applications include Voice over IP (VoIP), Internet audio streaming, audio books, and archiving of speech data (e.g. voice mail)." -PKG_IS_ADDON="no" +PKG_IS_ADDON="no" PKG_AUTORECONF="yes" + +# package specific configure options +PKG_CONFIGURE_OPTS_TARGET="--with-ogg=$SYSROOT_PREFIX/usr \ + --enable-fixed-point \ + --disable-oggtest \ + --disable-float-api \ + --disable-vbr" + +post_makeinstall_target() { + rm -rf $INSTALL/usr/bin +} diff --git a/packages/audio/taglib/build b/packages/audio/taglib/build deleted file mode 100755 index 8c22bad6fe..0000000000 --- a/packages/audio/taglib/build +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -cd $PKG_BUILD -mkdir -p build && cd build - -cmake -DCMAKE_TOOLCHAIN_FILE=$CMAKE_CONF \ - -DCMAKE_INSTALL_PREFIX=/usr \ - .. - -make -$MAKEINSTALL diff --git a/packages/audio/taglib/install b/packages/audio/taglib/install deleted file mode 100755 index 261329232e..0000000000 --- a/packages/audio/taglib/install +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -mkdir -p $INSTALL/usr/lib - cp -P $PKG_BUILD/build/taglib/*.so* $INSTALL/usr/lib - cp -P $PKG_BUILD/build/bindings/c/*.so* $INSTALL/usr/lib diff --git a/packages/audio/taglib/meta b/packages/audio/taglib/package.mk similarity index 86% rename from packages/audio/taglib/meta rename to packages/audio/taglib/package.mk index 1137b9ba08..63cfef652b 100644 --- a/packages/audio/taglib/meta +++ b/packages/audio/taglib/package.mk @@ -26,11 +26,20 @@ PKG_LICENSE="LGPL" PKG_SITE="http://taglib.github.com/" PKG_URL="https://github.com/downloads/taglib/$PKG_NAME/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS="zlib" -PKG_BUILD_DEPENDS="toolchain zlib" +PKG_BUILD_DEPENDS_TARGET="toolchain cmake zlib" PKG_PRIORITY="optional" PKG_SECTION="audio" PKG_SHORTDESC="taglib: a library for reading and editing the meta-data of several popular audio formats." PKG_LONGDESC="TagLib is a library for reading and editing the meta-data of several popular audio formats." -PKG_IS_ADDON="no" +PKG_IS_ADDON="no" PKG_AUTORECONF="no" + +# package specific configure options +configure_target() { + cmake -DCMAKE_TOOLCHAIN_FILE=$CMAKE_CONF -DCMAKE_INSTALL_PREFIX=/usr .. +} + +post_makeinstall_target() { + rm -rf $INSTALL/usr/bin +} diff --git a/packages/compress/bzip2/build b/packages/compress/bzip2/build deleted file mode 100755 index bd951e4573..0000000000 --- a/packages/compress/bzip2/build +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -cd $PKG_BUILD - -sed -e "s,ln -s (lib.*),ln -snf \$$1; ln -snf libbz2.so.$PKG_VERSION libbz2.so,g" -i Makefile-libbz2_so - -make CC=$TARGET_CC RANLIB=$TARGET_RANLIB AR=$TARGET_AR CFLAGS="$CFLAGS -fPIC -DPIC" -f Makefile-libbz2_so -ln -snf libbz2.so.1.0 libbz2.so - -mkdir -p $SYSROOT_PREFIX/usr/include - cp bzlib.h $SYSROOT_PREFIX/usr/include - -mkdir -p $SYSROOT_PREFIX/usr/lib - cp -P libbz2.so* $SYSROOT_PREFIX/usr/lib - diff --git a/packages/compress/bzip2/install b/packages/compress/bzip2/install deleted file mode 100755 index 9dd22ead23..0000000000 --- a/packages/compress/bzip2/install +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -mkdir -p $INSTALL/usr/lib - cp -P $PKG_BUILD/*.so* $INSTALL/usr/lib diff --git a/packages/compress/bzip2/meta b/packages/compress/bzip2/package.mk similarity index 74% rename from packages/compress/bzip2/meta rename to packages/compress/bzip2/package.mk index 16632983a1..a8ba92c060 100644 --- a/packages/compress/bzip2/meta +++ b/packages/compress/bzip2/package.mk @@ -26,11 +26,33 @@ PKG_LICENSE="GPL" PKG_SITE="http://www.bzip.org" PKG_URL="http://www.bzip.org/$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS="" -PKG_BUILD_DEPENDS="toolchain" +PKG_BUILD_DEPENDS_TARGET="toolchain" PKG_PRIORITY="optional" PKG_SECTION="compress" PKG_SHORTDESC="bzip2 data compressor" PKG_LONGDESC="bzip2 is a freely available, patent free (see below), high-quality data compressor. It typically compresses files to within 10% to 15% of the best available techniques (the PPM family of statistical compressors), whilst being around twice as fast at compression and six times faster at decompression." -PKG_IS_ADDON="no" +PKG_IS_ADDON="no" PKG_AUTORECONF="no" + +pre_make_target() { + sed -e "s,ln -s (lib.*),ln -snf \$$1; ln -snf libbz2.so.$PKG_VERSION libbz2.so,g" -i Makefile-libbz2_so +} + +make_target() { + make -f Makefile-libbz2_so CC=$TARGET_CC CFLAGS="$CFLAGS -fPIC -DPIC" +} + +post_make_target() { + ln -snf libbz2.so.1.0 libbz2.so +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/include + cp bzlib.h $SYSROOT_PREFIX/usr/include + mkdir -p $SYSROOT_PREFIX/usr/lib + cp -P libbz2.so* $SYSROOT_PREFIX/usr/lib + + mkdir -p $INSTALL/usr/lib + cp -P libbz2.so* $INSTALL/usr/lib +} diff --git a/packages/compress/bzip2/patches/bzip2-1.0.6-cflags.patch b/packages/compress/bzip2/patches/bzip2-1.0.6-cflags.patch new file mode 100644 index 0000000000..d0ef3c65d9 --- /dev/null +++ b/packages/compress/bzip2/patches/bzip2-1.0.6-cflags.patch @@ -0,0 +1,12 @@ +diff -Naur bzip2-1.0.6/Makefile-libbz2_so bzip2-1.0.6.patch/Makefile-libbz2_so +--- bzip2-1.0.6/Makefile-libbz2_so 2010-09-11 01:07:52.000000000 +0200 ++++ bzip2-1.0.6.patch/Makefile-libbz2_so 2013-03-31 18:26:33.335234891 +0200 +@@ -35,7 +35,7 @@ + bzlib.o + + all: $(OBJS) +- $(CC) -shared -Wl,-soname -Wl,libbz2.so.1.0 -o libbz2.so.1.0.6 $(OBJS) ++ $(CC) $(CFLAGS) -shared -Wl,-soname -Wl,libbz2.so.1.0 -o libbz2.so.1.0.6 $(OBJS) + $(CC) $(CFLAGS) -o bzip2-shared bzip2.c libbz2.so.1.0.6 + rm -f libbz2.so.1.0 + ln -s libbz2.so.1.0.6 libbz2.so.1.0 diff --git a/packages/compress/lzo/build b/packages/compress/lzo/build deleted file mode 100755 index 36e0f4e393..0000000000 --- a/packages/compress/lzo/build +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -cd $PKG_BUILD - -mkdir -p .build-target && cd .build-target -../configure --host=$TARGET_NAME \ - --build=$HOST_NAME \ - --prefix=/usr \ - --exec-prefix=/usr \ - --sysconfdir=/etc \ - --datadir=/usr/share \ - --disable-shared \ - --enable-static \ - -make -$MAKEINSTALL diff --git a/packages/compress/lzo/meta b/packages/compress/lzo/package.mk similarity index 92% rename from packages/compress/lzo/meta rename to packages/compress/lzo/package.mk index 9ab9f5cbba..4645a03fc9 100644 --- a/packages/compress/lzo/meta +++ b/packages/compress/lzo/package.mk @@ -26,11 +26,14 @@ PKG_LICENSE="GPL" PKG_SITE="http://www.oberhumer.com/opensource/lzo" PKG_URL="http://www.oberhumer.com/opensource/lzo/download/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS="" -PKG_BUILD_DEPENDS="toolchain" +PKG_BUILD_DEPENDS_TARGET="toolchain" +PKG_BUILD_DEPENDS_HOST="toolchain" PKG_PRIORITY="optional" PKG_SECTION="compress" PKG_SHORTDESC="LZO data compressor" PKG_LONGDESC="LZO is a data compression library which is suitable for data de-/compression in real-time. This means it favours speed over compression ratio." -PKG_IS_ADDON="no" +PKG_IS_ADDON="no" PKG_AUTORECONF="yes" + +PKG_CONFIGURE_OPTS_TARGET="--disable-shared --enable-static" diff --git a/packages/compress/zip/build b/packages/compress/zip/build deleted file mode 100755 index f5d0c11d7c..0000000000 --- a/packages/compress/zip/build +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -cd $BUILD/$1* - -make CC=$TARGET_CC \ - CPP=${TARGET_PREFIX}cpp \ - RANLIB=$TARGET_RANLIB \ - AR=$TARGET_AR \ - STRIP=$TARGET_STRIP \ - LOCAL_ZIP="$TARGET_CFLAGS" \ - -f unix/Makefile generic - diff --git a/packages/compress/zip/install b/packages/compress/zip/install deleted file mode 100755 index 8b4df09993..0000000000 --- a/packages/compress/zip/install +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -mkdir -p $INSTALL/usr/bin - cp $BUILD/$1*/zip $INSTALL/usr/bin - diff --git a/packages/compress/zip/meta b/packages/compress/zip/package.mk similarity index 83% rename from packages/compress/zip/meta rename to packages/compress/zip/package.mk index 8ac8d05cae..c0b1e0c7f3 100644 --- a/packages/compress/zip/meta +++ b/packages/compress/zip/package.mk @@ -26,11 +26,26 @@ PKG_LICENSE="Info-ZIP" PKG_SITE="http://www.info-zip.org/pub/infozip/" PKG_URL="$SOURCEFORGE_SRC/infozip/Zip%203.x%20%28latest%29/3.0/${PKG_NAME}${PKG_VERSION}.tar.gz" PKG_DEPENDS="bzip2" -PKG_BUILD_DEPENDS="toolchain bzip2" +PKG_BUILD_DEPENDS_TARGET="toolchain bzip2" PKG_PRIORITY="optional" PKG_SECTION="compress" PKG_SHORTDESC="zip: PKUNZIP compatible compression utility" PKG_LONGDESC="zip is a compression and file packaging utility for Unix, VMS, MSDOS, OS/2, Windows 9x/NT/XP, Minix, Atari, Macintosh, MVS, z/OS, Amiga, Acorn RISC, and other OS. It is analogous to a combination of the Unix commands tar(1) and compress(1) (or tar(1) and gzip(1)) and is compatible with PKZIP (Phil Katz's ZIP for MSDOS systems) and other major zip utilities." -PKG_IS_ADDON="no" +PKG_IS_ADDON="no" PKG_AUTORECONF="no" + +make_target() { + make CC=$TARGET_CC \ + CPP=${TARGET_PREFIX}cpp \ + RANLIB=$TARGET_RANLIB \ + AR=$TARGET_AR \ + STRIP=$TARGET_STRIP \ + LOCAL_ZIP="$TARGET_CFLAGS" \ + -f unix/Makefile generic +} + +makeinstall_target() { + mkdir -p $INSTALL/usr/bin + cp zip $INSTALL/usr/bin +} diff --git a/packages/compress/zlib-host/build b/packages/compress/zlib-host/build deleted file mode 100755 index 9185bfb21d..0000000000 --- a/packages/compress/zlib-host/build +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -$SCRIPTS/unpack zlib - -# dont build parallel - MAKEFLAGS=-j1 - -setup_toolchain host - -cd $BUILD/zlib-* - -cd zlib-host - -./configure --prefix=$ROOT/$TOOLCHAIN - -make -make install diff --git a/packages/compress/zlib-host/meta b/packages/compress/zlib-host/meta deleted file mode 100644 index f89c54d853..0000000000 --- a/packages/compress/zlib-host/meta +++ /dev/null @@ -1,36 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -PKG_NAME="zlib-host" -PKG_VERSION="" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="OSS" -PKG_SITE="http://www.zlib.net" -PKG_URL="" -PKG_DEPENDS="" -PKG_BUILD_DEPENDS="ccache" -PKG_PRIORITY="optional" -PKG_SECTION="compress" -PKG_SHORTDESC="zlib: A general purpose (ZIP) data compression library" -PKG_LONGDESC="zlib is a general purpose data compression library. All the code is thread safe. The data format used by the zlib library is described by RFCs (Request for Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format)." -PKG_IS_ADDON="no" - -PKG_AUTORECONF="no" diff --git a/packages/compress/zlib/build b/packages/compress/zlib/build deleted file mode 100755 index 9f49cd7dcd..0000000000 --- a/packages/compress/zlib/build +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -cd $PKG_BUILD - -./configure --prefix=/usr - -make - -$MAKEINSTALL diff --git a/packages/compress/zlib/install b/packages/compress/zlib/install deleted file mode 100755 index b54f4412a3..0000000000 --- a/packages/compress/zlib/install +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -mkdir -p $INSTALL/usr/lib - cp -R $PKG_BUILD/*.so* $INSTALL/usr/lib diff --git a/packages/compress/zlib/meta b/packages/compress/zlib/package.mk similarity index 82% rename from packages/compress/zlib/meta rename to packages/compress/zlib/package.mk index d24d2a6b6e..4c9744f978 100644 --- a/packages/compress/zlib/meta +++ b/packages/compress/zlib/package.mk @@ -26,11 +26,25 @@ PKG_LICENSE="OSS" PKG_SITE="http://www.zlib.net" PKG_URL="http://www.zlib.net/$PKG_NAME-$PKG_VERSION.tar.xz" PKG_DEPENDS="" -PKG_BUILD_DEPENDS="toolchain" +PKG_BUILD_DEPENDS_TARGET="toolchain" +PKG_BUILD_DEPENDS_HOST="" PKG_PRIORITY="optional" PKG_SECTION="compress" PKG_SHORTDESC="zlib: A general purpose (ZIP) data compression library" PKG_LONGDESC="zlib is a general purpose data compression library. All the code is thread safe. The data format used by the zlib library is described by RFCs (Request for Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format)." -PKG_IS_ADDON="no" +PKG_IS_ADDON="no" PKG_AUTORECONF="no" + +TARGET_CONFIGURE_OPTS="--prefix=/usr" +HOST_CONFIGURE_OPTS="--prefix=$ROOT/$TOOLCHAIN" + +pre_build_target() { + mkdir -p $PKG_BUILD/.$TARGET_NAME + cp -RP $PKG_BUILD/* $PKG_BUILD/.$TARGET_NAME +} + +pre_build_host() { + mkdir -p $PKG_BUILD/.$HOST_NAME + cp -RP $PKG_BUILD/* $PKG_BUILD/.$HOST_NAME +} diff --git a/packages/compress/zlib/unpack b/packages/compress/zlib/unpack deleted file mode 100755 index aa9d15868d..0000000000 --- a/packages/compress/zlib/unpack +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -ZLIB_DIR=`ls -d $PKG_BUILD` - -cp -r "$ZLIB_DIR" "$BUILD/zlib-host" || rm -rf "$BUILD/zlib-host" -mv "$BUILD/zlib-host" "$ZLIB_DIR" diff --git a/packages/databases/mysql-hosttools/build b/packages/databases/mysql-hosttools/build deleted file mode 100755 index a414e41df4..0000000000 --- a/packages/databases/mysql-hosttools/build +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -$SCRIPTS/unpack mysql - -setup_toolchain host - -cd $BUILD/mysql* -do_autoreconf -mkdir -p .objdir-host && cd .objdir-host -../configure --host=$HOST_NAME \ - --build=$HOST_NAME \ - --prefix=/usr \ - --sysconfdir=/etc \ - --libexecdir=/usr/sbin \ - --localstatedir=/var/mysql \ - --with-zlib-dir="$ROOT/$TOOLCHAIN" \ - -make -C include my_config.h -make -C mysys libmysys.a -make -C strings libmystrings.a - -make -C dbug factorial - -cp -PR dbug/factorial $ROOT/$TOOLCHAIN/bin/mysql-factorial - -make -C vio libvio.a -make -C dbug libdbug.a -make -C regex libregex.a -make -C sql gen_lex_hash - -cp -PR sql/gen_lex_hash $ROOT/$TOOLCHAIN/bin/mysql-gen_lex_hash - -make -C scripts comp_sql - -cp -PR scripts/comp_sql $ROOT/$TOOLCHAIN/bin/mysql-comp_sql - -make -C extra comp_err - -cp -PR extra/comp_err $ROOT/$TOOLCHAIN/bin/mysql-comp_err diff --git a/packages/databases/mysql-hosttools/meta b/packages/databases/mysql-hosttools/meta deleted file mode 100644 index 46d9368c69..0000000000 --- a/packages/databases/mysql-hosttools/meta +++ /dev/null @@ -1,36 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -PKG_NAME="mysql-hosttools" -PKG_VERSION="" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="LGPL" -PKG_SITE="http://www.mysql.com" -PKG_URL="" -PKG_DEPENDS="" -PKG_BUILD_DEPENDS="toolchain zlib-host" -PKG_PRIORITY="optional" -PKG_SECTION="database" -PKG_SHORTDESC="mysql: A database server" -PKG_LONGDESC="MySQL is a SQL (Structured Query Language) database server. SQL is the most popular database language in the world. MySQL is a client server implementation that consists of a server daemon mysqld and many different client programs/libraries." -PKG_IS_ADDON="no" - -PKG_AUTORECONF="no" diff --git a/packages/databases/mysql/build b/packages/databases/mysql/build deleted file mode 100755 index 2c90135cb6..0000000000 --- a/packages/databases/mysql/build +++ /dev/null @@ -1,85 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -CFLAGS="$CFLAGS -fPIC -DPIC" - -cd $PKG_BUILD -ac_cv_c_stack_direction=-1 \ -ac_cv_sys_restartable_syscalls=yes \ -./configure --host=$TARGET_NAME \ - --build=$HOST_NAME \ - --target=$TARGET_NAME \ - --prefix=/usr \ - --sysconfdir=/etc \ - --sbindir=/usr/sbin \ - --libdir=/usr/lib \ - --libexecdir=/usr/sbin \ - --localstatedir=/storage/.mysql \ - --with-unix-socket-path=/var/tmp/mysql.socket \ - --with-tcp-port=3306 \ - --enable-static \ - --disable-shared \ - --with-low-memory \ - --enable-largefile \ - --with-big-tables \ - --with-mysqld-user=mysqld \ - --with-extra-charsets=all \ - --with-pthread \ - --with-named-thread-libs=-lpthread \ - --enable-thread-safe-client \ - --enable-assembler \ - --enable-local-infile \ - --without-debug \ - --without-docs \ - --without-man \ - --with-readline \ - --without-libwrap \ - --without-pstack \ - --without-server \ - --without-embedded-server \ - --without-libedit \ - --with-query-cache \ - --without-plugin-partition \ - --without-plugin-daemon_example \ - --without-plugin-ftexample \ - --without-plugin-archive \ - --without-plugin-blackhole \ - --without-plugin-example \ - --without-plugin-federated \ - --without-plugin-ibmdb2i \ - --without-plugin-innobase \ - --without-plugin-innodb_plugin \ - --without-plugin-ndbcluster \ - -make -$MAKEINSTALL - -sed -i "s|pkgincludedir=.*|pkgincludedir=\'$SYSROOT_PREFIX/usr/include/mysql\'|" scripts/mysql_config -sed -i "s|pkglibdir=.*|pkglibdir=\'$SYSROOT_PREFIX/usr/lib/mysql\'|" scripts/mysql_config -cp scripts/mysql_config $SYSROOT_PREFIX/usr/bin -ln -sf $SYSROOT_PREFIX/usr/bin/mysql_config $ROOT/$TOOLCHAIN/bin/mysql_config - -for i in `ls -d $SYSROOT_PREFIX/usr/lib/mysql/*.a`; do - ln -v -sf $i $SYSROOT_PREFIX/usr/lib -done diff --git a/packages/databases/mysql/meta b/packages/databases/mysql/meta deleted file mode 100644 index 2d7366789a..0000000000 --- a/packages/databases/mysql/meta +++ /dev/null @@ -1,36 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -PKG_NAME="mysql" -PKG_VERSION="5.1.68" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="LGPL" -PKG_SITE="http://www.mysql.com" -PKG_URL="http://ftp.gwdg.de/pub/misc/$PKG_NAME/Downloads/MySQL-5.1/$PKG_NAME-$PKG_VERSION.tar.gz" -PKG_DEPENDS="zlib ncurses" -PKG_BUILD_DEPENDS="toolchain zlib ncurses mysql-hosttools" -PKG_PRIORITY="optional" -PKG_SECTION="database" -PKG_SHORTDESC="mysql: A database server" -PKG_LONGDESC="MySQL is a SQL (Structured Query Language) database server. SQL is the most popular database language in the world. MySQL is a client server implementation that consists of a server daemon mysqld and many different client programs/libraries." -PKG_IS_ADDON="no" - -PKG_AUTORECONF="yes" diff --git a/packages/databases/mysql/package.mk b/packages/databases/mysql/package.mk new file mode 100644 index 0000000000..083d661455 --- /dev/null +++ b/packages/databases/mysql/package.mk @@ -0,0 +1,116 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) +# +# 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 OpenELEC.tv; see the file COPYING. If not, write to +# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ + +PKG_NAME="mysql" +PKG_VERSION="5.1.68" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="LGPL" +PKG_SITE="http://www.mysql.com" +PKG_URL="http://ftp.gwdg.de/pub/misc/$PKG_NAME/Downloads/MySQL-5.1/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS="zlib ncurses" +PKG_BUILD_DEPENDS_HOST="toolchain zlib:host" +PKG_BUILD_DEPENDS_TARGET="toolchain zlib ncurses mysql:host" +PKG_PRIORITY="optional" +PKG_SECTION="database" +PKG_SHORTDESC="mysql: A database server" +PKG_LONGDESC="MySQL is a SQL (Structured Query Language) database server. SQL is the most popular database language in the world. MySQL is a client server implementation that consists of a server daemon mysqld and many different client programs/libraries." + +PKG_IS_ADDON="no" +PKG_AUTORECONF="yes" + +TARGET_CFLAGS="$TARGET_CFLAGS -fPIC -DPIC" + +PKG_CONFIGURE_OPTS_HOST="--with-zlib-dir=$ROOT/$TOOLCHAIN" + +PKG_CONFIGURE_OPTS_TARGET="ac_cv_c_stack_direction=-1 \ + ac_cv_sys_restartable_syscalls=yes \ + --localstatedir=/storage/.mysql \ + --with-unix-socket-path=/var/tmp/mysql.socket \ + --with-tcp-port=3306 \ + --enable-static \ + --disable-shared \ + --with-low-memory \ + --enable-largefile \ + --with-big-tables \ + --with-mysqld-user=mysqld \ + --with-extra-charsets=all \ + --with-pthread \ + --with-named-thread-libs=-lpthread \ + --enable-thread-safe-client \ + --enable-assembler \ + --enable-local-infile \ + --without-debug \ + --without-docs \ + --without-man \ + --with-readline \ + --without-libwrap \ + --without-pstack \ + --without-server \ + --without-embedded-server \ + --without-libedit \ + --with-query-cache \ + --without-plugin-partition \ + --without-plugin-daemon_example \ + --without-plugin-ftexample \ + --without-plugin-archive \ + --without-plugin-blackhole \ + --without-plugin-example \ + --without-plugin-federated \ + --without-plugin-ibmdb2i \ + --without-plugin-innobase \ + --without-plugin-innodb_plugin \ + --without-plugin-ndbcluster" + +make_host() { + make -C include my_config.h + make -C mysys libmysys.a + make -C strings libmystrings.a + make -C dbug factorial + make -C vio libvio.a + make -C dbug libdbug.a + make -C regex libregex.a + make -C sql gen_lex_hash + make -C scripts comp_sql + make -C extra comp_err +} + +makeinstall_host() { + cp -PR dbug/factorial $ROOT/$TOOLCHAIN/bin/mysql-factorial + cp -PR sql/gen_lex_hash $ROOT/$TOOLCHAIN/bin/mysql-gen_lex_hash + cp -PR scripts/comp_sql $ROOT/$TOOLCHAIN/bin/mysql-comp_sql + cp -PR extra/comp_err $ROOT/$TOOLCHAIN/bin/mysql-comp_err +} + +post_makeinstall_target() { + sed -i "s|pkgincludedir=.*|pkgincludedir=\'$SYSROOT_PREFIX/usr/include/mysql\'|" scripts/mysql_config + sed -i "s|pkglibdir=.*|pkglibdir=\'$SYSROOT_PREFIX/usr/lib/mysql\'|" scripts/mysql_config + cp scripts/mysql_config $SYSROOT_PREFIX/usr/bin + ln -sf $SYSROOT_PREFIX/usr/bin/mysql_config $ROOT/$TOOLCHAIN/bin/mysql_config + + for i in `ls -d $SYSROOT_PREFIX/usr/lib/mysql/*.a`; do + ln -v -sf $i $SYSROOT_PREFIX/usr/lib + done + + rm -rf $INSTALL/usr/bin + rm -rf $INSTALL/usr/mysql-test + rm -rf $INSTALL/usr/share/mysql + rm -rf $INSTALL/usr/sql-bench +} diff --git a/packages/databases/sqlite/meta b/packages/databases/sqlite/meta deleted file mode 100644 index 12a3d99875..0000000000 --- a/packages/databases/sqlite/meta +++ /dev/null @@ -1,36 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -PKG_NAME="sqlite" -PKG_VERSION="autoconf-3071700" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="PublicDomain" -PKG_SITE="http://www.sqlite.org/" -PKG_URL="http://sqlite.org/2013/$PKG_NAME-$PKG_VERSION.tar.gz" -PKG_DEPENDS="" -PKG_BUILD_DEPENDS="toolchain" -PKG_PRIORITY="optional" -PKG_SECTION="database" -PKG_SHORTDESC="sqlite: An Embeddable SQL Database Engine" -PKG_LONGDESC="SQLite is a C library that implements an embeddable SQL database engine. Programs that link with the SQLite library can have SQL database access without running a separate RDBMS process. The distribution comes with a standalone command-line access program (sqlite) that can be used to administer an SQLite database and which serves as an example of how to use the SQLite library. SQLite is not a client library used to connect to a big database server. SQLite is the server. The SQLite library reads and writes directly to and from the database files on disk." -PKG_IS_ADDON="no" - -PKG_AUTORECONF="yes" diff --git a/packages/databases/sqlite/build b/packages/databases/sqlite/package.mk old mode 100755 new mode 100644 similarity index 66% rename from packages/databases/sqlite/build rename to packages/databases/sqlite/package.mk index 2e92d02cf4..81c15b0dbc --- a/packages/databases/sqlite/build +++ b/packages/databases/sqlite/package.mk @@ -1,5 +1,3 @@ -#!/bin/sh - ################################################################################ # This file is part of OpenELEC - http://www.openelec.tv # Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) @@ -20,7 +18,22 @@ # http://www.gnu.org/copyleft/gpl.html ################################################################################ -. config/options $1 +PKG_NAME="sqlite" +PKG_VERSION="autoconf-3071700" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="PublicDomain" +PKG_SITE="http://www.sqlite.org/" +PKG_URL="http://sqlite.org/2013/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS="" +PKG_BUILD_DEPENDS_TARGET="toolchain" +PKG_PRIORITY="optional" +PKG_SECTION="database" +PKG_SHORTDESC="sqlite: An Embeddable SQL Database Engine" +PKG_LONGDESC="SQLite is a C library that implements an embeddable SQL database engine. Programs that link with the SQLite library can have SQL database access without running a separate RDBMS process. The distribution comes with a standalone command-line access program (sqlite) that can be used to administer an SQLite database and which serves as an example of how to use the SQLite library. SQLite is not a client library used to connect to a big database server. SQLite is the server. The SQLite library reads and writes directly to and from the database files on disk." + +PKG_IS_ADDON="no" +PKG_AUTORECONF="yes" # sqlite fails to compile with fast-math link time optimization. CFLAGS=`echo $CFLAGS | sed -e "s|-Ofast|-O3|g"` @@ -53,17 +66,14 @@ # mmap_size pragma. CFLAGS="$CFLAGS -DSQLITE_DEFAULT_MMAP_SIZE=268435456" -cd $PKG_BUILD -./configure --host=$TARGET_NAME \ - --build=$HOST_NAME \ - --prefix=/usr \ - --sysconfdir=/etc \ - --enable-static \ - --disable-shared \ - --disable-readline \ - --enable-threadsafe \ - --enable-dynamic-extensions \ - --with-gnu-ld -make -$MAKEINSTALL +PKG_CONFIGURE_OPTS_TARGET="--enable-static \ + --disable-shared \ + --disable-readline \ + --enable-threadsafe \ + --enable-dynamic-extensions \ + --with-gnu-ld" + +post_makeinstall_target() { + rm -rf $INSTALL/usr/bin +} diff --git a/packages/debug/gdb/build b/packages/debug/gdb/build deleted file mode 100755 index 5be7db90cf..0000000000 --- a/packages/debug/gdb/build +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -export bash_cv_have_mbstate_t=set - -export CC_FOR_BUILD="$HOST_CC" -export CFLAGS_FOR_BUILD="$HOST_CFLAGS" - -cd $PKG_BUILD -mkdir -p objdir && cd objdir - -../configure --host=$TARGET_NAME \ - --build=$HOST_NAME \ - --prefix=/usr \ - --disable-nls \ - --disable-sim \ - --without-x \ - --disable-tui \ - --disable-libada \ - --disable-werror \ - -make diff --git a/packages/debug/gdb/install b/packages/debug/gdb/install deleted file mode 100755 index 2e39e1e5f7..0000000000 --- a/packages/debug/gdb/install +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -mkdir -p $INSTALL/usr/bin - cp $PKG_BUILD/objdir/$1/$1 $INSTALL/usr/bin - cp $PKG_BUILD/objdir/$1/gdbserver/gdbserver $INSTALL/usr/bin - cp $PKG_BUILD/objdir/$1/gdbserver/gdbreplay $INSTALL/usr/bin diff --git a/packages/debug/gdb/meta b/packages/debug/gdb/package.mk similarity index 72% rename from packages/debug/gdb/meta rename to packages/debug/gdb/package.mk index 599e26f696..8fe274d375 100644 --- a/packages/debug/gdb/meta +++ b/packages/debug/gdb/package.mk @@ -25,13 +25,29 @@ PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.gnu.org/software/gdb/" PKG_URL="http://ftp.gnu.org/gnu/gdb/$PKG_NAME-$PKG_VERSION.tar.bz2" -#PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS="zlib ncurses expat" -PKG_BUILD_DEPENDS="toolchain zlib ncurses expat" +PKG_BUILD_DEPENDS_TARGET="toolchain zlib ncurses expat" PKG_PRIORITY="optional" PKG_SECTION="debug" PKG_SHORTDESC="gdb: The GNU Debugger" PKG_LONGDESC="The purpose of a debugger such as GDB is to allow you to see what is going on ``inside'' another program while it executes--or what another program was doing at the moment it crashed." -PKG_IS_ADDON="no" +PKG_IS_ADDON="no" PKG_AUTORECONF="no" + +CC_FOR_BUILD="$HOST_CC" +CFLAGS_FOR_BUILD="$HOST_CFLAGS" + +PKG_CONFIGURE_OPTS_TARGET="bash_cv_have_mbstate_t=set \ + --disable-shared \ + --enable-static \ + --disable-nls \ + --disable-sim \ + --without-x \ + --disable-tui \ + --disable-libada \ + --disable-werror" + +post_makeinstall_target() { + rm -rf $INSTALL/usr/share/gdb/python +} diff --git a/packages/debug/mesa-demos/build b/packages/debug/mesa-demos/build deleted file mode 100755 index e4c5ef4eb1..0000000000 --- a/packages/debug/mesa-demos/build +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -cd $PKG_BUILD -./configure --host=$TARGET_NAME \ - --build=$HOST_NAME \ - --prefix=/usr \ - --sysconfdir=/etc \ - --localstatedir=/var \ - --disable-static \ - --enable-shared \ - -make diff --git a/packages/debug/mesa-demos/install b/packages/debug/mesa-demos/install deleted file mode 100755 index f5870568c8..0000000000 --- a/packages/debug/mesa-demos/install +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -mkdir -p $INSTALL/usr/bin - cp $PKG_BUILD/src/xdemos/glxdemo $INSTALL/usr/bin - cp $PKG_BUILD/src/xdemos/glxgears $INSTALL/usr/bin - cp $PKG_BUILD/src/xdemos/glxinfo $INSTALL/usr/bin diff --git a/packages/debug/mesa-demos/meta b/packages/debug/mesa-demos/meta deleted file mode 100644 index 5a73febaee..0000000000 --- a/packages/debug/mesa-demos/meta +++ /dev/null @@ -1,36 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -PKG_NAME="mesa-demos" -PKG_VERSION="8.0.1" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="OSS" -PKG_SITE="http://www.mesa3d.org/" -PKG_URL="ftp://ftp.freedesktop.org/pub/mesa/demos/$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS="libX11 glu" -PKG_BUILD_DEPENDS="toolchain libX11 Mesa glu glew" -PKG_PRIORITY="optional" -PKG_SECTION="debug" -PKG_SHORTDESC="mesa-demos: Mesa 3D demos" -PKG_LONGDESC="Mesa 3D demos - installed are the well known glxinfo and glxgears." -PKG_IS_ADDON="no" - -PKG_AUTORECONF="yes" diff --git a/packages/debug/mrxvt/build b/packages/debug/mrxvt/build deleted file mode 100755 index 0dd3dcce22..0000000000 --- a/packages/debug/mrxvt/build +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -cd $PKG_BUILD -ac_cv_func_setpgrp_void=no \ -./configure --host=$TARGET_NAME \ - --build=$HOST_NAME \ - --prefix=/usr \ - --sysconfdir=/etc \ - --enable-minimal \ - --disable-frills \ - --enable-keepscrolling \ - --disable-selectionscrolling \ - --enable-mousewheel \ - --disable-mouseslipwheel \ - --enable-rxvt-scroll \ - --disable-half-shadow \ - --enable-lastlog \ - --enable-sessionmgr \ - --enable-linespace \ - --enable-24bits \ - --enable-256colors \ - --enable-cursor-blink \ - --enable-pointer-blank \ - --disable-text-shadow \ - --enable-menubar \ - --disable-transparency \ - --disable-tinting \ - --enable-xrender \ - --disable-xpm \ - --disable-jpeg \ - --disable-png \ - --enable-xft \ - --enable-ttygid \ - --enable-backspace-key \ - --enable-delete-key \ - --disable-resources \ - --disable-swapscreen - -# --x-includes=$SYSROOT_PREFIX/usr/include \ -# --x-libraries=$SYSROOT_PREFIX/usr/lib \ - -make - -$STRIP src/$1 diff --git a/packages/debug/mrxvt/install b/packages/debug/mrxvt/install deleted file mode 100755 index e0a84222ed..0000000000 --- a/packages/debug/mrxvt/install +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options - -mkdir -p $INSTALL/usr/bin - cp -P $PKG_DIR/scripts/$1-session $INSTALL/usr/bin - cp -P $PKG_BUILD/src/$1 $INSTALL/usr/bin - diff --git a/packages/debug/mrxvt/meta b/packages/debug/mrxvt/meta deleted file mode 100644 index b4dff10d4f..0000000000 --- a/packages/debug/mrxvt/meta +++ /dev/null @@ -1,36 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -PKG_NAME="mrxvt" -PKG_VERSION="0.5.4" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="GPL" -PKG_SITE="http://materm.sourceforge.net/" -PKG_URL="$SOURCEFORGE_SRC/materm/$PKG_NAME-$PKG_VERSION.tar.gz" -PKG_DEPENDS="libX11 libXrender freetype" -PKG_BUILD_DEPENDS="toolchain libX11 libXrender freetype" -PKG_PRIORITY="optional" -PKG_SECTION="debug" -PKG_SHORTDESC="mrxvt: Lightweight Xterm replacement" -PKG_LONGDESC="Mrxvt (previously named as materm) is a lightweight and powerful multi-tabbed X terminal emulator based on the popular rxvt and aterm. It implements many useful features seen in some modern X terminal emulators, like gnome-terminal and konsole, but keep to be lightweight and independent from the GNOME and KDE desktop environment." -PKG_IS_ADDON="no" - -PKG_AUTORECONF="yes" diff --git a/packages/debug/mrxvt/patches/mrxvt-0.5.4-automake-1.13.patch b/packages/debug/mrxvt/patches/mrxvt-0.5.4-automake-1.13.patch deleted file mode 100644 index b29c058183..0000000000 --- a/packages/debug/mrxvt/patches/mrxvt-0.5.4-automake-1.13.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -Naur mrxvt-0.5.4/configure.ac mrxvt-0.5.4.patch/configure.ac ---- mrxvt-0.5.4/configure.ac 2008-05-12 19:21:56.000000000 +0200 -+++ mrxvt-0.5.4.patch/configure.ac 2013-01-12 01:54:55.819541351 +0100 -@@ -28,7 +28,7 @@ - AC_INIT(mrxvt, 0.5.4, [jimmyzhou@users.sourceforge.net]) - AM_INIT_AUTOMAKE(mrxvt, 0.5.4) - --AM_CONFIG_HEADER(config.h) -+AC_CONFIG_HEADERS(config.h) - AC_CONFIG_SRCDIR([src/main.c]) - - diff --git a/packages/debug/mrxvt/profile.d/52-terminal.conf b/packages/debug/mrxvt/profile.d/52-terminal.conf deleted file mode 100644 index 4174bef2b9..0000000000 --- a/packages/debug/mrxvt/profile.d/52-terminal.conf +++ /dev/null @@ -1,10 +0,0 @@ -################################################################################ -# Core (PATH) environment variables. -# -# This file contains non-OpenELEC evironment variables as well as OpenELEC -# evironment variables that are not user defined. -################################################################################ - -TERMINAL="/usr/bin/mrxvt-session" - -export TERMINAL diff --git a/packages/debug/mrxvt/scripts/mrxvt-session b/packages/debug/mrxvt/scripts/mrxvt-session deleted file mode 100755 index 51e940fba2..0000000000 --- a/packages/debug/mrxvt/scripts/mrxvt-session +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -. /etc/profile - -# start Windowmanager by default - $WINDOWMANAGER -term mrxvt & - -# start terminal - mrxvt diff --git a/packages/debug/meta b/packages/debug/package.mk similarity index 98% rename from packages/debug/meta rename to packages/debug/package.mk index e9078465a3..c88638abe5 100644 --- a/packages/debug/meta +++ b/packages/debug/package.mk @@ -28,10 +28,10 @@ PKG_URL="" PKG_DEPENDS="gdb strace" PKG_BUILD_DEPENDS="toolchain" PKG_PRIORITY="optional" -PKG_SECTION="debug" +PKG_SECTION="virtual" PKG_SHORTDESC="debug: Metapackage for installing debugging tools" PKG_LONGDESC="debug is a Metapackage for installing debugging tools" -PKG_IS_ADDON="no" +PKG_IS_ADDON="no" PKG_AUTORECONF="no" diff --git a/packages/debug/strace/build b/packages/debug/strace/build deleted file mode 100755 index f60f77b31a..0000000000 --- a/packages/debug/strace/build +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -cd $PKG_BUILD -./configure --host=$TARGET_NAME \ - --build=$HOST_NAME - -make diff --git a/packages/debug/strace/install b/packages/debug/strace/install deleted file mode 100755 index 91be57ef46..0000000000 --- a/packages/debug/strace/install +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -mkdir -p $INSTALL/usr/bin - cp $PKG_BUILD/strace $INSTALL/usr/bin diff --git a/packages/debug/strace/meta b/packages/debug/strace/package.mk similarity index 92% rename from packages/debug/strace/meta rename to packages/debug/strace/package.mk index e262773698..014cac7a50 100644 --- a/packages/debug/strace/meta +++ b/packages/debug/strace/package.mk @@ -26,11 +26,16 @@ PKG_LICENSE="BSD" PKG_SITE="http://sourceforge.net/projects/strace/" PKG_URL="$SOURCEFORGE_SRC/strace/strace/$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.xz" PKG_DEPENDS="" -PKG_BUILD_DEPENDS="toolchain" +PKG_BUILD_DEPENDS_TARGET="toolchain" PKG_PRIORITY="optional" PKG_SECTION="debug" PKG_SHORTDESC="strace: Trace system calls and signals" PKG_LONGDESC="In the simplest case strace runs the specified command until it exits. It intercepts and records the system calls which are called by a process and the signals which are received by a process. The name of each system call, its arguments and its return value are printed on standard error or to the file specified with the -o option." -PKG_IS_ADDON="no" +PKG_IS_ADDON="no" PKG_AUTORECONF="yes" + +post_makeinstall_target() { + rm -rf $INSTALL/usr/bin/strace-graph + rm -rf $INSTALL/usr/bin/strace-log-merge +} diff --git a/packages/devel/glib-host/meta b/packages/devel/glib-host/meta index d4bf96045d..ba08408a3d 100644 --- a/packages/devel/glib-host/meta +++ b/packages/devel/glib-host/meta @@ -26,7 +26,7 @@ PKG_LICENSE="LGPL" PKG_SITE="http://www.gtk.org/" PKG_URL="" PKG_DEPENDS="" -PKG_BUILD_DEPENDS="ccache libffi-host zlib-host Python-host" +PKG_BUILD_DEPENDS="ccache libffi-host zlib:host Python-host" PKG_PRIORITY="optional" PKG_SECTION="devel" PKG_SHORTDESC="glib-host: C support library" diff --git a/packages/devel/llvm/build b/packages/devel/llvm/build deleted file mode 100755 index 5269272964..0000000000 --- a/packages/devel/llvm/build +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -# llvm fails to build with LTO support - strip_lto - -if [ "$TARGET_ARCH" = i386 ]; then - LLVM_ARCH=x86 -elif [ "$TARGET_ARCH" = x86_64 ]; then - LLVM_ARCH=x86_64 -fi - -LLVM_DIR=`ls -d $BUILD/llvm-[0-9]*` - -cd $LLVM_DIR - -mkdir -p .build-target && cd .build-target -../configure --host=$TARGET_NAME \ - --build=$HOST_NAME \ - --prefix=/usr \ - --enable-polly \ - --enable-optimized \ - --disable-profiling \ - --disable-assertions \ - --disable-expensive-checks \ - --disable-debug-runtime \ - --disable-debug-symbols \ - --enable-jit \ - --disable-docs \ - --disable-doxygen \ - --enable-threads \ - --enable-pthreads \ - --enable-pic \ - --enable-shared \ - --enable-embed-stdcxx \ - --enable-timestamps \ - --enable-targets=$LLVM_ARCH \ - --disable-libffi \ - --disable-ltdl-install \ - -LLVM_TBLGEN="$ROOT/$TOOLCHAIN/bin/llvm-tblgen" \ -make - -LLVM_TBLGEN="$ROOT/$TOOLCHAIN/bin/llvm-tblgen" \ -$MAKEINSTALL - -#TCLSH="$ROOT/$TOOLCHAIN/bin/tclsh" \ diff --git a/packages/devel/llvm/install b/packages/devel/llvm/install deleted file mode 100755 index e35717f56f..0000000000 --- a/packages/devel/llvm/install +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -mkdir -p $INSTALL/usr/lib - cp -P $PKG_BUILD/.build-target/Release/lib/libLLVM-*.so $INSTALL/usr/lib - diff --git a/packages/devel/llvm/meta b/packages/devel/llvm/meta deleted file mode 100644 index fedfc7d600..0000000000 --- a/packages/devel/llvm/meta +++ /dev/null @@ -1,36 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -PKG_NAME="llvm" -PKG_VERSION="3.0" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="GPL" -PKG_SITE="http://llvm.org/" -PKG_URL="http://llvm.org/releases/$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.gz" -PKG_DEPENDS="" -PKG_BUILD_DEPENDS="toolchain llvm-host" -PKG_PRIORITY="optional" -PKG_SECTION="toolchain/lang" -PKG_SHORTDESC="llvm: Low Level Virtual Machine" -PKG_LONGDESC="Low-Level Virtual Machine (LLVM) is a compiler infrastructure designed for compile-time, link-time, run-time, and "idle-time" optimization of programs from arbitrary programming languages. It currently supports compilation of C, Objective-C, and C++ programs, using front-ends derived from GCC 4.0, GCC 4.2, and a custom new front-end, "clang". It supports x86, x86-64, ia64, PowerPC, and SPARC, with support for Alpha and ARM under development." -PKG_IS_ADDON="no" - -PKG_AUTORECONF="no" diff --git a/packages/devel/llvm/package.mk b/packages/devel/llvm/package.mk new file mode 100644 index 0000000000..1c689bd520 --- /dev/null +++ b/packages/devel/llvm/package.mk @@ -0,0 +1,107 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) +# +# 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 OpenELEC.tv; see the file COPYING. If not, write to +# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ + +PKG_NAME="llvm" +PKG_VERSION="3.0" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://llvm.org/" +PKG_URL="http://llvm.org/releases/$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS="" +PKG_BUILD_DEPENDS_TARGET="toolchain llvm:host" +PKG_BUILD_DEPENDS_HOST="toolchain" +PKG_PRIORITY="optional" +PKG_SECTION="toolchain/lang" +PKG_SHORTDESC="llvm: Low Level Virtual Machine" +PKG_LONGDESC="Low-Level Virtual Machine (LLVM) is a compiler infrastructure designed for compile-time, link-time, run-time, and idle-time optimization of programs from arbitrary programming languages. It currently supports compilation of C, Objective-C, and C++ programs, using front-ends derived from GCC 4.0, GCC 4.2, and a custom new front-end, "clang". It supports x86, x86-64, ia64, PowerPC, and SPARC, with support for Alpha and ARM under development." + +PKG_IS_ADDON="no" +PKG_AUTORECONF="no" + +# package specific configure options +PKG_CONFIGURE_OPTS_HOST="--enable-polly \ + --enable-optimized \ + --disable-profiling \ + --disable-assertions \ + --disable-expensive-checks \ + --disable-debug-runtime \ + --disable-debug-symbols \ + --enable-jit \ + --disable-docs \ + --disable-doxygen \ + --enable-threads \ + --enable-pthreads \ + --enable-pic \ + --enable-shared \ + --enable-embed-stdcxx \ + --enable-timestamps \ + --disable-libffi \ + --enable-ltdl-install" + +PKG_CONFIGURE_OPTS_TARGET="--enable-polly \ + --enable-optimized \ + --disable-profiling \ + --disable-assertions \ + --disable-expensive-checks \ + --disable-debug-runtime \ + --disable-debug-symbols \ + --enable-jit \ + --disable-docs \ + --disable-doxygen \ + --enable-threads \ + --enable-pthreads \ + --enable-pic \ + --enable-shared \ + --enable-embed-stdcxx \ + --enable-timestamps \ + --disable-libffi \ + --disable-ltdl-install" + +if [ "$TARGET_ARCH" = i386 ]; then + PKG_CONFIGURE_OPTS_HOST="$PKG_CONFIGURE_OPTS_HOST --enable-targets=x86" + PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET --enable-targets=x86" +elif [ "$TARGET_ARCH" = x86_64 ]; then + PKG_CONFIGURE_OPTS_HOST="$PKG_CONFIGURE_OPTS_HOST --enable-targets=x86_64" + PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET --enable-targets=x86_64" +fi + +PKG_MAKE_OPTS_TARGET="LLVM_TBLGEN=$ROOT/$TOOLCHAIN/bin/llvm-tblgen" +PKG_MAKEINSTALL_OPTS_TARGET="LLVM_TBLGEN=$ROOT/$TOOLCHAIN/bin/llvm-tblgen" + +pre_configure_host() { + ( cd ../autoconf + aclocal --force --verbose -I m4 + autoconf --force --verbose -I m4 -o ../configure + ) +} + +pre_configure_target() { + # llvm fails to build with LTO support + strip_lto +} + +post_makeinstall_target() { + rm -rf $INSTALL/usr/bin + rm -rf $INSTALL/usr/lib/BugpointPasses.so + rm -rf $INSTALL/usr/lib/LLVMHello.so + rm -rf $INSTALL/usr/lib/libLTO.so + rm -rf $INSTALL/usr/lib/libprofile_rt.so +} diff --git a/packages/graphics/Mesa/build b/packages/graphics/Mesa/build deleted file mode 100755 index eacab61cf2..0000000000 --- a/packages/graphics/Mesa/build +++ /dev/null @@ -1,101 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -get_graphicdrivers - -export CC_FOR_BUILD="$HOST_CC" -export CXX_FOR_BUILD="$HOST_CXX" -export CFLAGS_FOR_BUILD="" -export CXXFLAGS_FOR_BUILD="" -export LDFLAGS_FOR_BUILD="" - -export X11_INCLUDES="" -export DRI_DRIVER_INSTALL_DIR="$XORG_PATH_DRI" -export DRI_DRIVER_SEARCH_DIR="$XORG_PATH_DRI" - -if [ "$LLVM_SUPPORT" = "yes" ]; then - export LLVM_CONFIG="$SYSROOT_PREFIX/usr/bin/llvm-config" - MESA_GALLIUM_LLVM="--enable-gallium-llvm --with-llvm-shared-libs" -else - MESA_GALLIUM_LLVM="--disable-gallium-llvm" -fi - -if [ "$MESA_VDPAU_SUPPORT" = "yes" ]; then - MESA_VDPAU="--enable-vdpau" -else - MESA_VDPAU="--disable-vdpau" -fi - -XA_CONFIG="--disable-xa" -for drv in $GRAPHIC_DRIVERS; do - [ "$drv" = "vmware" ] && XA_CONFIG="--enable-xa" -done - -cd $PKG_BUILD - -./configure --host=$TARGET_NAME \ - --build=$HOST_NAME \ - --prefix=/usr \ - --sysconfdir=/etc \ - --localstatedir=/var \ - --disable-static \ - --enable-shared \ - --disable-debug \ - --enable-texture-float \ - --enable-asm \ - --disable-selinux \ - --enable-opengl \ - --enable-glx-tls \ - --enable-driglx-direct \ - --disable-gles1 \ - --disable-gles2 \ - --disable-openvg \ - --enable-dri \ - --enable-glx \ - --disable-osmesa \ - --disable-egl \ - --disable-xorg \ - $XA_CONFIG \ - --disable-gbm \ - --disable-xvmc \ - $MESA_VDPAU \ - --disable-opencl \ - --disable-xlib-glx \ - --disable-gallium-egl \ - --disable-gallium-gbm \ - --disable-r600-llvm-compiler \ - --disable-gallium-tests \ - --enable-shared-glapi \ - --disable-glx-tls \ - --disable-gallium-g3dvl \ - $MESA_GALLIUM_LLVM \ - --disable-silent-rules \ - --with-gl-lib-name=GL \ - --with-osmesa-lib-name=OSMesa \ - --with-gallium-drivers="$GALLIUM_DRIVERS" \ - --with-dri-drivers="$DRI_DRIVERS" \ - -make - -$MAKEINSTALL diff --git a/packages/graphics/Mesa/install b/packages/graphics/Mesa/install deleted file mode 100755 index 21b87e8168..0000000000 --- a/packages/graphics/Mesa/install +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -mkdir -p $INSTALL/usr/lib - cp -P $PKG_BUILD/lib/libGL.so.1 $INSTALL/usr/lib/libGL_mesa.so.1 # rename for cooperate with nvidia drivers - ln -sf libGL.so.1 $INSTALL/usr/lib/libGL.so - ln -sf /var/lib/libGL.so $INSTALL/usr/lib/libGL.so.1 - cp -P $PKG_BUILD/lib/libdricore*.so* $INSTALL/usr/lib || true - cp -P $PKG_BUILD/lib/libglapi.so* $INSTALL/usr/lib - if [ -f $PKG_BUILD/lib/gallium/libxatracker.so ] ; then - cp -P $PKG_BUILD/lib/gallium/libxatracker.so* $INSTALL/usr/lib || true - fi - -mkdir -p $INSTALL/usr/lib/dri - cp -P $PKG_BUILD/lib/*_dri.so $INSTALL/usr/lib/dri || true - cp -P $PKG_BUILD/lib/gallium/*_dri.so $INSTALL/usr/lib/dri || true - -mkdir -p $INSTALL/usr/lib/xorg/modules/drivers - cp -P $PKG_BUILD/lib/gallium/*_drv.so $INSTALL/usr/lib/xorg/modules/drivers || true - -if [ "$MESA_VDPAU_SUPPORT" = "yes" ]; then - mkdir -p $INSTALL/usr/lib/vdpau - cp -P $PKG_BUILD/lib/gallium/libvdpau_*.so* $INSTALL/usr/lib/vdpau -fi diff --git a/packages/graphics/Mesa/meta b/packages/graphics/Mesa/meta deleted file mode 100644 index 3169327517..0000000000 --- a/packages/graphics/Mesa/meta +++ /dev/null @@ -1,57 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -PKG_NAME="Mesa" -PKG_VERSION="9.1.4" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="OSS" -PKG_SITE="http://www.mesa3d.org/" -PKG_URL="ftp://freedesktop.org/pub/mesa/$PKG_VERSION/MesaLib-$PKG_VERSION.tar.bz2" -PKG_DEPENDS="libXdamage libdrm expat libXext libXfixes libX11" -PKG_BUILD_DEPENDS="toolchain Python-host makedepend libxml2-host expat glproto dri2proto libdrm libXext libXdamage libXfixes libXxf86vm libxcb libX11" -PKG_PRIORITY="optional" -PKG_SECTION="graphics" -PKG_SHORTDESC="mesa: 3-D graphics library with OpenGL API" -PKG_LONGDESC="Mesa is a 3-D graphics library with an API which is very similar to that of OpenGL*. To the extent that Mesa utilizes the OpenGL command syntax or state machine, it is being used with authorization from Silicon Graphics, Inc. However, the author makes no claim that Mesa is in any way a compatible replacement for OpenGL or associated with Silicon Graphics, Inc. Those who want a licensed implementation of OpenGL should contact a licensed vendor. While Mesa is not a licensed OpenGL implementation, it is currently being tested with the OpenGL conformance tests. For the current conformance status see the CONFORM file included in the Mesa distribution." -PKG_IS_ADDON="no" - -PKG_AUTORECONF="yes" - -get_graphicdrivers - -if [ "$LLVM_SUPPORT" = "yes" ]; then - PKG_BUILD_DEPENDS="$PKG_BUILD_DEPENDS llvm" - PKG_DEPENDS="$PKG_DEPENDS llvm" -fi - -if [ "$MESA_VDPAU_SUPPORT" = "yes" ]; then - PKG_BUILD_DEPENDS="$PKG_BUILD_DEPENDS libvdpau" - PKG_DEPENDS="$PKG_DEPENDS libvdpau" -fi - -if [ "$MESA_VAAPI_SUPPORT" = "yes" ]; then - PKG_BUILD_DEPENDS="$PKG_BUILD_DEPENDS libva" - PKG_DEPENDS="$PKG_DEPENDS libva" -fi - -if [ "$DEVTOOLS" = yes ]; then - PKG_DEPENDS="$PKG_DEPENDS mesa-demos" -fi diff --git a/packages/graphics/Mesa/package.mk b/packages/graphics/Mesa/package.mk new file mode 100644 index 0000000000..6b8a68802b --- /dev/null +++ b/packages/graphics/Mesa/package.mk @@ -0,0 +1,117 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) +# +# 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 OpenELEC.tv; see the file COPYING. If not, write to +# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ + +PKG_NAME="Mesa" +PKG_VERSION="9.1.5" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="OSS" +PKG_SITE="http://www.mesa3d.org/" +PKG_URL="ftp://freedesktop.org/pub/mesa/$PKG_VERSION/MesaLib-$PKG_VERSION.tar.bz2" +PKG_DEPENDS="libXdamage libdrm expat libXext libXfixes libX11" +PKG_BUILD_DEPENDS_TARGET="toolchain Python-host makedepend libxml2-host expat glproto dri2proto libdrm libXext libXdamage libXfixes libXxf86vm libxcb libX11" +PKG_PRIORITY="optional" +PKG_SECTION="graphics" +PKG_SHORTDESC="mesa: 3-D graphics library with OpenGL API" +PKG_LONGDESC="Mesa is a 3-D graphics library with an API which is very similar to that of OpenGL*. To the extent that Mesa utilizes the OpenGL command syntax or state machine, it is being used with authorization from Silicon Graphics, Inc. However, the author makes no claim that Mesa is in any way a compatible replacement for OpenGL or associated with Silicon Graphics, Inc. Those who want a licensed implementation of OpenGL should contact a licensed vendor. While Mesa is not a licensed OpenGL implementation, it is currently being tested with the OpenGL conformance tests. For the current conformance status see the CONFORM file included in the Mesa distribution." + +PKG_IS_ADDON="no" +PKG_AUTORECONF="yes" + +if [ "$LLVM_SUPPORT" = "yes" ]; then + PKG_BUILD_DEPENDS_TARGET="$PKG_BUILD_DEPENDS_TARGET llvm" + PKG_DEPENDS="$PKG_DEPENDS llvm" + LLVM_CONFIG="$SYSROOT_PREFIX/usr/bin/llvm-config" + MESA_GALLIUM_LLVM="--enable-gallium-llvm --with-llvm-shared-libs" +else + MESA_GALLIUM_LLVM="--disable-gallium-llvm" +fi + +if [ "$MESA_VDPAU_SUPPORT" = "yes" ]; then + PKG_BUILD_DEPENDS_TARGET="$PKG_BUILD_DEPENDS_TARGET libvdpau" + PKG_DEPENDS="$PKG_DEPENDS libvdpau" + MESA_VDPAU="--enable-vdpau" +else + MESA_VDPAU="--disable-vdpau" +fi + +if [ "$MESA_VAAPI_SUPPORT" = "yes" ]; then + PKG_BUILD_DEPENDS_TARGET="$PKG_BUILD_DEPENDS_TARGET libva" + PKG_DEPENDS="$PKG_DEPENDS libva" +fi + +get_graphicdrivers + +XA_CONFIG="--disable-xa" +for drv in $GRAPHIC_DRIVERS; do + [ "$drv" = "vmware" ] && XA_CONFIG="--enable-xa" +done + +PKG_CONFIGURE_OPTS_TARGET="CC_FOR_BUILD=$HOST_CC \ + CXX_FOR_BUILD=$HOST_CXX \ + CFLAGS_FOR_BUILD= \ + CXXFLAGS_FOR_BUILD= \ + LDFLAGS_FOR_BUILD= \ + X11_INCLUDES= \ + DRI_DRIVER_INSTALL_DIR=$XORG_PATH_DRI \ + DRI_DRIVER_SEARCH_DIR=$XORG_PATH_DRI \ + --disable-debug \ + --enable-texture-float \ + --enable-asm \ + --disable-selinux \ + --enable-opengl \ + --enable-glx-tls \ + --enable-driglx-direct \ + --disable-gles1 \ + --disable-gles2 \ + --disable-openvg \ + --enable-dri \ + --enable-glx \ + --disable-osmesa \ + --disable-egl \ + --disable-xorg \ + $XA_CONFIG \ + --disable-gbm \ + --disable-xvmc \ + $MESA_VDPAU \ + --disable-opencl \ + --disable-xlib-glx \ + --disable-gallium-egl \ + --disable-gallium-gbm \ + --disable-r600-llvm-compiler \ + --disable-gallium-tests \ + --enable-shared-glapi \ + --disable-glx-tls \ + --disable-gallium-g3dvl \ + $MESA_GALLIUM_LLVM \ + --disable-silent-rules \ + --with-gl-lib-name=GL \ + --with-osmesa-lib-name=OSMesa \ + --with-gallium-drivers=$GALLIUM_DRIVERS \ + --with-dri-drivers=$DRI_DRIVERS" + +post_makeinstall_target() { + # rename and relink for cooperate with nvidia drivers + rm -rf $INSTALL/usr/lib/libGL.so + rm -rf $INSTALL/usr/lib/libGL.so.1 + ln -sf libGL.so.1 $INSTALL/usr/lib/libGL.so + ln -sf /var/lib/libGL.so $INSTALL/usr/lib/libGL.so.1 + mv $INSTALL/usr/lib/libGL.so.1.2.0 $INSTALL/usr/lib/libGL_mesa.so.1 +} diff --git a/packages/graphics/bcm2835-driver/build b/packages/graphics/bcm2835-driver/build deleted file mode 100755 index d8b14c9e43..0000000000 --- a/packages/graphics/bcm2835-driver/build +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -if [ "$TARGET_FLOAT" = "softfp" -o "$TARGET_FLOAT" = "soft" ]; then - FLOAT="softfp" -elif [ "$TARGET_FLOAT" = "hard" ]; then - FLOAT="hardfp" -fi - -cd $PKG_BUILD -mkdir -p $SYSROOT_PREFIX/usr/include - cp -PR $FLOAT/opt/vc/include/* $SYSROOT_PREFIX/usr/include - -mkdir -p $SYSROOT_PREFIX/usr/lib - cp -PR $FLOAT/opt/vc/lib/libEGL.so $SYSROOT_PREFIX/usr/lib - cp -PR $FLOAT/opt/vc/lib/libGLESv2.so $SYSROOT_PREFIX/usr/lib - cp -PR $FLOAT/opt/vc/lib/libbcm_host.so $SYSROOT_PREFIX/usr/lib - cp -PR $FLOAT/opt/vc/lib/libvchiq_arm.so $SYSROOT_PREFIX/usr/lib - cp -PR $FLOAT/opt/vc/lib/libvcos.so $SYSROOT_PREFIX/usr/lib diff --git a/packages/graphics/bcm2835-driver/install b/packages/graphics/bcm2835-driver/install deleted file mode 100755 index a50422577f..0000000000 --- a/packages/graphics/bcm2835-driver/install +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -if [ "$TARGET_FLOAT" = "softfp" -o "$TARGET_FLOAT" = "soft" ]; then - FLOAT="softfp" -elif [ "$TARGET_FLOAT" = "hard" ]; then - FLOAT="hardfp" -fi - -mkdir -p $INSTALL/usr/sbin - cp -PR $PKG_BUILD/$FLOAT/opt/vc/sbin/vcfiled $INSTALL/usr/sbin - -mkdir -p $INSTALL/usr/lib - cp -PR $PKG_BUILD/$FLOAT/opt/vc/lib/libEGL.so $INSTALL/usr/lib - cp -PR $PKG_BUILD/$FLOAT/opt/vc/lib/libGLESv2.so $INSTALL/usr/lib - cp -PR $PKG_BUILD/$FLOAT/opt/vc/lib/libbcm_host.so $INSTALL/usr/lib - cp -PR $PKG_BUILD/$FLOAT/opt/vc/lib/libopenmaxil.so $INSTALL/usr/lib - cp -PR $PKG_BUILD/$FLOAT/opt/vc/lib/libvchiq_arm.so $INSTALL/usr/lib - cp -PR $PKG_BUILD/$FLOAT/opt/vc/lib/libvcos.so $INSTALL/usr/lib - -# some usefull debug tools -mkdir -p $INSTALL/usr/bin - cp -PR $PKG_BUILD/$FLOAT/opt/vc/bin/vcdbg $INSTALL/usr/bin - cp -PR $PKG_BUILD/$FLOAT/opt/vc/lib/libdebug_sym.so $INSTALL/usr/lib - cp -PR $PKG_BUILD/$FLOAT/opt/vc/bin/vcgencmd $INSTALL/usr/bin - cp -PR $PKG_BUILD/$FLOAT/opt/vc/bin/tvservice $INSTALL/usr/bin - cp -PR $PKG_BUILD/$FLOAT/opt/vc/bin/edidparser $INSTALL/usr/bin - -mkdir -p $INSTALL/opt/vc - ln -sf /usr/lib $INSTALL/opt/vc/lib diff --git a/packages/graphics/bcm2835-driver/meta b/packages/graphics/bcm2835-driver/meta deleted file mode 100644 index 455375416b..0000000000 --- a/packages/graphics/bcm2835-driver/meta +++ /dev/null @@ -1,36 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -PKG_NAME="bcm2835-driver" -PKG_VERSION="e11b332" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="nonfree" -PKG_SITE="http://www.broadcom.com" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" -PKG_DEPENDS="" -PKG_BUILD_DEPENDS="toolchain" -PKG_PRIORITY="optional" -PKG_SECTION="graphics" -PKG_SHORTDESC="OpenMAX-bcm2835: OpenGL-ES and OpenMAX driver for BCM2835" -PKG_LONGDESC="OpenMAX-bcm2835: OpenGL-ES and OpenMAX driver for BCM2835" -PKG_IS_ADDON="no" - -PKG_AUTORECONF="no" diff --git a/packages/graphics/bcm2835-driver/package.mk b/packages/graphics/bcm2835-driver/package.mk new file mode 100644 index 0000000000..7a1f89a218 --- /dev/null +++ b/packages/graphics/bcm2835-driver/package.mk @@ -0,0 +1,78 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) +# +# 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 OpenELEC.tv; see the file COPYING. If not, write to +# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ + +PKG_NAME="bcm2835-driver" +PKG_VERSION="82ca326" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="nonfree" +PKG_SITE="http://www.broadcom.com" +PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_DEPENDS="" +PKG_BUILD_DEPENDS_TARGET="toolchain" +PKG_PRIORITY="optional" +PKG_SECTION="graphics" +PKG_SHORTDESC="OpenMAX-bcm2835: OpenGL-ES and OpenMAX driver for BCM2835" +PKG_LONGDESC="OpenMAX-bcm2835: OpenGL-ES and OpenMAX driver for BCM2835" + +PKG_IS_ADDON="no" +PKG_AUTORECONF="no" + +if [ "$TARGET_FLOAT" = "softfp" -o "$TARGET_FLOAT" = "soft" ]; then + FLOAT="softfp" +elif [ "$TARGET_FLOAT" = "hard" ]; then + FLOAT="hardfp" +fi + +make_target() { + mkdir -p $SYSROOT_PREFIX/usr/include + cp -PRv $FLOAT/opt/vc/include/* $SYSROOT_PREFIX/usr/include + + mkdir -p $SYSROOT_PREFIX/usr/lib + cp -PRv $FLOAT/opt/vc/lib/libEGL.so $SYSROOT_PREFIX/usr/lib + cp -PRv $FLOAT/opt/vc/lib/libGLESv2.so $SYSROOT_PREFIX/usr/lib + cp -PRv $FLOAT/opt/vc/lib/libbcm_host.so $SYSROOT_PREFIX/usr/lib + cp -PRv $FLOAT/opt/vc/lib/libvchiq_arm.so $SYSROOT_PREFIX/usr/lib + cp -PRv $FLOAT/opt/vc/lib/libvcos.so $SYSROOT_PREFIX/usr/lib +} + +makeinstall_target() { + mkdir -p $INSTALL/usr/sbin + cp -PRv $FLOAT/opt/vc/sbin/vcfiled $INSTALL/usr/sbin + + mkdir -p $INSTALL/usr/lib + cp -PRv $FLOAT/opt/vc/lib/libEGL.so $INSTALL/usr/lib + cp -PRv $FLOAT/opt/vc/lib/libGLESv2.so $INSTALL/usr/lib + cp -PRv $FLOAT/opt/vc/lib/libbcm_host.so $INSTALL/usr/lib + cp -PRv $FLOAT/opt/vc/lib/libopenmaxil.so $INSTALL/usr/lib + cp -PRv $FLOAT/opt/vc/lib/libvchiq_arm.so $INSTALL/usr/lib + cp -PRv $FLOAT/opt/vc/lib/libvcos.so $INSTALL/usr/lib + +# some usefull debug tools + mkdir -p $INSTALL/usr/bin + cp -PRv $FLOAT/opt/vc/bin/vcdbg $INSTALL/usr/bin + cp -PRv $FLOAT/opt/vc/lib/libdebug_sym.so $INSTALL/usr/lib + cp -PRv $FLOAT/opt/vc/bin/vcgencmd $INSTALL/usr/bin + cp -PRv $FLOAT/opt/vc/bin/tvservice $INSTALL/usr/bin + cp -PRv $FLOAT/opt/vc/bin/edidparser $INSTALL/usr/bin + + mkdir -p $INSTALL/opt/vc + ln -sf /usr/lib $INSTALL/opt/vc/lib +} diff --git a/packages/graphics/libpng-host/meta b/packages/graphics/libpng-host/meta index 0d724b9745..cbcfe00942 100644 --- a/packages/graphics/libpng-host/meta +++ b/packages/graphics/libpng-host/meta @@ -26,7 +26,7 @@ PKG_LICENSE="OSS" PKG_SITE="http://www.libpng.org/" PKG_URL="" PKG_DEPENDS="" -PKG_BUILD_DEPENDS="toolchain zlib-host" +PKG_BUILD_DEPENDS="toolchain zlib:host" PKG_PRIORITY="optional" PKG_SECTION="graphics" PKG_SHORTDESC="libpng: Portable Network Graphics (PNG) Reference Library" diff --git a/packages/initramfs/compress/zlib-initramfs/install b/packages/initramfs/compress/zlib-initramfs/install index 2a938a9674..d464224d8b 100755 --- a/packages/initramfs/compress/zlib-initramfs/install +++ b/packages/initramfs/compress/zlib-initramfs/install @@ -25,4 +25,4 @@ ZLIB_DIR="$BUILD/zlib-[0-9]*" mkdir -p $INSTALL/lib - cp -R $ZLIB_DIR/*.so* $INSTALL/lib + cp -R $ZLIB_DIR/.install_pkg/usr/lib/*.so* $INSTALL/lib diff --git a/packages/initramfs/sysutils/busybox-initramfs/build b/packages/initramfs/sysutils/busybox-initramfs/build index 509fec906f..bd6fb25c94 100755 --- a/packages/initramfs/sysutils/busybox-initramfs/build +++ b/packages/initramfs/sysutils/busybox-initramfs/build @@ -27,7 +27,7 @@ $SCRIPTS/unpack busybox if [ -f $PROJECT_DIR/$PROJECT/busybox/$1.conf ]; then BUSYBOX_CFG_FILE=$PROJECT_DIR/$PROJECT/busybox/$1.conf else - BUSYBOX_CFG_FILE=$ROOT/$PKG_DIR/config/$1.conf + BUSYBOX_CFG_FILE=$PKG_DIR/config/$1.conf fi # optimize for size diff --git a/packages/linux-firmware/wlan-firmware/meta b/packages/linux-firmware/wlan-firmware/meta index f1541da996..4ec73ad0fe 100644 --- a/packages/linux-firmware/wlan-firmware/meta +++ b/packages/linux-firmware/wlan-firmware/meta @@ -19,7 +19,7 @@ ################################################################################ PKG_NAME="wlan-firmware" -PKG_VERSION="0.0.12" +PKG_VERSION="0.0.13" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="Free-to-use" diff --git a/packages/linux/meta b/packages/linux/meta index ccd2c667f9..a0cd50163f 100644 --- a/packages/linux/meta +++ b/packages/linux/meta @@ -34,7 +34,7 @@ case "$LINUX" in PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.bz2" ;; *) - PKG_VERSION="3.10.1" + PKG_VERSION="3.10.2" PKG_URL="http://www.kernel.org/pub/linux/kernel/v3.x/$PKG_NAME-$PKG_VERSION.tar.xz" ;; esac diff --git a/packages/linux/patches/3.10.1/linux-003-no_dev_console.patch b/packages/linux/patches/3.10.2/linux-003-no_dev_console.patch similarity index 100% rename from packages/linux/patches/3.10.1/linux-003-no_dev_console.patch rename to packages/linux/patches/3.10.2/linux-003-no_dev_console.patch diff --git a/packages/linux/patches/3.10.1/linux-010-perf_crosscompiling.patch b/packages/linux/patches/3.10.2/linux-010-perf_crosscompiling.patch similarity index 100% rename from packages/linux/patches/3.10.1/linux-010-perf_crosscompiling.patch rename to packages/linux/patches/3.10.2/linux-010-perf_crosscompiling.patch diff --git a/packages/linux/patches/3.10.1/linux-052-XBOX_remote_support.patch b/packages/linux/patches/3.10.2/linux-052-XBOX_remote_support.patch similarity index 100% rename from packages/linux/patches/3.10.1/linux-052-XBOX_remote_support.patch rename to packages/linux/patches/3.10.2/linux-052-XBOX_remote_support.patch diff --git a/packages/linux/patches/3.10.1/linux-053-spinelplus-remote-0.2.patch b/packages/linux/patches/3.10.2/linux-053-spinelplus-remote-0.2.patch similarity index 100% rename from packages/linux/patches/3.10.1/linux-053-spinelplus-remote-0.2.patch rename to packages/linux/patches/3.10.2/linux-053-spinelplus-remote-0.2.patch diff --git a/packages/linux/patches/3.10.1/linux-054-nuvoton_revert_d7b290a1056c5564eec8a1b169c6e84ff3.6.114c13.patch b/packages/linux/patches/3.10.2/linux-054-nuvoton_revert_d7b290a1056c5564eec8a1b169c6e84ff3.6.114c13.patch similarity index 100% rename from packages/linux/patches/3.10.1/linux-054-nuvoton_revert_d7b290a1056c5564eec8a1b169c6e84ff3.6.114c13.patch rename to packages/linux/patches/3.10.2/linux-054-nuvoton_revert_d7b290a1056c5564eec8a1b169c6e84ff3.6.114c13.patch diff --git a/packages/linux/patches/3.10.1/linux-055-add_Formosa_eHome_Infrared_Receiver.patch b/packages/linux/patches/3.10.2/linux-055-add_Formosa_eHome_Infrared_Receiver.patch similarity index 100% rename from packages/linux/patches/3.10.1/linux-055-add_Formosa_eHome_Infrared_Receiver.patch rename to packages/linux/patches/3.10.2/linux-055-add_Formosa_eHome_Infrared_Receiver.patch diff --git a/packages/linux/patches/3.10.1/linux-056-add_Adaptec_eHome_Infrared_Receiver.patch b/packages/linux/patches/3.10.2/linux-056-add_Adaptec_eHome_Infrared_Receiver.patch similarity index 100% rename from packages/linux/patches/3.10.1/linux-056-add_Adaptec_eHome_Infrared_Receiver.patch rename to packages/linux/patches/3.10.2/linux-056-add_Adaptec_eHome_Infrared_Receiver.patch diff --git a/packages/linux/patches/3.10.1/linux-057-Removed-MCE-customer-code-restriction-in-rc6-decode.patch b/packages/linux/patches/3.10.2/linux-057-Removed-MCE-customer-code-restriction-in-rc6-decode.patch similarity index 100% rename from packages/linux/patches/3.10.1/linux-057-Removed-MCE-customer-code-restriction-in-rc6-decode.patch rename to packages/linux/patches/3.10.2/linux-057-Removed-MCE-customer-code-restriction-in-rc6-decode.patch diff --git a/packages/linux/patches/3.10.1/linux-057-add_SMK_Manufacturing_Inc_Infrared_Receiver.patch b/packages/linux/patches/3.10.2/linux-057-add_SMK_Manufacturing_Inc_Infrared_Receiver.patch similarity index 100% rename from packages/linux/patches/3.10.1/linux-057-add_SMK_Manufacturing_Inc_Infrared_Receiver.patch rename to packages/linux/patches/3.10.2/linux-057-add_SMK_Manufacturing_Inc_Infrared_Receiver.patch diff --git a/packages/linux/patches/3.10.1/linux-058.01-HID-Sony-upstream_patches.patch b/packages/linux/patches/3.10.2/linux-058.01-HID-Sony-upstream_patches.patch similarity index 100% rename from packages/linux/patches/3.10.1/linux-058.01-HID-Sony-upstream_patches.patch rename to packages/linux/patches/3.10.2/linux-058.01-HID-Sony-upstream_patches.patch diff --git a/packages/linux/patches/3.10.1/linux-058.05-hid_sony-add_autorepeat_for_PS3_remotes.patch b/packages/linux/patches/3.10.2/linux-058.05-hid_sony-add_autorepeat_for_PS3_remotes.patch similarity index 100% rename from packages/linux/patches/3.10.1/linux-058.05-hid_sony-add_autorepeat_for_PS3_remotes.patch rename to packages/linux/patches/3.10.2/linux-058.05-hid_sony-add_autorepeat_for_PS3_remotes.patch diff --git a/packages/linux/patches/3.10.1/linux-059-remove_some_xpad_pids-0.2.patch b/packages/linux/patches/3.10.2/linux-059-remove_some_xpad_pids-0.2.patch similarity index 100% rename from packages/linux/patches/3.10.1/linux-059-remove_some_xpad_pids-0.2.patch rename to packages/linux/patches/3.10.2/linux-059-remove_some_xpad_pids-0.2.patch diff --git a/packages/linux/patches/3.10.1/linux-060-add_AUGUST_DVB-T205.patch b/packages/linux/patches/3.10.2/linux-060-add_AUGUST_DVB-T205.patch similarity index 100% rename from packages/linux/patches/3.10.1/linux-060-add_AUGUST_DVB-T205.patch rename to packages/linux/patches/3.10.2/linux-060-add_AUGUST_DVB-T205.patch diff --git a/packages/linux/patches/3.10.1/linux-203-stb0899_enable_low_symbol_rate.patch b/packages/linux/patches/3.10.2/linux-203-stb0899_enable_low_symbol_rate.patch similarity index 100% rename from packages/linux/patches/3.10.1/linux-203-stb0899_enable_low_symbol_rate.patch rename to packages/linux/patches/3.10.2/linux-203-stb0899_enable_low_symbol_rate.patch diff --git a/packages/linux/patches/3.10.1/linux-210-dvbsky.patch b/packages/linux/patches/3.10.2/linux-210-dvbsky.patch similarity index 100% rename from packages/linux/patches/3.10.1/linux-210-dvbsky.patch rename to packages/linux/patches/3.10.2/linux-210-dvbsky.patch diff --git a/packages/linux/patches/3.10.1/linux-212-mantis_stb0899_faster_lock.patch b/packages/linux/patches/3.10.2/linux-212-mantis_stb0899_faster_lock.patch similarity index 100% rename from packages/linux/patches/3.10.1/linux-212-mantis_stb0899_faster_lock.patch rename to packages/linux/patches/3.10.2/linux-212-mantis_stb0899_faster_lock.patch diff --git a/packages/linux/patches/3.10.1/linux-221-ngene-octopus.patch b/packages/linux/patches/3.10.2/linux-221-ngene-octopus.patch similarity index 100% rename from packages/linux/patches/3.10.1/linux-221-ngene-octopus.patch rename to packages/linux/patches/3.10.2/linux-221-ngene-octopus.patch diff --git a/packages/linux/patches/3.10.1/linux-222-stb0899_signal_quality.patch b/packages/linux/patches/3.10.2/linux-222-stb0899_signal_quality.patch similarity index 100% rename from packages/linux/patches/3.10.1/linux-222-stb0899_signal_quality.patch rename to packages/linux/patches/3.10.2/linux-222-stb0899_signal_quality.patch diff --git a/packages/linux/patches/3.10.1/linux-223-Fix-video-artifacts-with-tt-3600-s2-usb.patch b/packages/linux/patches/3.10.2/linux-223-Fix-video-artifacts-with-tt-3600-s2-usb.patch similarity index 100% rename from packages/linux/patches/3.10.1/linux-223-Fix-video-artifacts-with-tt-3600-s2-usb.patch rename to packages/linux/patches/3.10.2/linux-223-Fix-video-artifacts-with-tt-3600-s2-usb.patch diff --git a/packages/linux/patches/3.10.1/linux-700-jmicron_1_0_8_5.patch b/packages/linux/patches/3.10.2/linux-700-jmicron_1_0_8_5.patch similarity index 100% rename from packages/linux/patches/3.10.1/linux-700-jmicron_1_0_8_5.patch rename to packages/linux/patches/3.10.2/linux-700-jmicron_1_0_8_5.patch diff --git a/packages/linux/patches/3.10.2/linux-701-linksys_aes2500_brcmfmac.patch b/packages/linux/patches/3.10.2/linux-701-linksys_aes2500_brcmfmac.patch new file mode 100644 index 0000000000..639a6ab30b --- /dev/null +++ b/packages/linux/patches/3.10.2/linux-701-linksys_aes2500_brcmfmac.patch @@ -0,0 +1,21 @@ +--- a/drivers/net/wireless/brcm80211/brcmfmac/usb.c 2013-07-21 16:06:37.443909481 +0200 ++++ b/drivers/net/wireless/brcm80211/brcmfmac/usb.c 2013-07-21 16:11:10.696335476 +0200 +@@ -1470,15 +1470,18 @@ + } + + #define BRCMF_USB_VENDOR_ID_BROADCOM 0x0a5c ++#define BRCMF_USB_VENDOR_ID_LINKSYS 0x13b1 + #define BRCMF_USB_DEVICE_ID_43143 0xbd1e + #define BRCMF_USB_DEVICE_ID_43236 0xbd17 + #define BRCMF_USB_DEVICE_ID_43242 0xbd1f ++#define BRCMF_USB_DEVICE_ID_AE2500 0x003a + #define BRCMF_USB_DEVICE_ID_BCMFW 0x0bdc + + static struct usb_device_id brcmf_usb_devid_table[] = { + { USB_DEVICE(BRCMF_USB_VENDOR_ID_BROADCOM, BRCMF_USB_DEVICE_ID_43143) }, + { USB_DEVICE(BRCMF_USB_VENDOR_ID_BROADCOM, BRCMF_USB_DEVICE_ID_43236) }, + { USB_DEVICE(BRCMF_USB_VENDOR_ID_BROADCOM, BRCMF_USB_DEVICE_ID_43242) }, ++ { USB_DEVICE(BRCMF_USB_VENDOR_ID_LINKSYS, BRCMF_USB_DEVICE_ID_AE2500) }, + /* special entry for device with firmware loaded and running */ + { USB_DEVICE(BRCMF_USB_VENDOR_ID_BROADCOM, BRCMF_USB_DEVICE_ID_BCMFW) }, + { } diff --git a/packages/linux/patches/3.10.1/linux-999.01-Support-for-cheap-Ralink-3070-WiFi-plug.patch b/packages/linux/patches/3.10.2/linux-702-Support-for-cheap-Ralink-3070-WiFi-plug.patch similarity index 100% rename from packages/linux/patches/3.10.1/linux-999.01-Support-for-cheap-Ralink-3070-WiFi-plug.patch rename to packages/linux/patches/3.10.2/linux-702-Support-for-cheap-Ralink-3070-WiFi-plug.patch diff --git a/packages/linux/patches/3.10.1/linux-996-macmini2012-ethernet.patch b/packages/linux/patches/3.10.2/linux-703-macmini2012-ethernet.patch similarity index 100% rename from packages/linux/patches/3.10.1/linux-996-macmini2012-ethernet.patch rename to packages/linux/patches/3.10.2/linux-703-macmini2012-ethernet.patch diff --git a/packages/linux/patches/3.10.1/linux-900-hide_tsc_error.patch b/packages/linux/patches/3.10.2/linux-900-hide_tsc_error.patch similarity index 100% rename from packages/linux/patches/3.10.1/linux-900-hide_tsc_error.patch rename to packages/linux/patches/3.10.2/linux-900-hide_tsc_error.patch diff --git a/packages/linux/patches/3.10.1/linux-950-saa716x_PCIe_interface_chipset.patch b/packages/linux/patches/3.10.2/linux-950-saa716x_PCIe_interface_chipset.patch similarity index 100% rename from packages/linux/patches/3.10.1/linux-950-saa716x_PCIe_interface_chipset.patch rename to packages/linux/patches/3.10.2/linux-950-saa716x_PCIe_interface_chipset.patch diff --git a/packages/linux/patches/3.10.1/linux-990.06-hda-Avoid-outputting-HDMI-audio-before-prepare-.patch b/packages/linux/patches/3.10.2/linux-990.06-hda-Avoid-outputting-HDMI-audio-before-prepare-.patch similarity index 100% rename from packages/linux/patches/3.10.1/linux-990.06-hda-Avoid-outputting-HDMI-audio-before-prepare-.patch rename to packages/linux/patches/3.10.2/linux-990.06-hda-Avoid-outputting-HDMI-audio-before-prepare-.patch diff --git a/packages/linux/patches/3.10.1/linux-995-CX24120-13Z_frontend.patch b/packages/linux/patches/3.10.2/linux-995-CX24120-13Z_frontend.patch similarity index 100% rename from packages/linux/patches/3.10.1/linux-995-CX24120-13Z_frontend.patch rename to packages/linux/patches/3.10.2/linux-995-CX24120-13Z_frontend.patch diff --git a/packages/linux/patches/3.10.1/linux-997-disable-rc6-on-sandybridge-gt1.patch b/packages/linux/patches/3.10.2/linux-997-disable-rc6-on-sandybridge-gt1.patch similarity index 100% rename from packages/linux/patches/3.10.1/linux-997-disable-rc6-on-sandybridge-gt1.patch rename to packages/linux/patches/3.10.2/linux-997-disable-rc6-on-sandybridge-gt1.patch diff --git a/packages/linux/patches/3.10.2/linux-999.02-drm-i915-correctly-restore-fences-with-objects-attached.patch b/packages/linux/patches/3.10.2/linux-999.02-drm-i915-correctly-restore-fences-with-objects-attached.patch new file mode 100644 index 0000000000..ce2b44dfdc --- /dev/null +++ b/packages/linux/patches/3.10.2/linux-999.02-drm-i915-correctly-restore-fences-with-objects-attached.patch @@ -0,0 +1,106 @@ +From 94a335dba34ff47cad3d6d0c29b452d43a1be3c8 Mon Sep 17 00:00:00 2001 +From: Daniel Vetter +Date: Wed, 17 Jul 2013 12:51:28 +0000 +Subject: drm/i915: correctly restore fences with objects attached + +To avoid stalls we delay tiling changes and especially hold of +committing the new fence state for as long as possible. +Synchronization points are in the execbuf code and in our gtt fault +handler. + +Unfortunately we've missed that tricky detail when adding proper fence +restore code in + +commit 19b2dbde5732170a03bd82cc8bd442cf88d856f7 +Author: Chris Wilson +Date: Wed Jun 12 10:15:12 2013 +0100 + + drm/i915: Restore fences after resume and GPU resets + +The result was that we've restored fences for objects with no tiling, +since the object<->fence link still existed after resume. Now that +wouldn't have been too bad since any subsequent access would have +fixed things up, but if we've changed from tiled to untiled real havoc +happened: + +The tiling stride is stored -1 in the fence register, so a stride of 0 +resulted in all 1s in the top 32bits, and so a completely bogus fence +spanning everything from the start of the object to the top of the +GTT. The tell-tale in the register dumps looks like: + + FENCE START 2: 0x0214d001 + FENCE END 2: 0xfffff3ff + +Bit 11 isn't set since the hw doesn't store it, even when writing all +1s (at least on my snb here). + +To prevent such a gaffle in the future add a sanity check for fences +with an untiled object attached in i915_gem_write_fence. + +v2: Fix the WARN, spotted by Chris. + +v3: Trying to reuse get_fences looked ugly and obfuscated the code. +Instead reuse update_fence and to make it really dtrt also move the +fence dirty state clearing into update_fence. + +Cc: Chris Wilson +Cc: Stéphane Marchesin +Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=60530 +Cc: stable@vger.kernel.org (for 3.10 only) +Reviewed-by: Chris Wilson +Tested-by: Matthew Garrett +Tested-by: Björn Bidar +Signed-off-by: Daniel Vetter +--- +diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c +index 97afd26..d9e2208 100644 +--- a/drivers/gpu/drm/i915/i915_gem.c ++++ b/drivers/gpu/drm/i915/i915_gem.c +@@ -2258,7 +2258,17 @@ void i915_gem_restore_fences(struct drm_device *dev) + + for (i = 0; i < dev_priv->num_fence_regs; i++) { + struct drm_i915_fence_reg *reg = &dev_priv->fence_regs[i]; +- i915_gem_write_fence(dev, i, reg->obj); ++ ++ /* ++ * Commit delayed tiling changes if we have an object still ++ * attached to the fence, otherwise just clear the fence. ++ */ ++ if (reg->obj) { ++ i915_gem_object_update_fence(reg->obj, reg, ++ reg->obj->tiling_mode); ++ } else { ++ i915_gem_write_fence(dev, i, NULL); ++ } + } + } + +@@ -2795,6 +2805,10 @@ static void i915_gem_write_fence(struct drm_device *dev, int reg, + if (i915_gem_object_needs_mb(dev_priv->fence_regs[reg].obj)) + mb(); + ++ WARN(obj && (!obj->stride || !obj->tiling_mode), ++ "bogus fence setup with stride: 0x%x, tiling mode: %i\n", ++ obj->stride, obj->tiling_mode); ++ + switch (INTEL_INFO(dev)->gen) { + case 7: + case 6: +@@ -2836,6 +2850,7 @@ static void i915_gem_object_update_fence(struct drm_i915_gem_object *obj, + fence->obj = NULL; + list_del_init(&fence->lru_list); + } ++ obj->fence_dirty = false; + } + + static int +@@ -2965,7 +2980,6 @@ i915_gem_object_get_fence(struct drm_i915_gem_object *obj) + return 0; + + i915_gem_object_update_fence(obj, reg, enable); +- obj->fence_dirty = false; + + return 0; + } +-- +cgit v0.9.0.2-2-gbebe diff --git a/packages/linux/unpack b/packages/linux/unpack index 9621709a31..3a42225898 100755 --- a/packages/linux/unpack +++ b/packages/linux/unpack @@ -50,6 +50,25 @@ sed -i -e "s|^CONFIG_INITRAMFS_SOURCE=.*$|CONFIG_INITRAMFS_SOURCE=\"$ROOT/$BUILD sed -i -e "s|^CONFIG_SWAP=.*$|# CONFIG_SWAP is not set|" $LINUX/.config fi +# disable nfs support if not enabled + if [ ! "$NFS_SUPPORT" = yes ]; then + sed -i -e "s|^CONFIG_NFS_FS=.*$|# CONFIG_NFS_FS is not set|" $LINUX/.config + fi + +# disable cifs support if not enabled + if [ ! "$SAMBA_SUPPORT" = yes ]; then + sed -i -e "s|^CONFIG_CIFS=.*$|# CONFIG_CIFS is not set|" $LINUX/.config + fi + +# disable iscsi support if not enabled + if [ ! "$ISCSI_SUPPORT" = yes ]; then + sed -i -e "s|^CONFIG_SCSI_ISCSI_ATTRS=.*$|# CONFIG_SCSI_ISCSI_ATTRS is not set|" $LINUX/.config + sed -i -e "s|^CONFIG_ISCSI_TCP=.*$|# CONFIG_ISCSI_TCP is not set|" $LINUX/.config + sed -i -e "s|^CONFIG_ISCSI_BOOT_SYSFS=.*$|# CONFIG_ISCSI_BOOT_SYSFS is not set|" $LINUX/.config + sed -i -e "s|^CONFIG_ISCSI_IBFT_FIND=.*$|# CONFIG_ISCSI_IBFT_FIND is not set|" $LINUX/.config + sed -i -e "s|^CONFIG_ISCSI_IBFT=.*$|# CONFIG_ISCSI_IBFT is not set|" $LINUX/.config + fi + # copy some extra firmware to linux tree cp -R $PKG_DIR/firmware/* $LINUX/firmware diff --git a/packages/mediacenter/service.openelec.settings/build b/packages/mediacenter/service.openelec.settings/build index 73831c3b0e..68e9e1dbd2 100755 --- a/packages/mediacenter/service.openelec.settings/build +++ b/packages/mediacenter/service.openelec.settings/build @@ -23,6 +23,10 @@ . config/options $1 cd $PKG_BUILD + # bluetooth is optional + if [ ! "$BLUETOOTH_SUPPORT" = yes ]; then + rm -f resources/lib/modules/bluetooth.py + fi python -Wi -t -B $ROOT/$TOOLCHAIN/lib/python2.7/compileall.py ./resources/lib/ -f rm -rf `find ./resources/lib/ -name "*.py"` diff --git a/packages/mediacenter/service.openelec.settings/meta b/packages/mediacenter/service.openelec.settings/meta index 2c0c214f60..88172665be 100644 --- a/packages/mediacenter/service.openelec.settings/meta +++ b/packages/mediacenter/service.openelec.settings/meta @@ -19,7 +19,7 @@ ################################################################################ PKG_NAME="service.openelec.settings" -PKG_VERSION="0.1.25" +PKG_VERSION="0.1.30" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="prop." diff --git a/packages/mediacenter/xbmc-theme-Confluence/meta b/packages/mediacenter/xbmc-theme-Confluence/meta index 8a7de79748..33c386507e 100644 --- a/packages/mediacenter/xbmc-theme-Confluence/meta +++ b/packages/mediacenter/xbmc-theme-Confluence/meta @@ -19,7 +19,7 @@ ################################################################################ PKG_NAME="xbmc-theme-Confluence" -PKG_VERSION="12.2.0" +PKG_VERSION="12.2-ad84e88" if [ "$XBMC" = "master" ]; then PKG_VERSION="c218d5c" elif [ "$XBMC" = "xbmc-aml" ]; then diff --git a/packages/mediacenter/xbmc/build b/packages/mediacenter/xbmc/build index cad46ad520..8a284b739f 100755 --- a/packages/mediacenter/xbmc/build +++ b/packages/mediacenter/xbmc/build @@ -174,7 +174,7 @@ else XBMC_AFP="--disable-afpclient" fi -if [ "$SAMBA_CLIENT" = yes ]; then +if [ "$SAMBA_SUPPORT" = yes ]; then XBMC_SAMBA="--enable-samba" export LIBS="$LIBS -ltalloc -ltdb -lwbclient" else diff --git a/packages/mediacenter/xbmc/init.d/93_xbmc b/packages/mediacenter/xbmc/init.d/93_xbmc index 05eb267fff..74db285901 100644 --- a/packages/mediacenter/xbmc/init.d/93_xbmc +++ b/packages/mediacenter/xbmc/init.d/93_xbmc @@ -62,6 +62,10 @@ LIRCDEV="/var/run/lirc/lircd" [ -e /var/run/lirc/lircd.irtrans ] && LIRCDEV="/var/run/lirc/lircd.irtrans" XBMC_ARGS="--standalone -fs --lircdev $LIRCDEV" +if [ "$DEBUG" = yes ]; then + XBMC_ARGS="$XBMC_ARGS --debug" +fi + progress "starting XBMC" # hack for Boxee Remote diff --git a/packages/mediacenter/xbmc/meta b/packages/mediacenter/xbmc/meta index cf7539c6a8..0bceee7e02 100644 --- a/packages/mediacenter/xbmc/meta +++ b/packages/mediacenter/xbmc/meta @@ -19,7 +19,7 @@ ################################################################################ PKG_NAME="xbmc" -PKG_VERSION="12.2.0" +PKG_VERSION="12.2-ad84e88" if [ "$XBMC" = "master" ]; then PKG_VERSION="c218d5c" elif [ "$XBMC" = "xbmc-aml" ]; then @@ -41,7 +41,7 @@ PKG_IS_ADDON="no" PKG_AUTORECONF="no" # needed for hosttools (Texturepacker) - PKG_BUILD_DEPENDS="$PKG_BUILD_DEPENDS lzo-host SDL-host SDL_image-host" + PKG_BUILD_DEPENDS="$PKG_BUILD_DEPENDS lzo:host SDL-host SDL_image-host" # some python stuff needed for various addons PKG_DEPENDS="$PKG_DEPENDS Imaging" @@ -84,7 +84,7 @@ fi if [ "$ALSA_SUPPORT" = yes ]; then PKG_BUILD_DEPENDS="$PKG_BUILD_DEPENDS alsa-lib" - PKG_DEPENDS="$PKG_DEPENDS alsa alsa-lib" + PKG_DEPENDS="$PKG_DEPENDS alsa-lib" fi if [ "$PULSEAUDIO_SUPPORT" = yes ]; then @@ -160,7 +160,7 @@ if [ "$AFP_SUPPORT" = yes ]; then PKG_DEPENDS="$PKG_DEPENDS afpfs-ng" fi -if [ "$SAMBA_CLIENT" = yes ]; then +if [ "$SAMBA_SUPPORT" = yes ]; then PKG_BUILD_DEPENDS="$PKG_BUILD_DEPENDS samba" PKG_DEPENDS="$PKG_DEPENDS samba" fi diff --git a/packages/mediacenter/xbmc/patches/12.2-ad84e88/todo/xbmc-990.26.01-PR2890.patch b/packages/mediacenter/xbmc/patches/12.2-ad84e88/todo/xbmc-990.26.01-PR2890.patch new file mode 100644 index 0000000000..ac505a42f8 --- /dev/null +++ b/packages/mediacenter/xbmc/patches/12.2-ad84e88/todo/xbmc-990.26.01-PR2890.patch @@ -0,0 +1,29 @@ +From 86a63c5040e307dcb633a5934ab1b3f9114009f5 Mon Sep 17 00:00:00 2001 +From: arnova +Date: Sun, 23 Jun 2013 23:16:55 +0200 +Subject: [PATCH] changed: Make more obvious we're passing a CFileItem + +--- + xbmc/music/infoscanner/MusicInfoScanner.cpp | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/xbmc/music/infoscanner/MusicInfoScanner.cpp b/xbmc/music/infoscanner/MusicInfoScanner.cpp +index 84a155c..f93d613 100644 +--- a/xbmc/music/infoscanner/MusicInfoScanner.cpp ++++ b/xbmc/music/infoscanner/MusicInfoScanner.cpp +@@ -1009,8 +1009,10 @@ void CMusicInfoScanner::FindArtForAlbums(VECALBUMS &albums, const CStdString &pa + } + } + if (albums.size() == 1 && !albumArt.empty()) +- { // assign to folder thumb as well +- CMusicThumbLoader::SetCachedImage(path, "thumb", albumArt); ++ { ++ // assign to folder thumb as well ++ CFileItem albumItem(path, true); ++ CMusicThumbLoader::SetCachedImage(albumItem, "thumb", albumArt); + } + } + +-- +1.8.1.6 + diff --git a/packages/mediacenter/xbmc/patches/12.2-ad84e88/todo/xbmc-990.26.02-PR2890.patch b/packages/mediacenter/xbmc/patches/12.2-ad84e88/todo/xbmc-990.26.02-PR2890.patch new file mode 100644 index 0000000000..4db4c3470d --- /dev/null +++ b/packages/mediacenter/xbmc/patches/12.2-ad84e88/todo/xbmc-990.26.02-PR2890.patch @@ -0,0 +1,1875 @@ +From 9752e490e40e69d53e9dbb10a972dff533192570 Mon Sep 17 00:00:00 2001 +From: arnova +Date: Fri, 14 Jun 2013 12:55:10 +0200 +Subject: [PATCH 1/6] removed: BackGroundInfo Loader multithreading (no longer + needed) + +--- + xbmc/BackgroundInfoLoader.cpp | 62 +++++------------------------ + xbmc/BackgroundInfoLoader.h | 12 ++---- + xbmc/ThumbLoader.cpp | 4 +- + xbmc/ThumbLoader.h | 2 +- + xbmc/addons/GUIWindowAddonBrowser.cpp | 1 - + xbmc/music/MusicInfoLoader.cpp | 2 +- + xbmc/music/MusicThumbLoader.cpp | 2 +- + xbmc/pictures/PictureThumbLoader.cpp | 2 +- + xbmc/pvr/windows/GUIWindowPVRRecordings.cpp | 1 - + xbmc/settings/AdvancedSettings.cpp | 5 --- + xbmc/settings/AdvancedSettings.h | 1 - + xbmc/video/VideoThumbLoader.cpp | 2 +- + 12 files changed, 21 insertions(+), 75 deletions(-) + +diff --git a/xbmc/BackgroundInfoLoader.cpp b/xbmc/BackgroundInfoLoader.cpp +index 3c76188..0c6de8d 100644 +--- a/xbmc/BackgroundInfoLoader.cpp ++++ b/xbmc/BackgroundInfoLoader.cpp +@@ -26,17 +26,12 @@ + + using namespace std; + +-#define ITEMS_PER_THREAD 5 +- +-CBackgroundInfoLoader::CBackgroundInfoLoader(int nThreads) ++CBackgroundInfoLoader::CBackgroundInfoLoader() : m_thread (NULL) + { + m_bStop = true; + m_pObserver=NULL; + m_pProgressCallback=NULL; + m_pVecItems = NULL; +- m_nRequestedThreads = nThreads; +- m_bStartCalled = false; +- m_nActiveThreads = 0; + } + + CBackgroundInfoLoader::~CBackgroundInfoLoader() +@@ -44,29 +39,16 @@ + StopThread(); + } + +-void CBackgroundInfoLoader::SetNumOfWorkers(int nThreads) +-{ +- m_nRequestedThreads = nThreads; +-} +- + void CBackgroundInfoLoader::Run() + { + try + { + if (m_vecItems.size() > 0) + { +- { +- CSingleLock lock(m_lock); +- if (!m_bStartCalled) +- { +- OnLoaderStart(); +- m_bStartCalled = true; +- } +- } ++ OnLoaderStart(); + + while (!m_bStop) + { +- CSingleLock lock(m_lock); + CFileItemPtr pItem; + vector::iterator iter = m_vecItems.begin(); + if (iter != m_vecItems.end()) +@@ -82,7 +64,6 @@ void CBackgroundInfoLoader::Run() + if ((m_pProgressCallback && m_pProgressCallback->Abort()) || m_bStop) + break; + +- lock.Leave(); + try + { + if (LoadItem(pItem.get()) && m_pObserver) +@@ -95,15 +76,10 @@ void CBackgroundInfoLoader::Run() + } + } + +- CSingleLock lock(m_lock); +- if (m_nActiveThreads == 1) +- OnLoaderFinish(); +- m_nActiveThreads--; +- ++ OnLoaderFinish(); + } + catch (...) + { +- m_nActiveThreads--; + CLog::Log(LOGERROR, "%s - Unhandled exception", __FUNCTION__); + } + } +@@ -122,26 +98,12 @@ void CBackgroundInfoLoader::Load(CFileItemList& items) + + m_pVecItems = &items; + m_bStop = false; +- m_bStartCalled = false; +- +- int nThreads = m_nRequestedThreads; +- if (nThreads == -1) +- nThreads = (m_vecItems.size() / (ITEMS_PER_THREAD+1)) + 1; + +- if (nThreads > g_advancedSettings.m_bgInfoLoaderMaxThreads) +- nThreads = g_advancedSettings.m_bgInfoLoaderMaxThreads; +- +- m_nActiveThreads = nThreads; +- for (int i=0; i < nThreads; i++) +- { +- CThread *pThread = new CThread(this, "Background Loader"); +- pThread->Create(); ++ m_thread = new CThread(this, "Background Loader"); ++ m_thread->Create(); + #ifndef _LINUX +- pThread->SetPriority(THREAD_PRIORITY_BELOW_NORMAL); ++ m_thread->SetPriority(THREAD_PRIORITY_BELOW_NORMAL); + #endif +- m_workers.push_back(pThread); +- } +- + } + + void CBackgroundInfoLoader::StopAsync() +@@ -154,21 +116,19 @@ void CBackgroundInfoLoader::StopThread() + { + StopAsync(); + +- for (int i=0; i<(int)m_workers.size(); i++) ++ if (m_thread) + { +- m_workers[i]->StopThread(); +- delete m_workers[i]; ++ m_thread->StopThread(); ++ delete m_thread; ++ m_thread = NULL; + } +- +- m_workers.clear(); + m_vecItems.clear(); + m_pVecItems = NULL; +- m_nActiveThreads = 0; + } + + bool CBackgroundInfoLoader::IsLoading() + { +- return m_nActiveThreads > 0; ++ return m_thread != NULL; + } + + void CBackgroundInfoLoader::SetObserver(IBackgroundLoaderObserver* pObserver) +diff --git a/xbmc/BackgroundInfoLoader.h b/xbmc/BackgroundInfoLoader.h +index c0c1580..a580605 100644 +--- a/xbmc/BackgroundInfoLoader.h ++++ b/xbmc/BackgroundInfoLoader.h +@@ -40,7 +40,7 @@ class IBackgroundLoaderObserver + class CBackgroundInfoLoader : public IRunnable + { + public: +- CBackgroundInfoLoader(int nThreads=-1); ++ CBackgroundInfoLoader(); + virtual ~CBackgroundInfoLoader(); + + void Load(CFileItemList& items); +@@ -50,11 +50,9 @@ class CBackgroundInfoLoader : public IRunnable + void SetProgressCallback(IProgressCallback* pCallback); + virtual bool LoadItem(CFileItem* pItem) { return false; }; + +- void StopThread(); // will actually stop all worker threads. ++ void StopThread(); // will actually stop the loader thread. + void StopAsync(); // will ask loader to stop as soon as possible, but not block + +- void SetNumOfWorkers(int nThreads); // -1 means auto compute num of required threads +- + protected: + virtual void OnLoaderStart() {}; + virtual void OnLoaderFinish() {}; +@@ -63,14 +61,10 @@ class CBackgroundInfoLoader : public IRunnable + std::vector m_vecItems; // FileItemList would delete the items and we only want to keep a reference. + CCriticalSection m_lock; + +- bool m_bStartCalled; + volatile bool m_bStop; +- int m_nRequestedThreads; +- int m_nActiveThreads; ++ CThread *m_thread; + + IBackgroundLoaderObserver* m_pObserver; + IProgressCallback* m_pProgressCallback; +- +- std::vector m_workers; + }; + +diff --git a/xbmc/ThumbLoader.cpp b/xbmc/ThumbLoader.cpp +index a6997c8..8382acf 100644 +--- a/xbmc/ThumbLoader.cpp ++++ b/xbmc/ThumbLoader.cpp +@@ -26,8 +26,8 @@ + using namespace std; + using namespace XFILE; + +-CThumbLoader::CThumbLoader(int nThreads) : +- CBackgroundInfoLoader(nThreads) ++CThumbLoader::CThumbLoader() : ++ CBackgroundInfoLoader() + { + } + +diff --git a/xbmc/ThumbLoader.h b/xbmc/ThumbLoader.h +index a06680f..655d528 100644 +--- a/xbmc/ThumbLoader.h ++++ b/xbmc/ThumbLoader.h +@@ -25,7 +25,7 @@ + class CThumbLoader : public CBackgroundInfoLoader + { + public: +- CThumbLoader(int nThreads=-1); ++ CThumbLoader(); + virtual ~CThumbLoader(); + + virtual void Initialize() { }; +diff --git a/xbmc/addons/GUIWindowAddonBrowser.cpp b/xbmc/addons/GUIWindowAddonBrowser.cpp +index e6303e2..dddce48 100644 +--- a/xbmc/addons/GUIWindowAddonBrowser.cpp ++++ b/xbmc/addons/GUIWindowAddonBrowser.cpp +@@ -59,7 +59,6 @@ + CGUIWindowAddonBrowser::CGUIWindowAddonBrowser(void) + : CGUIMediaWindow(WINDOW_ADDON_BROWSER, "AddonBrowser.xml") + { +- m_thumbLoader.SetNumOfWorkers(1); + } + + CGUIWindowAddonBrowser::~CGUIWindowAddonBrowser() +diff --git a/xbmc/music/MusicInfoLoader.cpp b/xbmc/music/MusicInfoLoader.cpp +index 4cb41c2..9256e89 100644 +--- a/xbmc/music/MusicInfoLoader.cpp ++++ b/xbmc/music/MusicInfoLoader.cpp +@@ -41,7 +41,7 @@ + using namespace MUSIC_INFO; + + // HACK until we make this threadable - specify 1 thread only for now +-CMusicInfoLoader::CMusicInfoLoader() : CBackgroundInfoLoader(1) ++CMusicInfoLoader::CMusicInfoLoader() : CBackgroundInfoLoader() + { + m_mapFileItems = new CFileItemList; + +diff --git a/xbmc/music/MusicThumbLoader.cpp b/xbmc/music/MusicThumbLoader.cpp +index 5d66e1c..dc21ccc 100644 +--- a/xbmc/music/MusicThumbLoader.cpp ++++ b/xbmc/music/MusicThumbLoader.cpp +@@ -30,7 +30,7 @@ + using namespace std; + using namespace MUSIC_INFO; + +-CMusicThumbLoader::CMusicThumbLoader() : CThumbLoader(1) ++CMusicThumbLoader::CMusicThumbLoader() : CThumbLoader() + { + m_database = new CMusicDatabase; + } +diff --git a/xbmc/pictures/PictureThumbLoader.cpp b/xbmc/pictures/PictureThumbLoader.cpp +index 2eb57f6..8e690d2 100644 +--- a/xbmc/pictures/PictureThumbLoader.cpp ++++ b/xbmc/pictures/PictureThumbLoader.cpp +@@ -35,7 +35,7 @@ + using namespace XFILE; + using namespace std; + +-CPictureThumbLoader::CPictureThumbLoader() : CThumbLoader(1), CJobQueue(true) ++CPictureThumbLoader::CPictureThumbLoader() : CThumbLoader(), CJobQueue(true) + { + m_regenerateThumbs = false; + } +diff --git a/xbmc/pvr/windows/GUIWindowPVRRecordings.cpp b/xbmc/pvr/windows/GUIWindowPVRRecordings.cpp +index 369a775..a49ba32 100644 +--- a/xbmc/pvr/windows/GUIWindowPVRRecordings.cpp ++++ b/xbmc/pvr/windows/GUIWindowPVRRecordings.cpp +@@ -42,7 +42,6 @@ + CGUIWindowPVRCommon(parent, PVR_WINDOW_RECORDINGS, CONTROL_BTNRECORDINGS, CONTROL_LIST_RECORDINGS) + { + m_strSelectedPath = "pvr://recordings/"; +- m_thumbLoader.SetNumOfWorkers(1); + } + + void CGUIWindowPVRRecordings::UnregisterObservers(void) +diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp +index 3189ad9..bbbdb01 100644 +--- a/xbmc/settings/AdvancedSettings.cpp ++++ b/xbmc/settings/AdvancedSettings.cpp +@@ -346,8 +346,6 @@ void CAdvancedSettings::Initialize() + m_alwaysOnTop = false; + #endif + +- m_bgInfoLoaderMaxThreads = 5; +- + m_iPVRTimeCorrection = 0; + m_iPVRInfoToggleInterval = 3000; + m_bPVRShowEpgInfoOnEpgItemSelect = true; +@@ -1053,9 +1051,6 @@ void CAdvancedSettings::ParseSettingsFile(const CStdString &file) + + XMLUtils::GetBoolean(pRootElement, "alwaysontop", m_alwaysOnTop); + +- XMLUtils::GetInt(pRootElement, "bginfoloadermaxthreads", m_bgInfoLoaderMaxThreads); +- m_bgInfoLoaderMaxThreads = std::max(1, m_bgInfoLoaderMaxThreads); +- + TiXmlElement *pPVR = pRootElement->FirstChildElement("pvr"); + if (pPVR) + { +diff --git a/xbmc/settings/AdvancedSettings.h b/xbmc/settings/AdvancedSettings.h +index dc0c854..2385d2f 100644 +--- a/xbmc/settings/AdvancedSettings.h ++++ b/xbmc/settings/AdvancedSettings.h +@@ -337,7 +337,6 @@ class CAdvancedSettings : public ISettingCallback, public ISettingsHandler + + CStdString m_cpuTempCmd; + CStdString m_gpuTempCmd; +- int m_bgInfoLoaderMaxThreads; + + /* PVR/TV related advanced settings */ + int m_iPVRTimeCorrection; /*!< @brief correct all times (epg tags, timer tags, recording tags) by this amount of minutes. defaults to 0. */ +diff --git a/xbmc/video/VideoThumbLoader.cpp b/xbmc/video/VideoThumbLoader.cpp +index a130f57..0801d6b 100644 +--- a/xbmc/video/VideoThumbLoader.cpp ++++ b/xbmc/video/VideoThumbLoader.cpp +@@ -116,7 +116,7 @@ bool CThumbExtractor::DoWork() + } + + CVideoThumbLoader::CVideoThumbLoader() : +- CThumbLoader(1), CJobQueue(true), m_pStreamDetailsObs(NULL) ++ CThumbLoader(), CJobQueue(true), m_pStreamDetailsObs(NULL) + { + m_database = new CVideoDatabase(); + } +-- +1.8.1.6 + + +From 8f3a951e751d8cd7d8e1cbfa2c3732c48f1639c7 Mon Sep 17 00:00:00 2001 +From: arnova +Date: Fri, 14 Jun 2013 13:44:23 +0200 +Subject: [PATCH 2/6] changed: Split background info loading into a 2 stages + +This allows us to first perform loading of cached (fast) stuff and after that load the lookup (slow) stuff (partially fixes #14071) +--- + xbmc/BackgroundInfoLoader.cpp | 32 +++++++++++++++------- + xbmc/BackgroundInfoLoader.h | 2 ++ + xbmc/ThumbLoader.cpp | 17 +++++++++++- + xbmc/ThumbLoader.h | 2 ++ + xbmc/music/MusicInfoLoader.cpp | 22 +++++++++++++-- + xbmc/music/MusicInfoLoader.h | 2 ++ + xbmc/music/MusicThumbLoader.cpp | 33 ++++++++++++++++++++-- + xbmc/music/MusicThumbLoader.h | 4 ++- + xbmc/pictures/PictureInfoLoader.cpp | 25 +++++++++++++++-- + xbmc/pictures/PictureInfoLoader.h | 2 ++ + xbmc/pictures/PictureThumbLoader.cpp | 18 ++++++++++-- + xbmc/pictures/PictureThumbLoader.h | 2 ++ + xbmc/video/VideoThumbLoader.cpp | 53 +++++++++++++++++++++++++++++++----- + xbmc/video/VideoThumbLoader.h | 2 ++ + 14 files changed, 186 insertions(+), 30 deletions(-) + +diff --git a/xbmc/BackgroundInfoLoader.cpp b/xbmc/BackgroundInfoLoader.cpp +index 0c6de8d..8e488d0 100644 +--- a/xbmc/BackgroundInfoLoader.cpp ++++ b/xbmc/BackgroundInfoLoader.cpp +@@ -47,18 +47,30 @@ void CBackgroundInfoLoader::Run() + { + OnLoaderStart(); + +- while (!m_bStop) ++ // Stage 1: All "fast" stuff we have already cached ++ for (vector::const_iterator iter = m_vecItems.begin(); iter != m_vecItems.end(); ++iter) + { +- CFileItemPtr pItem; +- vector::iterator iter = m_vecItems.begin(); +- if (iter != m_vecItems.end()) ++ CFileItemPtr pItem = *iter; ++ ++ // Ask the callback if we should abort ++ if ((m_pProgressCallback && m_pProgressCallback->Abort()) || m_bStop) ++ break; ++ ++ try + { +- pItem = *iter; +- m_vecItems.erase(iter); ++ if (LoadItemCached(pItem.get()) && m_pObserver) ++ m_pObserver->OnItemLoaded(pItem.get()); + } ++ catch (...) ++ { ++ CLog::Log(LOGERROR, "CBackgroundInfoLoader::LoadItemCached - Unhandled exception for item %s", pItem->GetPath().c_str()); ++ } ++ } + +- if (pItem == NULL) +- break; ++ // Stage 2: All "slow" stuff that we need to lookup ++ for (vector::const_iterator iter = m_vecItems.begin(); iter != m_vecItems.end(); ++iter) ++ { ++ CFileItemPtr pItem = *iter; + + // Ask the callback if we should abort + if ((m_pProgressCallback && m_pProgressCallback->Abort()) || m_bStop) +@@ -66,12 +78,12 @@ void CBackgroundInfoLoader::Run() + + try + { +- if (LoadItem(pItem.get()) && m_pObserver) ++ if (LoadItemLookup(pItem.get()) && m_pObserver) + m_pObserver->OnItemLoaded(pItem.get()); + } + catch (...) + { +- CLog::Log(LOGERROR, "%s::LoadItem - Unhandled exception for item %s", __FUNCTION__, pItem->GetPath().c_str()); ++ CLog::Log(LOGERROR, "CBackgroundInfoLoader::LoadItemLookup - Unhandled exception for item %s", pItem->GetPath().c_str()); + } + } + } +diff --git a/xbmc/BackgroundInfoLoader.h b/xbmc/BackgroundInfoLoader.h +index a580605..3a214a3 100644 +--- a/xbmc/BackgroundInfoLoader.h ++++ b/xbmc/BackgroundInfoLoader.h +@@ -49,6 +49,8 @@ class CBackgroundInfoLoader : public IRunnable + void SetObserver(IBackgroundLoaderObserver* pObserver); + void SetProgressCallback(IProgressCallback* pCallback); + virtual bool LoadItem(CFileItem* pItem) { return false; }; ++ virtual bool LoadItemCached(CFileItem* pItem) { return false; }; ++ virtual bool LoadItemLookup(CFileItem* pItem) { return false; }; + + void StopThread(); // will actually stop the loader thread. + void StopAsync(); // will ask loader to stop as soon as possible, but not block +diff --git a/xbmc/ThumbLoader.cpp b/xbmc/ThumbLoader.cpp +index 8382acf..aa4cb82 100644 +--- a/xbmc/ThumbLoader.cpp ++++ b/xbmc/ThumbLoader.cpp +@@ -60,10 +60,25 @@ void CThumbLoader::SetCachedImage(const CFileItem &item, const CStdString &type, + + bool CProgramThumbLoader::LoadItem(CFileItem *pItem) + { +- if (pItem->IsParentFolder()) return true; ++ bool result = LoadItemCached(pItem); ++ result |= LoadItemLookup(pItem); ++ ++ return result; ++} ++ ++bool CProgramThumbLoader::LoadItemCached(CFileItem *pItem) ++{ ++ if (pItem->IsParentFolder()) ++ return false; ++ + return FillThumb(*pItem); + } + ++bool CProgramThumbLoader::LoadItemLookup(CFileItem *pItem) ++{ ++ return false; ++} ++ + bool CProgramThumbLoader::FillThumb(CFileItem &item) + { + // no need to do anything if we already have a thumb set +diff --git a/xbmc/ThumbLoader.h b/xbmc/ThumbLoader.h +index 655d528..2ee06d1 100644 +--- a/xbmc/ThumbLoader.h ++++ b/xbmc/ThumbLoader.h +@@ -57,6 +57,8 @@ class CProgramThumbLoader : public CThumbLoader + CProgramThumbLoader(); + virtual ~CProgramThumbLoader(); + virtual bool LoadItem(CFileItem* pItem); ++ virtual bool LoadItemCached(CFileItem* pItem); ++ virtual bool LoadItemLookup(CFileItem* pItem); + + /*! \brief Fill the thumb of a programs item + First uses a cached thumb from a previous run, then checks for a local thumb +diff --git a/xbmc/music/MusicInfoLoader.cpp b/xbmc/music/MusicInfoLoader.cpp +index 9256e89..5924f47 100644 +--- a/xbmc/music/MusicInfoLoader.cpp ++++ b/xbmc/music/MusicInfoLoader.cpp +@@ -125,6 +125,25 @@ bool CMusicInfoLoader::LoadAdditionalTagInfo(CFileItem* pItem) + + bool CMusicInfoLoader::LoadItem(CFileItem* pItem) + { ++ bool result = LoadItemCached(pItem); ++ result |= LoadItemLookup(pItem); ++ ++ return result; ++} ++ ++bool CMusicInfoLoader::LoadItemCached(CFileItem* pItem) ++{ ++ if (pItem->m_bIsFolder || pItem->IsPlayList() || pItem->IsNFO() || pItem->IsInternetStream()) ++ return false; ++ ++ // Get thumb for item ++ m_thumbLoader->LoadItem(pItem); ++ ++ return true; ++} ++ ++bool CMusicInfoLoader::LoadItemLookup(CFileItem* pItem) ++{ + if (m_pProgressCallback && !pItem->m_bIsFolder) + m_pProgressCallback->SetProgressAdvance(); + +@@ -188,9 +207,6 @@ bool CMusicInfoLoader::LoadItem(CFileItem* pItem) + } + } + +- // Get thumb for item +- m_thumbLoader->LoadItem(pItem); +- + return true; + } + +diff --git a/xbmc/music/MusicInfoLoader.h b/xbmc/music/MusicInfoLoader.h +index 7715cba..543a8bf 100644 +--- a/xbmc/music/MusicInfoLoader.h ++++ b/xbmc/music/MusicInfoLoader.h +@@ -34,6 +34,8 @@ class CMusicInfoLoader : public CBackgroundInfoLoader + + void UseCacheOnHD(const CStdString& strFileName); + virtual bool LoadItem(CFileItem* pItem); ++ virtual bool LoadItemCached(CFileItem* pItem); ++ virtual bool LoadItemLookup(CFileItem* pItem); + static bool LoadAdditionalTagInfo(CFileItem* pItem); + + protected: +diff --git a/xbmc/music/MusicThumbLoader.cpp b/xbmc/music/MusicThumbLoader.cpp +index dc21ccc..bc1d84a 100644 +--- a/xbmc/music/MusicThumbLoader.cpp ++++ b/xbmc/music/MusicThumbLoader.cpp +@@ -64,21 +64,30 @@ void CMusicThumbLoader::OnLoaderFinish() + + bool CMusicThumbLoader::LoadItem(CFileItem* pItem) + { ++ bool result = LoadItemCached(pItem); ++ result |= LoadItemLookup(pItem); ++ ++ return result; ++} ++ ++bool CMusicThumbLoader::LoadItemCached(CFileItem* pItem) ++{ + if (pItem->m_bIsShareOrDrive) +- return true; ++ return false; + + if (pItem->HasMusicInfoTag() && pItem->GetArt().empty()) + { + if (FillLibraryArt(*pItem)) + return true; ++ + if (pItem->GetMusicInfoTag()->GetType() == "artist") +- return true; // no fallback ++ return false; // No fallback + } + + if (pItem->HasVideoInfoTag() && pItem->GetArt().empty()) + { // music video + CVideoThumbLoader loader; +- if (loader.LoadItem(pItem)) ++ if (loader.LoadItemCached(pItem)) + return true; + } + +@@ -102,6 +111,24 @@ bool CMusicThumbLoader::LoadItem(CFileItem* pItem) + } + } + ++ return false; ++} ++ ++bool CMusicThumbLoader::LoadItemLookup(CFileItem* pItem) ++{ ++ if (pItem->m_bIsShareOrDrive) ++ return false; ++ ++ if (pItem->HasMusicInfoTag() && pItem->GetMusicInfoTag()->GetType() == "artist") // No fallback for artist ++ return false; ++ ++ if (pItem->HasVideoInfoTag()) ++ { // music video ++ CVideoThumbLoader loader; ++ if (loader.LoadItemLookup(pItem)) ++ return true; ++ } ++ + if (!pItem->HasArt("thumb")) + { + // Look for embedded art +diff --git a/xbmc/music/MusicThumbLoader.h b/xbmc/music/MusicThumbLoader.h +index 6351789..f8bbd29 100644 +--- a/xbmc/music/MusicThumbLoader.h ++++ b/xbmc/music/MusicThumbLoader.h +@@ -40,7 +40,9 @@ class CMusicThumbLoader : public CThumbLoader + virtual void Deinitialize(); + + virtual bool LoadItem(CFileItem* pItem); +- ++ virtual bool LoadItemCached(CFileItem* pItem); ++ virtual bool LoadItemLookup(CFileItem* pItem); ++ + /*! \brief helper function to fill the art for a video library item + \param item a video CFileItem + \return true if we fill art, false otherwise +diff --git a/xbmc/pictures/PictureInfoLoader.cpp b/xbmc/pictures/PictureInfoLoader.cpp +index 00b30d3..f92f307 100644 +--- a/xbmc/pictures/PictureInfoLoader.cpp ++++ b/xbmc/pictures/PictureInfoLoader.cpp +@@ -50,16 +50,21 @@ void CPictureInfoLoader::OnLoaderStart() + + bool CPictureInfoLoader::LoadItem(CFileItem* pItem) + { +- if (m_pProgressCallback && !pItem->m_bIsFolder) +- m_pProgressCallback->SetProgressAdvance(); ++ bool result = LoadItemCached(pItem); ++ result |= LoadItemLookup(pItem); + ++ return result; ++} ++ ++bool CPictureInfoLoader::LoadItemCached(CFileItem* pItem) ++{ + if (!pItem->IsPicture() || pItem->IsZIP() || pItem->IsRAR() || pItem->IsCBR() || pItem->IsCBZ() || pItem->IsInternetStream() || pItem->IsVideo()) + return false; + + if (pItem->HasPictureInfoTag()) + return true; + +- // first check the cached item ++ // Check the cached item + CFileItemPtr mapItem = (*m_mapFileItems)[pItem->GetPath()]; + if (mapItem && mapItem->m_dateTime==pItem->m_dateTime && mapItem->HasPictureInfoTag()) + { // Query map if we previously cached the file on HD +@@ -68,6 +73,20 @@ bool CPictureInfoLoader::LoadItem(CFileItem* pItem) + return true; + } + ++ return true; ++} ++ ++bool CPictureInfoLoader::LoadItemLookup(CFileItem* pItem) ++{ ++ if (m_pProgressCallback && !pItem->m_bIsFolder) ++ m_pProgressCallback->SetProgressAdvance(); ++ ++ if (!pItem->IsPicture() || pItem->IsZIP() || pItem->IsRAR() || pItem->IsCBR() || pItem->IsCBZ() || pItem->IsInternetStream() || pItem->IsVideo()) ++ return false; ++ ++ if (pItem->HasPictureInfoTag()) ++ return false; ++ + if (m_loadTags) + { // Nothing found, load tag from file + pItem->GetPictureInfoTag()->Load(pItem->GetPath()); +diff --git a/xbmc/pictures/PictureInfoLoader.h b/xbmc/pictures/PictureInfoLoader.h +index 7308413..d390318 100644 +--- a/xbmc/pictures/PictureInfoLoader.h ++++ b/xbmc/pictures/PictureInfoLoader.h +@@ -30,6 +30,8 @@ class CPictureInfoLoader : public CBackgroundInfoLoader + + void UseCacheOnHD(const CStdString& strFileName); + virtual bool LoadItem(CFileItem* pItem); ++ virtual bool LoadItemCached(CFileItem* pItem); ++ virtual bool LoadItemLookup(CFileItem* pItem); + + protected: + virtual void OnLoaderStart(); +diff --git a/xbmc/pictures/PictureThumbLoader.cpp b/xbmc/pictures/PictureThumbLoader.cpp +index 8e690d2..3943a11 100644 +--- a/xbmc/pictures/PictureThumbLoader.cpp ++++ b/xbmc/pictures/PictureThumbLoader.cpp +@@ -47,8 +47,17 @@ + + bool CPictureThumbLoader::LoadItem(CFileItem* pItem) + { +- if (pItem->m_bIsShareOrDrive) return true; +- if (pItem->IsParentFolder()) return true; ++ bool result = LoadItemCached(pItem); ++ result |= LoadItemLookup(pItem); ++ ++ return result; ++} ++ ++bool CPictureThumbLoader::LoadItemCached(CFileItem* pItem) ++{ ++ if (pItem->m_bIsShareOrDrive ++ || pItem->IsParentFolder()) ++ return false; + + if (pItem->HasArt("thumb") && m_regenerateThumbs) + { +@@ -95,6 +104,11 @@ bool CPictureThumbLoader::LoadItem(CFileItem* pItem) + return true; + } + ++bool CPictureThumbLoader::LoadItemLookup(CFileItem* pItem) ++{ ++ return false; ++} ++ + void CPictureThumbLoader::OnJobComplete(unsigned int jobID, bool success, CJob* job) + { + if (success) +diff --git a/xbmc/pictures/PictureThumbLoader.h b/xbmc/pictures/PictureThumbLoader.h +index 5191834..e7ad872 100644 +--- a/xbmc/pictures/PictureThumbLoader.h ++++ b/xbmc/pictures/PictureThumbLoader.h +@@ -29,6 +29,8 @@ class CPictureThumbLoader : public CThumbLoader, public CJobQueue + CPictureThumbLoader(); + virtual ~CPictureThumbLoader(); + virtual bool LoadItem(CFileItem* pItem); ++ virtual bool LoadItemCached(CFileItem* pItem); ++ virtual bool LoadItemLookup(CFileItem* pItem); + void SetRegenerateThumbs(bool regenerate) { m_regenerateThumbs = regenerate; }; + static void ProcessFoldersAndArchives(CFileItem *pItem); + +diff --git a/xbmc/video/VideoThumbLoader.cpp b/xbmc/video/VideoThumbLoader.cpp +index 0801d6b..4f3fea2 100644 +--- a/xbmc/video/VideoThumbLoader.cpp ++++ b/xbmc/video/VideoThumbLoader.cpp +@@ -199,6 +199,14 @@ static void SetupRarOptions(CFileItem& item, const CStdString& path) + */ + bool CVideoThumbLoader::LoadItem(CFileItem* pItem) + { ++ bool result = LoadItemCached(pItem); ++ result |= LoadItemLookup(pItem); ++ ++ return result; ++} ++ ++bool CVideoThumbLoader::LoadItemCached(CFileItem* pItem) ++{ + if (pItem->m_bIsShareOrDrive + || pItem->IsParentFolder()) + return false; +@@ -242,20 +250,51 @@ bool CVideoThumbLoader::LoadItem(CFileItem* pItem) + { + std::string type = *i; + std::string art = GetCachedImage(*pItem, type); +- if (art.empty()) +- { +- art = GetLocalArt(*pItem, type, type=="fanart"); +- if (!art.empty()) // cache it +- SetCachedImage(*pItem, type, art); +- } + if (!art.empty()) ++ artwork.insert(make_pair(type, art)); ++ } ++ SetArt(*pItem, artwork); ++ } ++ ++ m_database->Close(); ++ ++ return true; ++} ++ ++bool CVideoThumbLoader::LoadItemLookup(CFileItem* pItem) ++{ ++ if (pItem->m_bIsShareOrDrive ++ || pItem->IsParentFolder()) ++ return false; ++ ++ if (pItem->HasVideoInfoTag() && ++ !pItem->GetVideoInfoTag()->m_type.empty() && ++ pItem->GetVideoInfoTag()->m_type != "movie" && ++ pItem->GetVideoInfoTag()->m_type != "tvshow" && ++ pItem->GetVideoInfoTag()->m_type != "episode" && ++ pItem->GetVideoInfoTag()->m_type != "musicvideo") ++ return false; // Nothing to do here ++ ++ m_database->Open(); ++ map artwork = pItem->GetArt(); ++ vector artTypes = GetArtTypes(pItem->HasVideoInfoTag() ? pItem->GetVideoInfoTag()->m_type : ""); ++ if (find(artTypes.begin(), artTypes.end(), "thumb") == artTypes.end()) ++ artTypes.push_back("thumb"); // always look for "thumb" art for files ++ for (vector::const_iterator i = artTypes.begin(); i != artTypes.end(); ++i) ++ { ++ std::string type = *i; ++ if (!pItem->HasArt(type)) ++ { ++ std::string art = GetLocalArt(*pItem, type, type=="fanart"); ++ if (!art.empty()) // cache it + { ++ SetCachedImage(*pItem, type, art); + CTextureCache::Get().BackgroundCacheImage(art); + artwork.insert(make_pair(type, art)); + } + } +- SetArt(*pItem, artwork); + } ++ SetArt(*pItem, artwork); + + // We can only extract flags/thumbs for file-like items + if (!pItem->m_bIsFolder && pItem->IsVideo()) +diff --git a/xbmc/video/VideoThumbLoader.h b/xbmc/video/VideoThumbLoader.h +index 4befd6c..97ac22d 100644 +--- a/xbmc/video/VideoThumbLoader.h ++++ b/xbmc/video/VideoThumbLoader.h +@@ -68,6 +68,8 @@ class CVideoThumbLoader : public CThumbLoader, public CJobQueue + + virtual void Initialize(); + virtual bool LoadItem(CFileItem* pItem); ++ virtual bool LoadItemCached(CFileItem* pItem); ++ virtual bool LoadItemLookup(CFileItem* pItem); + void SetStreamDetailsObserver(IStreamDetailsObserver *pObs) { m_pStreamDetailsObs = pObs; } + + /*! \brief Fill the thumb of a video item +-- +1.8.1.6 + + +From 7ea5521c4477d095cecbfd570de7972ee2b1b3f8 Mon Sep 17 00:00:00 2001 +From: arnova +Date: Thu, 20 Jun 2013 12:41:21 +0200 +Subject: [PATCH 3/6] changed: Renamed m_database to m_video/m_musicDatabase + for clarity + +--- + xbmc/music/MusicThumbLoader.cpp | 26 +++++++++++++------------- + xbmc/music/MusicThumbLoader.h | 2 +- + xbmc/video/VideoThumbLoader.cpp | 33 +++++++++++++++++---------------- + xbmc/video/VideoThumbLoader.h | 2 +- + 4 files changed, 32 insertions(+), 31 deletions(-) + +diff --git a/xbmc/music/MusicThumbLoader.cpp b/xbmc/music/MusicThumbLoader.cpp +index bc1d84a..8272834 100644 +--- a/xbmc/music/MusicThumbLoader.cpp ++++ b/xbmc/music/MusicThumbLoader.cpp +@@ -32,23 +32,23 @@ + + CMusicThumbLoader::CMusicThumbLoader() : CThumbLoader() + { +- m_database = new CMusicDatabase; ++ m_musicDatabase = new CMusicDatabase; + } + + CMusicThumbLoader::~CMusicThumbLoader() + { +- delete m_database; ++ delete m_musicDatabase; + } + + void CMusicThumbLoader::Initialize() + { +- m_database->Open(); ++ m_musicDatabase->Open(); + m_albumArt.clear(); + } + + void CMusicThumbLoader::Deinitialize() + { +- m_database->Close(); ++ m_musicDatabase->Close(); + m_albumArt.clear(); + } + +@@ -96,18 +96,18 @@ bool CMusicThumbLoader::LoadItemCached(CFileItem* pItem) + if (pItem->HasMusicInfoTag() && !pItem->GetMusicInfoTag()->GetArtist().empty()) + { + std::string artist = pItem->GetMusicInfoTag()->GetArtist()[0]; +- m_database->Open(); +- int idArtist = m_database->GetArtistByName(artist); ++ m_musicDatabase->Open(); ++ int idArtist = m_musicDatabase->GetArtistByName(artist); + if (idArtist >= 0) + { +- string fanart = m_database->GetArtForItem(idArtist, "artist", "fanart"); ++ string fanart = m_musicDatabase->GetArtForItem(idArtist, "artist", "fanart"); + if (!fanart.empty()) + { + pItem->SetArt("artist.fanart", fanart); + pItem->SetArtFallback("fanart", "artist.fanart"); + } + } +- m_database->Close(); ++ m_musicDatabase->Close(); + } + } + +@@ -172,16 +172,16 @@ bool CMusicThumbLoader::FillLibraryArt(CFileItem &item) + CMusicInfoTag &tag = *item.GetMusicInfoTag(); + if (tag.GetDatabaseId() > -1 && !tag.GetType().empty()) + { +- m_database->Open(); ++ m_musicDatabase->Open(); + map artwork; +- if (m_database->GetArtForItem(tag.GetDatabaseId(), tag.GetType(), artwork)) ++ if (m_musicDatabase->GetArtForItem(tag.GetDatabaseId(), tag.GetType(), artwork)) + item.SetArt(artwork); + else if (tag.GetType() == "song") + { // no art for the song, try the album + ArtCache::const_iterator i = m_albumArt.find(tag.GetAlbumId()); + if (i == m_albumArt.end()) + { +- m_database->GetArtForItem(tag.GetAlbumId(), "album", artwork); ++ m_musicDatabase->GetArtForItem(tag.GetAlbumId(), "album", artwork); + i = m_albumArt.insert(make_pair(tag.GetAlbumId(), artwork)).first; + } + if (i != m_albumArt.end()) +@@ -193,14 +193,14 @@ bool CMusicThumbLoader::FillLibraryArt(CFileItem &item) + } + if (tag.GetType() == "song" || tag.GetType() == "album") + { // fanart from the artist +- string fanart = m_database->GetArtistArtForItem(tag.GetDatabaseId(), tag.GetType(), "fanart"); ++ string fanart = m_musicDatabase->GetArtistArtForItem(tag.GetDatabaseId(), tag.GetType(), "fanart"); + if (!fanart.empty()) + { + item.SetArt("artist.fanart", fanart); + item.SetArtFallback("fanart", "artist.fanart"); + } + } +- m_database->Close(); ++ m_musicDatabase->Close(); + } + return !item.GetArt().empty(); + } +diff --git a/xbmc/music/MusicThumbLoader.h b/xbmc/music/MusicThumbLoader.h +index f8bbd29..7bdad72 100644 +--- a/xbmc/music/MusicThumbLoader.h ++++ b/xbmc/music/MusicThumbLoader.h +@@ -63,7 +63,7 @@ class CMusicThumbLoader : public CThumbLoader + virtual void OnLoaderStart(); + virtual void OnLoaderFinish(); + +- CMusicDatabase *m_database; ++ CMusicDatabase *m_musicDatabase; + typedef std::map > ArtCache; + ArtCache m_albumArt; + }; +diff --git a/xbmc/video/VideoThumbLoader.cpp b/xbmc/video/VideoThumbLoader.cpp +index 4f3fea2..e92fc3f 100644 +--- a/xbmc/video/VideoThumbLoader.cpp ++++ b/xbmc/video/VideoThumbLoader.cpp +@@ -118,18 +118,18 @@ bool CThumbExtractor::DoWork() + CVideoThumbLoader::CVideoThumbLoader() : + CThumbLoader(), CJobQueue(true), m_pStreamDetailsObs(NULL) + { +- m_database = new CVideoDatabase(); ++ m_videoDatabase = new CVideoDatabase(); + } + + CVideoThumbLoader::~CVideoThumbLoader() + { + StopThread(); +- delete m_database; ++ delete m_videoDatabase; + } + + void CVideoThumbLoader::Initialize() + { +- m_database->Open(); ++ m_videoDatabase->Open(); + m_showArt.clear(); + } + +@@ -140,7 +140,7 @@ void CVideoThumbLoader::OnLoaderStart() + + void CVideoThumbLoader::OnLoaderFinish() + { +- m_database->Close(); ++ m_videoDatabase->Close(); + m_showArt.clear(); + } + +@@ -211,14 +211,14 @@ bool CVideoThumbLoader::LoadItemCached(CFileItem* pItem) + || pItem->IsParentFolder()) + return false; + +- m_database->Open(); ++ m_videoDatabase->Open(); + + if (!pItem->HasVideoInfoTag() || !pItem->GetVideoInfoTag()->HasStreamDetails()) // no stream details + { + if ((pItem->HasVideoInfoTag() && pItem->GetVideoInfoTag()->m_iFileId >= 0) // file (or maybe folder) is in the database + || (!pItem->m_bIsFolder && pItem->IsVideo())) // Some other video file for which we haven't yet got any database details + { +- if (m_database->GetStreamDetails(*pItem)) ++ if (m_videoDatabase->GetStreamDetails(*pItem)) + pItem->SetInvalid(); + } + } +@@ -234,7 +234,7 @@ bool CVideoThumbLoader::LoadItemCached(CFileItem* pItem) + pItem->GetVideoInfoTag()->m_type != "episode" && + pItem->GetVideoInfoTag()->m_type != "musicvideo") + { +- m_database->Close(); ++ m_videoDatabase->Close(); + return true; // nothing else to be done + } + } +@@ -256,7 +256,7 @@ bool CVideoThumbLoader::LoadItemCached(CFileItem* pItem) + SetArt(*pItem, artwork); + } + +- m_database->Close(); ++ m_videoDatabase->Close(); + + return true; + } +@@ -275,7 +275,8 @@ bool CVideoThumbLoader::LoadItemLookup(CFileItem* pItem) + pItem->GetVideoInfoTag()->m_type != "musicvideo") + return false; // Nothing to do here + +- m_database->Open(); ++ m_videoDatabase->Open(); ++ + map artwork = pItem->GetArt(); + vector artTypes = GetArtTypes(pItem->HasVideoInfoTag() ? pItem->GetVideoInfoTag()->m_type : ""); + if (find(artTypes.begin(), artTypes.end(), "thumb") == artTypes.end()) +@@ -320,7 +321,7 @@ bool CVideoThumbLoader::LoadItemLookup(CFileItem* pItem) + // Item has cached autogen image but no art entry. Save it to db. + CVideoInfoTag* info = pItem->GetVideoInfoTag(); + if (info->m_iDbId > 0 && !info->m_type.empty()) +- m_database->SetArtForItem(info->m_iDbId, info->m_type, "thumb", thumbURL); ++ m_videoDatabase->SetArtForItem(info->m_iDbId, info->m_type, "thumb", thumbURL); + } + } + else if (CSettings::Get().GetBool("myvideos.extractthumb") && +@@ -334,7 +335,7 @@ bool CVideoThumbLoader::LoadItemLookup(CFileItem* pItem) + CThumbExtractor* extract = new CThumbExtractor(item, path, true, thumbURL); + AddJob(extract); + +- m_database->Close(); ++ m_videoDatabase->Close(); + return true; + } + } +@@ -354,7 +355,7 @@ bool CVideoThumbLoader::LoadItemLookup(CFileItem* pItem) + } + } + +- m_database->Close(); ++ m_videoDatabase->Close(); + return true; + } + +@@ -376,8 +377,8 @@ bool CVideoThumbLoader::FillLibraryArt(CFileItem &item) + if (tag.m_iDbId > -1 && !tag.m_type.IsEmpty()) + { + map artwork; +- m_database->Open(); +- if (m_database->GetArtForItem(tag.m_iDbId, tag.m_type, artwork)) ++ m_videoDatabase->Open(); ++ if (m_videoDatabase->GetArtForItem(tag.m_iDbId, tag.m_type, artwork)) + SetArt(item, artwork); + else if (tag.m_type == "artist") + { // we retrieve music video art from the music database (no backward compat) +@@ -402,7 +403,7 @@ bool CVideoThumbLoader::FillLibraryArt(CFileItem &item) + if (i == m_showArt.end()) + { + map showArt; +- m_database->GetArtForItem(tag.m_iIdShow, "tvshow", showArt); ++ m_videoDatabase->GetArtForItem(tag.m_iIdShow, "tvshow", showArt); + i = m_showArt.insert(make_pair(tag.m_iIdShow, showArt)).first; + } + if (i != m_showArt.end()) +@@ -412,7 +413,7 @@ bool CVideoThumbLoader::FillLibraryArt(CFileItem &item) + item.SetArtFallback("tvshow.thumb", "tvshow.poster"); + } + } +- m_database->Close(); ++ m_videoDatabase->Close(); + } + return !item.GetArt().empty(); + } +diff --git a/xbmc/video/VideoThumbLoader.h b/xbmc/video/VideoThumbLoader.h +index 97ac22d..4a06073 100644 +--- a/xbmc/video/VideoThumbLoader.h ++++ b/xbmc/video/VideoThumbLoader.h +@@ -128,7 +128,7 @@ class CVideoThumbLoader : public CThumbLoader, public CJobQueue + virtual void OnLoaderFinish(); + + IStreamDetailsObserver *m_pStreamDetailsObs; +- CVideoDatabase *m_database; ++ CVideoDatabase *m_videoDatabase; + typedef std::map > ArtCache; + ArtCache m_showArt; + }; +-- +1.8.1.6 + + +From 59c6386ee7af83fe3e8e18c4b28bde42c399bbf2 Mon Sep 17 00:00:00 2001 +From: arnova +Date: Thu, 20 Jun 2013 13:29:22 +0200 +Subject: [PATCH 4/6] changed: Use a member variable for the texture database + +This speeds up thumb loading considerably. This also gets rid of the Initialize/Deinitialize ThumbLoader functions +--- + xbmc/GUIInfoManager.cpp | 8 +++++-- + xbmc/ThumbLoader.cpp | 34 +++++++++++++++++++++------- + xbmc/ThumbLoader.h | 14 ++++++++---- + xbmc/interfaces/json-rpc/FileItemHandler.cpp | 4 ++-- + xbmc/music/MusicInfoLoader.cpp | 4 ++-- + xbmc/music/MusicThumbLoader.cpp | 16 ++++--------- + xbmc/music/MusicThumbLoader.h | 11 ++++----- + xbmc/music/infoscanner/MusicInfoScanner.cpp | 3 ++- + xbmc/music/windows/GUIWindowMusicBase.cpp | 8 +++++-- + xbmc/network/upnp/UPnPServer.cpp | 4 ++-- + xbmc/pictures/GUIWindowPictures.cpp | 4 +++- + xbmc/pictures/PictureInfoLoader.h | 2 +- + xbmc/pictures/PictureThumbLoader.cpp | 23 +++++++++++-------- + xbmc/pictures/PictureThumbLoader.h | 3 +++ + xbmc/utils/RecentlyAddedJob.cpp | 4 ++-- + xbmc/video/VideoInfoScanner.cpp | 3 ++- + xbmc/video/VideoThumbLoader.cpp | 9 +++----- + xbmc/video/VideoThumbLoader.h | 9 ++++---- + 18 files changed, 95 insertions(+), 68 deletions(-) + +diff --git a/xbmc/GUIInfoManager.cpp b/xbmc/GUIInfoManager.cpp +index fba60ae..c9c616d 100644 +--- a/xbmc/GUIInfoManager.cpp ++++ b/xbmc/GUIInfoManager.cpp +@@ -3892,7 +3892,9 @@ void CGUIInfoManager::SetCurrentSong(CFileItem &item) + { + CLog::Log(LOGDEBUG,"Streaming media detected... using %s to find a thumb", g_application.m_strPlayListFile.c_str()); + CFileItem streamingItem(g_application.m_strPlayListFile,false); +- CMusicThumbLoader::FillThumb(streamingItem); ++ ++ CMusicThumbLoader loader; ++ loader.FillThumb(streamingItem); + if (streamingItem.HasArt("thumb")) + m_currentFile->SetArt("thumb", streamingItem.GetArt("thumb")); + } +@@ -3945,7 +3947,9 @@ void CGUIInfoManager::SetCurrentMovie(CFileItem &item) + { + CLog::Log(LOGDEBUG,"Streaming media detected... using %s to find a thumb", g_application.m_strPlayListFile.c_str()); + CFileItem thumbItem(g_application.m_strPlayListFile,false); +- if (CVideoThumbLoader::FillThumb(thumbItem)) ++ ++ CVideoThumbLoader loader; ++ if (loader.FillThumb(thumbItem)) + item.SetArt("thumb", thumbItem.GetArt("thumb")); + } + } +diff --git a/xbmc/ThumbLoader.cpp b/xbmc/ThumbLoader.cpp +index aa4cb82..98ce95c 100644 +--- a/xbmc/ThumbLoader.cpp ++++ b/xbmc/ThumbLoader.cpp +@@ -29,25 +29,42 @@ + CThumbLoader::CThumbLoader() : + CBackgroundInfoLoader() + { ++ m_textureDatabase = new CTextureDatabase(); + } + + CThumbLoader::~CThumbLoader() + { ++ delete m_textureDatabase; ++} ++ ++void CThumbLoader::OnLoaderStart() ++{ ++ m_textureDatabase->Open(); ++} ++ ++void CThumbLoader::OnLoaderFinish() ++{ ++ m_textureDatabase->Close(); + } + + CStdString CThumbLoader::GetCachedImage(const CFileItem &item, const CStdString &type) + { +- CTextureDatabase db; +- if (!item.GetPath().empty() && db.Open()) +- return db.GetTextureForPath(item.GetPath(), type); ++ if (!item.GetPath().empty() && m_textureDatabase->Open()) ++ { ++ CStdString image = m_textureDatabase->GetTextureForPath(item.GetPath(), type); ++ m_textureDatabase->Close(); ++ return image; ++ } + return ""; + } + + void CThumbLoader::SetCachedImage(const CFileItem &item, const CStdString &type, const CStdString &image) + { +- CTextureDatabase db; +- if (!item.GetPath().empty() && db.Open()) +- db.SetTextureForPath(item.GetPath(), type, image); ++ if (!item.GetPath().empty() && m_textureDatabase->Open()) ++ { ++ m_textureDatabase->SetTextureForPath(item.GetPath(), type, image); ++ m_textureDatabase->Close(); ++ } + } + + CProgramThumbLoader::CProgramThumbLoader() +@@ -86,12 +103,13 @@ bool CProgramThumbLoader::FillThumb(CFileItem &item) + + if (thumb.IsEmpty()) + { // see whether we have a cached image for this item +- thumb = GetCachedImage(item, "thumb"); ++ CProgramThumbLoader loader; ++ thumb = loader.GetCachedImage(item, "thumb"); + if (thumb.IsEmpty()) + { + thumb = GetLocalThumb(item); + if (!thumb.IsEmpty()) +- SetCachedImage(item, "thumb", thumb); ++ loader.SetCachedImage(item, "thumb", thumb); + } + } + +diff --git a/xbmc/ThumbLoader.h b/xbmc/ThumbLoader.h +index 2ee06d1..28692c9 100644 +--- a/xbmc/ThumbLoader.h ++++ b/xbmc/ThumbLoader.h +@@ -22,13 +22,16 @@ + #include "BackgroundInfoLoader.h" + #include "utils/StdString.h" + ++class CTextureDatabase; ++ + class CThumbLoader : public CBackgroundInfoLoader + { + public: + CThumbLoader(); + virtual ~CThumbLoader(); + +- virtual void Initialize() { }; ++ virtual void OnLoaderStart(); ++ virtual void OnLoaderFinish(); + + /*! \brief helper function to fill the art for a library item + \param item a CFileItem +@@ -41,14 +44,17 @@ class CThumbLoader : public CBackgroundInfoLoader + \param type the type of image to retrieve + \return the image associated with this item + */ +- static CStdString GetCachedImage(const CFileItem &item, const CStdString &type); ++ virtual CStdString GetCachedImage(const CFileItem &item, const CStdString &type); + + /*! \brief Associate an image with the given item in the texture database + \param item CFileItem to associate the image with + \param type the type of image + \param image the URL of the image + */ +- static void SetCachedImage(const CFileItem &item, const CStdString &type, const CStdString &image); ++ virtual void SetCachedImage(const CFileItem &item, const CStdString &type, const CStdString &image); ++ ++protected: ++ CTextureDatabase *m_textureDatabase; + }; + + class CProgramThumbLoader : public CThumbLoader +@@ -67,7 +73,7 @@ class CProgramThumbLoader : public CThumbLoader + \return true if we fill the thumb, false otherwise + \sa GetLocalThumb + */ +- static bool FillThumb(CFileItem &item); ++ virtual bool FillThumb(CFileItem &item); + + /*! \brief Get a local thumb for a programs item + Shortcuts are checked, then we check for a file or folder thumb +diff --git a/xbmc/interfaces/json-rpc/FileItemHandler.cpp b/xbmc/interfaces/json-rpc/FileItemHandler.cpp +index 28e1e0b..0d7117b 100644 +--- a/xbmc/interfaces/json-rpc/FileItemHandler.cpp ++++ b/xbmc/interfaces/json-rpc/FileItemHandler.cpp +@@ -221,7 +221,7 @@ void CFileItemHandler::HandleFileItemList(const char *ID, bool allowFile, const + thumbLoader = new CMusicThumbLoader(); + + if (thumbLoader != NULL) +- thumbLoader->Initialize(); ++ thumbLoader->OnLoaderStart(); + } + + std::set fields; +@@ -329,7 +329,7 @@ void CFileItemHandler::HandleFileItem(const char *ID, bool allowFile, const char + if (thumbLoader != NULL) + { + deleteThumbloader = true; +- thumbLoader->Initialize(); ++ thumbLoader->OnLoaderStart(); + } + } + +diff --git a/xbmc/music/MusicInfoLoader.cpp b/xbmc/music/MusicInfoLoader.cpp +index 5924f47..d6e1afa 100644 +--- a/xbmc/music/MusicInfoLoader.cpp ++++ b/xbmc/music/MusicInfoLoader.cpp +@@ -77,7 +77,7 @@ void CMusicInfoLoader::OnLoaderStart() + m_musicDatabase.Open(); + + if (m_thumbLoader) +- m_thumbLoader->Initialize(); ++ m_thumbLoader->OnLoaderStart(); + } + + bool CMusicInfoLoader::LoadAdditionalTagInfo(CFileItem* pItem) +@@ -227,7 +227,7 @@ void CMusicInfoLoader::OnLoaderFinish() + m_musicDatabase.Close(); + + if (m_thumbLoader) +- m_thumbLoader->Deinitialize(); ++ m_thumbLoader->OnLoaderFinish(); + } + + void CMusicInfoLoader::UseCacheOnHD(const CStdString& strFileName) +diff --git a/xbmc/music/MusicThumbLoader.cpp b/xbmc/music/MusicThumbLoader.cpp +index 8272834..88cd10a 100644 +--- a/xbmc/music/MusicThumbLoader.cpp ++++ b/xbmc/music/MusicThumbLoader.cpp +@@ -40,26 +40,18 @@ + delete m_musicDatabase; + } + +-void CMusicThumbLoader::Initialize() ++void CMusicThumbLoader::OnLoaderStart() + { + m_musicDatabase->Open(); + m_albumArt.clear(); ++ CThumbLoader::OnLoaderStart(); + } + +-void CMusicThumbLoader::Deinitialize() ++void CMusicThumbLoader::OnLoaderFinish() + { + m_musicDatabase->Close(); + m_albumArt.clear(); +-} +- +-void CMusicThumbLoader::OnLoaderStart() +-{ +- Initialize(); +-} +- +-void CMusicThumbLoader::OnLoaderFinish() +-{ +- Deinitialize(); ++ CThumbLoader::OnLoaderFinish(); + } + + bool CMusicThumbLoader::LoadItem(CFileItem* pItem) +diff --git a/xbmc/music/MusicThumbLoader.h b/xbmc/music/MusicThumbLoader.h +index 7bdad72..69205a3 100644 +--- a/xbmc/music/MusicThumbLoader.h ++++ b/xbmc/music/MusicThumbLoader.h +@@ -35,9 +35,9 @@ class CMusicThumbLoader : public CThumbLoader + public: + CMusicThumbLoader(); + virtual ~CMusicThumbLoader(); +- +- virtual void Initialize(); +- virtual void Deinitialize(); ++ ++ virtual void OnLoaderStart(); ++ virtual void OnLoaderFinish(); + + virtual bool LoadItem(CFileItem* pItem); + virtual bool LoadItemCached(CFileItem* pItem); +@@ -55,14 +55,11 @@ class CMusicThumbLoader : public CThumbLoader + \param item the CFileItem object to fill + \return true if we fill the thumb, false otherwise + */ +- static bool FillThumb(CFileItem &item, bool folderThumbs = true); ++ virtual bool FillThumb(CFileItem &item, bool folderThumbs = true); + + static bool GetEmbeddedThumb(const std::string &path, MUSIC_INFO::EmbeddedArt &art); + + protected: +- virtual void OnLoaderStart(); +- virtual void OnLoaderFinish(); +- + CMusicDatabase *m_musicDatabase; + typedef std::map > ArtCache; + ArtCache m_albumArt; +diff --git a/xbmc/music/infoscanner/MusicInfoScanner.cpp b/xbmc/music/infoscanner/MusicInfoScanner.cpp +index fb9b16a..9583e48 100644 +--- a/xbmc/music/infoscanner/MusicInfoScanner.cpp ++++ b/xbmc/music/infoscanner/MusicInfoScanner.cpp +@@ -1016,7 +1016,8 @@ void CMusicInfoScanner::FindArtForAlbums(VECALBUMS &albums, const CStdString &pa + { + // assign to folder thumb as well + CFileItem albumItem(path, true); +- CMusicThumbLoader::SetCachedImage(albumItem, "thumb", albumArt); ++ CMusicThumbLoader loader; ++ loader.SetCachedImage(albumItem, "thumb", albumArt); + } + } + +diff --git a/xbmc/music/windows/GUIWindowMusicBase.cpp b/xbmc/music/windows/GUIWindowMusicBase.cpp +index cf8ae67..d16b31b 100644 +--- a/xbmc/music/windows/GUIWindowMusicBase.cpp ++++ b/xbmc/music/windows/GUIWindowMusicBase.cpp +@@ -1038,7 +1038,8 @@ void CGUIWindowMusicBase::UpdateThumb(const CAlbum &album, const CStdString &pat + CMusicInfoScanner::FileItemsToAlbums(items, albums); + if (albums.size() == 1) + { // set as folder thumb as well +- CThumbLoader::SetCachedImage(items, "thumb", albumPath); ++ CMusicThumbLoader loader; ++ loader.SetCachedImage(items, "thumb", albumPath); + } + } + +@@ -1105,7 +1106,10 @@ bool CGUIWindowMusicBase::GetDirectory(const CStdString &strDirectory, CFileItem + items.SetArt("thumb", ""); + bool bResult = CGUIMediaWindow::GetDirectory(strDirectory, items); + if (bResult) +- CMusicThumbLoader::FillThumb(items); ++ { ++ CMusicThumbLoader loader; ++ loader.FillThumb(items); ++ } + + // add in the "New Playlist" item if we're in the playlists folder + if ((items.GetPath() == "special://musicplaylists/") && !items.Contains("newplaylist://")) +diff --git a/xbmc/network/upnp/UPnPServer.cpp b/xbmc/network/upnp/UPnPServer.cpp +index 2549a70..7158cb7 100644 +--- a/xbmc/network/upnp/UPnPServer.cpp ++++ b/xbmc/network/upnp/UPnPServer.cpp +@@ -545,7 +545,7 @@ static NPT_String TranslateWMPObjectId(NPT_String id) + thumb_loader = NPT_Reference(new CMusicThumbLoader()); + } + if (!thumb_loader.IsNull()) { +- thumb_loader->Initialize(); ++ thumb_loader->OnLoaderStart(); + } + object = Build(item, true, context, thumb_loader, parent.empty()?NULL:parent.c_str()); + } +@@ -710,7 +710,7 @@ static NPT_String TranslateWMPObjectId(NPT_String id) + thumb_loader = NPT_Reference(new CMusicThumbLoader()); + } + if (!thumb_loader.IsNull()) { +- thumb_loader->Initialize(); ++ thumb_loader->OnLoaderStart(); + } + + // this isn't pretty but needed to properly hide the addons node from clients +diff --git a/xbmc/pictures/GUIWindowPictures.cpp b/xbmc/pictures/GUIWindowPictures.cpp +index 0dbe98c..8668b1d 100644 +--- a/xbmc/pictures/GUIWindowPictures.cpp ++++ b/xbmc/pictures/GUIWindowPictures.cpp +@@ -271,7 +271,9 @@ bool CGUIWindowPictures::Update(const CStdString &strDirectory, bool updateFilte + m_vecItems->SetArt("thumb", ""); + if (CSettings::Get().GetBool("pictures.generatethumbs")) + m_thumbLoader.Load(*m_vecItems); +- m_vecItems->SetArt("thumb", CPictureThumbLoader::GetCachedImage(*m_vecItems, "thumb")); ++ ++ CStdString thumb = m_thumbLoader.GetCachedImage(*m_vecItems, "thumb"); ++ m_vecItems->SetArt("thumb", thumb); + + return true; + } +diff --git a/xbmc/pictures/PictureInfoLoader.h b/xbmc/pictures/PictureInfoLoader.h +index d390318..8ad7678 100644 +--- a/xbmc/pictures/PictureInfoLoader.h ++++ b/xbmc/pictures/PictureInfoLoader.h +@@ -36,7 +36,7 @@ class CPictureInfoLoader : public CBackgroundInfoLoader + protected: + virtual void OnLoaderStart(); + virtual void OnLoaderFinish(); +-protected: ++ + CFileItemList* m_mapFileItems; + unsigned int m_tagReads; + bool m_loadTags; +diff --git a/xbmc/pictures/PictureThumbLoader.cpp b/xbmc/pictures/PictureThumbLoader.cpp +index 3943a11..1ad3a79 100644 +--- a/xbmc/pictures/PictureThumbLoader.cpp ++++ b/xbmc/pictures/PictureThumbLoader.cpp +@@ -45,6 +45,12 @@ + StopThread(); + } + ++void CPictureThumbLoader::OnLoaderFinish() ++{ ++ m_regenerateThumbs = false; ++ CThumbLoader::OnLoaderFinish(); ++} ++ + bool CPictureThumbLoader::LoadItem(CFileItem* pItem) + { + bool result = LoadItemCached(pItem); +@@ -62,9 +68,11 @@ bool CPictureThumbLoader::LoadItemCached(CFileItem* pItem) + if (pItem->HasArt("thumb") && m_regenerateThumbs) + { + CTextureCache::Get().ClearCachedImage(pItem->GetArt("thumb")); +- CTextureDatabase db; +- if (db.Open()) +- db.ClearTextureForPath(pItem->GetPath(), "thumb"); ++ if (m_textureDatabase->Open()) ++ { ++ m_textureDatabase->ClearTextureForPath(pItem->GetPath(), "thumb"); ++ m_textureDatabase->Close(); ++ } + pItem->SetArt("thumb", ""); + } + +@@ -75,7 +83,8 @@ bool CPictureThumbLoader::LoadItemCached(CFileItem* pItem) + } + else if (pItem->IsVideo() && !pItem->IsZIP() && !pItem->IsRAR() && !pItem->IsCBZ() && !pItem->IsCBR() && !pItem->IsPlayList()) + { // video +- if (!CVideoThumbLoader::FillThumb(*pItem)) ++ CVideoThumbLoader loader; ++ if (!loader.FillThumb(*pItem)) + { + CStdString thumbURL = CVideoThumbLoader::GetEmbeddedThumbURL(*pItem); + if (CTextureCache::Get().HasCachedImage(thumbURL)) +@@ -122,12 +131,6 @@ void CPictureThumbLoader::OnJobComplete(unsigned int jobID, bool success, CJob* + CJobQueue::OnJobComplete(jobID, success, job); + } + +- +-void CPictureThumbLoader::OnLoaderFinish() +-{ +- m_regenerateThumbs = false; +-} +- + void CPictureThumbLoader::ProcessFoldersAndArchives(CFileItem *pItem) + { + if (pItem->HasArt("thumb")) +diff --git a/xbmc/pictures/PictureThumbLoader.h b/xbmc/pictures/PictureThumbLoader.h +index e7ad872..76d2aee 100644 +--- a/xbmc/pictures/PictureThumbLoader.h ++++ b/xbmc/pictures/PictureThumbLoader.h +@@ -28,6 +28,7 @@ class CPictureThumbLoader : public CThumbLoader, public CJobQueue + public: + CPictureThumbLoader(); + virtual ~CPictureThumbLoader(); ++ + virtual bool LoadItem(CFileItem* pItem); + virtual bool LoadItemCached(CFileItem* pItem); + virtual bool LoadItemLookup(CFileItem* pItem); +@@ -42,8 +43,10 @@ class CPictureThumbLoader : public CThumbLoader, public CJobQueue + \sa CImageLoader, IJobCallback + */ + virtual void OnJobComplete(unsigned int jobID, bool success, CJob *job); ++ + protected: + virtual void OnLoaderFinish(); ++ + private: + bool m_regenerateThumbs; + }; +diff --git a/xbmc/utils/RecentlyAddedJob.cpp b/xbmc/utils/RecentlyAddedJob.cpp +index 9bae92b..4d724a7 100644 +--- a/xbmc/utils/RecentlyAddedJob.cpp ++++ b/xbmc/utils/RecentlyAddedJob.cpp +@@ -54,7 +54,7 @@ bool CRecentlyAddedJob::UpdateVideo() + CFileItemList items; + CVideoDatabase videodatabase; + CVideoThumbLoader loader; +- loader.Initialize(); ++ loader.OnLoaderStart(); + + videodatabase.Open(); + +@@ -213,7 +213,7 @@ bool CRecentlyAddedJob::UpdateMusic() + CFileItemList musicItems; + CMusicDatabase musicdatabase; + CMusicThumbLoader loader; +- loader.Initialize(); ++ loader.OnLoaderStart(); + + musicdatabase.Open(); + +diff --git a/xbmc/video/VideoInfoScanner.cpp b/xbmc/video/VideoInfoScanner.cpp +index 3c56881..26e9219 100644 +--- a/xbmc/video/VideoInfoScanner.cpp ++++ b/xbmc/video/VideoInfoScanner.cpp +@@ -1632,7 +1632,8 @@ + if (!imdbThumb.IsEmpty()) + { + CFileItem folderItem(folder, true); +- CThumbLoader::SetCachedImage(folderItem, "thumb", imdbThumb); ++ CThumbLoader loader; ++ loader.SetCachedImage(folderItem, "thumb", imdbThumb); + } + } + +diff --git a/xbmc/video/VideoThumbLoader.cpp b/xbmc/video/VideoThumbLoader.cpp +index e92fc3f..714a67a 100644 +--- a/xbmc/video/VideoThumbLoader.cpp ++++ b/xbmc/video/VideoThumbLoader.cpp +@@ -127,21 +127,18 @@ bool CThumbExtractor::DoWork() + delete m_videoDatabase; + } + +-void CVideoThumbLoader::Initialize() ++void CVideoThumbLoader::OnLoaderStart() + { + m_videoDatabase->Open(); + m_showArt.clear(); +-} +- +-void CVideoThumbLoader::OnLoaderStart() +-{ +- Initialize(); ++ CThumbLoader::OnLoaderStart(); + } + + void CVideoThumbLoader::OnLoaderFinish() + { + m_videoDatabase->Close(); + m_showArt.clear(); ++ CThumbLoader::OnLoaderFinish(); + } + + static void SetupRarOptions(CFileItem& item, const CStdString& path) +diff --git a/xbmc/video/VideoThumbLoader.h b/xbmc/video/VideoThumbLoader.h +index 4a06073..6567a98 100644 +--- a/xbmc/video/VideoThumbLoader.h ++++ b/xbmc/video/VideoThumbLoader.h +@@ -66,7 +66,9 @@ class CVideoThumbLoader : public CThumbLoader, public CJobQueue + CVideoThumbLoader(); + virtual ~CVideoThumbLoader(); + +- virtual void Initialize(); ++ virtual void OnLoaderStart(); ++ virtual void OnLoaderFinish(); ++ + virtual bool LoadItem(CFileItem* pItem); + virtual bool LoadItemCached(CFileItem* pItem); + virtual bool LoadItemLookup(CFileItem* pItem); +@@ -78,7 +80,7 @@ class CVideoThumbLoader : public CThumbLoader, public CJobQueue + \param item the CFileItem object to fill + \return true if we fill the thumb, false otherwise + */ +- static bool FillThumb(CFileItem &item); ++ virtual bool FillThumb(CFileItem &item); + + /*! \brief Find a particular art type for a given item, optionally checking at the folder level + \param item the CFileItem to search. +@@ -124,9 +126,6 @@ class CVideoThumbLoader : public CThumbLoader, public CJobQueue + static void SetArt(CFileItem &item, const std::map &artwork); + + protected: +- virtual void OnLoaderStart(); +- virtual void OnLoaderFinish(); +- + IStreamDetailsObserver *m_pStreamDetailsObs; + CVideoDatabase *m_videoDatabase; + typedef std::map > ArtCache; +-- +1.8.1.6 + + +From 428b580064c5b7a14444d66bb18bdfe94b4046ab Mon Sep 17 00:00:00 2001 +From: arnova +Date: Tue, 2 Jul 2013 22:49:55 +0200 +Subject: [PATCH 5/6] fixed: Music thumb loading for files view was slow + +This was caused by the fact that we never checked for cached images for music items +--- + xbmc/music/MusicThumbLoader.cpp | 14 +++++++++++++- + 1 file changed, 13 insertions(+), 1 deletion(-) + +diff --git a/xbmc/music/MusicThumbLoader.cpp b/xbmc/music/MusicThumbLoader.cpp +index 88cd10a..1330ff9 100644 +--- a/xbmc/music/MusicThumbLoader.cpp ++++ b/xbmc/music/MusicThumbLoader.cpp +@@ -83,9 +83,21 @@ bool CMusicThumbLoader::LoadItemCached(CFileItem* pItem) + return true; + } + ++ if (!pItem->HasArt("thumb")) ++ { ++ std::string art = GetCachedImage(*pItem, "thumb"); ++ if (!art.empty()) ++ pItem->SetArt("thumb", art); ++ } ++ + if (!pItem->HasArt("fanart")) + { +- if (pItem->HasMusicInfoTag() && !pItem->GetMusicInfoTag()->GetArtist().empty()) ++ std::string art = GetCachedImage(*pItem, "fanart"); ++ if (!art.empty()) ++ { ++ pItem->SetArt("fanart", art); ++ } ++ else if (pItem->HasMusicInfoTag() && !pItem->GetMusicInfoTag()->GetArtist().empty()) + { + std::string artist = pItem->GetMusicInfoTag()->GetArtist()[0]; + m_musicDatabase->Open(); +-- +1.8.1.6 + + +From 487cd9f6b568f3af71b73ce03afb405dbf8fb511 Mon Sep 17 00:00:00 2001 +From: arnova +Date: Wed, 3 Jul 2013 10:25:34 +0200 +Subject: [PATCH 6/6] fixed: Thumb/flag extractions were never stored when used + outside the bg infoloader + +Also factored out some (obsolote?) code as a bonus +--- + xbmc/utils/StreamDetails.h | 7 ----- + xbmc/video/VideoThumbLoader.cpp | 45 ++++++++++++++++++++----------- + xbmc/video/VideoThumbLoader.h | 3 --- + xbmc/video/windows/GUIWindowVideoBase.cpp | 15 ----------- + xbmc/video/windows/GUIWindowVideoBase.h | 3 +-- + 5 files changed, 30 insertions(+), 43 deletions(-) + +diff --git a/xbmc/utils/StreamDetails.h b/xbmc/utils/StreamDetails.h +index 5d5e205..b531c00 100644 +--- a/xbmc/utils/StreamDetails.h ++++ b/xbmc/utils/StreamDetails.h +@@ -134,10 +134,3 @@ class CStreamDetails : public IArchivable, public ISerializable + CStreamDetailAudio *m_pBestAudio; + CStreamDetailSubtitle *m_pBestSubtitle; + }; +- +-class IStreamDetailsObserver +-{ +-public: +- virtual ~IStreamDetailsObserver() {} +- virtual void OnStreamDetails(const CStreamDetails &details, const CStdString &strFileName, long lFileId) = 0; +-}; +diff --git a/xbmc/video/VideoThumbLoader.cpp b/xbmc/video/VideoThumbLoader.cpp +index 714a67a..8b30ee7 100644 +--- a/xbmc/video/VideoThumbLoader.cpp ++++ b/xbmc/video/VideoThumbLoader.cpp +@@ -103,6 +103,17 @@ bool CThumbExtractor::DoWork() + m_item.SetProperty("HasAutoThumb", true); + m_item.SetProperty("AutoThumbImage", m_target); + m_item.SetArt("thumb", m_target); ++ ++ CVideoInfoTag* info = m_item.GetVideoInfoTag(); ++ if (info->m_iDbId > 0 && !info->m_type.empty()) ++ { ++ CVideoDatabase db; ++ if (db.Open()) ++ { ++ db.SetArtForItem(info->m_iDbId, info->m_type, "thumb", m_item.GetArt("thumb")); ++ db.Close(); ++ } ++ } + } + } + else if (!m_item.HasVideoInfoTag() || !m_item.GetVideoInfoTag()->HasStreamDetails()) +@@ -112,11 +123,27 @@ bool CThumbExtractor::DoWork() + result = CDVDFileInfo::GetFileStreamDetails(&m_item); + } + +- return result; ++ if (result) ++ { ++ CVideoInfoTag* info = m_item.GetVideoInfoTag(); ++ CVideoDatabase db; ++ if (db.Open()) ++ { ++ if (info->m_iFileId < 0) ++ db.SetStreamDetailsForFile(info->m_streamDetails, !info->m_strFileNameAndPath.IsEmpty() ? info->m_strFileNameAndPath : m_item.GetPath()); ++ else ++ db.SetStreamDetailsForFileId(info->m_streamDetails, info->m_iFileId); ++ ++ db.Close(); ++ } ++ return true; ++ } ++ ++ return false; + } + + CVideoThumbLoader::CVideoThumbLoader() : +- CThumbLoader(), CJobQueue(true), m_pStreamDetailsObs(NULL) ++ CThumbLoader(), CJobQueue(true) + { + m_videoDatabase = new CVideoDatabase(); + } +@@ -481,21 +508,7 @@ void CVideoThumbLoader::OnJobComplete(unsigned int jobID, bool success, CJob* jo + { + CThumbExtractor* loader = (CThumbExtractor*)job; + loader->m_item.SetPath(loader->m_listpath); +- CVideoInfoTag* info = loader->m_item.GetVideoInfoTag(); +- +- if (loader->m_thumb && info->m_iDbId > 0 && !info->m_type.empty()) +- { +- // This runs in a different thread than the CVideoThumbLoader object. +- CVideoDatabase db; +- if (db.Open()) +- { +- db.SetArtForItem(info->m_iDbId, info->m_type, "thumb", loader->m_item.GetArt("thumb")); +- db.Close(); +- } +- } + +- if (m_pStreamDetailsObs) +- m_pStreamDetailsObs->OnStreamDetails(info->m_streamDetails, !info->m_strFileNameAndPath.IsEmpty() ? info->m_strFileNameAndPath : loader->m_item.GetPath(), info->m_iFileId); + if (m_pObserver) + m_pObserver->OnItemLoaded(&loader->m_item); + CFileItemPtr pItem(new CFileItem(loader->m_item)); +diff --git a/xbmc/video/VideoThumbLoader.h b/xbmc/video/VideoThumbLoader.h +index 6567a98..906c82c 100644 +--- a/xbmc/video/VideoThumbLoader.h ++++ b/xbmc/video/VideoThumbLoader.h +@@ -25,7 +25,6 @@ + #include "FileItem.h" + + class CStreamDetails; +-class IStreamDetailsObserver; + class CVideoDatabase; + + /*! +@@ -72,7 +71,6 @@ class CVideoThumbLoader : public CThumbLoader, public CJobQueue + virtual bool LoadItem(CFileItem* pItem); + virtual bool LoadItemCached(CFileItem* pItem); + virtual bool LoadItemLookup(CFileItem* pItem); +- void SetStreamDetailsObserver(IStreamDetailsObserver *pObs) { m_pStreamDetailsObs = pObs; } + + /*! \brief Fill the thumb of a video item + First uses a cached thumb from a previous run, then checks for a local thumb +@@ -126,7 +124,6 @@ class CVideoThumbLoader : public CThumbLoader, public CJobQueue + static void SetArt(CFileItem &item, const std::map &artwork); + + protected: +- IStreamDetailsObserver *m_pStreamDetailsObs; + CVideoDatabase *m_videoDatabase; + typedef std::map > ArtCache; + ArtCache m_showArt; +diff --git a/xbmc/video/windows/GUIWindowVideoBase.cpp b/xbmc/video/windows/GUIWindowVideoBase.cpp +index b881699..119e1d4 100644 +--- a/xbmc/video/windows/GUIWindowVideoBase.cpp ++++ b/xbmc/video/windows/GUIWindowVideoBase.cpp +@@ -102,7 +102,6 @@ + : CGUIMediaWindow(id, xmlFile) + { + m_thumbLoader.SetObserver(this); +- m_thumbLoader.SetStreamDetailsObserver(this); + m_stackingAvailable = true; + } + +@@ -1191,20 +1190,6 @@ bool CGUIWindowVideoBase::OnResumeItem(int iItem) + return OnFileAction(iItem, SELECT_ACTION_PLAY); + } + +-void CGUIWindowVideoBase::OnStreamDetails(const CStreamDetails &details, const CStdString &strFileName, long lFileId) +-{ +- CVideoDatabase db; +- if (db.Open()) +- { +- if (lFileId < 0) +- db.SetStreamDetailsForFile(details, strFileName); +- else +- db.SetStreamDetailsForFileId(details, lFileId); +- +- db.Close(); +- } +-} +- + void CGUIWindowVideoBase::GetContextButtons(int itemNumber, CContextButtons &buttons) + { + CFileItemPtr item; +diff --git a/xbmc/video/windows/GUIWindowVideoBase.h b/xbmc/video/windows/GUIWindowVideoBase.h +index c77a2ac..d994ac7 100644 +--- a/xbmc/video/windows/GUIWindowVideoBase.h ++++ b/xbmc/video/windows/GUIWindowVideoBase.h +@@ -36,7 +36,7 @@ enum VideoSelectAction + SELECT_ACTION_PLAYPART + }; + +-class CGUIWindowVideoBase : public CGUIMediaWindow, public IBackgroundLoaderObserver, public IStreamDetailsObserver ++class CGUIWindowVideoBase : public CGUIMediaWindow, public IBackgroundLoaderObserver + { + public: + CGUIWindowVideoBase(int id, const CStdString &xmlFile); +@@ -50,7 +50,6 @@ class CGUIWindowVideoBase : public CGUIMediaWindow, public IBackgroundLoaderObse + + void AddToDatabase(int iItem); + virtual void OnInfo(CFileItem* pItem, const ADDON::ScraperPtr& scraper); +- virtual void OnStreamDetails(const CStreamDetails &details, const CStdString &strFileName, long lFileId); + static void MarkWatched(const CFileItemPtr &pItem, bool bMark); + static void UpdateVideoTitle(const CFileItem* pItem); + +-- +1.8.1.6 + diff --git a/packages/mediacenter/xbmc/patches/12.2-ad84e88/todo/xbmc-990.26.03-PR2890.patch b/packages/mediacenter/xbmc/patches/12.2-ad84e88/todo/xbmc-990.26.03-PR2890.patch new file mode 100644 index 0000000000..8bca4acf61 --- /dev/null +++ b/packages/mediacenter/xbmc/patches/12.2-ad84e88/todo/xbmc-990.26.03-PR2890.patch @@ -0,0 +1,68 @@ +From 94817e6fa85e2e0b39d1f0f96795435a4256fe7b Mon Sep 17 00:00:00 2001 +From: arnova +Date: Sun, 7 Jul 2013 12:27:08 +0200 +Subject: [PATCH] fixed: MusicInfoTag loader locked up after + 9752e490e40e69d53e9dbb10a972dff533192570 + +--- + xbmc/BackgroundInfoLoader.cpp | 6 +++++- + xbmc/BackgroundInfoLoader.h | 1 + + 2 files changed, 6 insertions(+), 1 deletion(-) + +diff --git a/xbmc/BackgroundInfoLoader.cpp b/xbmc/BackgroundInfoLoader.cpp +index 8e488d0..1cd6e62 100644 +--- a/xbmc/BackgroundInfoLoader.cpp ++++ b/xbmc/BackgroundInfoLoader.cpp +@@ -32,6 +32,7 @@ + m_pObserver=NULL; + m_pProgressCallback=NULL; + m_pVecItems = NULL; ++ m_bIsLoading = false; + } + + CBackgroundInfoLoader::~CBackgroundInfoLoader() +@@ -88,6 +89,7 @@ void CBackgroundInfoLoader::Run() + } + } + ++ m_bIsLoading = false; + OnLoaderFinish(); + } + catch (...) +@@ -110,6 +112,7 @@ void CBackgroundInfoLoader::Load(CFileItemList& items) + + m_pVecItems = &items; + m_bStop = false; ++ m_bIsLoading = true; + + m_thread = new CThread(this, "BackgroundLoader"); + m_thread->Create(); +@@ -136,11 +139,12 @@ void CBackgroundInfoLoader::StopThread() + } + m_vecItems.clear(); + m_pVecItems = NULL; ++ m_bIsLoading = false; + } + + bool CBackgroundInfoLoader::IsLoading() + { +- return m_thread != NULL; ++ return m_bIsLoading; + } + + void CBackgroundInfoLoader::SetObserver(IBackgroundLoaderObserver* pObserver) +diff --git a/xbmc/BackgroundInfoLoader.h b/xbmc/BackgroundInfoLoader.h +index 3a214a3..3cf28db 100644 +--- a/xbmc/BackgroundInfoLoader.h ++++ b/xbmc/BackgroundInfoLoader.h +@@ -63,6 +63,7 @@ class CBackgroundInfoLoader : public IRunnable + std::vector m_vecItems; // FileItemList would delete the items and we only want to keep a reference. + CCriticalSection m_lock; + ++ volatile bool m_bIsLoading; + volatile bool m_bStop; + CThread *m_thread; + +-- +1.8.1.6 + diff --git a/packages/mediacenter/xbmc/patches/12.2-ad84e88/todo/xbmc-990.26.04-PR2890.patch b/packages/mediacenter/xbmc/patches/12.2-ad84e88/todo/xbmc-990.26.04-PR2890.patch new file mode 100644 index 0000000000..7b47dc3bf7 --- /dev/null +++ b/packages/mediacenter/xbmc/patches/12.2-ad84e88/todo/xbmc-990.26.04-PR2890.patch @@ -0,0 +1,31 @@ +From fe1856c912e47a86081d08e25d95b2efcc3e14ac Mon Sep 17 00:00:00 2001 +From: arnova +Date: Mon, 8 Jul 2013 08:29:37 +0200 +Subject: [PATCH] fixed: Little fixup for + 94817e6fa85e2e0b39d1f0f96795435a4256fe7b (thanks JM) + +--- + xbmc/BackgroundInfoLoader.cpp | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/xbmc/BackgroundInfoLoader.cpp b/xbmc/BackgroundInfoLoader.cpp +index 1cd6e62..43dfb49 100644 +--- a/xbmc/BackgroundInfoLoader.cpp ++++ b/xbmc/BackgroundInfoLoader.cpp +@@ -89,11 +89,12 @@ void CBackgroundInfoLoader::Run() + } + } + +- m_bIsLoading = false; + OnLoaderFinish(); ++ m_bIsLoading = false; + } + catch (...) + { ++ m_bIsLoading = false; + CLog::Log(LOGERROR, "%s - Unhandled exception", __FUNCTION__); + } + } +-- +1.8.1.6 + diff --git a/packages/mediacenter/xbmc/patches/12.2-ad84e88/todo/xbmc-990.27-PR2232.patch.bk b/packages/mediacenter/xbmc/patches/12.2-ad84e88/todo/xbmc-990.27-PR2232.patch.bk new file mode 100644 index 0000000000..fff3c4477f --- /dev/null +++ b/packages/mediacenter/xbmc/patches/12.2-ad84e88/todo/xbmc-990.27-PR2232.patch.bk @@ -0,0 +1,746 @@ +From 1a93a46fe38c926ccd7658ce6f8c827d0491c117 Mon Sep 17 00:00:00 2001 +From: stupid-boy +Date: Wed, 13 Feb 2013 23:47:07 +0200 +Subject: [PATCH 1/2] [OMXPlayer] Both HDMI and Analog output + +--- + xbmc/cores/omxplayer/OMXAudio.cpp | 407 +++++++++++++++++++++++++------- + xbmc/cores/omxplayer/OMXAudio.h | 12 +- + xbmc/cores/omxplayer/OMXPlayerAudio.cpp | 9 +- + xbmc/settings/GUISettings.cpp | 2 + + xbmc/settings/GUISettings.h | 3 + + 5 files changed, 341 insertions(+), 92 deletions(-) + +diff --git a/xbmc/cores/omxplayer/OMXAudio.cpp b/xbmc/cores/omxplayer/OMXAudio.cpp +index 10c3329..1470685 100644 +--- a/xbmc/cores/omxplayer/OMXAudio.cpp ++++ b/xbmc/cores/omxplayer/OMXAudio.cpp +@@ -111,8 +111,7 @@ + m_eEncoding (OMX_AUDIO_CodingPCM), + m_extradata (NULL ), + m_extrasize (0 ), +- m_last_pts (DVD_NOPTS_VALUE), +- m_omx_render (NULL ) ++ m_last_pts (DVD_NOPTS_VALUE) + { + m_vizBufferSize = m_vizRemapBufferSize = VIS_PACKET_SIZE * sizeof(float); + m_vizRemapBuffer = (uint8_t *)_aligned_malloc(m_vizRemapBufferSize,16); +@@ -161,7 +160,7 @@ CAEChannelInfo COMXAudio::GetChannelLayout(AEAudioFormat format) + return info; + } + +-bool COMXAudio::Initialize(AEAudioFormat format, std::string& device, OMXClock *clock, CDVDStreamInfo &hints, bool bUsePassthrough, bool bUseHWDecode) ++bool COMXAudio::Initialize(AEAudioFormat format, OMXClock *clock, CDVDStreamInfo &hints, bool bUsePassthrough, bool bUseHWDecode) + { + Deinitialize(); + +@@ -320,32 +319,62 @@ bool COMXAudio::Initialize(AEAudioFormat format, std::string& device, OMXClock * + + componentName = "OMX.broadcom.audio_render"; + +- if(!m_omx_render) +- m_omx_render = new COMXCoreComponent(); +- if(!m_omx_render) ++ std::string device = ""; ++ ++ if((g_guiSettings.GetInt("audiooutput.mode") == AUDIO_HDMI) || ++ (g_guiSettings.GetInt("audiooutput.mode") == AUDIO_BOTH)) + { +- CLog::Log(LOGERROR, "COMXAudio::Initialize error allocate OMX.broadcom.audio_render\n"); +- return false; ++ device = "hdmi"; ++ if(!m_omx_render_HDMI.Initialize((const std::string)componentName, OMX_IndexParamAudioInit)) ++ return false; ++ ++ OMX_CONFIG_BRCMAUDIODESTINATIONTYPE audioDest; ++ OMX_INIT_STRUCTURE(audioDest); ++ strncpy((char *)audioDest.sName, device.c_str(), strlen(device.c_str())); ++ ++ omx_err = m_omx_render_HDMI.SetConfig(OMX_IndexConfigBrcmAudioDestination, &audioDest); ++ if (omx_err != OMX_ErrorNone) ++ return false; ++ ++ OMX_CONFIG_BOOLEANTYPE configBool; ++ OMX_INIT_STRUCTURE(configBool); ++ configBool.bEnabled = OMX_FALSE; ++ ++ omx_err = m_omx_render_HDMI.SetConfig(OMX_IndexConfigBrcmClockReferenceSource, &configBool); ++ if (omx_err != OMX_ErrorNone) ++ return false; + } + +- if(!m_omx_render->Initialize((const std::string)componentName, OMX_IndexParamAudioInit)) +- return false; ++ if((g_guiSettings.GetInt("audiooutput.mode") == AUDIO_ANALOG) || ++ (g_guiSettings.GetInt("audiooutput.mode") == AUDIO_BOTH)) ++ { ++ device = "local"; ++ if(!m_omx_render_analog.Initialize((const std::string)componentName, OMX_IndexParamAudioInit)) ++ return false; + +- OMX_CONFIG_BRCMAUDIODESTINATIONTYPE audioDest; +- OMX_INIT_STRUCTURE(audioDest); +- strncpy((char *)audioDest.sName, device.c_str(), strlen(device.c_str())); ++ OMX_CONFIG_BRCMAUDIODESTINATIONTYPE audioDest; ++ OMX_INIT_STRUCTURE(audioDest); ++ strncpy((char *)audioDest.sName, device.c_str(), strlen(device.c_str())); + +- omx_err = m_omx_render->SetConfig(OMX_IndexConfigBrcmAudioDestination, &audioDest); +- if (omx_err != OMX_ErrorNone) +- return false; ++ omx_err = m_omx_render_analog.SetConfig(OMX_IndexConfigBrcmAudioDestination, &audioDest); ++ if (omx_err != OMX_ErrorNone) ++ return false; + +- OMX_CONFIG_BOOLEANTYPE configBool; +- OMX_INIT_STRUCTURE(configBool); +- configBool.bEnabled = OMX_FALSE; ++ OMX_CONFIG_BOOLEANTYPE configBool; ++ OMX_INIT_STRUCTURE(configBool); ++ configBool.bEnabled = OMX_FALSE; + +- omx_err = m_omx_render->SetConfig(OMX_IndexConfigBrcmClockReferenceSource, &configBool); +- if (omx_err != OMX_ErrorNone) +- return false; ++ omx_err = m_omx_render_analog.SetConfig(OMX_IndexConfigBrcmClockReferenceSource, &configBool); ++ if (omx_err != OMX_ErrorNone) ++ return false; ++ } ++ ++ if(g_guiSettings.GetInt("audiooutput.mode") == AUDIO_BOTH) ++ { ++ componentName = "OMX.broadcom.audio_splitter"; ++ if(!m_omx_splitter.Initialize((const std::string)componentName, OMX_IndexParamAudioInit)) ++ return false; ++ } + + componentName = "OMX.broadcom.audio_decode"; + if(!m_omx_decoder.Initialize((const std::string)componentName, OMX_IndexParamAudioInit)) +@@ -411,13 +440,30 @@ bool COMXAudio::Initialize(AEAudioFormat format, std::string& device, OMXClock * + } + } + +- m_omx_tunnel_clock.Initialize(m_omx_clock, m_omx_clock->GetInputPort(), m_omx_render, m_omx_render->GetInputPort()+1); ++ if( m_omx_render_analog.IsInitialized()) ++ { ++ m_omx_tunnel_clock_analog.Initialize(m_omx_clock, m_omx_clock->GetInputPort(), ++ &m_omx_render_analog, m_omx_render_analog.GetInputPort()+1); + +- omx_err = m_omx_tunnel_clock.Establish(false); +- if(omx_err != OMX_ErrorNone) ++ omx_err = m_omx_tunnel_clock_analog.Establish(false, true); ++ if(omx_err != OMX_ErrorNone) ++ { ++ CLog::Log(LOGERROR, "COMXAudio::Initialize m_omx_tunnel_clock_analog.Establish\n"); ++ return false; ++ } ++ } ++ ++ if( m_omx_render_HDMI.IsInitialized()) + { +- CLog::Log(LOGERROR, "COMXAudio::Initialize m_omx_tunnel_clock.Establish\n"); +- return false; ++ m_omx_tunnel_clock_HDMI.Initialize(m_omx_clock, m_omx_clock->GetInputPort()+ ( m_omx_render_analog.IsInitialized() ? 2 : 0), ++ &m_omx_render_HDMI, m_omx_render_HDMI.GetInputPort()+1); ++ ++ omx_err = m_omx_tunnel_clock_HDMI.Establish(false, true); ++ if(omx_err != OMX_ErrorNone) ++ { ++ CLog::Log(LOGERROR, "COMXAudio::Initialize m_omx_tunnel_clock_HDMI.Establish\n"); ++ return false; ++ } + } + + omx_err = m_omx_decoder.AllocInputBuffers(); +@@ -443,12 +489,56 @@ bool COMXAudio::Initialize(AEAudioFormat format, std::string& device, OMXClock * + return false; + } + +- m_omx_tunnel_mixer.Initialize(&m_omx_mixer, m_omx_mixer.GetOutputPort(), m_omx_render, m_omx_render->GetInputPort()); +- omx_err = m_omx_tunnel_mixer.Establish(false); +- if(omx_err != OMX_ErrorNone) ++ if(g_guiSettings.GetInt("audiooutput.mode") == AUDIO_ANALOG) + { +- CLog::Log(LOGERROR, "COMXAudio::Initialize - Error m_omx_tunnel_decoder.Establish 0x%08x", omx_err); +- return false; ++ m_omx_tunnel_mixer.Initialize(&m_omx_mixer, m_omx_mixer.GetOutputPort(), ++ &m_omx_render_analog, m_omx_render_analog.GetInputPort()); ++ omx_err = m_omx_tunnel_mixer.Establish(false); ++ if(omx_err != OMX_ErrorNone) ++ { ++ CLog::Log(LOGERROR, "COMXAudio::Initialize - Error m_omx_tunnel_decoder.Establish 0x%08x", omx_err); ++ return false; ++ } ++ } ++ else if (g_guiSettings.GetInt("audiooutput.mode") == AUDIO_HDMI) ++ { ++ m_omx_tunnel_mixer.Initialize(&m_omx_mixer, m_omx_mixer.GetOutputPort(), ++ &m_omx_render_HDMI, m_omx_render_HDMI.GetInputPort()); ++ omx_err = m_omx_tunnel_mixer.Establish(false); ++ if(omx_err != OMX_ErrorNone) ++ { ++ CLog::Log(LOGERROR, "COMXAudio::Initialize - Error m_omx_tunnel_decoder.Establish 0x%08x", omx_err); ++ return false; ++ } ++ } ++ else // AUDIO_BOTH ++ { ++ m_omx_tunnel_mixer.Initialize(&m_omx_mixer, m_omx_mixer.GetOutputPort(), ++ &m_omx_splitter, m_omx_splitter.GetInputPort()); ++ omx_err = m_omx_tunnel_mixer.Establish(false); ++ if(omx_err != OMX_ErrorNone) ++ { ++ CLog::Log(LOGERROR, "COMXAudio::Initialize - Error m_omx_tunnel_mixer.Establish 0x%08x", omx_err); ++ return false; ++ } ++ ++ m_omx_tunnel_splitter_analog.Initialize(&m_omx_splitter, m_omx_splitter.GetOutputPort(), ++ &m_omx_render_analog, m_omx_render_analog.GetInputPort()); ++ omx_err = m_omx_tunnel_splitter_analog.Establish(false); ++ if(omx_err != OMX_ErrorNone) ++ { ++ CLog::Log(LOGERROR, "COMXAudio::Initialize - Error m_omx_tunnel_splitter_analog.Establish 0x%08x", omx_err); ++ return false; ++ } ++ ++ m_omx_tunnel_splitter_HDMI.Initialize(&m_omx_splitter, m_omx_splitter.GetOutputPort() + 1, ++ &m_omx_render_HDMI, m_omx_render_HDMI.GetInputPort()); ++ omx_err = m_omx_tunnel_splitter_HDMI.Establish(false); ++ if(omx_err != OMX_ErrorNone) ++ { ++ CLog::Log(LOGERROR, "COMXAudio::Initialize - Error m_omx_tunnel_splitter_HDMI.Establish 0x%08x", omx_err); ++ return false; ++ } + } + + omx_err = m_omx_mixer.SetStateForComponent(OMX_StateExecuting); +@@ -459,7 +549,9 @@ bool COMXAudio::Initialize(AEAudioFormat format, std::string& device, OMXClock * + } + else + { +- m_omx_tunnel_decoder.Initialize(&m_omx_decoder, m_omx_decoder.GetOutputPort(), m_omx_render, m_omx_render->GetInputPort()); ++ // Passthrough work only for HDMI ++ m_omx_tunnel_decoder.Initialize(&m_omx_decoder, m_omx_decoder.GetOutputPort(), ++ &m_omx_render_HDMI, m_omx_render_HDMI.GetInputPort()); + omx_err = m_omx_tunnel_decoder.Establish(false); + if(omx_err != OMX_ErrorNone) + { +@@ -474,11 +566,34 @@ bool COMXAudio::Initialize(AEAudioFormat format, std::string& device, OMXClock * + } + } + +- omx_err = m_omx_render->SetStateForComponent(OMX_StateExecuting); +- if(omx_err != OMX_ErrorNone) ++ if ( m_omx_splitter.IsInitialized()) + { +- CLog::Log(LOGERROR, "COMXAudio::Initialize - Error setting OMX_StateExecuting 0x%08x", omx_err); +- return false; ++ omx_err = m_omx_splitter.SetStateForComponent(OMX_StateExecuting); ++ if(omx_err != OMX_ErrorNone) ++ { ++ CLog::Log(LOGERROR, "COMXAudio::Initialize - Error setting OMX_StateExecuting 0x%08x for m_omx_splitter", omx_err); ++ return false; ++ } ++ } ++ ++ if ( m_omx_render_analog.IsInitialized()) ++ { ++ omx_err = m_omx_render_analog.SetStateForComponent(OMX_StateExecuting); ++ if(omx_err != OMX_ErrorNone) ++ { ++ CLog::Log(LOGERROR, "COMXAudio::Initialize - Error setting OMX_StateExecuting 0x%08x for m_omx_render_analog", omx_err); ++ return false; ++ } ++ } ++ ++ if ( m_omx_render_HDMI.IsInitialized()) ++ { ++ omx_err = m_omx_render_HDMI.SetStateForComponent(OMX_StateExecuting); ++ if(omx_err != OMX_ErrorNone) ++ { ++ CLog::Log(LOGERROR, "COMXAudio::Initialize - Error setting OMX_StateExecuting 0x%08x for m_omx_render_HDMI", omx_err); ++ return false; ++ } + } + + m_omx_decoder.EnablePort(m_omx_decoder.GetInputPort(), true); +@@ -570,9 +685,12 @@ bool COMXAudio::Deinitialize() + m_omx_tunnel_decoder.Flush(); + if(!m_Passthrough) + m_omx_tunnel_mixer.Flush(); +- m_omx_tunnel_clock.Flush(); + +- m_omx_tunnel_clock.Deestablish(); ++ m_omx_tunnel_clock_analog.Flush(); ++ m_omx_tunnel_clock_HDMI.Flush(); ++ m_omx_tunnel_clock_analog.Deestablish(); ++ m_omx_tunnel_clock_HDMI.Deestablish(); ++ + if(!m_Passthrough) + { + // workaround for the strange BCM mixer component +@@ -587,8 +705,16 @@ bool COMXAudio::Deinitialize() + + m_omx_decoder.FlushInput(); + +- if(m_omx_render) +- m_omx_render->Deinitialize(true); ++ m_omx_tunnel_splitter_analog.Flush(); ++ m_omx_tunnel_splitter_analog.Deestablish(true); ++ m_omx_tunnel_splitter_HDMI.Flush(); ++ m_omx_tunnel_splitter_HDMI.Deestablish(true); ++ ++ m_omx_splitter.Deinitialize(true); ++ ++ m_omx_render_analog.Deinitialize(true); ++ m_omx_render_HDMI.Deinitialize(true); ++ + if(!m_Passthrough) + m_omx_mixer.Deinitialize(true); + m_omx_decoder.Deinitialize(true); +@@ -613,9 +739,6 @@ bool COMXAudio::Deinitialize() + m_first_frame = true; + m_last_pts = DVD_NOPTS_VALUE; + +- delete m_omx_render; +- m_omx_render = NULL; +- + return true; + } + +@@ -696,7 +819,7 @@ void COMXAudio::Mute(bool bMute) + //*********************************************************************************************** + bool COMXAudio::SetCurrentVolume(float fVolume) + { +- CSingleLock lock (m_critSection); ++CSingleLock lock (m_critSection); + + if(!m_Initialized || m_Passthrough) + return false; +@@ -754,22 +877,39 @@ bool COMXAudio::SetCurrentVolume(float fVolume) + { + OMX_AUDIO_CONFIG_VOLUMETYPE volume; + OMX_INIT_STRUCTURE(volume); +- volume.nPortIndex = m_omx_render->GetInputPort(); ++ OMX_ERRORTYPE omx_err; + + volume.bLinear = OMX_TRUE; + float hardwareVolume = fVolume * gain * 100.0f; + volume.sVolume.nValue = (int)(hardwareVolume + 0.5f); + +- OMX_ERRORTYPE omx_err = +- m_omx_render->SetConfig(OMX_IndexConfigAudioVolume, &volume); +- if(omx_err != OMX_ErrorNone) ++ if(m_omx_render_analog.IsInitialized()) + { +- CLog::Log(LOGERROR, "%s::%s - error setting OMX_IndexConfigAudioVolume, error 0x%08x\n", ++ volume.nPortIndex = m_omx_render_analog.GetInputPort(); ++ omx_err = m_omx_render_analog.SetConfig(OMX_IndexConfigAudioVolume, &volume); ++ if(omx_err != OMX_ErrorNone) ++ { ++ CLog::Log(LOGERROR, "%s::%s - error setting OMX_IndexConfigAudioVolume, error 0x%08x for m_omx_render_analog\n", + CLASSNAME, __func__, omx_err); +- return false; ++ return false; ++ } ++ } ++ if(m_omx_render_HDMI.IsInitialized()) ++ { ++ volume.nPortIndex = m_omx_render_HDMI.GetInputPort(); ++ omx_err = m_omx_render_HDMI.SetConfig(OMX_IndexConfigAudioVolume, &volume); ++ if(omx_err != OMX_ErrorNone) ++ { ++ CLog::Log(LOGERROR, "%s::%s - error setting OMX_IndexConfigAudioVolume, error 0x%08x for m_omx_render_HDMI\n", ++ CLASSNAME, __func__, omx_err); ++ return false; ++ } + } ++ + } + return true; ++ ++ return true; + } + + +@@ -927,7 +1067,18 @@ unsigned int COMXAudio::AddPackets(const void* data, unsigned int len, double dt + m_first_frame = false; + //m_omx_render.WaitForEvent(OMX_EventPortSettingsChanged); + +- m_omx_render->DisablePort(m_omx_render->GetInputPort(), false); ++ if(m_omx_render_analog.IsInitialized()) ++ m_omx_render_analog.DisablePort(m_omx_render_analog.GetInputPort(), false); ++ if(m_omx_render_HDMI.IsInitialized()) ++ m_omx_render_HDMI.DisablePort(m_omx_render_HDMI.GetInputPort(), false); ++ ++ if(m_omx_splitter.IsInitialized()) ++ { ++ m_omx_splitter.DisablePort(m_omx_splitter.GetOutputPort(), false); ++ m_omx_splitter.DisablePort(m_omx_splitter.GetOutputPort()+1, false); ++ m_omx_splitter.DisablePort(m_omx_splitter.GetInputPort(), false); ++ } ++ + if(!m_Passthrough) + { + m_omx_mixer.DisablePort(m_omx_mixer.GetOutputPort(), false); +@@ -965,6 +1116,11 @@ unsigned int COMXAudio::AddPackets(const void* data, unsigned int len, double dt + } + + m_pcm_output.nSamplingRate = m_format.m_sampleRate; ++ // "Currently this component only supports raw PCM on all audio ports." ++ if(m_omx_splitter.IsInitialized()) ++ { ++ m_pcm_output.ePCMMode = OMX_AUDIO_PCMModeLinear; ++ } + + /* setup mixer output */ + m_pcm_output.nPortIndex = m_omx_mixer.GetOutputPort(); +@@ -981,16 +1137,64 @@ unsigned int COMXAudio::AddPackets(const void* data, unsigned int len, double dt + + m_pcm_output.nSamplingRate = m_format.m_sampleRate; + +- m_pcm_output.nPortIndex = m_omx_render->GetInputPort(); +- omx_err = m_omx_render->SetParameter(OMX_IndexParamAudioPcm, &m_pcm_output); +- if(omx_err != OMX_ErrorNone) ++ if(m_omx_splitter.IsInitialized()) + { +- CLog::Log(LOGERROR, "COMXAudio::AddPackets error SetParameter 1 render omx_err(0x%08x)\n", omx_err); ++ m_pcm_output.nPortIndex = m_omx_splitter.GetInputPort(); ++ omx_err = m_omx_splitter.SetParameter(OMX_IndexParamAudioPcm, &m_pcm_output); ++ if(omx_err != OMX_ErrorNone) ++ { ++ CLog::Log(LOGERROR, "COMXAudio::AddPackets error SetParameter 1 omx_err(0x%08x) for m_omx_splitter\n", omx_err); ++ } ++ ++ ++ // Splitter will copy input params to output when input port is enabled. ++ omx_err = m_omx_splitter.SetStateForComponent(OMX_StateIdle); ++ if(omx_err != OMX_ErrorNone) ++ { ++ CLog::Log(LOGERROR, "COMXAudio::AddPackets - Error setting OMX_StateIdle 0x%08x for m_omx_splitter", omx_err); ++ return false; ++ } ++ ++ m_omx_splitter.EnablePort(m_omx_splitter.GetInputPort(), false); ++ m_omx_splitter.DisablePort(m_omx_splitter.GetInputPort(), false); ++ ++ omx_err = m_omx_splitter.SetStateForComponent(OMX_StateExecuting); ++ if(omx_err != OMX_ErrorNone) ++ { ++ CLog::Log(LOGERROR, "COMXAudio::AddPackets - Error setting OMX_StateExecuting 0x%08x for m_omx_splitter", omx_err); ++ return false; ++ } ++ ++ m_pcm_output.nPortIndex = m_omx_splitter.GetOutputPort(); ++ omx_err = m_omx_splitter.GetParameter(OMX_IndexParamAudioPcm, &m_pcm_output); ++ if(omx_err != OMX_ErrorNone) ++ { ++ CLog::Log(LOGERROR, "COMXAudio::AddPackets error GetParameter 3 omx_err(0x%08x) for m_omx_splitter\n", omx_err); ++ } ++ ++ m_pcm_output.nSamplingRate = m_format.m_sampleRate; + } +- omx_err = m_omx_render->GetParameter(OMX_IndexParamAudioPcm, &m_pcm_output); +- if(omx_err != OMX_ErrorNone) ++ ++ if(m_omx_render_analog.IsInitialized()) ++ { ++ m_pcm_output.nPortIndex = m_omx_render_analog.GetInputPort(); ++ omx_err = m_omx_render_analog.SetParameter(OMX_IndexParamAudioPcm, &m_pcm_output); ++ if(omx_err != OMX_ErrorNone) ++ { ++ CLog::Log(LOGERROR, "COMXAudio::AddPackets error SetParameter 1 render omx_err(0x%08x) for m_omx_render_analog\n", omx_err); ++ } ++ ++ } ++ ++ if(m_omx_render_HDMI.IsInitialized()) + { +- CLog::Log(LOGERROR, "COMXAudio::AddPackets error GetParameter 2 render omx_err(0x%08x)\n", omx_err); ++ m_pcm_output.nPortIndex = m_omx_render_HDMI.GetInputPort(); ++ omx_err = m_omx_render_HDMI.SetParameter(OMX_IndexParamAudioPcm, &m_pcm_output); ++ if(omx_err != OMX_ErrorNone) ++ { ++ CLog::Log(LOGERROR, "COMXAudio::AddPackets error SetParameter 1 render omx_err(0x%08x) for m_omx_render_HDMI\n", omx_err); ++ } ++ + } + + PrintPCM(&m_pcm_input, std::string("input")); +@@ -1000,9 +1204,9 @@ unsigned int COMXAudio::AddPackets(const void* data, unsigned int len, double dt + { + OMX_AUDIO_PARAM_PORTFORMATTYPE formatType; + OMX_INIT_STRUCTURE(formatType); +- formatType.nPortIndex = m_omx_render->GetInputPort(); ++ formatType.nPortIndex = m_omx_render_HDMI.GetInputPort(); + +- omx_err = m_omx_render->GetParameter(OMX_IndexParamAudioPortFormat, &formatType); ++ omx_err = m_omx_render_HDMI.GetParameter(OMX_IndexParamAudioPortFormat, &formatType); + if(omx_err != OMX_ErrorNone) + { + CLog::Log(LOGERROR, "COMXAudio::AddPackets error OMX_IndexParamAudioPortFormat omx_err(0x%08x)\n", omx_err); +@@ -1011,7 +1215,7 @@ unsigned int COMXAudio::AddPackets(const void* data, unsigned int len, double dt + + formatType.eEncoding = m_eEncoding; + +- omx_err = m_omx_render->SetParameter(OMX_IndexParamAudioPortFormat, &formatType); ++ omx_err = m_omx_render_HDMI.SetParameter(OMX_IndexParamAudioPortFormat, &formatType); + if(omx_err != OMX_ErrorNone) + { + CLog::Log(LOGERROR, "COMXAudio::AddPackets error OMX_IndexParamAudioPortFormat omx_err(0x%08x)\n", omx_err); +@@ -1023,7 +1227,7 @@ unsigned int COMXAudio::AddPackets(const void* data, unsigned int len, double dt + OMX_AUDIO_PARAM_DDPTYPE m_ddParam; + OMX_INIT_STRUCTURE(m_ddParam); + +- m_ddParam.nPortIndex = m_omx_render->GetInputPort(); ++ m_ddParam.nPortIndex = m_omx_render_HDMI.GetInputPort(); + + m_ddParam.nChannels = m_format.m_channelLayout.Count(); //(m_InputChannels == 6) ? 8 : m_InputChannels; + m_ddParam.nSampleRate = m_SampleRate; +@@ -1038,13 +1242,13 @@ unsigned int COMXAudio::AddPackets(const void* data, unsigned int len, double dt + m_ddParam.eChannelMapping[i] = OMXChannels[i]; + } + +- m_omx_render->SetParameter(OMX_IndexParamAudioDdp, &m_ddParam); +- m_omx_render->GetParameter(OMX_IndexParamAudioDdp, &m_ddParam); ++ m_omx_render_HDMI.SetParameter(OMX_IndexParamAudioDdp, &m_ddParam); ++ m_omx_render_HDMI.GetParameter(OMX_IndexParamAudioDdp, &m_ddParam); + PrintDDP(&m_ddParam); + } + else if(m_eEncoding == OMX_AUDIO_CodingDTS) + { +- m_dtsParam.nPortIndex = m_omx_render->GetInputPort(); ++ m_dtsParam.nPortIndex = m_omx_render_HDMI.GetInputPort(); + + m_dtsParam.nChannels = m_format.m_channelLayout.Count(); //(m_InputChannels == 6) ? 8 : m_InputChannels; + m_dtsParam.nBitRate = 0; +@@ -1057,13 +1261,24 @@ unsigned int COMXAudio::AddPackets(const void* data, unsigned int len, double dt + m_dtsParam.eChannelMapping[i] = OMXChannels[i]; + } + +- m_omx_render->SetParameter(OMX_IndexParamAudioDts, &m_dtsParam); +- m_omx_render->GetParameter(OMX_IndexParamAudioDts, &m_dtsParam); ++ m_omx_render_HDMI.SetParameter(OMX_IndexParamAudioDts, &m_dtsParam); ++ m_omx_render_HDMI.GetParameter(OMX_IndexParamAudioDts, &m_dtsParam); + PrintDTS(&m_dtsParam); + } + } + +- m_omx_render->EnablePort(m_omx_render->GetInputPort(), false); ++ if(m_omx_render_analog.IsInitialized()) ++ m_omx_render_analog.EnablePort(m_omx_render_analog.GetInputPort(), false); ++ if(m_omx_render_HDMI.IsInitialized()) ++ m_omx_render_HDMI.EnablePort(m_omx_render_HDMI.GetInputPort(), false); ++ ++ if(m_omx_splitter.IsInitialized()) ++ { ++ m_omx_splitter.EnablePort(m_omx_splitter.GetOutputPort(), false); ++ m_omx_splitter.EnablePort(m_omx_splitter.GetOutputPort()+1, false); ++ m_omx_splitter.EnablePort(m_omx_splitter.GetInputPort(), false); ++ } ++ + if(!m_Passthrough) + { + m_omx_mixer.EnablePort(m_omx_mixer.GetOutputPort(), false); +@@ -1139,21 +1354,49 @@ unsigned int COMXAudio::GetAudioRenderingLatency() + if(!m_Initialized) + return 0; + +- OMX_PARAM_U32TYPE param; +- OMX_INIT_STRUCTURE(param); +- param.nPortIndex = m_omx_render->GetInputPort(); ++ unsigned int latAnalog = 0; ++ unsigned int latHDMI = 0; + +- OMX_ERRORTYPE omx_err = +- m_omx_render->GetConfig(OMX_IndexConfigAudioRenderingLatency, ¶m); ++ // Prefer HDMI latency if both are used ++ if(m_omx_render_analog.IsInitialized() && !m_omx_render_HDMI.IsInitialized()) ++ { ++ OMX_PARAM_U32TYPE param; ++ OMX_INIT_STRUCTURE(param); ++ param.nPortIndex = m_omx_render_analog.GetInputPort(); + +- if(omx_err != OMX_ErrorNone) ++ OMX_ERRORTYPE omx_err = ++ m_omx_render_analog.GetConfig(OMX_IndexConfigAudioRenderingLatency, ¶m); ++ ++ if(omx_err != OMX_ErrorNone) ++ { ++ CLog::Log(LOGERROR, "%s::%s - error getting OMX_IndexConfigAudioRenderingLatency error 0x%08x\n for m_omx_render_analog", ++ CLASSNAME, __func__, omx_err); ++ return 0; ++ } ++ ++ latAnalog = param.nU32; ++ } ++ ++ if(m_omx_render_HDMI.IsInitialized()) + { +- CLog::Log(LOGERROR, "%s::%s - error getting OMX_IndexConfigAudioRenderingLatency error 0x%08x\n", +- CLASSNAME, __func__, omx_err); +- return 0; ++ OMX_PARAM_U32TYPE param; ++ OMX_INIT_STRUCTURE(param); ++ param.nPortIndex = m_omx_render_HDMI.GetInputPort(); ++ ++ OMX_ERRORTYPE omx_err = ++ m_omx_render_HDMI.GetConfig(OMX_IndexConfigAudioRenderingLatency, ¶m); ++ ++ if(omx_err != OMX_ErrorNone) ++ { ++ CLog::Log(LOGERROR, "%s::%s - error getting OMX_IndexConfigAudioRenderingLatency error 0x%08x\n for m_omx_render_HDMI", ++ CLASSNAME, __func__, omx_err); ++ return 0; ++ } ++ ++ latHDMI = param.nU32; + } + +- return param.nU32; ++ return std::max(latAnalog, latHDMI); + } + + void COMXAudio::WaitCompletion() +@@ -1188,7 +1431,8 @@ void COMXAudio::WaitCompletion() + unsigned int nTimeOut = AUDIO_BUFFER_SECONDS * 1000; + while(nTimeOut) + { +- if(m_omx_render->IsEOS()) ++ if((m_omx_render_analog.IsInitialized() ? m_omx_render_analog.IsEOS() : true) && ++ (m_omx_render_HDMI.IsInitialized() ? m_omx_render_HDMI.IsEOS() : true)) + { + CLog::Log(LOGDEBUG, "%s::%s - got eos\n", CLASSNAME, __func__); + break; +@@ -1218,7 +1462,8 @@ void COMXAudio::WaitCompletion() + nTimeOut -= 50; + } + +- m_omx_render->ResetEos(); ++ m_omx_render_analog.ResetEos(); ++ m_omx_render_HDMI.ResetEos(); + + return; + } +diff --git a/xbmc/cores/omxplayer/OMXAudio.h b/xbmc/cores/omxplayer/OMXAudio.h +index d812e0a..81aeb7e 100644 +--- a/xbmc/cores/omxplayer/OMXAudio.h ++++ b/xbmc/cores/omxplayer/OMXAudio.h +@@ -60,7 +60,7 @@ class COMXAudio + float GetCacheTime(); + float GetCacheTotal(); + COMXAudio(); +- bool Initialize(AEAudioFormat format, std::string& device, OMXClock *clock, CDVDStreamInfo &hints, bool bUsePassthrough, bool bUseHWDecode); ++ bool Initialize(AEAudioFormat format, OMXClock *clock, CDVDStreamInfo &hints, bool bUsePassthrough, bool bUseHWDecode); + ~COMXAudio(); + + unsigned int AddPackets(const void* data, unsigned int len); +@@ -132,12 +132,18 @@ class COMXAudio + WAVEFORMATEXTENSIBLE m_wave_header; + AEAudioFormat m_format; + protected: +- COMXCoreComponent *m_omx_render; ++ void DumpStates(); ++ COMXCoreComponent m_omx_render_analog; ++ COMXCoreComponent m_omx_render_HDMI; ++ COMXCoreComponent m_omx_splitter; + COMXCoreComponent m_omx_mixer; + COMXCoreComponent m_omx_decoder; +- COMXCoreTunel m_omx_tunnel_clock; ++ COMXCoreTunel m_omx_tunnel_clock_analog; ++ COMXCoreTunel m_omx_tunnel_clock_HDMI; + COMXCoreTunel m_omx_tunnel_mixer; + COMXCoreTunel m_omx_tunnel_decoder; ++ COMXCoreTunel m_omx_tunnel_splitter_analog; ++ COMXCoreTunel m_omx_tunnel_splitter_HDMI; + DllAvUtil m_dllAvUtil; + + OMX_AUDIO_CHANNELTYPE m_input_channels[OMX_AUDIO_MAXCHANNELS]; +diff --git a/xbmc/cores/omxplayer/OMXPlayerAudio.cpp b/xbmc/cores/omxplayer/OMXPlayerAudio.cpp +index 58c3a4f..f3276d2 100644 +--- a/xbmc/cores/omxplayer/OMXPlayerAudio.cpp ++++ b/xbmc/cores/omxplayer/OMXPlayerAudio.cpp +@@ -731,17 +731,10 @@ bool OMXPlayerAudio::OpenDecoder() + /* GetDataFormat is setting up evrything */ + m_format.m_dataFormat = GetDataFormat(m_hints); + +- std::string device = ""; +- +- if(g_guiSettings.GetInt("audiooutput.mode") == AUDIO_HDMI) +- device = "hdmi"; +- else +- device = "local"; +- + m_av_clock->Lock(); + m_av_clock->OMXStop(false); + +- bool bAudioRenderOpen = m_omxAudio.Initialize(m_format, device, m_av_clock, m_hints, m_passthrough, m_hw_decode); ++ bool bAudioRenderOpen = m_omxAudio.Initialize(m_format, m_av_clock, m_hints, m_passthrough, m_hw_decode); + + m_codec_name = ""; + m_bad_state = !bAudioRenderOpen; +diff --git a/xbmc/settings/GUISettings.cpp b/xbmc/settings/GUISettings.cpp +index e92a82d..e798683 100644 +--- a/xbmc/settings/GUISettings.cpp ++++ b/xbmc/settings/GUISettings.cpp +@@ -457,6 +457,8 @@ void CGUISettings::Initialize() + audiomode.insert(make_pair(338,AUDIO_ANALOG)); + #if !defined(TARGET_RASPBERRY_PI) + audiomode.insert(make_pair(339,AUDIO_IEC958)); ++#else ++ audiomode.insert(make_pair(593,AUDIO_BOTH)); + #endif + audiomode.insert(make_pair(420,AUDIO_HDMI )); + #if defined(TARGET_RASPBERRY_PI) +diff --git a/xbmc/settings/GUISettings.h b/xbmc/settings/GUISettings.h +index b48ba35..500ec36 100644 +--- a/xbmc/settings/GUISettings.h ++++ b/xbmc/settings/GUISettings.h +@@ -84,6 +84,9 @@ + #define AUDIO_ANALOG 0 + #define AUDIO_IEC958 1 + #define AUDIO_HDMI 2 ++#ifdef TARGET_RASPBERRY_PI ++#define AUDIO_BOTH 3 ++#endif + #define AUDIO_IS_BITSTREAM(x) ((x) == AUDIO_IEC958 || (x) == AUDIO_HDMI) + + #define VIDEO_NORMAL 0 +-- +1.8.1.6 + + +From 85bb82a3f78a63385767e8e1a7490860077b1b32 Mon Sep 17 00:00:00 2001 +From: stupid-boy +Date: Thu, 7 Mar 2013 20:46:21 +0200 +Subject: [PATCH 2/2] Seek fixed + +--- + xbmc/cores/omxplayer/OMXAudio.cpp | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/xbmc/cores/omxplayer/OMXAudio.cpp b/xbmc/cores/omxplayer/OMXAudio.cpp +index 1470685..6b0e71a 100644 +--- a/xbmc/cores/omxplayer/OMXAudio.cpp ++++ b/xbmc/cores/omxplayer/OMXAudio.cpp +@@ -749,8 +749,16 @@ void COMXAudio::Flush() + + m_omx_decoder.FlushInput(); + m_omx_tunnel_decoder.Flush(); +- if(!m_Passthrough) ++ if ( m_omx_mixer.IsInitialized() ) ++ m_omx_mixer.FlushAll(); ++ if( m_omx_tunnel_mixer.IsInitialized() ) + m_omx_tunnel_mixer.Flush(); ++ if ( m_omx_splitter.IsInitialized() ) ++ m_omx_splitter.FlushAll(); ++ if ( m_omx_tunnel_splitter_analog.IsInitialized() ) ++ m_omx_tunnel_splitter_analog.Flush(); ++ if ( m_omx_tunnel_splitter_HDMI.IsInitialized() ) ++ m_omx_tunnel_splitter_HDMI.Flush(); + + m_last_pts = DVD_NOPTS_VALUE; + m_LostSync = true; +-- +1.8.1.6 + diff --git a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-995.03-OMXPlayer-Audio-fix_incorrect_usage_of_flag_talled.patch b/packages/mediacenter/xbmc/patches/12.2-ad84e88/todo/xbmc-995.03-OMXPlayer-Audio-fix_incorrect_usage_of_flag_talled.patch.bk similarity index 100% rename from packages/mediacenter/xbmc/patches/12.2.0/xbmc-995.03-OMXPlayer-Audio-fix_incorrect_usage_of_flag_talled.patch rename to packages/mediacenter/xbmc/patches/12.2-ad84e88/todo/xbmc-995.03-OMXPlayer-Audio-fix_incorrect_usage_of_flag_talled.patch.bk diff --git a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-995.04-OMXPlayer-some_caching_fixes_for_pvr.patch b/packages/mediacenter/xbmc/patches/12.2-ad84e88/todo/xbmc-995.04-OMXPlayer-some_caching_fixes_for_pvr.patch.bk similarity index 100% rename from packages/mediacenter/xbmc/patches/12.2.0/xbmc-995.04-OMXPlayer-some_caching_fixes_for_pvr.patch rename to packages/mediacenter/xbmc/patches/12.2-ad84e88/todo/xbmc-995.04-OMXPlayer-some_caching_fixes_for_pvr.patch.bk diff --git a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-321-texturepacker-hostflags-and-rework.patch b/packages/mediacenter/xbmc/patches/12.2-ad84e88/xbmc-321-texturepacker-hostflags-and-rework.patch similarity index 100% rename from packages/mediacenter/xbmc/patches/12.2.0/xbmc-321-texturepacker-hostflags-and-rework.patch rename to packages/mediacenter/xbmc/patches/12.2-ad84e88/xbmc-321-texturepacker-hostflags-and-rework.patch diff --git a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-408-enable_PYTHONOPTIMIZE_with_external_Python-0.1.patch b/packages/mediacenter/xbmc/patches/12.2-ad84e88/xbmc-408-enable_PYTHONOPTIMIZE_with_external_Python-0.1.patch similarity index 100% rename from packages/mediacenter/xbmc/patches/12.2.0/xbmc-408-enable_PYTHONOPTIMIZE_with_external_Python-0.1.patch rename to packages/mediacenter/xbmc/patches/12.2-ad84e88/xbmc-408-enable_PYTHONOPTIMIZE_with_external_Python-0.1.patch diff --git a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-452-change_lcd_content-0.1.patch b/packages/mediacenter/xbmc/patches/12.2-ad84e88/xbmc-452-change_lcd_content-0.1.patch similarity index 100% rename from packages/mediacenter/xbmc/patches/12.2.0/xbmc-452-change_lcd_content-0.1.patch rename to packages/mediacenter/xbmc/patches/12.2-ad84e88/xbmc-452-change_lcd_content-0.1.patch diff --git a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-453-add_openelec.tv_RSS_news-0.1.patch b/packages/mediacenter/xbmc/patches/12.2-ad84e88/xbmc-453-add_openelec.tv_RSS_news-0.1.patch similarity index 100% rename from packages/mediacenter/xbmc/patches/12.2.0/xbmc-453-add_openelec.tv_RSS_news-0.1.patch rename to packages/mediacenter/xbmc/patches/12.2-ad84e88/xbmc-453-add_openelec.tv_RSS_news-0.1.patch diff --git a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.00-remove-windowed-display-mode.patch b/packages/mediacenter/xbmc/patches/12.2-ad84e88/xbmc-990.00-remove-windowed-display-mode.patch similarity index 100% rename from packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.00-remove-windowed-display-mode.patch rename to packages/mediacenter/xbmc/patches/12.2-ad84e88/xbmc-990.00-remove-windowed-display-mode.patch diff --git a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.24-smbnfsdeinit-and-wait-for-nic-on-wakeup.patch b/packages/mediacenter/xbmc/patches/12.2-ad84e88/xbmc-990.24-smbnfsdeinit-and-wait-for-nic-on-wakeup.patch similarity index 100% rename from packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.24-smbnfsdeinit-and-wait-for-nic-on-wakeup.patch rename to packages/mediacenter/xbmc/patches/12.2-ad84e88/xbmc-990.24-smbnfsdeinit-and-wait-for-nic-on-wakeup.patch diff --git a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-995.11-enable-vpp-deinterlacing.patch b/packages/mediacenter/xbmc/patches/12.2-ad84e88/xbmc-995.11-enable-vpp-deinterlacing.patch similarity index 100% rename from packages/mediacenter/xbmc/patches/12.2.0/xbmc-995.11-enable-vpp-deinterlacing.patch rename to packages/mediacenter/xbmc/patches/12.2-ad84e88/xbmc-995.11-enable-vpp-deinterlacing.patch diff --git a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-995.12-enable-vpp-fix-audio-out-of-sync.patch b/packages/mediacenter/xbmc/patches/12.2-ad84e88/xbmc-995.12-enable-vpp-fix-audio-out-of-sync.patch similarity index 100% rename from packages/mediacenter/xbmc/patches/12.2.0/xbmc-995.12-enable-vpp-fix-audio-out-of-sync.patch rename to packages/mediacenter/xbmc/patches/12.2-ad84e88/xbmc-995.12-enable-vpp-fix-audio-out-of-sync.patch diff --git a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-995.13-vpp-fix-skipping.patch b/packages/mediacenter/xbmc/patches/12.2-ad84e88/xbmc-995.13-vpp-fix-skipping.patch similarity index 100% rename from packages/mediacenter/xbmc/patches/12.2.0/xbmc-995.13-vpp-fix-skipping.patch rename to packages/mediacenter/xbmc/patches/12.2-ad84e88/xbmc-995.13-vpp-fix-skipping.patch diff --git a/packages/mediacenter/xbmc/patches/12.2.0/todo/xbmc-995.02-only_free_unused_textures_after_a_flip.patch.bk b/packages/mediacenter/xbmc/patches/12.2.0/todo/xbmc-995.02-only_free_unused_textures_after_a_flip.patch.bk deleted file mode 100644 index 6ee705e97f..0000000000 --- a/packages/mediacenter/xbmc/patches/12.2.0/todo/xbmc-995.02-only_free_unused_textures_after_a_flip.patch.bk +++ /dev/null @@ -1,29 +0,0 @@ -From f3ffe4e25bfca41379e4e2ffba75ad55d13ba30e Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Thu, 21 Mar 2013 07:53:20 +0100 -Subject: [PATCH] only free unused textures after a flip - ---- - xbmc/Application.cpp | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp -index fa0e71d..5bd2d72 100644 ---- a/xbmc/Application.cpp -+++ b/xbmc/Application.cpp -@@ -2363,11 +2363,10 @@ void CApplication::Render() - { - g_graphicsContext.Flip(dirtyRegions); - g_renderManager.NotifyDisplayFlip(); -+ g_TextureManager.FreeUnusedTextures(); - } - CTimeUtils::UpdateFrameTime(flip); - -- g_TextureManager.FreeUnusedTextures(); -- - g_renderManager.UpdateResolution(); - g_renderManager.ManageCaptures(); - } --- -1.8.1.5 - diff --git a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.01-PR1934.patch b/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.01-PR1934.patch deleted file mode 100644 index 8079f1049a..0000000000 --- a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.01-PR1934.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 1704ff69ba704bf53505f7f9ac51ec06f93401ee Mon Sep 17 00:00:00 2001 -From: wsnipex -Date: Sun, 9 Dec 2012 14:37:21 +0100 -Subject: [PATCH 1/2] configure: allow GIT_REV to be read from VERSION file - needed for building outside of a git repo - ---- - configure.in | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - -diff --git a/configure.in b/configure.in -index d8c7804..ac1445c 100644 ---- a/configure.in -+++ b/configure.in -@@ -2160,7 +2160,12 @@ if test "$HAVE_GIT" = "yes"; then - GIT_REV=$(git --no-pager log --abbrev=7 -n 1 --pretty=format:"%h %ci" HEAD | awk '{gsub("-", "");print $2"-"$1}') - fi - if test "$GIT_REV" = ""; then -- GIT_REV="Unknown" -+ if test -f VERSION ; then -+ GIT_REV=$(awk 'END{print substr($1,1,16)}' VERSION) -+ if test -z $GIT_REV ; then GIT_REV="Unknown" ; fi -+ else -+ GIT_REV="Unknown" -+ fi - fi - if test "$host_vendor" = "apple"; then - echo "#define GIT_REV \"$GIT_REV\"" > git_revision.h --- -1.7.10 - - -From 4377a985c7e4e4d1f1c0abba68c2367d33ddab03 Mon Sep 17 00:00:00 2001 -From: wsnipex -Date: Sun, 16 Dec 2012 17:46:12 +0100 -Subject: [PATCH 2/2] release-source script needs bash on some systems /bin/sh - is a simplistic posix shell - ---- - tools/mk-release-source | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/tools/mk-release-source b/tools/mk-release-source -index 7964665..68bdfa1 100755 ---- a/tools/mk-release-source -+++ b/tools/mk-release-source -@@ -1,4 +1,4 @@ --#!/bin/sh -+#!/bin/bash - REVISION="${1}" - COMPRESS="gzip" - WORKDIR="xbmc-${REVISION}" --- -1.7.10 - diff --git a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.02-PR2193.patch b/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.02-PR2193.patch deleted file mode 100644 index ab619e9a67..0000000000 --- a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.02-PR2193.patch +++ /dev/null @@ -1,88 +0,0 @@ -From 1e3abea7b9a4212005b11dbb5a9542ca9cbcd21a Mon Sep 17 00:00:00 2001 -From: Stephan Raue -Date: Thu, 7 Feb 2013 18:27:08 +0100 -Subject: [PATCH] configure.in: change check for 'VERSION' file: - first check - if this file exist and use the content from there - if it - not exist check with 'git log' - if this fails set to - 'Unknown' - -This patch also shows the GIT_REV in the configure summary message. To display This message on top of the messages we move the whole block a bit above ---- - configure.in | 40 ++++++++++++++++++++-------------------- - 1 file changed, 20 insertions(+), 20 deletions(-) - -diff --git a/configure.in b/configure.in -index ac1445c..869fd29 100644 ---- a/configure.in -+++ b/configure.in -@@ -687,6 +687,25 @@ case $use_platform in - ;; - esac - -+# check for GIT_REV -+AC_CHECK_PROG(HAVE_GIT,git,"yes","no",) -+if test "$GIT_REV" = ""; then -+ if test -f VERSION ; then -+ GIT_REV=$(awk 'END{print substr($1,1,16)}' VERSION) -+ elif test "$HAVE_GIT" = "yes"; then -+ GIT_REV=$(git --no-pager log --abbrev=7 -n 1 --pretty=format:"%h %ci" HEAD | awk '{gsub("-", "");print $2"-"$1}') -+ else -+ GIT_REV="Unknown" -+ fi -+fi -+final_message="$final_message\n git Rev.:\t${GIT_REV}" -+ -+if test "$host_vendor" = "apple"; then -+ echo "#define GIT_REV \"$GIT_REV\"" > git_revision.h -+else -+ SDL_DEFINES="$SDL_DEFINES -D'GIT_REV=\"$GIT_REV\"'" -+fi -+ - if test "$build_shared_lib" = "yes"; then - final_message="$final_message\n Shared lib\tYes" - AC_SUBST(USE_LIBXBMC,1) -@@ -1886,8 +1905,6 @@ if test "$ARCH" = "i486-linux" || test "$ARCH" = "x86-freebsd"; then - fi - fi - --AC_CHECK_PROG(HAVE_GIT,git,"yes","no",) -- - # Checks for header files. - AC_HEADER_DIRENT - AC_HEADER_STDC -@@ -1943,7 +1960,7 @@ else - USE_OPENGL=1 - else - final_message="$final_message\n OpenGL:\tNo (Very Slow)" -- SDL_DEFINES="-DHAS_SDL_2D" -+ SDL_DEFINES="$SDL_DEFINES -DHAS_SDL_2D" - USE_OPENGL=0 - fi - fi -@@ -2156,23 +2173,6 @@ else - final_message="$final_message\n Avahi:\tNo" - fi - --if test "$HAVE_GIT" = "yes"; then -- GIT_REV=$(git --no-pager log --abbrev=7 -n 1 --pretty=format:"%h %ci" HEAD | awk '{gsub("-", "");print $2"-"$1}') --fi --if test "$GIT_REV" = ""; then -- if test -f VERSION ; then -- GIT_REV=$(awk 'END{print substr($1,1,16)}' VERSION) -- if test -z $GIT_REV ; then GIT_REV="Unknown" ; fi -- else -- GIT_REV="Unknown" -- fi --fi --if test "$host_vendor" = "apple"; then -- echo "#define GIT_REV \"$GIT_REV\"" > git_revision.h --else -- SDL_DEFINES="$SDL_DEFINES -D'GIT_REV=\"$GIT_REV\"'" --fi -- - if test "$use_nonfree" = "yes"; then - final_message="$final_message\n Non-free:\tYes" - HAVE_XBMC_NONFREE=1 --- -1.7.10 - diff --git a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.03-PR2449-1.patch b/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.03-PR2449-1.patch deleted file mode 100644 index 9f56960ed2..0000000000 --- a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.03-PR2449-1.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 3180ec7e5e065c0f9276a2d8999e8e8d997c4dba Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Sat, 16 Mar 2013 15:52:55 +0100 -Subject: [PATCH] dvdplayer: put line break into video codec info because it - gets too long - ---- - xbmc/cores/dvdplayer/DVDPlayer.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp -index be89406..bb1fc42 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayer.cpp -+++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp -@@ -2579,7 +2579,7 @@ void CDVDPlayer::GetVideoInfo(CStdString& strVideoInfo) - { CSingleLock lock(m_StateSection); - strVideoInfo.Format("D(%s)", m_StateInput.demux_video.c_str()); - } -- strVideoInfo.AppendFormat(" P(%s)", m_dvdPlayerVideo.GetPlayerInfo().c_str()); -+ strVideoInfo.AppendFormat("\nP(%s)", m_dvdPlayerVideo.GetPlayerInfo().c_str()); - } - - void CDVDPlayer::GetGeneralInfo(CStdString& strGeneralInfo) --- -1.8.1.5 - diff --git a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.04-PR2231.patch b/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.04-PR2231.patch deleted file mode 100644 index b65672ae88..0000000000 --- a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.04-PR2231.patch +++ /dev/null @@ -1,138 +0,0 @@ -From 07b4e2c80c046bad566ed4a70e49ae4bfb3ecc47 Mon Sep 17 00:00:00 2001 -From: stupid-boy -Date: Wed, 13 Feb 2013 20:56:12 +0200 -Subject: [PATCH] Changed cpu frequency for all Linux platforms, added RPI - specific cpu temp command and removed irrelevant gpu temp - for all ARM platforms. - ---- - xbmc/utils/CPUInfo.cpp | 41 +++++++++++++++++----------------- - xbmc/utils/CPUInfo.h | 2 +- - xbmc/windows/GUIWindowSystemInfo.cpp | 4 +++- - 3 files changed, 24 insertions(+), 23 deletions(-) - -diff --git a/xbmc/utils/CPUInfo.cpp b/xbmc/utils/CPUInfo.cpp -index 64c90b9..f605751 100644 ---- a/xbmc/utils/CPUInfo.cpp -+++ b/xbmc/utils/CPUInfo.cpp -@@ -107,7 +107,7 @@ static inline int _private_gettimeofday( struct timeval *tv, void *tz ) - - CCPUInfo::CCPUInfo(void) - { -- m_fProcStat = m_fProcTemperature = m_fCPUInfo = NULL; -+ m_fProcStat = m_fProcTemperature = m_fCPUFreq = NULL; - m_lastUsedPercentage = 0; - m_cpuFeatures = 0; - -@@ -235,15 +235,20 @@ static inline int _private_gettimeofday( struct timeval *tv, void *tz ) - // read from the new location of the temperature data on new kernels, 2.6.39, 3.0 etc - if (m_fProcTemperature == NULL) - m_fProcTemperature = fopen("/sys/class/hwmon/hwmon0/temp1_input", "r"); -- -- m_fCPUInfo = fopen("/proc/cpuinfo", "r"); -+ if (m_fProcTemperature == NULL) -+ m_fProcTemperature = fopen("/sys/class/thermal/thermal_zone0/temp", "r"); // On Raspberry PIs -+ -+ m_fCPUFreq = fopen ("/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq", "r"); -+ -+ -+ FILE* fCPUInfo = fopen("/proc/cpuinfo", "r"); - m_cpuCount = 0; -- if (m_fCPUInfo) -+ if (fCPUInfo) - { - char buffer[512]; - - int nCurrId = 0; -- while (fgets(buffer, sizeof(buffer), m_fCPUInfo)) -+ while (fgets(buffer, sizeof(buffer), fCPUInfo)) - { - if (strncmp(buffer, "processor", strlen("processor"))==0) - { -@@ -369,6 +374,7 @@ static inline int _private_gettimeofday( struct timeval *tv, void *tz ) - } - } - } -+ fclose(fCPUInfo); - } - else - { -@@ -409,8 +415,8 @@ static inline int _private_gettimeofday( struct timeval *tv, void *tz ) - if (m_fProcTemperature != NULL) - fclose(m_fProcTemperature); - -- if (m_fCPUInfo != NULL) -- fclose(m_fCPUInfo); -+ if (m_fCPUFreq != NULL) -+ fclose(m_fCPUFreq); - } - - int CCPUInfo::getUsedPercentage() -@@ -482,21 +488,14 @@ float CCPUInfo::getCPUFrequency() - hz = 0; - return (float)hz; - #else -- float mhz = 0.f; -- char buf[256], -- *needle = NULL; -- if (!m_fCPUInfo) -- return mhz; -- rewind(m_fCPUInfo); -- fflush(m_fCPUInfo); -- while (fgets(buf, 256, m_fCPUInfo) != NULL) { -- if (strncmp(buf, "cpu MHz", 7) == 0) { -- needle = strchr(buf, ':'); -- sscanf(++needle, "%f", &mhz); -- break; -- } -+ int value = 0; -+ if (m_fCPUFreq) -+ { -+ rewind(m_fCPUFreq); -+ fflush(m_fCPUFreq); -+ fscanf(m_fCPUFreq, "%d", &value); - } -- return mhz; -+ return value / 1000.0; - #endif - } - -diff --git a/xbmc/utils/CPUInfo.h b/xbmc/utils/CPUInfo.h -index 638c19f..ae9447d 100644 ---- a/xbmc/utils/CPUInfo.h -+++ b/xbmc/utils/CPUInfo.h -@@ -93,7 +93,7 @@ class CCPUInfo - - FILE* m_fProcStat; - FILE* m_fProcTemperature; -- FILE* m_fCPUInfo; -+ FILE* m_fCPUFreq; - - unsigned long long m_userTicks; - unsigned long long m_niceTicks; -diff --git a/xbmc/windows/GUIWindowSystemInfo.cpp b/xbmc/windows/GUIWindowSystemInfo.cpp -index fcc1f89..75fd0cd 100644 ---- a/xbmc/windows/GUIWindowSystemInfo.cpp -+++ b/xbmc/windows/GUIWindowSystemInfo.cpp -@@ -141,7 +141,9 @@ void CGUIWindowSystemInfo::FrameMove() - SetControlLabel(i++, "%s %s", 22023, SYSTEM_RENDER_VENDOR); - SetControlLabel(i++, "%s %s", 22024, SYSTEM_RENDER_VERSION); - #endif -+#ifndef __arm__ - SetControlLabel(i++, "%s %s", 22010, SYSTEM_GPU_TEMPERATURE); -+#endif - } - else if (m_section == CONTROL_BT_HARDWARE) - { -@@ -155,7 +157,7 @@ void CGUIWindowSystemInfo::FrameMove() - SET_CONTROL_LABEL(i++, g_sysinfo.GetCPUSerial()); - #endif - SetControlLabel(i++, "%s %s", 22011, SYSTEM_CPU_TEMPERATURE); --#if !defined(__arm__) -+#if !defined(__arm__) || defined(TARGET_RASPBERRY_PI) - SetControlLabel(i++, "%s %s", 13284, SYSTEM_CPUFREQUENCY); - #endif - #endif --- -1.7.10 - diff --git a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.05-PR2403-01.patch b/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.05-PR2403-01.patch deleted file mode 100644 index 6eac2089ef..0000000000 --- a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.05-PR2403-01.patch +++ /dev/null @@ -1,94 +0,0 @@ -diff -Naur xbmc-12.0.6/xbmc/powermanagement/linux/FallbackPowerSyscall.h xbmc-12.0.6.patch/xbmc/powermanagement/linux/FallbackPowerSyscall.h ---- xbmc-12.0.6/xbmc/powermanagement/linux/FallbackPowerSyscall.h 1970-01-01 01:00:00.000000000 +0100 -+++ xbmc-12.0.6.patch/xbmc/powermanagement/linux/FallbackPowerSyscall.h 2013-03-13 22:25:29.220700789 +0100 -@@ -0,0 +1,39 @@ -+/* -+ * Copyright (C) 2005-2013 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 -+ * . -+ * -+ */ -+#pragma once -+#include "powermanagement/IPowerSyscall.h" -+#include "system.h" -+#if defined(TARGET_LINUX) -+ -+class CFallbackPowerSyscall : public CPowerSyscallWithoutEvents -+{ -+public: -+ virtual bool Powerdown() {return true; } -+ virtual bool Suspend() {return false; } -+ virtual bool Hibernate() {return false; } -+ virtual bool Reboot() {return true; } -+ -+ virtual bool CanPowerdown() {return true; } -+ virtual bool CanSuspend() {return false; } -+ virtual bool CanHibernate() {return false; } -+ virtual bool CanReboot() {return true; } -+ virtual int BatteryLevel() {return 0; } -+}; -+#endif -diff -Naur xbmc-12.0.6/xbmc/powermanagement/PowerManager.cpp xbmc-12.0.6.patch/xbmc/powermanagement/PowerManager.cpp ---- xbmc-12.0.6/xbmc/powermanagement/PowerManager.cpp 2013-03-11 18:01:45.000000000 +0100 -+++ xbmc-12.0.6.patch/xbmc/powermanagement/PowerManager.cpp 2013-03-14 00:20:43.263315592 +0100 -@@ -41,14 +41,17 @@ - #include "osx/CocoaPowerSyscall.h" - #elif defined(TARGET_ANDROID) - #include "android/AndroidPowerSyscall.h" --#elif defined(_LINUX) && defined(HAS_DBUS) -+#elif defined(TARGET_LINUX) -+#include "linux/FallbackPowerSyscall.h" -+#if defined(HAS_DBUS) - #include "linux/ConsoleUPowerSyscall.h" - #include "linux/ConsoleDeviceKitPowerSyscall.h" - #include "linux/SystemdUPowerSyscall.h" - #include "linux/UPowerSyscall.h" --#ifdef HAS_HAL -+#if defined(HAS_HAL) - #include "linux/HALPowerSyscall.h" --#endif -+#endif // HAS_HAL -+#endif // HAS_DBUS - #elif defined(_WIN32) - #include "powermanagement/windows/Win32PowerSyscall.h" - extern HWND g_hWnd; -@@ -74,7 +77,8 @@ - m_instance = new CCocoaPowerSyscall(); - #elif defined(TARGET_ANDROID) - m_instance = new CAndroidPowerSyscall(); --#elif defined(_LINUX) && defined(HAS_DBUS) -+#elif defined(TARGET_LINUX) -+#if defined(HAS_DBUS) - if (CConsoleUPowerSyscall::HasConsoleKitAndUPower()) - m_instance = new CConsoleUPowerSyscall(); - else if (CConsoleDeviceKitPowerSyscall::HasDeviceConsoleKit()) -@@ -83,10 +87,13 @@ - m_instance = new CSystemdUPowerSyscall(); - else if (CUPowerSyscall::HasUPower()) - m_instance = new CUPowerSyscall(); --#ifdef HAS_HAL -- else -+#if defined(HAS_HAL) -+ else if(1) - m_instance = new CHALPowerSyscall(); --#endif -+#endif // HAS_HAL -+#endif // HAS_DBUS -+ else -+ m_instance = new CFallbackPowerSyscall(); - #elif defined(_WIN32) - m_instance = new CWin32PowerSyscall(); - #endif diff --git a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.06-add-builtin-to-set-GUI-Language.patch b/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.06-add-builtin-to-set-GUI-Language.patch deleted file mode 100644 index 884e1f31fc..0000000000 --- a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.06-add-builtin-to-set-GUI-Language.patch +++ /dev/null @@ -1,32 +0,0 @@ -commit d1fcd3007827ddd2ab20864677a5baf64e4782a4 -Author: Stefan Saraev -Date: Mon Jan 21 17:11:21 2013 +0200 - - add builtin to set GUI Language - -diff --git a/xbmc/interfaces/Builtins.cpp b/xbmc/interfaces/Builtins.cpp -index fae2524..3f5ceab 100644 ---- a/xbmc/interfaces/Builtins.cpp -+++ b/xbmc/interfaces/Builtins.cpp -@@ -120,6 +120,7 @@ const BUILT_IN commands[] = { - { "Minimize", false, "Minimize XBMC" }, - { "Reset", false, "Reset the system (same as reboot)" }, - { "Mastermode", false, "Control master mode" }, -+ { "SetGUILanguage", true, "Set GUI Language" }, - { "ActivateWindow", true, "Activate the specified window" }, - { "ActivateWindowAndFocus", true, "Activate the specified window and sets focus to the specified id" }, - { "ReplaceWindow", true, "Replaces the current window with the new one" }, -@@ -321,6 +322,13 @@ int CBuiltins::Execute(const CStdString& execString) - CGUIMessage msg(GUI_MSG_NOTIFY_ALL, 0, 0, GUI_MSG_UPDATE); - g_windowManager.SendMessage(msg); - } -+ else if (execute.Equals("setguilanguage")) -+ { -+ if (params.size()) -+ { -+ CApplicationMessenger::Get().SetGUILanguage(params[0]); -+ } -+ } - else if (execute.Equals("takescreenshot")) - { - CScreenShot::TakeScreenshot(); diff --git a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.07-PR2435.patch b/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.07-PR2435.patch deleted file mode 100644 index 1b68099108..0000000000 --- a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.07-PR2435.patch +++ /dev/null @@ -1,184 +0,0 @@ -From 2da77839fbf972e8c6f09c56d25f8c7bf999f3fa Mon Sep 17 00:00:00 2001 -From: dezi -Date: Mon, 18 Mar 2013 12:29:27 +0000 -Subject: [PATCH] Added hotplug support for Linux input devices. - ---- - xbmc/input/linux/LinuxInputDevices.cpp | 80 ++++++++++++++++++++++++++++++++++ - xbmc/input/linux/LinuxInputDevices.h | 6 +++ - 2 files changed, 86 insertions(+) - -diff --git a/xbmc/input/linux/LinuxInputDevices.cpp b/xbmc/input/linux/LinuxInputDevices.cpp -index 9d253bb..1d3d315 100644 ---- a/xbmc/input/linux/LinuxInputDevices.cpp -+++ b/xbmc/input/linux/LinuxInputDevices.cpp -@@ -338,6 +338,7 @@ - m_deviceMinKeyCode = 0; - m_deviceMaxKeyCode = 0; - m_deviceMaxAxis = 0; -+ m_bUnplugged = false; - - Open(); - } -@@ -744,7 +745,15 @@ XBMC_Event CLinuxInputDevice::ReadEvent() - readlen = read(m_fd, &levt, sizeof(levt)); - - if (readlen <= 0) -+ { -+ if (errno == ENODEV) -+ { -+ CLog::Log(LOGINFO,"input device was unplugged %s",m_deviceName); -+ m_bUnplugged = true; -+ } -+ - break; -+ } - - //printf("read event readlen = %d device name %s m_fileName %s\n", readlen, m_deviceName, m_fileName.c_str()); - -@@ -963,6 +972,16 @@ void CLinuxInputDevice::GetInfo(int fd) - //printf("pref: %d\n", m_devicePreferredId); - } - -+char* CLinuxInputDevice::GetDeviceName() -+{ -+ return m_deviceName; -+} -+ -+bool CLinuxInputDevice::IsUnplugged() -+{ -+ return m_bUnplugged; -+} -+ - bool CLinuxInputDevices::CheckDevice(const char *device) - { - int fd; -@@ -1021,6 +1040,41 @@ void CLinuxInputDevices::InitAvailable() - } - - /* -+ * Check for hot plugged devices. -+ */ -+void CLinuxInputDevices::CheckHotplugged() -+{ -+ CSingleLock lock(m_devicesListLock); -+ -+ int deviceId = m_devices.size(); -+ -+ /* No devices specified. Try to guess some. */ -+ for (int i = 0; i < MAX_LINUX_INPUT_DEVICES; i++) -+ { -+ char buf[32]; -+ bool ispresent = false; -+ -+ snprintf(buf, 32, "/dev/input/event%d", i); -+ -+ for (size_t j = 0; j < m_devices.size(); j++) -+ { -+ if (strcmp(m_devices[j]->GetDeviceName(),buf) == 0) -+ { -+ ispresent = true; -+ break; -+ } -+ } -+ -+ if (!ispresent && CheckDevice(buf)) -+ { -+ CLog::Log(LOGINFO, "Found input device %s", buf); -+ m_devices.push_back(new CLinuxInputDevice(buf, deviceId)); -+ ++deviceId; -+ } -+ } -+} -+ -+/* - * Open the device, fill out information about it, - * allocate and fill private data, start input thread. - */ -@@ -1076,6 +1130,9 @@ bool CLinuxInputDevice::Open() - { - if (m_vt_fd < 0) - m_vt_fd = open("/dev/tty0", O_RDWR | O_NOCTTY); -+ -+ if (m_vt_fd < 0) -+ m_vt_fd = open("/dev/tty1", O_RDWR | O_NOCTTY); - - if (m_vt_fd < 0) - CLog::Log(LOGWARNING, "no keymap support (requires /dev/tty0 - CONFIG_VT)"); -@@ -1195,6 +1252,23 @@ void CLinuxInputDevice::Close() - - XBMC_Event CLinuxInputDevices::ReadEvent() - { -+ if (m_bReInitialize) -+ { -+ InitAvailable(); -+ m_bReInitialize = false; -+ } -+ else -+ { -+ time_t now; -+ time(&now); -+ -+ if ((now - m_lastHotplugCheck) >= 10) -+ { -+ CheckHotplugged(); -+ m_lastHotplugCheck = now; -+ } -+ } -+ - CSingleLock lock(m_devicesListLock); - - XBMC_Event event; -@@ -1207,6 +1281,12 @@ XBMC_Event CLinuxInputDevices::ReadEvent() - { - break; - } -+ -+ if (m_devices[i]->IsUnplugged()) -+ { -+ m_bReInitialize = true; -+ break; -+ } - } - - return event; -diff --git a/xbmc/input/linux/LinuxInputDevices.h b/xbmc/input/linux/LinuxInputDevices.h -index 18224a9..b7626f4 100644 ---- a/xbmc/input/linux/LinuxInputDevices.h -+++ b/xbmc/input/linux/LinuxInputDevices.h -@@ -41,6 +41,8 @@ class CLinuxInputDevice - CLinuxInputDevice(const std::string fileName, int index); - ~CLinuxInputDevice(); - XBMC_Event ReadEvent(); -+ char* GetDeviceName(); -+ bool IsUnplugged(); - - private: - void SetupKeyboardAutoRepeat(int fd); -@@ -76,12 +78,14 @@ class CLinuxInputDevice - int m_deviceMaxKeyCode; - int m_deviceMaxAxis; - bool m_bSkipNonKeyEvents; -+ bool m_bUnplugged; - }; - - class CLinuxInputDevices - { - public: - void InitAvailable(); -+ void CheckHotplugged(); - XBMC_Event ReadEvent(); - bool IsRemoteLowBattery(); - bool IsRemoteNotPaired(); -@@ -89,6 +93,8 @@ class CLinuxInputDevices - CCriticalSection m_devicesListLock; - bool CheckDevice(const char *device); - std::vector m_devices; -+ bool m_bReInitialize; -+ time_t m_lastHotplugCheck; - }; - - #endif /* LINUXINPUTDEVICES_H_ */ --- -1.8.1.5 - diff --git a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.08-PR2637.patch b/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.08-PR2637.patch deleted file mode 100644 index 61ba30e4cc..0000000000 --- a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.08-PR2637.patch +++ /dev/null @@ -1,60 +0,0 @@ -From d4c34400b9bdebbb1a943603a54fdf207034ddd1 Mon Sep 17 00:00:00 2001 -From: Dag Wieers -Date: Sat, 20 Apr 2013 02:59:47 +0200 -Subject: [PATCH] Increase USB and CEC rescan interval to 5 seconds - -In one of my investigations to see why XBMC performance is so bad (even when idle) I found one of the threads (in my case PeripheralBusCEC) scan a big sysfs tree recursively. On the 1Ghz AppleTV 1 device this would be about 2% of the CPU *every* second. For the USB thread we luckily have Udev events, but for CEC it is using sysfs polling which is quite expensive. It would be better to make use of Udev as well for CEC (where available) however 5 seconds should be fine for everyone. - -In my own builds I even brought it down to 30 seconds. Which means 29 seconds of reduced CPU usage. - -The CEC polling probably should be more restricted to specific sysfs sections, or preferably use Udev as well, when available. - -PS XBMC needs a special idle-state where it can turn down these expensive threads to make sure hardware can go into deeper sleep states. Especially for devices that doesn't do suspend for various reasons this is a requirement. (The ATV1 device for instance gets warm even when idle) If we can combine display-sleep with low-power states and a less expensive main-loop, that would be already quite an improvement without needing a complete refactoring of the code. ---- - xbmc/peripherals/bus/PeripheralBus.cpp | 2 +- - xbmc/peripherals/bus/PeripheralBus.h | 2 +- - xbmc/peripherals/bus/virtual/PeripheralBusCEC.cpp | 2 +- - 3 files changed, 3 insertions(+), 3 deletions(-) - -diff --git a/xbmc/peripherals/bus/PeripheralBus.cpp b/xbmc/peripherals/bus/PeripheralBus.cpp -index 0e673ee..f0219f1 100644 ---- a/xbmc/peripherals/bus/PeripheralBus.cpp -+++ b/xbmc/peripherals/bus/PeripheralBus.cpp -@@ -27,7 +27,7 @@ - using namespace std; - using namespace PERIPHERALS; - --#define PERIPHERAL_DEFAULT_RESCAN_INTERVAL 1000 -+#define PERIPHERAL_DEFAULT_RESCAN_INTERVAL 5000 - - CPeripheralBus::CPeripheralBus(CPeripherals *manager, PeripheralBusType type) : - CThread("PeripheralBus"), -diff --git a/xbmc/peripherals/bus/PeripheralBus.h b/xbmc/peripherals/bus/PeripheralBus.h -index cc368ac..24e1524 100644 ---- a/xbmc/peripherals/bus/PeripheralBus.h -+++ b/xbmc/peripherals/bus/PeripheralBus.h -@@ -33,7 +33,7 @@ - - /*! - * @class CPeripheralBus -- * This represents a bus on the system. By default, this bus instance will scan for changes every second. -+ * This represents a bus on the system. By default, this bus instance will scan for changes every 5 seconds. - * If this bus only has to be updated after a notification sent by the system, set m_bNeedsPolling to false - * in the constructor, and implement the OnDeviceAdded(), OnDeviceChanged() and OnDeviceRemoved() methods. - * -diff --git a/xbmc/peripherals/bus/virtual/PeripheralBusCEC.cpp b/xbmc/peripherals/bus/virtual/PeripheralBusCEC.cpp -index da169c1..0db7423 100644 ---- a/xbmc/peripherals/bus/virtual/PeripheralBusCEC.cpp -+++ b/xbmc/peripherals/bus/virtual/PeripheralBusCEC.cpp -@@ -57,7 +57,7 @@ class PERIPHERALS::DllLibCEC : public DllDynamic, DllLibCECInterface - m_dll(new DllLibCEC), - m_cecAdapter(NULL) - { -- m_iRescanTime = 1000; -+ m_iRescanTime = 5000; - if (!m_dll->Load() || !m_dll->IsLoaded()) - { - delete m_dll; --- -1.8.1.6 - diff --git a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.09-PR2686.patch b/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.09-PR2686.patch deleted file mode 100644 index c295c354de..0000000000 --- a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.09-PR2686.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 7ee7e59e858c7f1901c6879e39b30480c42ef126 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 29 Apr 2013 22:50:08 +0100 -Subject: [PATCH] [rbp] Remove unnecessary gl ifdef - -I'm not sure why this was originally added. -I couldn't think of a reason why the Pi would want things done differently here, -so I tried without the ifdef. I can't see any difference in behaviour, -so I think we're better off removing it. ---- - xbmc/rendering/gles/RenderSystemGLES.cpp | 4 ---- - 1 file changed, 4 deletions(-) - -diff --git a/xbmc/rendering/gles/RenderSystemGLES.cpp b/xbmc/rendering/gles/RenderSystemGLES.cpp -index e7795fb..472f441 100644 ---- a/xbmc/rendering/gles/RenderSystemGLES.cpp -+++ b/xbmc/rendering/gles/RenderSystemGLES.cpp -@@ -138,11 +138,7 @@ bool CRenderSystemGLES::ResetRenderSystem(int width, int height, bool fullScreen - g_matrices.MatrixMode(MM_PROJECTION); - g_matrices.LoadIdentity(); - --#ifdef TARGET_RASPBERRY_PI -- g_matrices.Ortho(0.0f, width-1, height-1, 0.0f, +1.0f, 1.0f); --#else - g_matrices.Ortho(0.0f, width-1, height-1, 0.0f, -1.0f, 1.0f); --#endif - - g_matrices.MatrixMode(MM_MODELVIEW); - g_matrices.LoadIdentity(); --- -1.8.1.6 - diff --git a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.10-PR2713.patch b/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.10-PR2713.patch deleted file mode 100644 index 19c9cf7fee..0000000000 --- a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.10-PR2713.patch +++ /dev/null @@ -1,331 +0,0 @@ -From 1c12a2f021cceee0d7eee2de5df993d73d790aa5 Mon Sep 17 00:00:00 2001 -From: Cory Fields -Date: Thu, 9 May 2013 19:27:14 -0400 -Subject: [PATCH 1/2] texture: combine Load() and GetTexture() since they must - be used together - ---- - xbmc/guilib/GUITexture.cpp | 19 ++++++++-------- - xbmc/guilib/TextureManager.cpp | 51 ++++++++++++++++++++---------------------- - xbmc/guilib/TextureManager.h | 3 +-- - 3 files changed, 34 insertions(+), 39 deletions(-) - -diff --git a/xbmc/guilib/GUITexture.cpp b/xbmc/guilib/GUITexture.cpp -index 9da2030..5896606 100644 ---- a/xbmc/guilib/GUITexture.cpp -+++ b/xbmc/guilib/GUITexture.cpp -@@ -301,11 +301,12 @@ bool CGUITextureBase::AllocResources() - { // we want to use the large image loader, but we first check for bundled textures - if (!IsAllocated()) - { -- int images = g_TextureManager.Load(m_info.filename, true); -- if (images) -+ CTextureArray texture; -+ texture = g_TextureManager.Load(m_info.filename, true); -+ if (texture.size()) - { - m_isAllocated = NORMAL; -- m_texture = g_TextureManager.GetTexture(m_info.filename); -+ m_texture = texture; - changed = true; - } - } -@@ -329,15 +330,14 @@ bool CGUITextureBase::AllocResources() - } - else if (!IsAllocated()) - { -- int images = g_TextureManager.Load(m_info.filename); -+ CTextureArray texture = g_TextureManager.Load(m_info.filename); - - // set allocated to true even if we couldn't load the image to save - // us hitting the disk every frame -- m_isAllocated = images ? NORMAL : NORMAL_FAILED; -- if (!images) -+ m_isAllocated = texture.size() ? NORMAL : NORMAL_FAILED; -+ if (!texture.size()) - return false; -- -- m_texture = g_TextureManager.GetTexture(m_info.filename); -+ m_texture = texture; - changed = true; - } - m_frameWidth = (float)m_texture.m_width; -@@ -346,8 +346,7 @@ bool CGUITextureBase::AllocResources() - // load the diffuse texture (if necessary) - if (!m_info.diffuse.IsEmpty()) - { -- g_TextureManager.Load(m_info.diffuse); -- m_diffuse = g_TextureManager.GetTexture(m_info.diffuse); -+ m_diffuse = g_TextureManager.Load(m_info.diffuse); - } - - CalculateSize(); -diff --git a/xbmc/guilib/TextureManager.cpp b/xbmc/guilib/TextureManager.cpp -index 93fdcd1..6d6c4d9 100644 ---- a/xbmc/guilib/TextureManager.cpp -+++ b/xbmc/guilib/TextureManager.cpp -@@ -221,22 +221,6 @@ void CTextureMap::Add(CBaseTexture* texture, int delay) - Cleanup(); - } - --const CTextureArray& CGUITextureManager::GetTexture(const CStdString& strTextureName) --{ -- static CTextureArray emptyTexture; -- // CLog::Log(LOGINFO, " refcount++ for GetTexture(%s)\n", strTextureName.c_str()); -- for (int i = 0; i < (int)m_vecTextures.size(); ++i) -- { -- CTextureMap *pMap = m_vecTextures[i]; -- if (pMap->GetName() == strTextureName) -- { -- //CLog::Log(LOGDEBUG, "Total memusage %u", GetMemoryUsage()); -- return pMap->GetTexture(); -- } -- } -- return emptyTexture; --} -- - /************************************************************************/ - /* */ - /************************************************************************/ -@@ -290,19 +274,32 @@ bool CGUITextureManager::HasTexture(const CStdString &textureName, CStdString *p - return !fullPath.IsEmpty(); - } - --int CGUITextureManager::Load(const CStdString& strTextureName, bool checkBundleOnly /*= false */) -+const CTextureArray& CGUITextureManager::Load(const CStdString& strTextureName, bool checkBundleOnly /*= false */) - { - CStdString strPath; -+ static CTextureArray emptyTexture; - int bundle = -1; - int size = 0; - if (!HasTexture(strTextureName, &strPath, &bundle, &size)) -- return 0; -+ return emptyTexture; - - if (size) // we found the texture -- return size; -+ { -+ for (int i = 0; i < (int)m_vecTextures.size(); ++i) -+ { -+ CTextureMap *pMap = m_vecTextures[i]; -+ if (pMap->GetName() == strTextureName) -+ { -+ //CLog::Log(LOGDEBUG, "Total memusage %u", GetMemoryUsage()); -+ return pMap->GetTexture(); -+ } -+ } -+ // Whoops, not there. -+ return emptyTexture; -+ } - - if (checkBundleOnly && bundle == -1) -- return 0; -+ return emptyTexture; - - //Lock here, we will do stuff that could break rendering - CSingleLock lock(g_graphicsContext); -@@ -327,7 +324,7 @@ int CGUITextureManager::Load(const CStdString& strTextureName, bool checkBundleO - CLog::Log(LOGERROR, "Texture manager unable to load bundled file: %s", strTextureName.c_str()); - delete [] pTextures; - delete [] Delay; -- return 0; -+ return emptyTexture; - } - - pMap = new CTextureMap(strTextureName, width, height, nLoops); -@@ -348,7 +345,7 @@ int CGUITextureManager::Load(const CStdString& strTextureName, bool checkBundleO - CStdString rootPath = strPath.Left(g_SkinInfo->Path().GetLength()); - if (0 == rootPath.CompareNoCase(g_SkinInfo->Path())) - CLog::Log(LOGERROR, "Texture manager unable to load file: %s", strPath.c_str()); -- return 0; -+ return emptyTexture; - } - int iWidth = AnimatedGifSet.FrameWidth; - int iHeight = AnimatedGifSet.FrameHeight; -@@ -386,7 +383,7 @@ int CGUITextureManager::Load(const CStdString& strTextureName, bool checkBundleO - #endif - - m_vecTextures.push_back(pMap); -- return 1; -+ return pMap->GetTexture(); - } // of if (strPath.Right(4).ToLower()==".gif") - - CBaseTexture *pTexture = NULL; -@@ -396,19 +393,19 @@ int CGUITextureManager::Load(const CStdString& strTextureName, bool checkBundleO - if (!m_TexBundle[bundle].LoadTexture(strTextureName, &pTexture, width, height)) - { - CLog::Log(LOGERROR, "Texture manager unable to load bundled file: %s", strTextureName.c_str()); -- return 0; -+ return emptyTexture; - } - } - else - { - pTexture = CBaseTexture::LoadFromFile(strPath); - if (!pTexture) -- return 0; -+ return emptyTexture; - width = pTexture->GetWidth(); - height = pTexture->GetHeight(); - } - -- if (!pTexture) return 0; -+ if (!pTexture) return emptyTexture; - - CTextureMap* pMap = new CTextureMap(strTextureName, width, height, 0); - pMap->Add(pTexture, 100); -@@ -423,7 +420,7 @@ int CGUITextureManager::Load(const CStdString& strTextureName, bool checkBundleO - OutputDebugString(temp); - #endif - -- return 1; -+ return pMap->GetTexture(); - } - - -diff --git a/xbmc/guilib/TextureManager.h b/xbmc/guilib/TextureManager.h -index c982e6a..22fc192 100644 ---- a/xbmc/guilib/TextureManager.h -+++ b/xbmc/guilib/TextureManager.h -@@ -108,8 +108,7 @@ class CGUITextureManager - - bool HasTexture(const CStdString &textureName, CStdString *path = NULL, int *bundle = NULL, int *size = NULL); - bool CanLoad(const CStdString &texturePath) const; ///< Returns true if the texture manager can load this texture -- int Load(const CStdString& strTextureName, bool checkBundleOnly = false); -- const CTextureArray& GetTexture(const CStdString& strTextureName); -+ const CTextureArray& Load(const CStdString& strTextureName, bool checkBundleOnly = false); - void ReleaseTexture(const CStdString& strTextureName); - void Cleanup(); - void Dump() const; --- -1.8.1.6 - - -From ece7ac520231ff144d7bc4d8393d1ca36f227927 Mon Sep 17 00:00:00 2001 -From: Cory Fields -Date: Tue, 30 Apr 2013 23:01:57 -0400 -Subject: [PATCH 2/2] texture: two texture speedups - -1. Check to see if we have a texture loaded already before opening/uploading - another instance of it. - -2. Set a time-out for deleting textures. If they are needed again before the - time-out expires, they are re-added to the loaded textures array and ready - for use again. Otherwise, they are deleted after X msec. This helps to avoid - doing _really_ nasty things, like re-loading the background image when - moving from home to settings. ---- - xbmc/Application.cpp | 2 +- - xbmc/guilib/TextureManager.cpp | 30 +++++++++++++++++++++++++----- - xbmc/guilib/TextureManager.h | 6 ++++-- - 3 files changed, 30 insertions(+), 8 deletions(-) - -diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp -index 37d17e3..df456ec 100644 ---- a/xbmc/Application.cpp -+++ b/xbmc/Application.cpp -@@ -4953,7 +4953,7 @@ void CApplication::ProcessSlow() - if (!IsPlayingVideo()) - g_largeTextureManager.CleanupUnusedImages(); - -- g_TextureManager.FreeUnusedTextures(); -+ g_TextureManager.FreeUnusedTextures(5000); - - #ifdef HAS_DVD_DRIVE - // checks whats in the DVD drive and tries to autostart the content (xbox games, dvd, cdda, avi files...) -diff --git a/xbmc/guilib/TextureManager.cpp b/xbmc/guilib/TextureManager.cpp -index 6d6c4d9..f214489 100644 ---- a/xbmc/guilib/TextureManager.cpp -+++ b/xbmc/guilib/TextureManager.cpp -@@ -29,6 +29,7 @@ - #ifdef _DEBUG - #include "utils/TimeUtils.h" - #endif -+#include "threads/SystemClock.h" - #include "filesystem/File.h" - #include "filesystem/Directory.h" - #include "URL.h" -@@ -298,6 +299,17 @@ bool CGUITextureManager::HasTexture(const CStdString &textureName, CStdString *p - return emptyTexture; - } - -+ for (ilistUnused i = m_unusedTextures.begin(); i != m_unusedTextures.end(); i++) -+ { -+ CTextureMap* pMap = i->first; -+ if (pMap->GetName() == strTextureName) -+ { -+ m_vecTextures.push_back(pMap); -+ m_unusedTextures.erase(i); -+ return pMap->GetTexture(); -+ } -+ } -+ - if (checkBundleOnly && bundle == -1) - return emptyTexture; - -@@ -439,7 +451,7 @@ void CGUITextureManager::ReleaseTexture(const CStdString& strTextureName) - { - //CLog::Log(LOGINFO, " cleanup:%s", strTextureName.c_str()); - // add to our textures to free -- m_unusedTextures.push_back(pMap); -+ m_unusedTextures.push_back(make_pair(pMap, XbmcThreads::SystemClockMillis())); - i = m_vecTextures.erase(i); - } - return; -@@ -449,12 +461,20 @@ void CGUITextureManager::ReleaseTexture(const CStdString& strTextureName) - CLog::Log(LOGWARNING, "%s: Unable to release texture %s", __FUNCTION__, strTextureName.c_str()); - } - --void CGUITextureManager::FreeUnusedTextures() -+void CGUITextureManager::FreeUnusedTextures(unsigned int timeDelay) - { -+ unsigned int currFrameTime = XbmcThreads::SystemClockMillis(); - CSingleLock lock(g_graphicsContext); -- for (ivecTextures i = m_unusedTextures.begin(); i != m_unusedTextures.end(); ++i) -- delete *i; -- m_unusedTextures.clear(); -+ for (ilistUnused i = m_unusedTextures.begin(); i != m_unusedTextures.end();) -+ { -+ if (currFrameTime - i->second >= timeDelay) -+ { -+ delete i->first; -+ i = m_unusedTextures.erase(i); -+ } -+ else -+ i++; -+ } - - #if defined(HAS_GL) || defined(HAS_GLES) - for (unsigned int i = 0; i < m_unusedHwTextures.size(); ++i) -diff --git a/xbmc/guilib/TextureManager.h b/xbmc/guilib/TextureManager.h -index 22fc192..2633c39d 100644 ---- a/xbmc/guilib/TextureManager.h -+++ b/xbmc/guilib/TextureManager.h -@@ -27,6 +27,7 @@ - #define GUILIB_TEXTUREMANAGER_H - - #include -+#include - #include "TextureBundle.h" - #include "threads/CriticalSection.h" - -@@ -121,13 +122,14 @@ class CGUITextureManager - void SetTexturePath(const CStdString &texturePath); ///< Set a single path as the path to check when loading media (clear then add) - void RemoveTexturePath(const CStdString &texturePath); ///< Remove a path from the paths to check when loading media - -- void FreeUnusedTextures(); ///< Free textures (called from app thread only) -+ void FreeUnusedTextures(unsigned int timeDelay = 0); ///< Free textures (called from app thread only) - void ReleaseHwTexture(unsigned int texture); - protected: - std::vector m_vecTextures; -- std::vector m_unusedTextures; -+ std::list > m_unusedTextures; - std::vector m_unusedHwTextures; - typedef std::vector::iterator ivecTextures; -+ typedef std::list >::iterator ilistUnused; - // we have 2 texture bundles (one for the base textures, one for the theme) - CTextureBundle m_TexBundle[2]; - --- -1.8.1.6 - diff --git a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.11-PR2712.patch b/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.11-PR2712.patch deleted file mode 100644 index 63e2969491..0000000000 --- a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.11-PR2712.patch +++ /dev/null @@ -1,77 +0,0 @@ -From 101fbc2d6869d6f02c4345a232854dbbb3f1a855 Mon Sep 17 00:00:00 2001 -From: Cory Fields -Date: Thu, 2 May 2013 16:45:41 -0400 -Subject: [PATCH] build: stop using whole-archive for our final binary - -This nasty hack has been around for ages. By changing, we get the following -benefits: - -- We don't link in _every_ object in _every_ archive! -- Builds will no longer fail if a source file has been removed but its object - still exists in the archive -- Filesize reduction -- Ability to use lto, garbage collection, dead-code stripping, etc in a - useful manner - -This is achieved by specifying a main object on the link line, and using -start-group/end-group to search through the archives multiple times until each -symbol is found. ---- - Makefile.in | 24 ++++++++++++++++-------- - 1 file changed, 16 insertions(+), 8 deletions(-) - -diff --git a/Makefile.in b/Makefile.in -index 3cbe1a2..f0827f2 100644 ---- a/Makefile.in -+++ b/Makefile.in -@@ -92,6 +92,9 @@ DIRECTORY_ARCHIVES=$(DVDPLAYER_ARCHIVES) \ - xbmc/windows/windows.a \ - xbmc/xbmc.a \ - -+ifneq (@USE_LIBXBMC@,1) -+DIRECTORY_ARCHIVES +=xbmc/main/main.a -+endif - - NWAOBJSXBMC= xbmc/threads/threads.a \ - xbmc/commons/commons.a -@@ -425,24 +428,29 @@ endif - - OBJSXBMC:=$(filter-out $(DYNOBJSXBMC), $(OBJSXBMC)) - --libxbmc.so: $(OBJSXBMC) $(DYNOBJSXBMC) $(NWAOBJSXBMC) -+MAINOBJS=xbmc/xbmc.o -+ifeq (@USE_ANDROID@,1) -+MAINOBJS+=xbmc/android/activity/android_main.o -+endif -+ifneq (@USE_LIBXBMC@,1) -+MAINOBJS+=xbmc/main/main.o -+endif -+ -+libxbmc.so: $(OBJSXBMC) $(DYNOBJSXBMC) $(NWAOBJSXBMC) $(MAINOBJS) - ifeq ($(findstring osx,@ARCH@), osx) - $(SILENT_LD) $(CXX) $(LDFLAGS) -bundle -o $@ -Wl,-all_load,-ObjC $(DYNOBJSXBMC) $(NWAOBJSXBMC) $(OBJSXBMC) $(LIBS) - else -- $(SILENT_LD) $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -o $@ -Wl,--whole-archive $(DYNOBJSXBMC) $(OBJSXBMC) -Wl,--no-whole-archive -Wl,--no-undefined $(NWAOBJSXBMC) $(LIBS) -+ $(SILENT_LD) $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -o $@ $(MAINOBJS) -Wl,--start-group $(DYNOBJSXBMC) $(OBJSXBMC) -Wl,--end-group -Wl,--no-undefined $(NWAOBJSXBMC) $(LIBS) - endif - --xbmc.bin: xbmc/main/main.a $(OBJSXBMC) $(DYNOBJSXBMC) $(NWAOBJSXBMC) -+xbmc.bin: $(OBJSXBMC) $(DYNOBJSXBMC) $(NWAOBJSXBMC) $(MAINOBJS) - - ifeq ($(findstring osx,@ARCH@), osx) -- $(SILENT_LD) $(CXX) $(LDFLAGS) -o xbmc.bin -Wl,-all_load,-ObjC $(DYNOBJSXBMC) $(NWAOBJSXBMC) $(OBJSXBMC) xbmc/main/main.a $(LIBS) -rdynamic -+ $(SILENT_LD) $(CXX) $(LDFLAGS) -o xbmc.bin -Wl,-all_load,-ObjC $(DYNOBJSXBMC) $(NWAOBJSXBMC) $(OBJSXBMC) $(LIBS) -rdynamic - else -- $(SILENT_LD) $(CXX) $(CXXFLAGS) $(LDFLAGS) -o xbmc.bin -Wl,--whole-archive $(DYNOBJSXBMC) $(OBJSXBMC) xbmc/main/main.a -Wl,--no-whole-archive $(NWAOBJSXBMC) $(LIBS) -rdynamic -+ $(SILENT_LD) $(CXX) $(CXXFLAGS) $(LDFLAGS) -o xbmc.bin $(MAINOBJS) -Wl,--start-group $(DYNOBJSXBMC) $(OBJSXBMC) -Wl,--end-group $(NWAOBJSXBMC) $(LIBS) -rdynamic - endif - --xbmc/main/main.a: force -- $(MAKE) -C xbmc/main -- - xbmc-xrandr: xbmc-xrandr.c - ifneq (1,@USE_XRANDR@) - # xbmc-xrandr.c gets picked up by the default make rules --- -1.8.1.6 - diff --git a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.12-PR2570.patch b/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.12-PR2570.patch deleted file mode 100644 index a57c5a8b3d..0000000000 --- a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.12-PR2570.patch +++ /dev/null @@ -1,89 +0,0 @@ -From 0aaeb72ed3d76134f11b80a4d17e50b40d6459be Mon Sep 17 00:00:00 2001 -From: hmis -Date: Mon, 8 Apr 2013 21:35:35 +0300 -Subject: [PATCH] Read CD audio USB drive bug fixed - -libcdio seems to allow read no more than about 10 audio sectors at once when CD audio device is connected via USB. -This patch makes XBMC read small number of sectors if default one fails. It uses more CPU but allows to use USB CD devices. -Tested on GNU/Linux x86 and RPi. (On Rpi OMXPlayer does not play CD, but I can rip tracks). ---- - xbmc/filesystem/CDDAFile.cpp | 34 +++++++++++++++++++++++++++------- - xbmc/filesystem/CDDAFile.h | 1 + - 2 files changed, 28 insertions(+), 7 deletions(-) - -diff --git a/xbmc/filesystem/CDDAFile.cpp b/xbmc/filesystem/CDDAFile.cpp -index 5342629..f5eaf37 100644 ---- a/xbmc/filesystem/CDDAFile.cpp -+++ b/xbmc/filesystem/CDDAFile.cpp -@@ -40,6 +40,7 @@ - m_lsnCurrent = CDIO_INVALID_LSN; - m_lsnEnd = CDIO_INVALID_LSN; - m_cdio = CLibcdio::GetInstance(); -+ m_iSectorCount = 52; - } - - CFileCDDA::~CFileCDDA(void) -@@ -120,7 +121,8 @@ unsigned int CFileCDDA::Read(void* lpBuf, int64_t uiBufSize) - if (!m_pCdIo || !g_mediaManager.IsDiscInDrive()) - return 0; - -- int iSectorCount = (int)uiBufSize / CDIO_CD_FRAMESIZE_RAW; -+ // limit number of sectors that fits in buffer by m_iSectorCount -+ int iSectorCount = std::min((int)uiBufSize / CDIO_CD_FRAMESIZE_RAW, m_iSectorCount); - - if (iSectorCount <= 0) - return 0; -@@ -129,14 +131,32 @@ unsigned int CFileCDDA::Read(void* lpBuf, int64_t uiBufSize) - if (m_lsnCurrent + iSectorCount > m_lsnEnd) - iSectorCount = m_lsnEnd - m_lsnCurrent; - -- int iret = m_cdio->cdio_read_audio_sectors(m_pCdIo, lpBuf, m_lsnCurrent, iSectorCount); -- -- if ( iret != DRIVER_OP_SUCCESS) -+ // The loop tries to solve read error problem by lowering number of sectors to read (iSectorCount). -+ // When problem is solved the proper number of sectors is stored in m_iSectorCount -+ int big_iSectorCount = iSectorCount; -+ while (iSectorCount > 0) - { -- CLog::Log(LOGERROR, "file cdda: Reading %d sectors of audio data starting at lsn %d failed with error code %i", iSectorCount, m_lsnCurrent, iret); -- return 0; -+ int iret = m_cdio->cdio_read_audio_sectors(m_pCdIo, lpBuf, m_lsnCurrent, iSectorCount); -+ -+ if (iret == DRIVER_OP_SUCCESS) -+ { -+ // If lower iSectorCount solved the problem limit it's value -+ if (iSectorCount < big_iSectorCount) -+ { -+ m_iSectorCount = iSectorCount; -+ } -+ break; -+ } -+ -+ // iSectorCount is low so it cannot solve read problem -+ if (iSectorCount <= 10) -+ { -+ CLog::Log(LOGERROR, "file cdda: Reading %d sectors of audio data starting at lsn %d failed with error code %i", iSectorCount, m_lsnCurrent, iret); -+ return 0; -+ } -+ -+ iSectorCount = 10; - } -- - m_lsnCurrent += iSectorCount; - - return iSectorCount*CDIO_CD_FRAMESIZE_RAW; -diff --git a/xbmc/filesystem/CDDAFile.h b/xbmc/filesystem/CDDAFile.h -index f041e0b..72b8d5b 100644 ---- a/xbmc/filesystem/CDDAFile.h -+++ b/xbmc/filesystem/CDDAFile.h -@@ -53,6 +53,7 @@ class CFileCDDA : public IFile - lsn_t m_lsnStart; // Start of m_iTrack in logical sector number - lsn_t m_lsnCurrent; // Position inside the track in logical sector number - lsn_t m_lsnEnd; // End of m_iTrack in logical sector number -+ int m_iSectorCount; // max number of sectors to read at once - boost::shared_ptr m_cdio; - }; - } --- -1.8.1.6 - diff --git a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.12-PR2586.patch b/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.12-PR2586.patch deleted file mode 100644 index 63357752c3..0000000000 --- a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.12-PR2586.patch +++ /dev/null @@ -1,555 +0,0 @@ -diff -Naur xbmc-12.2.0/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxCDDA.cpp xbmc-12.2.0.patch/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxCDDA.cpp ---- xbmc-12.2.0/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxCDDA.cpp 1970-01-01 01:00:00.000000000 +0100 -+++ xbmc-12.2.0.patch/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxCDDA.cpp 2013-05-10 07:16:56.061904946 +0200 -@@ -0,0 +1,180 @@ -+/* -+ * Copyright (C) 2013 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 -+ * . -+ * -+ */ -+ -+#include "DVDInputStreams/DVDInputStream.h" -+#include "DVDDemuxCDDA.h" -+#include "DVDDemuxUtils.h" -+#include "utils/log.h" -+#include "../DVDClock.h" -+ -+// CDDA audio demuxer based on AirTunes audio Demuxer. -+ -+using namespace std; -+ -+class CDemuxStreamAudioCDDA -+ : public CDemuxStreamAudio -+{ -+public: -+ void GetStreamInfo(string& strInfo) -+ { -+ strInfo = "pcm"; -+ } -+}; -+ -+CDVDDemuxCDDA::CDVDDemuxCDDA() : CDVDDemux() -+{ -+ m_pInput = NULL; -+ m_stream = NULL; -+ m_bytes = 0; -+} -+ -+CDVDDemuxCDDA::~CDVDDemuxCDDA() -+{ -+ Dispose(); -+} -+ -+bool CDVDDemuxCDDA::Open(CDVDInputStream* pInput) -+{ -+ Abort(); -+ -+ Dispose(); -+ -+ if(!pInput || !pInput->IsStreamType(DVDSTREAM_TYPE_FILE)) -+ return false; -+ -+ m_pInput = pInput; -+ -+ m_stream = new CDemuxStreamAudioCDDA(); -+ -+ if(!m_stream) -+ return false; -+ -+ m_stream->iSampleRate = 44100; -+ m_stream->iBitsPerSample = 16; -+ m_stream->iBitRate = 44100 * 2 * 16; -+ m_stream->iChannels = 2; -+ m_stream->type = STREAM_AUDIO; -+ m_stream->codec = CODEC_ID_PCM_S16LE; -+ -+ return true; -+} -+ -+void CDVDDemuxCDDA::Dispose() -+{ -+ delete m_stream; -+ m_stream = NULL; -+ -+ m_pInput = NULL; -+ m_bytes = 0; -+} -+ -+void CDVDDemuxCDDA::Reset() -+{ -+ CDVDInputStream* pInputStream = m_pInput; -+ Dispose(); -+ Open(pInputStream); -+} -+ -+void CDVDDemuxCDDA::Abort() -+{ -+ if(m_pInput) -+ return m_pInput->Abort(); -+} -+ -+void CDVDDemuxCDDA::Flush() -+{ -+} -+ -+#define CDDA_READ_SIZE 4096 -+DemuxPacket* CDVDDemuxCDDA::Read() -+{ -+ if(!m_pInput) -+ return NULL; -+ -+ DemuxPacket* pPacket = CDVDDemuxUtils::AllocateDemuxPacket(CDDA_READ_SIZE); -+ -+ if (!pPacket) -+ { -+ if (m_pInput) -+ m_pInput->Close(); -+ return NULL; -+ } -+ -+ pPacket->iSize = m_pInput->Read(pPacket->pData, CDDA_READ_SIZE); -+ pPacket->iStreamId = 0; -+ -+ if(pPacket->iSize < 1) -+ { -+ delete pPacket; -+ pPacket = NULL; -+ } -+ else -+ { -+ int n = m_stream->iBitRate>>3; -+ if (n > 0) -+ { -+ m_bytes += pPacket->iSize; -+ pPacket->dts = (double)m_bytes * DVD_TIME_BASE / n; -+ pPacket->pts = pPacket->dts; -+ } -+ else -+ { -+ pPacket->dts = DVD_NOPTS_VALUE; -+ pPacket->pts = DVD_NOPTS_VALUE; -+ } -+ } -+ -+ return pPacket; -+} -+ -+int CDVDDemuxCDDA::GetStreamLength() -+{ -+ int64_t num_track_bytes = m_pInput->GetLength(); -+ int bytes_per_second = (m_stream->iBitRate>>3); -+ int64_t track_mseconds = num_track_bytes*1000 / bytes_per_second; -+ return (int)track_mseconds; -+} -+ -+CDemuxStream* CDVDDemuxCDDA::GetStream(int iStreamId) -+{ -+ if(iStreamId != 0) -+ return NULL; -+ -+ return m_stream; -+} -+ -+int CDVDDemuxCDDA::GetNrOfStreams() -+{ -+ return (m_stream == NULL ? 0 : 1); -+} -+ -+std::string CDVDDemuxCDDA::GetFileName() -+{ -+ if(m_pInput) -+ return m_pInput->GetFileName(); -+ else -+ return ""; -+} -+ -+void CDVDDemuxCDDA::GetStreamCodecName(int iStreamId, CStdString &strName) -+{ -+ if (m_stream && iStreamId == 0) -+ strName = "pcm"; -+} -diff -Naur xbmc-12.2.0/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxCDDA.h xbmc-12.2.0.patch/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxCDDA.h ---- xbmc-12.2.0/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxCDDA.h 1970-01-01 01:00:00.000000000 +0100 -+++ xbmc-12.2.0.patch/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxCDDA.h 2013-05-10 07:16:56.061904946 +0200 -@@ -0,0 +1,59 @@ -+#pragma once -+/* -+ * Copyright (C) 2013 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 -+ * . -+ * -+ */ -+ -+#include "DVDDemux.h" -+ -+#ifdef _WIN32 -+#define __attribute__(dummy_val) -+#else -+#include -+#endif -+ -+class CDemuxStreamAudioCDDA; -+ -+class CDVDDemuxCDDA : public CDVDDemux -+{ -+public: -+ -+ CDVDDemuxCDDA(); -+ ~CDVDDemuxCDDA(); -+ -+ bool Open(CDVDInputStream* pInput); -+ void Dispose(); -+ void Reset(); -+ void Abort(); -+ void Flush(); -+ DemuxPacket* Read(); -+ bool SeekTime(int time, bool backwords = false, double* startpts = NULL) { return false; }; -+ void SetSpeed(int iSpeed) {}; -+ int GetStreamLength() ; -+ CDemuxStream* GetStream(int iStreamId); -+ int GetNrOfStreams(); -+ std::string GetFileName(); -+ virtual void GetStreamCodecName(int iStreamId, CStdString &strName); -+ -+protected: -+ friend class CDemuxStreamAudioCDDA; -+ CDVDInputStream* m_pInput; -+ int64_t m_bytes; -+ -+ CDemuxStreamAudioCDDA *m_stream; -+}; -diff -Naur xbmc-12.2.0/xbmc/cores/dvdplayer/DVDDemuxers/DVDFactoryDemuxer.cpp xbmc-12.2.0.patch/xbmc/cores/dvdplayer/DVDDemuxers/DVDFactoryDemuxer.cpp ---- xbmc-12.2.0/xbmc/cores/dvdplayer/DVDDemuxers/DVDFactoryDemuxer.cpp 2013-05-02 17:00:07.000000000 +0200 -+++ xbmc-12.2.0.patch/xbmc/cores/dvdplayer/DVDDemuxers/DVDFactoryDemuxer.cpp 2013-05-10 07:16:56.061904946 +0200 -@@ -31,6 +31,7 @@ - #include "DVDDemuxHTSP.h" - #endif - #include "DVDDemuxBXA.h" -+#include "DVDDemuxCDDA.h" - #include "DVDDemuxPVRClient.h" - #include "pvr/PVRManager.h" - #include "pvr/addons/PVRClients.h" -@@ -51,6 +52,22 @@ - else - return NULL; - } -+ -+ // Try to open CDDA demuxer -+ if (pInputStream->IsStreamType(DVDSTREAM_TYPE_FILE) && pInputStream->GetContent().compare("application/octet-stream") == 0) -+ { -+ std::string filename = pInputStream->GetFileName(); -+ if (filename.substr(0, 7) == "cdda://") -+ { -+ CLog::Log(LOGDEBUG, "DVDFactoryDemuxer: Stream is probably CD audio. Creating CDDA demuxer."); -+ -+ auto_ptr demuxer(new CDVDDemuxCDDA()); -+ if (demuxer->Open(pInputStream)) -+ { -+ return demuxer.release(); -+ } -+ } -+ } - - if (pInputStream->IsStreamType(DVDSTREAM_TYPE_HTTP)) - { -diff -Naur xbmc-12.2.0/xbmc/cores/dvdplayer/DVDDemuxers/DVDFactoryDemuxer.cpp.orig xbmc-12.2.0.patch/xbmc/cores/dvdplayer/DVDDemuxers/DVDFactoryDemuxer.cpp.orig -diff -Naur xbmc-12.2.0/xbmc/cores/dvdplayer/DVDDemuxers/Makefile.in xbmc-12.2.0.patch/xbmc/cores/dvdplayer/DVDDemuxers/Makefile.in ---- xbmc-12.2.0/xbmc/cores/dvdplayer/DVDDemuxers/Makefile.in 2013-05-02 17:00:07.000000000 +0200 -+++ xbmc-12.2.0.patch/xbmc/cores/dvdplayer/DVDDemuxers/Makefile.in 2013-05-10 07:16:56.061904946 +0200 -@@ -2,6 +2,7 @@ - - SRCS = DVDDemux.cpp - SRCS += DVDDemuxBXA.cpp -+SRCS += DVDDemuxCDDA.cpp - SRCS += DVDDemuxFFmpeg.cpp - SRCS += DVDDemuxHTSP.cpp - SRCS += DVDDemuxPVRClient.cpp -diff -Naur xbmc-12.2.0/xbmc/cores/paplayer/CDDAcodec.cpp xbmc-12.2.0.patch/xbmc/cores/paplayer/CDDAcodec.cpp ---- xbmc-12.2.0/xbmc/cores/paplayer/CDDAcodec.cpp 2013-05-02 17:00:08.000000000 +0200 -+++ xbmc-12.2.0.patch/xbmc/cores/paplayer/CDDAcodec.cpp 1970-01-01 01:00:00.000000000 +0100 -@@ -1,159 +0,0 @@ --/* -- * Copyright (C) 2005-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 -- * . -- * -- */ -- --#include "CDDAcodec.h" --#if !defined(TARGET_DARWIN_IOS) --#include --#else --typedef int32_t lsn_t; --#define CDIO_CD_FRAMESIZE_RAW 2352 --#define CDIO_CD_FRAMES_PER_SEC 75 --#endif --#include "cores/AudioEngine/Utils/AEUtil.h" -- --#define SECTOR_COUNT 55 // max. sectors that can be read at once --#define MAX_BUFFER_SIZE 2*SECTOR_COUNT*CDIO_CD_FRAMESIZE_RAW -- --CDDACodec::CDDACodec() --{ -- m_SampleRate = 44100; -- m_Channels = 2; -- m_BitsPerSample = 16; -- m_DataFormat = AE_FMT_S16NE; -- m_TotalTime = 0; -- m_Bitrate = 0; -- m_CodecName = "cdda"; -- -- m_BufferSize=0; -- m_Buffer = new BYTE[MAX_BUFFER_SIZE]; -- m_BufferPos = 0; --} -- --CDDACodec::~CDDACodec() --{ -- DeInit(); -- -- if (m_Buffer) -- { -- delete[] m_Buffer; -- m_Buffer = NULL; -- } --} -- --bool CDDACodec::Init(const CStdString &strFile, unsigned int filecache) --{ -- if (!m_file.Open(strFile, READ_CACHED)) -- return false; -- -- // Calculate total time of the track -- m_TotalTime=(m_file.GetLength()/CDIO_CD_FRAMESIZE_RAW)/CDIO_CD_FRAMES_PER_SEC; -- if (m_TotalTime > 0) -- m_Bitrate = (int)((m_file.GetLength() * 8) / m_TotalTime); -- else -- m_Bitrate = 0; -- m_TotalTime*=1000; // ms -- return true; --} -- --void CDDACodec::DeInit() --{ -- m_file.Close(); --} -- --int64_t CDDACodec::Seek(int64_t iSeekTime) --{ -- // Calculate the next full second... -- int iSeekTimeFullSec=(int)(iSeekTime+(1000-(iSeekTime%1000)))/1000; -- -- // ...and the logical sector on the cd... -- lsn_t lsnSeek=iSeekTimeFullSec*CDIO_CD_FRAMES_PER_SEC; -- -- // ... then seek to its position... -- int iNewOffset=(int)m_file.Seek(lsnSeek*CDIO_CD_FRAMESIZE_RAW, SEEK_SET); -- m_BufferSize=m_BufferPos=0; -- -- // ... and look if we really got there. -- int iNewSeekTime=(iNewOffset/CDIO_CD_FRAMESIZE_RAW)/CDIO_CD_FRAMES_PER_SEC; -- return iNewSeekTime*(int64_t)1000; // ms --} -- --int CDDACodec::ReadPCM(BYTE *pBuffer, int size, int *actualsize) --{ -- *actualsize=0; -- -- bool bEof=false; -- // Reached end of track? -- if (m_file.GetLength()==m_file.GetPosition()) -- bEof=true; -- -- // Do we have to refill our audio buffer? -- if (m_BufferSize-m_BufferPos=size) -- { // we have enough data in our buffer -- memcpy(pBuffer, m_Buffer + m_BufferPos, size); -- m_BufferPos+=size; -- *actualsize=size; -- } -- else -- { // Only a smaller amount of data left as the player wants -- memcpy(pBuffer, m_Buffer + m_BufferPos, m_BufferSize-m_BufferPos); -- *actualsize=m_BufferSize-m_BufferPos; -- m_BufferPos+=m_BufferSize-m_BufferPos; -- } -- -- return READ_SUCCESS; --} -- --bool CDDACodec::CanInit() --{ -- return true; --} -- --CAEChannelInfo CDDACodec::GetChannelInfo() --{ -- static enum AEChannel map[2][3] = { -- {AE_CH_FC, AE_CH_NULL}, -- {AE_CH_FL, AE_CH_FR , AE_CH_NULL} -- }; -- -- if (m_Channels > 2) -- return CAEUtil::GuessChLayout(m_Channels); -- -- return CAEChannelInfo(map[m_Channels - 1]); --} -diff -Naur xbmc-12.2.0/xbmc/cores/paplayer/CDDAcodec.h xbmc-12.2.0.patch/xbmc/cores/paplayer/CDDAcodec.h ---- xbmc-12.2.0/xbmc/cores/paplayer/CDDAcodec.h 2013-05-02 17:00:08.000000000 +0200 -+++ xbmc-12.2.0.patch/xbmc/cores/paplayer/CDDAcodec.h 1970-01-01 01:00:00.000000000 +0100 -@@ -1,43 +0,0 @@ --#pragma once -- --/* -- * Copyright (C) 2005-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 -- * . -- * -- */ -- --#include "CachingCodec.h" -- --class CDDACodec : public CachingCodec --{ --public: -- CDDACodec(); -- virtual ~CDDACodec(); -- -- virtual bool Init(const CStdString &strFile, unsigned int filecache); -- virtual void DeInit(); -- virtual int64_t Seek(int64_t iSeekTime); -- virtual int ReadPCM(BYTE *pBuffer, int size, int *actualsize); -- virtual bool CanInit(); -- virtual CAEChannelInfo GetChannelInfo(); -- --private: -- // Input buffer to read our cdda data into -- BYTE* m_Buffer; -- int m_BufferSize; -- int m_BufferPos; --}; -diff -Naur xbmc-12.2.0/xbmc/cores/paplayer/CodecFactory.cpp xbmc-12.2.0.patch/xbmc/cores/paplayer/CodecFactory.cpp ---- xbmc-12.2.0/xbmc/cores/paplayer/CodecFactory.cpp 2013-05-02 17:00:08.000000000 +0200 -+++ xbmc-12.2.0.patch/xbmc/cores/paplayer/CodecFactory.cpp 2013-05-10 07:16:56.061904946 +0200 -@@ -21,7 +21,6 @@ - #include "system.h" - #include "CodecFactory.h" - #include "MP3codec.h" --#include "CDDAcodec.h" - #include "OGGcodec.h" - #include "FLACcodec.h" - #include "WAVcodec.h" -@@ -51,7 +50,7 @@ - else if (strFileType.Equals("ape") || strFileType.Equals("mac")) - return new DVDPlayerCodec(); - else if (strFileType.Equals("cdda")) -- return new CDDACodec(); -+ return new DVDPlayerCodec(); - else if (strFileType.Equals("mpc") || strFileType.Equals("mp+") || strFileType.Equals("mpp")) - return new DVDPlayerCodec(); - else if (strFileType.Equals("shn")) -@@ -183,20 +182,6 @@ - } - delete codec; - } -- if (urlFile.GetFileType().Equals("cdda")) -- { -- //lets see what it contains... -- //this kinda sucks 'cause if it's plain cdda the file -- //will be opened, sniffed and closed before it is opened *again* for cdda -- //would be better if the papcodecs could work with bitstreams instead of filenames. -- DVDPlayerCodec *dvdcodec = new DVDPlayerCodec(); -- dvdcodec->SetContentType("audio/x-spdif-compressed"); -- if (dvdcodec->Init(strFile, filecache)) -- { -- return dvdcodec; -- } -- delete dvdcodec; -- } - else if (urlFile.GetFileType().Equals("ogg") || urlFile.GetFileType().Equals("oggstream") || urlFile.GetFileType().Equals("oga")) - return CreateOGGCodec(strFile,filecache); - -diff -Naur xbmc-12.2.0/xbmc/cores/paplayer/Makefile.in xbmc-12.2.0.patch/xbmc/cores/paplayer/Makefile.in ---- xbmc-12.2.0/xbmc/cores/paplayer/Makefile.in 2013-05-02 17:00:08.000000000 +0200 -+++ xbmc-12.2.0.patch/xbmc/cores/paplayer/Makefile.in 2013-05-10 07:16:56.062904942 +0200 -@@ -9,7 +9,6 @@ - - SRCS = ADPCMCodec.cpp - SRCS += AudioDecoder.cpp --SRCS += CDDAcodec.cpp - SRCS += CodecFactory.cpp - SRCS += DVDPlayerCodec.cpp - SRCS += FLACcodec.cpp diff --git a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.13-RPB-Fix_for_hang_following_seek_after_eos.patch b/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.13-RPB-Fix_for_hang_following_seek_after_eos.patch deleted file mode 100644 index b259666b75..0000000000 --- a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.13-RPB-Fix_for_hang_following_seek_after_eos.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 5b75f44b448bcefb9b802a3a28d0e6846284d22e Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 6 May 2013 14:20:05 +0100 -Subject: [PATCH] [rbp/omxplayer] Fix for hang following seek after eos - -If you seek after the demuxer eof, the eof state is cleared, but we are not clearing the flags relating to sending eos stream to audio/video players ---- - xbmc/cores/omxplayer/OMXPlayer.cpp | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - -diff --git a/xbmc/cores/omxplayer/OMXPlayer.cpp b/xbmc/cores/omxplayer/OMXPlayer.cpp -index 156a3ad..82d0024 100644 ---- a/xbmc/cores/omxplayer/OMXPlayer.cpp -+++ b/xbmc/cores/omxplayer/OMXPlayer.cpp -@@ -1178,7 +1178,13 @@ void COMXPlayer::Process() - CDVDDemuxUtils::FreeDemuxPacket(pPacket); - continue; - } -- -+ if (pPacket) -+ { -+ // reset eos state when we get a packet (e.g. for case of seek after eos) -+ bOmxWaitVideo = false; -+ bOmxWaitAudio = false; -+ bOmxSentEOFs = false; -+ } - if (!pPacket) - { - // when paused, demuxer could be be returning empty --- -1.8.1.6 - diff --git a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.14-PR2700.patch.bk b/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.14-PR2700.patch.bk deleted file mode 100644 index 0ac0d2cc14..0000000000 --- a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.14-PR2700.patch.bk +++ /dev/null @@ -1,322 +0,0 @@ -From 85891c135b848d8f11a5410d867f67e0515d3d0b Mon Sep 17 00:00:00 2001 -From: Joakim Plate -Date: Sun, 17 Mar 2013 19:04:52 +0100 -Subject: [PATCH 1/3] dvdplayer: move CanSeek/CanPause to seekable interface - ---- - .../dvdplayer/DVDInputStreams/DVDInputStream.h | 8 ++++++++ - .../DVDInputStreams/DVDInputStreamPVRManager.h | 1 + - xbmc/cores/dvdplayer/DVDPlayer.cpp | 22 +++++++++++----------- - 3 files changed, 20 insertions(+), 11 deletions(-) - -diff --git a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStream.h b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStream.h -index b3b7ae3..a5ee3ae 100644 ---- a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStream.h -+++ b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStream.h -@@ -122,6 +122,14 @@ class CDVDInputStream - virtual double GetTimeStampCorrection() = 0; - }; - -+ class ISeekable -+ { -+ public: -+ virtual ~ISeekable() {}; -+ virtual bool CanSeek() = 0; -+ virtual bool CanPause() = 0; -+ }; -+ - enum ENextStream - { - NEXTSTREAM_NONE, -diff --git a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamPVRManager.h b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamPVRManager.h -index 79389a4..89f05a7 100644 ---- a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamPVRManager.h -+++ b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamPVRManager.h -@@ -39,6 +39,7 @@ class CDVDInputStreamPVRManager - : public CDVDInputStream - , public CDVDInputStream::IChannel - , public CDVDInputStream::IDisplayTime -+ , public CDVDInputStream::ISeekable - { - public: - CDVDInputStreamPVRManager(IDVDPlayer* pPlayer); -diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp -index e5a1e71..5baf57a 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayer.cpp -+++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp -@@ -3833,6 +3833,9 @@ void CDVDPlayer::UpdatePlayState(double timeout) - state.time_src = ETIMESOURCE_CLOCK; - } - -+ state.canpause = true; -+ state.canseek = true; -+ - if(m_pInputStream) - { - // override from input stream if needed -@@ -3861,16 +3864,10 @@ void CDVDPlayer::UpdatePlayState(double timeout) - } - } - -- if (m_pInputStream->IsStreamType(DVDSTREAM_TYPE_PVRMANAGER)) -- { -- CDVDInputStreamPVRManager* pvrinputstream = static_cast(m_pInputStream); -- state.canpause = pvrinputstream->CanPause(); -- state.canseek = pvrinputstream->CanSeek(); -- } -- else -+ if (CDVDInputStream::ISeekable* ptr = dynamic_cast(m_pInputStream)) - { -- state.canseek = state.time_total > 0 ? true : false; -- state.canpause = true; -+ state.canpause = ptr->CanPause(); -+ state.canseek = ptr->CanSeek(); - } - } - -@@ -3880,10 +3877,13 @@ void CDVDPlayer::UpdatePlayState(double timeout) - state.time_total = m_Edl.RemoveCutTime(llrint(state.time_total)); - } - -+ if(state.time_total <= 0) -+ state.canseek = false; -+ - state.player_state = ""; -- if (m_pInputStream && m_pInputStream->IsStreamType(DVDSTREAM_TYPE_DVD)) -+ if(CDVDInputStreamNavigator* ptr = dynamic_cast(m_pInputStream)) - { -- if(!((CDVDInputStreamNavigator*)m_pInputStream)->GetNavigatorState(state.player_state)) -+ if(!ptr->GetNavigatorState(state.player_state)) - state.player_state = ""; - } - --- -1.8.1.6 - - -From c817ed00d875174b6789621aba4dc15123c4f3bd Mon Sep 17 00:00:00 2001 -From: Joakim Plate -Date: Sun, 17 Mar 2013 19:15:13 +0100 -Subject: [PATCH 2/3] dvdplayer: disable seeking and pause for udp/rtp and seek - for tcp - ---- - .../dvdplayer/DVDInputStreams/DVDInputStreamFFmpeg.cpp | 17 +++++++++++++++++ - .../dvdplayer/DVDInputStreams/DVDInputStreamFFmpeg.h | 9 ++++++++- - 2 files changed, 25 insertions(+), 1 deletion(-) - -diff --git a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamFFmpeg.cpp -index 72ea5f8..fb5001a 100644 ---- a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamFFmpeg.cpp -+++ b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamFFmpeg.cpp -@@ -47,7 +47,24 @@ bool CDVDInputStreamFFmpeg::Open(const char* strFile, const std::string& content - if (!CDVDInputStream::Open(strFile, content)) - return false; - -+ m_can_pause = true; -+ m_can_seek = true; -+ -+ if(strnicmp(strFile, "udp://", 6) == 0 -+ || strnicmp(strFile, "rtp://", 6) == 0) -+ { -+ m_can_pause = false; -+ m_can_seek = false; -+ } -+ -+ if(strnicmp(strFile, "tcp://", 6) == 0) -+ { -+ m_can_pause = true; -+ m_can_seek = false; -+ } -+ - m_aborted = false; -+ - return true; - } - -diff --git a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamFFmpeg.h b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamFFmpeg.h -index 6149233..cf80e8f 100644 ---- a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamFFmpeg.h -+++ b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamFFmpeg.h -@@ -22,7 +22,9 @@ - - #include "DVDInputStream.h" - --class CDVDInputStreamFFmpeg : public CDVDInputStream -+class CDVDInputStreamFFmpeg -+ : public CDVDInputStream -+ , public CDVDInputStream::ISeekable - { - public: - CDVDInputStreamFFmpeg(); -@@ -38,6 +40,11 @@ class CDVDInputStreamFFmpeg : public CDVDInputStream - virtual void Abort() { m_aborted = true; } - bool Aborted() { return m_aborted; } - -+ bool CanSeek() { return m_can_seek; } -+ bool CanPause() { return m_can_pause; } -+ - protected: - bool m_aborted; -+ bool m_can_pause; -+ bool m_can_seek; - }; --- -1.8.1.6 - - -From 20562d6450d481967833de7895cd27352a4fdea1 Mon Sep 17 00:00:00 2001 -From: Wolfgang Haupt -Date: Tue, 7 May 2013 09:43:03 +0200 -Subject: [PATCH 3/3] dvdplayer: move navigator state into IMenus - ---- - .../dvdplayer/DVDInputStreams/DVDInputStream.h | 2 ++ - .../DVDInputStreams/DVDInputStreamBluray.h | 2 ++ - .../DVDInputStreams/DVDInputStreamNavigator.cpp | 4 +-- - .../DVDInputStreams/DVDInputStreamNavigator.h | 4 +-- - xbmc/cores/dvdplayer/DVDPlayer.cpp | 38 ++++++++++------------ - 5 files changed, 25 insertions(+), 25 deletions(-) - -diff --git a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStream.h b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStream.h -index a5ee3ae..76414b2 100644 ---- a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStream.h -+++ b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStream.h -@@ -120,6 +120,8 @@ class CDVDInputStream - virtual bool OnMouseClick(const CPoint &point) = 0; - virtual bool IsInMenu() = 0; - virtual double GetTimeStampCorrection() = 0; -+ virtual bool GetState(std::string &xmlstate) { return false; } -+ virtual bool SetState(const std::string &xmlstate) { return false; } - }; - - class ISeekable -diff --git a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamBluray.h b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamBluray.h -index 6897d0f..a7d8f6b 100644 ---- a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamBluray.h -+++ b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamBluray.h -@@ -81,6 +81,8 @@ class CDVDInputStreamBluray - virtual bool OnMouseMove(const CPoint &point) { return false; } - virtual bool OnMouseClick(const CPoint &point) { return false; } - virtual double GetTimeStampCorrection() { return 0.0; } -+ virtual bool GetState(std::string &xmlstate) { return false; } -+ virtual bool SetState(const std::string &xmlstate) { return false; } - - void UserInput(bd_vk_key_e vk); - -diff --git a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamNavigator.cpp b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamNavigator.cpp -index 9cd8cf9..102b862 100644 ---- a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamNavigator.cpp -+++ b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamNavigator.cpp -@@ -1144,7 +1144,7 @@ bool CDVDInputStreamNavigator::IsSubtitleStreamEnabled() - return false; - } - --bool CDVDInputStreamNavigator::GetNavigatorState(std::string &xmlstate) -+bool CDVDInputStreamNavigator::GetState(std::string &xmlstate) - { - if( !m_dvdnav ) - return false; -@@ -1165,7 +1165,7 @@ bool CDVDInputStreamNavigator::GetNavigatorState(std::string &xmlstate) - return true; - } - --bool CDVDInputStreamNavigator::SetNavigatorState(std::string &xmlstate) -+bool CDVDInputStreamNavigator::SetState(const std::string &xmlstate) - { - if( !m_dvdnav ) - return false; -diff --git a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamNavigator.h b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamNavigator.h -index 0c16642..45b2632 100644 ---- a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamNavigator.h -+++ b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamNavigator.h -@@ -108,8 +108,8 @@ class CDVDInputStreamNavigator - int GetAudioStreamCount(); - bool SetActiveAudioStream(int iId); - -- bool GetNavigatorState(std::string &xmlstate); -- bool SetNavigatorState(std::string &xmlstate); -+ bool GetState(std::string &xmlstate); -+ bool SetState(const std::string &xmlstate); - - int GetChapter() { return m_iPart; } // the current part in the current title - int GetChapterCount() { return m_iPartCount; } // the number of parts in the current title -diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp -index 5baf57a..cb8a62b 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayer.cpp -+++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp -@@ -936,16 +936,15 @@ void CDVDPlayer::Process() - return; - } - -- if(m_pInputStream->IsStreamType(DVDSTREAM_TYPE_DVD)) -+ if (CDVDInputStream::IMenus* ptr = dynamic_cast(m_pInputStream)) - { -- CLog::Log(LOGNOTICE, "DVDPlayer: playing a dvd with menu's"); -+ CLog::Log(LOGNOTICE, "DVDPlayer: playing a file with menu's"); - m_PlayerOptions.starttime = 0; - -- - if(m_PlayerOptions.state.size() > 0) -- ((CDVDInputStreamNavigator*)m_pInputStream)->SetNavigatorState(m_PlayerOptions.state); -- else -- ((CDVDInputStreamNavigator*)m_pInputStream)->EnableSubtitleStream(g_settings.m_currentVideoSettings.m_SubtitleOn); -+ ptr->SetState(m_PlayerOptions.state); -+ else if(CDVDInputStreamNavigator* nav = dynamic_cast(m_pInputStream)) -+ nav->EnableSubtitleStream(g_settings.m_currentVideoSettings.m_SubtitleOn); - - g_settings.m_currentVideoSettings.m_SubtitleCached = true; - } -@@ -2147,13 +2146,14 @@ void CDVDPlayer::HandleMessages() - - CDVDMsgPlayerSetState* pMsgPlayerSetState = (CDVDMsgPlayerSetState*)pMsg; - -- if (m_pInputStream && m_pInputStream->IsStreamType(DVDSTREAM_TYPE_DVD)) -+ if (CDVDInputStream::IMenus* ptr = dynamic_cast(m_pInputStream)) - { -- std::string s = pMsgPlayerSetState->GetState(); -- ((CDVDInputStreamNavigator*)m_pInputStream)->SetNavigatorState(s); -- m_dvd.state = DVDSTATE_NORMAL; -- m_dvd.iDVDStillStartTime = 0; -- m_dvd.iDVDStillTime = 0; -+ if(ptr->SetState(pMsgPlayerSetState->GetState())) -+ { -+ m_dvd.state = DVDSTATE_NORMAL; -+ m_dvd.iDVDStillStartTime = 0; -+ m_dvd.iDVDStillTime = 0; -+ } - } - - g_infoManager.SetDisplayAfterSeek(); -@@ -3853,9 +3853,12 @@ void CDVDPlayer::UpdatePlayState(double timeout) - state.time_total = pDisplayTime->GetTotalTime(); - state.time_src = ETIMESOURCE_INPUT; - } -- -- if (dynamic_cast(m_pInputStream)) -+ -+ if (CDVDInputStream::IMenus* ptr = dynamic_cast(m_pInputStream)) - { -+ if(!ptr->GetState(state.player_state)) -+ state.player_state = ""; -+ - if(m_dvd.state == DVDSTATE_STILL) - { - state.time = XbmcThreads::SystemClockMillis() - m_dvd.iDVDStillStartTime; -@@ -3880,13 +3883,6 @@ void CDVDPlayer::UpdatePlayState(double timeout) - if(state.time_total <= 0) - state.canseek = false; - -- state.player_state = ""; -- if(CDVDInputStreamNavigator* ptr = dynamic_cast(m_pInputStream)) -- { -- if(!ptr->GetNavigatorState(state.player_state)) -- state.player_state = ""; -- } -- - if (state.time_src == ETIMESOURCE_CLOCK) - state.time_offset = m_offset_pts; - else --- -1.8.1.6 - diff --git a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.15-depends-mark_our_wrapped_functions_as_used.patch b/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.15-depends-mark_our_wrapped_functions_as_used.patch deleted file mode 100644 index 4eeb6cd461..0000000000 --- a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.15-depends-mark_our_wrapped_functions_as_used.patch +++ /dev/null @@ -1,456 +0,0 @@ -From 0c2eaf5082a30fb06bad553775e805a745d59ee2 Mon Sep 17 00:00:00 2001 -From: theuni -Date: Tue, 22 Jan 2013 04:09:07 -0500 -Subject: [PATCH] depends: mark our wrapped functions as used - -otherwise they get stripped when enabling dead code stripping ---- - xbmc/cores/DllLoader/exports/wrapper.c | 138 ++++++++++++++++----------------- - 1 file changed, 69 insertions(+), 69 deletions(-) - -diff --git a/xbmc/cores/DllLoader/exports/wrapper.c b/xbmc/cores/DllLoader/exports/wrapper.c -index cb7bbf7..67189e9 100644 ---- a/xbmc/cores/DllLoader/exports/wrapper.c -+++ b/xbmc/cores/DllLoader/exports/wrapper.c -@@ -115,7 +115,7 @@ - int dll_setvbuf(FILE *stream, char *buf, int type, size_t size); - struct mntent *dll_getmntent(FILE *fp); - --void *__wrap_dlopen(const char *filename, int flag) -+__attribute__((used)) void *__wrap_dlopen(const char *filename, int flag) - { - #if defined(TARGET_ANDROID) - return dll_dlopen(filename, flag); -@@ -124,213 +124,213 @@ void *__wrap_dlopen(const char *filename, int flag) - #endif - } - --FILE *__wrap_popen(const char *command, const char *mode) -+__attribute__((used)) FILE *__wrap_popen(const char *command, const char *mode) - { - return dll_popen(command, mode); - } - --void* __wrap_calloc( size_t num, size_t size ) -+__attribute__((used)) void* __wrap_calloc( size_t num, size_t size ) - { - return dllcalloc(num, size); - } - --void* __wrap_malloc(size_t size) -+__attribute__((used)) void* __wrap_malloc(size_t size) - { - return dllmalloc(size); - } - --void* __wrap_realloc( void *memblock, size_t size ) -+__attribute__((used)) void* __wrap_realloc( void *memblock, size_t size ) - { - return dllrealloc(memblock, size); - } - --void __wrap_free( void* pPtr ) -+__attribute__((used)) void __wrap_free( void* pPtr ) - { - dllfree(pPtr); - } - --int __wrap_open(const char *file, int oflag, ...) -+__attribute__((used)) int __wrap_open(const char *file, int oflag, ...) - { - return dll_open(file, oflag); - } - --int __wrap_open64(const char *file, int oflag, ...) -+__attribute__((used)) int __wrap_open64(const char *file, int oflag, ...) - { - return dll_open(file, oflag); - } - --int __wrap_close(int fd) -+__attribute__((used)) int __wrap_close(int fd) - { - return dll_close(fd); - } - --ssize_t __wrap_write(int fd, const void *buf, size_t count) -+__attribute__((used)) ssize_t __wrap_write(int fd, const void *buf, size_t count) - { - return dll_write(fd, buf, count); - } - --ssize_t __wrap_read(int fd, void *buf, size_t count) -+__attribute__((used)) ssize_t __wrap_read(int fd, void *buf, size_t count) - { - return dll_read(fd, buf, count); - } - --__off_t __wrap_lseek(int fildes, __off_t offset, int whence) -+__attribute__((used)) __off_t __wrap_lseek(int fildes, __off_t offset, int whence) - { - return dll_lseek(fildes, offset, whence); - } - --__off64_t __wrap_lseek64(int fildes, __off64_t offset, int whence) -+__attribute__((used)) __off64_t __wrap_lseek64(int fildes, __off64_t offset, int whence) - { - __off64_t seekRes = dll_lseeki64(fildes, offset, whence); - return seekRes; - } - --int __wrap_fclose(FILE *fp) -+__attribute__((used)) int __wrap_fclose(FILE *fp) - { - return dll_fclose(fp); - } - --int __wrap_ferror(FILE *stream) -+__attribute__((used)) int __wrap_ferror(FILE *stream) - { - return dll_ferror(stream); - } - --void __wrap_clearerr(FILE *stream) -+__attribute__((used)) void __wrap_clearerr(FILE *stream) - { - return dll_clearerr(stream); - } - --int __wrap_feof(FILE *stream) -+__attribute__((used)) int __wrap_feof(FILE *stream) - { - return dll_feof(stream); - } - --int __wrap_fileno(FILE *stream) -+__attribute__((used)) int __wrap_fileno(FILE *stream) - { - return dll_fileno(stream); - } - --FILE *__wrap_fopen(const char *path, const char *mode) -+__attribute__((used)) FILE *__wrap_fopen(const char *path, const char *mode) - { - return dll_fopen(path, mode); - } - --FILE *__wrap_fopen64(const char *path, const char *mode) -+__attribute__((used)) FILE *__wrap_fopen64(const char *path, const char *mode) - { - return dll_fopen(path, mode); - } - --FILE *__wrap_fdopen(int fildes, const char *mode) -+__attribute__((used)) FILE *__wrap_fdopen(int fildes, const char *mode) - { - return dll_fdopen(fildes, mode); - } - --FILE *__wrap_freopen(const char *path, const char *mode, FILE *stream) -+__attribute__((used)) FILE *__wrap_freopen(const char *path, const char *mode, FILE *stream) - { - return dll_freopen(path, mode, stream); - } - --size_t __wrap_fread(void *ptr, size_t size, size_t nmemb, FILE *stream) -+__attribute__((used)) size_t __wrap_fread(void *ptr, size_t size, size_t nmemb, FILE *stream) - { - return dll_fread(ptr, size, nmemb, stream); - } - --size_t __wrap_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream) -+__attribute__((used)) size_t __wrap_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream) - { - return dll_fwrite(ptr, size, nmemb, stream); - } - --int __wrap_fflush(FILE *stream) -+__attribute__((used)) int __wrap_fflush(FILE *stream) - { - return dll_fflush(stream); - } - --int __wrap_fputc(int c, FILE *stream) -+__attribute__((used)) int __wrap_fputc(int c, FILE *stream) - { - return dll_fputc(c, stream); - } - --int __wrap_fputs(const char *s, FILE *stream) -+__attribute__((used)) int __wrap_fputs(const char *s, FILE *stream) - { - return dll_fputs(s, stream); - } - --int __wrap__IO_putc(int c, FILE *stream) -+__attribute__((used)) int __wrap__IO_putc(int c, FILE *stream) - { - return dll_putc(c, stream); - } - --int __wrap_fseek(FILE *stream, long offset, int whence) -+__attribute__((used)) int __wrap_fseek(FILE *stream, long offset, int whence) - { - return dll_fseek(stream, offset, whence); - } - --int __wrap_fseeko64(FILE *stream, off64_t offset, int whence) -+__attribute__((used)) int __wrap_fseeko64(FILE *stream, off64_t offset, int whence) - { - return dll_fseek64(stream, offset, whence); - } - --long __wrap_ftell(FILE *stream) -+__attribute__((used)) long __wrap_ftell(FILE *stream) - { - return dll_ftell(stream); - } - --off64_t __wrap_ftello64(FILE *stream) -+__attribute__((used)) off64_t __wrap_ftello64(FILE *stream) - { - return dll_ftell64(stream); - } - --void __wrap_rewind(FILE *stream) -+__attribute__((used)) void __wrap_rewind(FILE *stream) - { - dll_rewind(stream); - } - --int __wrap_fgetpos(FILE *stream, fpos_t *pos) -+__attribute__((used)) int __wrap_fgetpos(FILE *stream, fpos_t *pos) - { - return dll_fgetpos(stream, pos); - } - --int __wrap_fgetpos64(FILE *stream, fpos64_t *pos) -+__attribute__((used)) int __wrap_fgetpos64(FILE *stream, fpos64_t *pos) - { - return dll_fgetpos64(stream, pos); - } - --int __wrap_fsetpos(FILE *stream, fpos_t *pos) -+__attribute__((used)) int __wrap_fsetpos(FILE *stream, fpos_t *pos) - { - return dll_fsetpos(stream, pos); - } - --int __wrap_fsetpos64(FILE *stream, fpos64_t *pos) -+__attribute__((used)) int __wrap_fsetpos64(FILE *stream, fpos64_t *pos) - { - return dll_fsetpos64(stream, pos); - } - --DIR * __wrap_opendir(const char *name) -+__attribute__((used)) DIR * __wrap_opendir(const char *name) - { - return dll_opendir(name); - } - --struct dirent * __wrap_readdir(DIR* dirp) -+__attribute__((used)) struct dirent * __wrap_readdir(DIR* dirp) - { - return dll_readdir(dirp); - } - --struct dirent * __wrap_readdir64(DIR* dirp) -+__attribute__((used)) struct dirent * __wrap_readdir64(DIR* dirp) - { - return dll_readdir(dirp); - } - --int __wrap_closedir(DIR* dirp) -+__attribute__((used)) int __wrap_closedir(DIR* dirp) - { - return dll_closedir(dirp); - } - --void __wrap_rewinddir(DIR* dirp) -+__attribute__((used)) void __wrap_rewinddir(DIR* dirp) - { - dll_rewinddir(dirp); - } - --int __wrap_fprintf(FILE *stream, const char *format, ...) -+__attribute__((used)) int __wrap_fprintf(FILE *stream, const char *format, ...) - { - int res; - va_list va; -@@ -340,12 +340,12 @@ int __wrap_fprintf(FILE *stream, const char *format, ...) - return res; - } - --int __wrap_vfprintf(FILE *stream, const char *format, va_list ap) -+__attribute__((used)) int __wrap_vfprintf(FILE *stream, const char *format, va_list ap) - { - return dll_vfprintf(stream, format, ap); - } - --int __wrap_printf(const char *format, ...) -+__attribute__((used)) int __wrap_printf(const char *format, ...) - { - int res; - va_list va; -@@ -355,42 +355,42 @@ int __wrap_printf(const char *format, ...) - return res; - } - --int __wrap_fgetc(FILE *stream) -+__attribute__((used)) int __wrap_fgetc(FILE *stream) - { - return dll_fgetc(stream); - } - --char *__wrap_fgets(char *s, int size, FILE *stream) -+__attribute__((used)) char *__wrap_fgets(char *s, int size, FILE *stream) - { - return dll_fgets(s, size, stream); - } - --int __wrap__IO_getc(FILE *stream) -+__attribute__((used)) int __wrap__IO_getc(FILE *stream) - { - return dll_getc(stream); - } - --int __wrap__IO_getc_unlocked(FILE *stream) -+__attribute__((used)) int __wrap__IO_getc_unlocked(FILE *stream) - { - return dll_getc(stream); - } - --int __wrap_getc_unlocked(FILE *stream) -+__attribute__((used)) int __wrap_getc_unlocked(FILE *stream) - { - return dll_getc(stream); - } - --int __wrap_ungetc(int c, FILE *stream) -+__attribute__((used)) int __wrap_ungetc(int c, FILE *stream) - { - return dll_ungetc(c, stream); - } - --int __wrap_getc(FILE *stream) -+__attribute__((used)) int __wrap_getc(FILE *stream) - { - return dll_getc(stream); - } - --int __wrap_ioctl(int d, unsigned long int request, ...) -+__attribute__((used)) int __wrap_ioctl(int d, unsigned long int request, ...) - { - int res; - va_list va; -@@ -400,52 +400,52 @@ int __wrap_ioctl(int d, unsigned long int request, ...) - return res; - } - --int __wrap__stat(const char *path, struct _stat *buffer) -+__attribute__((used)) int __wrap__stat(const char *path, struct _stat *buffer) - { - return dll_stat(path, buffer); - } - --int __wrap___xstat64(int __ver, const char *__filename, struct stat64 *__stat_buf) -+__attribute__((used)) int __wrap___xstat64(int __ver, const char *__filename, struct stat64 *__stat_buf) - { - return dll_stat64(__filename, __stat_buf); - } - --int __wrap___lxstat64(int __ver, const char *__filename, struct stat64 *__stat_buf) -+__attribute__((used)) int __wrap___lxstat64(int __ver, const char *__filename, struct stat64 *__stat_buf) - { - return dll_stat64(__filename, __stat_buf); - } - --void __wrap_flockfile(FILE *file) -+__attribute__((used)) void __wrap_flockfile(FILE *file) - { - dll_flockfile(file); - } - --int __wrap_ftrylockfile(FILE *file) -+__attribute__((used)) int __wrap_ftrylockfile(FILE *file) - { - return dll_ftrylockfile(file); - } - --void __wrap_funlockfile(FILE *file) -+__attribute__((used)) void __wrap_funlockfile(FILE *file) - { - dll_funlockfile(file); - } - --int __wrap___fxstat64(int ver, int fd, struct stat64 *buf) -+__attribute__((used)) int __wrap___fxstat64(int ver, int fd, struct stat64 *buf) - { - return dll_fstat64(fd, buf); - } - --int __wrap_fstat(int fd, struct _stat *buf) -+__attribute__((used)) int __wrap_fstat(int fd, struct _stat *buf) - { - return dll_fstat(fd, buf); - } - --int __wrap_setvbuf(FILE *stream, char *buf, int type, size_t size) -+__attribute__((used)) int __wrap_setvbuf(FILE *stream, char *buf, int type, size_t size) - { - return dll_setvbuf(stream, buf, type, size); - } - --struct mntent *__wrap_getmntent(FILE *fp) -+__attribute__((used)) struct mntent *__wrap_getmntent(FILE *fp) - { - #ifdef _LINUX - return dll_getmntent(fp); -@@ -459,12 +459,12 @@ struct mntent *__wrap_getmntent(FILE *fp) - // thing to actually call our wrapped functions. - #if _FORTIFY_SOURCE > 1 - --size_t __wrap___fread_chk(void * ptr, size_t ptrlen, size_t size, size_t n, FILE * stream) -+__attribute__((used)) size_t __wrap___fread_chk(void * ptr, size_t ptrlen, size_t size, size_t n, FILE * stream) - { - return dll_fread(ptr, size, n, stream); - } - --int __wrap___printf_chk(int flag, const char *format, ...) -+__attribute__((used)) int __wrap___printf_chk(int flag, const char *format, ...) - { - int res; - va_list va; -@@ -474,12 +474,12 @@ int __wrap___printf_chk(int flag, const char *format, ...) - return res; - } - --int __wrap___vfprintf_chk(FILE* stream, int flag, const char *format, _G_va_list ap) -+__attribute__((used)) int __wrap___vfprintf_chk(FILE* stream, int flag, const char *format, _G_va_list ap) - { - return dll_vfprintf(stream, format, ap); - } - --int __wrap___fprintf_chk(FILE * stream, int flag, const char *format, ...) -+__attribute__((used)) int __wrap___fprintf_chk(FILE * stream, int flag, const char *format, ...) - { - int res; - va_list va; -@@ -489,12 +489,12 @@ int __wrap___fprintf_chk(FILE * stream, int flag, const char *format, ...) - return res; - } - --char *__wrap___fgets_chk(char *s, size_t size, int n, FILE *stream) -+__attribute__((used)) char *__wrap___fgets_chk(char *s, size_t size, int n, FILE *stream) - { - return dll_fgets(s, n, stream); - } - --size_t __wrap___read_chk(int fd, void *buf, size_t nbytes, size_t buflen) -+__attribute__((used)) size_t __wrap___read_chk(int fd, void *buf, size_t nbytes, size_t buflen) - { - return dll_read(fd, buf, nbytes); - } --- -1.8.1.6 - diff --git a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.16-XB822abd9.patch b/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.16-XB822abd9.patch deleted file mode 100644 index 0fd16ed008..0000000000 --- a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.16-XB822abd9.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 822abd913ab38a742f710173f551bac22477eebd Mon Sep 17 00:00:00 2001 -From: Lee Pollock -Date: Wed, 8 May 2013 18:04:41 +0100 -Subject: [PATCH] [Fix] Re-get details from nfo file after advancing to first - episodedetails - ---- - xbmc/NfoFile.cpp | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/xbmc/NfoFile.cpp b/xbmc/NfoFile.cpp -index 973e4d0..791c92e 100644 ---- a/xbmc/NfoFile.cpp -+++ b/xbmc/NfoFile.cpp -@@ -71,6 +71,7 @@ - { - int infos=0; - m_headofdoc = strstr(m_headofdoc," -Date: Sat, 11 May 2013 06:03:55 +0800 -Subject: [PATCH] Fix color index overflow by reuse existed color in the - vector. Fix #14293 - ---- - xbmc/guilib/GUITextLayout.cpp | 19 ++++++++++++++++--- - 1 file changed, 16 insertions(+), 3 deletions(-) - -diff --git a/xbmc/guilib/GUITextLayout.cpp b/xbmc/guilib/GUITextLayout.cpp -index 33c8c48..8dc8b45 100644 ---- a/xbmc/guilib/GUITextLayout.cpp -+++ b/xbmc/guilib/GUITextLayout.cpp -@@ -401,9 +401,22 @@ void CGUITextLayout::ParseText(const CStdStringW &text, uint32_t defaultStyle, v - { // color - size_t finish = text.Find(L']', pos + 5); - if (on && finish != CStdString::npos && (size_t)text.Find(L"[/COLOR]",finish) != CStdString::npos) -- { // create new color -- newColor = colors.size(); -- colors.push_back(g_colorManager.GetColor(text.Mid(pos + 5, finish - pos - 5))); -+ { -+ color_t color = g_colorManager.GetColor(text.Mid(pos + 5, finish - pos - 5)); -+ vecColors::const_iterator it = std::find(colors.begin(), colors.end(), color); -+ if (it == colors.end()) -+ { // create new color -+ if (colors.size() <= 0xFF) -+ { -+ newColor = colors.size(); -+ colors.push_back(color); -+ } -+ else // we have only 8 bits for color index, fallback to first color if reach max. -+ newColor = 0; -+ } -+ else -+ // reuse existing color -+ newColor = it - colors.begin(); - colorStack.push(newColor); - } - else if (!on && finish == pos + 5 && colorStack.size() > 1) --- -1.8.1.6 - diff --git a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.17.02-XBef82d9b.patch b/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.17.02-XBef82d9b.patch deleted file mode 100644 index 8551ec48c0..0000000000 --- a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.17.02-XBef82d9b.patch +++ /dev/null @@ -1,41 +0,0 @@ -From ef82d9b6177a0576548e8e9cdc0eb17cf10524af Mon Sep 17 00:00:00 2001 -From: ulion -Date: Thu, 9 May 2013 13:11:59 +0800 -Subject: [PATCH] [OSX] Fix always on top after restore from fullscreen. - ---- - xbmc/windowing/osx/WinSystemOSX.mm | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/xbmc/windowing/osx/WinSystemOSX.mm b/xbmc/windowing/osx/WinSystemOSX.mm -index e45693c..cb86e0a 100644 ---- a/xbmc/windowing/osx/WinSystemOSX.mm -+++ b/xbmc/windowing/osx/WinSystemOSX.mm -@@ -710,6 +710,7 @@ static void DisplayReconfigured(CGDirectDisplayID display, - static NSView* last_view = NULL; - static NSSize last_view_size; - static NSPoint last_view_origin; -+ static NSInteger last_window_level = NSNormalWindowLevel; - bool was_fullscreen = m_bFullScreen; - static int lastDisplayNr = res.iScreen; - NSOpenGLContext* cur_context; -@@ -779,6 +780,7 @@ static void DisplayReconfigured(CGDirectDisplayID display, - last_view_origin = [last_view frame].origin; - last_window_screen = [[last_view window] screen]; - last_window_origin = [[last_view window] frame].origin; -+ last_window_level = [[last_view window] level]; - - if (CSettings::Get().GetBool("videoscreen.fakefullscreen")) - { -@@ -891,7 +893,7 @@ static void DisplayReconfigured(CGDirectDisplayID display, - if (CSettings::Get().GetBool("videoscreen.fakefullscreen")) - { - // restore the windowed window level -- [[last_view window] setLevel:NSNormalWindowLevel]; -+ [[last_view window] setLevel:last_window_level]; - - // Get rid of the new window we created. - if (windowedFullScreenwindow != NULL) --- -1.8.1.6 - diff --git a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.17.03-XB07c1ed5.patch b/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.17.03-XB07c1ed5.patch deleted file mode 100644 index 99406bd7b8..0000000000 --- a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.17.03-XB07c1ed5.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 07c1ed5752225f44a55ed9099c5cbfd34bff0906 Mon Sep 17 00:00:00 2001 -From: Ulion -Date: Mon, 29 Apr 2013 06:09:14 +0800 -Subject: [PATCH] Fix undefined reference caused by wrong detection of gcc - builtin atomic functions. - ---- - configure.in | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/configure.in b/configure.in -index f0e4905..95f12da 100644 ---- a/configure.in -+++ b/configure.in -@@ -850,7 +850,7 @@ AC_CHECK_SIZEOF([size_t]) - - # Check for intrinsics - AC_MSG_CHECKING([for __sync_add_and_fetch(temp, 1)]) --AC_TRY_COMPILE([],[long* temp=0; __sync_add_and_fetch(temp, 1);], -+AC_TRY_LINK([],[long* temp=0; long ret=__sync_add_and_fetch(temp, 1);], - [have_builtin_sync_add_and_fetch=yes], - [have_builtin_sync_add_and_fetch=no]) - AC_MSG_RESULT($have_builtin_sync_add_and_fetch) -@@ -860,7 +860,7 @@ if test "x$have_builtin_sync_add_and_fetch" = "xyes"; then - fi - - AC_MSG_CHECKING([for __sync_sub_and_fetch(temp, 1)]) --AC_TRY_COMPILE([],[long* temp=0; __sync_sub_and_fetch(temp, 1);], -+AC_TRY_LINK([],[long* temp=0; long ret=__sync_sub_and_fetch(temp, 1);], - [have_builtin_sync_sub_and_fetch=yes], - [have_builtin_sync_sub_and_fetch=no]) - AC_MSG_RESULT($have_builtin_sync_sub_and_fetch) -@@ -870,7 +870,7 @@ if test "x$have_builtin_sync_sub_and_fetch" = "xyes"; then - fi - - AC_MSG_CHECKING([for __sync_val_compare_and_swap(temp, 1, 1)]) --AC_TRY_COMPILE([],[long *temp = 0; __sync_val_compare_and_swap(temp, 1, 1);], -+AC_TRY_LINK([],[long *temp = 0; long ret=__sync_val_compare_and_swap(temp, 1, 1);], - [have_builtin_sync_val_compare_and_swap=yes], - [have_builtin_sync_val_compare_and_swap=no]) - AC_MSG_RESULT($have_builtin_sync_val_compare_and_swap) --- -1.8.1.6 - diff --git a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.17.04-XB01480bb.patch b/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.17.04-XB01480bb.patch deleted file mode 100644 index 0bf2742f28..0000000000 --- a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.17.04-XB01480bb.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 01480bb7ab2022616c938d2fd222cfdafa243b67 Mon Sep 17 00:00:00 2001 -From: ulion -Date: Wed, 10 Apr 2013 19:54:54 +0800 -Subject: [PATCH] avoid detect folder.jpg under 'add' item. - ---- - xbmc/pictures/PictureThumbLoader.cpp | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/xbmc/pictures/PictureThumbLoader.cpp b/xbmc/pictures/PictureThumbLoader.cpp -index ddff86c..61c624d 100644 ---- a/xbmc/pictures/PictureThumbLoader.cpp -+++ b/xbmc/pictures/PictureThumbLoader.cpp -@@ -132,7 +132,8 @@ void CPictureThumbLoader::ProcessFoldersAndArchives(CFileItem *pItem) - return; - } - } -- if ((pItem->m_bIsFolder || pItem->IsCBR() || pItem->IsCBZ()) && !pItem->m_bIsShareOrDrive && !pItem->IsParentFolder()) -+ if ((pItem->m_bIsFolder || pItem->IsCBR() || pItem->IsCBZ()) && !pItem->m_bIsShareOrDrive -+ && !pItem->IsParentFolder() && !pItem->GetPath().Equals("add")) - { - // first check for a folder.jpg - CStdString thumb = "folder.jpg"; --- -1.8.1.6 - diff --git a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.17.05-XBff283b0.patch b/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.17.05-XBff283b0.patch deleted file mode 100644 index 21bbc0d531..0000000000 --- a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.17.05-XBff283b0.patch +++ /dev/null @@ -1,29 +0,0 @@ -From ff283b0861afd35410d20c52fee8ba0542e91f8a Mon Sep 17 00:00:00 2001 -From: ulion -Date: Sun, 24 Mar 2013 13:19:39 +0800 -Subject: [PATCH] Check exists before listing dir, to avoid produce error log, - fix #14210 - ---- - xbmc/video/VideoInfoScanner.cpp | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/xbmc/video/VideoInfoScanner.cpp b/xbmc/video/VideoInfoScanner.cpp -index 170b5a9..fbe7913 100644 ---- a/xbmc/video/VideoInfoScanner.cpp -+++ b/xbmc/video/VideoInfoScanner.cpp -@@ -1771,7 +1771,10 @@ - void CVideoInfoScanner::FetchActorThumbs(vector& actors, const CStdString& strPath) - { - CFileItemList items; -- CDirectory::GetDirectory(URIUtils::AddFileToFolder(strPath, ".actors"), items, ".png|.jpg|.tbn", DIR_FLAG_NO_FILE_DIRS | DIR_FLAG_NO_FILE_INFO); -+ CStdString actorsDir = URIUtils::AddFileToFolder(strPath, ".actors"); -+ if (CDirectory::Exists(actorsDir)) -+ CDirectory::GetDirectory(actorsDir, items, ".png|.jpg|.tbn", DIR_FLAG_NO_FILE_DIRS | -+ DIR_FLAG_NO_FILE_INFO); - for (vector::iterator i = actors.begin(); i != actors.end(); ++i) - { - if (i->thumb.IsEmpty()) --- -1.8.1.6 - diff --git a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.17.06-XB937e565.patch b/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.17.06-XB937e565.patch deleted file mode 100644 index 296012c069..0000000000 --- a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.17.06-XB937e565.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 937e565410c19c0c3c3651c467c919a69cf027a2 Mon Sep 17 00:00:00 2001 -From: ulion -Date: Mon, 13 May 2013 08:41:14 +0800 -Subject: [PATCH] Fix color tag didn't hide bug introduced by PR2725. - ---- - xbmc/guilib/GUITextLayout.cpp | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/xbmc/guilib/GUITextLayout.cpp b/xbmc/guilib/GUITextLayout.cpp -index 8dc8b45..49c0459 100644 ---- a/xbmc/guilib/GUITextLayout.cpp -+++ b/xbmc/guilib/GUITextLayout.cpp -@@ -354,6 +354,7 @@ void CGUITextLayout::ParseText(const CStdStringW &text, uint32_t defaultStyle, v - { - uint32_t newStyle = 0; - color_t newColor = currentColor; -+ bool colorTagChange = false; - bool newLine = false; - // have a [ - check if it's an ON or OFF switch - bool on(true); -@@ -418,17 +419,19 @@ void CGUITextLayout::ParseText(const CStdStringW &text, uint32_t defaultStyle, v - // reuse existing color - newColor = it - colors.begin(); - colorStack.push(newColor); -+ colorTagChange = true; - } - else if (!on && finish == pos + 5 && colorStack.size() > 1) - { // revert to previous color - colorStack.pop(); - newColor = colorStack.top(); -+ colorTagChange = true; - } - if (finish != CStdString::npos) - pos = finish + 1; - } - -- if (newStyle || newColor != currentColor || newLine) -+ if (newStyle || colorTagChange || newLine) - { // we have a new style or a new color, so format up the previous segment - CStdStringW subText = text.Mid(startPos, endPos - startPos); - if (currentStyle & FONT_STYLE_UPPERCASE) --- -1.8.1.6 - diff --git a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.18-2758.patch.bk b/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.18-2758.patch.bk deleted file mode 100644 index fa0cd1d77b..0000000000 --- a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.18-2758.patch.bk +++ /dev/null @@ -1,28 +0,0 @@ -From 2441ddbbd638fb8b81c0eed46a78ba1a1b228413 Mon Sep 17 00:00:00 2001 -From: Rainer Hochecker -Date: Fri, 17 May 2013 09:19:16 +0200 -Subject: [PATCH] backport some constructor initializations from - 92e8bc4a4361d730abac9ad3080cd6923e9d551a - ---- - xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp -index f70a4f9..5af76d0 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp -@@ -147,6 +147,10 @@ - dl_vdp_device_create_x11 = NULL; - dl_vdp_get_proc_address = NULL; - dl_vdp_preemption_callback_register = NULL; -+ past[0] = NULL; -+ past[1] = NULL; -+ current = NULL; -+ future = NULL; - } - - bool CVDPAU::Open(AVCodecContext* avctx, const enum PixelFormat, unsigned int surfaces) --- -1.8.1.6 - diff --git a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.19-PR2761.patch b/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.19-PR2761.patch deleted file mode 100644 index 3309abec04..0000000000 --- a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.19-PR2761.patch +++ /dev/null @@ -1,85 +0,0 @@ -From 6cba369a0f54231b145ce6b07a42cd1cd32261ec Mon Sep 17 00:00:00 2001 -From: ulion -Date: Sun, 21 Apr 2013 04:43:30 +0800 -Subject: [PATCH] Fixed: do not send Range request header when encounter error. - ---- - xbmc/filesystem/CurlFile.cpp | 20 +++++++++++++++++++- - xbmc/filesystem/CurlFile.h | 1 + - 2 files changed, 20 insertions(+), 1 deletion(-) - -diff --git a/xbmc/filesystem/CurlFile.cpp b/xbmc/filesystem/CurlFile.cpp -index ff8250c..8667fc6 100644 ---- a/xbmc/filesystem/CurlFile.cpp -+++ b/xbmc/filesystem/CurlFile.cpp -@@ -197,6 +197,7 @@ size_t CCurlFile::CReadState::WriteCallback(char *buffer, size_t size, size_t ni - m_bufferSize = 0; - m_cancelled = false; - m_bFirstLoop = true; -+ m_sendRange = true; - m_headerdone = false; - } - -@@ -255,8 +256,13 @@ void CCurlFile::CReadState::SetResume(void) - * request header. If we don't the server may provide different content causing seeking to fail. - * This only affects HTTP-like items, for FTP it's a null operation. - */ -- if (m_filePos == 0) -+ if (m_sendRange && m_filePos == 0) - g_curlInterface.easy_setopt(m_easyHandle, CURLOPT_RANGE, "0-"); -+ else -+ { -+ g_curlInterface.easy_setopt(m_easyHandle, CURLOPT_RANGE, NULL); -+ m_sendRange = false; -+ } - - g_curlInterface.easy_setopt(m_easyHandle, CURLOPT_RESUME_FROM_LARGE, m_filePos); - } -@@ -866,6 +872,7 @@ bool CCurlFile::Open(const CURL& url) - // setup common curl options - SetCommonOptions(m_state); - SetRequestHeaders(m_state); -+ m_state->m_sendRange = m_seekable; - - m_httpresponse = m_state->Connect(m_bufferSize); - if( m_httpresponse < 0 || m_httpresponse >= 400) -@@ -1046,6 +1053,7 @@ int64_t CCurlFile::Seek(int64_t iFilePosition, int iWhence) - SetRequestHeaders(m_state); - - m_state->m_filePos = nextPos; -+ m_state->m_sendRange = true; - if (oldstate) - m_state->m_fileSize = oldstate->m_fileSize; - -@@ -1287,6 +1295,16 @@ bool CCurlFile::CReadState::FillBuffer(unsigned int want) - msg->data.result == CURLE_RECV_ERROR) && - !m_bFirstLoop) - CURLresult = msg->data.result; -+ else if ( (msg->data.result == CURLE_HTTP_RANGE_ERROR || -+ msg->data.result == CURLE_HTTP_RETURNED_ERROR) && -+ m_bFirstLoop && -+ m_filePos == 0 && -+ m_sendRange) -+ { -+ // If server returns a range or http error, retry with range disabled -+ CURLresult = msg->data.result; -+ m_sendRange = false; -+ } - else - return false; - } -diff --git a/xbmc/filesystem/CurlFile.h b/xbmc/filesystem/CurlFile.h -index d25fb58..a48207a 100644 ---- a/xbmc/filesystem/CurlFile.h -+++ b/xbmc/filesystem/CurlFile.h -@@ -101,6 +101,7 @@ - int64_t m_fileSize; - int64_t m_filePos; - bool m_bFirstLoop; -+ bool m_sendRange; - - /* returned http header */ - CHttpHeader m_httpheader; --- -1.8.1.6 - diff --git a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.20-XB812a890.patch b/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.20-XB812a890.patch deleted file mode 100644 index 7990929a24..0000000000 --- a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.20-XB812a890.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 812a89032539d7d40d8d27b10337c1dd2ccca29b Mon Sep 17 00:00:00 2001 -From: montellese -Date: Sun, 19 May 2013 15:46:05 +0200 -Subject: [PATCH] CGUISliderControl: only switch between selectors on - if there are more than one - ---- - xbmc/guilib/GUISliderControl.cpp | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/xbmc/guilib/GUISliderControl.cpp b/xbmc/guilib/GUISliderControl.cpp -index 9de3413..5cce7a8 100644 ---- a/xbmc/guilib/GUISliderControl.cpp -+++ b/xbmc/guilib/GUISliderControl.cpp -@@ -174,7 +174,8 @@ bool CGUISliderControl::OnAction(const CAction &action) - - case ACTION_SELECT_ITEM: - // switch between the two sliders -- SwitchRangeSelector(); -+ if (m_rangeSelection) -+ SwitchRangeSelector(); - return true; - - default: --- -1.8.1.6 - diff --git a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.21-XB2e18d81.patch b/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.21-XB2e18d81.patch deleted file mode 100644 index e2f0da65a5..0000000000 --- a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.21-XB2e18d81.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 2e18d8108e29d58199616d7d6457026ef736cf47 Mon Sep 17 00:00:00 2001 -From: Rainer Hochecker -Date: Fri, 17 May 2013 09:07:27 +0200 -Subject: [PATCH] pvr: fix channel switch for addons using other stream - ---- - xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamPVRManager.cpp | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamPVRManager.cpp b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamPVRManager.cpp -index aa3298b..397ea5d 100644 ---- a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamPVRManager.cpp -+++ b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamPVRManager.cpp -@@ -315,8 +315,9 @@ bool CDVDInputStreamPVRManager::UpdateItem(CFileItem& item) - - m_eof = IsEOF(); - -- if (m_pOtherStream) -- return m_pOtherStream->NextStream(); -+ CDVDInputStream::ENextStream next; -+ if (m_pOtherStream && ((next = m_pOtherStream->NextStream()) != NEXTSTREAM_NONE)) -+ return next; - else if(m_pFile->SkipNext()) - { - if (m_eof) --- -1.8.1.6 - diff --git a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.22-XB3e58f24.patch b/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.22-XB3e58f24.patch deleted file mode 100644 index 90ad7077c7..0000000000 --- a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.22-XB3e58f24.patch +++ /dev/null @@ -1,300 +0,0 @@ -diff -Naur xbmc-12.2.0/xbmc/cores/omxplayer/OMXPlayerAudio.cpp xbmc-12.2.0.patch/xbmc/cores/omxplayer/OMXPlayerAudio.cpp ---- xbmc-12.2.0/xbmc/cores/omxplayer/OMXPlayerAudio.cpp 2013-05-02 17:00:07.000000000 +0200 -+++ xbmc-12.2.0.patch/xbmc/cores/omxplayer/OMXPlayerAudio.cpp 2013-06-12 23:56:33.134924673 +0200 -@@ -76,7 +76,6 @@ - m_buffer_empty = false; - m_nChannels = 0; - m_DecoderOpen = false; -- m_freq = CurrentHostFrequency(); - m_bad_state = false; - m_hints_current.Clear(); - -@@ -135,20 +134,11 @@ - - m_speed = DVD_PLAYSPEED_NORMAL; - m_audioClock = 0; -- m_error = 0; -- m_errorbuff = 0; -- m_errorcount = 0; -- m_integral = 0; -- m_skipdupcount = 0; -- m_prevskipped = false; -- m_syncclock = true; - m_hw_decode = false; -- m_errortime = CurrentHostCounter(); - m_silence = false; - m_started = false; - m_flush = false; - m_nChannels = 0; -- m_synctype = SYNC_DISCON; - m_stalled = m_messageQueue.GetPacketCount(CDVDMsg::DEMUXER_PACKET) == 0; - m_use_passthrough = (g_guiSettings.GetInt("audiooutput.mode") == AUDIO_HDMI) ? true : false ; - m_use_hw_decode = g_advancedSettings.m_omxHWAudioDecode; -@@ -190,110 +180,6 @@ - CLog::Log(LOGNOTICE, "thread end: OMXPlayerAudio::OnExit()"); - } - -- -- --void OMXPlayerAudio::HandleSyncError(double duration) --{ -- double clock = m_av_clock->GetClock(); -- double error = m_audioClock - clock; -- int64_t now; -- -- if( fabs(error) > DVD_MSEC_TO_TIME(100) || m_syncclock ) -- { -- m_av_clock->Discontinuity(clock+error); -- /* -- if(m_speed == DVD_PLAYSPEED_NORMAL) -- CLog::Log(LOGDEBUG, "OMXPlayerAudio:: Discontinuity - was:%f, should be:%f, error:%f\n", clock, clock+error, error); -- */ -- -- m_errorbuff = 0; -- m_errorcount = 0; -- m_skipdupcount = 0; -- m_error = 0; -- m_syncclock = false; -- m_errortime = CurrentHostCounter(); -- -- return; -- } -- -- if (m_speed != DVD_PLAYSPEED_NORMAL) -- { -- m_errorbuff = 0; -- m_errorcount = 0; -- m_integral = 0; -- m_skipdupcount = 0; -- m_error = 0; -- m_errortime = CurrentHostCounter(); -- return; -- } -- -- //check if measured error for 1 second -- now = CurrentHostCounter(); -- if ((now - m_errortime) >= m_freq) -- { -- m_errortime = now; -- m_error = m_errorbuff / m_errorcount; -- -- m_errorbuff = 0; -- m_errorcount = 0; -- -- if (m_synctype == SYNC_DISCON) -- { -- double limit, error; -- -- if (m_av_clock->GetRefreshRate(&limit) > 0) -- { -- //when the videoreferenceclock is running, the discontinuity limit is one vblank period -- limit *= DVD_TIME_BASE; -- -- //make error a multiple of limit, rounded towards zero, -- //so it won't interfere with the sync methods in CXBMCRenderManager::WaitPresentTime -- if (m_error > 0.0) -- error = limit * floor(m_error / limit); -- else -- error = limit * ceil(m_error / limit); -- } -- else -- { -- limit = DVD_MSEC_TO_TIME(10); -- error = m_error; -- } -- -- /* -- limit = DVD_MSEC_TO_TIME(10); -- error = m_error; -- */ -- -- if (fabs(error) > limit - 0.001) -- { -- m_av_clock->Discontinuity(clock+error); -- /* -- if(m_speed == DVD_PLAYSPEED_NORMAL) -- CLog::Log(LOGDEBUG, "COMXPlayerAudio:: Discontinuity - was:%f, should be:%f, error:%f", clock, clock+error, error); -- */ -- } -- } -- /* -- else if (m_synctype == SYNC_SKIPDUP && m_skipdupcount == 0 && fabs(m_error) > DVD_MSEC_TO_TIME(10)) -- if (m_skipdupcount == 0 && fabs(m_error) > DVD_MSEC_TO_TIME(10)) -- { -- //check how many packets to skip/duplicate -- m_skipdupcount = (int)(m_error / duration); -- //if less than one frame off, see if it's more than two thirds of a frame, so we can get better in sync -- if (m_skipdupcount == 0 && fabs(m_error) > duration / 3 * 2) -- m_skipdupcount = (int)(m_error / (duration / 3 * 2)); -- -- if (m_skipdupcount > 0) -- CLog::Log(LOGDEBUG, "OMXPlayerAudio:: Duplicating %i packet(s) of %.2f ms duration", -- m_skipdupcount, duration / DVD_TIME_BASE * 1000.0); -- else if (m_skipdupcount < 0) -- CLog::Log(LOGDEBUG, "OMXPlayerAudio:: Skipping %i packet(s) of %.2f ms duration ", -- m_skipdupcount * -1, duration / DVD_TIME_BASE * 1000.0); -- } -- */ -- } --} -- - bool OMXPlayerAudio::CodecChange() - { - unsigned int old_bitrate = m_hints.bitrate; -@@ -394,9 +280,6 @@ - int n = (m_nChannels * m_hints.bitspersample * m_hints.samplerate)>>3; - if (n > 0) - m_audioClock += ((double)decoded_size * DVD_TIME_BASE) / n; -- -- if(m_speed == DVD_PLAYSPEED_NORMAL) -- HandleSyncError((((double)decoded_size * DVD_TIME_BASE) / n)); - break; - - } -@@ -430,9 +313,6 @@ - m_omxAudio.AddPackets(pkt->pData, pkt->iSize, m_audioClock, m_audioClock); - } - -- if(m_speed == DVD_PLAYSPEED_NORMAL) -- HandleSyncError(0); -- - m_audioStats.AddSampleBytes(pkt->iSize); - - break; -@@ -525,18 +405,7 @@ - else if (pMsg->IsType(CDVDMsg::GENERAL_RESYNC)) - { //player asked us to set internal clock - CDVDMsgGeneralResync* pMsgGeneralResync = (CDVDMsgGeneralResync*)pMsg; -- -- if (pMsgGeneralResync->m_timestamp != DVD_NOPTS_VALUE) -- m_audioClock = pMsgGeneralResync->m_timestamp; -- -- if (pMsgGeneralResync->m_clock) -- { -- CLog::Log(LOGDEBUG, "COMXPlayerAudio - CDVDMsg::GENERAL_RESYNC(%f, 1)", m_audioClock); -- m_av_clock->Discontinuity(m_audioClock); -- //m_av_clock->OMXUpdateClock(m_audioClock); -- } -- else -- CLog::Log(LOGDEBUG, "COMXPlayerAudio - CDVDMsg::GENERAL_RESYNC(%f, 0)", m_audioClock); -+ CLog::Log(LOGDEBUG, "COMXPlayerAudio - CDVDMsg::GENERAL_RESYNC(%f, %d)", m_audioClock, pMsgGeneralResync->m_clock); - m_flush = false; - } - else if (pMsg->IsType(CDVDMsg::GENERAL_RESET)) -@@ -559,7 +428,6 @@ - m_omxAudio.Flush(); - m_av_clock->OMXReset(false); - m_av_clock->UnLock(); -- m_syncclock = true; - m_stalled = true; - m_started = false; - -@@ -599,10 +467,6 @@ - m_speed = static_cast(pMsg)->m_value; - CLog::Log(LOGDEBUG, "COMXPlayerAudio - CDVDMsg::PLAYER_SETSPEED %d", m_speed); - } -- if (m_speed != DVD_PLAYSPEED_NORMAL) -- { -- m_syncclock = true; -- } - } - else if (pMsg->IsType(CDVDMsg::AUDIO_SILENCE)) - { -diff -Naur xbmc-12.2.0/xbmc/cores/omxplayer/OMXPlayerAudio.h xbmc-12.2.0.patch/xbmc/cores/omxplayer/OMXPlayerAudio.h ---- xbmc-12.2.0/xbmc/cores/omxplayer/OMXPlayerAudio.h 2013-05-02 17:00:08.000000000 +0200 -+++ xbmc-12.2.0.patch/xbmc/cores/omxplayer/OMXPlayerAudio.h 2013-06-12 23:56:33.135924691 +0200 -@@ -60,19 +60,6 @@ - int m_speed; - bool m_silence; - double m_audioClock; -- double m_error; //last average error -- -- int64_t m_errortime; //timestamp of last time we measured -- int64_t m_freq; -- -- void HandleSyncError(double duration); -- double m_errorbuff; //place to store average errors -- int m_errorcount;//number of errors stored -- bool m_syncclock; -- -- double m_integral; //integral correction for resampler -- int m_skipdupcount; //counter for skip/duplicate synctype -- bool m_prevskipped; - - bool m_stalled; - bool m_started; -@@ -82,8 +69,6 @@ - struct timespec m_starttime, m_endtime; - bool m_buffer_empty; - bool m_flush; -- //SYNC_DISCON, SYNC_SKIPDUP, SYNC_RESAMPLE -- int m_synctype; - int m_nChannels; - bool m_DecoderOpen; - -diff -Naur xbmc-12.2.0/xbmc/cores/omxplayer/OMXPlayerVideo.cpp xbmc-12.2.0.patch/xbmc/cores/omxplayer/OMXPlayerVideo.cpp ---- xbmc-12.2.0/xbmc/cores/omxplayer/OMXPlayerVideo.cpp 2013-05-02 17:00:07.000000000 +0200 -+++ xbmc-12.2.0.patch/xbmc/cores/omxplayer/OMXPlayerVideo.cpp 2013-06-13 00:11:56.443044388 +0200 -@@ -89,7 +89,6 @@ - m_iVideoDelay = 0; - m_droptime = 0.0; - m_dropbase = 0.0; -- m_autosync = 1; - m_fForcedAspectRatio = 0.0f; - m_messageQueue.SetMaxDataSize(10 * 1024 * 1024); - m_messageQueue.SetMaxTimeSize(8.0); -@@ -115,7 +114,6 @@ - m_started = false; - m_flush = false; - m_stalled = m_messageQueue.GetPacketCount(CDVDMsg::DEMUXER_PACKET) == 0; -- m_autosync = 1; - m_iSleepEndTime = DVD_NOPTS_VALUE; - // force SetVideoRect to be called initially - m_dst_rect.SetRect(0, 0, 0, 0); -@@ -280,11 +278,6 @@ - iClockSleep = min(iClockSleep, DVD_MSEC_TO_TIME(500)); - iFrameSleep = min(iFrameSleep, DVD_MSEC_TO_TIME(500)); - -- if( m_stalled ) -- iSleepTime = iFrameSleep; -- else -- iSleepTime = iFrameSleep + (iClockSleep - iFrameSleep) / m_autosync; -- - // present the current pts of this frame to user, and include the actual - // presentation delay, to allow him to adjust for it - if( m_stalled ) -@@ -398,22 +391,7 @@ - else if (pMsg->IsType(CDVDMsg::GENERAL_RESYNC)) - { - CDVDMsgGeneralResync* pMsgGeneralResync = (CDVDMsgGeneralResync*)pMsg; -- -- if(pMsgGeneralResync->m_timestamp != DVD_NOPTS_VALUE) -- pts = pMsgGeneralResync->m_timestamp; -- -- double delay = m_FlipTimeStamp - m_av_clock->GetAbsoluteClock(); -- if( delay > frametime ) delay = frametime; -- else if( delay < 0 ) delay = 0; -- -- if(pMsgGeneralResync->m_clock) -- { -- CLog::Log(LOGDEBUG, "COMXPlayerVideo - CDVDMsg::GENERAL_RESYNC(%f, 1)", pts); -- m_av_clock->Discontinuity(pts - delay); -- //m_av_clock->OMXUpdateClock(pts - delay); -- } -- else -- CLog::Log(LOGDEBUG, "COMXPlayerVideo - CDVDMsg::GENERAL_RESYNC(%f, 0)", pts); -+ CLog::Log(LOGDEBUG, "COMXPlayerVideo - CDVDMsg::GENERAL_RESYNC(%f, %d)", pts, pMsgGeneralResync->m_clock); - - pMsgGeneralResync->Release(); - continue; -diff -Naur xbmc-12.2.0/xbmc/cores/omxplayer/OMXPlayerVideo.h xbmc-12.2.0.patch/xbmc/cores/omxplayer/OMXPlayerVideo.h ---- xbmc-12.2.0/xbmc/cores/omxplayer/OMXPlayerVideo.h 2013-05-02 17:00:07.000000000 +0200 -+++ xbmc-12.2.0.patch/xbmc/cores/omxplayer/OMXPlayerVideo.h 2013-06-12 23:57:42.278013434 +0200 -@@ -66,7 +66,6 @@ - std::string m_codecname; - double m_droptime; - double m_dropbase; -- unsigned int m_autosync; - double m_iSubtitleDelay; - bool m_bRenderSubs; - bool m_bAllowFullscreen; diff --git a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.23-PR2861.patch b/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.23-PR2861.patch deleted file mode 100644 index 9b9c5aea7e..0000000000 --- a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.23-PR2861.patch +++ /dev/null @@ -1,26 +0,0 @@ -From aa12d4ae8315ef4b14c01e3595ea984f8c605639 Mon Sep 17 00:00:00 2001 -From: fritsch -Date: Mon, 10 Jun 2013 22:20:13 +0200 -Subject: [PATCH] AE: Workaround (ugly) non existing channel maps in old ffmpeg - (workarounds: #14407) - ---- - xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp -index 985a01c..880b710 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp -@@ -319,6 +319,8 @@ void CDVDAudioCodecFFmpeg::BuildChannelMap() - { - CLog::Log(LOGINFO, "CDVDAudioCodecFFmpeg::GetChannelMap - FFmpeg reported %d channels, but the layout contains %d ignoring", m_pCodecContext->channels, bits); - layout = m_dllAvUtil.av_get_default_channel_layout(m_pCodecContext->channels); -+ while(layout == 0 && m_pCodecContext->channels > 2) -+ layout = m_dllAvUtil.av_get_default_channel_layout(--m_pCodecContext->channels); - } - - m_channelLayout.Reset(); --- -1.8.1.6 - diff --git a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.25-XB21eb522.patch b/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.25-XB21eb522.patch deleted file mode 100644 index 8581ec7d63..0000000000 --- a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.25-XB21eb522.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff -Naur xbmc-12.2.0/lib/libdvd/libdvdread/src/dvd_reader.c xbmc-12.2.0.patch/lib/libdvd/libdvdread/src/dvd_reader.c ---- xbmc-12.2.0/lib/libdvd/libdvdread/src/dvd_reader.c 2013-05-02 17:00:11.000000000 +0200 -+++ xbmc-12.2.0.patch/lib/libdvd/libdvdread/src/dvd_reader.c 2013-06-18 07:08:23.973913805 +0200 -@@ -423,6 +423,9 @@ - /* Also WIN32 does not have symlinks, so we don't need this bit of code. */ - - /* Resolve any symlinks and get the absolut dir name. */ -+#if defined(_XBMC) /* for XBMC, only do symlink resolution for (real) non-xbmc-VFS paths */ -+ if ( path[0] == '/' ) -+#endif // _XBMC - { - char *new_path; - int cdir = open( ".", O_RDONLY ); diff --git a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-995.01-xvba_support-cc55dcb.patch b/packages/mediacenter/xbmc/patches/12.2.0/xbmc-995.01-xvba_support-cc55dcb.patch deleted file mode 100644 index b062ccabd3..0000000000 --- a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-995.01-xvba_support-cc55dcb.patch +++ /dev/null @@ -1,21656 +0,0 @@ -From 665a6540b13fc7d61fb114611926a289b3c33290 Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Mon, 28 May 2012 10:03:31 +0200 -Subject: [PATCH 01/94] VideoRenerers: add buffering - ---- - xbmc/Application.cpp | 3 + - xbmc/cores/IPlayer.h | 2 + - xbmc/cores/VideoRenderers/BaseRenderer.h | 5 +- - xbmc/cores/VideoRenderers/LinuxRendererGL.cpp | 41 ++-- - xbmc/cores/VideoRenderers/LinuxRendererGL.h | 13 +- - xbmc/cores/VideoRenderers/LinuxRendererGLES.cpp | 8 +- - xbmc/cores/VideoRenderers/LinuxRendererGLES.h | 4 +- - xbmc/cores/VideoRenderers/OverlayRenderer.cpp | 24 +- - xbmc/cores/VideoRenderers/OverlayRenderer.h | 9 +- - xbmc/cores/VideoRenderers/RenderManager.cpp | 294 ++++++++++++++++++++---- - xbmc/cores/VideoRenderers/RenderManager.h | 63 ++++- - xbmc/cores/VideoRenderers/WinRenderer.cpp | 8 +- - xbmc/cores/VideoRenderers/WinRenderer.h | 2 +- - xbmc/cores/dvdplayer/DVDPlayer.cpp | 5 + - xbmc/cores/dvdplayer/DVDPlayer.h | 2 + - xbmc/cores/dvdplayer/DVDPlayerVideo.cpp | 34 ++- - 16 files changed, 417 insertions(+), 100 deletions(-) - -diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp -index 17eccbe..2ada954 100644 ---- a/xbmc/Application.cpp -+++ b/xbmc/Application.cpp -@@ -2371,7 +2371,10 @@ void CApplication::Render() - m_lastFrameTime = XbmcThreads::SystemClockMillis(); - - if (flip) -+ { - g_graphicsContext.Flip(dirtyRegions); -+ g_renderManager.NotifyDisplayFlip(); -+ } - CTimeUtils::UpdateFrameTime(flip); - - g_renderManager.UpdateResolution(); -diff --git a/xbmc/cores/IPlayer.h b/xbmc/cores/IPlayer.h -index f2aa227..eb654ec 100644 ---- a/xbmc/cores/IPlayer.h -+++ b/xbmc/cores/IPlayer.h -@@ -229,6 +229,8 @@ class IPlayer - */ - virtual void GetSubtitleCapabilities(std::vector &subCaps) { subCaps.assign(1,IPC_SUBS_ALL); }; - -+ virtual double GetClock(double& absolute, bool interpolated = true) {return 0; }; -+ - protected: - IPlayerCallback& m_callback; - }; -diff --git a/xbmc/cores/VideoRenderers/BaseRenderer.h b/xbmc/cores/VideoRenderers/BaseRenderer.h -index 81d21d8..aa1e4ae 100644 ---- a/xbmc/cores/VideoRenderers/BaseRenderer.h -+++ b/xbmc/cores/VideoRenderers/BaseRenderer.h -@@ -80,10 +80,13 @@ class CBaseRenderer - void GetVideoRect(CRect &source, CRect &dest); - float GetAspectRatio() const; - -- virtual bool AddVideoPicture(DVDVideoPicture* picture) { return false; } -+ virtual bool AddVideoPicture(DVDVideoPicture* picture, int index) { return false; } - virtual void Flush() {}; - - virtual unsigned int GetProcessorSize() { return 0; } -+ virtual unsigned int GetMaxBufferSize() { return 0; } -+ virtual void SetBufferSize(int numBuffers) { } -+ virtual void ReleaseBuffer(int idx) { } - - virtual bool Supports(ERENDERFEATURE feature) { return false; } - -diff --git a/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp b/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp -index 1cf52d3..b32a7ea 100644 ---- a/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp -+++ b/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp -@@ -235,14 +235,6 @@ bool CLinuxRendererGL::ValidateRenderer() - return true; - } - -- --void CLinuxRendererGL::ManageTextures() --{ -- m_NumYV12Buffers = 2; -- //m_iYV12RenderBuffer = 0; -- return; --} -- - bool CLinuxRendererGL::ValidateRenderTarget() - { - if (!m_bValidated) -@@ -603,13 +595,28 @@ void CLinuxRendererGL::Flush() - glFinish(); - m_bValidated = false; - m_fbo.fbo.Cleanup(); -+ m_iYV12RenderBuffer = 0; -+} -+ -+void CLinuxRendererGL::ReleaseBuffer(int idx) -+{ -+ YUVBUFFER &buf = m_buffers[idx]; -+#ifdef HAVE_LIBVDPAU -+ SAFE_RELEASE(buf.vdpau); -+#endif -+#ifdef HAVE_LIBVA -+ buf.vaapi.surface.reset(); -+#endif -+#ifdef TARGET_DARWIN -+ if (buf.cvBufferRef) -+ CVBufferRelease(buf.cvBufferRef); -+#endif - } - - void CLinuxRendererGL::Update(bool bPauseDrawing) - { - if (!m_bConfigured) return; - ManageDisplay(); -- ManageTextures(); - } - - void CLinuxRendererGL::RenderUpdate(bool clear, DWORD flags, DWORD alpha) -@@ -625,7 +632,6 @@ void CLinuxRendererGL::RenderUpdate(bool clear, DWORD flags, DWORD alpha) - } - - ManageDisplay(); -- ManageTextures(); - - g_graphicsContext.BeginPaint(); - -@@ -782,7 +788,6 @@ unsigned int CLinuxRendererGL::PreInit() - m_resolution = RES_DESKTOP; - - m_iYV12RenderBuffer = 0; -- m_NumYV12Buffers = 2; - - m_formats.push_back(RENDER_FMT_YUV420P); - GLint size; -@@ -2465,7 +2470,7 @@ void CLinuxRendererGL::UploadVAAPITexture(int index) - || status == VA_STATUS_ERROR_INVALID_DISPLAY) - { - va.display->lost(true); -- for(int i = 0; i < NUM_BUFFERS; i++) -+ for(int i = 0; i < m_NumYV12Buffers; i++) - { - m_buffers[i].vaapi.display.reset(); - m_buffers[i].vaapi.surface.reset(); -@@ -3412,26 +3417,26 @@ void CLinuxRendererGL::UnBindPbo(YUVBUFFER& buff) - } - - #ifdef HAVE_LIBVDPAU --void CLinuxRendererGL::AddProcessor(CVDPAU* vdpau) -+void CLinuxRendererGL::AddProcessor(CVDPAU* vdpau, int index) - { -- YUVBUFFER &buf = m_buffers[NextYV12Texture()]; -+ YUVBUFFER &buf = m_buffers[index]; - SAFE_RELEASE(buf.vdpau); - buf.vdpau = (CVDPAU*)vdpau->Acquire(); - } - #endif - - #ifdef HAVE_LIBVA --void CLinuxRendererGL::AddProcessor(VAAPI::CHolder& holder) -+void CLinuxRendererGL::AddProcessor(VAAPI::CHolder& holder, int index) - { -- YUVBUFFER &buf = m_buffers[NextYV12Texture()]; -+ YUVBUFFER &buf = m_buffers[index]; - buf.vaapi.surface = holder.surface; - } - #endif - - #ifdef TARGET_DARWIN --void CLinuxRendererGL::AddProcessor(struct __CVBuffer *cvBufferRef) -+void CLinuxRendererGL::AddProcessor(struct __CVBuffer *cvBufferRef, int index) - { -- YUVBUFFER &buf = m_buffers[NextYV12Texture()]; -+ YUVBUFFER &buf = m_buffers[index]; - if (buf.cvBufferRef) - CVBufferRelease(buf.cvBufferRef); - buf.cvBufferRef = cvBufferRef; -diff --git a/xbmc/cores/VideoRenderers/LinuxRendererGL.h b/xbmc/cores/VideoRenderers/LinuxRendererGL.h -index acebfe0..7c9fcae 100644 ---- a/xbmc/cores/VideoRenderers/LinuxRendererGL.h -+++ b/xbmc/cores/VideoRenderers/LinuxRendererGL.h -@@ -44,7 +44,7 @@ - namespace Shaders { class BaseVideoFilterShader; } - namespace VAAPI { struct CHolder; } - --#define NUM_BUFFERS 3 -+#define NUM_BUFFERS 10 - - - #undef ALIGN -@@ -138,15 +138,19 @@ class CLinuxRendererGL : public CBaseRenderer - virtual void UnInit(); - virtual void Reset(); /* resets renderer after seek for example */ - virtual void Flush(); -+ virtual void ReleaseBuffer(int idx); -+ virtual void SetBufferSize(int numBuffers) { m_NumYV12Buffers = numBuffers; } -+ virtual unsigned int GetMaxBufferSize() { return NUM_BUFFERS; } -+ virtual unsigned int GetProcessorSize() { return m_NumYV12Buffers; } - - #ifdef HAVE_LIBVDPAU -- virtual void AddProcessor(CVDPAU* vdpau); -+ virtual void AddProcessor(CVDPAU* vdpau, int index); - #endif - #ifdef HAVE_LIBVA -- virtual void AddProcessor(VAAPI::CHolder& holder); -+ virtual void AddProcessor(VAAPI::CHolder& holder, int index); - #endif - #ifdef TARGET_DARWIN -- virtual void AddProcessor(struct __CVBuffer *cvBufferRef); -+ virtual void AddProcessor(struct __CVBuffer *cvBufferRef, int index); - #endif - - virtual void RenderUpdate(bool clear, DWORD flags = 0, DWORD alpha = 255); -@@ -168,7 +172,6 @@ class CLinuxRendererGL : public CBaseRenderer - void DrawBlackBars(); - - bool ValidateRenderer(); -- virtual void ManageTextures(); - int NextYV12Texture(); - virtual bool ValidateRenderTarget(); - virtual void LoadShaders(int field=FIELD_FULL); -diff --git a/xbmc/cores/VideoRenderers/LinuxRendererGLES.cpp b/xbmc/cores/VideoRenderers/LinuxRendererGLES.cpp -index cb0939f..2a59e2b 100644 ---- a/xbmc/cores/VideoRenderers/LinuxRendererGLES.cpp -+++ b/xbmc/cores/VideoRenderers/LinuxRendererGLES.cpp -@@ -1982,16 +1982,16 @@ EINTERLACEMETHOD CLinuxRendererGLES::AutoInterlaceMethod() - } - - #ifdef HAVE_LIBOPENMAX --void CLinuxRendererGLES::AddProcessor(COpenMax* openMax, DVDVideoPicture *picture) -+void CLinuxRendererGLES::AddProcessor(COpenMax* openMax, DVDVideoPicture *picture, int index) - { -- YUVBUFFER &buf = m_buffers[NextYV12Texture()]; -+ YUVBUFFER &buf = m_buffers[index]; - buf.openMaxBuffer = picture->openMaxBuffer; - } - #endif - #ifdef HAVE_VIDEOTOOLBOXDECODER --void CLinuxRendererGLES::AddProcessor(struct __CVBuffer *cvBufferRef) -+void CLinuxRendererGLES::AddProcessor(struct __CVBuffer *cvBufferRef, int index) - { -- YUVBUFFER &buf = m_buffers[NextYV12Texture()]; -+ YUVBUFFER &buf = m_buffers[index]; - if (buf.cvBufferRef) - CVBufferRelease(buf.cvBufferRef); - buf.cvBufferRef = cvBufferRef; -diff --git a/xbmc/cores/VideoRenderers/LinuxRendererGLES.h b/xbmc/cores/VideoRenderers/LinuxRendererGLES.h -index 76b5437..c6b69db 100644 ---- a/xbmc/cores/VideoRenderers/LinuxRendererGLES.h -+++ b/xbmc/cores/VideoRenderers/LinuxRendererGLES.h -@@ -153,10 +153,10 @@ class CLinuxRendererGLES : public CBaseRenderer - virtual std::vector SupportedFormats() { return m_formats; } - - #ifdef HAVE_LIBOPENMAX -- virtual void AddProcessor(COpenMax* openMax, DVDVideoPicture *picture); -+ virtual void AddProcessor(COpenMax* openMax, DVDVideoPicture *picture, int index); - #endif - #ifdef HAVE_VIDEOTOOLBOXDECODER -- virtual void AddProcessor(struct __CVBuffer *cvBufferRef); -+ virtual void AddProcessor(struct __CVBuffer *cvBufferRef, int index); - #endif - - protected: -diff --git a/xbmc/cores/VideoRenderers/OverlayRenderer.cpp b/xbmc/cores/VideoRenderers/OverlayRenderer.cpp -index 19d2d7d..f7f74ce 100644 ---- a/xbmc/cores/VideoRenderers/OverlayRenderer.cpp -+++ b/xbmc/cores/VideoRenderers/OverlayRenderer.cpp -@@ -89,29 +89,32 @@ long COverlayMainThread::Release() - CRenderer::CRenderer() - { - m_render = 0; -- m_decode = (m_render + 1) % 2; - } - - CRenderer::~CRenderer() - { -- for(int i = 0; i < 2; i++) -+ for(int i = 0; i < 10; i++) - Release(m_buffers[i]); - } - --void CRenderer::AddOverlay(CDVDOverlay* o, double pts) -+void CRenderer::AddOverlay(CDVDOverlay* o, double pts, int index) - { - CSingleLock lock(m_section); - -+ m_decode = index; -+ - SElement e; - e.pts = pts; - e.overlay_dvd = o->Acquire(); - m_buffers[m_decode].push_back(e); - } - --void CRenderer::AddOverlay(COverlay* o, double pts) -+void CRenderer::AddOverlay(COverlay* o, double pts, int index) - { - CSingleLock lock(m_section); - -+ m_decode = index; -+ - SElement e; - e.pts = pts; - e.overlay = o->Acquire(); -@@ -151,20 +154,23 @@ void CRenderer::Flush() - { - CSingleLock lock(m_section); - -- for(int i = 0; i < 2; i++) -+ for(int i = 0; i < m_iNumBuffers; i++) - Release(m_buffers[i]); - -+ m_render = 0; - Release(m_cleanup); - } - - void CRenderer::Flip() - { - CSingleLock lock(m_section); -+ m_render = (m_render + 1) % m_iNumBuffers; -+} - -- m_render = m_decode; -- m_decode =(m_decode + 1) % 2; -- -- Release(m_buffers[m_decode]); -+void CRenderer::ReleaseBuffer(int idx) -+{ -+ CSingleLock lock(m_section); -+ Release(m_buffers[idx]); - } - - void CRenderer::Render() -diff --git a/xbmc/cores/VideoRenderers/OverlayRenderer.h b/xbmc/cores/VideoRenderers/OverlayRenderer.h -index d2175d8..0921fc5 100644 ---- a/xbmc/cores/VideoRenderers/OverlayRenderer.h -+++ b/xbmc/cores/VideoRenderers/OverlayRenderer.h -@@ -92,12 +92,14 @@ - CRenderer(); - ~CRenderer(); - -- void AddOverlay(CDVDOverlay* o, double pts); -- void AddOverlay(COverlay* o, double pts); -+ void AddOverlay(CDVDOverlay* o, double pts, int index); -+ void AddOverlay(COverlay* o, double pts, int index); - void AddCleanup(COverlay* o); - void Flip(); - void Render(); - void Flush(); -+ void SetNumBuffers(int numBuffers) { m_iNumBuffers = numBuffers; } -+ void ReleaseBuffer(int idx); - - protected: - -@@ -124,7 +126,8 @@ - void Release(SElementV& list); - - CCriticalSection m_section; -- SElementV m_buffers[2]; -+ SElementV m_buffers[10]; -+ int m_iNumBuffers; - int m_decode; - int m_render; - -diff --git a/xbmc/cores/VideoRenderers/RenderManager.cpp b/xbmc/cores/VideoRenderers/RenderManager.cpp -index d22287d..c13f83d 100644 ---- a/xbmc/cores/VideoRenderers/RenderManager.cpp -+++ b/xbmc/cores/VideoRenderers/RenderManager.cpp -@@ -28,6 +28,7 @@ - #include "utils/MathUtils.h" - #include "threads/SingleLock.h" - #include "utils/log.h" -+#include "utils/TimeUtils.h" - - #include "Application.h" - #include "ApplicationMessenger.h" -@@ -227,7 +228,7 @@ CStdString CXBMCRenderManager::GetVSyncState() - return state; - } - --bool CXBMCRenderManager::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) -+bool CXBMCRenderManager::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, bool buffering) - { - /* make sure any queued frame was fully presented */ - double timeout = m_presenttime + 0.1; -@@ -247,6 +248,9 @@ bool CXBMCRenderManager::Configure(unsigned int width, unsigned int height, unsi - return false; - } - -+ // set buffering -+ m_bCodecSupportsBuffering = buffering; -+ - bool result = m_pRenderer->Configure(width, height, d_width, d_height, fps, flags, format, extended_format, orientation); - if(result) - { -@@ -261,6 +265,7 @@ bool CXBMCRenderManager::Configure(unsigned int width, unsigned int height, unsi - m_bReconfigured = true; - m_presentstep = PRESENT_IDLE; - m_presentevent.Set(); -+ ResetRenderBuffer(); - } - - return result; -@@ -292,8 +297,12 @@ void CXBMCRenderManager::RenderUpdate(bool clear, DWORD flags, DWORD alpha) - if (!m_pRenderer) - return; - -+ if (m_presentstep == PRESENT_IDLE) -+ PrepareNextRender(); -+ - if(m_presentstep == PRESENT_FLIP) - { -+ FlipRenderBuffer(); - m_overlays.Flip(); - m_pRenderer->FlipPage(m_presentsource); - m_presentstep = PRESENT_FRAME; -@@ -338,6 +347,10 @@ unsigned int CXBMCRenderManager::PreInit() - - UpdateDisplayLatency(); - -+ m_bUseBuffering = false; -+ m_bCodecSupportsBuffering = true; -+ ResetRenderBuffer(); -+ - return m_pRenderer->PreInit(); - } - -@@ -366,7 +379,9 @@ bool CXBMCRenderManager::Flush() - - CRetakeLock lock(m_sharedSection); - m_pRenderer->Flush(); -+ m_overlays.Flush(); - m_flushEvent.Set(); -+ ResetRenderBuffer(); - } - else - { -@@ -534,25 +549,21 @@ void CXBMCRenderManager::SetViewMode(int iViewMode) - m_pRenderer->SetViewMode(iViewMode); - } - --void CXBMCRenderManager::FlipPage(volatile bool& bStop, double timestamp /* = 0LL*/, int source /*= -1*/, EFIELDSYNC sync /*= FS_NONE*/) -+void CXBMCRenderManager::FlipPage(volatile bool& bStop, double timestamp /* = 0LL*/, int source /*= -1*/, EFIELDSYNC sync /*= FS_NONE*/, int speed /*= 1000*/) - { -- if(timestamp - GetPresentTime() > MAXPRESENTDELAY) -- timestamp = GetPresentTime() + MAXPRESENTDELAY; -- -- /* can't flip, untill timestamp */ -- if(!g_graphicsContext.IsFullScreenVideo()) -- WaitPresentTime(timestamp); -- -- /* make sure any queued frame was fully presented */ -- double timeout = m_presenttime + 1.0; -- while(m_presentstep != PRESENT_IDLE && !bStop) -+ if (!m_bUseBuffering) - { -- if(!m_presentevent.WaitMSec(100) && GetPresentTime() > timeout && !bStop) -+ /* make sure any queued frame was fully presented */ -+ double timeout = m_presenttime + 1.0; -+ while(m_presentstep != PRESENT_IDLE && !bStop) - { -- CLog::Log(LOGWARNING, "CRenderManager::FlipPage - timeout waiting for previous frame"); -- return; -+ if(!m_presentevent.WaitMSec(100) && GetPresentTime() > timeout && !bStop) -+ { -+ CLog::Log(LOGWARNING, "CRenderManager::FlipPage - timeout waiting for previous frame"); -+ return; -+ } - } -- }; -+ } - - if(bStop) - return; -@@ -560,58 +571,67 @@ void CXBMCRenderManager::FlipPage(volatile bool& bStop, double timestamp /* = 0L - { CRetakeLock lock(m_sharedSection); - if(!m_pRenderer) return; - -- m_presenttime = timestamp; -- m_presentfield = sync; -- m_presentstep = PRESENT_FLIP; -- m_presentsource = source; -+ double presenttime = timestamp; -+ EFIELDSYNC presentfield = sync; -+ EPRESENTMETHOD presentmethod; -+ - EDEINTERLACEMODE deinterlacemode = g_settings.m_currentVideoSettings.m_DeinterlaceMode; - EINTERLACEMETHOD interlacemethod = AutoInterlaceMethodInternal(g_settings.m_currentVideoSettings.m_InterlaceMethod); - - bool invert = false; - - if (deinterlacemode == VS_DEINTERLACEMODE_OFF) -- m_presentmethod = PRESENT_METHOD_SINGLE; -+ presentmethod = PRESENT_METHOD_SINGLE; - else - { -- if (deinterlacemode == VS_DEINTERLACEMODE_AUTO && m_presentfield == FS_NONE) -- m_presentmethod = PRESENT_METHOD_SINGLE; -+ if (deinterlacemode == VS_DEINTERLACEMODE_AUTO && presentfield == FS_NONE) -+ presentmethod = PRESENT_METHOD_SINGLE; - else - { -- if (interlacemethod == VS_INTERLACEMETHOD_RENDER_BLEND) m_presentmethod = PRESENT_METHOD_BLEND; -- else if (interlacemethod == VS_INTERLACEMETHOD_RENDER_WEAVE) m_presentmethod = PRESENT_METHOD_WEAVE; -- else if (interlacemethod == VS_INTERLACEMETHOD_RENDER_WEAVE_INVERTED) { m_presentmethod = PRESENT_METHOD_WEAVE ; invert = true; } -- else if (interlacemethod == VS_INTERLACEMETHOD_RENDER_BOB) m_presentmethod = PRESENT_METHOD_BOB; -- else if (interlacemethod == VS_INTERLACEMETHOD_RENDER_BOB_INVERTED) { m_presentmethod = PRESENT_METHOD_BOB; invert = true; } -- else if (interlacemethod == VS_INTERLACEMETHOD_DXVA_BOB) m_presentmethod = PRESENT_METHOD_BOB; -- else if (interlacemethod == VS_INTERLACEMETHOD_DXVA_BEST) m_presentmethod = PRESENT_METHOD_BOB; -- else m_presentmethod = PRESENT_METHOD_SINGLE; -+ if (interlacemethod == VS_INTERLACEMETHOD_RENDER_BLEND) presentmethod = PRESENT_METHOD_BLEND; -+ else if (interlacemethod == VS_INTERLACEMETHOD_RENDER_WEAVE) presentmethod = PRESENT_METHOD_WEAVE; -+ else if (interlacemethod == VS_INTERLACEMETHOD_RENDER_WEAVE_INVERTED) { presentmethod = PRESENT_METHOD_WEAVE ; invert = true; } -+ else if (interlacemethod == VS_INTERLACEMETHOD_RENDER_BOB) presentmethod = PRESENT_METHOD_BOB; -+ else if (interlacemethod == VS_INTERLACEMETHOD_RENDER_BOB_INVERTED) { presentmethod = PRESENT_METHOD_BOB; invert = true; } -+ else if (interlacemethod == VS_INTERLACEMETHOD_DXVA_BOB) presentmethod = PRESENT_METHOD_BOB; -+ else if (interlacemethod == VS_INTERLACEMETHOD_DXVA_BEST) presentmethod = PRESENT_METHOD_BOB; -+ else presentmethod = PRESENT_METHOD_SINGLE; - - /* default to odd field if we want to deinterlace and don't know better */ -- if (deinterlacemode == VS_DEINTERLACEMODE_FORCE && m_presentfield == FS_NONE) -- m_presentfield = FS_TOP; -+ if (deinterlacemode == VS_DEINTERLACEMODE_FORCE && presentfield == FS_NONE) -+ presentfield = FS_TOP; - - /* invert present field */ - if(invert) - { -- if( m_presentfield == FS_BOT ) -- m_presentfield = FS_TOP; -+ if( presentfield == FS_BOT ) -+ presentfield = FS_TOP; - else -- m_presentfield = FS_BOT; -+ presentfield = FS_BOT; - } - } - } - -+ FlipFreeBuffer(); -+ m_renderBuffers[m_iOutputRenderBuffer].pts = timestamp; -+ m_renderBuffers[m_iOutputRenderBuffer].presentfield = presentfield; -+ m_renderBuffers[m_iOutputRenderBuffer].presentmethod = presentmethod; -+ m_speed = speed; - } - - g_application.NewFrame(); -- /* wait untill render thread have flipped buffers */ -- timeout = m_presenttime + 1.0; -- while(m_presentstep == PRESENT_FLIP && !bStop) -+ -+ if (!m_bUseBuffering) - { -- if(!m_presentevent.WaitMSec(100) && GetPresentTime() > timeout && !bStop) -+ /* wait untill render thread have flipped buffers */ -+ double timeout = m_presenttime + 1.0; -+ while(m_presentstep == PRESENT_FLIP && !bStop) - { -- CLog::Log(LOGWARNING, "CRenderManager::FlipPage - timeout waiting for flip to complete"); -- return; -+ if(!m_presentevent.WaitMSec(100) && GetPresentTime() > timeout && !bStop) -+ { -+ CLog::Log(LOGWARNING, "CRenderManager::FlipPage - timeout waiting for flip to complete"); -+ return; -+ } - } - } - } -@@ -675,8 +695,12 @@ void CXBMCRenderManager::Present() - if (!m_pRenderer) - return; - -+ if (m_presentstep == PRESENT_IDLE) -+ PrepareNextRender(); -+ - if(m_presentstep == PRESENT_FLIP) - { -+ FlipRenderBuffer(); - m_overlays.Flip(); - m_pRenderer->FlipPage(m_presentsource); - m_presentstep = PRESENT_FRAME; -@@ -800,11 +824,11 @@ int CXBMCRenderManager::AddVideoPicture(DVDVideoPicture& pic) - if (!m_pRenderer) - return -1; - -- if(m_pRenderer->AddVideoPicture(&pic)) -+ if(m_pRenderer->AddVideoPicture(&pic, (m_iOutputRenderBuffer + 1) % m_iNumRenderBuffers)) - return 1; - - YV12Image image; -- int index = m_pRenderer->GetImage(&image); -+ int index = m_pRenderer->GetImage(&image, (m_iOutputRenderBuffer + 1) % m_iNumRenderBuffers); - - if(index < 0) - return index; -@@ -830,19 +854,19 @@ int CXBMCRenderManager::AddVideoPicture(DVDVideoPicture& pic) - } - #ifdef HAVE_LIBVDPAU - else if(pic.format == RENDER_FMT_VDPAU) -- m_pRenderer->AddProcessor(pic.vdpau); -+ m_pRenderer->AddProcessor(pic.vdpau, index); - #endif - #ifdef HAVE_LIBOPENMAX - else if(pic.format == RENDER_FMT_OMXEGL) -- m_pRenderer->AddProcessor(pic.openMax, &pic); -+ m_pRenderer->AddProcessor(pic.openMax, &pic, index); - #endif - #ifdef TARGET_DARWIN - else if(pic.format == RENDER_FMT_CVBREF) -- m_pRenderer->AddProcessor(pic.cvBufferRef); -+ m_pRenderer->AddProcessor(pic.cvBufferRef, index); - #endif - #ifdef HAVE_LIBVA - else if(pic.format == RENDER_FMT_VAAPI) -- m_pRenderer->AddProcessor(*pic.vaapi); -+ m_pRenderer->AddProcessor(*pic.vaapi, index); - #endif - m_pRenderer->ReleaseImage(index, false); - -@@ -904,3 +928,177 @@ EINTERLACEMETHOD CXBMCRenderManager::AutoInterlaceMethodInternal(EINTERLACEMETHO - - return mInt; - } -+ -+int CXBMCRenderManager::WaitForBuffer(volatile bool& bStop, int timeout) -+{ -+ CSharedLock lock(m_sharedSection); -+ if (!m_pRenderer) -+ return -1; -+ -+ double maxwait = GetPresentTime() + (float)timeout/1000; -+ while(!HasFreeBuffer() && !bStop) -+ { -+ lock.Leave(); -+ m_flipEvent.WaitMSec(std::min(50, timeout)); -+ if(GetPresentTime() > maxwait && !bStop) -+ { -+ if (timeout != 0) -+ CLog::Log(LOGWARNING, "CRenderManager::WaitForBuffer - timeout waiting for buffer"); -+ return -1; -+ } -+ lock.Enter(); -+ } -+ lock.Leave(); -+ -+ if (bStop) -+ return -1; -+ -+ return 1; -+} -+ -+int CXBMCRenderManager::GetNextRenderBufferIndex() -+{ -+ if (m_iOutputRenderBuffer == m_iCurrentRenderBuffer) -+ return -1; -+ return (m_iCurrentRenderBuffer + 1) % m_iNumRenderBuffers; -+} -+ -+void CXBMCRenderManager::FlipRenderBuffer() -+{ -+ m_iCurrentRenderBuffer = GetNextRenderBufferIndex(); -+} -+ -+int CXBMCRenderManager::FlipFreeBuffer() -+{ -+ // See "Render Buffer State Description" in header for information. -+ if (HasFreeBuffer()) -+ { -+ m_bAllRenderBuffersDisplayed = false; -+ m_iOutputRenderBuffer = (m_iOutputRenderBuffer + 1) % m_iNumRenderBuffers; -+ return m_iOutputRenderBuffer; -+ } -+} -+ -+bool CXBMCRenderManager::HasFreeBuffer() -+{ -+ if (!m_bUseBuffering) -+ { -+ if (m_iOutputRenderBuffer != m_iCurrentRenderBuffer) -+ return false; -+ else -+ return true; -+ } -+ -+ int outputPlus1 = (m_iOutputRenderBuffer + 1) % m_iNumRenderBuffers; -+ if ((m_iOutputRenderBuffer == m_iDisplayedRenderBuffer && !m_bAllRenderBuffersDisplayed) -+ || outputPlus1 == m_iCurrentRenderBuffer) -+ return false; -+ else -+ return true; -+} -+ -+void CXBMCRenderManager::ResetRenderBuffer() -+{ -+ m_iNumRenderBuffers = m_pRenderer->GetMaxBufferSize(); -+ m_iNumRenderBuffers = std::min(5, m_iNumRenderBuffers); -+ m_iNumRenderBuffers = std::max(2, m_iNumRenderBuffers); -+ -+ if (!m_bCodecSupportsBuffering) -+ m_iNumRenderBuffers = 2; -+ -+ CLog::Log(LOGNOTICE,"CXBMCRenderManager::ResetRenderBuffer - using %d render buffers", m_iNumRenderBuffers); -+ m_overlays.SetNumBuffers(m_iNumRenderBuffers); -+ m_pRenderer->SetBufferSize(m_iNumRenderBuffers); -+ -+ m_iCurrentRenderBuffer = 0; -+ m_iOutputRenderBuffer = 0; -+ m_iDisplayedRenderBuffer = 0; -+ m_bAllRenderBuffersDisplayed = true; -+ m_sleeptime = 1.0; -+ m_presentPts = DVD_NOPTS_VALUE; -+ m_speed = 0; -+} -+ -+void CXBMCRenderManager::PrepareNextRender() -+{ -+ int idx = GetNextRenderBufferIndex(); -+ if (idx < 0) -+ { -+ if (m_speed >= DVD_PLAYSPEED_NORMAL && g_graphicsContext.IsFullScreenVideo()) -+ CLog::Log(LOGDEBUG,"%s no buffer, out: %d, current: %d, display: %d", -+ __FUNCTION__, m_iOutputRenderBuffer, m_iCurrentRenderBuffer, m_iDisplayedRenderBuffer); -+ return; -+ } -+ -+ double iClockSleep, iPlayingClock, iCurrentClock; -+ if (g_application.m_pPlayer) -+ iPlayingClock = g_application.m_pPlayer->GetClock(iCurrentClock, false); -+ else -+ iPlayingClock = iCurrentClock = 0; -+ -+ iClockSleep = m_renderBuffers[idx].pts - iPlayingClock; -+ -+ if (m_speed) -+ iClockSleep = iClockSleep * DVD_PLAYSPEED_NORMAL / m_speed; -+ -+ double presenttime = (iCurrentClock + iClockSleep) / DVD_TIME_BASE; -+ double clocktime = iCurrentClock / DVD_TIME_BASE; -+ if(presenttime - clocktime > MAXPRESENTDELAY) -+ presenttime = clocktime + MAXPRESENTDELAY; -+ -+ m_sleeptime = presenttime - clocktime; -+ double frametime = 1 / g_graphicsContext.GetFPS(); -+ -+ if (g_graphicsContext.IsFullScreenVideo() || presenttime <= clocktime + frametime) -+ { -+ m_presentPts = m_renderBuffers[idx].pts; -+ m_presenttime = presenttime; -+ m_presentmethod = m_renderBuffers[idx].presentmethod; -+ m_presentfield = m_renderBuffers[idx].presentfield; -+ m_presentstep = PRESENT_FLIP; -+ m_presentsource = idx; -+ } -+} -+ -+void CXBMCRenderManager::EnableBuffering(bool enable) -+{ -+ CRetakeLock lock(m_sharedSection); -+ -+ if (m_iNumRenderBuffers < 3) -+ return; -+ -+ m_bUseBuffering = enable; -+ if (!m_bUseBuffering) -+ m_iOutputRenderBuffer = m_iCurrentRenderBuffer; -+ -+ CLog::Log(LOGDEBUG, "CXBMCRenderManager::EnableBuffering - %d", m_bUseBuffering); -+} -+ -+void CXBMCRenderManager::DiscardBuffer() -+{ -+ CRetakeLock lock(m_sharedSection); -+ m_iOutputRenderBuffer = m_iCurrentRenderBuffer; -+} -+ -+void CXBMCRenderManager::NotifyDisplayFlip() -+{ -+ CRetakeLock lock(m_sharedSection); -+ if (!m_pRenderer) -+ return; -+ -+ if (m_iNumRenderBuffers >= 3) -+ { -+ int last = m_iDisplayedRenderBuffer; -+ m_iDisplayedRenderBuffer = (m_iCurrentRenderBuffer + m_iNumRenderBuffers - 1) % m_iNumRenderBuffers; -+ -+ if (last != m_iDisplayedRenderBuffer -+ && m_iDisplayedRenderBuffer != m_iCurrentRenderBuffer) -+ { -+ m_pRenderer->ReleaseBuffer(m_iDisplayedRenderBuffer); -+ m_overlays.ReleaseBuffer(m_iDisplayedRenderBuffer); -+ } -+ } -+ -+ lock.Leave(); -+ m_flipEvent.Set(); -+} -diff --git a/xbmc/cores/VideoRenderers/RenderManager.h b/xbmc/cores/VideoRenderers/RenderManager.h -index 7fe6bb2..96ab53f 100644 ---- a/xbmc/cores/VideoRenderers/RenderManager.h -+++ b/xbmc/cores/VideoRenderers/RenderManager.h -@@ -31,6 +31,7 @@ - #include "OverlayRenderer.h" - - class CRenderCapture; -+class CDVDClock; - - namespace DXVA { class CProcessor; } - namespace VAAPI { class CSurfaceHolder; } -@@ -65,12 +66,12 @@ class CXBMCRenderManager - void SetViewMode(int iViewMode); - - // Functions called from mplayer -- 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); -+ 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, bool buffering = false); - bool IsConfigured(); - - int AddVideoPicture(DVDVideoPicture& picture); - -- void FlipPage(volatile bool& bStop, double timestamp = 0.0, int source = -1, EFIELDSYNC sync = FS_NONE); -+ void FlipPage(volatile bool& bStop, double timestamp = 0.0, int source = -1, EFIELDSYNC sync = FS_NONE, int speed = 1000); - unsigned int PreInit(); - void UnInit(); - bool Flush(); -@@ -78,7 +79,7 @@ class CXBMCRenderManager - void AddOverlay(CDVDOverlay* o, double pts) - { - CSharedLock lock(m_sharedSection); -- m_overlays.AddOverlay(o, pts); -+ m_overlays.AddOverlay(o, pts, (m_iOutputRenderBuffer + 1) % m_iNumRenderBuffers); - } - - void AddCleanup(OVERLAY::COverlay* o) -@@ -132,6 +133,24 @@ class CXBMCRenderManager - - void RegisterRenderUpdateCallBack(const void *ctx, RenderUpdateCallBackFn fn); - -+ /** -+ * If player uses buffering it has to wait for a buffer before it calls -+ * AddVideoPicture and AddOverlay. It waits for max 50 ms before it returns -1 -+ * in case no buffer is available. Player may call this in a loop and decides -+ * by itself when it wants to drop a frame. -+ * If no buffering is requested in Configure, player does not need to call this, -+ * because FlipPage will block. -+ */ -+ int WaitForBuffer(volatile bool& bStop, int timeout = 100); -+ -+ /** -+ * Called by application right after flip. The buffer which has been rendered to -+ * display becomes available for player to deliver a new frame. -+ */ -+ void NotifyDisplayFlip(); -+ void EnableBuffering(bool enable); -+ void DiscardBuffer(); -+ - protected: - void Render(bool clear, DWORD flags, DWORD alpha); - -@@ -139,6 +158,13 @@ class CXBMCRenderManager - void PresentFields(bool clear, DWORD flags, DWORD alpha); - void PresentBlend(bool clear, DWORD flags, DWORD alpha); - -+ int GetNextRenderBufferIndex(); -+ void FlipRenderBuffer(); -+ int FlipFreeBuffer(); -+ bool HasFreeBuffer(); -+ void ResetRenderBuffer(); -+ void PrepareNextRender(); -+ - EINTERLACEMETHOD AutoInterlaceMethodInternal(EINTERLACEMETHOD mInt); - - bool m_bPauseDrawing; // true if we should pause rendering -@@ -169,6 +195,37 @@ class CXBMCRenderManager - double m_displayLatency; - void UpdateDisplayLatency(); - -+ // Render Buffer State Description: -+ // -+ // Output: is the buffer about to or having its texture prepared for render (ie from output thread). -+ // Cannot go past the "Displayed" buffer (otherwise we will probably overwrite buffers not yet -+ // displayed or even rendered). -+ // Current: is the current buffer being or having been submitted for render to back buffer. -+ // Cannot go past "Output" buffer (else it would be rendering old output). -+ // Displayed: is the buffer that is now considered to be safely copied from back buffer to front buffer -+ // (we assume that after two swap-buffer flips for the same "Current" render buffer that that -+ // buffer will be safe, but otherwise we consider that only the previous-to-"Current" is guaranteed). -+ -+ int m_iCurrentRenderBuffer; -+ int m_iNumRenderBuffers; -+ int m_iOutputRenderBuffer; -+ int m_iDisplayedRenderBuffer; -+ bool m_bAllRenderBuffersDisplayed; -+ bool m_bUseBuffering; -+ bool m_bCodecSupportsBuffering; -+ int m_speed; -+ CEvent m_flipEvent; -+ -+ struct -+ { -+ double pts; -+ EFIELDSYNC presentfield; -+ EPRESENTMETHOD presentmethod; -+ }m_renderBuffers[5]; -+ -+ double m_sleeptime; -+ double m_presentPts; -+ - double m_presenttime; - double m_presentcorr; - double m_presenterr; -diff --git a/xbmc/cores/VideoRenderers/WinRenderer.cpp b/xbmc/cores/VideoRenderers/WinRenderer.cpp -index f1d0768..f0f5b2d 100644 ---- a/xbmc/cores/VideoRenderers/WinRenderer.cpp -+++ b/xbmc/cores/VideoRenderers/WinRenderer.cpp -@@ -253,12 +253,12 @@ int CWinRenderer::NextYV12Texture() - return -1; - } - --bool CWinRenderer::AddVideoPicture(DVDVideoPicture* picture) -+bool CWinRenderer::AddVideoPicture(DVDVideoPicture* picture, int index) - { - if (m_renderMethod == RENDER_DXVA) - { -- int source = NextYV12Texture(); -- if(source < 0) -+ int source = index; -+ if(source < 0 || NextYV12Texture() < 0) - return false; - - DXVABuffer *buf = (DXVABuffer*)m_VideoBuffers[source]; -@@ -274,7 +274,7 @@ int CWinRenderer::GetImage(YV12Image *image, int source, bool readonly) - if( source == AUTOSOURCE ) - source = NextYV12Texture(); - -- if( source < 0 ) -+ if( source < 0 || NextYV12Texture() < 0) - return -1; - - YUVBuffer *buf = (YUVBuffer*)m_VideoBuffers[source]; -diff --git a/xbmc/cores/VideoRenderers/WinRenderer.h b/xbmc/cores/VideoRenderers/WinRenderer.h -index 2ab5684..f493ba7 100644 ---- a/xbmc/cores/VideoRenderers/WinRenderer.h -+++ b/xbmc/cores/VideoRenderers/WinRenderer.h -@@ -157,7 +157,7 @@ class CWinRenderer : public CBaseRenderer - virtual 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 int GetImage(YV12Image *image, int source = AUTOSOURCE, bool readonly = false); - virtual void ReleaseImage(int source, bool preserve = false); -- virtual bool AddVideoPicture(DVDVideoPicture* picture); -+ virtual bool AddVideoPicture(DVDVideoPicture* picture, int index); - virtual void FlipPage(int source); - virtual unsigned int PreInit(); - virtual void UnInit(); -diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp -index e5a1e71..bd55060 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayer.cpp -+++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp -@@ -4097,3 +4097,8 @@ bool CDVDPlayer::CachePVRStream(void) const - !g_PVRManager.IsPlayingRecording() && - g_advancedSettings.m_bPVRCacheInDvdPlayer; - } -+ -+double CDVDPlayer::GetClock(double& absolute, bool interpolated) -+{ -+ return m_clock.GetClock(absolute, interpolated); -+} -diff --git a/xbmc/cores/dvdplayer/DVDPlayer.h b/xbmc/cores/dvdplayer/DVDPlayer.h -index ebe0ce8..2d1b163 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayer.h -+++ b/xbmc/cores/dvdplayer/DVDPlayer.h -@@ -252,6 +252,8 @@ class CDVDPlayer : public IPlayer, public CThread, public IDVDPlayer - virtual bool SwitchChannel(const PVR::CPVRChannel &channel); - virtual bool CachePVRStream(void) const; - -+ virtual double GetClock(double& absolute, bool interpolated = true); -+ - enum ECacheState - { CACHESTATE_DONE = 0 - , CACHESTATE_FULL // player is filling up the demux queue -diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -index 3008c25..19496a7 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -+++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -@@ -261,6 +261,7 @@ void CDVDPlayerVideo::OpenStream(CDVDStreamInfo &hint, CDVDVideoCodec* codec) - m_stalled = m_messageQueue.GetPacketCount(CDVDMsg::DEMUXER_PACKET) == 0; - m_started = false; - m_codecname = m_pVideoCodec->GetName(); -+ g_renderManager.EnableBuffering(false); - } - - void CDVDPlayerVideo::CloseStream(bool bWaitForBuffers) -@@ -436,6 +437,7 @@ void CDVDPlayerVideo::Process() - picture.iFlags &= ~DVP_FLAG_ALLOCATED; - m_packets.clear(); - m_started = false; -+ g_renderManager.EnableBuffering(false); - } - else if (pMsg->IsType(CDVDMsg::GENERAL_FLUSH)) // private message sent by (CDVDPlayerVideo::Flush()) - { -@@ -448,6 +450,7 @@ void CDVDPlayerVideo::Process() - //we need to recalculate the framerate - //TODO: this needs to be set on a streamchange instead - ResetFrameRateCalc(); -+ g_renderManager.EnableBuffering(false); - - m_stalled = true; - m_started = false; -@@ -586,6 +589,8 @@ void CDVDPlayerVideo::Process() - - m_pVideoCodec->Reset(); - m_packets.clear(); -+ picture.iFlags &= ~DVP_FLAG_ALLOCATED; -+ g_renderManager.DiscardBuffer(); - break; - } - -@@ -700,6 +705,7 @@ void CDVDPlayerVideo::Process() - m_codecname = m_pVideoCodec->GetName(); - m_started = true; - m_messageParent.Put(new CDVDMsgInt(CDVDMsg::PLAYER_STARTED, DVDPLAYER_VIDEO)); -+ g_renderManager.EnableBuffering(true); - } - - // guess next frame pts. iDuration is always valid -@@ -1088,47 +1094,61 @@ int CDVDPlayerVideo::OutputPicture(const DVDVideoPicture* src, double pts) - } - - CStdString formatstr; -+ bool buffering; - - switch(pPicture->format) - { - case RENDER_FMT_YUV420P: - formatstr = "YV12"; -+ buffering = true; - break; - case RENDER_FMT_YUV420P16: - formatstr = "YV12P16"; -+ buffering = true; - break; - case RENDER_FMT_YUV420P10: - formatstr = "YV12P10"; -+ buffering = true; - break; - case RENDER_FMT_NV12: - formatstr = "NV12"; -+ buffering = true; - break; - case RENDER_FMT_UYVY422: - formatstr = "UYVY"; -+ buffering = true; - break; - case RENDER_FMT_YUYV422: - formatstr = "YUY2"; -+ buffering = true; - break; - case RENDER_FMT_VDPAU: - formatstr = "VDPAU"; -+ buffering = true; - break; - case RENDER_FMT_DXVA: - formatstr = "DXVA"; -+ buffering = false; - break; - case RENDER_FMT_VAAPI: - formatstr = "VAAPI"; -+ buffering = false; - break; - case RENDER_FMT_OMXEGL: - formatstr = "OMXEGL"; -+ buffering = false; - break; - case RENDER_FMT_CVBREF: - formatstr = "BGRA"; -+ buffering = false; - break; - case RENDER_FMT_BYPASS: - formatstr = "BYPASS"; -+ buffering = false; - break; - case RENDER_FMT_NONE: - formatstr = "NONE"; -+ buffering = false; - break; - } - -@@ -1139,7 +1159,7 @@ int CDVDPlayerVideo::OutputPicture(const DVDVideoPicture* src, double pts) - } - - CLog::Log(LOGDEBUG,"%s - change configuration. %dx%d. framerate: %4.2f. format: %s",__FUNCTION__,pPicture->iWidth, pPicture->iHeight, config_framerate, formatstr.c_str()); -- if(!g_renderManager.Configure(pPicture->iWidth, pPicture->iHeight, pPicture->iDisplayWidth, pPicture->iDisplayHeight, config_framerate, flags, pPicture->format, pPicture->extended_format, m_hints.orientation)) -+ if(!g_renderManager.Configure(pPicture->iWidth, pPicture->iHeight, pPicture->iDisplayWidth, pPicture->iDisplayHeight, config_framerate, flags, pPicture->format, pPicture->extended_format, m_hints.orientation, buffering)) - { - CLog::Log(LOGERROR, "%s - failed to configure renderer", __FUNCTION__); - return EOS_ABORT; -@@ -1317,6 +1337,16 @@ int CDVDPlayerVideo::OutputPicture(const DVDVideoPicture* src, double pts) - mDisplayField = FS_BOT; - } - -+ int buffer = g_renderManager.WaitForBuffer(m_bStop); -+ while (buffer < 0 && !CThread::m_bStop && -+ CDVDClock::GetAbsoluteClock(false) < iCurrentClock + iSleepTime + DVD_MSEC_TO_TIME(500) ) -+ { -+ Sleep(1); -+ buffer = g_renderManager.WaitForBuffer(m_bStop); -+ } -+ if (buffer < 0) -+ return EOS_DROPPED; -+ - ProcessOverlays(pPicture, pts); - AutoCrop(pPicture); - -@@ -1333,7 +1363,7 @@ int CDVDPlayerVideo::OutputPicture(const DVDVideoPicture* src, double pts) - if (index < 0) - return EOS_DROPPED; - -- g_renderManager.FlipPage(CThread::m_bStop, (iCurrentClock + iSleepTime) / DVD_TIME_BASE, -1, mDisplayField); -+ g_renderManager.FlipPage(CThread::m_bStop, pts, -1, mDisplayField, m_speed); - - return result; - #else --- -1.8.1.6 - - -From f2149c3e0cbfcb757d6e86f94a9523783209b83f Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Sat, 16 Feb 2013 08:32:18 +0100 -Subject: [PATCH 02/94] add buffering for GLES - ---- - xbmc/cores/VideoRenderers/LinuxRendererGLES.cpp | 10 ---------- - xbmc/cores/VideoRenderers/LinuxRendererGLES.h | 6 ++++-- - 2 files changed, 4 insertions(+), 12 deletions(-) - -diff --git a/xbmc/cores/VideoRenderers/LinuxRendererGLES.cpp b/xbmc/cores/VideoRenderers/LinuxRendererGLES.cpp -index 2a59e2b..1bf2f3b 100644 ---- a/xbmc/cores/VideoRenderers/LinuxRendererGLES.cpp -+++ b/xbmc/cores/VideoRenderers/LinuxRendererGLES.cpp -@@ -135,13 +135,6 @@ - delete m_dllSwScale; - } - --void CLinuxRendererGLES::ManageTextures() --{ -- m_NumYV12Buffers = 2; -- //m_iYV12RenderBuffer = 0; -- return; --} -- - bool CLinuxRendererGLES::ValidateRenderTarget() - { - if (!m_bValidated) -@@ -395,7 +388,6 @@ void CLinuxRendererGLES::Update(bool bPauseDrawing) - { - if (!m_bConfigured) return; - ManageDisplay(); -- ManageTextures(); - } - - void CLinuxRendererGLES::RenderUpdate(bool clear, DWORD flags, DWORD alpha) -@@ -409,7 +401,6 @@ void CLinuxRendererGLES::RenderUpdate(bool clear, DWORD flags, DWORD alpha) - if (m_renderMethod & RENDER_BYPASS) - { - ManageDisplay(); -- ManageTextures(); - // if running bypass, then the player might need the src/dst rects - // for sizing video playback on a layer other than the gles layer. - if (m_RenderUpdateCallBackFn) -@@ -449,7 +440,6 @@ void CLinuxRendererGLES::RenderUpdate(bool clear, DWORD flags, DWORD alpha) - return; - - ManageDisplay(); -- ManageTextures(); - - g_graphicsContext.BeginPaint(); - -diff --git a/xbmc/cores/VideoRenderers/LinuxRendererGLES.h b/xbmc/cores/VideoRenderers/LinuxRendererGLES.h -index c6b69db..5bae10d 100644 ---- a/xbmc/cores/VideoRenderers/LinuxRendererGLES.h -+++ b/xbmc/cores/VideoRenderers/LinuxRendererGLES.h -@@ -41,7 +41,7 @@ - class COpenMaxVideo; - typedef std::vector Features; - --#define NUM_BUFFERS 3 -+#define NUM_BUFFERS 10 - - - #undef ALIGN -@@ -138,6 +138,9 @@ class CLinuxRendererGLES : public CBaseRenderer - virtual void UnInit(); - virtual void Reset(); /* resets renderer after seek for example */ - virtual void ReorderDrawPoints(); -+ virtual void SetBufferSize(int numBuffers) { m_NumYV12Buffers = numBuffers; } -+ virtual unsigned int GetMaxBufferSize() { return NUM_BUFFERS; } -+ virtual unsigned int GetProcessorSize() { return m_NumYV12Buffers; } - - virtual void RenderUpdate(bool clear, DWORD flags = 0, DWORD alpha = 255); - -@@ -162,7 +165,6 @@ class CLinuxRendererGLES : public CBaseRenderer - protected: - virtual void Render(DWORD flags, int index); - -- virtual void ManageTextures(); - int NextYV12Texture(); - virtual bool ValidateRenderTarget(); - virtual void LoadShaders(int field=FIELD_FULL); --- -1.8.1.6 - - -From de745a5efcf48a15b3bb9349da9ab23cf4953e95 Mon Sep 17 00:00:00 2001 -From: unknown -Date: Sat, 16 Feb 2013 11:17:02 +0100 -Subject: [PATCH 03/94] WinRenderer: add buffering - ---- - xbmc/cores/VideoRenderers/WinRenderer.cpp | 14 ++++++-------- - xbmc/cores/VideoRenderers/WinRenderer.h | 12 +++++------- - 2 files changed, 11 insertions(+), 15 deletions(-) - -diff --git a/xbmc/cores/VideoRenderers/WinRenderer.cpp b/xbmc/cores/VideoRenderers/WinRenderer.cpp -index f0f5b2d..b6279f2 100644 ---- a/xbmc/cores/VideoRenderers/WinRenderer.cpp -+++ b/xbmc/cores/VideoRenderers/WinRenderer.cpp -@@ -103,21 +103,19 @@ static enum PixelFormat PixelFormatFromFormat(ERenderFormat format) - - void CWinRenderer::ManageTextures() - { -- int neededbuffers = 2; -- -- if( m_NumYV12Buffers < neededbuffers ) -+ if( m_NumYV12Buffers < m_neededBuffers ) - { -- for(int i = m_NumYV12Buffers; i neededbuffers ) -+ else if( m_NumYV12Buffers > m_neededBuffers ) - { -- m_NumYV12Buffers = neededbuffers; -+ m_NumYV12Buffers = m_neededBuffers; - m_iYV12RenderBuffer = m_iYV12RenderBuffer % m_NumYV12Buffers; - -- for(int i = m_NumYV12Buffers-1; i>=neededbuffers;i--) -+ for(int i = m_NumYV12Buffers-1; i>=m_neededBuffers;i--) - DeleteYV12Texture(i); - } - } -diff --git a/xbmc/cores/VideoRenderers/WinRenderer.h b/xbmc/cores/VideoRenderers/WinRenderer.h -index f493ba7..b3448ed 100644 ---- a/xbmc/cores/VideoRenderers/WinRenderer.h -+++ b/xbmc/cores/VideoRenderers/WinRenderer.h -@@ -32,13 +32,7 @@ - #include "cores/VideoRenderers/RenderFlags.h" - #include "cores/VideoRenderers/RenderFormats.h" - --//#define MP_DIRECTRENDERING -- --#ifdef MP_DIRECTRENDERING --#define NUM_BUFFERS 3 --#else --#define NUM_BUFFERS 2 --#endif -+#define NUM_BUFFERS 10 - - #define ALIGN(value, alignment) (((value)+((alignment)-1))&~((alignment)-1)) - #define CLAMP(a, min, max) ((a) > (max) ? (max) : ( (a) < (min) ? (min) : a )) -@@ -176,6 +170,8 @@ class CWinRenderer : public CBaseRenderer - void RenderUpdate(bool clear, DWORD flags = 0, DWORD alpha = 255); - - virtual unsigned int GetProcessorSize() { return m_processor.Size(); } -+ virtual void SetBufferSize(int numBuffers) { m_neededBuffers = numBuffers; } -+ virtual unsigned int GetMaxBufferSize() { return NUM_BUFFERS; } - - protected: - virtual void Render(DWORD flags); -@@ -245,6 +241,8 @@ class CWinRenderer : public CBaseRenderer - // the separable HQ scalers need this info, but could the m_destRect be used instead? - unsigned int m_destWidth; - unsigned int m_destHeight; -+ -+ int m_neededBuffers; - }; - - #else --- -1.8.1.6 - - -From e92897a0f4c555bce6010509cca85cc904f373af Mon Sep 17 00:00:00 2001 -From: unknown -Date: Sat, 16 Feb 2013 11:17:32 +0100 -Subject: [PATCH 04/94] DXVA: activate buffering in renderer - ---- - xbmc/cores/dvdplayer/DVDPlayerVideo.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -index 19496a7..3bfe180 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -+++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -@@ -1128,7 +1128,7 @@ int CDVDPlayerVideo::OutputPicture(const DVDVideoPicture* src, double pts) - break; - case RENDER_FMT_DXVA: - formatstr = "DXVA"; -- buffering = false; -+ buffering = true; - break; - case RENDER_FMT_VAAPI: - formatstr = "VAAPI"; --- -1.8.1.6 - - -From 09fe446db7be21df3592d9d7fbc15756ba00eaec Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Tue, 2 Oct 2012 10:49:09 +0200 -Subject: [PATCH 05/94] linuxrenderer: delete all textures on reconfigure - ---- - xbmc/cores/VideoRenderers/LinuxRendererGL.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp b/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp -index b32a7ea..a2dc2be 100644 ---- a/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp -+++ b/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp -@@ -251,7 +251,7 @@ bool CLinuxRendererGL::ValidateRenderTarget() - // function pointer for texture might change in - // call to LoadShaders - glFinish(); -- for (int i = 0 ; i < m_NumYV12Buffers ; i++) -+ for (int i = 0 ; i < NUM_BUFFERS ; i++) - (this->*m_textureDelete)(i); - - // trigger update of video filters --- -1.8.1.6 - - -From 1a1699c0eb9772b51a5338a12d6f6e4b182e93f1 Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Mon, 28 May 2012 10:17:33 +0200 -Subject: [PATCH 06/94] drop frame counter in application, ask render manager - instead - ---- - xbmc/Application.cpp | 50 ++++++----------------------- - xbmc/Application.h | 6 ++-- - xbmc/cores/VideoRenderers/RenderManager.cpp | 11 +++++++ - xbmc/cores/VideoRenderers/RenderManager.h | 1 + - 4 files changed, 23 insertions(+), 45 deletions(-) - -diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp -index 2ada954..ffd86a7 100644 ---- a/xbmc/Application.cpp -+++ b/xbmc/Application.cpp -@@ -419,8 +419,6 @@ - #endif - m_currentStack = new CFileItemList; - -- m_frameCount = 0; -- - m_bPresentFrame = false; - m_bPlatformDirectories = true; - -@@ -2231,28 +2229,18 @@ float CApplication::GetDimScreenSaverLevel() const - - bool CApplication::WaitFrame(unsigned int timeout) - { -- bool done = false; -- - // Wait for all other frames to be presented -- CSingleLock lock(m_frameMutex); -- //wait until event is set, but modify remaining time -+ m_frameEvent.Reset(); - -- TightConditionVariable > cv(m_frameCond, InversePredicate(m_frameCount)); -- cv.wait(lock,timeout); -- done = m_frameCount == 0; -+ if (!g_renderManager.HasFrame() && !m_frameEvent.WaitMSec(timeout)) -+ return false; - -- return done; -+ return g_renderManager.HasFrame(); - } - - void CApplication::NewFrame() - { -- // We just posted another frame. Keep track and notify. -- { -- CSingleLock lock(m_frameMutex); -- m_frameCount++; -- } -- -- m_frameCond.notifyAll(); -+ m_frameEvent.Set(); - } - - void CApplication::Render() -@@ -2272,7 +2260,6 @@ void CApplication::Render() - - int vsync_mode = g_guiSettings.GetInt("videoscreen.vsync"); - -- bool decrement = false; - bool hasRendered = false; - bool limitFrames = false; - unsigned int singleFrameTime = 10; // default limit 100 fps -@@ -2286,13 +2273,10 @@ void CApplication::Render() - m_bPresentFrame = false; - if (!extPlayerActive && g_graphicsContext.IsFullScreenVideo() && !IsPaused()) - { -- CSingleLock lock(m_frameMutex); -- -- TightConditionVariable cv(m_frameCond,m_frameCount); -- cv.wait(lock,100); -- -- m_bPresentFrame = m_frameCount > 0; -- decrement = m_bPresentFrame; -+ m_frameEvent.Reset(); -+ m_bPresentFrame = g_renderManager.HasFrame(); -+ if (!m_bPresentFrame && m_frameEvent.WaitMSec(100)) -+ m_bPresentFrame = g_renderManager.HasFrame(); - hasRendered = true; - } - else -@@ -2316,8 +2300,6 @@ void CApplication::Render() - else if (lowfps) - singleFrameTime = 200; // 5 fps, <=200 ms latency to wake up - } -- -- decrement = true; - } - } - -@@ -2379,13 +2361,6 @@ void CApplication::Render() - - g_renderManager.UpdateResolution(); - g_renderManager.ManageCaptures(); -- -- { -- CSingleLock lock(m_frameMutex); -- if(m_frameCount > 0 && decrement) -- m_frameCount--; -- } -- m_frameCond.notifyAll(); - } - - void CApplication::SetStandAlone(bool value) -@@ -5648,12 +5623,6 @@ bool CApplication::SwitchToFullScreen() - // See if we're playing a video, and are in GUI mode - if ( IsPlayingVideo() && g_windowManager.GetActiveWindow() != WINDOW_FULLSCREEN_VIDEO) - { -- // Reset frame count so that timing is FPS will be correct. -- { -- CSingleLock lock(m_frameMutex); -- m_frameCount = 0; -- } -- - // then switch to fullscreen mode - g_windowManager.ActivateWindow(WINDOW_FULLSCREEN_VIDEO); - return true; -@@ -5886,7 +5855,6 @@ bool CApplication::IsCurrentThread() const - - bool CApplication::IsPresentFrame() - { -- CSingleLock lock(m_frameMutex); - bool ret = m_bPresentFrame; - - return ret; -diff --git a/xbmc/Application.h b/xbmc/Application.h -index 69609fa..6764a60 100644 ---- a/xbmc/Application.h -+++ b/xbmc/Application.h -@@ -422,10 +422,8 @@ class CApplication : public CXBApplicationEx, public IPlayerCallback, public IMs - bool m_bEnableLegacyRes; - bool m_bTestMode; - bool m_bSystemScreenSaverEnable; -- -- int m_frameCount; -- CCriticalSection m_frameMutex; -- XbmcThreads::ConditionVariable m_frameCond; -+ -+ CEvent m_frameEvent; - - VIDEO::CVideoInfoScanner *m_videoInfoScanner; - MUSIC_INFO::CMusicInfoScanner *m_musicInfoScanner; -diff --git a/xbmc/cores/VideoRenderers/RenderManager.cpp b/xbmc/cores/VideoRenderers/RenderManager.cpp -index c13f83d..35aba7e 100644 ---- a/xbmc/cores/VideoRenderers/RenderManager.cpp -+++ b/xbmc/cores/VideoRenderers/RenderManager.cpp -@@ -1102,3 +1102,14 @@ void CXBMCRenderManager::NotifyDisplayFlip() - lock.Leave(); - m_flipEvent.Set(); - } -+ -+bool CXBMCRenderManager::HasFrame() -+{ -+ CSharedLock lock(m_sharedSection); -+ if (m_presentstep == PRESENT_IDLE && -+ GetNextRenderBufferIndex() < 0 && -+ m_speed > 0) -+ return false; -+ else -+ return true; -+} -diff --git a/xbmc/cores/VideoRenderers/RenderManager.h b/xbmc/cores/VideoRenderers/RenderManager.h -index 96ab53f..1e44233 100644 ---- a/xbmc/cores/VideoRenderers/RenderManager.h -+++ b/xbmc/cores/VideoRenderers/RenderManager.h -@@ -148,6 +148,7 @@ class CXBMCRenderManager - * display becomes available for player to deliver a new frame. - */ - void NotifyDisplayFlip(); -+ bool HasFrame(); - void EnableBuffering(bool enable); - void DiscardBuffer(); - --- -1.8.1.6 - - -From cdb9f67e23389c7ae8ca3f7d78ee3e0eef2eb860 Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Mon, 28 May 2012 11:02:29 +0200 -Subject: [PATCH 07/94] vaapi: adopt to buffering in renderer - ---- - xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp | 2 +- - xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp | 3 ++- - xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.h | 1 + - 3 files changed, 4 insertions(+), 2 deletions(-) - -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp -index 8f81637..286fd67 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp -@@ -106,7 +106,7 @@ enum PixelFormat CDVDVideoCodecFFmpeg::GetFormat( struct AVCodecContext * avctx - && (avctx->codec_id != CODEC_ID_MPEG4 || g_advancedSettings.m_videoAllowMpeg4VAAPI)) - { - VAAPI::CDecoder* dec = new VAAPI::CDecoder(); -- if(dec->Open(avctx, *cur)) -+ if(dec->Open(avctx, *cur, ctx->m_uSurfacesCount)) - { - ctx->SetHardware(dec); - return *cur; -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp -index 9f5a960..a2b9195 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp -@@ -357,6 +357,7 @@ bool CDecoder::Open(AVCodecContext *avctx, enum PixelFormat fmt, unsigned int su - CHECK(vaCreateConfig(m_display->get(), profile, entrypoint, &attrib, 1, &m_hwaccel->config_id)) - m_config = m_hwaccel->config_id; - -+ m_renderbuffers_count = surfaces; - if (!EnsureContext(avctx)) - return false; - -@@ -388,7 +389,7 @@ bool CDecoder::EnsureContext(AVCodecContext *avctx) - else - m_refs = 2; - } -- return EnsureSurfaces(avctx, m_refs + 3); -+ return EnsureSurfaces(avctx, m_refs + m_renderbuffers_count + 1); - } - - bool CDecoder::EnsureSurfaces(AVCodecContext *avctx, unsigned n_surfaces_count) -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.h -index 863edc4..417cbc0 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.h -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.h -@@ -122,6 +122,7 @@ class CDecoder - static const unsigned m_surfaces_max = 32; - unsigned m_surfaces_count; - VASurfaceID m_surfaces[m_surfaces_max]; -+ unsigned m_renderbuffers_count; - - int m_refs; - std::list m_surfaces_used; --- -1.8.1.6 - - -From bd53253c39b79610bff5a85fa33bf8d0330f367a Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Sat, 16 Feb 2013 20:17:29 +0100 -Subject: [PATCH 08/94] add buffering - some documentation - ---- - xbmc/cores/IPlayer.h | 3 +++ - xbmc/cores/VideoRenderers/RenderManager.h | 40 +++++++++++++++++++++++++++++++ - 2 files changed, 43 insertions(+) - -diff --git a/xbmc/cores/IPlayer.h b/xbmc/cores/IPlayer.h -index eb654ec..cbf2faa 100644 ---- a/xbmc/cores/IPlayer.h -+++ b/xbmc/cores/IPlayer.h -@@ -229,6 +229,9 @@ class IPlayer - */ - virtual void GetSubtitleCapabilities(std::vector &subCaps) { subCaps.assign(1,IPC_SUBS_ALL); }; - -+ /*! -+ \brief called by RenderManager in order to schedule frames -+ */ - virtual double GetClock(double& absolute, bool interpolated = true) {return 0; }; - - protected: -diff --git a/xbmc/cores/VideoRenderers/RenderManager.h b/xbmc/cores/VideoRenderers/RenderManager.h -index 1e44233..49da2ed 100644 ---- a/xbmc/cores/VideoRenderers/RenderManager.h -+++ b/xbmc/cores/VideoRenderers/RenderManager.h -@@ -66,11 +66,38 @@ class CXBMCRenderManager - void SetViewMode(int iViewMode); - - // Functions called from mplayer -+ /** -+ * Called by video player to configure renderer -+ * @param width width of decoded frame -+ * @param height height of decoded frame -+ * @param d_width displayed width of frame (aspect ratio) -+ * @param d_height displayed height of frame -+ * @param fps frames per second of video -+ * @param flags see RenderFlags.h -+ * @param format see RenderFormats.h -+ * @param extended_format used by DXVA -+ * @param orientation -+ * @param buffering enable buffering in renderer, defaults to false -+ */ - 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, bool buffering = false); - bool IsConfigured(); - - int AddVideoPicture(DVDVideoPicture& picture); - -+ /** -+ * Called by video player to flip render buffers -+ * If buffering is enabled this method does not block. In case of disabled buffering -+ * this method blocks waiting for the render thread to pass by. -+ * When buffering is used there might be no free buffer available after the call to -+ * this method. Player has to call WaitForBuffer. A free buffer will become -+ * available after the main thread has flipped front / back buffers. -+ * -+ * @param bStop reference to stop flag of calling thread -+ * @param timestamp pts of frame delivered with AddVideoPicture -+ * @param source depreciated -+ * @param sync signals frame, top, or bottom field -+ * @param speed current speed of player, needed for some optimizations like keeping the gui responsive on rewind -+ */ - void FlipPage(volatile bool& bStop, double timestamp = 0.0, int source = -1, EFIELDSYNC sync = FS_NONE, int speed = 1000); - unsigned int PreInit(); - void UnInit(); -@@ -148,8 +175,21 @@ class CXBMCRenderManager - * display becomes available for player to deliver a new frame. - */ - void NotifyDisplayFlip(); -+ -+ /** -+ * Called by application (main thread) to query if there is any frame to render -+ */ - bool HasFrame(); -+ -+ /** -+ * Video player can dynamically enable/disable buffering. In situations like -+ * rewind buffering is not ideal. -+ */ - void EnableBuffering(bool enable); -+ -+ /** -+ * Video player call this on flush in oder to discard any queued frames -+ */ - void DiscardBuffer(); - - protected: --- -1.8.1.6 - - -From 53a092f6153e7848d02d50de813f5ba315ef23a9 Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Mon, 18 Feb 2013 10:42:00 +0100 -Subject: [PATCH 09/94] RenderManager: only flip free buffer if player has - added something - ---- - xbmc/cores/VideoRenderers/RenderManager.cpp | 29 +++++++++++++++++++++++++---- - xbmc/cores/VideoRenderers/RenderManager.h | 7 ++----- - 2 files changed, 27 insertions(+), 9 deletions(-) - -diff --git a/xbmc/cores/VideoRenderers/RenderManager.cpp b/xbmc/cores/VideoRenderers/RenderManager.cpp -index 35aba7e..f5cc0f6 100644 ---- a/xbmc/cores/VideoRenderers/RenderManager.cpp -+++ b/xbmc/cores/VideoRenderers/RenderManager.cpp -@@ -612,10 +612,12 @@ void CXBMCRenderManager::FlipPage(volatile bool& bStop, double timestamp /* = 0L - } - } - -- FlipFreeBuffer(); -- m_renderBuffers[m_iOutputRenderBuffer].pts = timestamp; -- m_renderBuffers[m_iOutputRenderBuffer].presentfield = presentfield; -- m_renderBuffers[m_iOutputRenderBuffer].presentmethod = presentmethod; -+ if (FlipFreeBuffer() >= 0) -+ { -+ m_renderBuffers[m_iOutputRenderBuffer].pts = timestamp; -+ m_renderBuffers[m_iOutputRenderBuffer].presentfield = presentfield; -+ m_renderBuffers[m_iOutputRenderBuffer].presentmethod = presentmethod; -+ } - m_speed = speed; - } - -@@ -825,7 +827,10 @@ int CXBMCRenderManager::AddVideoPicture(DVDVideoPicture& pic) - return -1; - - if(m_pRenderer->AddVideoPicture(&pic, (m_iOutputRenderBuffer + 1) % m_iNumRenderBuffers)) -+ { -+ m_bRenderBufferUsed = true; - return 1; -+ } - - YV12Image image; - int index = m_pRenderer->GetImage(&image, (m_iOutputRenderBuffer + 1) % m_iNumRenderBuffers); -@@ -870,9 +875,17 @@ int CXBMCRenderManager::AddVideoPicture(DVDVideoPicture& pic) - #endif - m_pRenderer->ReleaseImage(index, false); - -+ m_bRenderBufferUsed = true; - return index; - } - -+void CXBMCRenderManager::AddOverlay(CDVDOverlay* o, double pts) -+{ -+ CSharedLock lock(m_sharedSection); -+ m_overlays.AddOverlay(o, pts, (m_iOutputRenderBuffer + 1) % m_iNumRenderBuffers); -+ m_bRenderBufferUsed = true; -+} -+ - bool CXBMCRenderManager::Supports(ERENDERFEATURE feature) - { - CSharedLock lock(m_sharedSection); -@@ -973,10 +986,17 @@ int CXBMCRenderManager::FlipFreeBuffer() - // See "Render Buffer State Description" in header for information. - if (HasFreeBuffer()) - { -+ if (!m_bRenderBufferUsed) -+ { -+ return -1; -+ } -+ m_bRenderBufferUsed = false; - m_bAllRenderBuffersDisplayed = false; - m_iOutputRenderBuffer = (m_iOutputRenderBuffer + 1) % m_iNumRenderBuffers; - return m_iOutputRenderBuffer; - } -+ else -+ return -1; - } - - bool CXBMCRenderManager::HasFreeBuffer() -@@ -1017,6 +1037,7 @@ void CXBMCRenderManager::ResetRenderBuffer() - m_sleeptime = 1.0; - m_presentPts = DVD_NOPTS_VALUE; - m_speed = 0; -+ m_bRenderBufferUsed = false; - } - - void CXBMCRenderManager::PrepareNextRender() -diff --git a/xbmc/cores/VideoRenderers/RenderManager.h b/xbmc/cores/VideoRenderers/RenderManager.h -index 49da2ed..afb6b1f 100644 ---- a/xbmc/cores/VideoRenderers/RenderManager.h -+++ b/xbmc/cores/VideoRenderers/RenderManager.h -@@ -103,11 +103,7 @@ class CXBMCRenderManager - void UnInit(); - bool Flush(); - -- void AddOverlay(CDVDOverlay* o, double pts) -- { -- CSharedLock lock(m_sharedSection); -- m_overlays.AddOverlay(o, pts, (m_iOutputRenderBuffer + 1) % m_iNumRenderBuffers); -- } -+ void AddOverlay(CDVDOverlay* o, double pts); - - void AddCleanup(OVERLAY::COverlay* o) - { -@@ -255,6 +251,7 @@ class CXBMCRenderManager - bool m_bUseBuffering; - bool m_bCodecSupportsBuffering; - int m_speed; -+ bool m_bRenderBufferUsed; - CEvent m_flipEvent; - - struct --- -1.8.1.6 - - -From dd0e5f0255697d390b1c2905821b056059a9fb1c Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Tue, 19 Feb 2013 09:06:22 +0100 -Subject: [PATCH 10/94] move NUM_BUFFERS up to BaseRenderer.h - ---- - xbmc/cores/VideoRenderers/BaseRenderer.h | 3 ++- - xbmc/cores/VideoRenderers/LinuxRendererGL.h | 2 -- - xbmc/cores/VideoRenderers/LinuxRendererGLES.h | 2 -- - xbmc/cores/VideoRenderers/OverlayRenderer.cpp | 2 +- - xbmc/cores/VideoRenderers/OverlayRenderer.h | 3 ++- - xbmc/cores/VideoRenderers/WinRenderer.h | 2 -- - 6 files changed, 5 insertions(+), 9 deletions(-) - -diff --git a/xbmc/cores/VideoRenderers/BaseRenderer.h b/xbmc/cores/VideoRenderers/BaseRenderer.h -index aa1e4ae..60b7197 100644 ---- a/xbmc/cores/VideoRenderers/BaseRenderer.h -+++ b/xbmc/cores/VideoRenderers/BaseRenderer.h -@@ -26,10 +26,11 @@ - - #define MAX_PLANES 3 - #define MAX_FIELDS 3 -+#define NUM_BUFFERS 10 - - typedef struct YV12Image - { -- BYTE * plane[MAX_PLANES]; -+ uint8_t* plane[MAX_PLANES]; - int planesize[MAX_PLANES]; - unsigned stride[MAX_PLANES]; - unsigned width; -diff --git a/xbmc/cores/VideoRenderers/LinuxRendererGL.h b/xbmc/cores/VideoRenderers/LinuxRendererGL.h -index 7c9fcae..a7b5886 100644 ---- a/xbmc/cores/VideoRenderers/LinuxRendererGL.h -+++ b/xbmc/cores/VideoRenderers/LinuxRendererGL.h -@@ -44,8 +44,6 @@ - namespace Shaders { class BaseVideoFilterShader; } - namespace VAAPI { struct CHolder; } - --#define NUM_BUFFERS 10 -- - - #undef ALIGN - #define ALIGN(value, alignment) (((value)+((alignment)-1))&~((alignment)-1)) -diff --git a/xbmc/cores/VideoRenderers/LinuxRendererGLES.h b/xbmc/cores/VideoRenderers/LinuxRendererGLES.h -index 5bae10d..fe32eff 100644 ---- a/xbmc/cores/VideoRenderers/LinuxRendererGLES.h -+++ b/xbmc/cores/VideoRenderers/LinuxRendererGLES.h -@@ -41,8 +41,6 @@ - class COpenMaxVideo; - typedef std::vector Features; - --#define NUM_BUFFERS 10 -- - - #undef ALIGN - #define ALIGN(value, alignment) (((value)+((alignment)-1))&~((alignment)-1)) -diff --git a/xbmc/cores/VideoRenderers/OverlayRenderer.cpp b/xbmc/cores/VideoRenderers/OverlayRenderer.cpp -index f7f74ce..5236390 100644 ---- a/xbmc/cores/VideoRenderers/OverlayRenderer.cpp -+++ b/xbmc/cores/VideoRenderers/OverlayRenderer.cpp -@@ -93,7 +93,7 @@ long COverlayMainThread::Release() - - CRenderer::~CRenderer() - { -- for(int i = 0; i < 10; i++) -+ for(int i = 0; i < NUM_BUFFERS; i++) - Release(m_buffers[i]); - } - -diff --git a/xbmc/cores/VideoRenderers/OverlayRenderer.h b/xbmc/cores/VideoRenderers/OverlayRenderer.h -index 0921fc5..66c592a 100644 ---- a/xbmc/cores/VideoRenderers/OverlayRenderer.h -+++ b/xbmc/cores/VideoRenderers/OverlayRenderer.h -@@ -23,6 +23,7 @@ - #pragma once - - #include "threads/CriticalSection.h" -+#include "BaseRenderer.h" - - #include - -@@ -126,7 +127,7 @@ - void Release(SElementV& list); - - CCriticalSection m_section; -- SElementV m_buffers[10]; -+ SElementV m_buffers[NUM_BUFFERS]; - int m_iNumBuffers; - int m_decode; - int m_render; -diff --git a/xbmc/cores/VideoRenderers/WinRenderer.h b/xbmc/cores/VideoRenderers/WinRenderer.h -index b3448ed..b099697 100644 ---- a/xbmc/cores/VideoRenderers/WinRenderer.h -+++ b/xbmc/cores/VideoRenderers/WinRenderer.h -@@ -32,8 +32,6 @@ - #include "cores/VideoRenderers/RenderFlags.h" - #include "cores/VideoRenderers/RenderFormats.h" - --#define NUM_BUFFERS 10 -- - #define ALIGN(value, alignment) (((value)+((alignment)-1))&~((alignment)-1)) - #define CLAMP(a, min, max) ((a) > (max) ? (max) : ( (a) < (min) ? (min) : a )) - --- -1.8.1.6 - - -From 10a92f0e407b43648de119586f156bb279210ea2 Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Sun, 24 Feb 2013 09:55:00 +0100 -Subject: [PATCH 11/94] OverlayRenderer: align buffers with index in - renderManager - ---- - xbmc/cores/VideoRenderers/OverlayRenderer.cpp | 26 +++++++++++++++++--------- - xbmc/cores/VideoRenderers/OverlayRenderer.h | 8 ++++---- - xbmc/cores/VideoRenderers/RenderManager.cpp | 11 +++++++---- - xbmc/cores/VideoRenderers/RenderManager.h | 1 + - 4 files changed, 29 insertions(+), 17 deletions(-) - -diff --git a/xbmc/cores/VideoRenderers/OverlayRenderer.cpp b/xbmc/cores/VideoRenderers/OverlayRenderer.cpp -index 5236390..5592eca 100644 ---- a/xbmc/cores/VideoRenderers/OverlayRenderer.cpp -+++ b/xbmc/cores/VideoRenderers/OverlayRenderer.cpp -@@ -127,27 +127,32 @@ void CRenderer::AddCleanup(COverlay* o) - m_cleanup.push_back(o->Acquire()); - } - --void CRenderer::Release(SElementV& list) -+long CRenderer::Release(SElementV& list) - { - SElementV l = list; - list.clear(); - -+ long count = 0; - for(SElementV::iterator it = l.begin(); it != l.end(); it++) - { - if(it->overlay) -- it->overlay->Release(); -+ count += it->overlay->Release(); - if(it->overlay_dvd) -- it->overlay_dvd->Release(); -+ count += it->overlay_dvd->Release(); - } -+ return count; - } - --void CRenderer::Release(COverlayV& list) -+long CRenderer::Release(COverlayV& list) - { - COverlayV l = list; - list.clear(); - -+ long count = 0; - for(COverlayV::iterator it = l.begin(); it != l.end(); it++) -- (*it)->Release(); -+ count += (*it)->Release(); -+ -+ return count; - } - - void CRenderer::Flush() -@@ -161,16 +166,19 @@ void CRenderer::Flush() - Release(m_cleanup); - } - --void CRenderer::Flip() -+void CRenderer::Flip(int source) - { - CSingleLock lock(m_section); -- m_render = (m_render + 1) % m_iNumBuffers; -+ if( source >= 0 && source < m_iNumBuffers ) -+ m_render = source; -+ else -+ m_render = (m_render + 1) % m_iNumBuffers; - } - --void CRenderer::ReleaseBuffer(int idx) -+long CRenderer::ReleaseBuffer(int idx) - { - CSingleLock lock(m_section); -- Release(m_buffers[idx]); -+ return Release(m_buffers[idx]); - } - - void CRenderer::Render() -diff --git a/xbmc/cores/VideoRenderers/OverlayRenderer.h b/xbmc/cores/VideoRenderers/OverlayRenderer.h -index 66c592a..627dd9f 100644 ---- a/xbmc/cores/VideoRenderers/OverlayRenderer.h -+++ b/xbmc/cores/VideoRenderers/OverlayRenderer.h -@@ -96,11 +96,11 @@ - void AddOverlay(CDVDOverlay* o, double pts, int index); - void AddOverlay(COverlay* o, double pts, int index); - void AddCleanup(COverlay* o); -- void Flip(); -+ void Flip(int source); - void Render(); - void Flush(); - void SetNumBuffers(int numBuffers) { m_iNumBuffers = numBuffers; } -- void ReleaseBuffer(int idx); -+ long ReleaseBuffer(int idx); - - protected: - -@@ -123,8 +123,8 @@ - COverlay* Convert(CDVDOverlay* o, double pts); - COverlay* Convert(CDVDOverlaySSA* o, double pts); - -- void Release(COverlayV& list); -- void Release(SElementV& list); -+ long Release(COverlayV& list); -+ long Release(SElementV& list); - - CCriticalSection m_section; - SElementV m_buffers[NUM_BUFFERS]; -diff --git a/xbmc/cores/VideoRenderers/RenderManager.cpp b/xbmc/cores/VideoRenderers/RenderManager.cpp -index f5cc0f6..e887313 100644 ---- a/xbmc/cores/VideoRenderers/RenderManager.cpp -+++ b/xbmc/cores/VideoRenderers/RenderManager.cpp -@@ -303,7 +303,7 @@ void CXBMCRenderManager::RenderUpdate(bool clear, DWORD flags, DWORD alpha) - if(m_presentstep == PRESENT_FLIP) - { - FlipRenderBuffer(); -- m_overlays.Flip(); -+ m_overlays.Flip(m_presentsource); - m_pRenderer->FlipPage(m_presentsource); - m_presentstep = PRESENT_FRAME; - m_presentevent.Set(); -@@ -703,7 +703,7 @@ void CXBMCRenderManager::Present() - if(m_presentstep == PRESENT_FLIP) - { - FlipRenderBuffer(); -- m_overlays.Flip(); -+ m_overlays.Flip(m_presentsource); - m_pRenderer->FlipPage(m_presentsource); - m_presentstep = PRESENT_FRAME; - m_presentevent.Set(); -@@ -986,11 +986,12 @@ int CXBMCRenderManager::FlipFreeBuffer() - // See "Render Buffer State Description" in header for information. - if (HasFreeBuffer()) - { -- if (!m_bRenderBufferUsed) -+ if (!m_bRenderBufferUsed && !m_bOverlayReleased) - { - return -1; - } - m_bRenderBufferUsed = false; -+ m_bOverlayReleased = false; - m_bAllRenderBuffersDisplayed = false; - m_iOutputRenderBuffer = (m_iOutputRenderBuffer + 1) % m_iNumRenderBuffers; - return m_iOutputRenderBuffer; -@@ -1038,6 +1039,7 @@ void CXBMCRenderManager::ResetRenderBuffer() - m_presentPts = DVD_NOPTS_VALUE; - m_speed = 0; - m_bRenderBufferUsed = false; -+ m_bOverlayReleased = false; - } - - void CXBMCRenderManager::PrepareNextRender() -@@ -1116,7 +1118,8 @@ void CXBMCRenderManager::NotifyDisplayFlip() - && m_iDisplayedRenderBuffer != m_iCurrentRenderBuffer) - { - m_pRenderer->ReleaseBuffer(m_iDisplayedRenderBuffer); -- m_overlays.ReleaseBuffer(m_iDisplayedRenderBuffer); -+ if (m_overlays.ReleaseBuffer(m_iDisplayedRenderBuffer) > 0) -+ m_bOverlayReleased = true; - } - } - -diff --git a/xbmc/cores/VideoRenderers/RenderManager.h b/xbmc/cores/VideoRenderers/RenderManager.h -index afb6b1f..3f95793 100644 ---- a/xbmc/cores/VideoRenderers/RenderManager.h -+++ b/xbmc/cores/VideoRenderers/RenderManager.h -@@ -252,6 +252,7 @@ class CXBMCRenderManager - bool m_bCodecSupportsBuffering; - int m_speed; - bool m_bRenderBufferUsed; -+ bool m_bOverlayReleased; - CEvent m_flipEvent; - - struct --- -1.8.1.6 - - -From 7dfb8e80deb4e196da0f7b9753cbffb4c0d2f84d Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Tue, 26 Feb 2013 09:00:21 +0100 -Subject: [PATCH 12/94] add buffering - submit absolute time to render buffers - ---- - xbmc/cores/IPlayer.h | 5 ----- - xbmc/cores/VideoRenderers/RenderManager.cpp | 20 +++----------------- - xbmc/cores/VideoRenderers/RenderManager.h | 5 ++--- - xbmc/cores/dvdplayer/DVDPlayer.cpp | 5 ----- - xbmc/cores/dvdplayer/DVDPlayer.h | 2 -- - xbmc/cores/dvdplayer/DVDPlayerVideo.cpp | 2 +- - 6 files changed, 6 insertions(+), 33 deletions(-) - -diff --git a/xbmc/cores/IPlayer.h b/xbmc/cores/IPlayer.h -index cbf2faa..f2aa227 100644 ---- a/xbmc/cores/IPlayer.h -+++ b/xbmc/cores/IPlayer.h -@@ -229,11 +229,6 @@ class IPlayer - */ - virtual void GetSubtitleCapabilities(std::vector &subCaps) { subCaps.assign(1,IPC_SUBS_ALL); }; - -- /*! -- \brief called by RenderManager in order to schedule frames -- */ -- virtual double GetClock(double& absolute, bool interpolated = true) {return 0; }; -- - protected: - IPlayerCallback& m_callback; - }; -diff --git a/xbmc/cores/VideoRenderers/RenderManager.cpp b/xbmc/cores/VideoRenderers/RenderManager.cpp -index e887313..a2001c0 100644 ---- a/xbmc/cores/VideoRenderers/RenderManager.cpp -+++ b/xbmc/cores/VideoRenderers/RenderManager.cpp -@@ -571,7 +571,6 @@ void CXBMCRenderManager::FlipPage(volatile bool& bStop, double timestamp /* = 0L - { CRetakeLock lock(m_sharedSection); - if(!m_pRenderer) return; - -- double presenttime = timestamp; - EFIELDSYNC presentfield = sync; - EPRESENTMETHOD presentmethod; - -@@ -614,7 +613,7 @@ void CXBMCRenderManager::FlipPage(volatile bool& bStop, double timestamp /* = 0L - - if (FlipFreeBuffer() >= 0) - { -- m_renderBuffers[m_iOutputRenderBuffer].pts = timestamp; -+ m_renderBuffers[m_iOutputRenderBuffer].timestamp = timestamp; - m_renderBuffers[m_iOutputRenderBuffer].presentfield = presentfield; - m_renderBuffers[m_iOutputRenderBuffer].presentmethod = presentmethod; - } -@@ -1036,7 +1035,6 @@ void CXBMCRenderManager::ResetRenderBuffer() - m_iDisplayedRenderBuffer = 0; - m_bAllRenderBuffersDisplayed = true; - m_sleeptime = 1.0; -- m_presentPts = DVD_NOPTS_VALUE; - m_speed = 0; - m_bRenderBufferUsed = false; - m_bOverlayReleased = false; -@@ -1053,19 +1051,8 @@ void CXBMCRenderManager::PrepareNextRender() - return; - } - -- double iClockSleep, iPlayingClock, iCurrentClock; -- if (g_application.m_pPlayer) -- iPlayingClock = g_application.m_pPlayer->GetClock(iCurrentClock, false); -- else -- iPlayingClock = iCurrentClock = 0; -- -- iClockSleep = m_renderBuffers[idx].pts - iPlayingClock; -- -- if (m_speed) -- iClockSleep = iClockSleep * DVD_PLAYSPEED_NORMAL / m_speed; -- -- double presenttime = (iCurrentClock + iClockSleep) / DVD_TIME_BASE; -- double clocktime = iCurrentClock / DVD_TIME_BASE; -+ double presenttime = m_renderBuffers[idx].timestamp; -+ double clocktime = GetPresentTime(); - if(presenttime - clocktime > MAXPRESENTDELAY) - presenttime = clocktime + MAXPRESENTDELAY; - -@@ -1074,7 +1061,6 @@ void CXBMCRenderManager::PrepareNextRender() - - if (g_graphicsContext.IsFullScreenVideo() || presenttime <= clocktime + frametime) - { -- m_presentPts = m_renderBuffers[idx].pts; - m_presenttime = presenttime; - m_presentmethod = m_renderBuffers[idx].presentmethod; - m_presentfield = m_renderBuffers[idx].presentfield; -diff --git a/xbmc/cores/VideoRenderers/RenderManager.h b/xbmc/cores/VideoRenderers/RenderManager.h -index 3f95793..858a547 100644 ---- a/xbmc/cores/VideoRenderers/RenderManager.h -+++ b/xbmc/cores/VideoRenderers/RenderManager.h -@@ -93,7 +93,7 @@ class CXBMCRenderManager - * available after the main thread has flipped front / back buffers. - * - * @param bStop reference to stop flag of calling thread -- * @param timestamp pts of frame delivered with AddVideoPicture -+ * @param timestamp of frame delivered with AddVideoPicture - * @param source depreciated - * @param sync signals frame, top, or bottom field - * @param speed current speed of player, needed for some optimizations like keeping the gui responsive on rewind -@@ -257,13 +257,12 @@ class CXBMCRenderManager - - struct - { -- double pts; -+ double timestamp; - EFIELDSYNC presentfield; - EPRESENTMETHOD presentmethod; - }m_renderBuffers[5]; - - double m_sleeptime; -- double m_presentPts; - - double m_presenttime; - double m_presentcorr; -diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp -index bd55060..e5a1e71 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayer.cpp -+++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp -@@ -4097,8 +4097,3 @@ bool CDVDPlayer::CachePVRStream(void) const - !g_PVRManager.IsPlayingRecording() && - g_advancedSettings.m_bPVRCacheInDvdPlayer; - } -- --double CDVDPlayer::GetClock(double& absolute, bool interpolated) --{ -- return m_clock.GetClock(absolute, interpolated); --} -diff --git a/xbmc/cores/dvdplayer/DVDPlayer.h b/xbmc/cores/dvdplayer/DVDPlayer.h -index 2d1b163..ebe0ce8 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayer.h -+++ b/xbmc/cores/dvdplayer/DVDPlayer.h -@@ -252,8 +252,6 @@ class CDVDPlayer : public IPlayer, public CThread, public IDVDPlayer - virtual bool SwitchChannel(const PVR::CPVRChannel &channel); - virtual bool CachePVRStream(void) const; - -- virtual double GetClock(double& absolute, bool interpolated = true); -- - enum ECacheState - { CACHESTATE_DONE = 0 - , CACHESTATE_FULL // player is filling up the demux queue -diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -index 3bfe180..a90c141 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -+++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -@@ -1363,7 +1363,7 @@ int CDVDPlayerVideo::OutputPicture(const DVDVideoPicture* src, double pts) - if (index < 0) - return EOS_DROPPED; - -- g_renderManager.FlipPage(CThread::m_bStop, pts, -1, mDisplayField, m_speed); -+ g_renderManager.FlipPage(CThread::m_bStop, (iCurrentClock + iSleepTime) / DVD_TIME_BASE, -1, mDisplayField, m_speed); - - return result; - #else --- -1.8.1.6 - - -From 6831c2ace51d439657bb068ff4a9176adc0563a8 Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Fri, 1 Mar 2013 08:05:00 +0100 -Subject: [PATCH 13/94] RenderManager: some rework, squash add buffering - ---- - xbmc/cores/VideoRenderers/RenderManager.cpp | 18 ++++++++++-------- - 1 file changed, 10 insertions(+), 8 deletions(-) - -diff --git a/xbmc/cores/VideoRenderers/RenderManager.cpp b/xbmc/cores/VideoRenderers/RenderManager.cpp -index a2001c0..09daaef 100644 ---- a/xbmc/cores/VideoRenderers/RenderManager.cpp -+++ b/xbmc/cores/VideoRenderers/RenderManager.cpp -@@ -616,6 +616,8 @@ void CXBMCRenderManager::FlipPage(volatile bool& bStop, double timestamp /* = 0L - m_renderBuffers[m_iOutputRenderBuffer].timestamp = timestamp; - m_renderBuffers[m_iOutputRenderBuffer].presentfield = presentfield; - m_renderBuffers[m_iOutputRenderBuffer].presentmethod = presentmethod; -+ if (!m_bUseBuffering) -+ PrepareNextRender(); - } - m_speed = speed; - } -@@ -825,17 +827,17 @@ int CXBMCRenderManager::AddVideoPicture(DVDVideoPicture& pic) - if (!m_pRenderer) - return -1; - -- if(m_pRenderer->AddVideoPicture(&pic, (m_iOutputRenderBuffer + 1) % m_iNumRenderBuffers)) -+ int index = (m_iOutputRenderBuffer + 1) % m_iNumRenderBuffers; -+ -+ if(m_pRenderer->AddVideoPicture(&pic, index)) - { - m_bRenderBufferUsed = true; - return 1; - } - - YV12Image image; -- int index = m_pRenderer->GetImage(&image, (m_iOutputRenderBuffer + 1) % m_iNumRenderBuffers); -- -- if(index < 0) -- return index; -+ if (m_pRenderer->GetImage(&image, index) < 0) -+ return -1; - - if(pic.format == RENDER_FMT_YUV420P - || pic.format == RENDER_FMT_YUV420P10 -@@ -947,14 +949,14 @@ int CXBMCRenderManager::WaitForBuffer(volatile bool& bStop, int timeout) - if (!m_pRenderer) - return -1; - -- double maxwait = GetPresentTime() + (float)timeout/1000; -+ XbmcThreads::EndTime endtime(timeout); - while(!HasFreeBuffer() && !bStop) - { - lock.Leave(); - m_flipEvent.WaitMSec(std::min(50, timeout)); -- if(GetPresentTime() > maxwait && !bStop) -+ if(endtime.IsTimePast()) - { -- if (timeout != 0) -+ if (timeout != 0 && !bStop) - CLog::Log(LOGWARNING, "CRenderManager::WaitForBuffer - timeout waiting for buffer"); - return -1; - } --- -1.8.1.6 - - -From 8606471ef3785ee53ad1025a4af03d3b5147d22a Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Fri, 1 Mar 2013 08:07:07 +0100 -Subject: [PATCH 14/94] dvdplayer: disable buffering unil dropping is improved - ---- - xbmc/cores/dvdplayer/DVDPlayerVideo.cpp | 16 ++++++++-------- - 1 file changed, 8 insertions(+), 8 deletions(-) - -diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -index a90c141..c02bb96 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -+++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -@@ -1100,35 +1100,35 @@ int CDVDPlayerVideo::OutputPicture(const DVDVideoPicture* src, double pts) - { - case RENDER_FMT_YUV420P: - formatstr = "YV12"; -- buffering = true; -+ buffering = false; - break; - case RENDER_FMT_YUV420P16: - formatstr = "YV12P16"; -- buffering = true; -+ buffering = false; - break; - case RENDER_FMT_YUV420P10: - formatstr = "YV12P10"; -- buffering = true; -+ buffering = false; - break; - case RENDER_FMT_NV12: - formatstr = "NV12"; -- buffering = true; -+ buffering = false; - break; - case RENDER_FMT_UYVY422: - formatstr = "UYVY"; -- buffering = true; -+ buffering = false; - break; - case RENDER_FMT_YUYV422: - formatstr = "YUY2"; -- buffering = true; -+ buffering = false; - break; - case RENDER_FMT_VDPAU: - formatstr = "VDPAU"; -- buffering = true; -+ buffering = false; - break; - case RENDER_FMT_DXVA: - formatstr = "DXVA"; -- buffering = true; -+ buffering = false; - break; - case RENDER_FMT_VAAPI: - formatstr = "VAAPI"; --- -1.8.1.6 - - -From 5abcce89d20fed5503a9bc4d441700e5274de8e7 Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Sat, 2 Mar 2013 12:00:51 +0100 -Subject: [PATCH 15/94] RenderManager: skip very late frames in render buffer - ---- - xbmc/cores/VideoRenderers/RenderManager.cpp | 21 +++++++++++++++++++-- - 1 file changed, 19 insertions(+), 2 deletions(-) - -diff --git a/xbmc/cores/VideoRenderers/RenderManager.cpp b/xbmc/cores/VideoRenderers/RenderManager.cpp -index 09daaef..9897f1c 100644 ---- a/xbmc/cores/VideoRenderers/RenderManager.cpp -+++ b/xbmc/cores/VideoRenderers/RenderManager.cpp -@@ -1053,13 +1053,30 @@ void CXBMCRenderManager::PrepareNextRender() - return; - } - -- double presenttime = m_renderBuffers[idx].timestamp; - double clocktime = GetPresentTime(); -+ double frametime = 1 / g_graphicsContext.GetFPS(); -+ -+ // look ahead in the queue -+ // if the next frame is already late, skip the one we are about to render -+ while (idx != m_iOutputRenderBuffer) -+ { -+ int idx_next = (idx + 1) % m_iNumRenderBuffers; -+ if (m_renderBuffers[idx_next].timestamp <= clocktime) -+ { -+ FlipRenderBuffer(); -+ idx = GetNextRenderBufferIndex(); -+ CLog::Log(LOGDEBUG,"%s - skip frame at render buffer index: %d", __FUNCTION__, idx); -+ } -+ else -+ break; -+ } -+ -+ double presenttime = m_renderBuffers[idx].timestamp; -+ - if(presenttime - clocktime > MAXPRESENTDELAY) - presenttime = clocktime + MAXPRESENTDELAY; - - m_sleeptime = presenttime - clocktime; -- double frametime = 1 / g_graphicsContext.GetFPS(); - - if (g_graphicsContext.IsFullScreenVideo() || presenttime <= clocktime + frametime) - { --- -1.8.1.6 - - -From 39311d81fe5dc4c2b9921564de9cfa78d9512c3a Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Sat, 2 Mar 2013 12:10:17 +0100 -Subject: [PATCH 16/94] renderbuffers: drop enable/disable in this iteration - ---- - xbmc/cores/VideoRenderers/RenderManager.cpp | 4 ++++ - xbmc/cores/dvdplayer/DVDPlayerVideo.cpp | 4 ---- - 2 files changed, 4 insertions(+), 4 deletions(-) - -diff --git a/xbmc/cores/VideoRenderers/RenderManager.cpp b/xbmc/cores/VideoRenderers/RenderManager.cpp -index 9897f1c..e479adc 100644 ---- a/xbmc/cores/VideoRenderers/RenderManager.cpp -+++ b/xbmc/cores/VideoRenderers/RenderManager.cpp -@@ -266,6 +266,7 @@ bool CXBMCRenderManager::Configure(unsigned int width, unsigned int height, unsi - m_presentstep = PRESENT_IDLE; - m_presentevent.Set(); - ResetRenderBuffer(); -+ EnableBuffering(buffering); - } - - return result; -@@ -1093,7 +1094,10 @@ void CXBMCRenderManager::EnableBuffering(bool enable) - CRetakeLock lock(m_sharedSection); - - if (m_iNumRenderBuffers < 3) -+ { -+ m_bUseBuffering = false; - return; -+ } - - m_bUseBuffering = enable; - if (!m_bUseBuffering) -diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -index c02bb96..1d3c7e3 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -+++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -@@ -261,7 +261,6 @@ void CDVDPlayerVideo::OpenStream(CDVDStreamInfo &hint, CDVDVideoCodec* codec) - m_stalled = m_messageQueue.GetPacketCount(CDVDMsg::DEMUXER_PACKET) == 0; - m_started = false; - m_codecname = m_pVideoCodec->GetName(); -- g_renderManager.EnableBuffering(false); - } - - void CDVDPlayerVideo::CloseStream(bool bWaitForBuffers) -@@ -437,7 +436,6 @@ void CDVDPlayerVideo::Process() - picture.iFlags &= ~DVP_FLAG_ALLOCATED; - m_packets.clear(); - m_started = false; -- g_renderManager.EnableBuffering(false); - } - else if (pMsg->IsType(CDVDMsg::GENERAL_FLUSH)) // private message sent by (CDVDPlayerVideo::Flush()) - { -@@ -450,7 +448,6 @@ void CDVDPlayerVideo::Process() - //we need to recalculate the framerate - //TODO: this needs to be set on a streamchange instead - ResetFrameRateCalc(); -- g_renderManager.EnableBuffering(false); - - m_stalled = true; - m_started = false; -@@ -705,7 +702,6 @@ void CDVDPlayerVideo::Process() - m_codecname = m_pVideoCodec->GetName(); - m_started = true; - m_messageParent.Put(new CDVDMsgInt(CDVDMsg::PLAYER_STARTED, DVDPLAYER_VIDEO)); -- g_renderManager.EnableBuffering(true); - } - - // guess next frame pts. iDuration is always valid --- -1.8.1.6 - - -From 668e9a334b2ab22bad7196804a2a9992384c0d6e Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Sat, 2 Mar 2013 12:31:11 +0100 -Subject: [PATCH 17/94] RenderManager: add method SetSpeed - ---- - xbmc/cores/VideoRenderers/RenderManager.cpp | 10 +++++++--- - xbmc/cores/VideoRenderers/RenderManager.h | 8 ++++++-- - xbmc/cores/dvdplayer/DVDPlayerVideo.cpp | 3 ++- - 3 files changed, 15 insertions(+), 6 deletions(-) - -diff --git a/xbmc/cores/VideoRenderers/RenderManager.cpp b/xbmc/cores/VideoRenderers/RenderManager.cpp -index e479adc..dc984cf 100644 ---- a/xbmc/cores/VideoRenderers/RenderManager.cpp -+++ b/xbmc/cores/VideoRenderers/RenderManager.cpp -@@ -550,7 +550,7 @@ void CXBMCRenderManager::SetViewMode(int iViewMode) - m_pRenderer->SetViewMode(iViewMode); - } - --void CXBMCRenderManager::FlipPage(volatile bool& bStop, double timestamp /* = 0LL*/, int source /*= -1*/, EFIELDSYNC sync /*= FS_NONE*/, int speed /*= 1000*/) -+void CXBMCRenderManager::FlipPage(volatile bool& bStop, double timestamp /* = 0LL*/, int source /*= -1*/, EFIELDSYNC sync /*= FS_NONE*/) - { - if (!m_bUseBuffering) - { -@@ -620,7 +620,6 @@ void CXBMCRenderManager::FlipPage(volatile bool& bStop, double timestamp /* = 0L - if (!m_bUseBuffering) - PrepareNextRender(); - } -- m_speed = speed; - } - - g_application.NewFrame(); -@@ -1038,7 +1037,7 @@ void CXBMCRenderManager::ResetRenderBuffer() - m_iDisplayedRenderBuffer = 0; - m_bAllRenderBuffersDisplayed = true; - m_sleeptime = 1.0; -- m_speed = 0; -+ m_speed = DVD_PLAYSPEED_NORMAL; - m_bRenderBufferUsed = false; - m_bOverlayReleased = false; - } -@@ -1112,6 +1111,11 @@ void CXBMCRenderManager::DiscardBuffer() - m_iOutputRenderBuffer = m_iCurrentRenderBuffer; - } - -+void CXBMCRenderManager::SetSpeed(int speed) -+{ -+ m_speed = speed; -+} -+ - void CXBMCRenderManager::NotifyDisplayFlip() - { - CRetakeLock lock(m_sharedSection); -diff --git a/xbmc/cores/VideoRenderers/RenderManager.h b/xbmc/cores/VideoRenderers/RenderManager.h -index 858a547..c9edb64 100644 ---- a/xbmc/cores/VideoRenderers/RenderManager.h -+++ b/xbmc/cores/VideoRenderers/RenderManager.h -@@ -96,9 +96,8 @@ class CXBMCRenderManager - * @param timestamp of frame delivered with AddVideoPicture - * @param source depreciated - * @param sync signals frame, top, or bottom field -- * @param speed current speed of player, needed for some optimizations like keeping the gui responsive on rewind - */ -- void FlipPage(volatile bool& bStop, double timestamp = 0.0, int source = -1, EFIELDSYNC sync = FS_NONE, int speed = 1000); -+ void FlipPage(volatile bool& bStop, double timestamp = 0.0, int source = -1, EFIELDSYNC sync = FS_NONE); - unsigned int PreInit(); - void UnInit(); - bool Flush(); -@@ -188,6 +187,11 @@ class CXBMCRenderManager - */ - void DiscardBuffer(); - -+ /** -+ * notify RenderManager about play speed -+ */ -+ void SetSpeed(int speed); -+ - protected: - void Render(bool clear, DWORD flags, DWORD alpha); - -diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -index 1d3c7e3..db4f7bd 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -+++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -@@ -465,6 +465,7 @@ void CDVDPlayerVideo::Process() - m_speed = static_cast(pMsg)->m_value; - if(m_speed == DVD_PLAYSPEED_PAUSE) - m_iNrOfPicturesNotToSkip = 0; -+ g_renderManager.SetSpeed(m_speed); - } - else if (pMsg->IsType(CDVDMsg::PLAYER_STARTED)) - { -@@ -1359,7 +1360,7 @@ int CDVDPlayerVideo::OutputPicture(const DVDVideoPicture* src, double pts) - if (index < 0) - return EOS_DROPPED; - -- g_renderManager.FlipPage(CThread::m_bStop, (iCurrentClock + iSleepTime) / DVD_TIME_BASE, -1, mDisplayField, m_speed); -+ g_renderManager.FlipPage(CThread::m_bStop, (iCurrentClock + iSleepTime) / DVD_TIME_BASE, -1, mDisplayField); - - return result; - #else --- -1.8.1.6 - - -From 80fc2f2b5a25d7bb987a3610c090bd79a7631480 Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Sun, 10 Feb 2013 18:40:30 +0100 -Subject: [PATCH 18/94] OMXPlayer: adapt to buffering - ---- - xbmc/cores/omxplayer/OMXPlayerVideo.cpp | 25 ++++++++----------------- - 1 file changed, 8 insertions(+), 17 deletions(-) - -diff --git a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp -index b181cbd..49e1b8c 100644 ---- a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp -+++ b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp -@@ -335,25 +335,16 @@ void OMXPlayerVideo::Output(int iGroupId, double pts, bool bDropPacket) - m_dropbase = 0.0f; - #endif - -- // DVDPlayer sleeps until m_iSleepEndTime here before calling FlipPage. -- // Video playback in asynchronous in OMXPlayer, so we don't want to do that here, as it prevents the video fifo from being kept full. -- // So, we keep track of when FlipPage would have been called on DVDPlayer and return early if it is not time. -- // m_iSleepEndTime == DVD_NOPTS_VALUE means we are not waiting to call FlipPage, otherwise it is the time we want to call FlipPage -- if (m_iSleepEndTime == DVD_NOPTS_VALUE) { -- m_iSleepEndTime = iCurrentClock + iSleepTime; -- } -- -- if (!CThread::m_bStop && m_av_clock->GetAbsoluteClock(false) < m_iSleepEndTime + DVD_MSEC_TO_TIME(500)) -+ int buffer = g_renderManager.WaitForBuffer(m_bStop, 0); -+ if (buffer < 0) - return; - -- double pts_media = m_av_clock->OMXMediaTime(false); -- ProcessOverlays(iGroupId, pts_media); -- -- g_renderManager.FlipPage(CThread::m_bStop, m_iSleepEndTime / DVD_TIME_BASE, -1, FS_NONE); -- -- m_iSleepEndTime = DVD_NOPTS_VALUE; -+ double pts_overlay = m_av_clock->OMXMediaTime(false) -+ + 2 * iFrameDuration; -+ ProcessOverlays(iGroupId, pts_overlay); - -- //m_av_clock->WaitAbsoluteClock((iCurrentClock + iSleepTime)); -+ double timestamp = (CDVDClock::GetAbsoluteClock(false) + 2 * iFrameDuration) / DVD_TIME_BASE; -+ g_renderManager.FlipPage(CThread::m_bStop, timestamp, -1, FS_NONE); - } - - void OMXPlayerVideo::Process() -@@ -794,7 +785,7 @@ void OMXPlayerVideo::ResolutionUpdateCallBack(uint32_t width, uint32_t height) - - if(!g_renderManager.Configure(width, height, - iDisplayWidth, iDisplayHeight, m_fFrameRate, flags, format, 0, -- m_hints.orientation)) -+ m_hints.orientation, true)) - { - CLog::Log(LOGERROR, "%s - failed to configure renderer", __FUNCTION__); - return; --- -1.8.1.6 - - -From cb3ed9e675b1a3cd08b2a2577d5730312af166ff Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Sat, 2 Mar 2013 20:42:10 +0100 -Subject: [PATCH 19/94] overlays: squash to - b0b5c7c825b0265c5e7c888a48a76d11eb719246 - ---- - xbmc/cores/VideoRenderers/OverlayRenderer.cpp | 19 +++++++++---------- - xbmc/cores/VideoRenderers/OverlayRenderer.h | 4 ++-- - xbmc/cores/VideoRenderers/RenderManager.cpp | 4 +++- - 3 files changed, 14 insertions(+), 13 deletions(-) - -diff --git a/xbmc/cores/VideoRenderers/OverlayRenderer.cpp b/xbmc/cores/VideoRenderers/OverlayRenderer.cpp -index 5592eca..8559720 100644 ---- a/xbmc/cores/VideoRenderers/OverlayRenderer.cpp -+++ b/xbmc/cores/VideoRenderers/OverlayRenderer.cpp -@@ -127,32 +127,31 @@ void CRenderer::AddCleanup(COverlay* o) - m_cleanup.push_back(o->Acquire()); - } - --long CRenderer::Release(SElementV& list) -+bool CRenderer::Release(SElementV& list) - { - SElementV l = list; - list.clear(); - -- long count = 0; -+ bool change = false; - for(SElementV::iterator it = l.begin(); it != l.end(); it++) - { - if(it->overlay) -- count += it->overlay->Release(); -+ it->overlay->Release(); - if(it->overlay_dvd) -- count += it->overlay_dvd->Release(); -+ it->overlay_dvd->Release(); -+ -+ change = true; - } -- return count; -+ return change; - } - --long CRenderer::Release(COverlayV& list) -+void CRenderer::Release(COverlayV& list) - { - COverlayV l = list; - list.clear(); - -- long count = 0; - for(COverlayV::iterator it = l.begin(); it != l.end(); it++) -- count += (*it)->Release(); -- -- return count; -+ (*it)->Release(); - } - - void CRenderer::Flush() -diff --git a/xbmc/cores/VideoRenderers/OverlayRenderer.h b/xbmc/cores/VideoRenderers/OverlayRenderer.h -index 627dd9f..e0c497d 100644 ---- a/xbmc/cores/VideoRenderers/OverlayRenderer.h -+++ b/xbmc/cores/VideoRenderers/OverlayRenderer.h -@@ -123,8 +123,8 @@ - COverlay* Convert(CDVDOverlay* o, double pts); - COverlay* Convert(CDVDOverlaySSA* o, double pts); - -- long Release(COverlayV& list); -- long Release(SElementV& list); -+ void Release(COverlayV& list); -+ bool Release(SElementV& list); - - CCriticalSection m_section; - SElementV m_buffers[NUM_BUFFERS]; -diff --git a/xbmc/cores/VideoRenderers/RenderManager.cpp b/xbmc/cores/VideoRenderers/RenderManager.cpp -index dc984cf..1343a71 100644 ---- a/xbmc/cores/VideoRenderers/RenderManager.cpp -+++ b/xbmc/cores/VideoRenderers/RenderManager.cpp -@@ -967,6 +967,8 @@ int CXBMCRenderManager::WaitForBuffer(volatile bool& bStop, int timeout) - if (bStop) - return -1; - -+ // make sure overlay buffer is released, this won't happen on AddOverlay -+ m_overlays.ReleaseBuffer((m_iOutputRenderBuffer + 1) % m_iNumRenderBuffers); - return 1; - } - -@@ -1131,7 +1133,7 @@ void CXBMCRenderManager::NotifyDisplayFlip() - && m_iDisplayedRenderBuffer != m_iCurrentRenderBuffer) - { - m_pRenderer->ReleaseBuffer(m_iDisplayedRenderBuffer); -- if (m_overlays.ReleaseBuffer(m_iDisplayedRenderBuffer) > 0) -+ if (m_overlays.ReleaseBuffer(m_iDisplayedRenderBuffer)) - m_bOverlayReleased = true; - } - } --- -1.8.1.6 - - -From 14d5bef5c13d8e469464778e55c8fa3bab345290 Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Mon, 28 May 2012 10:34:39 +0200 -Subject: [PATCH 20/94] videoplayer: adapt lateness detection and dropping to - buffering - ---- - xbmc/cores/VideoRenderers/RenderManager.cpp | 17 +- - xbmc/cores/VideoRenderers/RenderManager.h | 11 +- - .../dvdplayer/DVDCodecs/Video/DVDVideoCodec.h | 14 ++ - .../DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp | 31 +++ - .../DVDCodecs/Video/DVDVideoCodecFFmpeg.h | 7 + - xbmc/cores/dvdplayer/DVDPlayerVideo.cpp | 226 ++++++++++++++++----- - xbmc/cores/dvdplayer/DVDPlayerVideo.h | 24 +++ - 7 files changed, 282 insertions(+), 48 deletions(-) - -diff --git a/xbmc/cores/VideoRenderers/RenderManager.cpp b/xbmc/cores/VideoRenderers/RenderManager.cpp -index 1343a71..c4ca57e 100644 ---- a/xbmc/cores/VideoRenderers/RenderManager.cpp -+++ b/xbmc/cores/VideoRenderers/RenderManager.cpp -@@ -550,7 +550,7 @@ void CXBMCRenderManager::SetViewMode(int iViewMode) - m_pRenderer->SetViewMode(iViewMode); - } - --void CXBMCRenderManager::FlipPage(volatile bool& bStop, double timestamp /* = 0LL*/, int source /*= -1*/, EFIELDSYNC sync /*= FS_NONE*/) -+void CXBMCRenderManager::FlipPage(volatile bool& bStop, double timestamp /* = 0LL*/, double pts /* = 0 */, int source /*= -1*/, EFIELDSYNC sync /*= FS_NONE*/) - { - if (!m_bUseBuffering) - { -@@ -614,6 +614,7 @@ void CXBMCRenderManager::FlipPage(volatile bool& bStop, double timestamp /* = 0L - - if (FlipFreeBuffer() >= 0) - { -+ m_renderBuffers[m_iOutputRenderBuffer].pts = pts; - m_renderBuffers[m_iOutputRenderBuffer].timestamp = timestamp; - m_renderBuffers[m_iOutputRenderBuffer].presentfield = presentfield; - m_renderBuffers[m_iOutputRenderBuffer].presentmethod = presentmethod; -@@ -1040,6 +1041,7 @@ void CXBMCRenderManager::ResetRenderBuffer() - m_bAllRenderBuffersDisplayed = true; - m_sleeptime = 1.0; - m_speed = DVD_PLAYSPEED_NORMAL; -+ m_presentPts = DVD_NOPTS_VALUE; - m_bRenderBufferUsed = false; - m_bOverlayReleased = false; - } -@@ -1082,6 +1084,7 @@ void CXBMCRenderManager::PrepareNextRender() - - if (g_graphicsContext.IsFullScreenVideo() || presenttime <= clocktime + frametime) - { -+ m_presentPts = m_renderBuffers[idx].pts; - m_presenttime = presenttime; - m_presentmethod = m_renderBuffers[idx].presentmethod; - m_presentfield = m_renderBuffers[idx].presentfield; -@@ -1142,6 +1145,18 @@ void CXBMCRenderManager::NotifyDisplayFlip() - m_flipEvent.Set(); - } - -+bool CXBMCRenderManager::GetStats(double &sleeptime, double &pts, int &bufferLevel) -+{ -+ CSharedLock lock(m_sharedSection); -+ sleeptime = m_sleeptime; -+ pts = m_presentPts; -+ if (m_iNumRenderBuffers < 3) -+ bufferLevel = -1; -+ else -+ bufferLevel = (m_iOutputRenderBuffer - m_iCurrentRenderBuffer + m_iNumRenderBuffers) % m_iNumRenderBuffers; -+ return true; -+} -+ - bool CXBMCRenderManager::HasFrame() - { - CSharedLock lock(m_sharedSection); -diff --git a/xbmc/cores/VideoRenderers/RenderManager.h b/xbmc/cores/VideoRenderers/RenderManager.h -index c9edb64..b3e6547 100644 ---- a/xbmc/cores/VideoRenderers/RenderManager.h -+++ b/xbmc/cores/VideoRenderers/RenderManager.h -@@ -94,10 +94,11 @@ class CXBMCRenderManager - * - * @param bStop reference to stop flag of calling thread - * @param timestamp of frame delivered with AddVideoPicture -+ * @param pts used for lateness detection - * @param source depreciated - * @param sync signals frame, top, or bottom field - */ -- void FlipPage(volatile bool& bStop, double timestamp = 0.0, int source = -1, EFIELDSYNC sync = FS_NONE); -+ void FlipPage(volatile bool& bStop, double timestamp = 0.0, double pts = 0.0, int source = -1, EFIELDSYNC sync = FS_NONE); - unsigned int PreInit(); - void UnInit(); - bool Flush(); -@@ -177,6 +178,12 @@ class CXBMCRenderManager - bool HasFrame(); - - /** -+ * Can be called by player for lateness detection. This is done best by -+ * looking at the end of the queue. -+ */ -+ bool GetStats(double &sleeptime, double &pts, int &bufferLevel); -+ -+ /** - * Video player can dynamically enable/disable buffering. In situations like - * rewind buffering is not ideal. - */ -@@ -261,12 +268,14 @@ class CXBMCRenderManager - - struct - { -+ double pts; - double timestamp; - EFIELDSYNC presentfield; - EPRESENTMETHOD presentmethod; - }m_renderBuffers[5]; - - double m_sleeptime; -+ double m_presentPts; - - double m_presenttime; - double m_presentcorr; -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h -index 1d8bad3..5001aac 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h -@@ -110,6 +110,10 @@ struct DVDVideoUserData - #define DVP_FLAG_NOSKIP 0x00000010 // indicate this picture should never be dropped - #define DVP_FLAG_DROPPED 0x00000020 // indicate that this picture has been dropped in decoder stage, will have no data - -+#define DVP_FLAG_DROPDEINT 0x00000040 // indicate that this picture was requested to have been dropped in deint stage -+#define DVP_FLAG_NO_POSTPROC 0x00000100 -+#define DVP_FLAG_DRAIN 0x00000200 -+ - // DVP_FLAG 0x00000100 - 0x00000f00 is in use by libmpeg2! - - #define DVP_QSCALE_UNKNOWN 0 -@@ -127,6 +131,9 @@ struct DVDVideoUserData - #define VC_PICTURE 0x00000004 // the decoder got a picture, call Decode(NULL, 0) again to parse the rest of the data - #define VC_USERDATA 0x00000008 // the decoder found some userdata, call Decode(NULL, 0) again to parse the rest of the data - #define VC_FLUSHED 0x00000010 // the decoder lost it's state, we need to restart decoding again -+#define VC_DROPPED 0x00000020 // needed to identify if a picture was dropped -+#define VC_HURRY 0x00000040 -+ - class CDVDVideoCodec - { - public: -@@ -237,4 +244,11 @@ class CDVDVideoCodec - { - return 0; - } -+ -+ virtual bool GetPts(double &pts, int &skippedDeint, int &interlaced) -+ { -+ return false; -+ } -+ -+ virtual void SetCodecControl(int flags) {} - }; -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp -index 286fd67..dae3b8e 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp -@@ -142,6 +142,7 @@ enum PixelFormat CDVDVideoCodecFFmpeg::GetFormat( struct AVCodecContext * avctx - m_iLastKeyframe = 0; - m_dts = DVD_NOPTS_VALUE; - m_started = false; -+ m_decoderPts = DVD_NOPTS_VALUE; - } - - CDVDVideoCodecFFmpeg::~CDVDVideoCodecFFmpeg() -@@ -340,6 +341,14 @@ void CDVDVideoCodecFFmpeg::SetDropState(bool bDrop) - { - if( m_pCodecContext ) - { -+ if (bDrop && m_pHardware && m_pHardware->CanSkipDeint()) -+ { -+ m_requestSkipDeint = true; -+ bDrop = false; -+ } -+ else -+ m_requestSkipDeint = false; -+ - // i don't know exactly how high this should be set - // couldn't find any good docs on it. think it varies - // from codec to codec on what it does -@@ -541,6 +550,7 @@ int CDVDVideoCodecFFmpeg::Decode(BYTE* pData, int iSize, double dts, double pts) - void CDVDVideoCodecFFmpeg::Reset() - { - m_started = false; -+ m_decoderPts = DVD_NOPTS_VALUE; - m_iLastKeyframe = m_pCodecContext->has_b_frames; - m_dllAvCodec.avcodec_flush_buffers(m_pCodecContext); - -@@ -639,6 +649,22 @@ bool CDVDVideoCodecFFmpeg::GetPictureCommon(DVDVideoPicture* pDvdVideoPicture) - else - pDvdVideoPicture->pts = DVD_NOPTS_VALUE; - -+ if (pDvdVideoPicture->pts != DVD_NOPTS_VALUE) -+ m_decoderPts = pDvdVideoPicture->pts; -+ else -+ m_decoderPts = m_dts; -+ -+ if (m_requestSkipDeint) -+ { -+ pDvdVideoPicture->iFlags |= DVP_FLAG_DROPDEINT; -+ m_skippedDeint = 1; -+ } -+ else -+ m_skippedDeint = 0; -+ -+ m_requestSkipDeint = false; -+ pDvdVideoPicture->iFlags |= m_codecControlFlags; -+ - if(!m_started) - pDvdVideoPicture->iFlags |= DVP_FLAG_DROPPED; - -@@ -861,3 +887,8 @@ unsigned CDVDVideoCodecFFmpeg::GetConvergeCount() - else - return 0; - } -+ -+void CDVDVideoCodecFFmpeg::SetCodecControl(int flags) -+{ -+ m_codecControlFlags = flags; -+} -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.h -index 61d0305..52e1113 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.h -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.h -@@ -44,6 +44,7 @@ class CDVDVideoCodecFFmpeg : public CDVDVideoCodec - virtual bool GetPicture(AVCodecContext* avctx, AVFrame* frame, DVDVideoPicture* picture) = 0; - virtual int Check (AVCodecContext* avctx) = 0; - virtual void Reset () {} -+ virtual bool CanSkipDeint() {return false; } - virtual const std::string Name() = 0; - virtual CCriticalSection* Section() { return NULL; } - }; -@@ -60,6 +61,8 @@ class CDVDVideoCodecFFmpeg : public CDVDVideoCodec - virtual unsigned int SetFilters(unsigned int filters); - virtual const char* GetName() { return m_name.c_str(); }; // m_name is never changed after open - virtual unsigned GetConvergeCount(); -+ virtual bool GetPts(double &pts, int &skippedDeint, int &interlaced) {pts=m_decoderPts; skippedDeint=m_skippedDeint; if (m_pFrame) interlaced = m_pFrame->interlaced_frame; return true;} -+ virtual void SetCodecControl(int flags); - - bool IsHardwareAllowed() { return !m_bSoftware; } - IHardwareDecoder * GetHardware() { return m_pHardware; }; -@@ -119,4 +122,8 @@ class CDVDVideoCodecFFmpeg : public CDVDVideoCodec - double m_dts; - bool m_started; - std::vector m_formats; -+ double m_decoderPts, m_decoderInterval; -+ int m_skippedDeint; -+ bool m_requestSkipDeint; -+ int m_codecControlFlags; - }; -diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -index db4f7bd..5484073 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -+++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -@@ -325,8 +325,10 @@ void CDVDPlayerVideo::Process() - - int iDropped = 0; //frames dropped in a row - bool bRequestDrop = false; -+ int iDropDirective; - - m_videoStats.Start(); -+ m_droppingStats.Reset(); - - while (!m_bStop) - { -@@ -436,6 +438,7 @@ void CDVDPlayerVideo::Process() - picture.iFlags &= ~DVP_FLAG_ALLOCATED; - m_packets.clear(); - m_started = false; -+ m_droppingStats.Reset(); - } - else if (pMsg->IsType(CDVDMsg::GENERAL_FLUSH)) // private message sent by (CDVDPlayerVideo::Flush()) - { -@@ -448,6 +451,7 @@ void CDVDPlayerVideo::Process() - //we need to recalculate the framerate - //TODO: this needs to be set on a streamchange instead - ResetFrameRateCalc(); -+ m_droppingStats.Reset(); - - m_stalled = true; - m_started = false; -@@ -466,6 +470,7 @@ void CDVDPlayerVideo::Process() - if(m_speed == DVD_PLAYSPEED_PAUSE) - m_iNrOfPicturesNotToSkip = 0; - g_renderManager.SetSpeed(m_speed); -+ m_droppingStats.Reset(); - } - else if (pMsg->IsType(CDVDMsg::PLAYER_STARTED)) - { -@@ -500,6 +505,28 @@ void CDVDPlayerVideo::Process() - m_iNrOfPicturesNotToSkip = 1; - } - -+ bRequestDrop = false; -+ iDropDirective = CalcDropRequirement(pts); -+ if (iDropDirective & EOS_VERYLATE) -+ { -+ if (m_bAllowDrop) -+ { -+ m_pullupCorrection.Flush(); -+ bRequestDrop = true; -+ } -+ } -+ int codecControl = 0; -+ if (iDropDirective & EOS_BUFFER_LEVEL) -+ codecControl |= DVP_FLAG_DRAIN; -+ if (m_speed > DVD_PLAYSPEED_NORMAL) -+ codecControl |= DVP_FLAG_NO_POSTPROC; -+ m_pVideoCodec->SetCodecControl(codecControl); -+ if (iDropDirective & EOS_DROPPED) -+ { -+ m_iDroppedFrames++; -+ iDropped++; -+ } -+ - #ifdef PROFILE - bRequestDrop = false; - #else -@@ -509,6 +536,7 @@ void CDVDPlayerVideo::Process() - bRequestDrop = false; - m_iDroppedRequest = 0; - m_iLateFrames = 0; -+ m_droppingStats.m_requestOutputDrop = false; - } - #endif - -@@ -556,15 +584,8 @@ void CDVDPlayerVideo::Process() - } - - m_videoStats.AddSampleBytes(pPacket->iSize); -- // assume decoder dropped a picture if it didn't give us any -- // picture from a demux packet, this should be reasonable -- // for libavformat as a demuxer as it normally packetizes -- // pictures when they come from demuxer -- if(bRequestDrop && !bPacketDrop && (iDecoderState & VC_BUFFER) && !(iDecoderState & VC_PICTURE)) -- { -- m_iDroppedFrames++; -- iDropped++; -- } -+ -+ bRequestDrop = false; - - // loop while no error - while (!m_bStop) -@@ -1255,50 +1276,30 @@ int CDVDPlayerVideo::OutputPicture(const DVDVideoPicture* src, double pts) - m_FlipTimeStamp += max(0.0, iSleepTime); - m_FlipTimeStamp += iFrameDuration; - -- if (iSleepTime <= 0 && m_speed) -- m_iLateFrames++; -- else -- m_iLateFrames = 0; -- -- // ask decoder to drop frames next round, as we are very late -- if(m_iLateFrames > 10) -- { -- if (!(pPicture->iFlags & DVP_FLAG_NOSKIP)) -- { -- //if we're calculating the framerate, -- //don't drop frames until we've calculated a stable framerate -- if (m_bAllowDrop || m_speed != DVD_PLAYSPEED_NORMAL) -- { -- result |= EOS_VERYLATE; -- m_pullupCorrection.Flush(); //dropped frames mess up the pattern, so just flush it -- } -- -- //if we requested 5 drops in a row and we're still late, drop on output -- //this keeps a/v sync if the decoder can't drop, or we're still calculating the framerate -- if (m_iDroppedRequest > 5) -- { -- m_iDroppedRequest--; //decrease so we only drop half the frames -- return result | EOS_DROPPED; -- } -- m_iDroppedRequest++; -- } -- } -- else -+ if ((m_droppingStats.m_requestOutputDrop && !(pPicture->iFlags & DVP_FLAG_NOSKIP)) -+ || (pPicture->iFlags & DVP_FLAG_DROPPED)) - { -- m_iDroppedRequest = 0; -+ m_droppingStats.AddOutputDropGain(pts, 1/m_fFrameRate); -+ m_droppingStats.m_requestOutputDrop = false; -+ CLog::Log(LOGDEBUG,"%s - dropped in output", __FUNCTION__); -+ return result | EOS_DROPPED; - } - - if( m_speed < 0 ) - { -- if( iClockSleep < -DVD_MSEC_TO_TIME(200) -- && !(pPicture->iFlags & DVP_FLAG_NOSKIP) ) -+ double decoderPts = m_droppingStats.m_lastDecoderPts; -+ double renderPts = m_droppingStats.m_lastRenderPts; -+ if (pts > renderPts) -+ { -+ if (decoderPts >= renderPts) -+ { -+ Sleep(200); -+ } - return result | EOS_DROPPED; -+ } - } - -- if( (pPicture->iFlags & DVP_FLAG_DROPPED) ) -- return result | EOS_DROPPED; -- -- if( m_speed != DVD_PLAYSPEED_NORMAL && limited ) -+ if( m_speed != DVD_PLAYSPEED_NORMAL && m_speed >= 0 && limited ) - { - // calculate frame dropping pattern to render at this speed - // we do that by deciding if this or next frame is closest -@@ -1360,7 +1361,7 @@ int CDVDPlayerVideo::OutputPicture(const DVDVideoPicture* src, double pts) - if (index < 0) - return EOS_DROPPED; - -- g_renderManager.FlipPage(CThread::m_bStop, (iCurrentClock + iSleepTime) / DVD_TIME_BASE, -1, mDisplayField); -+ g_renderManager.FlipPage(CThread::m_bStop, (iCurrentClock + iSleepTime) / DVD_TIME_BASE, pts, -1, mDisplayField); - - return result; - #else -@@ -1659,3 +1660,136 @@ void CDVDPlayerVideo::CalcFrameRate() - m_iFrameRateCount = 0; - } - } -+ -+int CDVDPlayerVideo::CalcDropRequirement(double pts) -+{ -+ int result = 0; -+ double iSleepTime; -+ double iDecoderPts, iRenderPts; -+ double iInterval; -+ int interlaced; -+ double iGain; -+ double iLateness; -+ bool bNewFrame; -+ int iSkippedDeint = 0; -+ int iBufferLevel; -+ -+ // get decoder stats -+ if (!m_pVideoCodec->GetPts(iDecoderPts, iSkippedDeint, interlaced)) -+ iDecoderPts = pts; -+ if (iDecoderPts == DVD_NOPTS_VALUE) -+ iDecoderPts = pts; -+ -+ // get render stats -+ g_renderManager.GetStats(iSleepTime, iRenderPts, iBufferLevel); -+ -+ if (iBufferLevel < 0) -+ result |= EOS_BUFFER_LEVEL; -+ else if (iBufferLevel < 2) -+ { -+ result |= EOS_BUFFER_LEVEL; -+ CLog::Log(LOGDEBUG,"CDVDPlayerVideo::CalcDropRequirement - hurry: %d", iBufferLevel); -+ } -+ -+ bNewFrame = iDecoderPts != m_droppingStats.m_lastDecoderPts; -+ -+ if (interlaced) -+ iInterval = 2/m_fFrameRate*(double)DVD_TIME_BASE; -+ else -+ iInterval = 1/m_fFrameRate*(double)DVD_TIME_BASE; -+ -+ if (m_droppingStats.m_lastDecoderPts > 0 -+ && bNewFrame -+ && m_bAllowDrop -+ && m_droppingStats.m_dropRequests > 0) -+ { -+ iGain = (iDecoderPts - m_droppingStats.m_lastDecoderPts - iInterval)/(double)DVD_TIME_BASE; -+ if (iSkippedDeint) -+ { -+ CDroppingStats::CGain gain; -+ gain.gain = 1/m_fFrameRate; -+ gain.pts = iDecoderPts; -+ m_droppingStats.m_gain.push_back(gain); -+ m_droppingStats.m_totalGain += gain.gain; -+ result |= EOS_DROPPED; -+ m_droppingStats.m_dropRequests = 0; -+ CLog::Log(LOGDEBUG,"CDVDPlayerVideo::CalcDropRequirement - dropped de-interlacing cycle, Sleeptime: %f, Bufferlevel: %d", iSleepTime, iBufferLevel); -+ } -+ else if (iGain > 1/m_fFrameRate) -+ { -+ CDroppingStats::CGain gain; -+ gain.gain = iGain; -+ gain.pts = iDecoderPts; -+ m_droppingStats.m_gain.push_back(gain); -+ m_droppingStats.m_totalGain += iGain; -+ result |= EOS_DROPPED; -+ m_droppingStats.m_dropRequests = 0; -+ CLog::Log(LOGDEBUG,"CDVDPlayerVideo::CalcDropRequirement - dropped in decoder, Sleeptime: %f, Bufferlevel: %d, Gain: %f", iSleepTime, iBufferLevel, iGain); -+ } -+ } -+ m_droppingStats.m_lastDecoderPts = iDecoderPts; -+ -+ // subtract gains -+ while (!m_droppingStats.m_gain.empty() && -+ iRenderPts >= m_droppingStats.m_gain.front().pts) -+ { -+ m_droppingStats.m_totalGain -= m_droppingStats.m_gain.front().gain; -+ m_droppingStats.m_gain.pop_front(); -+ } -+ -+ // calculate lateness -+ iLateness = iSleepTime + m_droppingStats.m_totalGain; -+ if (iLateness < 0 && m_speed) -+ { -+ if (bNewFrame) -+ m_droppingStats.m_lateFrames++; -+ -+ // if lateness is smaller than frametime, we observe this state -+ // for 10 cycles -+ if (m_droppingStats.m_lateFrames > 10 || iLateness < -2/m_fFrameRate) -+ { -+ // is frame allowed to skip -+ if (m_iNrOfPicturesNotToSkip <= 0) -+ { -+ result |= EOS_VERYLATE; -+ -+ // drop in output -+ if (m_droppingStats.m_dropRequests > 7 && g_graphicsContext.IsFullScreenVideo()) -+ { -+ m_droppingStats.m_dropRequests--; //decrease so we only drop half the frames -+ m_droppingStats.m_requestOutputDrop = true; -+ } -+ else if (bNewFrame) -+ m_droppingStats.m_dropRequests++; -+ } -+ } -+ } -+ else -+ { -+ m_droppingStats.m_dropRequests = 0; -+ m_droppingStats.m_lateFrames = 0; -+ m_droppingStats.m_requestOutputDrop = false; -+ } -+ m_droppingStats.m_lastRenderPts = iRenderPts; -+ return result; -+} -+ -+void CDroppingStats::Reset() -+{ -+ m_gain.clear(); -+ m_totalGain = 0; -+ m_lastDecoderPts = 0; -+ m_lastRenderPts = 0; -+ m_lateFrames = 0; -+ m_dropRequests = 0; -+ m_requestOutputDrop = false; -+} -+ -+void CDroppingStats::AddOutputDropGain(double pts, double frametime) -+{ -+ CDroppingStats::CGain gain; -+ gain.gain = frametime; -+ gain.pts = pts; -+ m_gain.push_back(gain); -+ m_totalGain += frametime; -+} -diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.h b/xbmc/cores/dvdplayer/DVDPlayerVideo.h -index fe7e12c..4913712 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayerVideo.h -+++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.h -@@ -37,6 +37,26 @@ - - #define VIDEO_PICTURE_QUEUE_SIZE 1 - -+class CDroppingStats -+{ -+public: -+ void Reset(); -+ void AddOutputDropGain(double pts, double frametime); -+ struct CGain -+ { -+ double gain; -+ double pts; -+ }; -+ std::deque m_gain; -+ double m_totalGain; -+ double m_lastDecoderPts; -+ double m_lastRenderPts; -+ unsigned int m_lateFrames; -+ unsigned int m_dropRequests; -+ bool m_requestOutputDrop; -+}; -+ -+ - class CDVDPlayerVideo : public CThread - { - public: -@@ -110,6 +130,7 @@ class CDVDPlayerVideo : public CThread - #define EOS_ABORT 1 - #define EOS_DROPPED 2 - #define EOS_VERYLATE 4 -+#define EOS_BUFFER_LEVEL 8 - - void AutoCrop(DVDVideoPicture* pPicture); - void AutoCrop(DVDVideoPicture *pPicture, RECT &crop); -@@ -135,6 +156,7 @@ class CDVDPlayerVideo : public CThread - - void ResetFrameRateCalc(); - void CalcFrameRate(); -+ int CalcDropRequirement(double pts); - - double m_fFrameRate; //framerate of the video currently playing - bool m_bCalcFrameRate; //if we should calculate the framerate from the timestamps -@@ -195,5 +217,7 @@ class CDVDPlayerVideo : public CThread - CPullupCorrection m_pullupCorrection; - - std::list m_packets; -+ -+ CDroppingStats m_droppingStats; - }; - --- -1.8.1.6 - - -From 25c9f6d91192d95167353546a40500409fa75929 Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Sun, 2 Sep 2012 16:05:21 +0200 -Subject: [PATCH 21/94] video player: present correct pts to user for a/v sync - (after buffering in renderer) - ---- - xbmc/cores/dvdplayer/DVDPlayerVideo.cpp | 41 ++++++++++++++++++++------------- - xbmc/cores/dvdplayer/DVDPlayerVideo.h | 2 +- - 2 files changed, 26 insertions(+), 17 deletions(-) - -diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -index 5484073..8ac5a32 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -+++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -@@ -1260,22 +1260,6 @@ int CDVDPlayerVideo::OutputPicture(const DVDVideoPicture* src, double pts) - else - iSleepTime = iFrameSleep + (iClockSleep - iFrameSleep) / m_autosync; - --#ifdef PROFILE /* during profiling, try to play as fast as possible */ -- iSleepTime = 0; --#endif -- -- // present the current pts of this frame to user, and include the actual -- // presentation delay, to allow him to adjust for it -- if( m_stalled ) -- m_iCurrentPts = DVD_NOPTS_VALUE; -- else -- m_iCurrentPts = pts - max(0.0, iSleepTime); -- -- // timestamp when we think next picture should be displayed based on current duration -- m_FlipTimeStamp = iCurrentClock; -- m_FlipTimeStamp += max(0.0, iSleepTime); -- m_FlipTimeStamp += iFrameDuration; -- - if ((m_droppingStats.m_requestOutputDrop && !(pPicture->iFlags & DVP_FLAG_NOSKIP)) - || (pPicture->iFlags & DVP_FLAG_DROPPED)) - { -@@ -1580,6 +1564,22 @@ void CDVDPlayerVideo::ResetFrameRateCalc() - g_advancedSettings.m_videoFpsDetect == 0; - } - -+double CDVDPlayerVideo::GetCurrentPts() -+{ -+ double iSleepTime, iRenderPts; -+ int iBufferLevel; -+ -+ // get render stats -+ g_renderManager.GetStats(iSleepTime, iRenderPts, iBufferLevel); -+ -+ if( m_stalled ) -+ iRenderPts = DVD_NOPTS_VALUE; -+ else -+ iRenderPts = iRenderPts - max(0.0, iSleepTime); -+ -+ return iRenderPts; -+} -+ - #define MAXFRAMERATEDIFF 0.01 - #define MAXFRAMESERR 1000 - -@@ -1698,6 +1698,15 @@ int CDVDPlayerVideo::CalcDropRequirement(double pts) - else - iInterval = 1/m_fFrameRate*(double)DVD_TIME_BASE; - -+ -+ m_FlipTimeStamp = m_pClock->GetAbsoluteClock() + max(0.0, iSleepTime) + iInterval; -+ -+ if( m_stalled ) -+ m_iCurrentPts = DVD_NOPTS_VALUE; -+ else -+ m_iCurrentPts = iRenderPts - max(0.0, iSleepTime); -+ -+ - if (m_droppingStats.m_lastDecoderPts > 0 - && bNewFrame - && m_bAllowDrop -diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.h b/xbmc/cores/dvdplayer/DVDPlayerVideo.h -index 4913712..509d5f7 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayerVideo.h -+++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.h -@@ -108,7 +108,7 @@ class CDVDPlayerVideo : public CThread - - bool InitializedOutputDevice(); - -- double GetCurrentPts() { return m_iCurrentPts; } -+ double GetCurrentPts(); - int GetPullupCorrection() { return m_pullupCorrection.GetPatternLength(); } - - double GetOutputDelay(); /* returns the expected delay, from that a packet is put in queue */ --- -1.8.1.6 - - -From c5d82e4e8df8dc803dac562bfff851d9551c15f4 Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Sat, 16 Feb 2013 18:25:53 +0100 -Subject: [PATCH 22/94] videoplayer: some rework and documentation - ---- - .../dvdplayer/DVDCodecs/Video/DVDVideoCodec.h | 29 ++++++++++++++++++++-- - .../DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp | 11 ++++++++ - .../DVDCodecs/Video/DVDVideoCodecFFmpeg.h | 2 +- - xbmc/cores/dvdplayer/DVDPlayerVideo.cpp | 2 +- - 4 files changed, 40 insertions(+), 4 deletions(-) - -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h -index 5001aac..e84e65f 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h -@@ -132,7 +132,6 @@ struct DVDVideoUserData - #define VC_USERDATA 0x00000008 // the decoder found some userdata, call Decode(NULL, 0) again to parse the rest of the data - #define VC_FLUSHED 0x00000010 // the decoder lost it's state, we need to restart decoding again - #define VC_DROPPED 0x00000020 // needed to identify if a picture was dropped --#define VC_HURRY 0x00000040 - - class CDVDVideoCodec - { -@@ -245,10 +244,36 @@ class CDVDVideoCodec - return 0; - } - -- virtual bool GetPts(double &pts, int &skippedDeint, int &interlaced) -+ /** -+ * For calculation of dropping requirements player asks for some information. -+ * -+ * - pts : right after decoder, used to detect gaps (dropped frames in decoder) -+ * - skippedDeint : indicates if decoder has just skipped a deinterlacing cycle -+ * instead of dropping a full frame -+ * - interlaced : when detecting gaps in pts, player needs to know whether -+ * it's interlaced or not -+ * -+ * If codec does not implement this method, pts of decoded frame at input -+ * video player is used. In case coded does post-proc and de-interlacing there -+ * may be quite some frames queued up between exit decoder and entry player. -+ */ -+ virtual bool GetCodecStats(double &pts, int &skippedDeint, int &interlaced) - { - return false; - } - -+ /** -+ * Codec can be informed by player with the following flags: -+ * -+ * DVP_FLAG_NO_POSTPROC : if speed is not normal the codec can switch off -+ * postprocessing and de-interlacing -+ * -+ * DVP_FLAG_DRAIN : codecs may do postprocessing and de-interlacing. -+ * If video buffers in RenderManager are about to run dry, -+ * this is signaled to codec. Codec can wait for post-proc -+ * to be finished instead of returning empty and getting another -+ * packet. -+ * -+ */ - virtual void SetCodecControl(int flags) {} - }; -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp -index dae3b8e..2c2353d 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp -@@ -888,6 +888,17 @@ unsigned CDVDVideoCodecFFmpeg::GetConvergeCount() - return 0; - } - -+bool CDVDVideoCodecFFmpeg::GetCodecStats(double &pts, int &skippedDeint, int &interlaced) -+{ -+ pts = m_decoderPts; -+ skippedDeint = m_skippedDeint; -+ if (m_pFrame) -+ interlaced = m_pFrame->interlaced_frame; -+ else -+ interlaced = 0; -+ return true; -+} -+ - void CDVDVideoCodecFFmpeg::SetCodecControl(int flags) - { - m_codecControlFlags = flags; -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.h -index 52e1113..3631f7f 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.h -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.h -@@ -61,7 +61,7 @@ class CDVDVideoCodecFFmpeg : public CDVDVideoCodec - virtual unsigned int SetFilters(unsigned int filters); - virtual const char* GetName() { return m_name.c_str(); }; // m_name is never changed after open - virtual unsigned GetConvergeCount(); -- virtual bool GetPts(double &pts, int &skippedDeint, int &interlaced) {pts=m_decoderPts; skippedDeint=m_skippedDeint; if (m_pFrame) interlaced = m_pFrame->interlaced_frame; return true;} -+ virtual bool GetCodecStats(double &pts, int &skippedDeint, int &interlaced); - virtual void SetCodecControl(int flags); - - bool IsHardwareAllowed() { return !m_bSoftware; } -diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -index 8ac5a32..12b08ac 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -+++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -@@ -1675,7 +1675,7 @@ int CDVDPlayerVideo::CalcDropRequirement(double pts) - int iBufferLevel; - - // get decoder stats -- if (!m_pVideoCodec->GetPts(iDecoderPts, iSkippedDeint, interlaced)) -+ if (!m_pVideoCodec->GetCodecStats(iDecoderPts, iSkippedDeint, interlaced)) - iDecoderPts = pts; - if (iDecoderPts == DVD_NOPTS_VALUE) - iDecoderPts = pts; --- -1.8.1.6 - - -From 51cdc8453dce0754b9daa78acedb1deab6810d63 Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Fri, 1 Mar 2013 09:57:16 +0100 -Subject: [PATCH 23/94] Revert "dvdplayer: disable buffering unit dropping is - improves" - -This reverts commit de1caf5686c1fb53cb7ab11b356e6c22770740db. ---- - xbmc/cores/dvdplayer/DVDPlayerVideo.cpp | 16 ++++++++-------- - 1 file changed, 8 insertions(+), 8 deletions(-) - -diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -index 12b08ac..3297513 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -+++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -@@ -1118,35 +1118,35 @@ int CDVDPlayerVideo::OutputPicture(const DVDVideoPicture* src, double pts) - { - case RENDER_FMT_YUV420P: - formatstr = "YV12"; -- buffering = false; -+ buffering = true; - break; - case RENDER_FMT_YUV420P16: - formatstr = "YV12P16"; -- buffering = false; -+ buffering = true; - break; - case RENDER_FMT_YUV420P10: - formatstr = "YV12P10"; -- buffering = false; -+ buffering = true; - break; - case RENDER_FMT_NV12: - formatstr = "NV12"; -- buffering = false; -+ buffering = true; - break; - case RENDER_FMT_UYVY422: - formatstr = "UYVY"; -- buffering = false; -+ buffering = true; - break; - case RENDER_FMT_YUYV422: - formatstr = "YUY2"; -- buffering = false; -+ buffering = true; - break; - case RENDER_FMT_VDPAU: - formatstr = "VDPAU"; -- buffering = false; -+ buffering = true; - break; - case RENDER_FMT_DXVA: - formatstr = "DXVA"; -- buffering = false; -+ buffering = true; - break; - case RENDER_FMT_VAAPI: - formatstr = "VAAPI"; --- -1.8.1.6 - - -From e7446046da7da7b64f2f381bfcd8decdbb9e77f4 Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Mon, 28 May 2012 10:41:31 +0200 -Subject: [PATCH 24/94] videoplayer: update frametime, it might change due to - fps detection - ---- - xbmc/cores/dvdplayer/DVDPlayerVideo.cpp | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -index 3297513..8eb2eda 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -+++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -@@ -719,6 +719,8 @@ void CDVDPlayerVideo::Process() - CDVDCodecUtils::FreePicture(pTempYUVPackedPicture); - #endif - -+ frametime = (double)DVD_TIME_BASE/m_fFrameRate; -+ - if(m_started == false) - { - m_codecname = m_pVideoCodec->GetName(); --- -1.8.1.6 - - -From 9300e23fc0b9cc96237ec5bfc499a7880713674c Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Mon, 28 May 2012 10:43:06 +0200 -Subject: [PATCH 25/94] videoplayer: give streams with invalid fps a chance for - fps detection - ---- - xbmc/cores/dvdplayer/DVDPlayerVideo.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -index 8eb2eda..d004153 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -+++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -@@ -1606,7 +1606,7 @@ void CDVDPlayerVideo::CalcFrameRate() - double frameduration = m_pullupCorrection.GetFrameDuration(); - - if (frameduration == DVD_NOPTS_VALUE || -- (g_advancedSettings.m_videoFpsDetect == 1 && m_pullupCorrection.GetPatternLength() > 1)) -+ (g_advancedSettings.m_videoFpsDetect == 1 && (m_pullupCorrection.GetPatternLength() > 1 && !m_bFpsInvalid))) - { - //reset the stored framerates if no good framerate was detected - m_fStableFrameRate = 0.0; --- -1.8.1.6 - - -From 633396d59bb62d952092552ea6b7619d9536ffaf Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Mon, 28 May 2012 10:49:05 +0200 -Subject: [PATCH 26/94] dvdplayer: allow rewinding at end of stream, do a seek - after rewind - ---- - xbmc/cores/dvdplayer/DVDPlayer.cpp | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - -diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp -index e5a1e71..21414ab 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayer.cpp -+++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp -@@ -1552,7 +1552,7 @@ void CDVDPlayer::HandlePlaySpeed() - - } - else if (m_CurrentVideo.id >= 0 -- && m_CurrentVideo.inited == true -+ && (m_CurrentVideo.inited == true || GetPlaySpeed() < 0) // allow rewind at end of file - && m_SpeedState.lastpts != m_dvdPlayerVideo.GetCurrentPts() - && m_SpeedState.lasttime != GetTime()) - { -@@ -2193,6 +2193,12 @@ void CDVDPlayer::HandleMessages() - pvrinputstream->Pause( speed == 0 ); - } - -+ // do a seek after rewind, clock is not in sync with current pts -+ if (m_playSpeed < 0 && speed >= 0) -+ { -+ m_messenger.Put(new CDVDMsgPlayerSeek(GetTime(), true, true, true)); -+ } -+ - // if playspeed is different then DVD_PLAYSPEED_NORMAL or DVD_PLAYSPEED_PAUSE - // audioplayer, stops outputing audio to audiorendere, but still tries to - // sleep an correct amount for each packet --- -1.8.1.6 - - -From 47f1c914d0e09b4692bc079e3d1692df7792b4c9 Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Sat, 7 Apr 2012 09:19:00 +0200 -Subject: [PATCH 27/94] vdpau: redesign - ---- - language/English/strings.po | 12 +- - system/shaders/yuv2rgb_basic.glsl | 12 + - xbmc/cores/VideoRenderers/LinuxRendererGL.cpp | 203 +- - xbmc/cores/VideoRenderers/LinuxRendererGL.h | 13 +- - xbmc/cores/VideoRenderers/RenderFormats.h | 1 + - xbmc/cores/VideoRenderers/RenderManager.cpp | 3 +- - xbmc/cores/VideoRenderers/RenderManager.h | 2 +- - .../VideoRenderers/VideoShaders/YUV2RGBShader.cpp | 2 + - .../dvdplayer/DVDCodecs/Video/DVDVideoCodec.h | 4 +- - .../DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp | 23 +- - .../DVDCodecs/Video/DVDVideoCodecFFmpeg.h | 1 - - xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp | 3800 +++++++++++++++----- - xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.h | 662 +++- - xbmc/cores/dvdplayer/DVDPlayerVideo.cpp | 4 + - xbmc/settings/AdvancedSettings.cpp | 8 +- - xbmc/settings/AdvancedSettings.h | 4 +- - xbmc/settings/GUISettings.cpp | 2 + - xbmc/settings/GUIWindowSettingsCategory.cpp | 34 + - xbmc/utils/ActorProtocol.cpp | 253 ++ - xbmc/utils/ActorProtocol.h | 87 + - xbmc/utils/Makefile | 1 + - xbmc/video/dialogs/GUIDialogVideoSettings.cpp | 2 +- - xbmc/windowing/X11/WinSystemX11.h | 1 + - 23 files changed, 3942 insertions(+), 1192 deletions(-) - create mode 100644 xbmc/utils/ActorProtocol.cpp - create mode 100644 xbmc/utils/ActorProtocol.h - -diff --git a/language/English/strings.po b/language/English/strings.po -index 0c77c30..f18f109 100644 ---- a/language/English/strings.po -+++ b/language/English/strings.po -@@ -5113,7 +5113,15 @@ msgctxt "#13434" - msgid "Play only this" - msgstr "" - --#empty strings from id 13435 to 13499 -+msgctxt "#13435" -+msgid "Allow Vdpau OpenGL interop" -+msgstr "" -+ -+msgctxt "#13436" -+msgid "Allow Vdpau OpenGL interop YUV" -+msgstr "" -+ -+#empty strings from id 13437 to 13499 - - msgctxt "#13500" - msgid "A/V sync method" -@@ -6332,7 +6340,7 @@ msgid "Software Blend" - msgstr "" - - msgctxt "#16325" --msgid "Auto - ION Optimized" -+msgid "VDPAU - Bob" - msgstr "" - - #empty strings from id 16326 to 16399 -diff --git a/system/shaders/yuv2rgb_basic.glsl b/system/shaders/yuv2rgb_basic.glsl -index 88c33b2..aa26174 100644 ---- a/system/shaders/yuv2rgb_basic.glsl -+++ b/system/shaders/yuv2rgb_basic.glsl -@@ -70,6 +70,18 @@ void main() - rgb.a = gl_Color.a; - gl_FragColor = rgb; - -+#elif defined(XBMC_VDPAU_NV12) -+ -+ vec4 yuv, rgb; -+ yuv.rgba = vec4( texture2D(m_sampY, stretch(m_cordY)).r -+ , texture2D(m_sampU, stretch(m_cordU)).r -+ , texture2D(m_sampV, stretch(m_cordV)).g -+ , 1.0 ); -+ -+ rgb = m_yuvmat * yuv; -+ rgb.a = gl_Color.a; -+ gl_FragColor = rgb; -+ - #elif defined(XBMC_YUY2) || defined(XBMC_UYVY) - - #if(XBMC_texture_rectangle) -diff --git a/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp b/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp -index a2dc2be..4ee50c1 100644 ---- a/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp -+++ b/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp -@@ -689,6 +689,18 @@ void CLinuxRendererGL::RenderUpdate(bool clear, DWORD flags, DWORD alpha) - glDisable(GL_POLYGON_STIPPLE); - - } -+ else if(m_format == RENDER_FMT_VDPAU_420 -+ && !(flags & RENDER_FLAG_BOTH)) -+ { -+ glDisable(GL_BLEND); -+ glColor4f(1.0f, 1.0f, 1.0f, 1.0f); -+ Render(flags | RENDER_FLAG_TOP, index); -+ -+ glEnable(GL_BLEND); -+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); -+ glColor4f(1.0f, 1.0f, 1.0f, 128 / 255.0f); -+ Render(flags | RENDER_FLAG_BOT , index); -+ } - else - Render(flags, index); - -@@ -769,11 +781,6 @@ void CLinuxRendererGL::FlipPage(int source) - - m_buffers[m_iYV12RenderBuffer].flipindex = ++m_flipindex; - --#ifdef HAVE_LIBVDPAU -- if((m_renderMethod & RENDER_VDPAU) && m_buffers[m_iYV12RenderBuffer].vdpau) -- m_buffers[m_iYV12RenderBuffer].vdpau->Present(); --#endif -- - return; - } - -@@ -1100,6 +1107,12 @@ void CLinuxRendererGL::LoadShaders(int field) - m_textureCreate = &CLinuxRendererGL::CreateVDPAUTexture; - m_textureDelete = &CLinuxRendererGL::DeleteVDPAUTexture; - } -+ else if (m_format == RENDER_FMT_VDPAU_420) -+ { -+ m_textureUpload = &CLinuxRendererGL::UploadVDPAUTexture420; -+ m_textureCreate = &CLinuxRendererGL::CreateVDPAUTexture420; -+ m_textureDelete = &CLinuxRendererGL::DeleteVDPAUTexture420; -+ } - else if (m_format == RENDER_FMT_VAAPI) - { - m_textureUpload = &CLinuxRendererGL::UploadVAAPITexture; -@@ -1175,7 +1188,10 @@ void CLinuxRendererGL::Render(DWORD flags, int renderBuffer) - m_currentField = FIELD_FULL; - - // call texture load function -+ m_skipRender = false; - (this->*m_textureUpload)(renderBuffer); -+ if (m_skipRender) -+ return; - - if (m_renderMethod & RENDER_GLSL) - { -@@ -1541,17 +1557,12 @@ void CLinuxRendererGL::RenderFromFBO() - void CLinuxRendererGL::RenderVDPAU(int index, int field) - { - #ifdef HAVE_LIBVDPAU -- YUVPLANE &plane = m_buffers[index].fields[field][0]; -- CVDPAU *vdpau = m_buffers[m_iYV12RenderBuffer].vdpau; -- -- if (!vdpau) -- return; -+ YUVPLANE &plane = m_buffers[index].fields[0][1]; - - glEnable(m_textureTarget); - glActiveTextureARB(GL_TEXTURE0); -- glBindTexture(m_textureTarget, plane.id); - -- vdpau->BindPixmap(); -+ glBindTexture(m_textureTarget, plane.id); - - // Try some clamping or wrapping - glTexParameteri(m_textureTarget, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); -@@ -1609,8 +1620,6 @@ void CLinuxRendererGL::RenderVDPAU(int index, int field) - if (m_pVideoFilterShader) - m_pVideoFilterShader->Disable(); - -- vdpau->ReleasePixmap(); -- - glBindTexture (m_textureTarget, 0); - glDisable(m_textureTarget); - #endif -@@ -2295,12 +2304,14 @@ void CLinuxRendererGL::DeleteVDPAUTexture(int index) - { - #ifdef HAVE_LIBVDPAU - YUVPLANE &plane = m_buffers[index].fields[0][0]; -+ YUVFIELDS &fields = m_buffers[index].fields; - - SAFE_RELEASE(m_buffers[index].vdpau); - - if(plane.id && glIsTexture(plane.id)) - glDeleteTextures(1, &plane.id); - plane.id = 0; -+ fields[0][1].id = 0; - #endif - } - -@@ -2334,11 +2345,152 @@ bool CLinuxRendererGL::CreateVDPAUTexture(int index) - void CLinuxRendererGL::UploadVDPAUTexture(int index) - { - #ifdef HAVE_LIBVDPAU -+ VDPAU::CVdpauRenderPicture *vdpau = m_buffers[index].vdpau; -+ -+ unsigned int flipindex = m_buffers[index].flipindex; -+ YUVFIELDS &fields = m_buffers[index].fields; -+ YUVPLANE &plane = fields[0][0]; -+ -+ if (!vdpau || !vdpau->valid) -+ { -+ m_eventTexturesDone[index]->Set(); -+ m_skipRender = true; -+ return; -+ } -+ -+ fields[0][1].id = vdpau->texture[0]; -+ -+ m_eventTexturesDone[index]->Set(); -+#endif -+} -+ -+void CLinuxRendererGL::DeleteVDPAUTexture420(int index) -+{ -+#ifdef HAVE_LIBVDPAU -+ YUVPLANE &plane = m_buffers[index].fields[0][0]; -+ YUVFIELDS &fields = m_buffers[index].fields; -+ -+ SAFE_RELEASE(m_buffers[index].vdpau); -+ -+ if(plane.id && glIsTexture(plane.id)) -+ glDeleteTextures(1, &plane.id); -+ plane.id = 0; -+ fields[1][0].id = 0; -+ fields[1][1].id = 0; -+ fields[2][0].id = 0; -+ fields[2][1].id = 0; -+ -+#endif -+} -+ -+bool CLinuxRendererGL::CreateVDPAUTexture420(int index) -+{ -+#ifdef HAVE_LIBVDPAU -+ YV12Image &im = m_buffers[index].image; -+ YUVFIELDS &fields = m_buffers[index].fields; -+ YUVPLANE &plane = fields[0][0]; -+ GLuint *pbo = m_buffers[index].pbo; -+ -+ DeleteVDPAUTexture420(index); -+ -+ memset(&im , 0, sizeof(im)); -+ memset(&fields, 0, sizeof(fields)); -+ -+ im.cshift_x = 1; -+ im.cshift_y = 1; -+ -+ im.plane[0] = NULL; -+ im.plane[1] = NULL; -+ im.plane[2] = NULL; -+ -+ for(int p = 0;p<3;p++) -+ { -+ pbo[p] = None; -+ } -+ -+ glEnable(m_textureTarget); -+ glGenTextures(1, &plane.id); -+ glDisable(m_textureTarget); -+ - m_eventTexturesDone[index]->Set(); -- glPixelStorei(GL_UNPACK_ALIGNMENT,1); //what's this for? - #endif -+ return true; - } - -+void CLinuxRendererGL::UploadVDPAUTexture420(int index) -+{ -+#ifdef HAVE_LIBVDPAU -+ VDPAU::CVdpauRenderPicture *vdpau = m_buffers[index].vdpau; -+ YV12Image &im = m_buffers[index].image; -+ -+ unsigned int flipindex = m_buffers[index].flipindex; -+ YUVFIELDS &fields = m_buffers[index].fields; -+ YUVPLANE &plane = fields[0][0]; -+ -+ if (!vdpau || !vdpau->valid) -+ { -+ m_eventTexturesDone[index]->Set(); -+ m_skipRender = true; -+ return; -+ } -+ -+ im.height = vdpau->texHeight; -+ im.width = vdpau->texWidth; -+ -+ // YUV -+ for (int f = FIELD_FULL; f<=FIELD_BOT ; f++) -+ { -+ int fieldshift = (f==FIELD_FULL) ? 0 : 1; -+ YUVPLANES &planes = fields[f]; -+ -+ planes[0].texwidth = im.width; -+ planes[0].texheight = im.height >> fieldshift; -+ -+ planes[1].texwidth = planes[0].texwidth >> im.cshift_x; -+ planes[1].texheight = planes[0].texheight >> im.cshift_y; -+ planes[2].texwidth = planes[1].texwidth; -+ planes[2].texheight = planes[1].texheight; -+ -+ for (int p = 0; p < 3; p++) -+ { -+ planes[p].pixpertex_x = 1; -+ planes[p].pixpertex_y = 1; -+ } -+ } -+ // crop -+// m_sourceRect.x1 += vdpau->crop.x1; -+// m_sourceRect.x2 -= vdpau->crop.x2; -+// m_sourceRect.y1 += vdpau->crop.y1; -+// m_sourceRect.y2 -= vdpau->crop.y2; -+ -+ // set textures -+ fields[1][0].id = vdpau->texture[0]; -+ fields[1][1].id = vdpau->texture[2]; -+ fields[2][0].id = vdpau->texture[1]; -+ fields[2][1].id = vdpau->texture[3]; -+ -+ glEnable(m_textureTarget); -+ for (int f = 1; f < 3; f++) -+ { -+ for (int p=0;p<2;p++) -+ { -+ glBindTexture(m_textureTarget,fields[f][p].id); -+ glTexParameteri(m_textureTarget, GL_TEXTURE_MIN_FILTER, GL_LINEAR); -+ glTexParameteri(m_textureTarget, GL_TEXTURE_MAG_FILTER, GL_LINEAR); -+ glTexParameteri(m_textureTarget, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); -+ glTexParameteri(m_textureTarget, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); -+ -+ glBindTexture(m_textureTarget,0); -+ VerifyGLState(); -+ } -+ fields[f][2].id = fields[f][1].id; -+ } -+ CalculateTextureSourceRects(index, 3); -+ glDisable(m_textureTarget); -+ -+ m_eventTexturesDone[index]->Set(); -+#endif -+} - - void CLinuxRendererGL::DeleteVAAPITexture(int index) - { -@@ -3276,12 +3428,13 @@ bool CLinuxRendererGL::Supports(EINTERLACEMETHOD method) - if(method == VS_INTERLACEMETHOD_AUTO) - return true; - -- if(m_renderMethod & RENDER_VDPAU) -+ if(m_renderMethod & RENDER_VDPAU || -+ m_format == RENDER_FMT_VDPAU_420) - { - #ifdef HAVE_LIBVDPAU -- CVDPAU *vdpau = m_buffers[m_iYV12RenderBuffer].vdpau; -- if(vdpau) -- return vdpau->Supports(method); -+ VDPAU::CVdpauRenderPicture *vdpauPic = m_buffers[m_iYV12RenderBuffer].vdpau; -+ if(vdpauPic && vdpauPic->vdpau) -+ return vdpauPic->vdpau->Supports(method); - #endif - return false; - } -@@ -3367,14 +3520,7 @@ EINTERLACEMETHOD CLinuxRendererGL::AutoInterlaceMethod() - return VS_INTERLACEMETHOD_NONE; - - if(m_renderMethod & RENDER_VDPAU) -- { --#ifdef HAVE_LIBVDPAU -- CVDPAU *vdpau = m_buffers[m_iYV12RenderBuffer].vdpau; -- if(vdpau) -- return vdpau->AutoInterlaceMethod(); --#endif - return VS_INTERLACEMETHOD_NONE; -- } - - if(Supports(VS_INTERLACEMETHOD_RENDER_BOB)) - return VS_INTERLACEMETHOD_RENDER_BOB; -@@ -3417,11 +3563,12 @@ void CLinuxRendererGL::UnBindPbo(YUVBUFFER& buff) - } - - #ifdef HAVE_LIBVDPAU --void CLinuxRendererGL::AddProcessor(CVDPAU* vdpau, int index) -+void CLinuxRendererGL::AddProcessor(VDPAU::CVdpauRenderPicture *vdpau, int index) - { - YUVBUFFER &buf = m_buffers[index]; -+ VDPAU::CVdpauRenderPicture *pic = vdpau->Acquire(); - SAFE_RELEASE(buf.vdpau); -- buf.vdpau = (CVDPAU*)vdpau->Acquire(); -+ buf.vdpau = pic; - } - #endif - -diff --git a/xbmc/cores/VideoRenderers/LinuxRendererGL.h b/xbmc/cores/VideoRenderers/LinuxRendererGL.h -index a7b5886..329ddee 100644 ---- a/xbmc/cores/VideoRenderers/LinuxRendererGL.h -+++ b/xbmc/cores/VideoRenderers/LinuxRendererGL.h -@@ -38,12 +38,11 @@ - - class CRenderCapture; - --class CVDPAU; - class CBaseTexture; - namespace Shaders { class BaseYUV2RGBShader; } - namespace Shaders { class BaseVideoFilterShader; } - namespace VAAPI { struct CHolder; } -- -+namespace VDPAU { class CVdpauRenderPicture; } - - #undef ALIGN - #define ALIGN(value, alignment) (((value)+((alignment)-1))&~((alignment)-1)) -@@ -142,7 +141,7 @@ class CLinuxRendererGL : public CBaseRenderer - virtual unsigned int GetProcessorSize() { return m_NumYV12Buffers; } - - #ifdef HAVE_LIBVDPAU -- virtual void AddProcessor(CVDPAU* vdpau, int index); -+ virtual void AddProcessor(VDPAU::CVdpauRenderPicture* vdpau, int index); - #endif - #ifdef HAVE_LIBVA - virtual void AddProcessor(VAAPI::CHolder& holder, int index); -@@ -193,6 +192,10 @@ class CLinuxRendererGL : public CBaseRenderer - void DeleteVDPAUTexture(int index); - bool CreateVDPAUTexture(int index); - -+ void UploadVDPAUTexture420(int index); -+ void DeleteVDPAUTexture420(int index); -+ bool CreateVDPAUTexture420(int index); -+ - void UploadVAAPITexture(int index); - void DeleteVAAPITexture(int index); - bool CreateVAAPITexture(int index); -@@ -219,6 +222,7 @@ class CLinuxRendererGL : public CBaseRenderer - void RenderSinglePass(int renderBuffer, int field); // single pass glsl renderer - void RenderSoftware(int renderBuffer, int field); // single pass s/w yuv2rgb renderer - void RenderVDPAU(int renderBuffer, int field); // render using vdpau hardware -+ void RenderVDPAUYV12(int renderBuffer, int field); // render using vdpau hardware - void RenderVAAPI(int renderBuffer, int field); // render using vdpau hardware - - struct -@@ -279,7 +283,7 @@ class CLinuxRendererGL : public CBaseRenderer - GLuint pbo[MAX_PLANES]; - - #ifdef HAVE_LIBVDPAU -- CVDPAU* vdpau; -+ VDPAU::CVdpauRenderPicture *vdpau; - #endif - #ifdef HAVE_LIBVA - VAAPI::CHolder& vaapi; -@@ -325,6 +329,7 @@ class CLinuxRendererGL : public CBaseRenderer - bool m_nonLinStretch; - bool m_nonLinStretchGui; - float m_pixelRatio; -+ bool m_skipRender; - }; - - -diff --git a/xbmc/cores/VideoRenderers/RenderFormats.h b/xbmc/cores/VideoRenderers/RenderFormats.h -index 09f8f5d..0262c60 100644 ---- a/xbmc/cores/VideoRenderers/RenderFormats.h -+++ b/xbmc/cores/VideoRenderers/RenderFormats.h -@@ -26,6 +26,7 @@ enum ERenderFormat { - RENDER_FMT_YUV420P10, - RENDER_FMT_YUV420P16, - RENDER_FMT_VDPAU, -+ RENDER_FMT_VDPAU_420, - RENDER_FMT_NV12, - RENDER_FMT_UYVY422, - RENDER_FMT_YUYV422, -diff --git a/xbmc/cores/VideoRenderers/RenderManager.cpp b/xbmc/cores/VideoRenderers/RenderManager.cpp -index c4ca57e..b89ec67 100644 ---- a/xbmc/cores/VideoRenderers/RenderManager.cpp -+++ b/xbmc/cores/VideoRenderers/RenderManager.cpp -@@ -860,7 +860,8 @@ int CXBMCRenderManager::AddVideoPicture(DVDVideoPicture& pic) - CDVDCodecUtils::CopyDXVA2Picture(&image, &pic); - } - #ifdef HAVE_LIBVDPAU -- else if(pic.format == RENDER_FMT_VDPAU) -+ else if(pic.format == RENDER_FMT_VDPAU -+ || pic.format == RENDER_FMT_VDPAU_420) - m_pRenderer->AddProcessor(pic.vdpau, index); - #endif - #ifdef HAVE_LIBOPENMAX -diff --git a/xbmc/cores/VideoRenderers/RenderManager.h b/xbmc/cores/VideoRenderers/RenderManager.h -index b3e6547..e4bd614 100644 ---- a/xbmc/cores/VideoRenderers/RenderManager.h -+++ b/xbmc/cores/VideoRenderers/RenderManager.h -@@ -35,7 +35,7 @@ - - namespace DXVA { class CProcessor; } - namespace VAAPI { class CSurfaceHolder; } --class CVDPAU; -+namespace VDPAU { class CVdpauRenderPicture; } - struct DVDVideoPicture; - - #define ERRORBUFFSIZE 30 -diff --git a/xbmc/cores/VideoRenderers/VideoShaders/YUV2RGBShader.cpp b/xbmc/cores/VideoRenderers/VideoShaders/YUV2RGBShader.cpp -index 58f26b0..50606eb 100644 ---- a/xbmc/cores/VideoRenderers/VideoShaders/YUV2RGBShader.cpp -+++ b/xbmc/cores/VideoRenderers/VideoShaders/YUV2RGBShader.cpp -@@ -201,6 +201,8 @@ static void CalculateYUVMatrixGL(GLfloat res[4][4] - m_defines += "#define XBMC_YUY2\n"; - else if (m_format == RENDER_FMT_UYVY422) - m_defines += "#define XBMC_UYVY\n"; -+ else if (RENDER_FMT_VDPAU_420) -+ m_defines += "#define XBMC_VDPAU_NV12\n"; - else - CLog::Log(LOGERROR, "GL: BaseYUV2RGBGLSLShader - unsupported format %d", m_format); - -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h -index e84e65f..64c5f5f 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h -@@ -34,7 +34,7 @@ - - namespace DXVA { class CSurfaceContext; } - namespace VAAPI { struct CHolder; } --class CVDPAU; -+namespace VDPAU { class CVdpauRenderPicture; } - class COpenMax; - class COpenMaxVideo; - struct OpenMaxVideoBuffer; -@@ -55,7 +55,7 @@ struct DVDVideoPicture - DXVA::CSurfaceContext* context; - }; - struct { -- CVDPAU* vdpau; -+ VDPAU::CVdpauRenderPicture* vdpau; - }; - struct { - VAAPI::CHolder* vaapi; -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp -index 2c2353d..e0c0f84 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp -@@ -71,14 +71,14 @@ enum PixelFormat CDVDVideoCodecFFmpeg::GetFormat( struct AVCodecContext * avctx - while(*cur != PIX_FMT_NONE) - { - #ifdef HAVE_LIBVDPAU -- if(CVDPAU::IsVDPAUFormat(*cur) && g_guiSettings.GetBool("videoplayer.usevdpau")) -+ if(VDPAU::CDecoder::IsVDPAUFormat(*cur) && g_guiSettings.GetBool("videoplayer.usevdpau")) - { - if(ctx->GetHardware()) - return *cur; - - CLog::Log(LOGNOTICE,"CDVDVideoCodecFFmpeg::GetFormat - Creating VDPAU(%ix%i)", avctx->width, avctx->height); -- CVDPAU* vdp = new CVDPAU(); -- if(vdp->Open(avctx, *cur)) -+ VDPAU::CDecoder* vdp = new VDPAU::CDecoder(); -+ if(vdp->Open(avctx, *cur, ctx->m_uSurfacesCount)) - { - ctx->SetHardware(vdp); - return *cur; -@@ -205,14 +205,27 @@ bool CDVDVideoCodecFFmpeg::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options - continue; - - CLog::Log(LOGNOTICE,"CDVDVideoCodecFFmpeg::Open() Creating VDPAU(%ix%i, %d)",hints.width, hints.height, hints.codec); -- CVDPAU* vdp = new CVDPAU(); -+ -+ VDPAU::CDecoder* vdp = new VDPAU::CDecoder(); - m_pCodecContext = m_dllAvCodec.avcodec_alloc_context3(pCodec); - m_pCodecContext->codec_id = hints.codec; - m_pCodecContext->width = hints.width; - m_pCodecContext->height = hints.height; - m_pCodecContext->coded_width = hints.width; - m_pCodecContext->coded_height = hints.height; -- if(vdp->Open(m_pCodecContext, pCodec->pix_fmts ? pCodec->pix_fmts[0] : PIX_FMT_NONE)) -+ -+ // check number of surfaces used in renderer -+ unsigned int surfaces = 0; -+ for(std::vector::iterator it = options.m_keys.begin(); it != options.m_keys.end(); it++) -+ { -+ if (it->m_name == "surfaces") -+ { -+ surfaces = std::atoi(it->m_value.c_str()); -+ break; -+ } -+ } -+ -+ if(vdp->Open(m_pCodecContext, pCodec->pix_fmts ? pCodec->pix_fmts[0] : PIX_FMT_NONE, surfaces)) - { - m_pHardware = vdp; - m_pCodecContext->codec_id = CODEC_ID_NONE; // ffmpeg will complain if this has been set -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.h -index 3631f7f..17a12d0 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.h -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.h -@@ -28,7 +28,6 @@ - #include "DllSwScale.h" - #include "DllAvFilter.h" - --class CVDPAU; - class CCriticalSection; - - class CDVDVideoCodecFFmpeg : public CDVDVideoCodec -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp -index f70a4f9..07cfc04 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp -@@ -32,11 +32,16 @@ - #include "settings/AdvancedSettings.h" - #include "Application.h" - #include "utils/MathUtils.h" -+#include "utils/TimeUtils.h" - #include "DVDCodecs/DVDCodecUtils.h" -+#include "cores/VideoRenderers/RenderFlags.h" -+ -+using namespace VDPAU; -+#define NUM_RENDER_PICS 9 - - #define ARSIZE(x) (sizeof(x) / sizeof((x)[0])) - --CVDPAU::Desc decoder_profiles[] = { -+CDecoder::Desc decoder_profiles[] = { - {"MPEG1", VDP_DECODER_PROFILE_MPEG1}, - {"MPEG2_SIMPLE", VDP_DECODER_PROFILE_MPEG2_SIMPLE}, - {"MPEG2_MAIN", VDP_DECODER_PROFILE_MPEG2_MAIN}, -@@ -50,14 +55,16 @@ - {"MPEG4_PART2_ASP", VDP_DECODER_PROFILE_MPEG4_PART2_ASP}, - #endif - }; --const size_t decoder_profile_count = sizeof(decoder_profiles)/sizeof(CVDPAU::Desc); -+const size_t decoder_profile_count = sizeof(decoder_profiles)/sizeof(CDecoder::Desc); - --static float studioCSC[3][4] = --{ -- { 1.0f, 0.0f, 1.57480000f,-0.78740000f}, -- { 1.0f,-0.18737736f,-0.46813736f, 0.32775736f}, -- { 1.0f, 1.85556000f, 0.0f,-0.92780000f} --}; -+//static float studioCSC[3][4] = -+//{ -+// { 1.0f, 0.0f, 1.57480000f,-0.78740000f}, -+// { 1.0f,-0.18737736f,-0.46813736f, 0.32775736f}, -+// { 1.0f, 1.85556000f, 0.0f,-0.92780000f} -+//}; -+static float studioCSCKCoeffs601[3] = {0.299, 0.587, 0.114}; //BT601 {Kr, Kg, Kb} -+static float studioCSCKCoeffs709[3] = {0.2126, 0.7152, 0.0722}; //BT709 {Kr, Kg, Kb} - - static struct SInterlaceMapping - { -@@ -68,88 +75,30 @@ - , {VS_INTERLACEMETHOD_VDPAU_TEMPORAL_HALF , VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL} - , {VS_INTERLACEMETHOD_VDPAU_TEMPORAL_SPATIAL , VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL_SPATIAL} - , {VS_INTERLACEMETHOD_VDPAU_TEMPORAL_SPATIAL_HALF, VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL_SPATIAL} --, {VS_INTERLACEMETHOD_VDPAU_INVERSE_TELECINE , VDP_VIDEO_MIXER_FEATURE_INVERSE_TELECINE} -+, {VS_INTERLACEMETHOD_VDPAU_INVERSE_TELECINE , VDP_VIDEO_MIXER_FEATURE_INVERSE_TELECINE} - , {VS_INTERLACEMETHOD_NONE , (VdpVideoMixerFeature)-1} - }; - - //since libvdpau 0.4, vdp_device_create_x11() installs a callback on the Display*, - //if we unload libvdpau with dlclose(), we segfault on XCloseDisplay, - //so we just keep a static handle to libvdpau around --void* CVDPAU::dl_handle; -+void* CDecoder::dl_handle; -+ -+//----------------------------------------------------------------------------- -+// CVDPAU -+//----------------------------------------------------------------------------- - --CVDPAU::CVDPAU() -+CDecoder::CDecoder() : m_vdpauOutput(&m_inMsgEvent) - { -- glXBindTexImageEXT = NULL; -- glXReleaseTexImageEXT = NULL; -- vdp_device = VDP_INVALID_HANDLE; -- surfaceNum = presentSurfaceNum = 0; -- picAge.b_age = picAge.ip_age[0] = picAge.ip_age[1] = 256*256*256*64; -- vdpauConfigured = false; -- m_DisplayState = VDPAU_OPEN; -- m_mixerfield = VDP_VIDEO_MIXER_PICTURE_STRUCTURE_FRAME; -- m_mixerstep = 0; -+ m_vdpauConfig.vdpDevice = VDP_INVALID_HANDLE; -+ m_vdpauConfig.videoSurfaces = &m_videoSurfaces; -+ m_vdpauConfig.videoSurfaceSec = &m_videoSurfaceSec; - -- m_glPixmap = 0; -- m_Pixmap = 0; -- if (!glXBindTexImageEXT) -- glXBindTexImageEXT = (PFNGLXBINDTEXIMAGEEXTPROC)glXGetProcAddress((GLubyte *) "glXBindTexImageEXT"); -- if (!glXReleaseTexImageEXT) -- glXReleaseTexImageEXT = (PFNGLXRELEASETEXIMAGEEXTPROC)glXGetProcAddress((GLubyte *) "glXReleaseTexImageEXT"); -+ m_vdpauConfigured = false; -+ m_DisplayState = VDPAU_OPEN; -+} - -- totalAvailableOutputSurfaces = 0; -- outputSurface = presentSurface = VDP_INVALID_HANDLE; -- vdp_flip_target = VDP_INVALID_HANDLE; -- vdp_flip_queue = VDP_INVALID_HANDLE; -- vid_width = vid_height = OutWidth = OutHeight = 0; -- surface_width = surface_height = 0; -- -- memset(&decoder, 0, sizeof(decoder)); -- memset(&outRect, 0, sizeof(outRect)); -- memset(&outRectVid, 0, sizeof(outRectVid)); -- -- m_Display = NULL; -- -- tmpBrightness = 0; -- tmpContrast = 0; -- tmpDeintMode = 0; -- tmpDeintGUI = 0; -- tmpDeint = 0; -- max_references = 0; -- -- for (int i = 0; i < NUM_OUTPUT_SURFACES; i++) -- outputSurfaces[i] = VDP_INVALID_HANDLE; -- -- videoMixer = VDP_INVALID_HANDLE; -- m_BlackBar = NULL; -- -- memset(m_features, 0, sizeof(m_features)); -- m_feature_count = 0; -- m_vdpauOutputMethod = OUTPUT_NONE; -- -- upScale = g_advancedSettings.m_videoVDPAUScaling; -- -- vdp_video_mixer_set_attribute_values = NULL; -- vdp_generate_csc_matrix = NULL; -- vdp_presentation_queue_target_destroy = NULL; -- vdp_presentation_queue_create = NULL; -- vdp_presentation_queue_destroy = NULL; -- vdp_presentation_queue_display = NULL; -- vdp_presentation_queue_block_until_surface_idle = NULL; -- vdp_presentation_queue_target_create_x11 = NULL; -- vdp_presentation_queue_query_surface_status = NULL; -- vdp_presentation_queue_get_time = NULL; -- vdp_get_error_string = NULL; -- vdp_decoder_create = NULL; -- vdp_decoder_destroy = NULL; -- vdp_decoder_render = NULL; -- vdp_decoder_query_caps = NULL; -- vdp_preemption_callback_register = NULL; -- dl_vdp_device_create_x11 = NULL; -- dl_vdp_get_proc_address = NULL; -- dl_vdp_preemption_callback_register = NULL; --} -- --bool CVDPAU::Open(AVCodecContext* avctx, const enum PixelFormat, unsigned int surfaces) -+bool CDecoder::Open(AVCodecContext* avctx, const enum PixelFormat, unsigned int surfaces) - { - if(avctx->coded_width == 0 - || avctx->coded_height == 0) -@@ -157,6 +106,8 @@ bool CVDPAU::Open(AVCodecContext* avctx, const enum PixelFormat, unsigned int su - CLog::Log(LOGWARNING,"(VDPAU) no width/height available, can't init"); - return false; - } -+ m_vdpauConfig.numRenderBuffers = surfaces; -+ m_decoderThread = CThread::GetCurrentThreadId(); - - if (!dl_handle) - { -@@ -168,8 +119,6 @@ bool CVDPAU::Open(AVCodecContext* avctx, const enum PixelFormat, unsigned int su - error = "dlerror() returned NULL"; - - CLog::Log(LOGNOTICE,"(VDPAU) Unable to get handle to libvdpau: %s", error); -- //g_application.m_guiDialogKaiToast.QueueNotification(CGUIDialogKaiToast::Error, "VDPAU", error, 10000); -- - return false; - } - } -@@ -178,8 +127,9 @@ bool CVDPAU::Open(AVCodecContext* avctx, const enum PixelFormat, unsigned int su - return false; - - InitVDPAUProcs(); -+ m_presentPicture = 0; - -- if (vdp_device != VDP_INVALID_HANDLE) -+ if (m_vdpauConfig.vdpDevice != VDP_INVALID_HANDLE) - { - SpewHardwareAvailable(); - -@@ -197,25 +147,23 @@ bool CVDPAU::Open(AVCodecContext* avctx, const enum PixelFormat, unsigned int su - - /* attempt to create a decoder with this width/height, some sizes are not supported by hw */ - VdpStatus vdp_st; -- vdp_st = vdp_decoder_create(vdp_device, profile, avctx->coded_width, avctx->coded_height, 5, &decoder); -+ vdp_st = m_vdpauConfig.vdpProcs.vdp_decoder_create(m_vdpauConfig.vdpDevice, profile, avctx->coded_width, avctx->coded_height, 5, &m_vdpauConfig.vdpDecoder); - - if(vdp_st != VDP_STATUS_OK) - { -- CLog::Log(LOGERROR, " (VDPAU) Error: %s(%d) checking for decoder support\n", vdp_get_error_string(vdp_st), vdp_st); -+ CLog::Log(LOGERROR, " (VDPAU) Error: %s(%d) checking for decoder support\n", m_vdpauConfig.vdpProcs.vdp_get_error_string(vdp_st), vdp_st); - FiniVDPAUProcs(); - return false; - } - -- vdp_decoder_destroy(decoder); -+ m_vdpauConfig.vdpProcs.vdp_decoder_destroy(m_vdpauConfig.vdpDecoder); - CheckStatus(vdp_st, __LINE__); - } - -- InitCSCMatrix(avctx->coded_height); -- - /* finally setup ffmpeg */ -- avctx->get_buffer = CVDPAU::FFGetBuffer; -- avctx->release_buffer = CVDPAU::FFReleaseBuffer; -- avctx->draw_horiz_band = CVDPAU::FFDrawSlice; -+ avctx->get_buffer = CDecoder::FFGetBuffer; -+ avctx->release_buffer = CDecoder::FFReleaseBuffer; -+ avctx->draw_horiz_band = CDecoder::FFDrawSlice; - avctx->slice_flags=SLICE_FLAG_CODED_ORDER|SLICE_FLAG_ALLOW_FIELD; - - g_Windowing.Register(this); -@@ -224,17 +172,20 @@ bool CVDPAU::Open(AVCodecContext* avctx, const enum PixelFormat, unsigned int su - return false; - } - --CVDPAU::~CVDPAU() -+CDecoder::~CDecoder() - { - Close(); - } - --void CVDPAU::Close() -+void CDecoder::Close() - { - CLog::Log(LOGNOTICE, " (VDPAU) %s", __FUNCTION__); - -+ CSingleLock lock(m_DecoderSection); -+ - FiniVDPAUOutput(); - FiniVDPAUProcs(); -+ m_vdpauOutput.Dispose(); - - while (!m_videoSurfaces.empty()) - { -@@ -250,188 +201,111 @@ void CVDPAU::Close() - m_dllAvUtil.Unload(); - } - --bool CVDPAU::MakePixmapGL() -+long CDecoder::Release() - { -- int num=0; -- int fbConfigIndex = 0; -- -- int doubleVisAttributes[] = { -- GLX_RENDER_TYPE, GLX_RGBA_BIT, -- GLX_RED_SIZE, 8, -- GLX_GREEN_SIZE, 8, -- GLX_BLUE_SIZE, 8, -- GLX_ALPHA_SIZE, 8, -- GLX_DEPTH_SIZE, 8, -- GLX_DRAWABLE_TYPE, GLX_PIXMAP_BIT, -- GLX_BIND_TO_TEXTURE_RGBA_EXT, True, -- GLX_DOUBLEBUFFER, True, -- GLX_Y_INVERTED_EXT, True, -- GLX_X_RENDERABLE, True, -- None -- }; -- -- int pixmapAttribs[] = { -- GLX_TEXTURE_TARGET_EXT, GLX_TEXTURE_2D_EXT, -- GLX_TEXTURE_FORMAT_EXT, GLX_TEXTURE_FORMAT_RGBA_EXT, -- None -- }; -- -- GLXFBConfig *fbConfigs; -- fbConfigs = glXChooseFBConfig(m_Display, DefaultScreen(m_Display), doubleVisAttributes, &num); -- if (fbConfigs==NULL) -+ // check if we should do some pre-cleanup here -+ // a second decoder might need resources -+ if (m_vdpauConfigured == true) - { -- CLog::Log(LOGERROR, "GLX Error: MakePixmap: No compatible framebuffers found"); -- return false; -- } -- CLog::Log(LOGDEBUG, "Found %d fbconfigs.", num); -- fbConfigIndex = 0; -- CLog::Log(LOGDEBUG, "Using fbconfig index %d.", fbConfigIndex); -+ CSingleLock lock(m_DecoderSection); -+ CLog::Log(LOGNOTICE,"CVDPAU::Release pre-cleanup"); - -- m_glPixmap = glXCreatePixmap(m_Display, fbConfigs[fbConfigIndex], m_Pixmap, pixmapAttribs); -+ Message *reply; -+ if (m_vdpauOutput.m_controlPort.SendOutMessageSync(COutputControlProtocol::PRECLEANUP, -+ &reply, -+ 2000)) -+ { -+ bool success = reply->signal == COutputControlProtocol::ACC ? true : false; -+ reply->Release(); -+ if (!success) -+ { -+ CLog::Log(LOGERROR, "VDPAU::%s - pre-cleanup returned error", __FUNCTION__); -+ m_DisplayState = VDPAU_ERROR; -+ } -+ } -+ else -+ { -+ CLog::Log(LOGERROR, "VDPAU::%s - pre-cleanup timed out", __FUNCTION__); -+ m_DisplayState = VDPAU_ERROR; -+ } - -- if (!m_glPixmap) -- { -- CLog::Log(LOGINFO, "GLX Error: Could not create Pixmap"); -- XFree(fbConfigs); -- return false; -+ for(unsigned int i = 0; i < m_videoSurfaces.size(); ++i) -+ { -+ vdpau_render_state *render = m_videoSurfaces[i]; -+ if (render->surface != VDP_INVALID_HANDLE && !(render->state & FF_VDPAU_STATE_USED_FOR_RENDER)) -+ { -+ m_vdpauConfig.vdpProcs.vdp_video_surface_destroy(render->surface); -+ render->surface = VDP_INVALID_HANDLE; -+ } -+ } - } -- XFree(fbConfigs); -+ IHardwareDecoder::Release(); -+} - -- return true; -+long CDecoder::ReleasePicReference() -+{ -+ return IHardwareDecoder::Release(); - } - --bool CVDPAU::MakePixmap(int width, int height) -+void CDecoder::SetWidthHeight(int width, int height) - { -+ m_vdpauConfig.upscale = g_advancedSettings.m_videoVDPAUScaling; -+ - //pick the smallest dimensions, so we downscale with vdpau and upscale with opengl when appropriate - //this requires the least amount of gpu memory bandwidth -- if (g_graphicsContext.GetWidth() < width || g_graphicsContext.GetHeight() < height || upScale) -+ if (g_graphicsContext.GetWidth() < width || g_graphicsContext.GetHeight() < height || m_vdpauConfig.upscale >= 0) - { - //scale width to desktop size if the aspect ratio is the same or bigger than the desktop - if ((double)height * g_graphicsContext.GetWidth() / width <= (double)g_graphicsContext.GetHeight()) - { -- OutWidth = g_graphicsContext.GetWidth(); -- OutHeight = MathUtils::round_int((double)height * g_graphicsContext.GetWidth() / width); -+ m_vdpauConfig.outWidth = g_graphicsContext.GetWidth(); -+ m_vdpauConfig.outHeight = MathUtils::round_int((double)height * g_graphicsContext.GetWidth() / width); - } - else //scale height to the desktop size if the aspect ratio is smaller than the desktop - { -- OutHeight = g_graphicsContext.GetHeight(); -- OutWidth = MathUtils::round_int((double)width * g_graphicsContext.GetHeight() / height); -+ m_vdpauConfig.outHeight = g_graphicsContext.GetHeight(); -+ m_vdpauConfig.outWidth = MathUtils::round_int((double)width * g_graphicsContext.GetHeight() / height); - } - } - else - { //let opengl scale -- OutWidth = width; -- OutHeight = height; -- } -- -- CLog::Log(LOGNOTICE,"Creating %ix%i pixmap", OutWidth, OutHeight); -- -- // Get our window attribs. -- XWindowAttributes wndattribs; -- XGetWindowAttributes(m_Display, DefaultRootWindow(m_Display), &wndattribs); // returns a status but I don't know what success is -- -- m_Pixmap = XCreatePixmap(m_Display, -- DefaultRootWindow(m_Display), -- OutWidth, -- OutHeight, -- wndattribs.depth); -- if (!m_Pixmap) -- { -- CLog::Log(LOGERROR, "GLX Error: MakePixmap: Unable to create XPixmap"); -- return false; -- } -- -- XGCValues values = {}; -- GC xgc; -- values.foreground = BlackPixel (m_Display, DefaultScreen (m_Display)); -- xgc = XCreateGC(m_Display, m_Pixmap, GCForeground, &values); -- XFillRectangle(m_Display, m_Pixmap, xgc, 0, 0, OutWidth, OutHeight); -- XFreeGC(m_Display, xgc); -- -- if(!MakePixmapGL()) -- return false; -- -- return true; --} -- --void CVDPAU::BindPixmap() --{ -- CSharedLock lock(m_DecoderSection); -- -- { CSharedLock dLock(m_DisplaySection); -- if (m_DisplayState != VDPAU_OPEN) -- return; -- } -- -- if (m_glPixmap) -- { -- if(presentSurface != VDP_INVALID_HANDLE) -- { -- VdpPresentationQueueStatus status; -- VdpTime time; -- VdpStatus vdp_st; -- vdp_st = vdp_presentation_queue_query_surface_status( -- vdp_flip_queue, presentSurface, &status, &time); -- CheckStatus(vdp_st, __LINE__); -- while(status != VDP_PRESENTATION_QUEUE_STATUS_VISIBLE && vdp_st == VDP_STATUS_OK) -- { -- Sleep(1); -- vdp_st = vdp_presentation_queue_query_surface_status( -- vdp_flip_queue, presentSurface, &status, &time); -- CheckStatus(vdp_st, __LINE__); -- } -- } -- -- glXBindTexImageEXT(m_Display, m_glPixmap, GLX_FRONT_LEFT_EXT, NULL); -- } -- else CLog::Log(LOGERROR,"(VDPAU) BindPixmap called without valid pixmap"); --} -- --void CVDPAU::ReleasePixmap() --{ -- CSharedLock lock(m_DecoderSection); -- -- { CSharedLock dLock(m_DisplaySection); -- if (m_DisplayState != VDPAU_OPEN) -- return; -- } -- -- if (m_glPixmap) -- { -- glXReleaseTexImageEXT(m_Display, m_glPixmap, GLX_FRONT_LEFT_EXT); -+ m_vdpauConfig.outWidth = width; -+ m_vdpauConfig.outHeight = height; - } -- else CLog::Log(LOGERROR,"(VDPAU) ReleasePixmap called without valid pixmap"); -+ CLog::Log(LOGDEBUG, "CVDPAU::SetWidthHeight Setting OutWidth: %i OutHeight: %i", m_vdpauConfig.outWidth, m_vdpauConfig.outHeight); - } - --void CVDPAU::OnLostDevice() -+void CDecoder::OnLostDevice() - { - CLog::Log(LOGNOTICE,"CVDPAU::OnLostDevice event"); - -- CExclusiveLock lock(m_DecoderSection); -+ CSingleLock lock(m_DecoderSection); - FiniVDPAUOutput(); - FiniVDPAUProcs(); - - m_DisplayState = VDPAU_LOST; -+ lock.Leave(); - m_DisplayEvent.Reset(); - } - --void CVDPAU::OnResetDevice() -+void CDecoder::OnResetDevice() - { - CLog::Log(LOGNOTICE,"CVDPAU::OnResetDevice event"); - -- CExclusiveLock lock(m_DisplaySection); -+ CSingleLock lock(m_DecoderSection); - if (m_DisplayState == VDPAU_LOST) - { - m_DisplayState = VDPAU_RESET; -+ lock.Leave(); - m_DisplayEvent.Set(); - } - } - --int CVDPAU::Check(AVCodecContext* avctx) -+int CDecoder::Check(AVCodecContext* avctx) - { - EDisplayState state; - -- { CSharedLock lock(m_DisplaySection); -+ { CSingleLock lock(m_DecoderSection); - state = m_DisplayState; - } - -@@ -445,16 +319,13 @@ int CVDPAU::Check(AVCodecContext* avctx) - } - else - { -- CSharedLock lock(m_DisplaySection); -+ CSingleLock lock(m_DecoderSection); - state = m_DisplayState; - } - } - if (state == VDPAU_RESET || state == VDPAU_ERROR) - { -- CLog::Log(LOGNOTICE,"Attempting recovery"); -- -- CSingleLock gLock(g_graphicsContext); -- CExclusiveLock lock(m_DecoderSection); -+ CSingleLock lock(m_DecoderSection); - - FiniVDPAUOutput(); - FiniVDPAUProcs(); -@@ -469,7 +340,7 @@ int CVDPAU::Check(AVCodecContext* avctx) - return 0; - } - --bool CVDPAU::IsVDPAUFormat(PixelFormat format) -+bool CDecoder::IsVDPAUFormat(PixelFormat format) - { - if ((format >= PIX_FMT_VDPAU_H264) && (format <= PIX_FMT_VDPAU_VC1)) return true; - #if (defined PIX_FMT_VDPAU_MPEG4_IN_AVUTIL) -@@ -478,91 +349,28 @@ bool CVDPAU::IsVDPAUFormat(PixelFormat format) - else return false; - } - --void CVDPAU::CheckFeatures() --{ -- if (videoMixer == VDP_INVALID_HANDLE) -- { -- CLog::Log(LOGNOTICE, " (VDPAU) Creating the video mixer"); -- // Creation of VideoMixer. -- VdpVideoMixerParameter parameters[] = { -- VDP_VIDEO_MIXER_PARAMETER_VIDEO_SURFACE_WIDTH, -- VDP_VIDEO_MIXER_PARAMETER_VIDEO_SURFACE_HEIGHT, -- VDP_VIDEO_MIXER_PARAMETER_CHROMA_TYPE -- }; -- -- void const * parameter_values[] = { -- &surface_width, -- &surface_height, -- &vdp_chroma_type -- }; -- -- tmpBrightness = 0; -- tmpContrast = 0; -- tmpNoiseReduction = 0; -- tmpSharpness = 0; -- -- VdpStatus vdp_st = VDP_STATUS_ERROR; -- vdp_st = vdp_video_mixer_create(vdp_device, -- m_feature_count, -- m_features, -- ARSIZE(parameters), -- parameters, -- parameter_values, -- &videoMixer); -- CheckStatus(vdp_st, __LINE__); -- -- SetHWUpscaling(); -- } -- -- if (tmpBrightness != g_settings.m_currentVideoSettings.m_Brightness || -- tmpContrast != g_settings.m_currentVideoSettings.m_Contrast) -- { -- SetColor(); -- tmpBrightness = g_settings.m_currentVideoSettings.m_Brightness; -- tmpContrast = g_settings.m_currentVideoSettings.m_Contrast; -- } -- if (tmpNoiseReduction != g_settings.m_currentVideoSettings.m_NoiseReduction) -- { -- tmpNoiseReduction = g_settings.m_currentVideoSettings.m_NoiseReduction; -- SetNoiseReduction(); -- } -- if (tmpSharpness != g_settings.m_currentVideoSettings.m_Sharpness) -- { -- tmpSharpness = g_settings.m_currentVideoSettings.m_Sharpness; -- SetSharpness(); -- } -- if ( tmpDeintMode != g_settings.m_currentVideoSettings.m_DeinterlaceMode || -- tmpDeintGUI != g_settings.m_currentVideoSettings.m_InterlaceMethod || -- (tmpDeintGUI == VS_INTERLACEMETHOD_AUTO && tmpDeint != AutoInterlaceMethod())) -- { -- tmpDeintMode = g_settings.m_currentVideoSettings.m_DeinterlaceMode; -- tmpDeintGUI = g_settings.m_currentVideoSettings.m_InterlaceMethod; -- if (tmpDeintGUI == VS_INTERLACEMETHOD_AUTO) -- tmpDeint = AutoInterlaceMethod(); -- else -- tmpDeint = tmpDeintGUI; -- -- SetDeinterlacing(); -- } --} -- --bool CVDPAU::Supports(VdpVideoMixerFeature feature) -+bool CDecoder::Supports(VdpVideoMixerFeature feature) - { -- for(int i = 0; i < m_feature_count; i++) -+ for(int i = 0; i < m_vdpauConfig.featureCount; i++) - { -- if(m_features[i] == feature) -+ if(m_vdpauConfig.vdpFeatures[i] == feature) - return true; - } - return false; - } - --bool CVDPAU::Supports(EINTERLACEMETHOD method) -+bool CDecoder::Supports(EINTERLACEMETHOD method) - { - if(method == VS_INTERLACEMETHOD_VDPAU_BOB -- || method == VS_INTERLACEMETHOD_AUTO -- || method == VS_INTERLACEMETHOD_AUTO_ION) -+ || method == VS_INTERLACEMETHOD_AUTO) - return true; - -+ if (g_guiSettings.GetBool("videoplayer.usevdpauinteropyuv")) -+ { -+ if (method == VS_INTERLACEMETHOD_RENDER_BOB) -+ return true; -+ } -+ - for(SInterlaceMapping* p = g_interlace_mapping; p->method != VS_INTERLACEMETHOD_NONE; p++) - { - if(p->method == method) -@@ -571,162 +379,12 @@ bool CVDPAU::Supports(EINTERLACEMETHOD method) - return false; - } - --EINTERLACEMETHOD CVDPAU::AutoInterlaceMethod() --{ -- return VS_INTERLACEMETHOD_VDPAU_TEMPORAL; --} -- --void CVDPAU::SetColor() --{ -- VdpStatus vdp_st; -- -- if (tmpBrightness != g_settings.m_currentVideoSettings.m_Brightness) -- m_Procamp.brightness = (float)((g_settings.m_currentVideoSettings.m_Brightness)-50) / 100; -- if (tmpContrast != g_settings.m_currentVideoSettings.m_Contrast) -- m_Procamp.contrast = (float)((g_settings.m_currentVideoSettings.m_Contrast)+50) / 100; -- -- if(vid_height >= 600 || vid_width > 1024) -- vdp_st = vdp_generate_csc_matrix(&m_Procamp, VDP_COLOR_STANDARD_ITUR_BT_709, &m_CSCMatrix); -- else -- vdp_st = vdp_generate_csc_matrix(&m_Procamp, VDP_COLOR_STANDARD_ITUR_BT_601, &m_CSCMatrix); -- -- VdpVideoMixerAttribute attributes[] = { VDP_VIDEO_MIXER_ATTRIBUTE_CSC_MATRIX }; -- if (g_guiSettings.GetBool("videoplayer.vdpaustudiolevel")) -- { -- void const * pm_CSCMatix[] = { &studioCSC }; -- vdp_st = vdp_video_mixer_set_attribute_values(videoMixer, ARSIZE(attributes), attributes, pm_CSCMatix); -- } -- else -- { -- void const * pm_CSCMatix[] = { &m_CSCMatrix }; -- vdp_st = vdp_video_mixer_set_attribute_values(videoMixer, ARSIZE(attributes), attributes, pm_CSCMatix); -- } -- CheckStatus(vdp_st, __LINE__); --} -- --void CVDPAU::SetNoiseReduction() --{ -- if(!Supports(VDP_VIDEO_MIXER_FEATURE_NOISE_REDUCTION)) -- return; -- -- VdpVideoMixerFeature feature[] = { VDP_VIDEO_MIXER_FEATURE_NOISE_REDUCTION }; -- VdpVideoMixerAttribute attributes[] = { VDP_VIDEO_MIXER_ATTRIBUTE_NOISE_REDUCTION_LEVEL }; -- VdpStatus vdp_st; -- -- if (!g_settings.m_currentVideoSettings.m_NoiseReduction) -- { -- VdpBool enabled[]= {0}; -- vdp_st = vdp_video_mixer_set_feature_enables(videoMixer, ARSIZE(feature), feature, enabled); -- CheckStatus(vdp_st, __LINE__); -- return; -- } -- VdpBool enabled[]={1}; -- vdp_st = vdp_video_mixer_set_feature_enables(videoMixer, ARSIZE(feature), feature, enabled); -- CheckStatus(vdp_st, __LINE__); -- void* nr[] = { &g_settings.m_currentVideoSettings.m_NoiseReduction }; -- CLog::Log(LOGNOTICE,"Setting Noise Reduction to %f",g_settings.m_currentVideoSettings.m_NoiseReduction); -- vdp_st = vdp_video_mixer_set_attribute_values(videoMixer, ARSIZE(attributes), attributes, nr); -- CheckStatus(vdp_st, __LINE__); --} -- --void CVDPAU::SetSharpness() --{ -- if(!Supports(VDP_VIDEO_MIXER_FEATURE_SHARPNESS)) -- return; -- -- VdpVideoMixerFeature feature[] = { VDP_VIDEO_MIXER_FEATURE_SHARPNESS }; -- VdpVideoMixerAttribute attributes[] = { VDP_VIDEO_MIXER_ATTRIBUTE_SHARPNESS_LEVEL }; -- VdpStatus vdp_st; -- -- if (!g_settings.m_currentVideoSettings.m_Sharpness) -- { -- VdpBool enabled[]={0}; -- vdp_st = vdp_video_mixer_set_feature_enables(videoMixer, ARSIZE(feature), feature, enabled); -- CheckStatus(vdp_st, __LINE__); -- return; -- } -- VdpBool enabled[]={1}; -- vdp_st = vdp_video_mixer_set_feature_enables(videoMixer, ARSIZE(feature), feature, enabled); -- CheckStatus(vdp_st, __LINE__); -- void* sh[] = { &g_settings.m_currentVideoSettings.m_Sharpness }; -- CLog::Log(LOGNOTICE,"Setting Sharpness to %f",g_settings.m_currentVideoSettings.m_Sharpness); -- vdp_st = vdp_video_mixer_set_attribute_values(videoMixer, ARSIZE(attributes), attributes, sh); -- CheckStatus(vdp_st, __LINE__); --} -- --void CVDPAU::SetHWUpscaling() --{ --#ifdef VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1 -- if(!Supports(VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1) || !upScale) -- return; -- -- VdpVideoMixerFeature feature[] = { VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1 }; -- VdpStatus vdp_st; -- VdpBool enabled[]={1}; -- vdp_st = vdp_video_mixer_set_feature_enables(videoMixer, ARSIZE(feature), feature, enabled); -- CheckStatus(vdp_st, __LINE__); --#endif --} -- --void CVDPAU::SetDeinterlacing() -+EINTERLACEMETHOD CDecoder::AutoInterlaceMethod() - { -- VdpStatus vdp_st; -- EDEINTERLACEMODE mode = g_settings.m_currentVideoSettings.m_DeinterlaceMode; -- EINTERLACEMETHOD method = g_settings.m_currentVideoSettings.m_InterlaceMethod; -- if (method == VS_INTERLACEMETHOD_AUTO) -- method = AutoInterlaceMethod(); -- -- VdpVideoMixerFeature feature[] = { VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL, -- VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL_SPATIAL, -- VDP_VIDEO_MIXER_FEATURE_INVERSE_TELECINE }; -- if (mode == VS_DEINTERLACEMODE_OFF) -- { -- VdpBool enabled[]={0,0,0}; -- vdp_st = vdp_video_mixer_set_feature_enables(videoMixer, ARSIZE(feature), feature, enabled); -- } -- else -- { -- if (method == VS_INTERLACEMETHOD_AUTO_ION) -- { -- if (vid_height <= 576) -- { -- VdpBool enabled[]={1,1,0}; -- vdp_st = vdp_video_mixer_set_feature_enables(videoMixer, ARSIZE(feature), feature, enabled); -- } -- else if (vid_height > 576) -- { -- VdpBool enabled[]={1,0,0}; -- vdp_st = vdp_video_mixer_set_feature_enables(videoMixer, ARSIZE(feature), feature, enabled); -- } -- } -- else if (method == VS_INTERLACEMETHOD_VDPAU_TEMPORAL -- || method == VS_INTERLACEMETHOD_VDPAU_TEMPORAL_HALF) -- { -- VdpBool enabled[]={1,0,0}; -- vdp_st = vdp_video_mixer_set_feature_enables(videoMixer, ARSIZE(feature), feature, enabled); -- } -- else if (method == VS_INTERLACEMETHOD_VDPAU_TEMPORAL_SPATIAL -- || method == VS_INTERLACEMETHOD_VDPAU_TEMPORAL_SPATIAL_HALF) -- { -- VdpBool enabled[]={1,1,0}; -- vdp_st = vdp_video_mixer_set_feature_enables(videoMixer, ARSIZE(feature), feature, enabled); -- } -- else if (method == VS_INTERLACEMETHOD_VDPAU_INVERSE_TELECINE) -- { -- VdpBool enabled[]={1,0,1}; -- vdp_st = vdp_video_mixer_set_feature_enables(videoMixer, ARSIZE(feature), feature, enabled); -- } -- else -- { -- VdpBool enabled[]={0,0,0}; -- vdp_st = vdp_video_mixer_set_feature_enables(videoMixer, ARSIZE(feature), feature, enabled); -- } -- } -- -- CheckStatus(vdp_st, __LINE__); -+ return VS_INTERLACEMETHOD_RENDER_BOB; - } - --void CVDPAU::InitVDPAUProcs() -+void CDecoder::InitVDPAUProcs() - { - char* error; - -@@ -736,151 +394,115 @@ void CVDPAU::InitVDPAUProcs() - if (error) - { - CLog::Log(LOGERROR,"(VDPAU) - %s in %s",error,__FUNCTION__); -- vdp_device = VDP_INVALID_HANDLE; -- -- //g_application.m_guiDialogKaiToast.QueueNotification(CGUIDialogKaiToast::Error, "VDPAU", error, 10000); -- -+ m_vdpauConfig.vdpDevice = VDP_INVALID_HANDLE; - return; - } - - if (dl_vdp_device_create_x11) - { -- CSingleLock lock(g_graphicsContext); -- m_Display = g_Windowing.GetDisplay(); -- } -- else -- { -- CLog::Log(LOGERROR,"(VDPAU) - Unable to get dl_vdp_device_create_x11 in %s", __FUNCTION__); -- vdp_device = VDP_INVALID_HANDLE; -- return; -+ m_Display = XOpenDisplay(NULL); - } - -- int mScreen = DefaultScreen(m_Display); -+ int mScreen = g_Windowing.GetCurrentScreen(); - VdpStatus vdp_st; - - // Create Device -- // tested on 64bit Ubuntu 11.10 and it deadlocked without this -- XLockDisplay(m_Display); - vdp_st = dl_vdp_device_create_x11(m_Display, //x_display, - mScreen, //x_screen, -- &vdp_device, -- &vdp_get_proc_address); -- XUnlockDisplay(m_Display); -+ &m_vdpauConfig.vdpDevice, -+ &m_vdpauConfig.vdpProcs.vdp_get_proc_address); - -- CLog::Log(LOGNOTICE,"vdp_device = 0x%08x vdp_st = 0x%08x",vdp_device,vdp_st); -+ CLog::Log(LOGNOTICE,"vdp_device = 0x%08x vdp_st = 0x%08x",m_vdpauConfig.vdpDevice,vdp_st); - if (vdp_st != VDP_STATUS_OK) - { - CLog::Log(LOGERROR,"(VDPAU) unable to init VDPAU - vdp_st = 0x%x. Falling back.",vdp_st); -- vdp_device = VDP_INVALID_HANDLE; -+ m_vdpauConfig.vdpDevice = VDP_INVALID_HANDLE; - return; - } - - #define VDP_PROC(id, proc) \ - do { \ -- vdp_st = vdp_get_proc_address(vdp_device, id, (void**)&proc); \ -+ vdp_st = m_vdpauConfig.vdpProcs.vdp_get_proc_address(m_vdpauConfig.vdpDevice, id, (void**)&proc); \ - CheckStatus(vdp_st, __LINE__); \ - } while(0); - -- VDP_PROC(VDP_FUNC_ID_GET_ERROR_STRING , vdp_get_error_string); -- VDP_PROC(VDP_FUNC_ID_DEVICE_DESTROY , vdp_device_destroy); -- VDP_PROC(VDP_FUNC_ID_GENERATE_CSC_MATRIX , vdp_generate_csc_matrix); -- VDP_PROC(VDP_FUNC_ID_VIDEO_SURFACE_CREATE , vdp_video_surface_create); -- VDP_PROC(VDP_FUNC_ID_VIDEO_SURFACE_DESTROY , vdp_video_surface_destroy); -- VDP_PROC(VDP_FUNC_ID_VIDEO_SURFACE_PUT_BITS_Y_CB_CR , vdp_video_surface_put_bits_y_cb_cr); -- VDP_PROC(VDP_FUNC_ID_VIDEO_SURFACE_GET_BITS_Y_CB_CR , vdp_video_surface_get_bits_y_cb_cr); -- VDP_PROC(VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_Y_CB_CR , vdp_output_surface_put_bits_y_cb_cr); -- VDP_PROC(VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_NATIVE , vdp_output_surface_put_bits_native); -- VDP_PROC(VDP_FUNC_ID_OUTPUT_SURFACE_CREATE , vdp_output_surface_create); -- VDP_PROC(VDP_FUNC_ID_OUTPUT_SURFACE_DESTROY , vdp_output_surface_destroy); -- VDP_PROC(VDP_FUNC_ID_OUTPUT_SURFACE_GET_BITS_NATIVE , vdp_output_surface_get_bits_native); -- VDP_PROC(VDP_FUNC_ID_OUTPUT_SURFACE_RENDER_OUTPUT_SURFACE, vdp_output_surface_render_output_surface); -- VDP_PROC(VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_INDEXED , vdp_output_surface_put_bits_indexed); -- VDP_PROC(VDP_FUNC_ID_VIDEO_MIXER_CREATE , vdp_video_mixer_create); -- VDP_PROC(VDP_FUNC_ID_VIDEO_MIXER_SET_FEATURE_ENABLES , vdp_video_mixer_set_feature_enables); -- VDP_PROC(VDP_FUNC_ID_VIDEO_MIXER_DESTROY , vdp_video_mixer_destroy); -- VDP_PROC(VDP_FUNC_ID_VIDEO_MIXER_RENDER , vdp_video_mixer_render); -- VDP_PROC(VDP_FUNC_ID_VIDEO_MIXER_SET_ATTRIBUTE_VALUES , vdp_video_mixer_set_attribute_values); -- VDP_PROC(VDP_FUNC_ID_VIDEO_MIXER_QUERY_PARAMETER_SUPPORT , vdp_video_mixer_query_parameter_support); -- VDP_PROC(VDP_FUNC_ID_VIDEO_MIXER_QUERY_FEATURE_SUPPORT , vdp_video_mixer_query_feature_support); -- VDP_PROC(VDP_FUNC_ID_DECODER_CREATE , vdp_decoder_create); -- VDP_PROC(VDP_FUNC_ID_DECODER_DESTROY , vdp_decoder_destroy); -- VDP_PROC(VDP_FUNC_ID_DECODER_RENDER , vdp_decoder_render); -- VDP_PROC(VDP_FUNC_ID_DECODER_QUERY_CAPABILITIES , vdp_decoder_query_caps); -- VDP_PROC(VDP_FUNC_ID_PREEMPTION_CALLBACK_REGISTER , vdp_preemption_callback_register); -- VDP_PROC(VDP_FUNC_ID_PRESENTATION_QUEUE_TARGET_DESTROY , vdp_presentation_queue_target_destroy); -- VDP_PROC(VDP_FUNC_ID_PRESENTATION_QUEUE_CREATE , vdp_presentation_queue_create); -- VDP_PROC(VDP_FUNC_ID_PRESENTATION_QUEUE_DESTROY , vdp_presentation_queue_destroy); -- VDP_PROC(VDP_FUNC_ID_PRESENTATION_QUEUE_DISPLAY , vdp_presentation_queue_display); -- VDP_PROC(VDP_FUNC_ID_PRESENTATION_QUEUE_BLOCK_UNTIL_SURFACE_IDLE, vdp_presentation_queue_block_until_surface_idle); -- VDP_PROC(VDP_FUNC_ID_PRESENTATION_QUEUE_TARGET_CREATE_X11 , vdp_presentation_queue_target_create_x11); -- VDP_PROC(VDP_FUNC_ID_PRESENTATION_QUEUE_QUERY_SURFACE_STATUS , vdp_presentation_queue_query_surface_status); -- VDP_PROC(VDP_FUNC_ID_PRESENTATION_QUEUE_GET_TIME , vdp_presentation_queue_get_time); -- -+ VDP_PROC(VDP_FUNC_ID_GET_ERROR_STRING , m_vdpauConfig.vdpProcs.vdp_get_error_string); -+ VDP_PROC(VDP_FUNC_ID_DEVICE_DESTROY , m_vdpauConfig.vdpProcs.vdp_device_destroy); -+ VDP_PROC(VDP_FUNC_ID_GENERATE_CSC_MATRIX , m_vdpauConfig.vdpProcs.vdp_generate_csc_matrix); -+ VDP_PROC(VDP_FUNC_ID_VIDEO_SURFACE_CREATE , m_vdpauConfig.vdpProcs.vdp_video_surface_create); -+ VDP_PROC(VDP_FUNC_ID_VIDEO_SURFACE_DESTROY , m_vdpauConfig.vdpProcs.vdp_video_surface_destroy); -+ VDP_PROC(VDP_FUNC_ID_VIDEO_SURFACE_PUT_BITS_Y_CB_CR , m_vdpauConfig.vdpProcs.vdp_video_surface_put_bits_y_cb_cr); -+ VDP_PROC(VDP_FUNC_ID_VIDEO_SURFACE_GET_BITS_Y_CB_CR , m_vdpauConfig.vdpProcs.vdp_video_surface_get_bits_y_cb_cr); -+ VDP_PROC(VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_Y_CB_CR , m_vdpauConfig.vdpProcs.vdp_output_surface_put_bits_y_cb_cr); -+ VDP_PROC(VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_NATIVE , m_vdpauConfig.vdpProcs.vdp_output_surface_put_bits_native); -+ VDP_PROC(VDP_FUNC_ID_OUTPUT_SURFACE_CREATE , m_vdpauConfig.vdpProcs.vdp_output_surface_create); -+ VDP_PROC(VDP_FUNC_ID_OUTPUT_SURFACE_DESTROY , m_vdpauConfig.vdpProcs.vdp_output_surface_destroy); -+ VDP_PROC(VDP_FUNC_ID_OUTPUT_SURFACE_GET_BITS_NATIVE , m_vdpauConfig.vdpProcs.vdp_output_surface_get_bits_native); -+ VDP_PROC(VDP_FUNC_ID_OUTPUT_SURFACE_RENDER_OUTPUT_SURFACE, m_vdpauConfig.vdpProcs.vdp_output_surface_render_output_surface); -+ VDP_PROC(VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_INDEXED , m_vdpauConfig.vdpProcs.vdp_output_surface_put_bits_indexed); -+ VDP_PROC(VDP_FUNC_ID_VIDEO_MIXER_CREATE , m_vdpauConfig.vdpProcs.vdp_video_mixer_create); -+ VDP_PROC(VDP_FUNC_ID_VIDEO_MIXER_SET_FEATURE_ENABLES , m_vdpauConfig.vdpProcs.vdp_video_mixer_set_feature_enables); -+ VDP_PROC(VDP_FUNC_ID_VIDEO_MIXER_DESTROY , m_vdpauConfig.vdpProcs.vdp_video_mixer_destroy); -+ VDP_PROC(VDP_FUNC_ID_VIDEO_MIXER_RENDER , m_vdpauConfig.vdpProcs.vdp_video_mixer_render); -+ VDP_PROC(VDP_FUNC_ID_VIDEO_MIXER_SET_ATTRIBUTE_VALUES , m_vdpauConfig.vdpProcs.vdp_video_mixer_set_attribute_values); -+ VDP_PROC(VDP_FUNC_ID_VIDEO_MIXER_QUERY_PARAMETER_SUPPORT , m_vdpauConfig.vdpProcs.vdp_video_mixer_query_parameter_support); -+ VDP_PROC(VDP_FUNC_ID_VIDEO_MIXER_QUERY_FEATURE_SUPPORT , m_vdpauConfig.vdpProcs.vdp_video_mixer_query_feature_support); -+ VDP_PROC(VDP_FUNC_ID_DECODER_CREATE , m_vdpauConfig.vdpProcs.vdp_decoder_create); -+ VDP_PROC(VDP_FUNC_ID_DECODER_DESTROY , m_vdpauConfig.vdpProcs.vdp_decoder_destroy); -+ VDP_PROC(VDP_FUNC_ID_DECODER_RENDER , m_vdpauConfig.vdpProcs.vdp_decoder_render); -+ VDP_PROC(VDP_FUNC_ID_DECODER_QUERY_CAPABILITIES , m_vdpauConfig.vdpProcs.vdp_decoder_query_caps); -+ VDP_PROC(VDP_FUNC_ID_PRESENTATION_QUEUE_TARGET_DESTROY , m_vdpauConfig.vdpProcs.vdp_presentation_queue_target_destroy); -+ VDP_PROC(VDP_FUNC_ID_PRESENTATION_QUEUE_CREATE , m_vdpauConfig.vdpProcs.vdp_presentation_queue_create); -+ VDP_PROC(VDP_FUNC_ID_PRESENTATION_QUEUE_DESTROY , m_vdpauConfig.vdpProcs.vdp_presentation_queue_destroy); -+ VDP_PROC(VDP_FUNC_ID_PRESENTATION_QUEUE_DISPLAY , m_vdpauConfig.vdpProcs.vdp_presentation_queue_display); -+ VDP_PROC(VDP_FUNC_ID_PRESENTATION_QUEUE_BLOCK_UNTIL_SURFACE_IDLE, m_vdpauConfig.vdpProcs.vdp_presentation_queue_block_until_surface_idle); -+ VDP_PROC(VDP_FUNC_ID_PRESENTATION_QUEUE_TARGET_CREATE_X11 , m_vdpauConfig.vdpProcs.vdp_presentation_queue_target_create_x11); -+ VDP_PROC(VDP_FUNC_ID_PRESENTATION_QUEUE_QUERY_SURFACE_STATUS , m_vdpauConfig.vdpProcs.vdp_presentation_queue_query_surface_status); -+ VDP_PROC(VDP_FUNC_ID_PRESENTATION_QUEUE_GET_TIME , m_vdpauConfig.vdpProcs.vdp_presentation_queue_get_time); -+ - #undef VDP_PROC - - // set all vdpau resources to invalid -- vdp_flip_target = VDP_INVALID_HANDLE; -- vdp_flip_queue = VDP_INVALID_HANDLE; -- videoMixer = VDP_INVALID_HANDLE; -- totalAvailableOutputSurfaces = 0; -- presentSurface = VDP_INVALID_HANDLE; -- outputSurface = VDP_INVALID_HANDLE; -- for (int i = 0; i < NUM_OUTPUT_SURFACES; i++) -- outputSurfaces[i] = VDP_INVALID_HANDLE; -- -- m_vdpauOutputMethod = OUTPUT_NONE; -- -- CExclusiveLock lock(m_DisplaySection); - m_DisplayState = VDPAU_OPEN; -- vdpauConfigured = false; -+ m_vdpauConfigured = false; - } - --void CVDPAU::FiniVDPAUProcs() -+void CDecoder::FiniVDPAUProcs() - { -- if (vdp_device == VDP_INVALID_HANDLE) return; -+ if (m_vdpauConfig.vdpDevice == VDP_INVALID_HANDLE) return; - - VdpStatus vdp_st; -- vdp_st = vdp_device_destroy(vdp_device); -+ vdp_st = m_vdpauConfig.vdpProcs.vdp_device_destroy(m_vdpauConfig.vdpDevice); - CheckStatus(vdp_st, __LINE__); -- vdp_device = VDP_INVALID_HANDLE; -- vdpauConfigured = false; -+ m_vdpauConfig.vdpDevice = VDP_INVALID_HANDLE; - } - --void CVDPAU::InitCSCMatrix(int Height) -+void CDecoder::FiniVDPAUOutput() - { -+ if (m_vdpauConfig.vdpDevice == VDP_INVALID_HANDLE || !m_vdpauConfigured) return; -+ -+ CLog::Log(LOGNOTICE, " (VDPAU) %s", __FUNCTION__); -+ -+ // uninit output -+ m_vdpauOutput.Dispose(); -+ m_vdpauConfigured = false; -+ - VdpStatus vdp_st; -- m_Procamp.struct_version = VDP_PROCAMP_VERSION; -- m_Procamp.brightness = 0.0; -- m_Procamp.contrast = 1.0; -- m_Procamp.saturation = 1.0; -- m_Procamp.hue = 0; -- vdp_st = vdp_generate_csc_matrix(&m_Procamp, -- (Height < 720)? VDP_COLOR_STANDARD_ITUR_BT_601 : VDP_COLOR_STANDARD_ITUR_BT_709, -- &m_CSCMatrix); -- CheckStatus(vdp_st, __LINE__); --} -- --void CVDPAU::FiniVDPAUOutput() --{ -- FiniOutputMethod(); - -- if (vdp_device == VDP_INVALID_HANDLE || !vdpauConfigured) return; -- -- CLog::Log(LOGNOTICE, " (VDPAU) %s", __FUNCTION__); -- -- VdpStatus vdp_st; -- -- vdp_st = vdp_decoder_destroy(decoder); -+ vdp_st = m_vdpauConfig.vdpProcs.vdp_decoder_destroy(m_vdpauConfig.vdpDecoder); - if (CheckStatus(vdp_st, __LINE__)) - return; -- decoder = VDP_INVALID_HANDLE; -+ m_vdpauConfig.vdpDecoder = VDP_INVALID_HANDLE; -+ -+ CSingleLock lock(m_videoSurfaceSec); -+ CLog::Log(LOGDEBUG, "CVDPAU::FiniVDPAUOutput destroying %d video surfaces", (int)m_videoSurfaces.size()); - -- for (unsigned int i = 0; i < m_videoSurfaces.size(); ++i) -+ for(unsigned int i = 0; i < m_videoSurfaces.size(); ++i) - { - vdpau_render_state *render = m_videoSurfaces[i]; - if (render->surface != VDP_INVALID_HANDLE) - { -- vdp_st = vdp_video_surface_destroy(render->surface); -+ vdp_st = m_vdpauConfig.vdpProcs.vdp_video_surface_destroy(render->surface); - render->surface = VDP_INVALID_HANDLE; - } - if (CheckStatus(vdp_st, __LINE__)) -@@ -888,8 +510,7 @@ void CVDPAU::FiniVDPAUOutput() - } - } - -- --void CVDPAU::ReadFormatOf( PixelFormat fmt -+void CDecoder::ReadFormatOf( PixelFormat fmt - , VdpDecoderProfile &vdp_decoder_profile - , VdpChromaType &vdp_chroma_type) - { -@@ -916,9 +537,9 @@ void CVDPAU::ReadFormatOf( PixelFormat fmt - vdp_chroma_type = VDP_CHROMA_TYPE_420; - break; - #if (defined PIX_FMT_VDPAU_MPEG4_IN_AVUTIL) && \ -- (defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP) -+ (defined VDP_DECODER_PROFILE_MP) - case PIX_FMT_VDPAU_MPEG4: -- vdp_decoder_profile = VDP_DECODER_PROFILE_MPEG4_PART2_ASP; -+ vdp_decoder_profile = VDP_DECOPEG4_PART2_ASP; - vdp_chroma_type = VDP_CHROMA_TYPE_420; - break; - #endif -@@ -929,170 +550,78 @@ void CVDPAU::ReadFormatOf( PixelFormat fmt - } - } - -- --bool CVDPAU::ConfigVDPAU(AVCodecContext* avctx, int ref_frames) -+bool CDecoder::ConfigVDPAU(AVCodecContext* avctx, int ref_frames) - { - FiniVDPAUOutput(); - - VdpStatus vdp_st; - VdpDecoderProfile vdp_decoder_profile; -- vid_width = avctx->width; -- vid_height = avctx->height; -- surface_width = avctx->coded_width; -- surface_height = avctx->coded_height; - -- past[1] = past[0] = current = future = NULL; -- CLog::Log(LOGNOTICE, " (VDPAU) screenWidth:%i vidWidth:%i surfaceWidth:%i",OutWidth,vid_width,surface_width); -- CLog::Log(LOGNOTICE, " (VDPAU) screenHeight:%i vidHeight:%i surfaceHeight:%i",OutHeight,vid_height,surface_height); -- ReadFormatOf(avctx->pix_fmt, vdp_decoder_profile, vdp_chroma_type); -+ m_vdpauConfig.vidWidth = avctx->width; -+ m_vdpauConfig.vidHeight = avctx->height; -+ m_vdpauConfig.surfaceWidth = avctx->coded_width; -+ m_vdpauConfig.surfaceHeight = avctx->coded_height; -+ -+ SetWidthHeight(avctx->width,avctx->height); -+ -+ CLog::Log(LOGNOTICE, " (VDPAU) screenWidth:%i vidWidth:%i surfaceWidth:%i",m_vdpauConfig.outWidth,m_vdpauConfig.vidWidth,m_vdpauConfig.surfaceWidth); -+ CLog::Log(LOGNOTICE, " (VDPAU) screenHeight:%i vidHeight:%i surfaceHeight:%i",m_vdpauConfig.outHeight,m_vdpauConfig.vidHeight,m_vdpauConfig.surfaceHeight); -+ -+ ReadFormatOf(avctx->pix_fmt, vdp_decoder_profile, m_vdpauConfig.vdpChromaType); - - if(avctx->pix_fmt == PIX_FMT_VDPAU_H264) - { -- max_references = ref_frames; -- if (max_references > 16) max_references = 16; -- if (max_references < 5) max_references = 5; -+ m_vdpauConfig.maxReferences = ref_frames; -+ if (m_vdpauConfig.maxReferences > 16) m_vdpauConfig.maxReferences = 16; -+ if (m_vdpauConfig.maxReferences < 5) m_vdpauConfig.maxReferences = 5; - } - else -- max_references = 2; -+ m_vdpauConfig.maxReferences = 2; - -- vdp_st = vdp_decoder_create(vdp_device, -+ vdp_st = m_vdpauConfig.vdpProcs.vdp_decoder_create(m_vdpauConfig.vdpDevice, - vdp_decoder_profile, -- surface_width, -- surface_height, -- max_references, -- &decoder); -- if (CheckStatus(vdp_st, __LINE__)) -- return false; -- -- m_vdpauOutputMethod = OUTPUT_NONE; -- -- vdpauConfigured = true; -- return true; --} -- --bool CVDPAU::ConfigOutputMethod(AVCodecContext *avctx, AVFrame *pFrame) --{ -- VdpStatus vdp_st; -- -- if (m_vdpauOutputMethod == OUTPUT_PIXMAP) -- return true; -- -- FiniOutputMethod(); -- -- MakePixmap(avctx->width,avctx->height); -- -- vdp_st = vdp_presentation_queue_target_create_x11(vdp_device, -- m_Pixmap, //x_window, -- &vdp_flip_target); -- if (CheckStatus(vdp_st, __LINE__)) -- return false; -- -- vdp_st = vdp_presentation_queue_create(vdp_device, -- vdp_flip_target, -- &vdp_flip_queue); -+ m_vdpauConfig.surfaceWidth, -+ m_vdpauConfig.surfaceHeight, -+ m_vdpauConfig.maxReferences, -+ &m_vdpauConfig.vdpDecoder); - if (CheckStatus(vdp_st, __LINE__)) - return false; - -- totalAvailableOutputSurfaces = 0; -- -- int tmpMaxOutputSurfaces = NUM_OUTPUT_SURFACES; -- if (vid_width == FULLHD_WIDTH) -- tmpMaxOutputSurfaces = NUM_OUTPUT_SURFACES_FOR_FULLHD; -- -- // Creation of outputSurfaces -- for (int i = 0; i < NUM_OUTPUT_SURFACES && i < tmpMaxOutputSurfaces; i++) -- { -- vdp_st = vdp_output_surface_create(vdp_device, -- VDP_RGBA_FORMAT_B8G8R8A8, -- OutWidth, -- OutHeight, -- &outputSurfaces[i]); -- if (CheckStatus(vdp_st, __LINE__)) -+ // initialize output -+ CSingleLock lock(g_graphicsContext); -+ m_vdpauConfig.stats = &m_bufferStats; -+ m_vdpauConfig.vdpau = this; -+ m_bufferStats.Reset(); -+ m_vdpauOutput.Start(); -+ Message *reply; -+ if (m_vdpauOutput.m_controlPort.SendOutMessageSync(COutputControlProtocol::INIT, -+ &reply, -+ 2000, -+ &m_vdpauConfig, -+ sizeof(m_vdpauConfig))) -+ { -+ bool success = reply->signal == COutputControlProtocol::ACC ? true : false; -+ reply->Release(); -+ if (!success) -+ { -+ CLog::Log(LOGERROR, "VDPAU::%s - vdpau output returned error", __FUNCTION__); -+ m_vdpauOutput.Dispose(); - return false; -- totalAvailableOutputSurfaces++; -- } -- CLog::Log(LOGNOTICE, " (VDPAU) Total Output Surfaces Available: %i of a max (tmp: %i const: %i)", -- totalAvailableOutputSurfaces, -- tmpMaxOutputSurfaces, -- NUM_OUTPUT_SURFACES); -- -- // create 3 pitches of black lines needed for clipping top -- // and bottom lines when de-interlacing -- m_BlackBar = new uint32_t[3*OutWidth]; -- memset(m_BlackBar, 0, 3*OutWidth*sizeof(uint32_t)); -- -- surfaceNum = presentSurfaceNum = 0; -- outputSurface = presentSurface = VDP_INVALID_HANDLE; -- videoMixer = VDP_INVALID_HANDLE; -- -- m_vdpauOutputMethod = OUTPUT_PIXMAP; -- -- return true; --} -- --bool CVDPAU::FiniOutputMethod() --{ -- VdpStatus vdp_st; -- -- if (vdp_flip_queue != VDP_INVALID_HANDLE) -- { -- vdp_st = vdp_presentation_queue_destroy(vdp_flip_queue); -- vdp_flip_queue = VDP_INVALID_HANDLE; -- CheckStatus(vdp_st, __LINE__); -- } -- -- if (vdp_flip_target != VDP_INVALID_HANDLE) -- { -- vdp_st = vdp_presentation_queue_target_destroy(vdp_flip_target); -- vdp_flip_target = VDP_INVALID_HANDLE; -- CheckStatus(vdp_st, __LINE__); -- } -- -- if (m_glPixmap) -- { -- CLog::Log(LOGDEBUG, "GLX: Destroying glPixmap"); -- glXDestroyPixmap(m_Display, m_glPixmap); -- m_glPixmap = None; -- } -- -- if (m_Pixmap) -- { -- CLog::Log(LOGDEBUG, "GLX: Destroying XPixmap"); -- XFreePixmap(m_Display, m_Pixmap); -- m_Pixmap = None; -- } -- -- outputSurface = presentSurface = VDP_INVALID_HANDLE; -- -- for (int i = 0; i < totalAvailableOutputSurfaces; i++) -- { -- if (outputSurfaces[i] == VDP_INVALID_HANDLE) -- continue; -- vdp_st = vdp_output_surface_destroy(outputSurfaces[i]); -- outputSurfaces[i] = VDP_INVALID_HANDLE; -- CheckStatus(vdp_st, __LINE__); -- } -- -- if (videoMixer != VDP_INVALID_HANDLE) -- { -- vdp_st = vdp_video_mixer_destroy(videoMixer); -- videoMixer = VDP_INVALID_HANDLE; -- CheckStatus(vdp_st, __LINE__); -+ } - } -- -- if (m_BlackBar) -+ else - { -- delete [] m_BlackBar; -- m_BlackBar = NULL; -+ CLog::Log(LOGERROR, "VDPAU::%s - failed to init output", __FUNCTION__); -+ m_vdpauOutput.Dispose(); -+ return false; - } - -- while (!m_DVDVideoPics.empty()) -- m_DVDVideoPics.pop(); -- -+ m_inMsgEvent.Reset(); -+ m_vdpauConfigured = true; - return true; - } - --void CVDPAU::SpewHardwareAvailable() //Copyright (c) 2008 Wladimir J. van der Laan -- VDPInfo -+void CDecoder::SpewHardwareAvailable() //CopyrighVDPAUt (c) 2008 Wladimir J. van der Laan -- VDPInfo - { - VdpStatus rv; - CLog::Log(LOGNOTICE,"VDPAU Decoder capabilities:"); -@@ -1102,7 +631,7 @@ void CVDPAU::SpewHardwareAvailable() //Copyright (c) 2008 Wladimir J. van der L - { - VdpBool is_supported = false; - uint32_t max_level, max_macroblocks, max_width, max_height; -- rv = vdp_decoder_query_caps(vdp_device, decoder_profiles[x].id, -+ rv = m_vdpauConfig.vdpProcs.vdp_decoder_query_caps(m_vdpauConfig.vdpDevice, decoder_profiles[x].id, - &is_supported, &max_level, &max_macroblocks, &max_width, &max_height); - if(rv == VDP_STATUS_OK && is_supported) - { -@@ -1111,13 +640,13 @@ void CVDPAU::SpewHardwareAvailable() //Copyright (c) 2008 Wladimir J. van der L - } - } - CLog::Log(LOGNOTICE,"------------------------------------"); -- m_feature_count = 0; -+ m_vdpauConfig.featureCount = 0; - #define CHECK_SUPPORT(feature) \ - do { \ - VdpBool supported; \ -- if(vdp_video_mixer_query_feature_support(vdp_device, feature, &supported) == VDP_STATUS_OK && supported) { \ -+ if(m_vdpauConfig.vdpProcs.vdp_video_mixer_query_feature_support(m_vdpauConfig.vdpDevice, feature, &supported) == VDP_STATUS_OK && supported) { \ - CLog::Log(LOGNOTICE, "Mixer feature: "#feature); \ -- m_features[m_feature_count++] = feature; \ -+ m_vdpauConfig.vdpFeatures[m_vdpauConfig.featureCount++] = feature; \ - } \ - } while(false) - -@@ -1141,7 +670,7 @@ void CVDPAU::SpewHardwareAvailable() //Copyright (c) 2008 Wladimir J. van der L - - } - --bool CVDPAU::IsSurfaceValid(vdpau_render_state *render) -+bool CDecoder::IsSurfaceValid(vdpau_render_state *render) - { - // find render state in queue - bool found(false); -@@ -1168,34 +697,33 @@ bool CVDPAU::IsSurfaceValid(vdpau_render_state *render) - return true; - } - --int CVDPAU::FFGetBuffer(AVCodecContext *avctx, AVFrame *pic) -+int CDecoder::FFGetBuffer(AVCodecContext *avctx, AVFrame *pic) - { - //CLog::Log(LOGNOTICE,"%s",__FUNCTION__); - CDVDVideoCodecFFmpeg* ctx = (CDVDVideoCodecFFmpeg*)avctx->opaque; -- CVDPAU* vdp = (CVDPAU*)ctx->GetHardware(); -- struct pictureAge* pA = &vdp->picAge; -+ CDecoder* vdp = (CDecoder*)ctx->GetHardware(); - - // while we are waiting to recover we can't do anything -- CSharedLock lock(vdp->m_DecoderSection); -+ CSingleLock lock(vdp->m_DecoderSection); - -- { CSharedLock dLock(vdp->m_DisplaySection); -- if(vdp->m_DisplayState != VDPAU_OPEN) -- { -- CLog::Log(LOGWARNING, "CVDPAU::FFGetBuffer - returning due to awaiting recovery"); -- return -1; -- } -+ if(vdp->m_DisplayState != VDPAU_OPEN) -+ { -+ CLog::Log(LOGWARNING, "CVDPAU::FFGetBuffer - returning due to awaiting recovery"); -+ return -1; - } - - vdpau_render_state * render = NULL; - - // find unused surface -- for(unsigned int i = 0; i < vdp->m_videoSurfaces.size(); i++) -- { -- if(!(vdp->m_videoSurfaces[i]->state & (FF_VDPAU_STATE_USED_FOR_REFERENCE | FF_VDPAU_STATE_USED_FOR_RENDER))) -+ { CSingleLock lock(vdp->m_videoSurfaceSec); -+ for(unsigned int i = 0; i < vdp->m_videoSurfaces.size(); i++) - { -- render = vdp->m_videoSurfaces[i]; -- render->state = 0; -- break; -+ if(!(vdp->m_videoSurfaces[i]->state & (FF_VDPAU_STATE_USED_FOR_REFERENCE | FF_VDPAU_STATE_USED_FOR_RENDER))) -+ { -+ render = vdp->m_videoSurfaces[i]; -+ render->state = 0; -+ break; -+ } - } - } - -@@ -1204,21 +732,22 @@ int CVDPAU::FFGetBuffer(AVCodecContext *avctx, AVFrame *pic) - { - // create a new surface - VdpDecoderProfile profile; -- ReadFormatOf(avctx->pix_fmt, profile, vdp->vdp_chroma_type); -+ ReadFormatOf(avctx->pix_fmt, profile, vdp->m_vdpauConfig.vdpChromaType); - render = (vdpau_render_state*)calloc(sizeof(vdpau_render_state), 1); - if (render == NULL) - { - CLog::Log(LOGWARNING, "CVDPAU::FFGetBuffer - calloc failed"); - return -1; - } -+ CSingleLock lock(vdp->m_videoSurfaceSec); - render->surface = VDP_INVALID_HANDLE; - vdp->m_videoSurfaces.push_back(render); - } - - if (render->surface == VDP_INVALID_HANDLE) - { -- vdp_st = vdp->vdp_video_surface_create(vdp->vdp_device, -- vdp->vdp_chroma_type, -+ vdp_st = vdp->m_vdpauConfig.vdpProcs.vdp_video_surface_create(vdp->m_vdpauConfig.vdpDevice, -+ vdp->m_vdpauConfig.vdpChromaType, - avctx->coded_width, - avctx->coded_height, - &render->surface); -@@ -1239,18 +768,6 @@ int CVDPAU::FFGetBuffer(AVCodecContext *avctx, AVFrame *pic) - - pic->linesize[0] = pic->linesize[1] = pic->linesize[2] = 0; - -- if(pic->reference) -- { -- pA->ip_age[0]= pA->ip_age[1]+1; -- pA->ip_age[1]= 1; -- pA->b_age++; -- } -- else -- { -- pA->ip_age[0]++; -- pA->ip_age[1]++; -- pA->b_age = 1; -- } - pic->type= FF_BUFFER_TYPE_USER; - - render->state |= FF_VDPAU_STATE_USED_FOR_REFERENCE; -@@ -1258,15 +775,16 @@ int CVDPAU::FFGetBuffer(AVCodecContext *avctx, AVFrame *pic) - return 0; - } - --void CVDPAU::FFReleaseBuffer(AVCodecContext *avctx, AVFrame *pic) -+void CDecoder::FFReleaseBuffer(AVCodecContext *avctx, AVFrame *pic) - { - //CLog::Log(LOGNOTICE,"%s",__FUNCTION__); - CDVDVideoCodecFFmpeg* ctx = (CDVDVideoCodecFFmpeg*)avctx->opaque; -- CVDPAU* vdp = (CVDPAU*)ctx->GetHardware(); -+ CDecoder* vdp = (CDecoder*)ctx->GetHardware(); -+ - vdpau_render_state * render; - unsigned int i; - -- CSharedLock lock(vdp->m_DecoderSection); -+ CSingleLock lock(vdp->m_DecoderSection); - - render=(vdpau_render_state*)pic->data[0]; - if(!render) -@@ -1275,6 +793,8 @@ void CVDPAU::FFReleaseBuffer(AVCodecContext *avctx, AVFrame *pic) - return; - } - -+ CSingleLock vLock(vdp->m_videoSurfaceSec); -+ render->state &= ~FF_VDPAU_STATE_USED_FOR_REFERENCE; - for(i=0; i<4; i++) - pic->data[i]= NULL; - -@@ -1289,21 +809,18 @@ void CVDPAU::FFReleaseBuffer(AVCodecContext *avctx, AVFrame *pic) - } - - --void CVDPAU::FFDrawSlice(struct AVCodecContext *s, -+void CDecoder::FFDrawSlice(struct AVCodecContext *s, - const AVFrame *src, int offset[4], - int y, int type, int height) - { - CDVDVideoCodecFFmpeg* ctx = (CDVDVideoCodecFFmpeg*)s->opaque; -- CVDPAU* vdp = (CVDPAU*)ctx->GetHardware(); -+ CDecoder* vdp = (CDecoder*)ctx->GetHardware(); - - // while we are waiting to recover we can't do anything -- CSharedLock lock(vdp->m_DecoderSection); -- -- { CSharedLock dLock(vdp->m_DisplaySection); -- if(vdp->m_DisplayState != VDPAU_OPEN) -- return; -- } -+ CSingleLock lock(vdp->m_DecoderSection); - -+ if(vdp->m_DisplayState != VDPAU_OPEN) -+ return; - - if(src->linesize[0] || src->linesize[1] || src->linesize[2] - || offset[0] || offset[1] || offset[2]) -@@ -1333,59 +850,41 @@ void CVDPAU::FFDrawSlice(struct AVCodecContext *s, - if(s->pix_fmt == PIX_FMT_VDPAU_H264) - max_refs = render->info.h264.num_ref_frames; - -- if(vdp->decoder == VDP_INVALID_HANDLE -- || vdp->vdpauConfigured == false -- || vdp->max_references < max_refs) -+ if(vdp->m_vdpauConfig.vdpDecoder == VDP_INVALID_HANDLE -+ || vdp->m_vdpauConfigured == false -+ || vdp->m_vdpauConfig.maxReferences < max_refs) - { - if(!vdp->ConfigVDPAU(s, max_refs)) - return; - } - -- vdp_st = vdp->vdp_decoder_render(vdp->decoder, -+ uint64_t startTime = CurrentHostCounter(); -+ uint16_t decoded, processed, rend; -+ vdp->m_bufferStats.Get(decoded, processed, rend); -+ vdp_st = vdp->m_vdpauConfig.vdpProcs.vdp_decoder_render(vdp->m_vdpauConfig.vdpDecoder, - render->surface, - (VdpPictureInfo const *)&(render->info), - render->bitstream_buffers_used, - render->bitstream_buffers); - vdp->CheckStatus(vdp_st, __LINE__); -+ uint64_t diff = CurrentHostCounter() - startTime; -+ if (diff*1000/CurrentHostFrequency() > 30) -+ CLog::Log(LOGWARNING,"CVDPAU::DrawSlice - VdpDecoderRender long decoding: %d ms, dec: %d, proc: %d, rend: %d", (int)((diff*1000)/CurrentHostFrequency()), decoded, processed, rend); -+ - } - --int CVDPAU::Decode(AVCodecContext *avctx, AVFrame *pFrame) --{ -- //CLog::Log(LOGNOTICE,"%s",__FUNCTION__); -- VdpStatus vdp_st; -- VdpTime time; - -+int CDecoder::Decode(AVCodecContext *avctx, AVFrame *pFrame) -+{ - int result = Check(avctx); - if (result) - return result; - -- CSharedLock lock(m_DecoderSection); -+ CSingleLock lock(m_DecoderSection); - -- if (!vdpauConfigured) -+ if (!m_vdpauConfigured) - return VC_ERROR; - -- // configure vdpau output -- if (!ConfigOutputMethod(avctx, pFrame)) -- return VC_FLUSHED; -- -- outputSurface = outputSurfaces[surfaceNum]; -- -- CheckFeatures(); -- -- if (( (int)outRectVid.x1 != OutWidth ) || -- ( (int)outRectVid.y1 != OutHeight )) -- { -- outRectVid.x0 = 0; -- outRectVid.y0 = 0; -- outRectVid.x1 = OutWidth; -- outRectVid.y1 = OutHeight; -- } -- -- EDEINTERLACEMODE mode = g_settings.m_currentVideoSettings.m_DeinterlaceMode; -- EINTERLACEMETHOD method = g_settings.m_currentVideoSettings.m_InterlaceMethod; -- if (method == VS_INTERLACEMETHOD_AUTO) -- method = AutoInterlaceMethod(); -- - if(pFrame) - { // we have a new frame from decoder - -@@ -1393,7 +892,10 @@ int CVDPAU::Decode(AVCodecContext *avctx, AVFrame *pFrame) - if(!render) // old style ffmpeg gave data on plane 0 - render = (vdpau_render_state*)pFrame->data[0]; - if(!render) -+ { -+ CLog::Log(LOGERROR, "CVDPAU::Decode: no valid frame"); - return VC_ERROR; -+ } - - // ffmpeg vc-1 decoder does not flush, make sure the data buffer is still valid - if (!IsSurfaceValid(render)) -@@ -1402,258 +904,166 @@ int CVDPAU::Decode(AVCodecContext *avctx, AVFrame *pFrame) - return VC_BUFFER; - } - -+ CSingleLock lock(m_videoSurfaceSec); - render->state |= FF_VDPAU_STATE_USED_FOR_RENDER; -+ lock.Leave(); - -- ClearUsedForRender(&past[0]); -- past[0] = past[1]; -- past[1] = current; -- current = future; -- future = render; -+ // send frame to output for processing -+ CVdpauDecodedPicture pic; -+ memset(&pic.DVDPic, 0, sizeof(pic.DVDPic)); -+ ((CDVDVideoCodecFFmpeg*)avctx->opaque)->GetPictureCommon(&pic.DVDPic); -+ pic.render = render; -+ m_bufferStats.IncDecoded(); -+ m_vdpauOutput.m_dataPort.SendOutMessage(COutputDataProtocol::NEWFRAME, &pic, sizeof(pic)); - -- DVDVideoPicture DVDPic; -- memset(&DVDPic, 0, sizeof(DVDVideoPicture)); -- ((CDVDVideoCodecFFmpeg*)avctx->opaque)->GetPictureCommon(&DVDPic); -- m_DVDVideoPics.push(DVDPic); -+ m_codecControl = pic.DVDPic.iFlags & (DVP_FLAG_DRAIN | DVP_FLAG_NO_POSTPROC); -+ } - -- int pics = m_DVDVideoPics.size(); -- if (pics < 2) -- return VC_BUFFER; -- else if (pics > 2) -+ int retval = 0; -+ uint16_t decoded, processed, render; -+ Message *msg; -+ while (m_vdpauOutput.m_controlPort.ReceiveInMessage(&msg)) -+ { -+ if (msg->signal == COutputControlProtocol::ERROR) - { -- // this should not normally happen -- CLog::Log(LOGERROR, "CVDPAU::Decode - invalid number of pictures in queue"); -- while (pics-- != 2) -- m_DVDVideoPics.pop(); -+ m_DisplayState = VDPAU_ERROR; -+ retval |= VC_ERROR; - } -+ msg->Release(); -+ } - -- if (mode == VS_DEINTERLACEMODE_FORCE -- || (mode == VS_DEINTERLACEMODE_AUTO && m_DVDVideoPics.front().iFlags & DVP_FLAG_INTERLACED)) -+ m_bufferStats.Get(decoded, processed, render); -+ -+ uint64_t startTime = CurrentHostCounter(); -+ while (!retval) -+ { -+ if (m_vdpauOutput.m_dataPort.ReceiveInMessage(&msg)) - { -- if((method == VS_INTERLACEMETHOD_AUTO_ION -- || method == VS_INTERLACEMETHOD_VDPAU_BOB -- || method == VS_INTERLACEMETHOD_VDPAU_TEMPORAL -- || method == VS_INTERLACEMETHOD_VDPAU_TEMPORAL_HALF -- || method == VS_INTERLACEMETHOD_VDPAU_TEMPORAL_SPATIAL -- || method == VS_INTERLACEMETHOD_VDPAU_TEMPORAL_SPATIAL_HALF -- || method == VS_INTERLACEMETHOD_VDPAU_INVERSE_TELECINE )) -+ if (msg->signal == COutputDataProtocol::PICTURE) - { -- if((method == VS_INTERLACEMETHOD_AUTO_ION && vid_height > 576) -- || method == VS_INTERLACEMETHOD_VDPAU_TEMPORAL_HALF -- || method == VS_INTERLACEMETHOD_VDPAU_TEMPORAL_SPATIAL_HALF -- || avctx->skip_frame == AVDISCARD_NONREF) -- m_mixerstep = 0; -- else -- m_mixerstep = 1; -- -- if(m_DVDVideoPics.front().iFlags & DVP_FLAG_TOP_FIELD_FIRST) -- m_mixerfield = VDP_VIDEO_MIXER_PICTURE_STRUCTURE_TOP_FIELD; -- else -- m_mixerfield = VDP_VIDEO_MIXER_PICTURE_STRUCTURE_BOTTOM_FIELD; -+ if (m_presentPicture) -+ { -+ m_presentPicture->ReturnUnused(); -+ m_presentPicture = 0; -+ } -+ -+ m_presentPicture = *(CVdpauRenderPicture**)msg->data; -+ m_presentPicture->vdpau = this; -+ m_bufferStats.DecRender(); -+ m_bufferStats.Get(decoded, processed, render); -+ retval |= VC_PICTURE; -+ msg->Release(); -+ break; -+ } -+ msg->Release(); -+ } -+ else if (m_vdpauOutput.m_controlPort.ReceiveInMessage(&msg)) -+ { -+ if (msg->signal == COutputControlProtocol::STATS) -+ { -+ m_bufferStats.Get(decoded, processed, render); - } - else - { -- m_mixerstep = 0; -- m_mixerfield = VDP_VIDEO_MIXER_PICTURE_STRUCTURE_FRAME; -+ m_DisplayState = VDPAU_ERROR; -+ retval |= VC_ERROR; - } -+ msg->Release(); - } -- else -+ -+ if ((m_codecControl & DVP_FLAG_DRAIN)) - { -- m_mixerstep = 0; -- m_mixerfield = VDP_VIDEO_MIXER_PICTURE_STRUCTURE_FRAME; -+ if (decoded + processed + render < 4) -+ { -+ retval |= VC_BUFFER; -+ } - } -- -- } -- else if(m_mixerstep == 1) -- { // no new frame given, output second field of old frame -- -- if(avctx->skip_frame == AVDISCARD_NONREF) -+ else - { -- ClearUsedForRender(&past[1]); -- m_DVDVideoPics.pop(); -- return VC_BUFFER; -+ if (decoded < 4 && (processed + render) < 3) -+ { -+ retval |= VC_BUFFER; -+ } - } - -- m_mixerstep = 2; -- if(m_mixerfield == VDP_VIDEO_MIXER_PICTURE_STRUCTURE_TOP_FIELD) -- m_mixerfield = VDP_VIDEO_MIXER_PICTURE_STRUCTURE_BOTTOM_FIELD; -- else -- m_mixerfield = VDP_VIDEO_MIXER_PICTURE_STRUCTURE_TOP_FIELD; -+ if (!retval && !m_inMsgEvent.WaitMSec(2000)) -+ break; - } -- else -+ uint64_t diff = CurrentHostCounter() - startTime; -+ if (retval & VC_PICTURE) - { -- CLog::Log(LOGERROR, "CVDPAU::Decode - invalid mixer state reached"); -- return VC_BUFFER; -+ m_bufferStats.SetParams(diff, m_codecControl); - } -+ if (diff*1000/CurrentHostFrequency() > 50) -+ CLog::Log(LOGDEBUG,"CVDPAU::Decode long wait: %d", (int)((diff*1000)/CurrentHostFrequency())); - -- VdpVideoSurface past_surfaces[2] = { VDP_INVALID_HANDLE, VDP_INVALID_HANDLE }; -- VdpVideoSurface futu_surfaces[1] = { VDP_INVALID_HANDLE }; -- -- if(m_mixerfield == VDP_VIDEO_MIXER_PICTURE_STRUCTURE_FRAME) -+ if (!retval) - { -- if (past[0]) -- past_surfaces[1] = past[0]->surface; -- if (past[1]) -- past_surfaces[0] = past[1]->surface; -- futu_surfaces[0] = future->surface; -+ CLog::Log(LOGERROR, "VDPAU::%s - timed out waiting for output message", __FUNCTION__); -+ m_DisplayState = VDPAU_ERROR; -+ retval |= VC_ERROR; - } -- else -- { -- if(m_mixerstep == 1) -- { // first field -- if (past[1]) -- { -- past_surfaces[1] = past[1]->surface; -- past_surfaces[0] = past[1]->surface; -- } -- futu_surfaces[0] = current->surface; -- } -- else -- { // second field -- if (past[1]) -- past_surfaces[1] = past[1]->surface; -- past_surfaces[0] = current->surface; -- futu_surfaces[0] = future->surface; -- } -- } -- -- vdp_st = vdp_presentation_queue_block_until_surface_idle(vdp_flip_queue,outputSurface,&time); -- -- VdpRect sourceRect = {0,0,vid_width, vid_height}; -- -- vdp_st = vdp_video_mixer_render(videoMixer, -- VDP_INVALID_HANDLE, -- 0, -- m_mixerfield, -- 2, -- past_surfaces, -- current->surface, -- 1, -- futu_surfaces, -- &sourceRect, -- outputSurface, -- &(outRectVid), -- &(outRectVid), -- 0, -- NULL); -- CheckStatus(vdp_st, __LINE__); - -- surfaceNum++; -- if (surfaceNum >= totalAvailableOutputSurfaces) surfaceNum = 0; -+ return retval; -+} - -- if(m_mixerfield == VDP_VIDEO_MIXER_PICTURE_STRUCTURE_FRAME) -- { -- ClearUsedForRender(&past[0]); -- return VC_BUFFER | VC_PICTURE; -- } -- else -- { -- // in order to clip top and bottom lines when de-interlacing -- // we black those lines as a work around for not working -- // background colour using the mixer -- // pixel perfect is preferred over overscanning or zooming -+bool CDecoder::GetPicture(AVCodecContext* avctx, AVFrame* frame, DVDVideoPicture* picture) -+{ -+ CSingleLock lock(m_DecoderSection); - -- VdpRect clipRect = outRectVid; -- clipRect.y1 = clipRect.y0 + 2; -- uint32_t *data[] = {m_BlackBar}; -- uint32_t pitches[] = {outRectVid.x1}; -- vdp_st = vdp_output_surface_put_bits_native(outputSurface, -- (void**)data, -- pitches, -- &clipRect); -- CheckStatus(vdp_st, __LINE__); -+ if (m_DisplayState != VDPAU_OPEN) -+ return false; - -- clipRect = outRectVid; -- clipRect.y0 = clipRect.y1 - 2; -- vdp_st = vdp_output_surface_put_bits_native(outputSurface, -- (void**)data, -- pitches, -- &clipRect); -- CheckStatus(vdp_st, __LINE__); -+ *picture = m_presentPicture->DVDPic; -+ picture->vdpau = m_presentPicture; - -- if(m_mixerstep == 1) -- return VC_PICTURE; -- else -- { -- ClearUsedForRender(&past[1]); -- return VC_BUFFER | VC_PICTURE; -- } -- } -+ return true; - } - --bool CVDPAU::GetPicture(AVCodecContext* avctx, AVFrame* frame, DVDVideoPicture* picture) -+void CDecoder::Reset() - { -- CSharedLock lock(m_DecoderSection); -- -- { CSharedLock dLock(m_DisplaySection); -- if (m_DisplayState != VDPAU_OPEN) -- return false; -- } -- -- *picture = m_DVDVideoPics.front(); -- // if this is the first field of an interlaced frame, we'll need -- // this same picture for the second field later -- if (m_mixerstep != 1) -- m_DVDVideoPics.pop(); -+ CSingleLock lock(m_DecoderSection); - -- picture->format = RENDER_FMT_VDPAU; -- picture->iFlags &= DVP_FLAG_DROPPED; -- picture->iWidth = OutWidth; -- picture->iHeight = OutHeight; -- picture->vdpau = this; -+ if (!m_vdpauConfigured) -+ return; - -- if(m_mixerstep) -+ Message *reply; -+ if (m_vdpauOutput.m_controlPort.SendOutMessageSync(COutputControlProtocol::FLUSH, -+ &reply, -+ 2000)) - { -- picture->iRepeatPicture = -0.5; -- if(m_mixerstep > 1) -+ bool success = reply->signal == COutputControlProtocol::ACC ? true : false; -+ reply->Release(); -+ if (!success) - { -- picture->dts = DVD_NOPTS_VALUE; -- picture->pts = DVD_NOPTS_VALUE; -+ CLog::Log(LOGERROR, "VDPAU::%s - flush returned error", __FUNCTION__); -+ m_DisplayState = VDPAU_ERROR; - } -+ else -+ m_bufferStats.Reset(); -+ } -+ else -+ { -+ CLog::Log(LOGERROR, "VDPAU::%s - flush timed out", __FUNCTION__); -+ m_DisplayState = VDPAU_ERROR; - } -- return true; - } - --void CVDPAU::Reset() -+bool CDecoder::CanSkipDeint() - { -- // invalidate surfaces and picture queue when seeking -- ClearUsedForRender(&past[0]); -- ClearUsedForRender(&past[1]); -- ClearUsedForRender(¤t); -- ClearUsedForRender(&future); -- -- while (!m_DVDVideoPics.empty()) -- m_DVDVideoPics.pop(); -+ return m_bufferStats.CanSkipDeint(); - } - --void CVDPAU::Present() -+void CDecoder::ReturnRenderPicture(CVdpauRenderPicture *renderPic) - { -- //CLog::Log(LOGNOTICE,"%s",__FUNCTION__); -- VdpStatus vdp_st; -- -- CSharedLock lock(m_DecoderSection); -- -- { CSharedLock dLock(m_DisplaySection); -- if (m_DisplayState != VDPAU_OPEN) -- return; -- } -- -- presentSurface = outputSurface; -- -- vdp_st = vdp_presentation_queue_display(vdp_flip_queue, -- presentSurface, -- 0, -- 0, -- 0); -- CheckStatus(vdp_st, __LINE__); -+ m_vdpauOutput.m_dataPort.SendOutMessage(COutputDataProtocol::RETURNPIC, &renderPic, sizeof(renderPic)); - } - --bool CVDPAU::CheckStatus(VdpStatus vdp_st, int line) -+bool CDecoder::CheckStatus(VdpStatus vdp_st, int line) - { - if (vdp_st != VDP_STATUS_OK) - { -- CLog::Log(LOGERROR, " (VDPAU) Error: %s(%d) at %s:%d\n", vdp_get_error_string(vdp_st), vdp_st, __FILE__, line); -- -- CExclusiveLock lock(m_DisplaySection); -+ CLog::Log(LOGERROR, " (VDPAU) Error: %s(%d) at %s:%d\n", m_vdpauConfig.vdpProcs.vdp_get_error_string(vdp_st), vdp_st, __FILE__, line); - - if(m_DisplayState == VDPAU_OPEN) - { -@@ -1671,4 +1081,2424 @@ bool CVDPAU::CheckStatus(VdpStatus vdp_st, int line) - return false; - } - -+//----------------------------------------------------------------------------- -+// RenderPicture -+//----------------------------------------------------------------------------- -+ -+CVdpauRenderPicture* CVdpauRenderPicture::Acquire() -+{ -+ CSingleLock lock(*renderPicSection); -+ -+ if (refCount == 0) -+ vdpau->Acquire(); -+ -+ refCount++; -+ return this; -+} -+ -+long CVdpauRenderPicture::Release() -+{ -+ CSingleLock lock(*renderPicSection); -+ -+ refCount--; -+ if (refCount > 0) -+ return refCount; -+ -+ lock.Leave(); -+ vdpau->ReturnRenderPicture(this); -+ vdpau->ReleasePicReference(); -+ -+ return refCount; -+} -+ -+void CVdpauRenderPicture::ReturnUnused() -+{ -+ { CSingleLock lock(*renderPicSection); -+ if (refCount > 0) -+ return; -+ } -+ if (vdpau) -+ vdpau->ReturnRenderPicture(this); -+} -+//----------------------------------------------------------------------------- -+// Mixer -+//----------------------------------------------------------------------------- -+CMixer::CMixer(CEvent *inMsgEvent) : -+ CThread("Vdpau Mixer Thread"), -+ m_controlPort("ControlPort", inMsgEvent, &m_outMsgEvent), -+ m_dataPort("DataPort", inMsgEvent, &m_outMsgEvent) -+{ -+ m_inMsgEvent = inMsgEvent; -+} -+ -+CMixer::~CMixer() -+{ -+ Dispose(); -+} -+ -+void CMixer::Start() -+{ -+ Create(); -+} -+ -+void CMixer::Dispose() -+{ -+ m_bStop = true; -+ m_outMsgEvent.Set(); -+ StopThread(); -+ -+ m_controlPort.Purge(); -+ m_dataPort.Purge(); -+} -+ -+void CMixer::OnStartup() -+{ -+ CLog::Log(LOGNOTICE, "CMixer::OnStartup: Output Thread created"); -+} -+ -+void CMixer::OnExit() -+{ -+ CLog::Log(LOGNOTICE, "CMixer::OnExit: Output Thread terminated"); -+} -+ -+enum MIXER_STATES -+{ -+ M_TOP = 0, // 0 -+ M_TOP_ERROR, // 1 -+ M_TOP_UNCONFIGURED, // 2 -+ M_TOP_CONFIGURED, // 3 -+ M_TOP_CONFIGURED_WAIT1, // 4 -+ M_TOP_CONFIGURED_STEP1, // 5 -+ M_TOP_CONFIGURED_WAIT2, // 6 -+ M_TOP_CONFIGURED_STEP2, // 7 -+}; -+ -+int MIXER_parentStates[] = { -+ -1, -+ 0, //TOP_ERROR -+ 0, //TOP_UNCONFIGURED -+ 0, //TOP_CONFIGURED -+ 3, //TOP_CONFIGURED_WAIT1 -+ 3, //TOP_CONFIGURED_STEP1 -+ 3, //TOP_CONFIGURED_WAIT2 -+ 3, //TOP_CONFIGURED_STEP2 -+}; -+ -+void CMixer::StateMachine(int signal, Protocol *port, Message *msg) -+{ -+ for (int state = m_state; ; state = MIXER_parentStates[state]) -+ { -+ switch (state) -+ { -+ case M_TOP: // TOP -+ if (port == &m_controlPort) -+ { -+ switch (signal) -+ { -+ case CMixerControlProtocol::FLUSH: -+ Flush(); -+ msg->Reply(CMixerControlProtocol::ACC); -+ return; -+ default: -+ break; -+ } -+ } -+ { -+ std::string portName = port == NULL ? "timer" : port->portName; -+ CLog::Log(LOGWARNING, "CMixer::%s - signal: %d form port: %s not handled for state: %d", __FUNCTION__, signal, portName.c_str(), m_state); -+ } -+ return; -+ -+ case M_TOP_ERROR: // TOP -+ break; -+ -+ case M_TOP_UNCONFIGURED: -+ if (port == &m_controlPort) -+ { -+ switch (signal) -+ { -+ case CMixerControlProtocol::INIT: -+ CVdpauConfig *data; -+ data = (CVdpauConfig*)msg->data; -+ if (data) -+ { -+ m_config = *data; -+ } -+ Init(); -+ if (!m_vdpError) -+ { -+ m_state = M_TOP_CONFIGURED_WAIT1; -+ msg->Reply(CMixerControlProtocol::ACC); -+ } -+ else -+ { -+ msg->Reply(CMixerControlProtocol::ERROR); -+ } -+ return; -+ default: -+ break; -+ } -+ } -+ break; -+ -+ case M_TOP_CONFIGURED: -+ if (port == &m_dataPort) -+ { -+ switch (signal) -+ { -+ case CMixerDataProtocol::FRAME: -+ CVdpauDecodedPicture *frame; -+ frame = (CVdpauDecodedPicture*)msg->data; -+ if (frame) -+ { -+ m_decodedPics.push(*frame); -+ } -+ m_extTimeout = 0; -+ return; -+ case CMixerDataProtocol::BUFFER: -+ VdpOutputSurface *surf; -+ surf = (VdpOutputSurface*)msg->data; -+ if (surf) -+ { -+ m_outputSurfaces.push(*surf); -+ } -+ m_extTimeout = 0; -+ return; -+ default: -+ break; -+ } -+ } -+ break; -+ -+ case M_TOP_CONFIGURED_WAIT1: -+ if (port == NULL) // timeout -+ { -+ switch (signal) -+ { -+ case CMixerControlProtocol::TIMEOUT: -+ if (!m_decodedPics.empty() && !m_outputSurfaces.empty()) -+ { -+ m_state = M_TOP_CONFIGURED_STEP1; -+ m_bStateMachineSelfTrigger = true; -+ } -+ else -+ { -+// if (m_extTimeout != 0) -+// { -+// SetPostProcFeatures(false); -+// CLog::Log(LOGWARNING,"CVDPAU::Mixer timeout - decoded: %d, outputSurf: %d", (int)m_decodedPics.size(), (int)m_outputSurfaces.size()); -+// } -+ m_extTimeout = 100; -+ } -+ return; -+ default: -+ break; -+ } -+ } -+ break; -+ -+ case M_TOP_CONFIGURED_STEP1: -+ if (port == NULL) // timeout -+ { -+ switch (signal) -+ { -+ case CMixerControlProtocol::TIMEOUT: -+ m_mixerInput.push_front(m_decodedPics.front()); -+ m_decodedPics.pop(); -+ if (m_mixerInput.size() < 2) -+ { -+ m_state = M_TOP_CONFIGURED_WAIT1; -+ m_extTimeout = 0; -+ return; -+ } -+ InitCycle(); -+ ProcessPicture(); -+ if (m_vdpError) -+ { -+ m_state = M_TOP_CONFIGURED_WAIT1; -+ m_extTimeout = 1000; -+ return; -+ } -+ if (m_processPicture.DVDPic.format != RENDER_FMT_VDPAU_420) -+ m_outputSurfaces.pop(); -+ m_config.stats->IncProcessed(); -+ m_config.stats->DecDecoded(); -+ m_dataPort.SendInMessage(CMixerDataProtocol::PICTURE,&m_processPicture,sizeof(m_processPicture)); -+ if (m_mixersteps > 1) -+ { -+ m_state = M_TOP_CONFIGURED_WAIT2; -+ m_extTimeout = 0; -+ } -+ else -+ { -+ FiniCycle(); -+ m_state = M_TOP_CONFIGURED_WAIT1; -+ m_extTimeout = 0; -+ } -+ return; -+ default: -+ break; -+ } -+ } -+ break; -+ -+ case M_TOP_CONFIGURED_WAIT2: -+ if (port == NULL) // timeout -+ { -+ switch (signal) -+ { -+ case CMixerControlProtocol::TIMEOUT: -+ if (!m_outputSurfaces.empty()) -+ { -+ m_state = M_TOP_CONFIGURED_STEP2; -+ m_bStateMachineSelfTrigger = true; -+ } -+ else -+ { -+// if (m_extTimeout != 0) -+// { -+// SetPostProcFeatures(false); -+// CLog::Log(LOGNOTICE,"---mixer wait2 decoded: %d, outputSurf: %d", (int)m_decodedPics.size(), (int)m_outputSurfaces.size()); -+// } -+ m_extTimeout = 100; -+ } -+ return; -+ default: -+ break; -+ } -+ } -+ break; -+ -+ case M_TOP_CONFIGURED_STEP2: -+ if (port == NULL) // timeout -+ { -+ switch (signal) -+ { -+ case CMixerControlProtocol::TIMEOUT: -+ m_processPicture.outputSurface = m_outputSurfaces.front(); -+ m_mixerstep = 1; -+ ProcessPicture(); -+ if (m_vdpError) -+ { -+ m_state = M_TOP_CONFIGURED_WAIT1; -+ m_extTimeout = 1000; -+ return; -+ } -+ if (m_processPicture.DVDPic.format != RENDER_FMT_VDPAU_420) -+ m_outputSurfaces.pop(); -+ m_config.stats->IncProcessed(); -+ m_dataPort.SendInMessage(CMixerDataProtocol::PICTURE,&m_processPicture,sizeof(m_processPicture)); -+ FiniCycle(); -+ m_state = M_TOP_CONFIGURED_WAIT1; -+ m_extTimeout = 0; -+ return; -+ default: -+ break; -+ } -+ } -+ break; -+ -+ default: // we are in no state, should not happen -+ CLog::Log(LOGERROR, "CMixer::%s - no valid state: %d", __FUNCTION__, m_state); -+ return; -+ } -+ } // for -+} -+ -+void CMixer::Process() -+{ -+ Message *msg; -+ Protocol *port; -+ bool gotMsg; -+ -+ m_state = M_TOP_UNCONFIGURED; -+ m_extTimeout = 1000; -+ m_bStateMachineSelfTrigger = false; -+ -+ while (!m_bStop) -+ { -+ gotMsg = false; -+ -+ if (m_bStateMachineSelfTrigger) -+ { -+ m_bStateMachineSelfTrigger = false; -+ // self trigger state machine -+ StateMachine(msg->signal, port, msg); -+ if (!m_bStateMachineSelfTrigger) -+ { -+ msg->Release(); -+ msg = NULL; -+ } -+ continue; -+ } -+ // check control port -+ else if (m_controlPort.ReceiveOutMessage(&msg)) -+ { -+ gotMsg = true; -+ port = &m_controlPort; -+ } -+ // check data port -+ else if (m_dataPort.ReceiveOutMessage(&msg)) -+ { -+ gotMsg = true; -+ port = &m_dataPort; -+ } -+ -+ if (gotMsg) -+ { -+ StateMachine(msg->signal, port, msg); -+ if (!m_bStateMachineSelfTrigger) -+ { -+ msg->Release(); -+ msg = NULL; -+ } -+ continue; -+ } -+ -+ // wait for message -+ else if (m_outMsgEvent.WaitMSec(m_extTimeout)) -+ { -+ continue; -+ } -+ // time out -+ else -+ { -+ msg = m_controlPort.GetMessage(); -+ msg->signal = CMixerControlProtocol::TIMEOUT; -+ port = 0; -+ // signal timeout to state machine -+ StateMachine(msg->signal, port, msg); -+ if (!m_bStateMachineSelfTrigger) -+ { -+ msg->Release(); -+ msg = NULL; -+ } -+ } -+ } -+ Uninit(); -+} -+ -+void CMixer::CreateVdpauMixer() -+{ -+ CLog::Log(LOGNOTICE, " (VDPAU) Creating the video mixer"); -+ -+ InitCSCMatrix(m_config.vidWidth); -+ -+ VdpVideoMixerParameter parameters[] = { -+ VDP_VIDEO_MIXER_PARAMETER_VIDEO_SURFACE_WIDTH, -+ VDP_VIDEO_MIXER_PARAMETER_VIDEO_SURFACE_HEIGHT, -+ VDP_VIDEO_MIXER_PARAMETER_CHROMA_TYPE}; -+ -+ void const * parameter_values[] = { -+ &m_config.surfaceWidth, -+ &m_config.surfaceHeight, -+ &m_config.vdpChromaType}; -+ -+ VdpStatus vdp_st = VDP_STATUS_ERROR; -+ vdp_st = m_config.vdpProcs.vdp_video_mixer_create(m_config.vdpDevice, -+ m_config.featureCount, -+ m_config.vdpFeatures, -+ ARSIZE(parameters), -+ parameters, -+ parameter_values, -+ &m_videoMixer); -+ CheckStatus(vdp_st, __LINE__); -+ -+ // create 3 pitches of black lines needed for clipping top -+ // and bottom lines when de-interlacing -+ m_BlackBar = new uint32_t[3*m_config.outWidth]; -+ memset(m_BlackBar, 0, 3*m_config.outWidth*sizeof(uint32_t)); -+ -+} -+ -+void CMixer::InitCSCMatrix(int Width) -+{ -+ VdpStatus vdp_st; -+ m_Procamp.struct_version = VDP_PROCAMP_VERSION; -+ m_Procamp.brightness = 0.0; -+ m_Procamp.contrast = 1.0; -+ m_Procamp.saturation = 1.0; -+ m_Procamp.hue = 0; -+ vdp_st = m_config.vdpProcs.vdp_generate_csc_matrix(&m_Procamp, -+ (Width < 1000)? VDP_COLOR_STANDARD_ITUR_BT_601 : VDP_COLOR_STANDARD_ITUR_BT_709, -+ &m_CSCMatrix); -+ CheckStatus(vdp_st, __LINE__); -+} -+ -+void CMixer::CheckFeatures() -+{ -+ if (m_Upscale != m_config.upscale) -+ { -+ SetHWUpscaling(); -+ m_Upscale = m_config.upscale; -+ } -+ if (m_Brightness != g_settings.m_currentVideoSettings.m_Brightness || -+ m_Contrast != g_settings.m_currentVideoSettings.m_Contrast) -+ { -+ SetColor(); -+ m_Brightness = g_settings.m_currentVideoSettings.m_Brightness; -+ m_Contrast = g_settings.m_currentVideoSettings.m_Contrast; -+ } -+ if (m_NoiseReduction != g_settings.m_currentVideoSettings.m_NoiseReduction) -+ { -+ m_NoiseReduction = g_settings.m_currentVideoSettings.m_NoiseReduction; -+ SetNoiseReduction(); -+ } -+ if (m_Sharpness != g_settings.m_currentVideoSettings.m_Sharpness) -+ { -+ m_Sharpness = g_settings.m_currentVideoSettings.m_Sharpness; -+ SetSharpness(); -+ } -+ if (m_DeintMode != g_settings.m_currentVideoSettings.m_DeinterlaceMode || -+ m_Deint != g_settings.m_currentVideoSettings.m_InterlaceMethod) -+ { -+ m_DeintMode = g_settings.m_currentVideoSettings.m_DeinterlaceMode; -+ m_Deint = g_settings.m_currentVideoSettings.m_InterlaceMethod; -+ SetDeinterlacing(); -+ } -+} -+ -+void CMixer::SetPostProcFeatures(bool postProcEnabled) -+{ -+ if (m_PostProc != postProcEnabled) -+ { -+ if (postProcEnabled) -+ { -+ SetNoiseReduction(); -+ SetSharpness(); -+ SetDeinterlacing(); -+ SetHWUpscaling(); -+ } -+ else -+ PostProcOff(); -+ m_PostProc = postProcEnabled; -+ } -+} -+ -+void CMixer::PostProcOff() -+{ -+ VdpStatus vdp_st; -+ -+ if (m_videoMixer == VDP_INVALID_HANDLE) -+ return; -+ -+ VdpVideoMixerFeature feature[] = { VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL, -+ VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL_SPATIAL, -+ VDP_VIDEO_MIXER_FEATURE_INVERSE_TELECINE}; -+ -+ VdpBool enabled[]={0,0,0}; -+ vdp_st = m_config.vdpProcs.vdp_video_mixer_set_feature_enables(m_videoMixer, ARSIZE(feature), feature, enabled); -+ CheckStatus(vdp_st, __LINE__); -+ -+ if(m_config.vdpau->Supports(VDP_VIDEO_MIXER_FEATURE_NOISE_REDUCTION)) -+ { -+ VdpVideoMixerFeature feature[] = { VDP_VIDEO_MIXER_FEATURE_NOISE_REDUCTION}; -+ -+ VdpBool enabled[]={0}; -+ vdp_st = m_config.vdpProcs.vdp_video_mixer_set_feature_enables(m_videoMixer, ARSIZE(feature), feature, enabled); -+ CheckStatus(vdp_st, __LINE__); -+ } -+ -+ if(m_config.vdpau->Supports(VDP_VIDEO_MIXER_FEATURE_SHARPNESS)) -+ { -+ VdpVideoMixerFeature feature[] = { VDP_VIDEO_MIXER_FEATURE_SHARPNESS}; -+ -+ VdpBool enabled[]={0}; -+ vdp_st = m_config.vdpProcs.vdp_video_mixer_set_feature_enables(m_videoMixer, ARSIZE(feature), feature, enabled); -+ CheckStatus(vdp_st, __LINE__); -+ } -+ -+ DisableHQScaling(); -+} -+ -+ -+bool CMixer::GenerateStudioCSCMatrix(VdpColorStandard colorStandard, VdpCSCMatrix &studioCSCMatrix) -+{ -+ // instead use studioCSCKCoeffs601[3], studioCSCKCoeffs709[3] to generate float[3][4] matrix (float studioCSC[3][4]) -+ // m00 = mRY = red: luma factor (contrast factor) (1.0) -+ // m10 = mGY = green: luma factor (contrast factor) (1.0) -+ // m20 = mBY = blue: luma factor (contrast factor) (1.0) -+ // -+ // m01 = mRB = red: blue color diff coeff (0.0) -+ // m11 = mGB = green: blue color diff coeff (-2Kb(1-Kb)/(Kg)) -+ // m21 = mBB = blue: blue color diff coeff ((1-Kb)/0.5) -+ // -+ // m02 = mRR = red: red color diff coeff ((1-Kr)/0.5) -+ // m12 = mGR = green: red color diff coeff (-2Kr(1-Kr)/(Kg)) -+ // m22 = mBR = blue: red color diff coeff (0.0) -+ // -+ // m03 = mRC = red: colour zero offset (brightness factor) (-(1-Kr)/0.5 * (128/255)) -+ // m13 = mGC = green: colour zero offset (brightness factor) ((256/255) * (Kb(1-Kb) + Kr(1-Kr)) / Kg) -+ // m23 = mBC = blue: colour zero offset (brightness factor) (-(1-Kb)/0.5 * (128/255)) -+ -+ // columns -+ int Y = 0; -+ int Cb = 1; -+ int Cr = 2; -+ int C = 3; -+ // rows -+ int R = 0; -+ int G = 1; -+ int B = 2; -+ // colour standard coefficients for red, geen, blue -+ double Kr, Kg, Kb; -+ // colour diff zero position (use standard 8-bit coding precision) -+ double CDZ = 128; //256*0.5 -+ // range excursion (use standard 8-bit coding precision) -+ double EXC = 255; //256-1 -+ -+ if (colorStandard == VDP_COLOR_STANDARD_ITUR_BT_601) -+ { -+ Kr = studioCSCKCoeffs601[0]; -+ Kg = studioCSCKCoeffs601[1]; -+ Kb = studioCSCKCoeffs601[2]; -+ } -+ else // assume VDP_COLOR_STANDARD_ITUR_BT_709 -+ { -+ Kr = studioCSCKCoeffs709[0]; -+ Kg = studioCSCKCoeffs709[1]; -+ Kb = studioCSCKCoeffs709[2]; -+ } -+ // we keep luma unscaled to retain the levels present in source so that 16-235 luma is converted to RGB 16-235 -+ studioCSCMatrix[R][Y] = 1.0; -+ studioCSCMatrix[G][Y] = 1.0; -+ studioCSCMatrix[B][Y] = 1.0; -+ -+ studioCSCMatrix[R][Cb] = 0.0; -+ studioCSCMatrix[G][Cb] = (double)-2 * Kb * (1 - Kb) / Kg; -+ studioCSCMatrix[B][Cb] = (double)(1 - Kb) / 0.5; -+ -+ studioCSCMatrix[R][Cr] = (double)(1 - Kr) / 0.5; -+ studioCSCMatrix[G][Cr] = (double)-2 * Kr * (1 - Kr) / Kg; -+ studioCSCMatrix[B][Cr] = 0.0; -+ -+ studioCSCMatrix[R][C] = (double)-1 * studioCSCMatrix[R][Cr] * CDZ/EXC; -+ studioCSCMatrix[G][C] = (double)-1 * (studioCSCMatrix[G][Cb] + studioCSCMatrix[G][Cr]) * CDZ/EXC; -+ studioCSCMatrix[B][C] = (double)-1 * studioCSCMatrix[B][Cb] * CDZ/EXC; -+ -+ return true; -+} -+ -+void CMixer::SetColor() -+{ -+ VdpStatus vdp_st; -+ -+ if (m_Brightness != g_settings.m_currentVideoSettings.m_Brightness) -+ m_Procamp.brightness = (float)((g_settings.m_currentVideoSettings.m_Brightness)-50) / 100; -+ if (m_Contrast != g_settings.m_currentVideoSettings.m_Contrast) -+ m_Procamp.contrast = (float)((g_settings.m_currentVideoSettings.m_Contrast)+50) / 100; -+ -+ VdpColorStandard colorStandard; -+// if(vid_height >= 600 || vid_width > 1024) -+ if(m_config.surfaceWidth > 1000) -+ colorStandard = VDP_COLOR_STANDARD_ITUR_BT_709; -+ //vdp_st = vdp_generate_csc_matrix(&m_Procamp, VDP_COLOR_STANDARD_ITUR_BT_709, &m_CSCMatrix); -+ else -+ colorStandard = VDP_COLOR_STANDARD_ITUR_BT_601; -+ //vdp_st = vdp_generate_csc_matrix(&m_Procamp, VDP_COLOR_STANDARD_ITUR_BT_601, &m_CSCMatrix); -+ -+ VdpVideoMixerAttribute attributes[] = { VDP_VIDEO_MIXER_ATTRIBUTE_CSC_MATRIX }; -+ if (g_guiSettings.GetBool("videoplayer.vdpaustudiolevel")) -+ { -+ float studioCSC[3][4]; -+ GenerateStudioCSCMatrix(colorStandard, studioCSC); -+ void const * pm_CSCMatix[] = { &studioCSC }; -+ vdp_st = m_config.vdpProcs.vdp_video_mixer_set_attribute_values(m_videoMixer, ARSIZE(attributes), attributes, pm_CSCMatix); -+ } -+ else -+ { -+ vdp_st = m_config.vdpProcs.vdp_generate_csc_matrix(&m_Procamp, colorStandard, &m_CSCMatrix); -+ void const * pm_CSCMatix[] = { &m_CSCMatrix }; -+ vdp_st = m_config.vdpProcs.vdp_video_mixer_set_attribute_values(m_videoMixer, ARSIZE(attributes), attributes, pm_CSCMatix); -+ } -+ CheckStatus(vdp_st, __LINE__); -+} -+ -+void CMixer::SetNoiseReduction() -+{ -+ if(!m_config.vdpau->Supports(VDP_VIDEO_MIXER_FEATURE_NOISE_REDUCTION)) -+ return; -+ -+ VdpVideoMixerFeature feature[] = { VDP_VIDEO_MIXER_FEATURE_NOISE_REDUCTION }; -+ VdpVideoMixerAttribute attributes[] = { VDP_VIDEO_MIXER_ATTRIBUTE_NOISE_REDUCTION_LEVEL }; -+ VdpStatus vdp_st; -+ -+ if (!g_settings.m_currentVideoSettings.m_NoiseReduction) -+ { -+ VdpBool enabled[]= {0}; -+ vdp_st = m_config.vdpProcs.vdp_video_mixer_set_feature_enables(m_videoMixer, ARSIZE(feature), feature, enabled); -+ CheckStatus(vdp_st, __LINE__); -+ return; -+ } -+ VdpBool enabled[]={1}; -+ vdp_st = m_config.vdpProcs.vdp_video_mixer_set_feature_enables(m_videoMixer, ARSIZE(feature), feature, enabled); -+ CheckStatus(vdp_st, __LINE__); -+ void* nr[] = { &g_settings.m_currentVideoSettings.m_NoiseReduction }; -+ CLog::Log(LOGNOTICE,"Setting Noise Reduction to %f",g_settings.m_currentVideoSettings.m_NoiseReduction); -+ vdp_st = m_config.vdpProcs.vdp_video_mixer_set_attribute_values(m_videoMixer, ARSIZE(attributes), attributes, nr); -+ CheckStatus(vdp_st, __LINE__); -+} -+ -+void CMixer::SetSharpness() -+{ -+ if(!m_config.vdpau->Supports(VDP_VIDEO_MIXER_FEATURE_SHARPNESS)) -+ return; -+ -+ VdpVideoMixerFeature feature[] = { VDP_VIDEO_MIXER_FEATURE_SHARPNESS }; -+ VdpVideoMixerAttribute attributes[] = { VDP_VIDEO_MIXER_ATTRIBUTE_SHARPNESS_LEVEL }; -+ VdpStatus vdp_st; -+ -+ if (!g_settings.m_currentVideoSettings.m_Sharpness) -+ { -+ VdpBool enabled[]={0}; -+ vdp_st = m_config.vdpProcs.vdp_video_mixer_set_feature_enables(m_videoMixer, ARSIZE(feature), feature, enabled); -+ CheckStatus(vdp_st, __LINE__); -+ return; -+ } -+ VdpBool enabled[]={1}; -+ vdp_st = m_config.vdpProcs.vdp_video_mixer_set_feature_enables(m_videoMixer, ARSIZE(feature), feature, enabled); -+ CheckStatus(vdp_st, __LINE__); -+ void* sh[] = { &g_settings.m_currentVideoSettings.m_Sharpness }; -+ CLog::Log(LOGNOTICE,"Setting Sharpness to %f",g_settings.m_currentVideoSettings.m_Sharpness); -+ vdp_st = m_config.vdpProcs.vdp_video_mixer_set_attribute_values(m_videoMixer, ARSIZE(attributes), attributes, sh); -+ CheckStatus(vdp_st, __LINE__); -+} -+ -+EINTERLACEMETHOD CMixer::GetDeinterlacingMethod(bool log /* = false */) -+{ -+ EINTERLACEMETHOD method = g_settings.m_currentVideoSettings.m_InterlaceMethod; -+ if (method == VS_INTERLACEMETHOD_AUTO) -+ { -+ int deint = -1; -+// if (m_config.outHeight >= 720) -+// deint = g_advancedSettings.m_videoVDPAUdeintHD; -+// else -+// deint = g_advancedSettings.m_videoVDPAUdeintSD; -+ -+ if (deint != -1) -+ { -+ if (m_config.vdpau->Supports(EINTERLACEMETHOD(deint))) -+ { -+ method = EINTERLACEMETHOD(deint); -+ if (log) -+ CLog::Log(LOGNOTICE, "CVDPAU::GetDeinterlacingMethod: set de-interlacing to %d", deint); -+ } -+ else -+ { -+ if (log) -+ CLog::Log(LOGWARNING, "CVDPAU::GetDeinterlacingMethod: method for de-interlacing (advanced settings) not supported"); -+ } -+ } -+ } -+ return method; -+} -+ -+void CMixer::SetDeinterlacing() -+{ -+ VdpStatus vdp_st; -+ -+ if (m_videoMixer == VDP_INVALID_HANDLE) -+ return; -+ -+ EDEINTERLACEMODE mode = g_settings.m_currentVideoSettings.m_DeinterlaceMode; -+ EINTERLACEMETHOD method = GetDeinterlacingMethod(true); -+ -+ VdpVideoMixerFeature feature[] = { VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL, -+ VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL_SPATIAL, -+ VDP_VIDEO_MIXER_FEATURE_INVERSE_TELECINE }; -+ -+ if (mode == VS_DEINTERLACEMODE_OFF) -+ { -+ VdpBool enabled[] = {0,0,0}; -+ vdp_st = m_config.vdpProcs.vdp_video_mixer_set_feature_enables(m_videoMixer, ARSIZE(feature), feature, enabled); -+ } -+ else -+ { -+ if (method == VS_INTERLACEMETHOD_AUTO) -+ { -+ VdpBool enabled[] = {1,0,0}; -+ if (g_advancedSettings.m_videoVDPAUtelecine) -+ enabled[2] = 1; -+ vdp_st = m_config.vdpProcs.vdp_video_mixer_set_feature_enables(m_videoMixer, ARSIZE(feature), feature, enabled); -+ } -+ else if (method == VS_INTERLACEMETHOD_VDPAU_TEMPORAL -+ || method == VS_INTERLACEMETHOD_VDPAU_TEMPORAL_HALF) -+ { -+ VdpBool enabled[] = {1,0,0}; -+ if (g_advancedSettings.m_videoVDPAUtelecine) -+ enabled[2] = 1; -+ vdp_st = m_config.vdpProcs.vdp_video_mixer_set_feature_enables(m_videoMixer, ARSIZE(feature), feature, enabled); -+ } -+ else if (method == VS_INTERLACEMETHOD_VDPAU_TEMPORAL_SPATIAL -+ || method == VS_INTERLACEMETHOD_VDPAU_TEMPORAL_SPATIAL_HALF) -+ { -+ VdpBool enabled[] = {1,1,0}; -+ if (g_advancedSettings.m_videoVDPAUtelecine) -+ enabled[2] = 1; -+ vdp_st = m_config.vdpProcs.vdp_video_mixer_set_feature_enables(m_videoMixer, ARSIZE(feature), feature, enabled); -+ } -+ else -+ { -+ VdpBool enabled[]={0,0,0}; -+ vdp_st = m_config.vdpProcs.vdp_video_mixer_set_feature_enables(m_videoMixer, ARSIZE(feature), feature, enabled); -+ } -+ } -+ CheckStatus(vdp_st, __LINE__); -+ -+ SetDeintSkipChroma(); -+ -+ m_config.useInteropYuv = g_guiSettings.GetBool("videoplayer.usevdpauinteropyuv"); -+} -+ -+void CMixer::SetDeintSkipChroma() -+{ -+ VdpVideoMixerAttribute attribute[] = { VDP_VIDEO_MIXER_ATTRIBUTE_SKIP_CHROMA_DEINTERLACE}; -+ VdpStatus vdp_st; -+ -+ uint8_t val; -+ if (g_advancedSettings.m_videoVDPAUdeintSkipChromaHD && m_config.outHeight >= 720) -+ val = 1; -+ else -+ val = 0; -+ -+ void const *values[]={&val}; -+ vdp_st = m_config.vdpProcs.vdp_video_mixer_set_attribute_values(m_videoMixer, ARSIZE(attribute), attribute, values); -+ -+ CheckStatus(vdp_st, __LINE__); -+} -+ -+void CMixer::SetHWUpscaling() -+{ -+#ifdef VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1 -+ -+ VdpStatus vdp_st; -+ VdpBool enabled[]={1}; -+ switch (m_config.upscale) -+ { -+ case 9: -+ if (m_config.vdpau->Supports(VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L9)) -+ { -+ VdpVideoMixerFeature feature[] = { VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L9 }; -+ vdp_st = m_config.vdpProcs.vdp_video_mixer_set_feature_enables(m_videoMixer, ARSIZE(feature), feature, enabled); -+ break; -+ } -+ case 8: -+ if (m_config.vdpau->Supports(VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L8)) -+ { -+ VdpVideoMixerFeature feature[] = { VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L8 }; -+ vdp_st = m_config.vdpProcs.vdp_video_mixer_set_feature_enables(m_videoMixer, ARSIZE(feature), feature, enabled); -+ break; -+ } -+ case 7: -+ if (m_config.vdpau->Supports(VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L7)) -+ { -+ VdpVideoMixerFeature feature[] = { VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L7 }; -+ vdp_st = m_config.vdpProcs.vdp_video_mixer_set_feature_enables(m_videoMixer, ARSIZE(feature), feature, enabled); -+ break; -+ } -+ case 6: -+ if (m_config.vdpau->Supports(VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L6)) -+ { -+ VdpVideoMixerFeature feature[] = { VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L6 }; -+ vdp_st = m_config.vdpProcs.vdp_video_mixer_set_feature_enables(m_videoMixer, ARSIZE(feature), feature, enabled); -+ break; -+ } -+ case 5: -+ if (m_config.vdpau->Supports(VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L5)) -+ { -+ VdpVideoMixerFeature feature[] = { VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L5 }; -+ vdp_st = m_config.vdpProcs.vdp_video_mixer_set_feature_enables(m_videoMixer, ARSIZE(feature), feature, enabled); -+ break; -+ } -+ case 4: -+ if (m_config.vdpau->Supports(VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L4)) -+ { -+ VdpVideoMixerFeature feature[] = { VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L4 }; -+ vdp_st = m_config.vdpProcs.vdp_video_mixer_set_feature_enables(m_videoMixer, ARSIZE(feature), feature, enabled); -+ break; -+ } -+ case 3: -+ if (m_config.vdpau->Supports(VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L3)) -+ { -+ VdpVideoMixerFeature feature[] = { VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L3 }; -+ vdp_st = m_config.vdpProcs.vdp_video_mixer_set_feature_enables(m_videoMixer, ARSIZE(feature), feature, enabled); -+ break; -+ } -+ case 2: -+ if (m_config.vdpau->Supports(VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L2)) -+ { -+ VdpVideoMixerFeature feature[] = { VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L2 }; -+ vdp_st = m_config.vdpProcs.vdp_video_mixer_set_feature_enables(m_videoMixer, ARSIZE(feature), feature, enabled); -+ break; -+ } -+ case 1: -+ if (m_config.vdpau->Supports(VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1)) -+ { -+ VdpVideoMixerFeature feature[] = { VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1 }; -+ vdp_st = m_config.vdpProcs.vdp_video_mixer_set_feature_enables(m_videoMixer, ARSIZE(feature), feature, enabled); -+ break; -+ } -+ default: -+ DisableHQScaling(); -+ return; -+ } -+ CheckStatus(vdp_st, __LINE__); -+#endif -+} -+ -+void CMixer::DisableHQScaling() -+{ -+ VdpStatus vdp_st; -+ -+ if (m_videoMixer == VDP_INVALID_HANDLE) -+ return; -+ -+ if(m_config.vdpau->Supports(VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1)) -+ { -+ VdpVideoMixerFeature feature[] = { VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1 }; -+ VdpBool enabled[]={0}; -+ vdp_st = m_config.vdpProcs.vdp_video_mixer_set_feature_enables(m_videoMixer, ARSIZE(feature), feature, enabled); -+ CheckStatus(vdp_st, __LINE__); -+ } -+ -+ if(m_config.vdpau->Supports(VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L2)) -+ { -+ VdpVideoMixerFeature feature[] = { VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L2 }; -+ VdpBool enabled[]={0}; -+ vdp_st = m_config.vdpProcs.vdp_video_mixer_set_feature_enables(m_videoMixer, ARSIZE(feature), feature, enabled); -+ CheckStatus(vdp_st, __LINE__); -+ } -+ -+ if(m_config.vdpau->Supports(VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L3)) -+ { -+ VdpVideoMixerFeature feature[] = { VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L3 }; -+ VdpBool enabled[]={0}; -+ vdp_st = m_config.vdpProcs.vdp_video_mixer_set_feature_enables(m_videoMixer, ARSIZE(feature), feature, enabled); -+ CheckStatus(vdp_st, __LINE__); -+ } -+ -+ if(m_config.vdpau->Supports(VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L4)) -+ { -+ VdpVideoMixerFeature feature[] = { VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L4 }; -+ VdpBool enabled[]={0}; -+ vdp_st = m_config.vdpProcs.vdp_video_mixer_set_feature_enables(m_videoMixer, ARSIZE(feature), feature, enabled); -+ CheckStatus(vdp_st, __LINE__); -+ } -+ -+ if(m_config.vdpau->Supports(VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L5)) -+ { -+ VdpVideoMixerFeature feature[] = { VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L5 }; -+ VdpBool enabled[]={0}; -+ vdp_st = m_config.vdpProcs.vdp_video_mixer_set_feature_enables(m_videoMixer, ARSIZE(feature), feature, enabled); -+ CheckStatus(vdp_st, __LINE__); -+ } -+ -+ if(m_config.vdpau->Supports(VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L6)) -+ { -+ VdpVideoMixerFeature feature[] = { VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L6 }; -+ VdpBool enabled[]={0}; -+ vdp_st = m_config.vdpProcs.vdp_video_mixer_set_feature_enables(m_videoMixer, ARSIZE(feature), feature, enabled); -+ CheckStatus(vdp_st, __LINE__); -+ } -+ -+ if(m_config.vdpau->Supports(VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L7)) -+ { -+ VdpVideoMixerFeature feature[] = { VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L7 }; -+ VdpBool enabled[]={0}; -+ vdp_st = m_config.vdpProcs.vdp_video_mixer_set_feature_enables(m_videoMixer, ARSIZE(feature), feature, enabled); -+ CheckStatus(vdp_st, __LINE__); -+ } -+ -+ if(m_config.vdpau->Supports(VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L8)) -+ { -+ VdpVideoMixerFeature feature[] = { VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L8 }; -+ VdpBool enabled[]={0}; -+ vdp_st = m_config.vdpProcs.vdp_video_mixer_set_feature_enables(m_videoMixer, ARSIZE(feature), feature, enabled); -+ CheckStatus(vdp_st, __LINE__); -+ } -+ -+ if(m_config.vdpau->Supports(VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L9)) -+ { -+ VdpVideoMixerFeature feature[] = { VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L9 }; -+ VdpBool enabled[]={0}; -+ vdp_st = m_config.vdpProcs.vdp_video_mixer_set_feature_enables(m_videoMixer, ARSIZE(feature), feature, enabled); -+ CheckStatus(vdp_st, __LINE__); -+ } -+} -+ -+ -+void CMixer::Init() -+{ -+ m_Brightness = 0.0; -+ m_Contrast = 0.0; -+ m_NoiseReduction = 0.0; -+ m_Sharpness = 0.0; -+ m_DeintMode = 0; -+ m_Deint = 0; -+ m_PostProc = false; -+ m_vdpError = false; -+ -+ m_config.upscale = g_advancedSettings.m_videoVDPAUScaling; -+ m_config.useInteropYuv = g_guiSettings.GetBool("videoplayer.usevdpauinteropyuv"); -+ -+ CreateVdpauMixer(); -+} -+ -+void CMixer::Uninit() -+{ -+ Flush(); -+ while (!m_outputSurfaces.empty()) -+ { -+ m_outputSurfaces.pop(); -+ } -+ m_config.vdpProcs.vdp_video_mixer_destroy(m_videoMixer); -+ -+ delete [] m_BlackBar; -+} -+ -+void CMixer::Flush() -+{ -+ while (!m_mixerInput.empty()) -+ { -+ CVdpauDecodedPicture pic = m_mixerInput.back(); -+ m_mixerInput.pop_back(); -+ CSingleLock lock(*m_config.videoSurfaceSec); -+ if (pic.render) -+ pic.render->state &= ~FF_VDPAU_STATE_USED_FOR_RENDER; -+ } -+ while (!m_decodedPics.empty()) -+ { -+ CVdpauDecodedPicture pic = m_decodedPics.front(); -+ m_decodedPics.pop(); -+ CSingleLock lock(*m_config.videoSurfaceSec); -+ if (pic.render) -+ pic.render->state &= ~FF_VDPAU_STATE_USED_FOR_RENDER; -+ } -+ Message *msg; -+ while (m_dataPort.ReceiveOutMessage(&msg)) -+ { -+ if (msg->signal == CMixerDataProtocol::FRAME) -+ { -+ CVdpauDecodedPicture pic = *(CVdpauDecodedPicture*)msg->data; -+ CSingleLock lock(*m_config.videoSurfaceSec); -+ if (pic.render) -+ pic.render->state &= ~FF_VDPAU_STATE_USED_FOR_RENDER; -+ } -+ else if (msg->signal == CMixerDataProtocol::BUFFER) -+ { -+ VdpOutputSurface *surf; -+ surf = (VdpOutputSurface*)msg->data; -+ m_outputSurfaces.push(*surf); -+ } -+ msg->Release(); -+ } -+} -+ -+void CMixer::InitCycle() -+{ -+ CheckFeatures(); -+ uint64_t latency; -+ int flags; -+ m_config.stats->GetParams(latency, flags); -+ latency = (latency*1000)/CurrentHostFrequency(); -+ if (flags & DVP_FLAG_NO_POSTPROC) -+ SetPostProcFeatures(false); -+ else -+ SetPostProcFeatures(true); -+ -+ m_config.stats->SetCanSkipDeint(false); -+ -+ EDEINTERLACEMODE mode = g_settings.m_currentVideoSettings.m_DeinterlaceMode; -+ EINTERLACEMETHOD method = GetDeinterlacingMethod(); -+ bool interlaced = m_mixerInput[1].DVDPic.iFlags & DVP_FLAG_INTERLACED; -+ -+ if (mode == VS_DEINTERLACEMODE_FORCE || -+ (mode == VS_DEINTERLACEMODE_AUTO && interlaced)) -+ { -+ if((method == VS_INTERLACEMETHOD_AUTO && interlaced) -+ || method == VS_INTERLACEMETHOD_VDPAU_BOB -+ || method == VS_INTERLACEMETHOD_VDPAU_TEMPORAL -+ || method == VS_INTERLACEMETHOD_VDPAU_TEMPORAL_HALF -+ || method == VS_INTERLACEMETHOD_VDPAU_TEMPORAL_SPATIAL -+ || method == VS_INTERLACEMETHOD_VDPAU_TEMPORAL_SPATIAL_HALF -+ || method == VS_INTERLACEMETHOD_VDPAU_INVERSE_TELECINE ) -+ { -+ if(method == VS_INTERLACEMETHOD_VDPAU_TEMPORAL_HALF -+ || method == VS_INTERLACEMETHOD_VDPAU_TEMPORAL_SPATIAL_HALF -+ || !g_graphicsContext.IsFullScreenVideo()) -+ m_mixersteps = 1; -+ else -+ { -+ m_mixersteps = 2; -+ m_config.stats->SetCanSkipDeint(true); -+ } -+ -+ if (m_mixerInput[1].DVDPic.iFlags & DVP_FLAG_DROPDEINT) -+ { -+ m_mixersteps = 1; -+ } -+ -+ if(m_mixerInput[1].DVDPic.iFlags & DVP_FLAG_TOP_FIELD_FIRST) -+ m_mixerfield = VDP_VIDEO_MIXER_PICTURE_STRUCTURE_TOP_FIELD; -+ else -+ m_mixerfield = VDP_VIDEO_MIXER_PICTURE_STRUCTURE_BOTTOM_FIELD; -+ -+ m_mixerInput[1].DVDPic.format = RENDER_FMT_VDPAU; -+ m_mixerInput[1].DVDPic.iFlags &= ~(DVP_FLAG_TOP_FIELD_FIRST | -+ DVP_FLAG_REPEAT_TOP_FIELD | -+ DVP_FLAG_INTERLACED); -+ m_config.useInteropYuv = false; -+ } -+ else if (method == VS_INTERLACEMETHOD_RENDER_BOB && m_config.useInteropYuv) -+ { -+ m_mixersteps = 1; -+ m_mixerfield = VDP_VIDEO_MIXER_PICTURE_STRUCTURE_FRAME; -+ m_mixerInput[1].DVDPic.format = RENDER_FMT_VDPAU_420; -+ } -+ else -+ { -+ CLog::Log(LOGERROR, "CMixer::%s - interlace method not supported", __FUNCTION__); -+ m_mixersteps = 1; -+ m_mixerfield = VDP_VIDEO_MIXER_PICTURE_STRUCTURE_FRAME; -+ m_mixerInput[1].DVDPic.format = RENDER_FMT_VDPAU; -+ m_mixerInput[1].DVDPic.iFlags &= ~(DVP_FLAG_TOP_FIELD_FIRST | -+ DVP_FLAG_REPEAT_TOP_FIELD | -+ DVP_FLAG_INTERLACED); -+ } -+ } -+ else -+ { -+ m_mixersteps = 1; -+ m_mixerfield = VDP_VIDEO_MIXER_PICTURE_STRUCTURE_FRAME; -+ -+ if (m_config.useInteropYuv) -+ m_mixerInput[1].DVDPic.format = RENDER_FMT_VDPAU_420; -+ else -+ { -+ m_mixerInput[1].DVDPic.format = RENDER_FMT_VDPAU; -+ m_mixerInput[1].DVDPic.iFlags &= ~(DVP_FLAG_TOP_FIELD_FIRST | -+ DVP_FLAG_REPEAT_TOP_FIELD | -+ DVP_FLAG_INTERLACED); -+ } -+ } -+ m_mixerstep = 0; -+ -+ if (m_mixerInput[1].DVDPic.format == RENDER_FMT_VDPAU) -+ { -+ m_processPicture.outputSurface = m_outputSurfaces.front(); -+ m_mixerInput[1].DVDPic.iWidth = m_config.outWidth; -+ m_mixerInput[1].DVDPic.iHeight = m_config.outHeight; -+ } -+ else -+ { -+ m_mixerInput[1].DVDPic.iWidth = m_config.vidWidth; -+ m_mixerInput[1].DVDPic.iHeight = m_config.vidHeight; -+ } -+ -+ m_processPicture.DVDPic = m_mixerInput[1].DVDPic; -+ m_processPicture.render = m_mixerInput[1].render; -+} -+ -+void CMixer::FiniCycle() -+{ -+ while (m_mixerInput.size() > 3) -+ { -+ CVdpauDecodedPicture &tmp = m_mixerInput.back(); -+ if (tmp.render && m_processPicture.DVDPic.format != RENDER_FMT_VDPAU_420) -+ { -+ CSingleLock lock(*m_config.videoSurfaceSec); -+ tmp.render->state &= ~FF_VDPAU_STATE_USED_FOR_RENDER; -+ } -+ m_mixerInput.pop_back(); -+// m_config.stats->DecDecoded(); -+ } -+} -+ -+void CMixer::ProcessPicture() -+{ -+ if (m_processPicture.DVDPic.format == RENDER_FMT_VDPAU_420) -+ return; -+ -+ VdpStatus vdp_st; -+ -+ if (m_mixerstep == 1) -+ { -+ if(m_mixerfield == VDP_VIDEO_MIXER_PICTURE_STRUCTURE_TOP_FIELD) -+ m_mixerfield = VDP_VIDEO_MIXER_PICTURE_STRUCTURE_BOTTOM_FIELD; -+ else -+ m_mixerfield = VDP_VIDEO_MIXER_PICTURE_STRUCTURE_TOP_FIELD; -+ } -+ -+ VdpVideoSurface past_surfaces[4] = { VDP_INVALID_HANDLE, VDP_INVALID_HANDLE, VDP_INVALID_HANDLE, VDP_INVALID_HANDLE }; -+ VdpVideoSurface futu_surfaces[2] = { VDP_INVALID_HANDLE, VDP_INVALID_HANDLE }; -+ uint32_t pastCount = 4; -+ uint32_t futuCount = 2; -+ -+ if(m_mixerfield == VDP_VIDEO_MIXER_PICTURE_STRUCTURE_FRAME) -+ { -+ // use only 2 past 1 future for progressive/weave -+ // (only used for postproc anyway eg noise reduction) -+ if (m_mixerInput.size() > 3) -+ past_surfaces[1] = m_mixerInput[3].render->surface; -+ if (m_mixerInput.size() > 2) -+ past_surfaces[0] = m_mixerInput[2].render->surface; -+ futu_surfaces[0] = m_mixerInput[0].render->surface; -+ pastCount = 2; -+ futuCount = 1; -+ } -+ else -+ { -+ if(m_mixerstep == 0) -+ { // first field -+ if (m_mixerInput.size() > 3) -+ { -+ past_surfaces[3] = m_mixerInput[3].render->surface; -+ past_surfaces[2] = m_mixerInput[3].render->surface; -+ } -+ if (m_mixerInput.size() > 2) -+ { -+ past_surfaces[1] = m_mixerInput[2].render->surface; -+ past_surfaces[0] = m_mixerInput[2].render->surface; -+ } -+ futu_surfaces[0] = m_mixerInput[1].render->surface; -+ futu_surfaces[1] = m_mixerInput[0].render->surface;; -+ } -+ else -+ { // second field -+ if (m_mixerInput.size() > 3) -+ { -+ past_surfaces[3] = m_mixerInput[3].render->surface; -+ } -+ if (m_mixerInput.size() > 2) -+ { -+ past_surfaces[2] = m_mixerInput[2].render->surface; -+ past_surfaces[1] = m_mixerInput[2].render->surface; -+ } -+ past_surfaces[0] = m_mixerInput[1].render->surface; -+ futu_surfaces[0] = m_mixerInput[1].render->surface; -+ futu_surfaces[1] = m_mixerInput[1].render->surface; -+ -+ m_processPicture.DVDPic.pts = DVD_NOPTS_VALUE; -+ m_processPicture.DVDPic.dts = DVD_NOPTS_VALUE; -+ } -+ m_processPicture.DVDPic.iRepeatPicture = 0.0; -+ } // interlaced -+ -+ VdpRect sourceRect; -+ sourceRect.x0 = 0; -+ sourceRect.y0 = 0; -+ sourceRect.x1 = m_config.vidWidth; -+ sourceRect.y1 = m_config.vidHeight; -+ -+ VdpRect destRect; -+ destRect.x0 = 0; -+ destRect.y0 = 0; -+ destRect.x1 = m_config.outWidth; -+ destRect.y1 = m_config.outHeight; -+ -+ // start vdpau video mixer -+ vdp_st = m_config.vdpProcs.vdp_video_mixer_render(m_videoMixer, -+ VDP_INVALID_HANDLE, -+ 0, -+ m_mixerfield, -+ pastCount, -+ past_surfaces, -+ m_mixerInput[1].render->surface, -+ futuCount, -+ futu_surfaces, -+ &sourceRect, -+ m_processPicture.outputSurface, -+ &destRect, -+ &destRect, -+ 0, -+ NULL); -+ CheckStatus(vdp_st, __LINE__); -+ -+ if (m_mixerfield != VDP_VIDEO_MIXER_PICTURE_STRUCTURE_FRAME) -+ { -+ // in order to clip top and bottom lines when de-interlacing -+ // we black those lines as a work around for not working -+ // background colour using the mixer -+ // pixel perfect is preferred over overscanning or zooming -+ -+ VdpRect clipRect = destRect; -+ clipRect.y1 = clipRect.y0 + 2; -+ uint32_t *data[] = {m_BlackBar}; -+ uint32_t pitches[] = {destRect.x1}; -+ vdp_st = m_config.vdpProcs.vdp_output_surface_put_bits_native(m_processPicture.outputSurface, -+ (void**)data, -+ pitches, -+ &clipRect); -+ CheckStatus(vdp_st, __LINE__); -+ -+ clipRect = destRect; -+ clipRect.y0 = clipRect.y1 - 2; -+ vdp_st = m_config.vdpProcs.vdp_output_surface_put_bits_native(m_processPicture.outputSurface, -+ (void**)data, -+ pitches, -+ &clipRect); -+ CheckStatus(vdp_st, __LINE__); -+ } -+} -+ -+ -+bool CMixer::CheckStatus(VdpStatus vdp_st, int line) -+{ -+ if (vdp_st != VDP_STATUS_OK) -+ { -+ CLog::Log(LOGERROR, " (VDPAU) Error: %s(%d) at %s:%d\n", m_config.vdpProcs.vdp_get_error_string(vdp_st), vdp_st, __FILE__, line); -+ m_vdpError = true; -+ return true; -+ } -+ return false; -+} -+ -+//----------------------------------------------------------------------------- -+// Output -+//----------------------------------------------------------------------------- -+COutput::COutput(CEvent *inMsgEvent) : -+ CThread("Vdpau Output Thread"), -+ m_controlPort("OutputControlPort", inMsgEvent, &m_outMsgEvent), -+ m_dataPort("OutputDataPort", inMsgEvent, &m_outMsgEvent), -+ m_mixer(&m_outMsgEvent) -+{ -+ m_inMsgEvent = inMsgEvent; -+ -+ CVdpauRenderPicture pic; -+ pic.renderPicSection = &m_bufferPool.renderPicSec; -+ pic.refCount = 0; -+ for (unsigned int i = 0; i < NUM_RENDER_PICS; i++) -+ { -+ m_bufferPool.allRenderPics.push_back(pic); -+ } -+ for (unsigned int i = 0; i < m_bufferPool.allRenderPics.size(); ++i) -+ { -+ m_bufferPool.freeRenderPics.push_back(&m_bufferPool.allRenderPics[i]); -+ } -+} -+ -+void COutput::Start() -+{ -+ Create(); -+} -+ -+COutput::~COutput() -+{ -+ Dispose(); -+ -+ m_bufferPool.freeRenderPics.clear(); -+ m_bufferPool.usedRenderPics.clear(); -+ m_bufferPool.allRenderPics.clear(); -+} -+ -+void COutput::Dispose() -+{ -+ CSingleLock lock(g_graphicsContext); -+ m_bStop = true; -+ m_outMsgEvent.Set(); -+ StopThread(); -+ m_controlPort.Purge(); -+ m_dataPort.Purge(); -+} -+ -+void COutput::OnStartup() -+{ -+ CLog::Log(LOGNOTICE, "COutput::OnStartup: Output Thread created"); -+} -+ -+void COutput::OnExit() -+{ -+ CLog::Log(LOGNOTICE, "COutput::OnExit: Output Thread terminated"); -+} -+ -+enum OUTPUT_STATES -+{ -+ O_TOP = 0, // 0 -+ O_TOP_ERROR, // 1 -+ O_TOP_UNCONFIGURED, // 2 -+ O_TOP_CONFIGURED, // 3 -+ O_TOP_CONFIGURED_IDLE, // 4 -+ O_TOP_CONFIGURED_WORK, // 5 -+}; -+ -+int VDPAU_OUTPUT_parentStates[] = { -+ -1, -+ 0, //TOP_ERROR -+ 0, //TOP_UNCONFIGURED -+ 0, //TOP_CONFIGURED -+ 3, //TOP_CONFIGURED_IDLE -+ 3, //TOP_CONFIGURED_WORK -+}; -+ -+void COutput::StateMachine(int signal, Protocol *port, Message *msg) -+{ -+ for (int state = m_state; ; state = VDPAU_OUTPUT_parentStates[state]) -+ { -+ switch (state) -+ { -+ case O_TOP: // TOP -+ if (port == &m_controlPort) -+ { -+ switch (signal) -+ { -+ case COutputControlProtocol::FLUSH: -+ msg->Reply(COutputControlProtocol::ACC); -+ return; -+ case COutputControlProtocol::PRECLEANUP: -+ msg->Reply(COutputControlProtocol::ACC); -+ return; -+ default: -+ break; -+ } -+ } -+ else if (port == &m_dataPort) -+ { -+ switch (signal) -+ { -+ case COutputDataProtocol::RETURNPIC: -+ CVdpauRenderPicture *pic; -+ pic = *((CVdpauRenderPicture**)msg->data); -+ ProcessReturnPicture(pic); -+ return; -+ default: -+ break; -+ } -+ } -+ { -+ std::string portName = port == NULL ? "timer" : port->portName; -+ CLog::Log(LOGWARNING, "COutput::%s - signal: %d form port: %s not handled for state: %d", __FUNCTION__, signal, portName.c_str(), m_state); -+ } -+ return; -+ -+ case O_TOP_ERROR: -+ break; -+ -+ case O_TOP_UNCONFIGURED: -+ if (port == &m_controlPort) -+ { -+ switch (signal) -+ { -+ case COutputControlProtocol::INIT: -+ CVdpauConfig *data; -+ data = (CVdpauConfig*)msg->data; -+ if (data) -+ { -+ m_config = *data; -+ } -+ Init(); -+ Message *reply; -+ if (m_mixer.m_controlPort.SendOutMessageSync(CMixerControlProtocol::INIT, -+ &reply, 1000, &m_config, sizeof(m_config))) -+ { -+ if (reply->signal != CMixerControlProtocol::ACC) -+ m_vdpError = true; -+ reply->Release(); -+ } -+ -+ // set initial number of -+ m_bufferPool.numOutputSurfaces = 4; -+ EnsureBufferPool(); -+ if (!m_vdpError) -+ { -+ m_state = O_TOP_CONFIGURED_IDLE; -+ msg->Reply(COutputControlProtocol::ACC); -+ } -+ else -+ { -+ m_state = O_TOP_ERROR; -+ msg->Reply(COutputControlProtocol::ERROR); -+ } -+ return; -+ default: -+ break; -+ } -+ } -+ break; -+ -+ case O_TOP_CONFIGURED: -+ if (port == &m_controlPort) -+ { -+ switch (signal) -+ { -+ case COutputControlProtocol::FLUSH: -+ Flush(); -+ msg->Reply(COutputControlProtocol::ACC); -+ return; -+ case COutputControlProtocol::PRECLEANUP: -+ Flush(); -+ msg->Reply(COutputControlProtocol::ACC); -+ return; -+ default: -+ break; -+ } -+ } -+ else if (port == &m_dataPort) -+ { -+ switch (signal) -+ { -+ case COutputDataProtocol::NEWFRAME: -+ CVdpauDecodedPicture *frame; -+ frame = (CVdpauDecodedPicture*)msg->data; -+ if (frame) -+ { -+ m_mixer.m_dataPort.SendOutMessage(CMixerDataProtocol::FRAME, -+ frame,sizeof(CVdpauDecodedPicture)); -+ } -+ return; -+ case COutputDataProtocol::RETURNPIC: -+ CVdpauRenderPicture *pic; -+ pic = *((CVdpauRenderPicture**)msg->data); -+ ProcessReturnPicture(pic); -+ m_controlPort.SendInMessage(COutputControlProtocol::STATS); -+ m_state = O_TOP_CONFIGURED_WORK; -+ m_extTimeout = 0; -+ return; -+ default: -+ break; -+ } -+ } -+ else if (port == &m_mixer.m_dataPort) -+ { -+ switch (signal) -+ { -+ case CMixerDataProtocol::PICTURE: -+ CVdpauProcessedPicture *pic; -+ pic = (CVdpauProcessedPicture*)msg->data; -+ m_bufferPool.processedPics.push(*pic); -+ m_state = O_TOP_CONFIGURED_WORK; -+ m_extTimeout = 0; -+ return; -+ default: -+ break; -+ } -+ } -+ break; -+ -+ case O_TOP_CONFIGURED_IDLE: -+ if (port == NULL) // timeout -+ { -+ switch (signal) -+ { -+ case COutputControlProtocol::TIMEOUT: -+// uint16_t decoded, processed, render; -+// m_config.stats->Get(decoded, processed, render); -+// CLog::Log(LOGDEBUG, "CVDPAU::COutput - timeout idle: decoded: %d, proc: %d, render: %d", decoded, processed, render); -+ return; -+ default: -+ break; -+ } -+ } -+ break; -+ -+ case O_TOP_CONFIGURED_WORK: -+ if (port == NULL) // timeout -+ { -+ switch (signal) -+ { -+ case COutputControlProtocol::TIMEOUT: -+ if (HasWork()) -+ { -+ CVdpauRenderPicture *pic; -+ pic = ProcessMixerPicture(); -+ if (pic) -+ { -+ m_config.stats->DecProcessed(); -+ m_config.stats->IncRender(); -+ m_dataPort.SendInMessage(COutputDataProtocol::PICTURE, &pic, sizeof(pic)); -+ } -+ m_extTimeout = 1; -+ } -+ else -+ { -+ m_state = O_TOP_CONFIGURED_IDLE; -+ m_extTimeout = 100; -+ } -+ return; -+ default: -+ break; -+ } -+ } -+ break; -+ -+ default: // we are in no state, should not happen -+ CLog::Log(LOGERROR, "COutput::%s - no valid state: %d", __FUNCTION__, m_state); -+ return; -+ } -+ } // for -+} -+ -+void COutput::Process() -+{ -+ Message *msg; -+ Protocol *port; -+ bool gotMsg; -+ -+ m_state = O_TOP_UNCONFIGURED; -+ m_extTimeout = 1000; -+ m_bStateMachineSelfTrigger = false; -+ -+ while (!m_bStop) -+ { -+ gotMsg = false; -+ -+ if (m_bStateMachineSelfTrigger) -+ { -+ m_bStateMachineSelfTrigger = false; -+ // self trigger state machine -+ StateMachine(msg->signal, port, msg); -+ if (!m_bStateMachineSelfTrigger) -+ { -+ msg->Release(); -+ msg = NULL; -+ } -+ continue; -+ } -+ // check control port -+ else if (m_controlPort.ReceiveOutMessage(&msg)) -+ { -+ gotMsg = true; -+ port = &m_controlPort; -+ } -+ // check data port -+ else if (m_dataPort.ReceiveOutMessage(&msg)) -+ { -+ gotMsg = true; -+ port = &m_dataPort; -+ } -+ // check mixer data port -+ else if (m_mixer.m_dataPort.ReceiveInMessage(&msg)) -+ { -+ gotMsg = true; -+ port = &m_mixer.m_dataPort; -+ } -+ if (gotMsg) -+ { -+ StateMachine(msg->signal, port, msg); -+ if (!m_bStateMachineSelfTrigger) -+ { -+ msg->Release(); -+ msg = NULL; -+ } -+ continue; -+ } -+ -+ // wait for message -+ else if (m_outMsgEvent.WaitMSec(m_extTimeout)) -+ { -+ continue; -+ } -+ // time out -+ else -+ { -+ msg = m_controlPort.GetMessage(); -+ msg->signal = COutputControlProtocol::TIMEOUT; -+ port = 0; -+ // signal timeout to state machine -+ StateMachine(msg->signal, port, msg); -+ if (!m_bStateMachineSelfTrigger) -+ { -+ msg->Release(); -+ msg = NULL; -+ } -+ } -+ } -+ Flush(); -+ Uninit(); -+} -+ -+bool COutput::Init() -+{ -+ if (!CreateGlxContext()) -+ return false; -+ -+ if (!GLInit()) -+ return false; -+ -+ m_mixer.Start(); -+ m_vdpError = false; -+ -+ return true; -+} -+ -+bool COutput::Uninit() -+{ -+ m_mixer.Dispose(); -+ GLUnmapSurfaces(); -+ GLUnbindPixmaps(); -+ ReleaseBufferPool(); -+ DestroyGlxContext(); -+ return true; -+} -+ -+void COutput::Flush() -+{ -+ Message *reply; -+ if (m_mixer.m_controlPort.SendOutMessageSync(CMixerControlProtocol::FLUSH, -+ &reply, -+ 2000)) -+ { -+ reply->Release(); -+ } -+ else -+ CLog::Log(LOGERROR, "Coutput::%s - failed to flush mixer", __FUNCTION__); -+ -+ Message *msg; -+ while (m_mixer.m_dataPort.ReceiveInMessage(&msg)) -+ { -+ if (msg->signal == CMixerDataProtocol::PICTURE) -+ { -+ CVdpauProcessedPicture pic = *(CVdpauProcessedPicture*)msg->data; -+ if (pic.DVDPic.format == RENDER_FMT_VDPAU_420) -+ { -+ CSingleLock lock(*m_config.videoSurfaceSec); -+ if (pic.render) -+ pic.render->state &= ~FF_VDPAU_STATE_USED_FOR_RENDER; -+ } -+ } -+ msg->Release(); -+ } -+ -+ while (m_dataPort.ReceiveOutMessage(&msg)) -+ { -+ if (msg->signal == COutputDataProtocol::NEWFRAME) -+ { -+ CVdpauDecodedPicture pic = *(CVdpauDecodedPicture*)msg->data; -+ CSingleLock lock(*m_config.videoSurfaceSec); -+ if (pic.render) -+ pic.render->state &= ~FF_VDPAU_STATE_USED_FOR_RENDER; -+ } -+ else if (msg->signal == COutputDataProtocol::RETURNPIC) -+ { -+ CVdpauRenderPicture *pic; -+ pic = *((CVdpauRenderPicture**)msg->data); -+ ProcessReturnPicture(pic); -+ } -+ msg->Release(); -+ } -+ -+ while (m_dataPort.ReceiveInMessage(&msg)) -+ { -+ if (msg->signal == COutputDataProtocol::PICTURE) -+ { -+ CVdpauRenderPicture *pic; -+ pic = *((CVdpauRenderPicture**)msg->data); -+ ProcessReturnPicture(pic); -+ } -+ } -+ -+ // reset used render flag which was cleared on mixer flush -+ std::deque::iterator it; -+ for (it = m_bufferPool.usedRenderPics.begin(); it != m_bufferPool.usedRenderPics.end(); ++it) -+ { -+ if ((*it)->DVDPic.format == RENDER_FMT_VDPAU_420) -+ { -+ std::map::iterator it2; -+ it2 = m_bufferPool.glVideoSurfaceMap.find((*it)->sourceIdx); -+ if (it2 == m_bufferPool.glVideoSurfaceMap.end()) -+ { -+ CLog::Log(LOGDEBUG, "COutput::Flush - gl surface not found"); -+ continue; -+ } -+ vdpau_render_state *render = it2->second.sourceVuv; -+ if (render) -+ render->state |= FF_VDPAU_STATE_USED_FOR_RENDER; -+ } -+ } -+} -+ -+bool COutput::HasWork() -+{ -+ if (m_config.usePixmaps) -+ { -+ if (!m_bufferPool.processedPics.empty() && FindFreePixmap() >= 0) -+ return true; -+ if (!m_bufferPool.notVisiblePixmaps.empty() && !m_bufferPool.freeRenderPics.empty()) -+ return true; -+ return false; -+ } -+ else -+ { -+ if (!m_bufferPool.processedPics.empty() && !m_bufferPool.freeRenderPics.empty()) -+ return true; -+ return false; -+ } -+} -+ -+CVdpauRenderPicture* COutput::ProcessMixerPicture() -+{ -+ CVdpauRenderPicture *retPic = 0; -+ -+ if (m_config.usePixmaps) -+ { -+ if (!m_bufferPool.processedPics.empty() && FindFreePixmap() >= 0) -+ { -+ unsigned int i = FindFreePixmap(); -+ VdpauBufferPool::Pixmaps *pixmap = &m_bufferPool.pixmaps[i]; -+ pixmap->used = true; -+ CVdpauProcessedPicture pic = m_bufferPool.processedPics.front(); -+ m_bufferPool.processedPics.pop(); -+ pixmap->surface = pic.outputSurface; -+ pixmap->DVDPic = pic.DVDPic; -+ pixmap->id = i; -+ m_bufferPool.notVisiblePixmaps.push_back(pixmap); -+ VdpStatus vdp_st; -+ m_config.vdpProcs.vdp_presentation_queue_display(pixmap->vdp_flip_queue, -+ pixmap->surface,0,0,0); -+ } -+ if (!m_bufferPool.notVisiblePixmaps.empty() && !m_bufferPool.freeRenderPics.empty()) -+ { -+ VdpStatus vdp_st; -+ VdpTime time; -+ VdpPresentationQueueStatus status; -+ VdpauBufferPool::Pixmaps *pixmap = m_bufferPool.notVisiblePixmaps.front(); -+ vdp_st = m_config.vdpProcs.vdp_presentation_queue_query_surface_status( -+ pixmap->vdp_flip_queue, pixmap->surface, &status, &time); -+ -+ if (vdp_st == VDP_STATUS_OK && status == VDP_PRESENTATION_QUEUE_STATUS_VISIBLE) -+ { -+ retPic = m_bufferPool.freeRenderPics.front(); -+ m_bufferPool.freeRenderPics.pop_front(); -+ m_bufferPool.usedRenderPics.push_back(retPic); -+ retPic->sourceIdx = pixmap->id; -+ retPic->DVDPic = pixmap->DVDPic; -+ retPic->valid = true; -+ retPic->texture[0] = pixmap->texture; -+ retPic->crop = CRect(0,0,0,0); -+ m_bufferPool.notVisiblePixmaps.pop_front(); -+ m_mixer.m_dataPort.SendOutMessage(CMixerDataProtocol::BUFFER, &pixmap->surface, sizeof(pixmap->surface)); -+ } -+ } -+ } // pixmap -+ else if (!m_bufferPool.processedPics.empty() && !m_bufferPool.freeRenderPics.empty()) -+ { -+ retPic = m_bufferPool.freeRenderPics.front(); -+ m_bufferPool.freeRenderPics.pop_front(); -+ m_bufferPool.usedRenderPics.push_back(retPic); -+ CVdpauProcessedPicture procPic = m_bufferPool.processedPics.front(); -+ m_bufferPool.processedPics.pop(); -+ -+ retPic->DVDPic = procPic.DVDPic; -+ retPic->valid = true; -+ if (retPic->DVDPic.format == RENDER_FMT_VDPAU) -+ { -+ m_config.useInteropYuv = false; -+ m_bufferPool.numOutputSurfaces = NUM_RENDER_PICS; -+ EnsureBufferPool(); -+ GLMapSurfaces(); -+ retPic->sourceIdx = procPic.outputSurface; -+ retPic->texture[0] = m_bufferPool.glOutputSurfaceMap[procPic.outputSurface].texture[0]; -+ retPic->crop = CRect(0,0,0,0); -+ } -+ else -+ { -+ m_config.useInteropYuv = true; -+ GLMapSurfaces(); -+ retPic->sourceIdx = procPic.render->surface; -+ for (unsigned int i=0; i<4; ++i) -+ retPic->texture[i] = m_bufferPool.glVideoSurfaceMap[procPic.render->surface].texture[i]; -+ retPic->texWidth = m_config.surfaceWidth; -+ retPic->texHeight = m_config.surfaceHeight; -+ retPic->crop.x1 = 0; -+ retPic->crop.y1 = 0; -+ retPic->crop.x2 = m_config.surfaceWidth - m_config.vidWidth; -+ retPic->crop.y2 = m_config.surfaceHeight - m_config.vidHeight; -+ } -+ } -+ return retPic; -+} -+ -+void COutput::ProcessReturnPicture(CVdpauRenderPicture *pic) -+{ -+ std::deque::iterator it; -+ it = std::find(m_bufferPool.usedRenderPics.begin(), m_bufferPool.usedRenderPics.end(), pic); -+ if (it == m_bufferPool.usedRenderPics.end()) -+ { -+ CLog::Log(LOGWARNING, "COutput::ProcessReturnPicture - pic not found"); -+ return; -+ } -+ m_bufferPool.usedRenderPics.erase(it); -+ m_bufferPool.freeRenderPics.push_back(pic); -+ if (!pic->valid) -+ { -+ CLog::Log(LOGDEBUG, "COutput::%s - return of invalid render pic", __FUNCTION__); -+ return; -+ } -+ -+ if (m_config.usePixmaps) -+ { -+ m_bufferPool.pixmaps[pic->sourceIdx].used = false; -+ return; -+ } -+ else if (pic->DVDPic.format == RENDER_FMT_VDPAU_420) -+ { -+ std::map::iterator it; -+ it = m_bufferPool.glVideoSurfaceMap.find(pic->sourceIdx); -+ if (it == m_bufferPool.glVideoSurfaceMap.end()) -+ { -+ CLog::Log(LOGDEBUG, "COutput::ProcessReturnPicture - gl surface not found"); -+ return; -+ } -+ vdpau_render_state *render = it->second.sourceVuv; -+ CSingleLock lock(*m_config.videoSurfaceSec); -+ render->state &= ~FF_VDPAU_STATE_USED_FOR_RENDER; -+ } -+ else if (pic->DVDPic.format == RENDER_FMT_VDPAU) -+ { -+ std::map::iterator it; -+ it = m_bufferPool.glOutputSurfaceMap.find(pic->sourceIdx); -+ if (it == m_bufferPool.glOutputSurfaceMap.end()) -+ { -+ CLog::Log(LOGDEBUG, "COutput::ProcessReturnPicture - gl surface not found"); -+ return; -+ } -+ VdpOutputSurface outSurf = it->second.sourceRgb; -+ m_mixer.m_dataPort.SendOutMessage(CMixerDataProtocol::BUFFER, &outSurf, sizeof(outSurf)); -+ } -+} -+ -+int COutput::FindFreePixmap() -+{ -+ // find free pixmap -+ unsigned int i; -+ for (i = 0; i < m_bufferPool.pixmaps.size(); ++i) -+ { -+ if (!m_bufferPool.pixmaps[i].used) -+ break; -+ } -+ if (i == m_bufferPool.pixmaps.size()) -+ return -1; -+ else -+ return i; -+} -+ -+bool COutput::EnsureBufferPool() -+{ -+ VdpStatus vdp_st; -+ -+ // Creation of outputSurfaces -+ VdpOutputSurface outputSurface; -+ for (int i = m_bufferPool.outputSurfaces.size(); i < m_bufferPool.numOutputSurfaces; i++) -+ { -+ vdp_st = m_config.vdpProcs.vdp_output_surface_create(m_config.vdpDevice, -+ VDP_RGBA_FORMAT_B8G8R8A8, -+ m_config.outWidth, -+ m_config.outHeight, -+ &outputSurface); -+ if (CheckStatus(vdp_st, __LINE__)) -+ return false; -+ m_bufferPool.outputSurfaces.push_back(outputSurface); -+ -+ m_mixer.m_dataPort.SendOutMessage(CMixerDataProtocol::BUFFER, -+ &outputSurface, -+ sizeof(VdpOutputSurface)); -+ CLog::Log(LOGNOTICE, "VDPAU::COutput::InitBufferPool - Output Surface created"); -+ } -+ -+ -+ if (m_config.usePixmaps && m_bufferPool.pixmaps.empty()) -+ { -+ // create pixmpas -+ VdpauBufferPool::Pixmaps pixmap; -+ int numPixmaps = NUM_RENDER_PICS; -+ for (unsigned int i = 0; i < numPixmaps; i++) -+ { -+ pixmap.pixmap = None; -+ pixmap.glPixmap = None; -+ pixmap.vdp_flip_queue = VDP_INVALID_HANDLE; -+ pixmap.vdp_flip_target = VDP_INVALID_HANDLE; -+ MakePixmap(pixmap); -+ glXMakeCurrent(m_Display, None, NULL); -+ vdp_st = m_config.vdpProcs.vdp_presentation_queue_target_create_x11(m_config.vdpDevice, -+ pixmap.pixmap, //x_window, -+ &pixmap.vdp_flip_target); -+ -+ CheckStatus(vdp_st, __LINE__); -+ -+ vdp_st = m_config.vdpProcs.vdp_presentation_queue_create(m_config.vdpDevice, -+ pixmap.vdp_flip_target, -+ &pixmap.vdp_flip_queue); -+ CheckStatus(vdp_st, __LINE__); -+ glXMakeCurrent(m_Display, m_glPixmap, m_glContext); -+ -+ pixmap.id = i; -+ pixmap.used = false; -+ m_bufferPool.pixmaps.push_back(pixmap); -+ } -+ GLBindPixmaps(); -+ } -+ -+ return true; -+} -+ -+void COutput::ReleaseBufferPool() -+{ -+ VdpStatus vdp_st; -+ -+ CSingleLock lock(m_bufferPool.renderPicSec); -+ -+ if (m_config.usePixmaps) -+ { -+ for (unsigned int i = 0; i < m_bufferPool.pixmaps.size(); ++i) -+ { -+ if (m_bufferPool.pixmaps[i].vdp_flip_queue != VDP_INVALID_HANDLE) -+ { -+ vdp_st = m_config.vdpProcs.vdp_presentation_queue_destroy(m_bufferPool.pixmaps[i].vdp_flip_queue); -+ CheckStatus(vdp_st, __LINE__); -+ } -+ if (m_bufferPool.pixmaps[i].vdp_flip_target != VDP_INVALID_HANDLE) -+ { -+ vdp_st = m_config.vdpProcs.vdp_presentation_queue_target_destroy(m_bufferPool.pixmaps[i].vdp_flip_target); -+ CheckStatus(vdp_st, __LINE__); -+ } -+ if (m_bufferPool.pixmaps[i].glPixmap) -+ { -+ glXDestroyPixmap(m_Display, m_bufferPool.pixmaps[i].glPixmap); -+ } -+ if (m_bufferPool.pixmaps[i].pixmap) -+ { -+ XFreePixmap(m_Display, m_bufferPool.pixmaps[i].pixmap); -+ } -+ } -+ m_bufferPool.pixmaps.clear(); -+ } -+ -+ // release all output surfaces -+ for (unsigned int i = 0; i < m_bufferPool.outputSurfaces.size(); ++i) -+ { -+ if (m_bufferPool.outputSurfaces[i] == VDP_INVALID_HANDLE) -+ continue; -+ vdp_st = m_config.vdpProcs.vdp_output_surface_destroy(m_bufferPool.outputSurfaces[i]); -+ CheckStatus(vdp_st, __LINE__); -+ } -+ m_bufferPool.outputSurfaces.clear(); -+ -+ // invalidate all used render pictures -+ for (unsigned int i = 0; i < m_bufferPool.usedRenderPics.size(); ++i) -+ { -+ m_bufferPool.usedRenderPics[i]->valid = false; -+ } -+} -+ -+void COutput::InitMixer() -+{ -+ for (unsigned int i = 0; i < m_bufferPool.outputSurfaces.size(); ++i) -+ { -+ m_mixer.m_dataPort.SendOutMessage(CMixerDataProtocol::BUFFER, -+ &m_bufferPool.outputSurfaces[i], -+ sizeof(VdpOutputSurface)); -+ } -+} -+ -+bool COutput::MakePixmap(VdpauBufferPool::Pixmaps &pixmap) -+{ -+ CLog::Log(LOGNOTICE,"Creating %ix%i pixmap", m_config.outWidth, m_config.outHeight); -+ -+ // Get our window attribs. -+ XWindowAttributes wndattribs; -+ XGetWindowAttributes(m_Display, g_Windowing.GetWindow(), &wndattribs); -+ -+ pixmap.pixmap = XCreatePixmap(m_Display, -+ g_Windowing.GetWindow(), -+ m_config.outWidth, -+ m_config.outHeight, -+ wndattribs.depth); -+ if (!pixmap.pixmap) -+ { -+ CLog::Log(LOGERROR, "VDPAU::COUtput::MakePixmap - GLX Error: MakePixmap: Unable to create XPixmap"); -+ return false; -+ } -+ -+// XGCValues values = {}; -+// GC xgc; -+// values.foreground = BlackPixel (m_Display, DefaultScreen (m_Display)); -+// xgc = XCreateGC(m_Display, pixmap.pixmap, GCForeground, &values); -+// XFillRectangle(m_Display, pixmap.pixmap, xgc, 0, 0, m_config.outWidth, m_config.outHeight); -+// XFreeGC(m_Display, xgc); -+ -+ if(!MakePixmapGL(pixmap)) -+ return false; -+ -+ return true; -+} -+ -+bool COutput::MakePixmapGL(VdpauBufferPool::Pixmaps &pixmap) -+{ -+ int num=0; -+ int fbConfigIndex = 0; -+ -+ int doubleVisAttributes[] = { -+ GLX_RENDER_TYPE, GLX_RGBA_BIT, -+ GLX_RED_SIZE, 8, -+ GLX_GREEN_SIZE, 8, -+ GLX_BLUE_SIZE, 8, -+ GLX_ALPHA_SIZE, 8, -+ GLX_DEPTH_SIZE, 8, -+ GLX_DRAWABLE_TYPE, GLX_PIXMAP_BIT, -+ GLX_BIND_TO_TEXTURE_RGBA_EXT, True, -+ GLX_DOUBLEBUFFER, False, -+ GLX_Y_INVERTED_EXT, True, -+ GLX_X_RENDERABLE, True, -+ None -+ }; -+ -+ int pixmapAttribs[] = { -+ GLX_TEXTURE_TARGET_EXT, GLX_TEXTURE_2D_EXT, -+ GLX_TEXTURE_FORMAT_EXT, GLX_TEXTURE_FORMAT_RGBA_EXT, -+ None -+ }; -+ -+ GLXFBConfig *fbConfigs; -+ fbConfigs = glXChooseFBConfig(m_Display, g_Windowing.GetCurrentScreen(), doubleVisAttributes, &num); -+ if (fbConfigs==NULL) -+ { -+ CLog::Log(LOGERROR, "VDPAU::COutput::MakPixmapGL - No compatible framebuffers found"); -+ return false; -+ } -+ fbConfigIndex = 0; -+ -+ pixmap.glPixmap = glXCreatePixmap(m_Display, fbConfigs[fbConfigIndex], pixmap.pixmap, pixmapAttribs); -+ -+ if (!pixmap.glPixmap) -+ { -+ CLog::Log(LOGERROR, "VDPAU::COutput::MakPixmapGL - Could not create Pixmap"); -+ XFree(fbConfigs); -+ return false; -+ } -+ XFree(fbConfigs); -+ return true; -+} -+ -+bool COutput::GLInit() -+{ -+ glXBindTexImageEXT = NULL; -+ glXReleaseTexImageEXT = NULL; -+#ifdef GL_NV_vdpau_interop -+ glVDPAUInitNV = NULL; -+ glVDPAUFiniNV = NULL; -+ glVDPAURegisterOutputSurfaceNV = NULL; -+ glVDPAURegisterVideoSurfaceNV = NULL; -+ glVDPAUIsSurfaceNV = NULL; -+ glVDPAUUnregisterSurfaceNV = NULL; -+ glVDPAUSurfaceAccessNV = NULL; -+ glVDPAUMapSurfacesNV = NULL; -+ glVDPAUUnmapSurfacesNV = NULL; -+ glVDPAUGetSurfaceivNV = NULL; -+#endif -+ -+ m_config.usePixmaps = !g_guiSettings.GetBool("videoplayer.usevdpauinterop"); -+ -+#ifdef GL_NV_vdpau_interop -+ if (glewIsSupported("GL_NV_vdpau_interop")) -+ { -+ if (!glVDPAUInitNV) -+ glVDPAUInitNV = (PFNGLVDPAUINITNVPROC)glXGetProcAddress((GLubyte *) "glVDPAUInitNV"); -+ if (!glVDPAUFiniNV) -+ glVDPAUFiniNV = (PFNGLVDPAUFININVPROC)glXGetProcAddress((GLubyte *) "glVDPAUFiniNV"); -+ if (!glVDPAURegisterOutputSurfaceNV) -+ glVDPAURegisterOutputSurfaceNV = (PFNGLVDPAUREGISTEROUTPUTSURFACENVPROC)glXGetProcAddress((GLubyte *) "glVDPAURegisterOutputSurfaceNV"); -+ if (!glVDPAURegisterVideoSurfaceNV) -+ glVDPAURegisterVideoSurfaceNV = (PFNGLVDPAUREGISTERVIDEOSURFACENVPROC)glXGetProcAddress((GLubyte *) "glVDPAURegisterVideoSurfaceNV"); -+ if (!glVDPAUIsSurfaceNV) -+ glVDPAUIsSurfaceNV = (PFNGLVDPAUISSURFACENVPROC)glXGetProcAddress((GLubyte *) "glVDPAUIsSurfaceNV"); -+ if (!glVDPAUUnregisterSurfaceNV) -+ glVDPAUUnregisterSurfaceNV = (PFNGLVDPAUUNREGISTERSURFACENVPROC)glXGetProcAddress((GLubyte *) "glVDPAUUnregisterSurfaceNV"); -+ if (!glVDPAUSurfaceAccessNV) -+ glVDPAUSurfaceAccessNV = (PFNGLVDPAUSURFACEACCESSNVPROC)glXGetProcAddress((GLubyte *) "glVDPAUSurfaceAccessNV"); -+ if (!glVDPAUMapSurfacesNV) -+ glVDPAUMapSurfacesNV = (PFNGLVDPAUMAPSURFACESNVPROC)glXGetProcAddress((GLubyte *) "glVDPAUMapSurfacesNV"); -+ if (!glVDPAUUnmapSurfacesNV) -+ glVDPAUUnmapSurfacesNV = (PFNGLVDPAUUNMAPSURFACESNVPROC)glXGetProcAddress((GLubyte *) "glVDPAUUnmapSurfacesNV"); -+ if (!glVDPAUGetSurfaceivNV) -+ glVDPAUGetSurfaceivNV = (PFNGLVDPAUGETSURFACEIVNVPROC)glXGetProcAddress((GLubyte *) "glVDPAUGetSurfaceivNV"); -+ -+ CLog::Log(LOGNOTICE, "VDPAU::COutput GL interop supported"); -+ } -+ else -+#endif -+ { -+ m_config.usePixmaps = true; -+ g_guiSettings.SetBool("videoplayer.usevdpauinterop",false); -+ g_guiSettings.SetBool("videoplayer.usevdpauinteropyuv",false); -+ } -+ if (!glXBindTexImageEXT) -+ glXBindTexImageEXT = (PFNGLXBINDTEXIMAGEEXTPROC)glXGetProcAddress((GLubyte *) "glXBindTexImageEXT"); -+ if (!glXReleaseTexImageEXT) -+ glXReleaseTexImageEXT = (PFNGLXRELEASETEXIMAGEEXTPROC)glXGetProcAddress((GLubyte *) "glXReleaseTexImageEXT"); -+ -+#ifdef GL_NV_vdpau_interop -+ if (!m_config.usePixmaps) -+ { -+ while (glGetError() != GL_NO_ERROR); -+ glVDPAUInitNV(reinterpret_cast(m_config.vdpDevice), reinterpret_cast(m_config.vdpProcs.vdp_get_proc_address)); -+ if (glGetError() != GL_NO_ERROR) -+ { -+ CLog::Log(LOGERROR, "VDPAU::COutput - GLInitInterop glVDPAUInitNV failed"); -+ m_vdpError = true; -+ return false; -+ } -+ CLog::Log(LOGNOTICE, "VDPAU::COutput: vdpau gl interop initialized"); -+ } -+#endif -+ return true; -+} -+ -+void COutput::GLMapSurfaces() -+{ -+#ifdef GL_NV_vdpau_interop -+ if (m_config.usePixmaps) -+ return; -+ -+ if (m_config.useInteropYuv) -+ { -+ VdpauBufferPool::GLVideoSurface glSurface; -+ if (m_config.videoSurfaces->size() != m_bufferPool.glVideoSurfaceMap.size()) -+ { -+ CSingleLock lock(*m_config.videoSurfaceSec); -+ for (int i = 0; i < m_config.videoSurfaces->size(); i++) -+ { -+ if ((*m_config.videoSurfaces)[i]->surface == VDP_INVALID_HANDLE) -+ continue; -+ -+ if (m_bufferPool.glVideoSurfaceMap.find((*m_config.videoSurfaces)[i]->surface) == m_bufferPool.glVideoSurfaceMap.end()) -+ { -+ glSurface.sourceVuv = (*m_config.videoSurfaces)[i]; -+ while (glGetError() != GL_NO_ERROR) ; -+ glGenTextures(4, glSurface.texture); -+ if (glGetError() != GL_NO_ERROR) -+ { -+ CLog::Log(LOGERROR, "VDPAU::COutput error creating texture"); -+ m_vdpError = true; -+ } -+ glSurface.glVdpauSurface = glVDPAURegisterVideoSurfaceNV(reinterpret_cast((*m_config.videoSurfaces)[i]->surface), -+ GL_TEXTURE_2D, 4, glSurface.texture); -+ -+ if (glGetError() != GL_NO_ERROR) -+ { -+ CLog::Log(LOGERROR, "VDPAU::COutput error register video surface"); -+ m_vdpError = true; -+ } -+ glVDPAUSurfaceAccessNV(glSurface.glVdpauSurface, GL_READ_ONLY); -+ if (glGetError() != GL_NO_ERROR) -+ { -+ CLog::Log(LOGERROR, "VDPAU::COutput error setting access"); -+ m_vdpError = true; -+ } -+ glVDPAUMapSurfacesNV(1, &glSurface.glVdpauSurface); -+ if (glGetError() != GL_NO_ERROR) -+ { -+ CLog::Log(LOGERROR, "VDPAU::COutput error mapping surface"); -+ m_vdpError = true; -+ } -+ m_bufferPool.glVideoSurfaceMap[(*m_config.videoSurfaces)[i]->surface] = glSurface; -+ if (m_vdpError) -+ return; -+ CLog::Log(LOGNOTICE, "VDPAU::COutput registered surface"); -+ } -+ } -+ } -+ } -+ else -+ { -+ if (m_bufferPool.glOutputSurfaceMap.size() != m_bufferPool.numOutputSurfaces) -+ { -+ VdpauBufferPool::GLVideoSurface glSurface; -+ for (int i=m_bufferPool.glOutputSurfaceMap.size(); i(m_bufferPool.outputSurfaces[i]), -+ GL_TEXTURE_2D, 1, glSurface.texture); -+ if (glGetError() != GL_NO_ERROR) -+ { -+ CLog::Log(LOGERROR, "VDPAU::COutput error register output surface"); -+ m_vdpError = true; -+ } -+ glVDPAUSurfaceAccessNV(glSurface.glVdpauSurface, GL_READ_ONLY); -+ if (glGetError() != GL_NO_ERROR) -+ { -+ CLog::Log(LOGERROR, "VDPAU::COutput error setting access"); -+ m_vdpError = true; -+ } -+ glVDPAUMapSurfacesNV(1, &glSurface.glVdpauSurface); -+ if (glGetError() != GL_NO_ERROR) -+ { -+ CLog::Log(LOGERROR, "VDPAU::COutput error mapping surface"); -+ m_vdpError = true; -+ } -+ m_bufferPool.glOutputSurfaceMap[m_bufferPool.outputSurfaces[i]] = glSurface; -+ if (m_vdpError) -+ return; -+ } -+ CLog::Log(LOGNOTICE, "VDPAU::COutput registered output surfaces"); -+ } -+ } -+#endif -+} -+ -+void COutput::GLUnmapSurfaces() -+{ -+#ifdef GL_NV_vdpau_interop -+ if (m_config.usePixmaps) -+ return; -+ -+ { CSingleLock lock(*m_config.videoSurfaceSec); -+ std::map::iterator it; -+ for (it = m_bufferPool.glVideoSurfaceMap.begin(); it != m_bufferPool.glVideoSurfaceMap.end(); ++it) -+ { -+ glVDPAUUnregisterSurfaceNV(it->second.glVdpauSurface); -+ glDeleteTextures(4, it->second.texture); -+ } -+ m_bufferPool.glVideoSurfaceMap.clear(); -+ } -+ -+ std::map::iterator it; -+ for (it = m_bufferPool.glOutputSurfaceMap.begin(); it != m_bufferPool.glOutputSurfaceMap.end(); ++it) -+ { -+ glVDPAUUnregisterSurfaceNV(it->second.glVdpauSurface); -+ glDeleteTextures(1, it->second.texture); -+ } -+ m_bufferPool.glOutputSurfaceMap.clear(); -+ -+ glVDPAUFiniNV(); -+ -+ CLog::Log(LOGNOTICE, "VDPAU::COutput: vdpau gl interop finished"); -+ -+#endif -+} -+ -+void COutput::GLBindPixmaps() -+{ -+ if (!m_config.usePixmaps) -+ return; -+ -+ for (unsigned int i = 0; i < m_bufferPool.pixmaps.size(); i++) -+ { -+ // create texture -+ glGenTextures(1, &m_bufferPool.pixmaps[i].texture); -+ -+ //bind texture -+ glBindTexture(GL_TEXTURE_2D, m_bufferPool.pixmaps[i].texture); -+ -+ // bind pixmap -+ glXBindTexImageEXT(m_Display, m_bufferPool.pixmaps[i].glPixmap, GLX_FRONT_LEFT_EXT, NULL); -+ -+ glBindTexture(GL_TEXTURE_2D, 0); -+ } -+ -+ CLog::Log(LOGNOTICE, "VDPAU::COutput: bound pixmaps"); -+} -+ -+void COutput::GLUnbindPixmaps() -+{ -+ if (!m_config.usePixmaps) -+ return; -+ -+ for (unsigned int i = 0; i < m_bufferPool.pixmaps.size(); i++) -+ { -+ // create texture -+ if (!glIsTexture(m_bufferPool.pixmaps[i].texture)) -+ continue; -+ -+ //bind texture -+ glBindTexture(GL_TEXTURE_2D, m_bufferPool.pixmaps[i].texture); -+ -+ // release pixmap -+ glXReleaseTexImageEXT(m_Display, m_bufferPool.pixmaps[i].glPixmap, GLX_FRONT_LEFT_EXT); -+ -+ glBindTexture(GL_TEXTURE_2D, 0); -+ -+ glDeleteTextures(1, &m_bufferPool.pixmaps[i].texture); -+ } -+ CLog::Log(LOGNOTICE, "VDPAU::COutput: unbound pixmaps"); -+} -+ -+bool COutput::CheckStatus(VdpStatus vdp_st, int line) -+{ -+ if (vdp_st != VDP_STATUS_OK) -+ { -+ CLog::Log(LOGERROR, " (VDPAU) Error: %s(%d) at %s:%d\n", m_config.vdpProcs.vdp_get_error_string(vdp_st), vdp_st, __FILE__, line); -+ m_vdpError = true; -+ return true; -+ } -+ return false; -+} -+ -+bool COutput::CreateGlxContext() -+{ -+ GLXContext glContext; -+ Window window; -+ -+ m_Display = g_Windowing.GetDisplay(); -+ glContext = g_Windowing.GetGlxContext(); -+ m_Window = g_Windowing.GetWindow(); -+ -+ // Get our window attribs. -+ XWindowAttributes wndattribs; -+ XGetWindowAttributes(m_Display, m_Window, &wndattribs); -+ -+ // Get visual Info -+ XVisualInfo visInfo; -+ visInfo.visualid = wndattribs.visual->visualid; -+ int nvisuals = 0; -+ XVisualInfo* visuals = XGetVisualInfo(m_Display, VisualIDMask, &visInfo, &nvisuals); -+ if (nvisuals != 1) -+ { -+ CLog::Log(LOGERROR, "VDPAU::COutput::CreateGlxContext - could not find visual"); -+ return false; -+ } -+ visInfo = visuals[0]; -+ XFree(visuals); -+ -+ m_pixmap = XCreatePixmap(m_Display, -+ m_Window, -+ 192, -+ 108, -+ visInfo.depth); -+ if (!m_pixmap) -+ { -+ CLog::Log(LOGERROR, "VDPAU::COutput::CreateGlxContext - Unable to create XPixmap"); -+ return false; -+ } -+ -+ // create gl pixmap -+ m_glPixmap = glXCreateGLXPixmap(m_Display, &visInfo, m_pixmap); -+ -+ if (!m_glPixmap) -+ { -+ CLog::Log(LOGINFO, "VDPAU::COutput::CreateGlxContext - Could not create glPixmap"); -+ return false; -+ } -+ -+ m_glContext = glXCreateContext(m_Display, &visInfo, glContext, True); -+ -+ if (!glXMakeCurrent(m_Display, m_glPixmap, m_glContext)) -+ { -+ CLog::Log(LOGINFO, "VDPAU::COutput::CreateGlxContext - Could not make Pixmap current"); -+ return false; -+ } -+ -+ CLog::Log(LOGNOTICE, "VDPAU::COutput::CreateGlxContext - created context"); -+ return true; -+} -+ -+bool COutput::DestroyGlxContext() -+{ -+ if (m_glContext) -+ { -+ glXMakeCurrent(m_Display, None, NULL); -+ glXDestroyContext(m_Display, m_glContext); -+ } -+ m_glContext = 0; -+ -+ if (m_glPixmap) -+ glXDestroyPixmap(m_Display, m_glPixmap); -+ m_glPixmap = 0; -+ -+ if (m_pixmap) -+ XFreePixmap(m_Display, m_pixmap); -+ m_pixmap = 0; -+ -+ return true; -+} -+ - #endif -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.h -index 2f53edf..4d1559c 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.h -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.h -@@ -1,5 +1,3 @@ -- --#pragma once - /* - * Copyright (C) 2005-2012 Team XBMC - * http://www.xbmc.org -@@ -20,9 +18,32 @@ - * - */ - -+/** -+ * design goals: -+ * - improve performance -+ * max out hw resources: e.g. make 1080p60 play on ION2 -+ * allow advanced de-interlacing on ION -+ * -+ * - add vdpau/opengl interop -+ * -+ * - remove tight dependency to render thread -+ * prior design needed to hijack render thread in order to do -+ * gl interop functions. In particular this was a problem for -+ * init and clear down. Introduction of GL_NV_vdpau_interop -+ * increased the need to be independent from render thread -+ * -+ * - move to an actor based design in order to reduce the number -+ * of locks needed. -+ */ -+ -+#pragma once -+ - #include "system_gl.h" - --#include -+#include "DllAvUtil.h" -+#include "DVDVideoCodec.h" -+#include "DVDVideoCodecFFmpeg.h" -+#include "libavcodec/vdpau.h" - #include - #include - #define GLX_GLXEXT_PROTOTYPES -@@ -37,118 +58,31 @@ - #include "settings/VideoSettings.h" - #include "guilib/DispResource.h" - #include "threads/Event.h" --namespace Surface { class CSurface; } -- --#define NUM_OUTPUT_SURFACES 4 --#define NUM_VIDEO_SURFACES_MPEG2 10 // (1 frame being decoded, 2 reference) --#define NUM_VIDEO_SURFACES_H264 32 // (1 frame being decoded, up to 16 references) --#define NUM_VIDEO_SURFACES_VC1 10 // (same as MPEG-2) --#define NUM_OUTPUT_SURFACES_FOR_FULLHD 2 --#define FULLHD_WIDTH 1920 -- --class CVDPAU -- : public CDVDVideoCodecFFmpeg::IHardwareDecoder -- , public IDispResource --{ --public: -- -- struct pictureAge -- { -- int b_age; -- int ip_age[2]; -- }; -- -- struct Desc -- { -- const char *name; -- uint32_t id; -- uint32_t aux; /* optional extra parameter... */ -- }; -- -- CVDPAU(); -- virtual ~CVDPAU(); -- -- virtual bool Open (AVCodecContext* avctx, const enum PixelFormat, unsigned int surfaces = 0); -- virtual int Decode (AVCodecContext* avctx, AVFrame* frame); -- virtual bool GetPicture(AVCodecContext* avctx, AVFrame* frame, DVDVideoPicture* picture); -- virtual void Reset(); -- virtual void Close(); -- -- virtual int Check(AVCodecContext* avctx); -- -- virtual const std::string Name() { return "vdpau"; } -- -- bool MakePixmap(int width, int height); -- bool MakePixmapGL(); -- -- void ReleasePixmap(); -- void BindPixmap(); -- -- PFNGLXBINDTEXIMAGEEXTPROC glXBindTexImageEXT; -- PFNGLXRELEASETEXIMAGEEXTPROC glXReleaseTexImageEXT; -- GLXPixmap m_glPixmap; -- Pixmap m_Pixmap; -- -- static void FFReleaseBuffer(AVCodecContext *avctx, AVFrame *pic); -- static void FFDrawSlice(struct AVCodecContext *s, -- const AVFrame *src, int offset[4], -- int y, int type, int height); -- static int FFGetBuffer(AVCodecContext *avctx, AVFrame *pic); -- -- void Present(); -- bool ConfigVDPAU(AVCodecContext *avctx, int ref_frames); -- void SpewHardwareAvailable(); -- void InitCSCMatrix(int Height); -- bool CheckStatus(VdpStatus vdp_st, int line); -- bool IsSurfaceValid(vdpau_render_state *render); -+#include "threads/Thread.h" -+#include "utils/ActorProtocol.h" - -- void CheckFeatures(); -- void SetColor(); -- void SetNoiseReduction(); -- void SetSharpness(); -- void SetDeinterlacing(); -- void SetHWUpscaling(); -+using namespace Actor; - -- pictureAge picAge; -- vdpau_render_state *past[2], *current, *future; -- int tmpDeintMode, tmpDeintGUI, tmpDeint; -- float tmpNoiseReduction, tmpSharpness; -- float tmpBrightness, tmpContrast; -- int OutWidth, OutHeight; -- bool upScale; -- std::queue m_DVDVideoPics; - -- static inline void ClearUsedForRender(vdpau_render_state **st) -- { -- if (*st) { -- (*st)->state &= ~FF_VDPAU_STATE_USED_FOR_RENDER; -- *st = NULL; -- } -- } -- -- VdpProcamp m_Procamp; -- VdpCSCMatrix m_CSCMatrix; -- VdpDevice HasDevice() { return vdp_device != VDP_INVALID_HANDLE; }; -- VdpChromaType vdp_chroma_type; -+#define FULLHD_WIDTH 1920 -+#define MAX_PIC_Q_LENGTH 20 //for non-interop_yuv this controls the max length of the decoded pic to render completion Q - -+namespace VDPAU -+{ - -- // protected: -- void InitVDPAUProcs(); -- void FiniVDPAUProcs(); -- void FiniVDPAUOutput(); -- bool ConfigOutputMethod(AVCodecContext *avctx, AVFrame *pFrame); -- bool FiniOutputMethod(); -+/** -+ * VDPAU interface to driver -+ */ - -- VdpDevice vdp_device; -- VdpGetProcAddress * vdp_get_proc_address; -- VdpPresentationQueueTarget vdp_flip_target; -- VdpPresentationQueue vdp_flip_queue; -- VdpDeviceDestroy * vdp_device_destroy; -+struct VDPAU_procs -+{ -+ VdpGetProcAddress * vdp_get_proc_address; -+ VdpDeviceDestroy * vdp_device_destroy; - -- VdpVideoSurfaceCreate * vdp_video_surface_create; -- VdpVideoSurfaceDestroy * vdp_video_surface_destroy; -- VdpVideoSurfacePutBitsYCbCr * vdp_video_surface_put_bits_y_cb_cr; -- VdpVideoSurfaceGetBitsYCbCr * vdp_video_surface_get_bits_y_cb_cr; -+ VdpVideoSurfaceCreate * vdp_video_surface_create; -+ VdpVideoSurfaceDestroy * vdp_video_surface_destroy; -+ VdpVideoSurfacePutBitsYCbCr * vdp_video_surface_put_bits_y_cb_cr; -+ VdpVideoSurfaceGetBitsYCbCr * vdp_video_surface_get_bits_y_cb_cr; - - VdpOutputSurfacePutBitsYCbCr * vdp_output_surface_put_bits_y_cb_cr; - VdpOutputSurfacePutBitsNative * vdp_output_surface_put_bits_native; -@@ -158,15 +92,15 @@ class CVDPAU - VdpOutputSurfaceRenderOutputSurface * vdp_output_surface_render_output_surface; - VdpOutputSurfacePutBitsIndexed * vdp_output_surface_put_bits_indexed; - -- VdpVideoMixerCreate * vdp_video_mixer_create; -- VdpVideoMixerSetFeatureEnables * vdp_video_mixer_set_feature_enables; -- VdpVideoMixerQueryParameterSupport * vdp_video_mixer_query_parameter_support; -- VdpVideoMixerQueryFeatureSupport * vdp_video_mixer_query_feature_support; -- VdpVideoMixerDestroy * vdp_video_mixer_destroy; -- VdpVideoMixerRender * vdp_video_mixer_render; -- VdpVideoMixerSetAttributeValues * vdp_video_mixer_set_attribute_values; -+ VdpVideoMixerCreate * vdp_video_mixer_create; -+ VdpVideoMixerSetFeatureEnables * vdp_video_mixer_set_feature_enables; -+ VdpVideoMixerQueryParameterSupport * vdp_video_mixer_query_parameter_support; -+ VdpVideoMixerQueryFeatureSupport * vdp_video_mixer_query_feature_support; -+ VdpVideoMixerDestroy * vdp_video_mixer_destroy; -+ VdpVideoMixerRender * vdp_video_mixer_render; -+ VdpVideoMixerSetAttributeValues * vdp_video_mixer_set_attribute_values; - -- VdpGenerateCSCMatrix * vdp_generate_csc_matrix; -+ VdpGenerateCSCMatrix * vdp_generate_csc_matrix; - - VdpPresentationQueueTargetDestroy * vdp_presentation_queue_target_destroy; - VdpPresentationQueueCreate * vdp_presentation_queue_create; -@@ -179,64 +113,459 @@ class CVDPAU - - VdpGetErrorString * vdp_get_error_string; - -- VdpDecoderCreate * vdp_decoder_create; -- VdpDecoderDestroy * vdp_decoder_destroy; -- VdpDecoderRender * vdp_decoder_render; -- VdpDecoderQueryCapabilities * vdp_decoder_query_caps; -+ VdpDecoderCreate * vdp_decoder_create; -+ VdpDecoderDestroy * vdp_decoder_destroy; -+ VdpDecoderRender * vdp_decoder_render; -+ VdpDecoderQueryCapabilities * vdp_decoder_query_caps; - - VdpPreemptionCallbackRegister * vdp_preemption_callback_register; - -- VdpOutputSurface outputSurfaces[NUM_OUTPUT_SURFACES]; -- VdpOutputSurface outputSurface; -- VdpOutputSurface presentSurface; -+}; - -- VdpDecoder decoder; -- VdpVideoMixer videoMixer; -- VdpRect outRect; -- VdpRect outRectVid; -+//----------------------------------------------------------------------------- -+// VDPAU data structs -+//----------------------------------------------------------------------------- - -- static void* dl_handle; -- VdpStatus (*dl_vdp_device_create_x11)(Display* display, int screen, VdpDevice* device, VdpGetProcAddress **get_proc_address); -- VdpStatus (*dl_vdp_get_proc_address)(VdpDevice device, VdpFuncId function_id, void** function_pointer); -- VdpStatus (*dl_vdp_preemption_callback_register)(VdpDevice device, VdpPreemptionCallback callback, void* context); -+class CDecoder; - -- int surfaceNum; -- int presentSurfaceNum; -- int totalAvailableOutputSurfaces; -- uint32_t vid_width, vid_height; -- int surface_width, surface_height; -- uint32_t max_references; -- Display* m_Display; -- bool vdpauConfigured; -- uint32_t *m_BlackBar; -+/** -+ * Buffer statistics used to control number of frames in queue -+ */ - -+class CVdpauBufferStats -+{ -+public: -+ uint16_t decodedPics; -+ uint16_t processedPics; -+ uint16_t renderPics; -+ uint64_t latency; // time decoder has waited for a frame, ideally there is no latency -+ int playSpeed; -+ bool canSkipDeint; -+ int processCmd; -+ -+ void IncDecoded() { CSingleLock l(m_sec); decodedPics++;} -+ void DecDecoded() { CSingleLock l(m_sec); decodedPics--;} -+ void IncProcessed() { CSingleLock l(m_sec); processedPics++;} -+ void DecProcessed() { CSingleLock l(m_sec); processedPics--;} -+ void IncRender() { CSingleLock l(m_sec); renderPics++;} -+ void DecRender() { CSingleLock l(m_sec); renderPics--;} -+ void Reset() { CSingleLock l(m_sec); decodedPics=0; processedPics=0;renderPics=0;latency=0;} -+ void Get(uint16_t &decoded, uint16_t &processed, uint16_t &render) {CSingleLock l(m_sec); decoded = decodedPics, processed=processedPics, render=renderPics;} -+ void SetParams(uint64_t time, int speed) { CSingleLock l(m_sec); latency = time; playSpeed = speed; } -+ void GetParams(uint64_t &lat, int &speed) { CSingleLock l(m_sec); lat = latency; speed = playSpeed; } -+ void SetCmd(int cmd) { CSingleLock l(m_sec); processCmd = cmd; } -+ void GetCmd(int &cmd) { CSingleLock l(m_sec); cmd = processCmd; processCmd = 0; } -+ void SetCanSkipDeint(bool canSkip) { CSingleLock l(m_sec); canSkipDeint = canSkip; } -+ bool CanSkipDeint() { CSingleLock l(m_sec); if (canSkipDeint) return true; else return false;} -+private: -+ CCriticalSection m_sec; -+}; -+ -+/** -+ * CVdpauConfig holds all configuration parameters needed by vdpau -+ * The structure is sent to the internal classes CMixer and COutput -+ * for init. -+ */ - -+struct CVdpauConfig -+{ -+ int surfaceWidth; -+ int surfaceHeight; -+ int vidWidth; -+ int vidHeight; -+ int outWidth; -+ int outHeight; -+ VDPAU_procs vdpProcs; -+ VdpDevice vdpDevice; -+ VdpDecoder vdpDecoder; -+ VdpChromaType vdpChromaType; -+ CVdpauBufferStats *stats; -+ CDecoder *vdpau; -+ int featureCount; -+ int upscale; -+ VdpVideoMixerFeature vdpFeatures[14]; -+ std::vector *videoSurfaces; -+ CCriticalSection *videoSurfaceSec; -+ bool usePixmaps; -+ int numRenderBuffers; -+ uint32_t maxReferences; -+ bool useInteropYuv; -+}; -+ -+/** -+ * Holds a decoded frame -+ * Input to COutput for further processing -+ */ -+struct CVdpauDecodedPicture -+{ -+ DVDVideoPicture DVDPic; -+ vdpau_render_state *render; -+}; -+ -+/** -+ * Frame after having been processed by vdpau mixer -+ */ -+struct CVdpauProcessedPicture -+{ -+ DVDVideoPicture DVDPic; -+ vdpau_render_state *render; -+ VdpOutputSurface outputSurface; -+}; -+ -+/** -+ * Ready to render textures -+ * Sent from COutput back to CDecoder -+ * Objects are referenced by DVDVideoPicture and are sent -+ * to renderer -+ */ -+class CVdpauRenderPicture -+{ -+ friend class CDecoder; -+ friend class COutput; -+public: -+ DVDVideoPicture DVDPic; -+ int texWidth, texHeight; -+ CRect crop; -+ GLuint texture[4]; -+ uint32_t sourceIdx; -+ bool valid; -+ CDecoder *vdpau; -+ CVdpauRenderPicture* Acquire(); -+ long Release(); -+private: -+ void ReturnUnused(); -+ int refCount; -+ CCriticalSection *renderPicSection; -+}; -+ -+//----------------------------------------------------------------------------- -+// Mixer -+//----------------------------------------------------------------------------- -+ -+class CMixerControlProtocol : public Protocol -+{ -+public: -+ CMixerControlProtocol(std::string name, CEvent* inEvent, CEvent *outEvent) : Protocol(name, inEvent, outEvent) {}; -+ enum OutSignal -+ { -+ INIT = 0, -+ FLUSH, -+ TIMEOUT, -+ }; -+ enum InSignal -+ { -+ ACC, -+ ERROR, -+ }; -+}; -+ -+class CMixerDataProtocol : public Protocol -+{ -+public: -+ CMixerDataProtocol(std::string name, CEvent* inEvent, CEvent *outEvent) : Protocol(name, inEvent, outEvent) {}; -+ enum OutSignal -+ { -+ FRAME, -+ BUFFER, -+ }; -+ enum InSignal -+ { -+ PICTURE, -+ }; -+}; -+ -+/** -+ * Embeds the vdpau video mixer -+ * Embedded by COutput class, gets decoded frames from COutput, processes -+ * them in mixer ands sends processed frames back to COutput -+ */ -+class CMixer : private CThread -+{ -+public: -+ CMixer(CEvent *inMsgEvent); -+ virtual ~CMixer(); -+ void Start(); -+ void Dispose(); -+ CMixerControlProtocol m_controlPort; -+ CMixerDataProtocol m_dataPort; -+protected: -+ void OnStartup(); -+ void OnExit(); -+ void Process(); -+ void StateMachine(int signal, Protocol *port, Message *msg); -+ void Init(); -+ void Uninit(); -+ void Flush(); -+ void CreateVdpauMixer(); -+ void ProcessPicture(); -+ void InitCycle(); -+ void FiniCycle(); -+ void CheckFeatures(); -+ void SetPostProcFeatures(bool postProcEnabled); -+ void PostProcOff(); -+ void InitCSCMatrix(int Width); -+ bool GenerateStudioCSCMatrix(VdpColorStandard colorStandard, VdpCSCMatrix &studioCSCMatrix); -+ void SetColor(); -+ void SetNoiseReduction(); -+ void SetSharpness(); -+ void SetDeintSkipChroma(); -+ void SetDeinterlacing(); -+ void SetHWUpscaling(); -+ void DisableHQScaling(); -+ EINTERLACEMETHOD GetDeinterlacingMethod(bool log = false); -+ bool CheckStatus(VdpStatus vdp_st, int line); -+ CEvent m_outMsgEvent; -+ CEvent *m_inMsgEvent; -+ int m_state; -+ bool m_bStateMachineSelfTrigger; -+ -+ // extended state variables for state machine -+ int m_extTimeout; -+ bool m_vdpError; -+ CVdpauConfig m_config; -+ VdpVideoMixer m_videoMixer; -+ VdpProcamp m_Procamp; -+ VdpCSCMatrix m_CSCMatrix; -+ bool m_PostProc; -+ float m_Brightness; -+ float m_Contrast; -+ float m_NoiseReduction; -+ float m_Sharpness; -+ int m_DeintMode; -+ int m_Deint; -+ int m_Upscale; -+ uint32_t *m_BlackBar; - VdpVideoMixerPictureStructure m_mixerfield; -- int m_mixerstep; -+ int m_mixerstep; -+ int m_mixersteps; -+ CVdpauProcessedPicture m_processPicture; -+ std::queue m_outputSurfaces; -+ std::queue m_decodedPics; -+ std::deque m_mixerInput; -+}; -+ -+//----------------------------------------------------------------------------- -+// Output -+//----------------------------------------------------------------------------- -+ -+/** -+ * Buffer pool holds allocated vdpau and gl resources -+ * Embedded in COutput -+ */ -+struct VdpauBufferPool -+{ -+ struct Pixmaps -+ { -+ unsigned short id; -+ bool used; -+ DVDVideoPicture DVDPic; -+ GLuint texture; -+ Pixmap pixmap; -+ GLXPixmap glPixmap; -+ VdpPresentationQueueTarget vdp_flip_target; -+ VdpPresentationQueue vdp_flip_queue; -+ VdpOutputSurface surface; -+ }; -+ struct GLVideoSurface -+ { -+ GLuint texture[4]; -+#ifdef GL_NV_vdpau_interop -+ GLvdpauSurfaceNV glVdpauSurface; -+#endif -+ vdpau_render_state *sourceVuv; -+ VdpOutputSurface sourceRgb; -+ }; -+ unsigned short numOutputSurfaces; -+ std::vector pixmaps; -+ std::vector outputSurfaces; -+ std::deque notVisiblePixmaps; -+ std::vector allRenderPics; -+ std::map glVideoSurfaceMap; -+ std::map glOutputSurfaceMap; -+ std::queue processedPics; -+ std::deque usedRenderPics; -+ std::deque freeRenderPics; -+ CCriticalSection renderPicSec; -+}; -+ -+class COutputControlProtocol : public Protocol -+{ -+public: -+ COutputControlProtocol(std::string name, CEvent* inEvent, CEvent *outEvent) : Protocol(name, inEvent, outEvent) {}; -+ enum OutSignal -+ { -+ INIT, -+ FLUSH, -+ PRECLEANUP, -+ TIMEOUT, -+ }; -+ enum InSignal -+ { -+ ACC, -+ ERROR, -+ STATS, -+ }; -+}; -+ -+class COutputDataProtocol : public Protocol -+{ -+public: -+ COutputDataProtocol(std::string name, CEvent* inEvent, CEvent *outEvent) : Protocol(name, inEvent, outEvent) {}; -+ enum OutSignal -+ { -+ NEWFRAME = 0, -+ RETURNPIC, -+ }; -+ enum InSignal -+ { -+ PICTURE, -+ }; -+}; -+ -+/** -+ * COutput is embedded in CDecoder and embeds CMixer -+ * The class has its own OpenGl context which is shared with render thread -+ * COuput generated ready to render textures and passes them back to -+ * CDecoder -+ */ -+class COutput : private CThread -+{ -+public: -+ COutput(CEvent *inMsgEvent); -+ virtual ~COutput(); -+ void Start(); -+ void Dispose(); -+ COutputControlProtocol m_controlPort; -+ COutputDataProtocol m_dataPort; -+protected: -+ void OnStartup(); -+ void OnExit(); -+ void Process(); -+ void StateMachine(int signal, Protocol *port, Message *msg); -+ bool HasWork(); -+ CVdpauRenderPicture *ProcessMixerPicture(); -+ void ProcessReturnPicture(CVdpauRenderPicture *pic); -+ int FindFreePixmap(); -+ bool Init(); -+ bool Uninit(); -+ void Flush(); -+ bool CreateGlxContext(); -+ bool DestroyGlxContext(); -+ bool EnsureBufferPool(); -+ void ReleaseBufferPool(); -+ void InitMixer(); -+ bool GLInit(); -+ void GLMapSurfaces(); -+ void GLUnmapSurfaces(); -+ void GLBindPixmaps(); -+ void GLUnbindPixmaps(); -+ bool MakePixmap(VdpauBufferPool::Pixmaps &pixmap); -+ bool MakePixmapGL(VdpauBufferPool::Pixmaps &pixmap); -+ bool CheckStatus(VdpStatus vdp_st, int line); -+ CEvent m_outMsgEvent; -+ CEvent *m_inMsgEvent; -+ int m_state; -+ bool m_bStateMachineSelfTrigger; -+ -+ // extended state variables for state machine -+ int m_extTimeout; -+ bool m_vdpError; -+ CVdpauConfig m_config; -+ VdpauBufferPool m_bufferPool; -+ CMixer m_mixer; -+ Display *m_Display; -+ Window m_Window; -+ GLXContext m_glContext; -+ GLXWindow m_glWindow; -+ Pixmap m_pixmap; -+ GLXPixmap m_glPixmap; -+ -+ // gl functions -+ PFNGLXBINDTEXIMAGEEXTPROC glXBindTexImageEXT; -+ PFNGLXRELEASETEXIMAGEEXTPROC glXReleaseTexImageEXT; -+#ifdef GL_NV_vdpau_interop -+ PFNGLVDPAUINITNVPROC glVDPAUInitNV; -+ PFNGLVDPAUFININVPROC glVDPAUFiniNV; -+ PFNGLVDPAUREGISTEROUTPUTSURFACENVPROC glVDPAURegisterOutputSurfaceNV; -+ PFNGLVDPAUREGISTERVIDEOSURFACENVPROC glVDPAURegisterVideoSurfaceNV; -+ PFNGLVDPAUISSURFACENVPROC glVDPAUIsSurfaceNV; -+ PFNGLVDPAUUNREGISTERSURFACENVPROC glVDPAUUnregisterSurfaceNV; -+ PFNGLVDPAUSURFACEACCESSNVPROC glVDPAUSurfaceAccessNV; -+ PFNGLVDPAUMAPSURFACESNVPROC glVDPAUMapSurfacesNV; -+ PFNGLVDPAUUNMAPSURFACESNVPROC glVDPAUUnmapSurfacesNV; -+ PFNGLVDPAUGETSURFACEIVNVPROC glVDPAUGetSurfaceivNV; -+#endif -+}; -+ -+//----------------------------------------------------------------------------- -+// VDPAU decoder -+//----------------------------------------------------------------------------- -+ -+/** -+ * VDPAU main class -+ */ -+class CDecoder -+ : public CDVDVideoCodecFFmpeg::IHardwareDecoder -+ , public IDispResource -+{ -+ friend class CVdpauRenderPicture; -+ -+public: -+ -+ struct Desc -+ { -+ const char *name; -+ uint32_t id; -+ uint32_t aux; /* optional extra parameter... */ -+ }; -+ -+ CDecoder(); -+ virtual ~CDecoder(); -+ -+ virtual bool Open (AVCodecContext* avctx, const enum PixelFormat, unsigned int surfaces = 0); -+ virtual int Decode (AVCodecContext* avctx, AVFrame* frame); -+ virtual bool GetPicture(AVCodecContext* avctx, AVFrame* frame, DVDVideoPicture* picture); -+ virtual void Reset(); -+ virtual void Close(); -+ virtual long Release(); -+ virtual bool CanSkipDeint(); -+ -+ virtual int Check(AVCodecContext* avctx); -+ virtual const std::string Name() { return "vdpau"; } - - bool Supports(VdpVideoMixerFeature feature); - bool Supports(EINTERLACEMETHOD method); - EINTERLACEMETHOD AutoInterlaceMethod(); -+ static bool IsVDPAUFormat(PixelFormat fmt); - -- VdpVideoMixerFeature m_features[14]; -- int m_feature_count; -+ static void FFReleaseBuffer(AVCodecContext *avctx, AVFrame *pic); -+ static void FFDrawSlice(struct AVCodecContext *s, -+ const AVFrame *src, int offset[4], -+ int y, int type, int height); -+ static int FFGetBuffer(AVCodecContext *avctx, AVFrame *pic); -+ -+ virtual void OnLostDevice(); -+ virtual void OnResetDevice(); -+ -+protected: -+ void SetWidthHeight(int width, int height); -+ bool ConfigVDPAU(AVCodecContext *avctx, int ref_frames); -+ void SpewHardwareAvailable(); -+ bool CheckStatus(VdpStatus vdp_st, int line); -+ bool IsSurfaceValid(vdpau_render_state *render); -+ void InitVDPAUProcs(); -+ void FiniVDPAUProcs(); -+ void FiniVDPAUOutput(); -+ void ReturnRenderPicture(CVdpauRenderPicture *renderPic); -+ long ReleasePicReference(); - -- static bool IsVDPAUFormat(PixelFormat fmt); - static void ReadFormatOf( PixelFormat fmt - , VdpDecoderProfile &decoder_profile - , VdpChromaType &chroma_type); - -- std::vector m_videoSurfaces; -- DllAvUtil m_dllAvUtil; -- -- enum VDPAUOutputMethod -- { -- OUTPUT_NONE, -- OUTPUT_PIXMAP, -- OUTPUT_GL_INTEROP_RGB, -- OUTPUT_GL_INTEROP_YUV -- }; -- VDPAUOutputMethod m_vdpauOutputMethod; -+ VdpStatus (*dl_vdp_device_create_x11)(Display* display, int screen, VdpDevice* device, VdpGetProcAddress **get_proc_address); -+ VdpStatus (*dl_vdp_get_proc_address)(VdpDevice device, VdpFuncId function_id, void** function_pointer); -+ VdpStatus (*dl_vdp_preemption_callback_register)(VdpDevice device, VdpPreemptionCallback callback, void* context); - - // OnLostDevice triggers transition from all states to LOST - // internal errors trigger transition from OPEN to RESET -@@ -247,9 +576,24 @@ class CVDPAU - , VDPAU_LOST - , VDPAU_ERROR - } m_DisplayState; -- CSharedSection m_DecoderSection; -- CSharedSection m_DisplaySection; -+ CCriticalSection m_DecoderSection; - CEvent m_DisplayEvent; -- virtual void OnLostDevice(); -- virtual void OnResetDevice(); -+ -+ static void* dl_handle; -+ DllAvUtil m_dllAvUtil; -+ Display* m_Display; -+ ThreadIdentifier m_decoderThread; -+ bool m_vdpauConfigured; -+ CVdpauConfig m_vdpauConfig; -+ std::vector m_videoSurfaces; -+ CCriticalSection m_videoSurfaceSec; -+ -+ COutput m_vdpauOutput; -+ CVdpauBufferStats m_bufferStats; -+ CEvent m_inMsgEvent; -+ CVdpauRenderPicture *m_presentPicture; -+ -+ int m_codecControl; - }; -+ -+} -diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -index d004153..92f62bb 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -+++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -@@ -1146,6 +1146,10 @@ int CDVDPlayerVideo::OutputPicture(const DVDVideoPicture* src, double pts) - formatstr = "VDPAU"; - buffering = true; - break; -+ case RENDER_FMT_VDPAU_420: -+ formatstr = "VDPAU_420"; -+ buffering = true; -+ break; - case RENDER_FMT_DXVA: - formatstr = "DXVA"; - buffering = true; -diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index 16800b7..844f8e8 100644 ---- a/xbmc/settings/AdvancedSettings.cpp -+++ b/xbmc/settings/AdvancedSettings.cpp -@@ -98,7 +98,7 @@ void CAdvancedSettings::Initialize() - m_videoIgnoreSecondsAtStart = 3*60; - m_videoIgnorePercentAtEnd = 8.0f; - m_videoPlayCountMinimumPercent = 90.0f; -- m_videoVDPAUScaling = false; -+ m_videoVDPAUScaling = -1; - m_videoNonLinStretchRatio = 0.5f; - m_videoEnableHighQualityHwScalers = false; - m_videoAutoScaleMaxFps = 30.0f; -@@ -106,6 +106,8 @@ void CAdvancedSettings::Initialize() - m_videoAllowMpeg4VAAPI = false; - m_videoDisableBackgroundDeinterlace = false; - m_videoCaptureUseOcclusionQuery = -1; //-1 is auto detect -+ m_videoVDPAUtelecine = false; -+ m_videoVDPAUdeintSkipChromaHD = false; - m_DXVACheckCompatibility = false; - m_DXVACheckCompatibilityPresent = false; - m_DXVAForceProcessorRenderer = true; -@@ -493,7 +495,7 @@ void CAdvancedSettings::ParseSettingsFile(const CStdString &file) - XMLUtils::GetString(pElement,"cleandatetime", m_videoCleanDateTimeRegExp); - XMLUtils::GetString(pElement,"ppffmpegdeinterlacing",m_videoPPFFmpegDeint); - XMLUtils::GetString(pElement,"ppffmpegpostprocessing",m_videoPPFFmpegPostProc); -- XMLUtils::GetBoolean(pElement,"vdpauscaling",m_videoVDPAUScaling); -+ XMLUtils::GetInt(pElement,"vdpauscaling",m_videoVDPAUScaling); - XMLUtils::GetFloat(pElement, "nonlinearstretchratio", m_videoNonLinStretchRatio, 0.01f, 1.0f); - XMLUtils::GetBoolean(pElement,"enablehighqualityhwscalers", m_videoEnableHighQualityHwScalers); - XMLUtils::GetFloat(pElement,"autoscalemaxfps",m_videoAutoScaleMaxFps, 0.0f, 1000.0f); -@@ -501,6 +503,8 @@ void CAdvancedSettings::ParseSettingsFile(const CStdString &file) - XMLUtils::GetBoolean(pElement,"allowmpeg4vaapi",m_videoAllowMpeg4VAAPI); - XMLUtils::GetBoolean(pElement, "disablebackgrounddeinterlace", m_videoDisableBackgroundDeinterlace); - XMLUtils::GetInt(pElement, "useocclusionquery", m_videoCaptureUseOcclusionQuery, -1, 1); -+ XMLUtils::GetBoolean(pElement,"vdpauInvTelecine",m_videoVDPAUtelecine); -+ XMLUtils::GetBoolean(pElement,"vdpauHDdeintSkipChroma",m_videoVDPAUdeintSkipChromaHD); - - TiXmlElement* pAdjustRefreshrate = pElement->FirstChildElement("adjustrefreshrate"); - if (pAdjustRefreshrate) -diff --git a/xbmc/settings/AdvancedSettings.h b/xbmc/settings/AdvancedSettings.h -index 27887d4..72718e5 100644 ---- a/xbmc/settings/AdvancedSettings.h -+++ b/xbmc/settings/AdvancedSettings.h -@@ -133,6 +133,8 @@ class CAdvancedSettings - int m_videoPercentSeekBackwardBig; - CStdString m_videoPPFFmpegDeint; - CStdString m_videoPPFFmpegPostProc; -+ bool m_videoVDPAUtelecine; -+ bool m_videoVDPAUdeintSkipChromaHD; - bool m_musicUseTimeSeeking; - int m_musicTimeSeekForward; - int m_musicTimeSeekBackward; -@@ -148,7 +150,7 @@ class CAdvancedSettings - CStdString m_audioHost; - bool m_audioApplyDrc; - -- bool m_videoVDPAUScaling; -+ int m_videoVDPAUScaling; - float m_videoNonLinStretchRatio; - bool m_videoEnableHighQualityHwScalers; - float m_videoAutoScaleMaxFps; -diff --git a/xbmc/settings/GUISettings.cpp b/xbmc/settings/GUISettings.cpp -index 76ec0cc..4cdb093 100644 ---- a/xbmc/settings/GUISettings.cpp -+++ b/xbmc/settings/GUISettings.cpp -@@ -685,6 +685,8 @@ void CGUISettings::Initialize() - - #ifdef HAVE_LIBVDPAU - AddBool(vp, "videoplayer.usevdpau", 13425, true); -+ AddBool(vp, "videoplayer.usevdpauinterop", 13435, true); -+ AddBool(vp, "videoplayer.usevdpauinteropyuv", 13436, false); - #endif - #ifdef HAVE_LIBVA - AddBool(vp, "videoplayer.usevaapi", 13426, true); -diff --git a/xbmc/settings/GUIWindowSettingsCategory.cpp b/xbmc/settings/GUIWindowSettingsCategory.cpp -index 4ac2663..d988598 100644 ---- a/xbmc/settings/GUIWindowSettingsCategory.cpp -+++ b/xbmc/settings/GUIWindowSettingsCategory.cpp -@@ -596,6 +596,40 @@ void CGUIWindowSettingsCategory::UpdateSettings() - pControl->SetEnabled(true); - } - } -+ else if (strSetting.Equals("videoplayer.usevdpauinteropyuv")) -+ { -+ bool hasInterop = g_guiSettings.GetBool("videoplayer.usevdpauinterop"); -+#ifndef GL_NV_vdpau_interop -+ hasInterop = false; -+#endif -+ CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID()); -+ if (pControl && hasInterop && glewIsSupported("GL_NV_vdpau_interop")) -+ { -+ pControl->SetEnabled(true); -+ } -+ else -+ { -+ pControl->SetEnabled(false); -+ g_guiSettings.SetBool("videoplayer.usevdpauinteropyuv",false); -+ } -+ } -+ else if (strSetting.Equals("videoplayer.usevdpauinterop")) -+ { -+ bool hasInterop = g_guiSettings.GetBool("videoplayer.usevdpau"); -+#ifndef GL_NV_vdpau_interop -+ hasInterop = false; -+#endif -+ CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID()); -+ if (pControl && hasInterop && glewIsSupported("GL_NV_vdpau_interop")) -+ { -+ pControl->SetEnabled(true); -+ } -+ else -+ { -+ pControl->SetEnabled(false); -+ g_guiSettings.SetBool("videoplayer.usevdpauinterop",false); -+ } -+ } - else - #endif - if (strSetting.Equals("videoscreen.resolution")) -diff --git a/xbmc/utils/ActorProtocol.cpp b/xbmc/utils/ActorProtocol.cpp -new file mode 100644 -index 0000000..e0cfd0e ---- /dev/null -+++ b/xbmc/utils/ActorProtocol.cpp -@@ -0,0 +1,253 @@ -+/* -+ * Copyright (C) 2005-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 -+ * . -+ * -+ */ -+ -+#include "ActorProtocol.h" -+ -+using namespace Actor; -+ -+void Message::Release() -+{ -+ bool skip; -+ origin->Lock(); -+ skip = isSync ? !isSyncFini : false; -+ isSyncFini = true; -+ origin->Unlock(); -+ -+ if (skip) -+ return; -+ -+ // free data buffer -+ if (data != buffer) -+ delete [] data; -+ -+ // delete event in case of sync message -+ if (event) -+ delete event; -+ -+ origin->ReturnMessage(this); -+} -+ -+bool Message::Reply(int sig, void *data /* = NULL*/, int size /* = 0 */) -+{ -+ if (!isSync) -+ { -+ if (isOut) -+ return origin->SendInMessage(sig, data, size); -+ else -+ return origin->SendOutMessage(sig, data, size); -+ } -+ -+ origin->Lock(); -+ -+ if (!isSyncTimeout) -+ { -+ Message *msg = origin->GetMessage(); -+ msg->signal = sig; -+ msg->isOut = !isOut; -+ replyMessage = msg; -+ if (data) -+ { -+ if (size > MSG_INTERNAL_BUFFER_SIZE) -+ msg->data = new uint8_t[size]; -+ else -+ msg->data = msg->buffer; -+ memcpy(msg->data, data, size); -+ } -+ } -+ -+ origin->Unlock(); -+ -+ if (event) -+ event->Set(); -+ -+ return true; -+} -+ -+Protocol::~Protocol() -+{ -+ Message *msg; -+ Purge(); -+ while (!freeMessageQueue.empty()) -+ { -+ msg = freeMessageQueue.front(); -+ freeMessageQueue.pop(); -+ delete msg; -+ } -+} -+ -+Message *Protocol::GetMessage() -+{ -+ Message *msg; -+ -+ CSingleLock lock(criticalSection); -+ -+ if (!freeMessageQueue.empty()) -+ { -+ msg = freeMessageQueue.front(); -+ freeMessageQueue.pop(); -+ } -+ else -+ msg = new Message(); -+ -+ msg->isSync = false; -+ msg->isSyncFini = false; -+ msg->isSyncTimeout = false; -+ msg->event = NULL; -+ msg->data = NULL; -+ msg->payloadSize = 0; -+ msg->replyMessage = NULL; -+ msg->origin = this; -+ -+ return msg; -+} -+ -+void Protocol::ReturnMessage(Message *msg) -+{ -+ CSingleLock lock(criticalSection); -+ -+ freeMessageQueue.push(msg); -+} -+ -+bool Protocol::SendOutMessage(int signal, void *data /* = NULL */, int size /* = 0 */, Message *outMsg /* = NULL */) -+{ -+ Message *msg; -+ if (outMsg) -+ msg = outMsg; -+ else -+ msg = GetMessage(); -+ -+ msg->signal = signal; -+ msg->isOut = true; -+ -+ if (data) -+ { -+ if (size > MSG_INTERNAL_BUFFER_SIZE) -+ msg->data = new uint8_t[size]; -+ else -+ msg->data = msg->buffer; -+ memcpy(msg->data, data, size); -+ } -+ -+ { CSingleLock lock(criticalSection); -+ outMessages.push(msg); -+ } -+ containerOutEvent->Set(); -+ -+ return true; -+} -+ -+bool Protocol::SendInMessage(int signal, void *data /* = NULL */, int size /* = 0 */, Message *outMsg /* = NULL */) -+{ -+ Message *msg; -+ if (outMsg) -+ msg = outMsg; -+ else -+ msg = GetMessage(); -+ -+ msg->signal = signal; -+ msg->isOut = false; -+ -+ if (data) -+ { -+ if (size > MSG_INTERNAL_BUFFER_SIZE) -+ msg->data = new uint8_t[size]; -+ else -+ msg->data = msg->buffer; -+ memcpy(msg->data, data, size); -+ } -+ -+ { CSingleLock lock(criticalSection); -+ inMessages.push(msg); -+ } -+ containerInEvent->Set(); -+ -+ return true; -+} -+ -+ -+bool Protocol::SendOutMessageSync(int signal, Message **retMsg, int timeout, void *data /* = NULL */, int size /* = 0 */) -+{ -+ Message *msg = GetMessage(); -+ msg->isOut = true; -+ msg->isSync = true; -+ msg->event = new CEvent; -+ msg->event->Reset(); -+ SendOutMessage(signal, data, size, msg); -+ -+ if (!msg->event->WaitMSec(timeout)) -+ { -+ msg->origin->Lock(); -+ if (msg->replyMessage) -+ *retMsg = msg->replyMessage; -+ else -+ { -+ *retMsg = NULL; -+ msg->isSyncTimeout = true; -+ } -+ msg->origin->Unlock(); -+ } -+ else -+ *retMsg = msg->replyMessage; -+ -+ msg->Release(); -+ -+ if (*retMsg) -+ return true; -+ else -+ return false; -+} -+ -+bool Protocol::ReceiveOutMessage(Message **msg) -+{ -+ CSingleLock lock(criticalSection); -+ -+ if (outMessages.empty() || outDefered) -+ return false; -+ -+ *msg = outMessages.front(); -+ outMessages.pop(); -+ -+ return true; -+} -+ -+bool Protocol::ReceiveInMessage(Message **msg) -+{ -+ CSingleLock lock(criticalSection); -+ -+ if (inMessages.empty() || inDefered) -+ return false; -+ -+ *msg = inMessages.front(); -+ inMessages.pop(); -+ -+ return true; -+} -+ -+ -+void Protocol::Purge() -+{ -+ Message *msg; -+ -+ while (ReceiveInMessage(&msg)) -+ msg->Release(); -+ -+ while (ReceiveOutMessage(&msg)) -+ msg->Release(); -+} -diff --git a/xbmc/utils/ActorProtocol.h b/xbmc/utils/ActorProtocol.h -new file mode 100644 -index 0000000..e7108ac ---- /dev/null -+++ b/xbmc/utils/ActorProtocol.h -@@ -0,0 +1,87 @@ -+/* -+ * Copyright (C) 2005-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 -+ * . -+ * -+ */ -+ -+#pragma once -+ -+#include "threads/Thread.h" -+#include "utils/log.h" -+#include -+#include "memory.h" -+ -+#define MSG_INTERNAL_BUFFER_SIZE 32 -+ -+namespace Actor -+{ -+ -+class Protocol; -+ -+class Message -+{ -+ friend class Protocol; -+public: -+ int signal; -+ bool isSync; -+ bool isSyncFini; -+ bool isOut; -+ bool isSyncTimeout; -+ int payloadSize; -+ uint8_t buffer[MSG_INTERNAL_BUFFER_SIZE]; -+ uint8_t *data; -+ Message *replyMessage; -+ Protocol *origin; -+ CEvent *event; -+ -+ void Release(); -+ bool Reply(int sig, void *data = NULL, int size = 0); -+ -+private: -+ Message() {isSync = false; data = NULL; event = NULL; replyMessage = NULL;}; -+}; -+ -+class Protocol -+{ -+public: -+ Protocol(std::string name, CEvent* inEvent, CEvent *outEvent) -+ : portName(name), inDefered(false), outDefered(false) {containerInEvent = inEvent; containerOutEvent = outEvent;}; -+ virtual ~Protocol(); -+ Message *GetMessage(); -+ void ReturnMessage(Message *msg); -+ bool SendOutMessage(int signal, void *data = NULL, int size = 0, Message *outMsg = NULL); -+ bool SendInMessage(int signal, void *data = NULL, int size = 0, Message *outMsg = NULL); -+ bool SendOutMessageSync(int signal, Message **retMsg, int timeout, void *data = NULL, int size = 0); -+ bool ReceiveOutMessage(Message **msg); -+ bool ReceiveInMessage(Message **msg); -+ void Purge(); -+ void DeferIn(bool value) {inDefered = value;}; -+ void DeferOut(bool value) {outDefered = value;}; -+ void Lock() {criticalSection.lock();}; -+ void Unlock() {criticalSection.unlock();}; -+ std::string portName; -+ -+protected: -+ CEvent *containerInEvent, *containerOutEvent; -+ CCriticalSection criticalSection; -+ std::queue outMessages; -+ std::queue inMessages; -+ std::queue freeMessageQueue; -+ bool inDefered, outDefered; -+}; -+ -+} -diff --git a/xbmc/utils/Makefile b/xbmc/utils/Makefile -index d201884..7d1f9f0 100644 ---- a/xbmc/utils/Makefile -+++ b/xbmc/utils/Makefile -@@ -70,6 +70,7 @@ SRCS=AlarmClock.cpp \ - Weather.cpp \ - XBMCTinyXML.cpp \ - XMLUtils.cpp \ -+ ActorProtocol.cpp \ - - LIB=utils.a - -diff --git a/xbmc/video/dialogs/GUIDialogVideoSettings.cpp b/xbmc/video/dialogs/GUIDialogVideoSettings.cpp -index ac5f007..f25d10d 100644 ---- a/xbmc/video/dialogs/GUIDialogVideoSettings.cpp -+++ b/xbmc/video/dialogs/GUIDialogVideoSettings.cpp -@@ -103,7 +103,7 @@ void CGUIDialogVideoSettings::CreateSettings() - entries.push_back(make_pair(VS_INTERLACEMETHOD_INVERSE_TELECINE , 16314)); - entries.push_back(make_pair(VS_INTERLACEMETHOD_VDPAU_TEMPORAL_SPATIAL , 16311)); - entries.push_back(make_pair(VS_INTERLACEMETHOD_VDPAU_TEMPORAL , 16310)); -- entries.push_back(make_pair(VS_INTERLACEMETHOD_VDPAU_BOB , 16021)); -+ entries.push_back(make_pair(VS_INTERLACEMETHOD_VDPAU_BOB , 16325)); - entries.push_back(make_pair(VS_INTERLACEMETHOD_VDPAU_TEMPORAL_SPATIAL_HALF, 16318)); - entries.push_back(make_pair(VS_INTERLACEMETHOD_VDPAU_TEMPORAL_HALF , 16317)); - entries.push_back(make_pair(VS_INTERLACEMETHOD_VDPAU_INVERSE_TELECINE , 16314)); -diff --git a/xbmc/windowing/X11/WinSystemX11.h b/xbmc/windowing/X11/WinSystemX11.h -index e7af3cb..2dd8a9f 100644 ---- a/xbmc/windowing/X11/WinSystemX11.h -+++ b/xbmc/windowing/X11/WinSystemX11.h -@@ -63,6 +63,7 @@ class CWinSystemX11 : public CWinSystemBase - // Local to WinSystemX11 only - Display* GetDisplay() { return m_dpy; } - GLXWindow GetWindow() { return m_glWindow; } -+ GLXContext GetGlxContext() { return m_glContext; } - - protected: - bool RefreshGlxContext(); --- -1.8.1.6 - - -From 5467f4b81a86ce4cd77039b6cfe151df0facafd7 Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Wed, 12 Dec 2012 09:52:17 +0100 -Subject: [PATCH 28/94] vdpau: make interop gl default and remove setting, - rename and intvert interop yuv - ---- - language/English/strings.po | 2 +- - xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp | 17 ++++++++++------- - xbmc/settings/GUISettings.cpp | 3 +-- - xbmc/settings/GUIWindowSettingsCategory.cpp | 23 +++-------------------- - 4 files changed, 15 insertions(+), 30 deletions(-) - -diff --git a/language/English/strings.po b/language/English/strings.po -index f18f109..7c534a6 100644 ---- a/language/English/strings.po -+++ b/language/English/strings.po -@@ -5118,7 +5118,7 @@ msgid "Allow Vdpau OpenGL interop" - msgstr "" - - msgctxt "#13436" --msgid "Allow Vdpau OpenGL interop YUV" -+msgid "Prefer VDPAU Video Mixer" - msgstr "" - - #empty strings from id 13437 to 13499 -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp -index 07cfc04..0381c44 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp -@@ -365,12 +365,15 @@ bool CDecoder::Supports(EINTERLACEMETHOD method) - || method == VS_INTERLACEMETHOD_AUTO) - return true; - -- if (g_guiSettings.GetBool("videoplayer.usevdpauinteropyuv")) -+ if (!m_vdpauConfig.usePixmaps) - { - if (method == VS_INTERLACEMETHOD_RENDER_BOB) - return true; - } - -+ if (method == VS_INTERLACEMETHOD_VDPAU_INVERSE_TELECINE) -+ return false; -+ - for(SInterlaceMapping* p = g_interlace_mapping; p->method != VS_INTERLACEMETHOD_NONE; p++) - { - if(p->method == method) -@@ -1847,7 +1850,7 @@ void CMixer::SetDeinterlacing() - - SetDeintSkipChroma(); - -- m_config.useInteropYuv = g_guiSettings.GetBool("videoplayer.usevdpauinteropyuv"); -+ m_config.useInteropYuv = !g_guiSettings.GetBool("videoplayer.usevdpaumixer"); - } - - void CMixer::SetDeintSkipChroma() -@@ -2039,7 +2042,7 @@ void CMixer::Init() - m_vdpError = false; - - m_config.upscale = g_advancedSettings.m_videoVDPAUScaling; -- m_config.useInteropYuv = g_guiSettings.GetBool("videoplayer.usevdpauinteropyuv"); -+ m_config.useInteropYuv = !g_guiSettings.GetBool("videoplayer.usevdpaumixer"); - - CreateVdpauMixer(); - } -@@ -2149,11 +2152,12 @@ void CMixer::InitCycle() - DVP_FLAG_INTERLACED); - m_config.useInteropYuv = false; - } -- else if (method == VS_INTERLACEMETHOD_RENDER_BOB && m_config.useInteropYuv) -+ else if (method == VS_INTERLACEMETHOD_RENDER_BOB) - { - m_mixersteps = 1; - m_mixerfield = VDP_VIDEO_MIXER_PICTURE_STRUCTURE_FRAME; - m_mixerInput[1].DVDPic.format = RENDER_FMT_VDPAU_420; -+ m_config.useInteropYuv = true; - } - else - { -@@ -3185,7 +3189,7 @@ bool COutput::GLInit() - glVDPAUGetSurfaceivNV = NULL; - #endif - -- m_config.usePixmaps = !g_guiSettings.GetBool("videoplayer.usevdpauinterop"); -+ m_config.usePixmaps = false; - - #ifdef GL_NV_vdpau_interop - if (glewIsSupported("GL_NV_vdpau_interop")) -@@ -3217,8 +3221,7 @@ bool COutput::GLInit() - #endif - { - m_config.usePixmaps = true; -- g_guiSettings.SetBool("videoplayer.usevdpauinterop",false); -- g_guiSettings.SetBool("videoplayer.usevdpauinteropyuv",false); -+ g_guiSettings.SetBool("videoplayer.usevdpaumixer",true); - } - if (!glXBindTexImageEXT) - glXBindTexImageEXT = (PFNGLXBINDTEXIMAGEEXTPROC)glXGetProcAddress((GLubyte *) "glXBindTexImageEXT"); -diff --git a/xbmc/settings/GUISettings.cpp b/xbmc/settings/GUISettings.cpp -index 4cdb093..33467d9 100644 ---- a/xbmc/settings/GUISettings.cpp -+++ b/xbmc/settings/GUISettings.cpp -@@ -685,8 +685,7 @@ void CGUISettings::Initialize() - - #ifdef HAVE_LIBVDPAU - AddBool(vp, "videoplayer.usevdpau", 13425, true); -- AddBool(vp, "videoplayer.usevdpauinterop", 13435, true); -- AddBool(vp, "videoplayer.usevdpauinteropyuv", 13436, false); -+ AddBool(vp, "videoplayer.usevdpaumixer", 13436, true); - #endif - #ifdef HAVE_LIBVA - AddBool(vp, "videoplayer.usevaapi", 13426, true); -diff --git a/xbmc/settings/GUIWindowSettingsCategory.cpp b/xbmc/settings/GUIWindowSettingsCategory.cpp -index d988598..2af9315 100644 ---- a/xbmc/settings/GUIWindowSettingsCategory.cpp -+++ b/xbmc/settings/GUIWindowSettingsCategory.cpp -@@ -596,9 +596,9 @@ void CGUIWindowSettingsCategory::UpdateSettings() - pControl->SetEnabled(true); - } - } -- else if (strSetting.Equals("videoplayer.usevdpauinteropyuv")) -+ else if (strSetting.Equals("videoplayer.usevdpaumixer")) - { -- bool hasInterop = g_guiSettings.GetBool("videoplayer.usevdpauinterop"); -+ bool hasInterop = true; - #ifndef GL_NV_vdpau_interop - hasInterop = false; - #endif -@@ -610,24 +610,7 @@ void CGUIWindowSettingsCategory::UpdateSettings() - else - { - pControl->SetEnabled(false); -- g_guiSettings.SetBool("videoplayer.usevdpauinteropyuv",false); -- } -- } -- else if (strSetting.Equals("videoplayer.usevdpauinterop")) -- { -- bool hasInterop = g_guiSettings.GetBool("videoplayer.usevdpau"); --#ifndef GL_NV_vdpau_interop -- hasInterop = false; --#endif -- CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID()); -- if (pControl && hasInterop && glewIsSupported("GL_NV_vdpau_interop")) -- { -- pControl->SetEnabled(true); -- } -- else -- { -- pControl->SetEnabled(false); -- g_guiSettings.SetBool("videoplayer.usevdpauinterop",false); -+ g_guiSettings.SetBool("videoplayer.usevdpaumixer",true); - } - } - else --- -1.8.1.6 - - -From 5bc4483a6acd3e0fe6f72d96b4ad17b2d2ced0f0 Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Wed, 12 Dec 2012 18:34:47 +0100 -Subject: [PATCH 29/94] vdpau: drop studio level conversion - ---- - language/English/strings.po | 6 +- - xbmc/cores/VideoRenderers/LinuxRendererGL.cpp | 4 +- - xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp | 94 ++------------------------ - xbmc/settings/GUISettings.cpp | 1 - - 4 files changed, 7 insertions(+), 98 deletions(-) - -diff --git a/language/English/strings.po b/language/English/strings.po -index 7c534a6..41e32a6 100644 ---- a/language/English/strings.po -+++ b/language/English/strings.po -@@ -4368,11 +4368,7 @@ msgctxt "#13121" - msgid "VDPAU HQ Upscaling level" - msgstr "" - --msgctxt "#13122" --msgid "VDPAU Studio level color conversion" --msgstr "" -- --#empty strings from id 13123 to 13129 -+#empty strings from id 13122 to 13129 - - msgctxt "#13130" - msgid "Blank other displays" -diff --git a/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp b/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp -index 4ee50c1..d2ba962 100644 ---- a/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp -+++ b/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp -@@ -3344,7 +3344,7 @@ bool CLinuxRendererGL::Supports(ERENDERFEATURE feature) - { - if(feature == RENDERFEATURE_BRIGHTNESS) - { -- if ((m_renderMethod & RENDER_VDPAU) && !g_guiSettings.GetBool("videoplayer.vdpaustudiolevel")) -+ if (m_renderMethod & RENDER_VDPAU) - return true; - - if (m_renderMethod & RENDER_VAAPI) -@@ -3357,7 +3357,7 @@ bool CLinuxRendererGL::Supports(ERENDERFEATURE feature) - - if(feature == RENDERFEATURE_CONTRAST) - { -- if ((m_renderMethod & RENDER_VDPAU) && !g_guiSettings.GetBool("videoplayer.vdpaustudiolevel")) -+ if (m_renderMethod & RENDER_VDPAU) - return true; - - if (m_renderMethod & RENDER_VAAPI) -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp -index 0381c44..15c58b8 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp -@@ -57,15 +57,6 @@ - }; - const size_t decoder_profile_count = sizeof(decoder_profiles)/sizeof(CDecoder::Desc); - --//static float studioCSC[3][4] = --//{ --// { 1.0f, 0.0f, 1.57480000f,-0.78740000f}, --// { 1.0f,-0.18737736f,-0.46813736f, 0.32775736f}, --// { 1.0f, 1.85556000f, 0.0f,-0.92780000f} --//}; --static float studioCSCKCoeffs601[3] = {0.299, 0.587, 0.114}; //BT601 {Kr, Kg, Kb} --static float studioCSCKCoeffs709[3] = {0.2126, 0.7152, 0.0722}; //BT709 {Kr, Kg, Kb} -- - static struct SInterlaceMapping - { - const EINTERLACEMETHOD method; -@@ -1614,74 +1605,6 @@ void CMixer::PostProcOff() - DisableHQScaling(); - } - -- --bool CMixer::GenerateStudioCSCMatrix(VdpColorStandard colorStandard, VdpCSCMatrix &studioCSCMatrix) --{ -- // instead use studioCSCKCoeffs601[3], studioCSCKCoeffs709[3] to generate float[3][4] matrix (float studioCSC[3][4]) -- // m00 = mRY = red: luma factor (contrast factor) (1.0) -- // m10 = mGY = green: luma factor (contrast factor) (1.0) -- // m20 = mBY = blue: luma factor (contrast factor) (1.0) -- // -- // m01 = mRB = red: blue color diff coeff (0.0) -- // m11 = mGB = green: blue color diff coeff (-2Kb(1-Kb)/(Kg)) -- // m21 = mBB = blue: blue color diff coeff ((1-Kb)/0.5) -- // -- // m02 = mRR = red: red color diff coeff ((1-Kr)/0.5) -- // m12 = mGR = green: red color diff coeff (-2Kr(1-Kr)/(Kg)) -- // m22 = mBR = blue: red color diff coeff (0.0) -- // -- // m03 = mRC = red: colour zero offset (brightness factor) (-(1-Kr)/0.5 * (128/255)) -- // m13 = mGC = green: colour zero offset (brightness factor) ((256/255) * (Kb(1-Kb) + Kr(1-Kr)) / Kg) -- // m23 = mBC = blue: colour zero offset (brightness factor) (-(1-Kb)/0.5 * (128/255)) -- -- // columns -- int Y = 0; -- int Cb = 1; -- int Cr = 2; -- int C = 3; -- // rows -- int R = 0; -- int G = 1; -- int B = 2; -- // colour standard coefficients for red, geen, blue -- double Kr, Kg, Kb; -- // colour diff zero position (use standard 8-bit coding precision) -- double CDZ = 128; //256*0.5 -- // range excursion (use standard 8-bit coding precision) -- double EXC = 255; //256-1 -- -- if (colorStandard == VDP_COLOR_STANDARD_ITUR_BT_601) -- { -- Kr = studioCSCKCoeffs601[0]; -- Kg = studioCSCKCoeffs601[1]; -- Kb = studioCSCKCoeffs601[2]; -- } -- else // assume VDP_COLOR_STANDARD_ITUR_BT_709 -- { -- Kr = studioCSCKCoeffs709[0]; -- Kg = studioCSCKCoeffs709[1]; -- Kb = studioCSCKCoeffs709[2]; -- } -- // we keep luma unscaled to retain the levels present in source so that 16-235 luma is converted to RGB 16-235 -- studioCSCMatrix[R][Y] = 1.0; -- studioCSCMatrix[G][Y] = 1.0; -- studioCSCMatrix[B][Y] = 1.0; -- -- studioCSCMatrix[R][Cb] = 0.0; -- studioCSCMatrix[G][Cb] = (double)-2 * Kb * (1 - Kb) / Kg; -- studioCSCMatrix[B][Cb] = (double)(1 - Kb) / 0.5; -- -- studioCSCMatrix[R][Cr] = (double)(1 - Kr) / 0.5; -- studioCSCMatrix[G][Cr] = (double)-2 * Kr * (1 - Kr) / Kg; -- studioCSCMatrix[B][Cr] = 0.0; -- -- studioCSCMatrix[R][C] = (double)-1 * studioCSCMatrix[R][Cr] * CDZ/EXC; -- studioCSCMatrix[G][C] = (double)-1 * (studioCSCMatrix[G][Cb] + studioCSCMatrix[G][Cr]) * CDZ/EXC; -- studioCSCMatrix[B][C] = (double)-1 * studioCSCMatrix[B][Cb] * CDZ/EXC; -- -- return true; --} -- - void CMixer::SetColor() - { - VdpStatus vdp_st; -@@ -1701,19 +1624,10 @@ void CMixer::SetColor() - //vdp_st = vdp_generate_csc_matrix(&m_Procamp, VDP_COLOR_STANDARD_ITUR_BT_601, &m_CSCMatrix); - - VdpVideoMixerAttribute attributes[] = { VDP_VIDEO_MIXER_ATTRIBUTE_CSC_MATRIX }; -- if (g_guiSettings.GetBool("videoplayer.vdpaustudiolevel")) -- { -- float studioCSC[3][4]; -- GenerateStudioCSCMatrix(colorStandard, studioCSC); -- void const * pm_CSCMatix[] = { &studioCSC }; -- vdp_st = m_config.vdpProcs.vdp_video_mixer_set_attribute_values(m_videoMixer, ARSIZE(attributes), attributes, pm_CSCMatix); -- } -- else -- { -- vdp_st = m_config.vdpProcs.vdp_generate_csc_matrix(&m_Procamp, colorStandard, &m_CSCMatrix); -- void const * pm_CSCMatix[] = { &m_CSCMatrix }; -- vdp_st = m_config.vdpProcs.vdp_video_mixer_set_attribute_values(m_videoMixer, ARSIZE(attributes), attributes, pm_CSCMatix); -- } -+ vdp_st = m_config.vdpProcs.vdp_generate_csc_matrix(&m_Procamp, colorStandard, &m_CSCMatrix); -+ void const * pm_CSCMatix[] = { &m_CSCMatrix }; -+ vdp_st = m_config.vdpProcs.vdp_video_mixer_set_attribute_values(m_videoMixer, ARSIZE(attributes), attributes, pm_CSCMatix); -+ - CheckStatus(vdp_st, __LINE__); - } - -diff --git a/xbmc/settings/GUISettings.cpp b/xbmc/settings/GUISettings.cpp -index 33467d9..4cec1b3 100644 ---- a/xbmc/settings/GUISettings.cpp -+++ b/xbmc/settings/GUISettings.cpp -@@ -764,7 +764,6 @@ void CGUISettings::Initialize() - AddSeparator(vp, "videoplayer.sep1.5"); - #ifdef HAVE_LIBVDPAU - AddBool(NULL, "videoplayer.vdpauUpscalingLevel", 13121, false); -- AddBool(vp, "videoplayer.vdpaustudiolevel", 13122, false); - #endif - #endif - AddSeparator(vp, "videoplayer.sep5"); --- -1.8.1.6 - - -From f9581c0dd5fb9e63eaa0c2aa38fbaa48794cf2c2 Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Wed, 12 Dec 2012 20:28:49 +0100 -Subject: [PATCH 30/94] vdpau: observe ffmpeg tags for color space - ---- - xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp | 38 ++++++++++++++++++-------- - xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.h | 1 + - 2 files changed, 27 insertions(+), 12 deletions(-) - -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp -index 15c58b8..34cc320 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp -@@ -907,6 +907,7 @@ int CDecoder::Decode(AVCodecContext *avctx, AVFrame *pFrame) - memset(&pic.DVDPic, 0, sizeof(pic.DVDPic)); - ((CDVDVideoCodecFFmpeg*)avctx->opaque)->GetPictureCommon(&pic.DVDPic); - pic.render = render; -+ pic.DVDPic.color_matrix = avctx->colorspace; - m_bufferStats.IncDecoded(); - m_vdpauOutput.m_dataPort.SendOutMessage(COutputDataProtocol::NEWFRAME, &pic, sizeof(pic)); - -@@ -1513,10 +1514,6 @@ void CMixer::InitCSCMatrix(int Width) - m_Procamp.contrast = 1.0; - m_Procamp.saturation = 1.0; - m_Procamp.hue = 0; -- vdp_st = m_config.vdpProcs.vdp_generate_csc_matrix(&m_Procamp, -- (Width < 1000)? VDP_COLOR_STANDARD_ITUR_BT_601 : VDP_COLOR_STANDARD_ITUR_BT_709, -- &m_CSCMatrix); -- CheckStatus(vdp_st, __LINE__); - } - - void CMixer::CheckFeatures() -@@ -1527,11 +1524,13 @@ void CMixer::CheckFeatures() - m_Upscale = m_config.upscale; - } - if (m_Brightness != g_settings.m_currentVideoSettings.m_Brightness || -- m_Contrast != g_settings.m_currentVideoSettings.m_Contrast) -+ m_Contrast != g_settings.m_currentVideoSettings.m_Contrast || -+ m_ColorMatrix != m_mixerInput[1].DVDPic.color_matrix) - { - SetColor(); - m_Brightness = g_settings.m_currentVideoSettings.m_Brightness; - m_Contrast = g_settings.m_currentVideoSettings.m_Contrast; -+ m_ColorMatrix = m_mixerInput[1].DVDPic.color_matrix; - } - if (m_NoiseReduction != g_settings.m_currentVideoSettings.m_NoiseReduction) - { -@@ -1615,13 +1614,27 @@ void CMixer::SetColor() - m_Procamp.contrast = (float)((g_settings.m_currentVideoSettings.m_Contrast)+50) / 100; - - VdpColorStandard colorStandard; --// if(vid_height >= 600 || vid_width > 1024) -- if(m_config.surfaceWidth > 1000) -- colorStandard = VDP_COLOR_STANDARD_ITUR_BT_709; -- //vdp_st = vdp_generate_csc_matrix(&m_Procamp, VDP_COLOR_STANDARD_ITUR_BT_709, &m_CSCMatrix); -- else -- colorStandard = VDP_COLOR_STANDARD_ITUR_BT_601; -- //vdp_st = vdp_generate_csc_matrix(&m_Procamp, VDP_COLOR_STANDARD_ITUR_BT_601, &m_CSCMatrix); -+ switch(m_mixerInput[1].DVDPic.color_matrix) -+ { -+ case AVCOL_SPC_BT709: -+ colorStandard = VDP_COLOR_STANDARD_ITUR_BT_709; -+ break; -+ case AVCOL_SPC_BT470BG: -+ case AVCOL_SPC_SMPTE170M: -+ colorStandard = VDP_COLOR_STANDARD_ITUR_BT_601; -+ break; -+ case AVCOL_SPC_SMPTE240M: -+ colorStandard = VDP_COLOR_STANDARD_SMPTE_240M; -+ break; -+ case AVCOL_SPC_FCC: -+ case AVCOL_SPC_UNSPECIFIED: -+ case AVCOL_SPC_RGB: -+ default: -+ if(m_config.surfaceWidth > 1000) -+ colorStandard = VDP_COLOR_STANDARD_ITUR_BT_709; -+ else -+ colorStandard = VDP_COLOR_STANDARD_ITUR_BT_601; -+ } - - VdpVideoMixerAttribute attributes[] = { VDP_VIDEO_MIXER_ATTRIBUTE_CSC_MATRIX }; - vdp_st = m_config.vdpProcs.vdp_generate_csc_matrix(&m_Procamp, colorStandard, &m_CSCMatrix); -@@ -1952,6 +1965,7 @@ void CMixer::Init() - m_Sharpness = 0.0; - m_DeintMode = 0; - m_Deint = 0; -+ m_ColorMatrix = 0; - m_PostProc = false; - m_vdpError = false; - -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.h -index 4d1559c..471ad68 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.h -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.h -@@ -334,6 +334,7 @@ class CMixer : private CThread - int m_DeintMode; - int m_Deint; - int m_Upscale; -+ unsigned int m_ColorMatrix : 4; - uint32_t *m_BlackBar; - VdpVideoMixerPictureStructure m_mixerfield; - int m_mixerstep; --- -1.8.1.6 - - -From 0a520997eddf638c60924ba81f338b1223de35a6 Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Sun, 27 Jan 2013 12:10:19 +0100 -Subject: [PATCH 31/94] vdpau: switch off de-interlacing on ff - ---- - xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp -index 34cc320..5de75ab 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp -@@ -2043,8 +2043,9 @@ void CMixer::InitCycle() - EINTERLACEMETHOD method = GetDeinterlacingMethod(); - bool interlaced = m_mixerInput[1].DVDPic.iFlags & DVP_FLAG_INTERLACED; - -- if (mode == VS_DEINTERLACEMODE_FORCE || -- (mode == VS_DEINTERLACEMODE_AUTO && interlaced)) -+ if (!(flags & DVP_FLAG_NO_POSTPROC) && -+ (mode == VS_DEINTERLACEMODE_FORCE || -+ (mode == VS_DEINTERLACEMODE_AUTO && interlaced))) - { - if((method == VS_INTERLACEMETHOD_AUTO && interlaced) - || method == VS_INTERLACEMETHOD_VDPAU_BOB --- -1.8.1.6 - - -From 2e9f0f7ddcf0935d061b9acda5259f5265932898 Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Sat, 2 Feb 2013 13:17:09 +0100 -Subject: [PATCH 32/94] vdpau: fix mp4 part2 decoding, activate by default - ---- - xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp | 8 ++------ - xbmc/settings/AdvancedSettings.cpp | 2 +- - 2 files changed, 3 insertions(+), 7 deletions(-) - -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp -index 5de75ab..68cf36a 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp -@@ -127,10 +127,9 @@ bool CDecoder::Open(AVCodecContext* avctx, const enum PixelFormat, unsigned int - VdpDecoderProfile profile = 0; - if(avctx->codec_id == CODEC_ID_H264) - profile = VDP_DECODER_PROFILE_H264_HIGH; --#ifdef VDP_DECODER_PROFILE_MPEG4_PART2_ASP - else if(avctx->codec_id == CODEC_ID_MPEG4) - profile = VDP_DECODER_PROFILE_MPEG4_PART2_ASP; --#endif -+ - if(profile) - { - if (!CDVDCodecUtils::IsVP3CompatibleWidth(avctx->coded_width)) -@@ -530,13 +529,10 @@ void CDecoder::ReadFormatOf( PixelFormat fmt - vdp_decoder_profile = VDP_DECODER_PROFILE_VC1_ADVANCED; - vdp_chroma_type = VDP_CHROMA_TYPE_420; - break; --#if (defined PIX_FMT_VDPAU_MPEG4_IN_AVUTIL) && \ -- (defined VDP_DECODER_PROFILE_MP) - case PIX_FMT_VDPAU_MPEG4: -- vdp_decoder_profile = VDP_DECOPEG4_PART2_ASP; -+ vdp_decoder_profile = VDP_DECODER_PROFILE_MPEG4_PART2_ASP; - vdp_chroma_type = VDP_CHROMA_TYPE_420; - break; --#endif - default: - vdp_decoder_profile = 0; - vdp_chroma_type = 0; -diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index 844f8e8..04a7c7c 100644 ---- a/xbmc/settings/AdvancedSettings.cpp -+++ b/xbmc/settings/AdvancedSettings.cpp -@@ -102,7 +102,7 @@ void CAdvancedSettings::Initialize() - m_videoNonLinStretchRatio = 0.5f; - m_videoEnableHighQualityHwScalers = false; - m_videoAutoScaleMaxFps = 30.0f; -- m_videoAllowMpeg4VDPAU = false; -+ m_videoAllowMpeg4VDPAU = true; - m_videoAllowMpeg4VAAPI = false; - m_videoDisableBackgroundDeinterlace = false; - m_videoCaptureUseOcclusionQuery = -1; //-1 is auto detect --- -1.8.1.6 - - -From 65f26cb37d53b5bcaef1c2b3f22c63c9601e5428 Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Tue, 25 Sep 2012 12:14:15 +0200 -Subject: [PATCH 33/94] linuxrenderer: drop method RenderMultiPass - ---- - xbmc/cores/VideoRenderers/LinuxRendererGL.cpp | 9 ++------- - xbmc/cores/VideoRenderers/LinuxRendererGL.h | 1 - - 2 files changed, 2 insertions(+), 8 deletions(-) - -diff --git a/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp b/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp -index d2ba962..62198f0 100644 ---- a/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp -+++ b/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp -@@ -1205,7 +1205,8 @@ void CLinuxRendererGL::Render(DWORD flags, int renderBuffer) - break; - - case RQ_MULTIPASS: -- RenderMultiPass(renderBuffer, m_currentField); -+ RenderToFBO(renderBuffer, m_currentField); -+ RenderFromFBO(); - VerifyGLState(); - break; - } -@@ -1328,12 +1329,6 @@ void CLinuxRendererGL::RenderSinglePass(int index, int field) - VerifyGLState(); - } - --void CLinuxRendererGL::RenderMultiPass(int index, int field) --{ -- RenderToFBO(index, field); -- RenderFromFBO(); --} -- - void CLinuxRendererGL::RenderToFBO(int index, int field) - { - YUVPLANES &planes = m_buffers[index].fields[field]; -diff --git a/xbmc/cores/VideoRenderers/LinuxRendererGL.h b/xbmc/cores/VideoRenderers/LinuxRendererGL.h -index 329ddee..08f8234 100644 ---- a/xbmc/cores/VideoRenderers/LinuxRendererGL.h -+++ b/xbmc/cores/VideoRenderers/LinuxRendererGL.h -@@ -216,7 +216,6 @@ class CLinuxRendererGL : public CBaseRenderer - void CalculateTextureSourceRects(int source, int num_planes); - - // renderers -- void RenderMultiPass(int renderBuffer, int field); // multi pass glsl renderer - void RenderToFBO(int renderBuffer, int field); - void RenderFromFBO(); - void RenderSinglePass(int renderBuffer, int field); // single pass glsl renderer --- -1.8.1.6 - - -From ec43b4a3d63ddf789bdb49f3aadaf0c0497eec2b Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Tue, 25 Sep 2012 13:20:47 +0200 -Subject: [PATCH 34/94] linuxrenderer: implement progressive weave for vdpau - ---- - xbmc/cores/VideoRenderers/LinuxRendererGL.cpp | 55 +++++++++++++++++++-------- - xbmc/cores/VideoRenderers/LinuxRendererGL.h | 4 +- - 2 files changed, 41 insertions(+), 18 deletions(-) - -diff --git a/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp b/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp -index 62198f0..6e6d97e 100644 ---- a/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp -+++ b/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp -@@ -689,18 +689,6 @@ void CLinuxRendererGL::RenderUpdate(bool clear, DWORD flags, DWORD alpha) - glDisable(GL_POLYGON_STIPPLE); - - } -- else if(m_format == RENDER_FMT_VDPAU_420 -- && !(flags & RENDER_FLAG_BOTH)) -- { -- glDisable(GL_BLEND); -- glColor4f(1.0f, 1.0f, 1.0f, 1.0f); -- Render(flags | RENDER_FLAG_TOP, index); -- -- glEnable(GL_BLEND); -- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); -- glColor4f(1.0f, 1.0f, 1.0f, 128 / 255.0f); -- Render(flags | RENDER_FLAG_BOT , index); -- } - else - Render(flags, index); - -@@ -1200,13 +1188,21 @@ void CLinuxRendererGL::Render(DWORD flags, int renderBuffer) - { - case RQ_LOW: - case RQ_SINGLEPASS: -- RenderSinglePass(renderBuffer, m_currentField); -+ if (m_format == RENDER_FMT_VDPAU_420 && m_currentField == FIELD_FULL) -+ RenderProgressiveWeave(renderBuffer, m_currentField); -+ else -+ RenderSinglePass(renderBuffer, m_currentField); - VerifyGLState(); - break; - - case RQ_MULTIPASS: -- RenderToFBO(renderBuffer, m_currentField); -- RenderFromFBO(); -+ if (m_format == RENDER_FMT_VDPAU_420 && m_currentField == FIELD_FULL) -+ RenderProgressiveWeave(renderBuffer, m_currentField); -+ else -+ { -+ RenderToFBO(renderBuffer, m_currentField); -+ RenderFromFBO(); -+ } - VerifyGLState(); - break; - } -@@ -1329,7 +1325,7 @@ void CLinuxRendererGL::RenderSinglePass(int index, int field) - VerifyGLState(); - } - --void CLinuxRendererGL::RenderToFBO(int index, int field) -+void CLinuxRendererGL::RenderToFBO(int index, int field, bool weave /*= false*/) - { - YUVPLANES &planes = m_buffers[index].fields[field]; - -@@ -1431,6 +1427,8 @@ void CLinuxRendererGL::RenderToFBO(int index, int field) - } - m_fbo.width *= planes[0].pixpertex_x; - m_fbo.height *= planes[0].pixpertex_y; -+ if (weave) -+ m_fbo.height *= 2; - - // 1st Pass to video frame size - glBegin(GL_QUADS); -@@ -1549,6 +1547,31 @@ void CLinuxRendererGL::RenderFromFBO() - VerifyGLState(); - } - -+void CLinuxRendererGL::RenderProgressiveWeave(int index, int field) -+{ -+ bool scaleUp = (int)m_sourceHeight < g_graphicsContext.GetHeight() || (int)m_sourceWidth < g_graphicsContext.GetWidth(); -+ -+ if (m_fbo.fbo.IsSupported() && (scaleUp || m_renderQuality == RQ_MULTIPASS)) -+ { -+ glEnable(GL_POLYGON_STIPPLE); -+ glPolygonStipple(stipple_weave); -+ RenderToFBO(index, FIELD_TOP, true); -+ glPolygonStipple(stipple_weave+4); -+ RenderToFBO(index, FIELD_BOT, true); -+ glDisable(GL_POLYGON_STIPPLE); -+ RenderFromFBO(); -+ } -+ else -+ { -+ glEnable(GL_POLYGON_STIPPLE); -+ glPolygonStipple(stipple_weave); -+ RenderSinglePass(index, FIELD_TOP); -+ glPolygonStipple(stipple_weave+4); -+ RenderSinglePass(index, FIELD_BOT); -+ glDisable(GL_POLYGON_STIPPLE); -+ } -+} -+ - void CLinuxRendererGL::RenderVDPAU(int index, int field) - { - #ifdef HAVE_LIBVDPAU -diff --git a/xbmc/cores/VideoRenderers/LinuxRendererGL.h b/xbmc/cores/VideoRenderers/LinuxRendererGL.h -index 08f8234..13217ce 100644 ---- a/xbmc/cores/VideoRenderers/LinuxRendererGL.h -+++ b/xbmc/cores/VideoRenderers/LinuxRendererGL.h -@@ -216,12 +216,12 @@ class CLinuxRendererGL : public CBaseRenderer - void CalculateTextureSourceRects(int source, int num_planes); - - // renderers -- void RenderToFBO(int renderBuffer, int field); -+ void RenderToFBO(int renderBuffer, int field, bool weave = false); - void RenderFromFBO(); - void RenderSinglePass(int renderBuffer, int field); // single pass glsl renderer - void RenderSoftware(int renderBuffer, int field); // single pass s/w yuv2rgb renderer - void RenderVDPAU(int renderBuffer, int field); // render using vdpau hardware -- void RenderVDPAUYV12(int renderBuffer, int field); // render using vdpau hardware -+ void RenderProgressiveWeave(int renderBuffer, int field); // render using vdpau hardware - void RenderVAAPI(int renderBuffer, int field); // render using vdpau hardware - - struct --- -1.8.1.6 - - -From 3cf3d02810620738ed653e3a54f3c747e8975a5c Mon Sep 17 00:00:00 2001 -From: FernetMenta -Date: Thu, 5 Jul 2012 15:22:05 +0200 -Subject: [PATCH 35/94] X11: ditch SDL for video and window events - ---- - xbmc/Application.cpp | 2 +- - xbmc/system.h | 5 + - xbmc/windowing/Makefile | 1 + - xbmc/windowing/WinEvents.h | 4 + - xbmc/windowing/WinEventsX11.cpp | 765 ++++++++++++++++++++++++++++++++++++ - xbmc/windowing/WinEventsX11.h | 57 +++ - xbmc/windowing/X11/WinSystemX11.cpp | 370 ++++++++++++----- - xbmc/windowing/X11/WinSystemX11.h | 9 +- - 8 files changed, 1112 insertions(+), 101 deletions(-) - create mode 100644 xbmc/windowing/WinEventsX11.cpp - create mode 100644 xbmc/windowing/WinEventsX11.h - -diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp -index ffd86a7..7e3de37 100644 ---- a/xbmc/Application.cpp -+++ b/xbmc/Application.cpp -@@ -794,7 +794,7 @@ bool CApplication::CreateGUI() - - uint32_t sdlFlags = 0; - --#if defined(HAS_SDL_OPENGL) || (HAS_GLES == 2) -+#if (defined(HAS_SDL_OPENGL) || (HAS_GLES == 2)) && !defined(HAS_GLX) - sdlFlags |= SDL_INIT_VIDEO; - #endif - -diff --git a/xbmc/system.h b/xbmc/system.h -index 4165c01..32584b1 100644 ---- a/xbmc/system.h -+++ b/xbmc/system.h -@@ -162,16 +162,21 @@ - #define HAS_GL - #ifdef HAVE_X11 - #define HAS_GLX -+#define HAS_X11_WIN_EVENTS - #endif - #ifdef HAVE_SDL - #define HAS_SDL - #ifndef HAS_SDL_OPENGL - #define HAS_SDL_OPENGL - #endif -+#ifndef HAVE_X11 - #define HAS_SDL_WIN_EVENTS -+#endif - #else -+#ifndef HAVE_X11 - #define HAS_LINUX_EVENTS - #endif -+#endif - #define HAS_LINUX_NETWORK - #define HAS_LIRC - #ifdef HAVE_LIBPULSE -diff --git a/xbmc/windowing/Makefile b/xbmc/windowing/Makefile -index f109bec..f981642 100644 ---- a/xbmc/windowing/Makefile -+++ b/xbmc/windowing/Makefile -@@ -1,6 +1,7 @@ - SRCS=WinEventsSDL.cpp \ - WinEventsLinux.cpp \ - WinSystem.cpp \ -+ WinEventsX11.cpp \ - - LIB=windowing.a - -diff --git a/xbmc/windowing/WinEvents.h b/xbmc/windowing/WinEvents.h -index 6d322a9..5a671cc 100644 ---- a/xbmc/windowing/WinEvents.h -+++ b/xbmc/windowing/WinEvents.h -@@ -58,6 +58,10 @@ class CWinEventsBase - #include "WinEventsSDL.h" - #define CWinEvents CWinEventsSDL - -+#elif defined(TARGET_LINUX) && defined(HAS_X11_WIN_EVENTS) -+#include "WinEventsX11.h" -+#define CWinEvents CWinEventsX11 -+ - #elif defined(TARGET_LINUX) && defined(HAS_LINUX_EVENTS) - #include "WinEventsLinux.h" - #define CWinEvents CWinEventsLinux -diff --git a/xbmc/windowing/WinEventsX11.cpp b/xbmc/windowing/WinEventsX11.cpp -new file mode 100644 -index 0000000..24477ae ---- /dev/null -+++ b/xbmc/windowing/WinEventsX11.cpp -@@ -0,0 +1,765 @@ -+/* -+* Copyright (C) 2005-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 -+* -+*/ -+ -+#include "system.h" -+ -+#ifdef HAS_X11_WIN_EVENTS -+ -+#include "WinEvents.h" -+#include "WinEventsX11.h" -+#include "Application.h" -+#include "ApplicationMessenger.h" -+#include -+#include "X11/WinSystemX11GL.h" -+#include "X11/keysymdef.h" -+#include "X11/XF86keysym.h" -+#include "utils/log.h" -+#include "guilib/GUIWindowManager.h" -+#include "input/MouseStat.h" -+ -+CWinEventsX11* CWinEventsX11::WinEvents = 0; -+ -+static uint32_t SymMappingsX11[][2] = -+{ -+ {XK_BackSpace, XBMCK_BACKSPACE} -+, {XK_Tab, XBMCK_TAB} -+, {XK_Clear, XBMCK_CLEAR} -+, {XK_Return, XBMCK_RETURN} -+, {XK_Pause, XBMCK_PAUSE} -+, {XK_Escape, XBMCK_ESCAPE} -+, {XK_Delete, XBMCK_DELETE} -+// multi-media keys -+, {XF86XK_Back, XBMCK_BROWSER_BACK} -+, {XF86XK_Forward, XBMCK_BROWSER_FORWARD} -+, {XF86XK_Refresh, XBMCK_BROWSER_REFRESH} -+, {XF86XK_Stop, XBMCK_BROWSER_STOP} -+, {XF86XK_Search, XBMCK_BROWSER_SEARCH} -+, {XF86XK_Favorites, XBMCK_BROWSER_FAVORITES} -+, {XF86XK_HomePage, XBMCK_BROWSER_HOME} -+, {XF86XK_AudioMute, XBMCK_VOLUME_MUTE} -+, {XF86XK_AudioLowerVolume, XBMCK_VOLUME_DOWN} -+, {XF86XK_AudioRaiseVolume, XBMCK_VOLUME_UP} -+, {XF86XK_AudioNext, XBMCK_MEDIA_NEXT_TRACK} -+, {XF86XK_AudioPrev, XBMCK_MEDIA_PREV_TRACK} -+, {XF86XK_AudioStop, XBMCK_MEDIA_STOP} -+, {XF86XK_AudioPause, XBMCK_MEDIA_PLAY_PAUSE} -+, {XF86XK_Mail, XBMCK_LAUNCH_MAIL} -+, {XF86XK_Select, XBMCK_LAUNCH_MEDIA_SELECT} -+, {XF86XK_Launch0, XBMCK_LAUNCH_APP1} -+, {XF86XK_Launch1, XBMCK_LAUNCH_APP2} -+, {XF86XK_WWW, XBMCK_LAUNCH_FILE_BROWSER} -+, {XF86XK_AudioMedia, XBMCK_LAUNCH_MEDIA_CENTER } -+ // Numeric keypad -+, {XK_KP_0, XBMCK_KP0} -+, {XK_KP_1, XBMCK_KP1} -+, {XK_KP_2, XBMCK_KP2} -+, {XK_KP_3, XBMCK_KP3} -+, {XK_KP_4, XBMCK_KP4} -+, {XK_KP_5, XBMCK_KP5} -+, {XK_KP_6, XBMCK_KP6} -+, {XK_KP_7, XBMCK_KP7} -+, {XK_KP_8, XBMCK_KP8} -+, {XK_KP_9, XBMCK_KP9} -+, {XK_KP_Separator, XBMCK_KP_PERIOD} -+, {XK_KP_Divide, XBMCK_KP_DIVIDE} -+, {XK_KP_Multiply, XBMCK_KP_MULTIPLY} -+, {XK_KP_Subtract, XBMCK_KP_MINUS} -+, {XK_KP_Add, XBMCK_KP_PLUS} -+, {XK_KP_Enter, XBMCK_KP_ENTER} -+, {XK_KP_Equal, XBMCK_KP_EQUALS} -+ // Arrows + Home/End pad -+, {XK_Up, XBMCK_UP} -+, {XK_Down, XBMCK_DOWN} -+, {XK_Right, XBMCK_RIGHT} -+, {XK_Left, XBMCK_LEFT} -+, {XK_Insert, XBMCK_INSERT} -+, {XK_Home, XBMCK_HOME} -+, {XK_End, XBMCK_END} -+, {XK_Page_Up, XBMCK_PAGEUP} -+, {XK_Page_Down, XBMCK_PAGEDOWN} -+ // Function keys -+, {XK_F1, XBMCK_F1} -+, {XK_F2, XBMCK_F2} -+, {XK_F3, XBMCK_F3} -+, {XK_F4, XBMCK_F4} -+, {XK_F5, XBMCK_F5} -+, {XK_F6, XBMCK_F6} -+, {XK_F7, XBMCK_F7} -+, {XK_F8, XBMCK_F8} -+, {XK_F9, XBMCK_F9} -+, {XK_F10, XBMCK_F10} -+, {XK_F11, XBMCK_F11} -+, {XK_F12, XBMCK_F12} -+, {XK_F13, XBMCK_F13} -+, {XK_F14, XBMCK_F14} -+, {XK_F15, XBMCK_F15} -+ // Key state modifier keys -+, {XK_Num_Lock, XBMCK_NUMLOCK} -+, {XK_Caps_Lock, XBMCK_CAPSLOCK} -+, {XK_Scroll_Lock, XBMCK_SCROLLOCK} -+, {XK_Shift_R, XBMCK_RSHIFT} -+, {XK_Shift_L, XBMCK_LSHIFT} -+, {XK_Control_R, XBMCK_RCTRL} -+, {XK_Control_L, XBMCK_LCTRL} -+, {XK_Alt_R, XBMCK_RALT} -+, {XK_Alt_L, XBMCK_LALT} -+, {XK_Meta_R, XBMCK_RMETA} -+, {XK_Meta_L, XBMCK_LMETA} -+, {XK_Super_L, XBMCK_LSUPER} -+, {XK_Super_R, XBMCK_RSUPER} -+, {XK_Mode_switch, XBMCK_MODE} -+, {XK_Multi_key, XBMCK_COMPOSE} -+ // Miscellaneous function keys -+, {XK_Help, XBMCK_HELP} -+, {XK_Print, XBMCK_PRINT} -+//, {0, XBMCK_SYSREQ} -+, {XK_Break, XBMCK_BREAK} -+, {XK_Menu, XBMCK_MENU} -+, {XF86XK_PowerOff, XBMCK_POWER} -+, {XK_EcuSign, XBMCK_EURO} -+, {XK_Undo, XBMCK_UNDO} -+ /* Media keys */ -+, {XF86XK_Eject, XBMCK_EJECT} -+, {XF86XK_Stop, XBMCK_STOP} -+, {XF86XK_AudioRecord, XBMCK_RECORD} -+, {XF86XK_AudioRewind, XBMCK_REWIND} -+, {XF86XK_Phone, XBMCK_PHONE} -+, {XF86XK_AudioPlay, XBMCK_PLAY} -+, {XF86XK_AudioRandomPlay, XBMCK_SHUFFLE} -+, {XF86XK_AudioForward, XBMCK_FASTFORWARD} -+}; -+ -+ -+CWinEventsX11::CWinEventsX11() -+{ -+ m_display = 0; -+ m_window = 0; -+ m_keybuf = 0; -+ m_utf16buf = 0; -+} -+ -+CWinEventsX11::~CWinEventsX11() -+{ -+ if (m_keybuf); -+ { -+ free(m_keybuf); -+ m_keybuf = 0; -+ } -+ -+ if (m_utf16buf) -+ { -+ free(m_utf16buf); -+ m_utf16buf = 0; -+ } -+ -+ if (m_xic) -+ { -+ XUnsetICFocus(m_xic); -+ XDestroyIC(m_xic); -+ m_xic = 0; -+ } -+ -+ if (m_xim) -+ { -+ XCloseIM(m_xim); -+ m_xim = 0; -+ } -+ -+ m_symLookupTable.clear(); -+} -+ -+bool CWinEventsX11::Init(Display *dpy, Window win) -+{ -+ if (WinEvents) -+ return true; -+ -+ WinEvents = new CWinEventsX11(); -+ WinEvents->m_display = dpy; -+ WinEvents->m_window = win; -+ WinEvents->m_keybuf = (char*)malloc(32*sizeof(char)); -+ WinEvents->m_utf16buf = (uint16_t*)malloc(32*sizeof(uint16_t)); -+ WinEvents->m_keymodState = 0; -+ WinEvents->m_wmDeleteMessage = XInternAtom(dpy, "WM_DELETE_WINDOW", False); -+ WinEvents->m_structureChanged = false; -+ memset(&(WinEvents->m_lastKey), 0, sizeof(XBMC_Event)); -+ -+ // open input method -+ char *old_locale = NULL, *old_modifiers = NULL; -+ char res_name[8]; -+ const char *p; -+ size_t n; -+ -+ // set resource name to xbmc, not used -+ strcpy(res_name, "xbmc"); -+ -+ // save current locale, this should be "C" -+ p = setlocale(LC_ALL, NULL); -+ if (p) -+ { -+ old_locale = (char*)malloc(strlen(p) +1); -+ strcpy(old_locale, p); -+ } -+ p = XSetLocaleModifiers(NULL); -+ if (p) -+ { -+ old_modifiers = (char*)malloc(strlen(p) +1); -+ strcpy(old_modifiers, p); -+ } -+ -+ // set users preferences and open input method -+ p = setlocale(LC_ALL, ""); -+ XSetLocaleModifiers(""); -+ WinEvents->m_xim = XOpenIM(WinEvents->m_display, NULL, res_name, res_name); -+ -+ // restore old locale -+ if (old_locale) -+ { -+ setlocale(LC_ALL, old_locale); -+ free(old_locale); -+ } -+ if (old_modifiers) -+ { -+ XSetLocaleModifiers(old_modifiers); -+ free(old_modifiers); -+ } -+ -+ WinEvents->m_xic = NULL; -+ if (WinEvents->m_xim) -+ { -+ WinEvents->m_xic = XCreateIC(WinEvents->m_xim, -+ XNClientWindow, WinEvents->m_window, -+ XNFocusWindow, WinEvents->m_window, -+ XNInputStyle, XIMPreeditNothing | XIMStatusNothing, -+ XNResourceName, res_name, -+ XNResourceClass, res_name, -+ NULL); -+ } -+ -+ if (!WinEvents->m_xic) -+ CLog::Log(LOGWARNING,"CWinEventsX11::Init - no input method found"); -+ -+ // build Keysym lookup table -+ for (unsigned int i = 0; i < sizeof(SymMappingsX11)/(2*sizeof(uint32_t)); ++i) -+ { -+ WinEvents->m_symLookupTable[SymMappingsX11[i][0]] = SymMappingsX11[i][1]; -+ } -+ -+ return true; -+} -+ -+void CWinEventsX11::Quit() -+{ -+ if (!WinEvents) -+ return; -+ -+ delete WinEvents; -+ WinEvents = 0; -+} -+ -+bool CWinEventsX11::HasStructureChanged() -+{ -+ if (!WinEvents) -+ return false; -+ -+ bool ret = WinEvents->m_structureChanged; -+ WinEvents->m_structureChanged = false; -+ return ret; -+} -+ -+bool CWinEventsX11::MessagePump() -+{ -+ if (!WinEvents) -+ return false; -+ -+ bool ret = false; -+ XEvent xevent; -+ unsigned long serial = 0; -+ -+ while (WinEvents && XPending(WinEvents->m_display)) -+ { -+ memset(&xevent, 0, sizeof (XEvent)); -+ XNextEvent(WinEvents->m_display, &xevent); -+ -+ // ignore events generated by auto-repeat -+ if (xevent.type == KeyRelease && XPending(WinEvents->m_display)) -+ { -+ XEvent peekevent; -+ XPeekEvent(WinEvents->m_display, &peekevent); -+ if ((peekevent.type == KeyPress) && -+ (peekevent.xkey.keycode == xevent.xkey.keycode) && -+ ((peekevent.xkey.time - xevent.xkey.time) < 2)) -+ { -+ XNextEvent(WinEvents->m_display, &peekevent); -+ continue; -+ } -+ } -+ -+ if (XFilterEvent(&xevent, None)) -+ continue; -+ -+ switch (xevent.type) -+ { -+ case MapNotify: -+ { -+ g_application.m_AppActive = true; -+ break; -+ } -+ -+ case UnmapNotify: -+ { -+ g_application.m_AppActive = false; -+ break; -+ } -+ -+ case FocusIn: -+ { -+ if (WinEvents->m_xic) -+ XSetICFocus(WinEvents->m_xic); -+ g_application.m_AppFocused = true; -+ if (serial == xevent.xfocus.serial) -+ break; -+ g_Windowing.NotifyAppFocusChange(g_application.m_AppFocused); -+ break; -+ } -+ -+ case FocusOut: -+ { -+ if (WinEvents->m_xic) -+ XUnsetICFocus(WinEvents->m_xic); -+ g_application.m_AppFocused = false; -+ g_Windowing.NotifyAppFocusChange(g_application.m_AppFocused); -+ serial = xevent.xfocus.serial; -+ break; -+ } -+ -+ case Expose: -+ { -+ g_windowManager.MarkDirty(); -+ break; -+ } -+ -+ case ConfigureNotify: -+ { -+ if (xevent.xconfigure.window != WinEvents->m_window) -+ break; -+ -+ WinEvents->m_structureChanged = true; -+ XBMC_Event newEvent; -+ memset(&newEvent, 0, sizeof(newEvent)); -+ newEvent.type = XBMC_VIDEORESIZE; -+ newEvent.resize.w = xevent.xconfigure.width; -+ newEvent.resize.h = xevent.xconfigure.height; -+ ret |= g_application.OnEvent(newEvent); -+ g_windowManager.MarkDirty(); -+ break; -+ } -+ -+ case ClientMessage: -+ { -+ if (xevent.xclient.data.l[0] == WinEvents->m_wmDeleteMessage) -+ if (!g_application.m_bStop) CApplicationMessenger::Get().Quit(); -+ break; -+ } -+ -+ case KeyPress: -+ { -+ XBMC_Event newEvent; -+ memset(&newEvent, 0, sizeof(newEvent)); -+ newEvent.type = XBMC_KEYDOWN; -+ KeySym xkeysym; -+ -+ // fallback if we have no IM -+ if (!WinEvents->m_xic) -+ { -+ static XComposeStatus state; -+ char keybuf[32]; -+ xkeysym = XLookupKeysym(&xevent.xkey, 0); -+ newEvent.key.keysym.sym = LookupXbmcKeySym(xkeysym); -+ newEvent.key.keysym.scancode = xevent.xkey.keycode; -+ newEvent.key.state = xevent.xkey.state; -+ newEvent.key.type = xevent.xkey.type; -+ if (XLookupString(&xevent.xkey, keybuf, sizeof(keybuf), NULL, &state)) -+ { -+ newEvent.key.keysym.unicode = keybuf[0]; -+ } -+ ret |= ProcessKey(newEvent, 500); -+ break; -+ } -+ -+ Status status; -+ int utf16size; -+ int utf16length; -+ int len; -+ len = Xutf8LookupString(WinEvents->m_xic, &xevent.xkey, -+ WinEvents->m_keybuf, sizeof(WinEvents->m_keybuf), -+ &xkeysym, &status); -+ if (status == XBufferOverflow) -+ { -+ WinEvents->m_keybuf = (char*)realloc(WinEvents->m_keybuf, len*sizeof(char)); -+ len = Xutf8LookupString(WinEvents->m_xic, &xevent.xkey, -+ WinEvents->m_keybuf, sizeof(WinEvents->m_keybuf), -+ &xkeysym, &status); -+ } -+ switch (status) -+ { -+ case XLookupNone: -+ break; -+ case XLookupChars: -+ case XLookupBoth: -+ { -+ if (len == 0) -+ break; -+ utf16size = len * sizeof(uint16_t); -+ if (utf16size > sizeof(WinEvents->m_utf16buf)) -+ { -+ WinEvents->m_utf16buf = (uint16_t *)realloc(WinEvents->m_utf16buf,utf16size); -+ if (WinEvents->m_utf16buf == NULL) -+ { -+ break; -+ } -+ } -+ utf16length = Utf8ToUnicode(WinEvents->m_keybuf, len, WinEvents->m_utf16buf, utf16size); -+ if (utf16length < 0) -+ { -+ break; -+ } -+ for (unsigned int i = 0; i < utf16length - 1; i++) -+ { -+ newEvent.key.keysym.sym = XBMCK_UNKNOWN; -+ newEvent.key.keysym.unicode = WinEvents->m_utf16buf[i]; -+ newEvent.key.state = xevent.xkey.state; -+ newEvent.key.type = xevent.xkey.type; -+ ret |= ProcessKey(newEvent, 500); -+ } -+ if (utf16length > 0) -+ { -+ newEvent.key.keysym.scancode = xevent.xkey.keycode; -+ xkeysym = XLookupKeysym(&xevent.xkey, 0); -+ newEvent.key.keysym.sym = LookupXbmcKeySym(xkeysym); -+ newEvent.key.keysym.unicode = WinEvents->m_utf16buf[utf16length - 1]; -+ newEvent.key.state = xevent.xkey.state; -+ newEvent.key.type = xevent.xkey.type; -+ -+ ret |= ProcessKey(newEvent, 500); -+ } -+ break; -+ } -+ -+ case XLookupKeySym: -+ { -+ newEvent.key.keysym.scancode = xevent.xkey.keycode; -+ newEvent.key.keysym.sym = LookupXbmcKeySym(xkeysym); -+ newEvent.key.state = xevent.xkey.state; -+ newEvent.key.type = xevent.xkey.type; -+ ret |= ProcessKey(newEvent, 500); -+ break; -+ } -+ -+ }// switch status -+ break; -+ } //KeyPress -+ -+ case KeyRelease: -+ { -+ XBMC_Event newEvent; -+ KeySym xkeysym; -+ memset(&newEvent, 0, sizeof(newEvent)); -+ newEvent.type = XBMC_KEYUP; -+ xkeysym = XLookupKeysym(&xevent.xkey, 0); -+ newEvent.key.keysym.scancode = xevent.xkey.keycode; -+ newEvent.key.keysym.sym = LookupXbmcKeySym(xkeysym); -+ newEvent.key.state = xevent.xkey.state; -+ newEvent.key.type = xevent.xkey.type; -+ ret |= ProcessKey(newEvent, 0); -+ break; -+ } -+ -+ // lose mouse coverage -+ case LeaveNotify: -+ { -+ g_Mouse.SetActive(false); -+ break; -+ } -+ -+ case MotionNotify: -+ { -+ XBMC_Event newEvent; -+ memset(&newEvent, 0, sizeof(newEvent)); -+ newEvent.type = XBMC_MOUSEMOTION; -+ newEvent.motion.xrel = (int16_t)xevent.xmotion.x_root; -+ newEvent.motion.yrel = (int16_t)xevent.xmotion.y_root; -+ newEvent.motion.x = (int16_t)xevent.xmotion.x; -+ newEvent.motion.y = (int16_t)xevent.xmotion.y; -+ ret |= g_application.OnEvent(newEvent); -+ break; -+ } -+ -+ case ButtonPress: -+ { -+ XBMC_Event newEvent; -+ memset(&newEvent, 0, sizeof(newEvent)); -+ newEvent.type = XBMC_MOUSEBUTTONDOWN; -+ newEvent.button.button = (unsigned char)xevent.xbutton.button; -+ newEvent.button.state = XBMC_PRESSED; -+ newEvent.button.x = (int16_t)xevent.xbutton.x; -+ newEvent.button.y = (int16_t)xevent.xbutton.y; -+ ret |= g_application.OnEvent(newEvent); -+ break; -+ } -+ -+ case ButtonRelease: -+ { -+ XBMC_Event newEvent; -+ memset(&newEvent, 0, sizeof(newEvent)); -+ newEvent.type = XBMC_MOUSEBUTTONUP; -+ newEvent.button.button = (unsigned char)xevent.xbutton.button; -+ newEvent.button.state = XBMC_RELEASED; -+ newEvent.button.x = (int16_t)xevent.xbutton.x; -+ newEvent.button.y = (int16_t)xevent.xbutton.y; -+ ret |= g_application.OnEvent(newEvent); -+ break; -+ } -+ -+ default: -+ { -+ break; -+ } -+ }// switch event.type -+ }// while -+ -+ ret |= ProcessKeyRepeat(); -+ -+ return ret; -+} -+ -+bool CWinEventsX11::ProcessKey(XBMC_Event &event, int repeatDelay) -+{ -+ if (event.type == XBMC_KEYDOWN) -+ { -+ // check key modifiers -+ switch(event.key.keysym.sym) -+ { -+ case XBMCK_LSHIFT: -+ WinEvents->m_keymodState |= XBMCKMOD_LSHIFT; -+ break; -+ case XBMCK_RSHIFT: -+ WinEvents->m_keymodState |= XBMCKMOD_RSHIFT; -+ break; -+ case XBMCK_LCTRL: -+ WinEvents->m_keymodState |= XBMCKMOD_LCTRL; -+ break; -+ case XBMCK_RCTRL: -+ WinEvents->m_keymodState |= XBMCKMOD_RCTRL; -+ break; -+ case XBMCK_LALT: -+ WinEvents->m_keymodState |= XBMCKMOD_LALT; -+ break; -+ case XBMCK_RALT: -+ WinEvents->m_keymodState |= XBMCKMOD_RCTRL; -+ break; -+ case XBMCK_LMETA: -+ WinEvents->m_keymodState |= XBMCKMOD_LMETA; -+ break; -+ case XBMCK_RMETA: -+ WinEvents->m_keymodState |= XBMCKMOD_RMETA; -+ break; -+ case XBMCK_MODE: -+ WinEvents->m_keymodState |= XBMCKMOD_MODE; -+ break; -+ default: -+ break; -+ } -+ event.key.keysym.mod = (XBMCMod)WinEvents->m_keymodState; -+ memcpy(&(WinEvents->m_lastKey), &event, sizeof(event)); -+ WinEvents->m_repeatKeyTimeout.Set(repeatDelay); -+ -+ bool ret = ProcessShortcuts(event); -+ if (ret) -+ return ret; -+ } -+ else if (event.type == XBMC_KEYUP) -+ { -+ switch(event.key.keysym.sym) -+ { -+ case XBMCK_LSHIFT: -+ WinEvents->m_keymodState &= ~XBMCKMOD_LSHIFT; -+ break; -+ case XBMCK_RSHIFT: -+ WinEvents->m_keymodState &= ~XBMCKMOD_RSHIFT; -+ break; -+ case XBMCK_LCTRL: -+ WinEvents->m_keymodState &= ~XBMCKMOD_LCTRL; -+ break; -+ case XBMCK_RCTRL: -+ WinEvents->m_keymodState &= ~XBMCKMOD_RCTRL; -+ break; -+ case XBMCK_LALT: -+ WinEvents->m_keymodState &= ~XBMCKMOD_LALT; -+ break; -+ case XBMCK_RALT: -+ WinEvents->m_keymodState &= ~XBMCKMOD_RCTRL; -+ break; -+ case XBMCK_LMETA: -+ WinEvents->m_keymodState &= ~XBMCKMOD_LMETA; -+ break; -+ case XBMCK_RMETA: -+ WinEvents->m_keymodState &= ~XBMCKMOD_RMETA; -+ break; -+ case XBMCK_MODE: -+ WinEvents->m_keymodState &= ~XBMCKMOD_MODE; -+ break; -+ default: -+ break; -+ } -+ event.key.keysym.mod = (XBMCMod)WinEvents->m_keymodState; -+ memset(&(WinEvents->m_lastKey), 0, sizeof(event)); -+ } -+ -+ return g_application.OnEvent(event); -+} -+ -+bool CWinEventsX11::ProcessShortcuts(XBMC_Event& event) -+{ -+ if (event.key.keysym.mod & XBMCKMOD_ALT) -+ { -+ switch(event.key.keysym.sym) -+ { -+ case XBMCK_TAB: // ALT+TAB to minimize/hide -+ g_application.Minimize(); -+ return true; -+ -+ default: -+ return false; -+ } -+ } -+ return false; -+} -+ -+bool CWinEventsX11::ProcessKeyRepeat() -+{ -+ if (WinEvents && (WinEvents->m_lastKey.type == XBMC_KEYDOWN)) -+ { -+ if (WinEvents->m_repeatKeyTimeout.IsTimePast()) -+ { -+ return ProcessKey(WinEvents->m_lastKey, 10); -+ } -+ } -+ return false; -+} -+ -+int CWinEventsX11::Utf8ToUnicode(const char *utf8, const int utf8Length, uint16_t *utf16, const int utf16MaxLength) -+{ -+ // p moves over the output buffer. max_ptr points to the next to the last slot of the buffer. -+ uint16_t *p = utf16; -+ uint16_t const *const maxPtr = utf16 + utf16MaxLength; -+ -+ // end_of_input points to the last byte of input as opposed to the next to the last byte. -+ char const *const endOfInput = utf8 + utf8Length - 1; -+ -+ while (utf8 <= endOfInput) -+ { -+ unsigned char const c = *utf8; -+ if (p >= maxPtr) -+ { -+ //No more output space. -+ return -1; -+ } -+ if (c < 0x80) -+ { -+ //One byte ASCII. -+ *p++ = c; -+ utf8 += 1; -+ } -+ else if (c < 0xC0) -+ { -+ // Follower byte without preceding leader bytes. -+ return -1; -+ } -+ // 11 bits -+ else if (c < 0xE0) -+ { -+ // Two byte sequence. We need one follower byte. -+ if (endOfInput - utf8 < 1 || (((utf8[1] ^ 0x80)) & 0xC0)) -+ { -+ return -1; -+ } -+ *p++ = (uint16_t)(((c & 0x1F) << 6) + (utf8[1] & 0x3F)); -+ utf8 += 2; -+ } -+ // 16 bis -+ else if (c < 0xF0) -+ { -+ // Three byte sequence. We need two follower byte. -+ if (endOfInput - utf8 < 2 || ((utf8[1] ^ 0x80) & 0xC0) || ((utf8[2] ^ 0x80) & 0xC0)) -+ { -+ return -1; -+ } -+ *p++ = (uint16_t)(((c & 0xF) << 12) + ((utf8[1] & 0x3F) << 6) + (utf8[2] & 0x3F)); -+ utf8 += 3; -+ } -+ // 21 bits -+ else if (c < 0xF8) -+ { -+ int plane; -+ // Four byte sequence. We need three follower bytes. -+ if (endOfInput - utf8 < 3 || ((utf8[1] ^ 0x80) & 0xC0) || -+ ((utf8[2] ^ 0x80) & 0xC0) || ((utf8[3] ^ 0x80) & 0xC0)) -+ { -+ return -1; -+ } -+ uint32_t unicode = ((c & 0x7) << 18) + ((utf8[1] & 0x3F) << 12) + -+ ((utf8[2] & 0x3F) << 6) + (utf8[3] & 0x3F); -+ utf8 += 4; -+ CLog::Log(LOGERROR, "CWinEventsX11::Utf8ToUnicode: 4 byte unicode not supported"); -+ } -+ // 26 bits -+ else if (c < 0xFC) -+ { -+ CLog::Log(LOGERROR, "CWinEventsX11::Utf8ToUnicode: 4 byte unicode not supported"); -+ utf8 += 5; -+ } -+ // 31 bit -+ else -+ { -+ CLog::Log(LOGERROR, "CWinEventsX11::Utf8ToUnicode: 4 byte unicode not supported"); -+ utf8 += 6; -+ } -+ } -+ return p - utf16; -+} -+ -+XBMCKey CWinEventsX11::LookupXbmcKeySym(KeySym keysym) -+{ -+ // try direct mapping first -+ std::map::iterator it; -+ it = WinEvents->m_symLookupTable.find(keysym); -+ if (it != WinEvents->m_symLookupTable.end()) -+ { -+ return (XBMCKey)(it->second); -+ } -+ -+ // try ascii mappings -+ if (keysym>>8 == 0x00) -+ return (XBMCKey)(keysym & 0xFF); -+ -+ return (XBMCKey)keysym; -+} -+#endif -diff --git a/xbmc/windowing/WinEventsX11.h b/xbmc/windowing/WinEventsX11.h -new file mode 100644 -index 0000000..e9b7553 ---- /dev/null -+++ b/xbmc/windowing/WinEventsX11.h -@@ -0,0 +1,57 @@ -+/* -+* Copyright (C) 2005-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 -+ -+#include "WinEvents.h" -+#include -+#include "threads/SystemClock.h" -+#include -+ -+class CWinEventsX11 : public CWinEventsBase -+{ -+public: -+ CWinEventsX11(); -+ virtual ~CWinEventsX11(); -+ static bool Init(Display *dpy, Window win); -+ static void Quit(); -+ static bool HasStructureChanged(); -+ static bool MessagePump(); -+ -+protected: -+ static int Utf8ToUnicode(const char *utf8, const int utf8Length, uint16_t *utf16, const int utf16MaxLength); -+ static XBMCKey LookupXbmcKeySym(KeySym keysym); -+ static bool ProcessKey(XBMC_Event &event, int repeatDelay); -+ static bool ProcessKeyRepeat(); -+ static bool ProcessShortcuts(XBMC_Event& event); -+ static CWinEventsX11 *WinEvents; -+ Display *m_display; -+ Window m_window; -+ Atom m_wmDeleteMessage; -+ char *m_keybuf; -+ uint16_t *m_utf16buf; -+ XIM m_xim; -+ XIC m_xic; -+ XBMC_Event m_lastKey; -+ XbmcThreads::EndTime m_repeatKeyTimeout; -+ std::map m_symLookupTable; -+ int m_keymodState; -+ bool m_structureChanged; -+}; -diff --git a/xbmc/windowing/X11/WinSystemX11.cpp b/xbmc/windowing/X11/WinSystemX11.cpp -index a839709..76ef462 100644 ---- a/xbmc/windowing/X11/WinSystemX11.cpp -+++ b/xbmc/windowing/X11/WinSystemX11.cpp -@@ -22,7 +22,6 @@ - - #ifdef HAS_GLX - --#include - #include "WinSystemX11.h" - #include "settings/Settings.h" - #include "guilib/Texture.h" -@@ -31,27 +30,30 @@ - #include "XRandR.h" - #include - #include "threads/SingleLock.h" --#include - #include "cores/VideoRenderers/RenderManager.h" - #include "utils/TimeUtils.h" -+#include "settings/GUISettings.h" - - #if defined(HAS_XRANDR) - #include - #endif - -+#include "../WinEvents.h" -+#include "input/MouseStat.h" -+ - using namespace std; - - CWinSystemX11::CWinSystemX11() : CWinSystemBase() - { - m_eWindowSystem = WINDOW_SYSTEM_X11; - m_glContext = NULL; -- m_SDLSurface = NULL; - m_dpy = NULL; - m_glWindow = 0; -- m_wmWindow = 0; - m_bWasFullScreenBeforeMinimize = false; - m_minimized = false; -+ m_bIgnoreNextFocusMessage = false; - m_dpyLostTime = 0; -+ m_invisibleCursor = 0; - - XSetErrorHandler(XErrorHandler); - } -@@ -64,18 +66,6 @@ bool CWinSystemX11::InitWindowSystem() - { - if ((m_dpy = XOpenDisplay(NULL))) - { -- -- SDL_EnableUNICODE(1); -- // set repeat to 10ms to ensure repeat time < frame time -- // so that hold times can be reliably detected -- SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, 10); -- -- SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8); -- SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8); -- SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8); -- SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8); -- SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); -- - return CWinSystemBase::InitWindowSystem(); - } - else -@@ -113,45 +103,37 @@ bool CWinSystemX11::DestroyWindowSystem() - - bool CWinSystemX11::CreateNewWindow(const CStdString& name, bool fullScreen, RESOLUTION_INFO& res, PHANDLE_EVENT_FUNC userFunction) - { -- RESOLUTION_INFO& desktop = g_settings.m_ResInfo[RES_DESKTOP]; -- -- if (fullScreen && -- (res.iWidth != desktop.iWidth || res.iHeight != desktop.iHeight || -- res.fRefreshRate != desktop.fRefreshRate || res.iScreen != desktop.iScreen)) -- { -- //on the first call to SDL_SetVideoMode, SDL stores the current displaymode -- //SDL restores the displaymode on SDL_QUIT(), if we change the displaymode -- //before the first call to SDL_SetVideoMode, SDL changes the displaymode back -- //to the wrong mode on exit -- -- CLog::Log(LOGINFO, "CWinSystemX11::CreateNewWindow initializing to desktop resolution first"); -- if (!SetFullScreen(true, desktop, false)) -- return false; -- } -- - if(!SetFullScreen(fullScreen, res, false)) - return false; - -- CBaseTexture* iconTexture = CTexture::LoadFromFile("special://xbmc/media/icon.png"); -- -- if (iconTexture) -- SDL_WM_SetIcon(SDL_CreateRGBSurfaceFrom(iconTexture->GetPixels(), iconTexture->GetWidth(), iconTexture->GetHeight(), 32, iconTexture->GetPitch(), 0xff0000, 0x00ff00, 0x0000ff, 0xff000000L), NULL); -- SDL_WM_SetCaption("XBMC Media Center", NULL); -- delete iconTexture; -- -- // register XRandR Events --#if defined(HAS_XRANDR) -- int iReturn; -- XRRQueryExtension(m_dpy, &m_RREventBase, &iReturn); -- XRRSelectInput(m_dpy, m_wmWindow, RRScreenChangeNotifyMask); --#endif -- - m_bWindowCreated = true; - return true; - } - - bool CWinSystemX11::DestroyWindow() - { -+ if (!m_glWindow) -+ return true; -+ -+ if (m_glContext) -+ glXMakeCurrent(m_dpy, None, NULL); -+ -+ if (m_invisibleCursor) -+ { -+ XUndefineCursor(m_dpy, m_glWindow); -+ XFreeCursor(m_dpy, m_invisibleCursor); -+ m_invisibleCursor = 0; -+ } -+ -+ CWinEvents::Quit(); -+ -+ XUnmapWindow(m_dpy, m_glWindow); -+ XSync(m_dpy,TRUE); -+ XUngrabKeyboard(m_dpy, CurrentTime); -+ XUngrabPointer(m_dpy, CurrentTime); -+ XDestroyWindow(m_dpy, m_glWindow); -+ m_glWindow = 0; -+ - return true; - } - -@@ -161,65 +143,105 @@ bool CWinSystemX11::ResizeWindow(int newWidth, int newHeight, int newLeft, int n - && m_nHeight == newHeight) - return true; - -+ if (!SetWindow(newWidth, newHeight, false)) -+ { -+ return false; -+ } -+ -+ RefreshGlxContext(); - m_nWidth = newWidth; - m_nHeight = newHeight; -+ m_bFullScreen = false; - -- int options = SDL_OPENGL; -- if (m_bFullScreen) -- options |= SDL_FULLSCREEN; -- else -- options |= SDL_RESIZABLE; -+ return false; -+} -+ -+void CWinSystemX11::RefreshWindow() -+{ -+ g_xrandr.Query(true); -+ XOutput out = g_xrandr.GetCurrentOutput(); -+ XMode mode = g_xrandr.GetCurrentMode(out.name); - -- if ((m_SDLSurface = SDL_SetVideoMode(m_nWidth, m_nHeight, 0, options))) -+ // only overwrite desktop resolution, if we are not in fullscreen mode -+ if (!g_graphicsContext.IsFullScreenVideo()) - { -- RefreshGlxContext(); -- return true; -+ CLog::Log(LOGDEBUG, "CWinSystemX11::RefreshWindow - store desktop resolution, width: %d, height: %d, hz: %2.2f", mode.w, mode.h, mode.hz); -+ UpdateDesktopResolution(g_settings.m_ResInfo[RES_DESKTOP], 0, mode.w, mode.h, mode.hz); -+ g_settings.m_ResInfo[RES_DESKTOP].strId = mode.id; -+ g_settings.m_ResInfo[RES_DESKTOP].strOutput = out.name; - } - -- return false; -+ RESOLUTION_INFO res; -+ unsigned int i; -+ bool found(false); -+ for (i = RES_DESKTOP; i < g_settings.m_ResInfo.size(); ++i) -+ { -+ if (g_settings.m_ResInfo[i].strId == mode.id) -+ { -+ found = true; -+ break; -+ } -+ } -+ -+ if (!found) -+ { -+ CLog::Log(LOGERROR, "CWinSystemX11::RefreshWindow - could not find resolution"); -+ return; -+ } -+ -+ if (g_graphicsContext.IsFullScreenRoot()) -+ g_graphicsContext.SetVideoResolution((RESOLUTION)i, true); -+ else -+ g_graphicsContext.SetVideoResolution(RES_WINDOW, true); - } - - bool CWinSystemX11::SetFullScreen(bool fullScreen, RESOLUTION_INFO& res, bool blankOtherDisplays) - { -- m_nWidth = res.iWidth; -- m_nHeight = res.iHeight; -- m_bFullScreen = fullScreen; - - #if defined(HAS_XRANDR) - XOutput out; - XMode mode; -- out.name = res.strOutput; -- mode.w = res.iWidth; -- mode.h = res.iHeight; -- mode.hz = res.fRefreshRate; -- mode.id = res.strId; -+ -+ if (fullScreen) -+ { -+ out.name = res.strOutput; -+ mode.w = res.iWidth; -+ mode.h = res.iHeight; -+ mode.hz = res.fRefreshRate; -+ mode.id = res.strId; -+ } -+ else -+ { -+ out.name = g_settings.m_ResInfo[RES_DESKTOP].strOutput; -+ mode.w = g_settings.m_ResInfo[RES_DESKTOP].iWidth; -+ mode.h = g_settings.m_ResInfo[RES_DESKTOP].iHeight; -+ mode.hz = g_settings.m_ResInfo[RES_DESKTOP].fRefreshRate; -+ mode.id = g_settings.m_ResInfo[RES_DESKTOP].strId; -+ } - -- if(m_bFullScreen) -+ XOutput currout = g_xrandr.GetCurrentOutput(); -+ XMode currmode = g_xrandr.GetCurrentMode(currout.name); -+ -+ // only call xrandr if mode changes -+ if (currout.name != out.name || currmode.w != mode.w || currmode.h != mode.h || -+ currmode.hz != mode.hz || currmode.id != mode.id) - { -+ CLog::Log(LOGNOTICE, "CWinSystemX11::SetFullScreen - calling xrandr"); - OnLostDevice(); - g_xrandr.SetMode(out, mode); - } -- else -- g_xrandr.RestoreState(); - #endif - -- int options = SDL_OPENGL; -- if (m_bFullScreen) -- options |= SDL_FULLSCREEN; -- else -- options |= SDL_RESIZABLE; -- -- if ((m_SDLSurface = SDL_SetVideoMode(m_nWidth, m_nHeight, 0, options))) -- { -- if ((m_SDLSurface->flags & SDL_OPENGL) != SDL_OPENGL) -- CLog::Log(LOGERROR, "CWinSystemX11::SetFullScreen SDL_OPENGL not set, SDL_GetError:%s", SDL_GetError()); -+ if (!SetWindow(res.iWidth, res.iHeight, fullScreen)) -+ return false; - -- RefreshGlxContext(); -+ RefreshGlxContext(); - -- return true; -- } -+ m_nWidth = res.iWidth; -+ m_nHeight = res.iHeight; -+ m_bFullScreen = fullScreen; - -- return false; -+ return true; - } - - void CWinSystemX11::UpdateResolutions() -@@ -321,17 +343,10 @@ bool CWinSystemX11::IsSuitableVisual(XVisualInfo *vInfo) - bool CWinSystemX11::RefreshGlxContext() - { - bool retVal = false; -- SDL_SysWMinfo info; -- SDL_VERSION(&info.version); -- if (SDL_GetWMInfo(&info) <= 0) -- { -- CLog::Log(LOGERROR, "Failed to get window manager info from SDL"); -- return false; -- } - -- if(m_glWindow == info.info.x11.window && m_glContext) -+ if (m_glContext) - { -- CLog::Log(LOGERROR, "GLX: Same window as before, refreshing context"); -+ CLog::Log(LOGDEBUG, "CWinSystemX11::RefreshGlxContext: refreshing context"); - glXMakeCurrent(m_dpy, None, NULL); - glXMakeCurrent(m_dpy, m_glWindow, m_glContext); - return true; -@@ -343,8 +358,6 @@ bool CWinSystemX11::RefreshGlxContext() - int availableVisuals = 0; - vMask.screen = DefaultScreen(m_dpy); - XWindowAttributes winAttr; -- m_glWindow = info.info.x11.window; -- m_wmWindow = info.info.x11.wmwindow; - - /* Assume a depth of 24 in case the below calls to XGetWindowAttributes() - or XGetVisualInfo() fail. That shouldn't happen unless something is -@@ -415,7 +428,10 @@ bool CWinSystemX11::RefreshGlxContext() - - void CWinSystemX11::ShowOSMouse(bool show) - { -- SDL_ShowCursor(show ? 1 : 0); -+ if (show) -+ XUndefineCursor(m_dpy,m_glWindow); -+ else if (m_invisibleCursor) -+ XDefineCursor(m_dpy,m_glWindow, m_invisibleCursor); - } - - void CWinSystemX11::ResetOSScreensaver() -@@ -429,8 +445,6 @@ void CWinSystemX11::ResetOSScreensaver() - { - m_screensaverReset.StartZero(); - XResetScreenSaver(m_dpy); -- //need to flush the output buffer, since we don't check for events on m_dpy -- XFlush(m_dpy); - } - } - else -@@ -446,13 +460,27 @@ void CWinSystemX11::NotifyAppActiveChange(bool bActivated) - - m_minimized = !bActivated; - } -+ -+void CWinSystemX11::NotifyAppFocusChange(bool bGaining) -+{ -+ if (bGaining && m_bWasFullScreenBeforeMinimize && !m_bIgnoreNextFocusMessage && -+ !g_graphicsContext.IsFullScreenRoot()) -+ g_graphicsContext.ToggleFullScreenRoot(); -+ if (!bGaining) -+ m_bIgnoreNextFocusMessage = false; -+} -+ - bool CWinSystemX11::Minimize() - { - m_bWasFullScreenBeforeMinimize = g_graphicsContext.IsFullScreenRoot(); - if (m_bWasFullScreenBeforeMinimize) -+ { -+ m_bIgnoreNextFocusMessage = true; - g_graphicsContext.ToggleFullScreenRoot(); -+ } -+ -+ XIconifyWindow(m_dpy, m_glWindow, DefaultScreen(m_dpy)); - -- SDL_WM_IconifyWindow(); - m_minimized = true; - return true; - } -@@ -462,13 +490,13 @@ bool CWinSystemX11::Restore() - } - bool CWinSystemX11::Hide() - { -- XUnmapWindow(m_dpy, m_wmWindow); -+ XUnmapWindow(m_dpy, m_glWindow); - XSync(m_dpy, False); - return true; - } - bool CWinSystemX11::Show(bool raise) - { -- XMapWindow(m_dpy, m_wmWindow); -+ XMapWindow(m_dpy, m_glWindow); - XSync(m_dpy, False); - m_minimized = false; - return true; -@@ -500,6 +528,7 @@ void CWinSystemX11::CheckDisplayEvents() - if (bGotEvent || bTimeout) - { - CLog::Log(LOGDEBUG, "%s - notify display reset event", __FUNCTION__); -+ RefreshWindow(); - - CSingleLock lock(m_resourceSection); - -@@ -558,4 +587,151 @@ bool CWinSystemX11::EnableFrameLimiter() - return m_minimized; - } - -+bool CWinSystemX11::SetWindow(int width, int height, bool fullscreen) -+{ -+ bool changeWindow = false; -+ bool changeSize = false; -+ bool mouseActive = false; -+ float mouseX, mouseY; -+ -+ if (m_glWindow && (m_bFullScreen != fullscreen)) -+ { -+ mouseActive = g_Mouse.IsActive(); -+ if (mouseActive) -+ { -+ Window root_return, child_return; -+ int root_x_return, root_y_return; -+ int win_x_return, win_y_return; -+ unsigned int mask_return; -+ bool isInWin = XQueryPointer(m_dpy, m_glWindow, &root_return, &child_return, -+ &root_x_return, &root_y_return, -+ &win_x_return, &win_y_return, -+ &mask_return); -+ if (isInWin) -+ { -+ mouseX = (float)win_x_return/m_nWidth; -+ mouseY = (float)win_y_return/m_nHeight; -+ g_Mouse.SetActive(false); -+ } -+ else -+ mouseActive = false; -+ } -+ DestroyWindow(); -+ } -+ -+ // create main window -+ if (!m_glWindow) -+ { -+ GLint att[] = -+ { -+ GLX_RGBA, -+ GLX_RED_SIZE, 8, -+ GLX_GREEN_SIZE, 8, -+ GLX_BLUE_SIZE, 8, -+ GLX_ALPHA_SIZE, 8, -+ GLX_DEPTH_SIZE, 24, -+ GLX_DOUBLEBUFFER, -+ None -+ }; -+ Colormap cmap; -+ XSetWindowAttributes swa; -+ XVisualInfo *vi; -+ -+ vi = glXChooseVisual(m_dpy, DefaultScreen(m_dpy), att); -+ cmap = XCreateColormap(m_dpy, RootWindow(m_dpy, vi->screen), vi->visual, AllocNone); -+ -+ int def_vis = (vi->visual == DefaultVisual(m_dpy, vi->screen)); -+ swa.override_redirect = fullscreen ? True : False; -+ swa.border_pixel = fullscreen ? 0 : 5; -+ swa.background_pixel = def_vis ? BlackPixel(m_dpy, vi->screen) : 0; -+ swa.colormap = cmap; -+ swa.background_pixel = def_vis ? BlackPixel(m_dpy, vi->screen) : 0; -+ swa.event_mask = FocusChangeMask | KeyPressMask | KeyReleaseMask | -+ ButtonPressMask | ButtonReleaseMask | PointerMotionMask | -+ PropertyChangeMask | StructureNotifyMask | KeymapStateMask | -+ EnterWindowMask | LeaveWindowMask | ExposureMask; -+ unsigned long mask = CWBackPixel | CWBorderPixel | CWColormap | CWOverrideRedirect | CWEventMask; -+ -+ m_glWindow = XCreateWindow(m_dpy, RootWindow(m_dpy, vi->screen), -+ 0, 0, width, height, 0, vi->depth, -+ InputOutput, vi->visual, -+ mask, &swa); -+ -+ // define invisible cursor -+ Pixmap bitmapNoData; -+ XColor black; -+ static char noData[] = { 0,0,0,0,0,0,0,0 }; -+ black.red = black.green = black.blue = 0; -+ -+ bitmapNoData = XCreateBitmapFromData(m_dpy, m_glWindow, noData, 8, 8); -+ m_invisibleCursor = XCreatePixmapCursor(m_dpy, bitmapNoData, bitmapNoData, -+ &black, &black, 0, 0); -+ XFreePixmap(m_dpy, bitmapNoData); -+ XDefineCursor(m_dpy,m_glWindow, m_invisibleCursor); -+ -+ //init X11 events -+ CWinEvents::Init(m_dpy, m_glWindow); -+ -+ changeWindow = true; -+ changeSize = true; -+ } -+ -+ if (!CWinEvents::HasStructureChanged() && ((width != m_nWidth) || (height != m_nHeight))) -+ { -+ changeSize = true; -+ } -+ -+ if (changeSize || changeWindow) -+ { -+ XResizeWindow(m_dpy, m_glWindow, width, height); -+ } -+ -+ if (changeWindow) -+ { -+ if (!fullscreen) -+ { -+ XWMHints wm_hints; -+ XClassHint class_hints; -+ XTextProperty windowName, iconName; -+ std::string titleString = "XBMC Media Center"; -+ char *title = (char*)titleString.c_str(); -+ -+ XStringListToTextProperty(&title, 1, &windowName); -+ XStringListToTextProperty(&title, 1, &iconName); -+ wm_hints.initial_state = NormalState; -+ wm_hints.input = True; -+ wm_hints.icon_pixmap = None; -+ wm_hints.flags = StateHint | IconPixmapHint | InputHint; -+ -+ XSetWMProperties(m_dpy, m_glWindow, &windowName, &iconName, -+ NULL, 0, NULL, &wm_hints, -+ NULL); -+ -+ // register interest in the delete window message -+ Atom wmDeleteMessage = XInternAtom(m_dpy, "WM_DELETE_WINDOW", False); -+ XSetWMProtocols(m_dpy, m_glWindow, &wmDeleteMessage, 1); -+ } -+ XMapRaised(m_dpy, m_glWindow); -+ XSync(m_dpy,TRUE); -+ -+ if (changeWindow && mouseActive) -+ { -+ XWarpPointer(m_dpy, None, m_glWindow, 0, 0, 0, 0, mouseX*width, mouseY*height); -+ } -+ -+ if (fullscreen) -+ { -+ int result = -1; -+ while (result != GrabSuccess) -+ { -+ result = XGrabPointer(m_dpy, m_glWindow, True, ButtonPressMask, GrabModeAsync, GrabModeAsync, m_glWindow, None, CurrentTime); -+ XbmcThreads::ThreadSleep(100); -+ } -+ XGrabKeyboard(m_dpy, m_glWindow, True, GrabModeAsync, GrabModeAsync, CurrentTime); -+ -+ } -+ } -+ return true; -+} -+ - #endif -diff --git a/xbmc/windowing/X11/WinSystemX11.h b/xbmc/windowing/X11/WinSystemX11.h -index 2dd8a9f..9616d17 100644 ---- a/xbmc/windowing/X11/WinSystemX11.h -+++ b/xbmc/windowing/X11/WinSystemX11.h -@@ -52,6 +52,7 @@ class CWinSystemX11 : public CWinSystemBase - virtual bool EnableFrameLimiter(); - - virtual void NotifyAppActiveChange(bool bActivated); -+ virtual void NotifyAppFocusChange(bool bGaining); - - virtual bool Minimize(); - virtual bool Restore() ; -@@ -64,19 +65,21 @@ class CWinSystemX11 : public CWinSystemBase - Display* GetDisplay() { return m_dpy; } - GLXWindow GetWindow() { return m_glWindow; } - GLXContext GetGlxContext() { return m_glContext; } -+ void RefreshWindow(); - - protected: - bool RefreshGlxContext(); - void CheckDisplayEvents(); - void OnLostDevice(); -+ bool SetWindow(int width, int height, bool fullscreen); - -- SDL_Surface* m_SDLSurface; -+ Window m_glWindow; - GLXContext m_glContext; -- GLXWindow m_glWindow; -- Window m_wmWindow; - Display* m_dpy; -+ Cursor m_invisibleCursor; - bool m_bWasFullScreenBeforeMinimize; - bool m_minimized; -+ bool m_bIgnoreNextFocusMessage; - int m_RREventBase; - CCriticalSection m_resourceSection; - std::vector m_resources; --- -1.8.1.6 - - -From e771f1b96d6f77358720b58362ed525cc9b9f01f Mon Sep 17 00:00:00 2001 -From: FernetMenta -Date: Thu, 5 Jul 2012 15:24:22 +0200 -Subject: [PATCH 36/94] X11: Add xbmc icon - ---- - xbmc/windowing/X11/WinSystemX11.cpp | 126 +++++++++++++++++++++++++++++++++++- - xbmc/windowing/X11/WinSystemX11.h | 2 + - 2 files changed, 127 insertions(+), 1 deletion(-) - -diff --git a/xbmc/windowing/X11/WinSystemX11.cpp b/xbmc/windowing/X11/WinSystemX11.cpp -index 76ef462..c854598 100644 ---- a/xbmc/windowing/X11/WinSystemX11.cpp -+++ b/xbmc/windowing/X11/WinSystemX11.cpp -@@ -134,6 +134,9 @@ bool CWinSystemX11::DestroyWindow() - XDestroyWindow(m_dpy, m_glWindow); - m_glWindow = 0; - -+ if (m_icon) -+ XFreePixmap(m_dpy, m_icon); -+ - return true; - } - -@@ -688,8 +691,10 @@ bool CWinSystemX11::SetWindow(int width, int height, bool fullscreen) - - if (changeWindow) - { -+ m_icon = None; - if (!fullscreen) - { -+ CreateIconPixmap(); - XWMHints wm_hints; - XClassHint class_hints; - XTextProperty windowName, iconName; -@@ -700,7 +705,7 @@ bool CWinSystemX11::SetWindow(int width, int height, bool fullscreen) - XStringListToTextProperty(&title, 1, &iconName); - wm_hints.initial_state = NormalState; - wm_hints.input = True; -- wm_hints.icon_pixmap = None; -+ wm_hints.icon_pixmap = m_icon; - wm_hints.flags = StateHint | IconPixmapHint | InputHint; - - XSetWMProperties(m_dpy, m_glWindow, &windowName, &iconName, -@@ -734,4 +739,123 @@ bool CWinSystemX11::SetWindow(int width, int height, bool fullscreen) - return true; - } - -+bool CWinSystemX11::CreateIconPixmap() -+{ -+ int depth; -+ XImage *img = NULL; -+ Visual *vis; -+ XWindowAttributes wndattribs; -+ XVisualInfo visInfo; -+ double rRatio; -+ double gRatio; -+ double bRatio; -+ int outIndex = 0; -+ int i,j; -+ int numBufBytes; -+ unsigned char *buf; -+ uint32_t *newBuf = 0; -+ size_t numNewBufBytes; -+ -+ // Get visual Info -+ XGetWindowAttributes(m_dpy, m_glWindow, &wndattribs); -+ visInfo.visualid = wndattribs.visual->visualid; -+ int nvisuals = 0; -+ XVisualInfo* visuals = XGetVisualInfo(m_dpy, VisualIDMask, &visInfo, &nvisuals); -+ if (nvisuals != 1) -+ { -+ CLog::Log(LOGERROR, "CWinSystemX11::CreateIconPixmap - could not find visual"); -+ return false; -+ } -+ visInfo = visuals[0]; -+ XFree(visuals); -+ -+ depth = visInfo.depth; -+ vis = visInfo.visual; -+ -+ if (depth < 15) -+ { -+ CLog::Log(LOGERROR, "CWinSystemX11::CreateIconPixmap - no suitable depth"); -+ return false; -+ } -+ -+ rRatio = vis->red_mask / 255.0; -+ gRatio = vis->green_mask / 255.0; -+ bRatio = vis->blue_mask / 255.0; -+ -+ CTexture iconTexture; -+ iconTexture.LoadFromFile("special://xbmc/media/icon.png"); -+ buf = iconTexture.GetPixels(); -+ -+ numBufBytes = iconTexture.GetWidth() * iconTexture.GetHeight() * 4; -+ -+ if (depth>=24) -+ numNewBufBytes = (4 * (iconTexture.GetWidth() * iconTexture.GetHeight())); -+ else -+ numNewBufBytes = (2 * (iconTexture.GetWidth() * iconTexture.GetHeight())); -+ -+ newBuf = (uint32_t*)malloc(numNewBufBytes); -+ if (!newBuf) -+ { -+ CLog::Log(LOGERROR, "CWinSystemX11::CreateIconPixmap - malloc failed"); -+ return false; -+ } -+ -+ for (i=0; ired_mask; -+ g &= vis->green_mask; -+ b &= vis->blue_mask; -+ newBuf[outIndex] = r | g | b; -+ ++outIndex; -+ } -+ } -+ img = XCreateImage(m_dpy, vis, depth,ZPixmap, 0, (char *)newBuf, -+ iconTexture.GetWidth(), iconTexture.GetHeight(), -+ (depth>=24)?32:16, 0); -+ if (!img) -+ { -+ CLog::Log(LOGERROR, "CWinSystemX11::CreateIconPixmap - could not create image"); -+ free(newBuf); -+ return false; -+ } -+ if (!XInitImage(img)) -+ { -+ CLog::Log(LOGERROR, "CWinSystemX11::CreateIconPixmap - init image failed"); -+ XDestroyImage(img); -+ return false; -+ } -+ -+ // set byte order -+ union -+ { -+ char c[sizeof(short)]; -+ short s; -+ } order; -+ order.s = 1; -+ if ((1 == order.c[0])) -+ { -+ img->byte_order = LSBFirst; -+ } -+ else -+ { -+ img->byte_order = MSBFirst; -+ } -+ -+ // create icon pixmap from image -+ m_icon = XCreatePixmap(m_dpy, m_glWindow, img->width, img->height, depth); -+ GC gc = XCreateGC(m_dpy, m_glWindow, 0, NULL); -+ XPutImage(m_dpy, m_icon, gc, img, 0, 0, 0, 0, img->width, img->height); -+ XFreeGC(m_dpy, gc); -+ XDestroyImage(img); // this also frees newBuf -+ -+ return true; -+} -+ - #endif -diff --git a/xbmc/windowing/X11/WinSystemX11.h b/xbmc/windowing/X11/WinSystemX11.h -index 9616d17..debf714 100644 ---- a/xbmc/windowing/X11/WinSystemX11.h -+++ b/xbmc/windowing/X11/WinSystemX11.h -@@ -77,6 +77,7 @@ class CWinSystemX11 : public CWinSystemBase - GLXContext m_glContext; - Display* m_dpy; - Cursor m_invisibleCursor; -+ Pixmap m_icon; - bool m_bWasFullScreenBeforeMinimize; - bool m_minimized; - bool m_bIgnoreNextFocusMessage; -@@ -88,6 +89,7 @@ class CWinSystemX11 : public CWinSystemBase - private: - bool IsSuitableVisual(XVisualInfo *vInfo); - static int XErrorHandler(Display* dpy, XErrorEvent* error); -+ bool CreateIconPixmap(); - - CStopWatch m_screensaverReset; - }; --- -1.8.1.6 - - -From 2a6b9a273a99c30cef58e083b6afd61c5cb4d20c Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Sun, 20 May 2012 14:11:26 +0200 -Subject: [PATCH 37/94] X11: add SDL joystick until we have a better solution - ---- - xbmc/windowing/WinEventsX11.cpp | 26 ++++++++++++++++++++++++++ - 1 file changed, 26 insertions(+) - -diff --git a/xbmc/windowing/WinEventsX11.cpp b/xbmc/windowing/WinEventsX11.cpp -index 24477ae..2ec86a8 100644 ---- a/xbmc/windowing/WinEventsX11.cpp -+++ b/xbmc/windowing/WinEventsX11.cpp -@@ -35,6 +35,10 @@ - #include "guilib/GUIWindowManager.h" - #include "input/MouseStat.h" - -+#ifdef HAS_SDL_JOYSTICK -+#include "input/SDLJoystick.h" -+#endif -+ - CWinEventsX11* CWinEventsX11::WinEvents = 0; - - static uint32_t SymMappingsX11[][2] = -@@ -547,6 +551,28 @@ bool CWinEventsX11::MessagePump() - - ret |= ProcessKeyRepeat(); - -+#ifdef HAS_SDL_JOYSTICK -+ SDL_Event event; -+ while (SDL_PollEvent(&event)) -+ { -+ switch(event.type) -+ { -+ case SDL_JOYBUTTONUP: -+ case SDL_JOYBUTTONDOWN: -+ case SDL_JOYAXISMOTION: -+ case SDL_JOYBALLMOTION: -+ case SDL_JOYHATMOTION: -+ g_Joystick.Update(event); -+ ret = true; -+ break; -+ -+ default: -+ break; -+ } -+ memset(&event, 0, sizeof(SDL_Event)); -+ } -+#endif -+ - return ret; - } - --- -1.8.1.6 - - -From 1fb4ee276dee8b7aad61bb8be2c8debac050ca07 Mon Sep 17 00:00:00 2001 -From: Joakim Plate -Date: Thu, 5 Jul 2012 12:35:55 +0200 -Subject: [PATCH 38/94] X11: factor out code handling device reset notification - ---- - xbmc/windowing/X11/WinSystemX11.cpp | 22 ++++++++++++++-------- - xbmc/windowing/X11/WinSystemX11.h | 1 + - 2 files changed, 15 insertions(+), 8 deletions(-) - -diff --git a/xbmc/windowing/X11/WinSystemX11.cpp b/xbmc/windowing/X11/WinSystemX11.cpp -index c854598..70557d0 100644 ---- a/xbmc/windowing/X11/WinSystemX11.cpp -+++ b/xbmc/windowing/X11/WinSystemX11.cpp -@@ -530,14 +530,7 @@ void CWinSystemX11::CheckDisplayEvents() - - if (bGotEvent || bTimeout) - { -- CLog::Log(LOGDEBUG, "%s - notify display reset event", __FUNCTION__); -- RefreshWindow(); -- -- CSingleLock lock(m_resourceSection); -- -- // tell any shared resources -- for (vector::iterator i = m_resources.begin(); i != m_resources.end(); i++) -- (*i)->OnResetDevice(); -+ NotifyXRREvent(); - - // reset fail safe timer - m_dpyLostTime = 0; -@@ -545,6 +538,19 @@ void CWinSystemX11::CheckDisplayEvents() - #endif - } - -+void CWinSystemX11::NotifyXRREvent() -+{ -+ CLog::Log(LOGDEBUG, "%s - notify display reset event", __FUNCTION__); -+ RefreshWindow(); -+ -+ CSingleLock lock(m_resourceSection); -+ -+ // tell any shared resources -+ for (vector::iterator i = m_resources.begin(); i != m_resources.end(); i++) -+ (*i)->OnResetDevice(); -+ -+} -+ - void CWinSystemX11::OnLostDevice() - { - CLog::Log(LOGDEBUG, "%s - notify display change event", __FUNCTION__); -diff --git a/xbmc/windowing/X11/WinSystemX11.h b/xbmc/windowing/X11/WinSystemX11.h -index debf714..8c28e3f 100644 ---- a/xbmc/windowing/X11/WinSystemX11.h -+++ b/xbmc/windowing/X11/WinSystemX11.h -@@ -66,6 +66,7 @@ class CWinSystemX11 : public CWinSystemBase - GLXWindow GetWindow() { return m_glWindow; } - GLXContext GetGlxContext() { return m_glContext; } - void RefreshWindow(); -+ void NotifyXRREvent(); - - protected: - bool RefreshGlxContext(); --- -1.8.1.6 - - -From d0268b4a14addd0564c6e1c3090ac844d12a3f31 Mon Sep 17 00:00:00 2001 -From: FernetMenta -Date: Thu, 5 Jul 2012 15:02:00 +0200 -Subject: [PATCH 39/94] X11: move xrandr events to WinEventsX11 - ---- - xbmc/windowing/WinEventsX11.cpp | 42 +++++++++++++++++++++++++++++++++++++ - xbmc/windowing/WinEventsX11.h | 5 +++++ - xbmc/windowing/X11/WinSystemX11.cpp | 6 +++++- - 3 files changed, 52 insertions(+), 1 deletion(-) - -diff --git a/xbmc/windowing/WinEventsX11.cpp b/xbmc/windowing/WinEventsX11.cpp -index 2ec86a8..5946a33 100644 ---- a/xbmc/windowing/WinEventsX11.cpp -+++ b/xbmc/windowing/WinEventsX11.cpp -@@ -35,6 +35,10 @@ - #include "guilib/GUIWindowManager.h" - #include "input/MouseStat.h" - -+#if defined(HAS_XRANDR) -+#include -+#endif -+ - #ifdef HAS_SDL_JOYSTICK - #include "input/SDLJoystick.h" - #endif -@@ -203,6 +207,7 @@ bool CWinEventsX11::Init(Display *dpy, Window win) - WinEvents->m_keymodState = 0; - WinEvents->m_wmDeleteMessage = XInternAtom(dpy, "WM_DELETE_WINDOW", False); - WinEvents->m_structureChanged = false; -+ WinEvents->m_xrrEventPending = false; - memset(&(WinEvents->m_lastKey), 0, sizeof(XBMC_Event)); - - // open input method -@@ -266,6 +271,13 @@ bool CWinEventsX11::Init(Display *dpy, Window win) - WinEvents->m_symLookupTable[SymMappingsX11[i][0]] = SymMappingsX11[i][1]; - } - -+ // register for xrandr events -+#if defined(HAS_XRANDR) -+ int iReturn; -+ XRRQueryExtension(WinEvents->m_display, &WinEvents->m_RREventBase, &iReturn); -+ XRRSelectInput(WinEvents->m_display, WinEvents->m_window, RRScreenChangeNotifyMask); -+#endif -+ - return true; - } - -@@ -288,6 +300,15 @@ bool CWinEventsX11::HasStructureChanged() - return ret; - } - -+void CWinEventsX11::SetXRRFailSafeTimer(int millis) -+{ -+ if (!WinEvents) -+ return; -+ -+ WinEvents->m_xrrFailSafeTimer.Set(millis); -+ WinEvents->m_xrrEventPending = true; -+} -+ - bool CWinEventsX11::MessagePump() - { - if (!WinEvents) -@@ -547,10 +568,31 @@ bool CWinEventsX11::MessagePump() - break; - } - }// switch event.type -+ -+#if defined(HAS_XRANDR) -+ if (WinEvents && (xevent.type == WinEvents->m_RREventBase + RRScreenChangeNotify)) -+ { -+ XRRUpdateConfiguration(&xevent); -+ if (xevent.xgeneric.serial != serial) -+ g_Windowing.NotifyXRREvent(); -+ WinEvents->m_xrrEventPending = false; -+ serial = xevent.xgeneric.serial; -+ } -+#endif -+ - }// while - - ret |= ProcessKeyRepeat(); - -+#if defined(HAS_XRANDR) -+ if (WinEvents && WinEvents->m_xrrEventPending && WinEvents->m_xrrFailSafeTimer.IsTimePast()) -+ { -+ CLog::Log(LOGERROR,"CWinEventsX11::MessagePump - missed XRR Events"); -+ g_Windowing.NotifyXRREvent(); -+ WinEvents->m_xrrEventPending = false; -+ } -+#endif -+ - #ifdef HAS_SDL_JOYSTICK - SDL_Event event; - while (SDL_PollEvent(&event)) -diff --git a/xbmc/windowing/WinEventsX11.h b/xbmc/windowing/WinEventsX11.h -index e9b7553..6100933 100644 ---- a/xbmc/windowing/WinEventsX11.h -+++ b/xbmc/windowing/WinEventsX11.h -@@ -33,6 +33,8 @@ class CWinEventsX11 : public CWinEventsBase - static bool Init(Display *dpy, Window win); - static void Quit(); - static bool HasStructureChanged(); -+ static void PendingResize(int width, int height); -+ static void SetXRRFailSafeTimer(int millis); - static bool MessagePump(); - - protected: -@@ -54,4 +56,7 @@ class CWinEventsX11 : public CWinEventsBase - std::map m_symLookupTable; - int m_keymodState; - bool m_structureChanged; -+ int m_RREventBase; -+ XbmcThreads::EndTime m_xrrFailSafeTimer; -+ bool m_xrrEventPending; - }; -diff --git a/xbmc/windowing/X11/WinSystemX11.cpp b/xbmc/windowing/X11/WinSystemX11.cpp -index 70557d0..1cce843 100644 ---- a/xbmc/windowing/X11/WinSystemX11.cpp -+++ b/xbmc/windowing/X11/WinSystemX11.cpp -@@ -507,7 +507,7 @@ bool CWinSystemX11::Show(bool raise) - - void CWinSystemX11::CheckDisplayEvents() - { --#if defined(HAS_XRANDR) -+#if defined(HAS_XRANDR) && defined(HAS_SDL_VIDEO_X11) - bool bGotEvent(false); - bool bTimeout(false); - XEvent Event; -@@ -563,8 +563,12 @@ void CWinSystemX11::OnLostDevice() - (*i)->OnLostDevice(); - } - -+#if defined(HAS_SDL_VIDEO_X11) - // fail safe timer - m_dpyLostTime = CurrentHostCounter(); -+#else -+ CWinEvents::SetXRRFailSafeTimer(3000); -+#endif - } - - void CWinSystemX11::Register(IDispResource *resource) --- -1.8.1.6 - - -From 2a5d2c53118b7bf1cf7636f6d9aa95b835364832 Mon Sep 17 00:00:00 2001 -From: FernetMenta -Date: Thu, 12 Apr 2012 15:43:56 +0200 -Subject: [PATCH 40/94] xrandr: remove method RestoreState - ---- - xbmc/windowing/X11/WinSystemX11.cpp | 13 +++++++++++-- - xbmc/windowing/X11/XRandR.cpp | 19 ------------------- - xbmc/windowing/X11/XRandR.h | 1 - - 3 files changed, 11 insertions(+), 22 deletions(-) - -diff --git a/xbmc/windowing/X11/WinSystemX11.cpp b/xbmc/windowing/X11/WinSystemX11.cpp -index 1cce843..e13ffa4 100644 ---- a/xbmc/windowing/X11/WinSystemX11.cpp -+++ b/xbmc/windowing/X11/WinSystemX11.cpp -@@ -77,9 +77,18 @@ bool CWinSystemX11::InitWindowSystem() - bool CWinSystemX11::DestroyWindowSystem() - { - #if defined(HAS_XRANDR) -- //restore videomode on exit -+ //restore desktop resolution on exit - if (m_bFullScreen) -- g_xrandr.RestoreState(); -+ { -+ XOutput out; -+ XMode mode; -+ out.name = g_settings.m_ResInfo[RES_DESKTOP].strOutput; -+ mode.w = g_settings.m_ResInfo[RES_DESKTOP].iWidth; -+ mode.h = g_settings.m_ResInfo[RES_DESKTOP].iHeight; -+ mode.hz = g_settings.m_ResInfo[RES_DESKTOP].fRefreshRate; -+ mode.id = g_settings.m_ResInfo[RES_DESKTOP].strId; -+ g_xrandr.SetMode(out, mode); -+ } - #endif - - if (m_dpy) -diff --git a/xbmc/windowing/X11/XRandR.cpp b/xbmc/windowing/X11/XRandR.cpp -index d8e9161..59755a6 100644 ---- a/xbmc/windowing/X11/XRandR.cpp -+++ b/xbmc/windowing/X11/XRandR.cpp -@@ -139,25 +139,6 @@ void CXRandR::SaveState() - Query(true); - } - --void CXRandR::RestoreState() --{ -- vector::iterator outiter; -- for (outiter=m_current.begin() ; outiter!=m_current.end() ; outiter++) -- { -- vector modes = (*outiter).modes; -- vector::iterator modeiter; -- for (modeiter=modes.begin() ; modeiter!=modes.end() ; modeiter++) -- { -- XMode mode = *modeiter; -- if (mode.isCurrent) -- { -- SetMode(*outiter, mode); -- return; -- } -- } -- } --} -- - bool CXRandR::SetMode(XOutput output, XMode mode) - { - if ((output.name == m_currentOutput && mode.id == m_currentMode) || (output.name == "" && mode.id == "")) -diff --git a/xbmc/windowing/X11/XRandR.h b/xbmc/windowing/X11/XRandR.h -index 2a269d0..5b64633 100644 ---- a/xbmc/windowing/X11/XRandR.h -+++ b/xbmc/windowing/X11/XRandR.h -@@ -99,7 +99,6 @@ class CXRandR - bool SetMode(XOutput output, XMode mode); - void LoadCustomModeLinesToAllOutputs(void); - void SaveState(); -- void RestoreState(); - //bool Has1080i(); - //bool Has1080p(); - //bool Has720p(); --- -1.8.1.6 - - -From a9567d6413d1c2fd1f8fdbc51f0cb6ca3c19dc5d Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Sun, 20 May 2012 13:17:10 +0200 -Subject: [PATCH 41/94] xrandr: observe orientation - ---- - xbmc/windowing/X11/WinSystemX11.cpp | 61 +++++++++++++++++++++++++++++++++++-- - xbmc/windowing/X11/WinSystemX11.h | 2 ++ - xbmc/windowing/X11/XRandR.cpp | 7 +++++ - xbmc/windowing/X11/XRandR.h | 1 + - 4 files changed, 68 insertions(+), 3 deletions(-) - -diff --git a/xbmc/windowing/X11/WinSystemX11.cpp b/xbmc/windowing/X11/WinSystemX11.cpp -index e13ffa4..6b0aa92 100644 ---- a/xbmc/windowing/X11/WinSystemX11.cpp -+++ b/xbmc/windowing/X11/WinSystemX11.cpp -@@ -170,15 +170,24 @@ bool CWinSystemX11::ResizeWindow(int newWidth, int newHeight, int newLeft, int n - - void CWinSystemX11::RefreshWindow() - { -- g_xrandr.Query(true); -+ if (!g_xrandr.Query(true)) -+ { -+ CLog::Log(LOGERROR, "WinSystemX11::RefreshWindow - failed to query xrandr"); -+ return; -+ } - XOutput out = g_xrandr.GetCurrentOutput(); - XMode mode = g_xrandr.GetCurrentMode(out.name); - -+ RotateResolutions(); -+ - // only overwrite desktop resolution, if we are not in fullscreen mode - if (!g_graphicsContext.IsFullScreenVideo()) - { - CLog::Log(LOGDEBUG, "CWinSystemX11::RefreshWindow - store desktop resolution, width: %d, height: %d, hz: %2.2f", mode.w, mode.h, mode.hz); -- UpdateDesktopResolution(g_settings.m_ResInfo[RES_DESKTOP], 0, mode.w, mode.h, mode.hz); -+ if (!out.isRotated) -+ UpdateDesktopResolution(g_settings.m_ResInfo[RES_DESKTOP], 0, mode.w, mode.h, mode.hz); -+ else -+ UpdateDesktopResolution(g_settings.m_ResInfo[RES_DESKTOP], 0, mode.h, mode.w, mode.hz); - g_settings.m_ResInfo[RES_DESKTOP].strId = mode.id; - g_settings.m_ResInfo[RES_DESKTOP].strOutput = out.name; - } -@@ -234,6 +243,14 @@ bool CWinSystemX11::SetFullScreen(bool fullScreen, RESOLUTION_INFO& res, bool bl - XOutput currout = g_xrandr.GetCurrentOutput(); - XMode currmode = g_xrandr.GetCurrentMode(currout.name); - -+ // flip h/w when rotated -+ if (m_bIsRotated) -+ { -+ int w = mode.w; -+ mode.w = mode.h; -+ mode.h = w; -+ } -+ - // only call xrandr if mode changes - if (currout.name != out.name || currmode.w != mode.w || currmode.h != mode.h || - currmode.hz != mode.hz || currmode.id != mode.id) -@@ -266,7 +283,11 @@ void CWinSystemX11::UpdateResolutions() - { - XOutput out = g_xrandr.GetCurrentOutput(); - XMode mode = g_xrandr.GetCurrentMode(out.name); -- UpdateDesktopResolution(g_settings.m_ResInfo[RES_DESKTOP], 0, mode.w, mode.h, mode.hz); -+ m_bIsRotated = out.isRotated; -+ if (!m_bIsRotated) -+ UpdateDesktopResolution(g_settings.m_ResInfo[RES_DESKTOP], 0, mode.w, mode.h, mode.hz); -+ else -+ UpdateDesktopResolution(g_settings.m_ResInfo[RES_DESKTOP], 0, mode.h, mode.w, mode.hz); - g_settings.m_ResInfo[RES_DESKTOP].strId = mode.id; - g_settings.m_ResInfo[RES_DESKTOP].strOutput = out.name; - } -@@ -305,6 +326,16 @@ void CWinSystemX11::UpdateResolutions() - res.iHeight = mode.h; - res.iScreenWidth = mode.w; - res.iScreenHeight = mode.h; -+ if (!m_bIsRotated) -+ { -+ res.iWidth = mode.w; -+ res.iHeight = mode.h; -+ } -+ else -+ { -+ res.iWidth = mode.h; -+ res.iHeight = mode.w; -+ } - if (mode.h>0 && mode.w>0 && out.hmm>0 && out.wmm>0) - res.fPixelRatio = ((float)out.wmm/(float)mode.w) / (((float)out.hmm/(float)mode.h)); - else -@@ -332,6 +363,30 @@ void CWinSystemX11::UpdateResolutions() - - } - -+void CWinSystemX11::RotateResolutions() -+{ -+#if defined(HAS_XRANDR) -+ XOutput out = g_xrandr.GetCurrentOutput(); -+ if (out.isRotated == m_bIsRotated) -+ return; -+ -+ for (unsigned int i = 0; i < g_settings.m_ResInfo.size(); ++i) -+ { -+ int width = g_settings.m_ResInfo[i].iWidth; -+ g_settings.m_ResInfo[i].iWidth = g_settings.m_ResInfo[i].iHeight; -+ g_settings.m_ResInfo[i].iHeight = width; -+ } -+ // update desktop resolution -+// int h = g_settings.m_ResInfo[RES_DESKTOP].iHeight; -+// int w = g_settings.m_ResInfo[RES_DESKTOP].iWidth; -+// float hz = g_settings.m_ResInfo[RES_DESKTOP].fRefreshRate; -+// UpdateDesktopResolution(g_settings.m_ResInfo[RES_DESKTOP], 0, w, h, hz); -+ -+ m_bIsRotated = out.isRotated; -+ -+#endif -+} -+ - bool CWinSystemX11::IsSuitableVisual(XVisualInfo *vInfo) - { - int value; -diff --git a/xbmc/windowing/X11/WinSystemX11.h b/xbmc/windowing/X11/WinSystemX11.h -index 8c28e3f..93cf5db 100644 ---- a/xbmc/windowing/X11/WinSystemX11.h -+++ b/xbmc/windowing/X11/WinSystemX11.h -@@ -73,12 +73,14 @@ class CWinSystemX11 : public CWinSystemBase - void CheckDisplayEvents(); - void OnLostDevice(); - bool SetWindow(int width, int height, bool fullscreen); -+ void RotateResolutions(); - - Window m_glWindow; - GLXContext m_glContext; - Display* m_dpy; - Cursor m_invisibleCursor; - Pixmap m_icon; -+ bool m_bIsRotated; - bool m_bWasFullScreenBeforeMinimize; - bool m_minimized; - bool m_bIgnoreNextFocusMessage; -diff --git a/xbmc/windowing/X11/XRandR.cpp b/xbmc/windowing/X11/XRandR.cpp -index 59755a6..45aeb71 100644 ---- a/xbmc/windowing/X11/XRandR.cpp -+++ b/xbmc/windowing/X11/XRandR.cpp -@@ -98,6 +98,13 @@ bool CXRandR::Query(bool force) - xoutput.y = (output->Attribute("y") != NULL ? atoi(output->Attribute("y")) : 0); - xoutput.wmm = (output->Attribute("wmm") != NULL ? atoi(output->Attribute("wmm")) : 0); - xoutput.hmm = (output->Attribute("hmm") != NULL ? atoi(output->Attribute("hmm")) : 0); -+ if (output->Attribute("rotation") != NULL -+ && (strcasecmp(output->Attribute("rotation"), "left") == 0 || strcasecmp(output->Attribute("rotation"), "right") == 0)) -+ { -+ xoutput.isRotated = true; -+ } -+ else -+ xoutput.isRotated = false; - - if (!xoutput.isConnected) - continue; -diff --git a/xbmc/windowing/X11/XRandR.h b/xbmc/windowing/X11/XRandR.h -index 5b64633..618bd68 100644 ---- a/xbmc/windowing/X11/XRandR.h -+++ b/xbmc/windowing/X11/XRandR.h -@@ -86,6 +86,7 @@ class XOutput - int wmm; - int hmm; - std::vector modes; -+ bool isRotated; - }; - - class CXRandR --- -1.8.1.6 - - -From d3c2af7c408efbf313db86d43b0959b03f5bbb0f Mon Sep 17 00:00:00 2001 -From: FernetMenta -Date: Thu, 5 Jul 2012 11:54:15 +0200 -Subject: [PATCH 42/94] xrandr: allow getting info for multiple screen's - -Refactored by: Joakim Plate ---- - xbmc/windowing/X11/XRandR.cpp | 65 +++++++++++++++++++++++++++++++++---------- - xbmc/windowing/X11/XRandR.h | 8 ++++-- - 2 files changed, 57 insertions(+), 16 deletions(-) - -diff --git a/xbmc/windowing/X11/XRandR.cpp b/xbmc/windowing/X11/XRandR.cpp -index 45aeb71..cc933b9 100644 ---- a/xbmc/windowing/X11/XRandR.cpp -+++ b/xbmc/windowing/X11/XRandR.cpp -@@ -39,6 +39,7 @@ - CXRandR::CXRandR(bool query) - { - m_bInit = false; -+ m_numScreens = 1; - if (query) - Query(); - } -@@ -55,11 +56,21 @@ bool CXRandR::Query(bool force) - return false; - - m_outputs.clear(); -- m_current.clear(); -+ // query all screens -+ for(unsigned int screennum=0; screennumValue(), "screen") != 0) -+ if (strcasecmp(pRootElement->Value(), "screen") != screennum) - { - // TODO ERROR - return false; -@@ -92,6 +103,7 @@ bool CXRandR::Query(bool force) - xoutput.name.TrimLeft(" \n\r\t"); - xoutput.name.TrimRight(" \n\r\t"); - xoutput.isConnected = (strcasecmp(output->Attribute("connected"), "true") == 0); -+ xoutput.screen = screennum; - xoutput.w = (output->Attribute("w") != NULL ? atoi(output->Attribute("w")) : 0); - xoutput.h = (output->Attribute("h") != NULL ? atoi(output->Attribute("h")) : 0); - xoutput.x = (output->Attribute("x") != NULL ? atoi(output->Attribute("x")) : 0); -@@ -123,7 +135,6 @@ bool CXRandR::Query(bool force) - xoutput.modes.push_back(xmode); - if (xmode.isCurrent) - { -- m_current.push_back(xoutput); - hascurrent = true; - } - } -@@ -247,17 +258,6 @@ bool CXRandR::SetMode(XOutput output, XMode mode) - return true; - } - --XOutput CXRandR::GetCurrentOutput() --{ -- Query(); -- for (unsigned int j = 0; j < m_outputs.size(); j++) -- { -- if(m_outputs[j].isConnected) -- return m_outputs[j]; -- } -- XOutput empty; -- return empty; --} - XMode CXRandR::GetCurrentMode(CStdString outputName) - { - Query(); -@@ -331,6 +331,43 @@ void CXRandR::LoadCustomModeLinesToAllOutputs(void) - } - } - -+void CXRandR::SetNumScreens(unsigned int num) -+{ -+ m_numScreens = num; -+ m_bInit = false; -+} -+ -+bool CXRandR::IsOutputConnected(CStdString name) -+{ -+ bool result = false; -+ Query(); -+ -+ for (unsigned int i = 0; i < m_outputs.size(); ++i) -+ { -+ if (m_outputs[i].name == name) -+ { -+ result = true; -+ break; -+ } -+ } -+ return result; -+} -+ -+XOutput* CXRandR::GetOutput(CStdString outputName) -+{ -+ XOutput *result = 0; -+ Query(); -+ for (unsigned int i = 0; i < m_outputs.size(); ++i) -+ { -+ if (m_outputs[i].name == outputName) -+ { -+ result = &m_outputs[i]; -+ break; -+ } -+ } -+ return result; -+} -+ - CXRandR g_xrandr; - - #endif // HAS_XRANDR -diff --git a/xbmc/windowing/X11/XRandR.h b/xbmc/windowing/X11/XRandR.h -index 618bd68..0824af5 100644 ---- a/xbmc/windowing/X11/XRandR.h -+++ b/xbmc/windowing/X11/XRandR.h -@@ -79,6 +79,7 @@ class XOutput - } - CStdString name; - bool isConnected; -+ int screen; - int w; - int h; - int x; -@@ -94,12 +95,15 @@ class CXRandR - public: - CXRandR(bool query=false); - bool Query(bool force=false); -+ bool Query(bool force, int screennum); - std::vector GetModes(void); -- XOutput GetCurrentOutput(); - XMode GetCurrentMode(CStdString outputName); -+ XOutput *GetOutput(CStdString outputName); - bool SetMode(XOutput output, XMode mode); - void LoadCustomModeLinesToAllOutputs(void); - void SaveState(); -+ void SetNumScreens(unsigned int num); -+ bool IsOutputConnected(CStdString name); - //bool Has1080i(); - //bool Has1080p(); - //bool Has720p(); -@@ -107,10 +111,10 @@ class CXRandR - - private: - bool m_bInit; -- std::vector m_current; - std::vector m_outputs; - CStdString m_currentOutput; - CStdString m_currentMode; -+ unsigned int m_numScreens; - }; - - extern CXRandR g_xrandr; --- -1.8.1.6 - - -From f8d8a2625e65c1e925a19153c742d2356bcede98 Mon Sep 17 00:00:00 2001 -From: FernetMenta -Date: Thu, 5 Jul 2012 11:44:00 +0200 -Subject: [PATCH 43/94] X11: fix multi-head setups - ---- - language/English/strings.po | 4 +- - xbmc/rendering/gl/RenderSystemGL.h | 1 + - xbmc/settings/GUISettings.cpp | 5 + - xbmc/settings/GUIWindowSettingsCategory.cpp | 60 ++++++- - xbmc/settings/GUIWindowSettingsCategory.h | 1 + - xbmc/windowing/WinEventsX11.cpp | 7 + - xbmc/windowing/X11/WinSystemX11.cpp | 262 ++++++++++++++++------------ - xbmc/windowing/X11/WinSystemX11.h | 10 +- - 8 files changed, 235 insertions(+), 115 deletions(-) - -diff --git a/language/English/strings.po b/language/English/strings.po -index 41e32a6..6cefd26 100644 ---- a/language/English/strings.po -+++ b/language/English/strings.po -@@ -894,7 +894,9 @@ msgctxt "#245" - msgid "Sizing: (%i,%i)->(%i,%i) (Zoom x%2.2f) AR:%2.2f:1 (Pixels: %2.2f:1) (VShift: %2.2f)" - msgstr "" - --#empty string with id 246 -+msgctxt "#246" -+msgid "Monitor" -+msgstr "" - - msgctxt "#247" - msgid "Scripts" -diff --git a/xbmc/rendering/gl/RenderSystemGL.h b/xbmc/rendering/gl/RenderSystemGL.h -index efe5493..85d780d 100644 ---- a/xbmc/rendering/gl/RenderSystemGL.h -+++ b/xbmc/rendering/gl/RenderSystemGL.h -@@ -44,6 +44,7 @@ class CRenderSystemGL : public CRenderSystemBase - virtual bool IsExtSupported(const char* extension); - - virtual void SetVSync(bool vsync); -+ virtual void ResetVSync() { m_bVsyncInit = false; } - - virtual void SetViewPort(CRect& viewPort); - virtual void GetViewPort(CRect& viewPort); -diff --git a/xbmc/settings/GUISettings.cpp b/xbmc/settings/GUISettings.cpp -index 4cec1b3..30b402d 100644 ---- a/xbmc/settings/GUISettings.cpp -+++ b/xbmc/settings/GUISettings.cpp -@@ -392,11 +392,16 @@ void CGUISettings::Initialize() - AddGroup(SETTINGS_SYSTEM, 13000); - CSettingsCategory* vs = AddCategory(SETTINGS_SYSTEM, "videoscreen", 21373); - -+#if defined(HAS_GLX) -+ AddString(vs, "videoscreen.monitor", 246, "", SPIN_CONTROL_TEXT); -+#endif -+ - // this setting would ideally not be saved, as its value is systematically derived from videoscreen.screenmode. - // contains a DISPLAYMODE - #if !defined(TARGET_DARWIN_IOS_ATV2) && !defined(TARGET_RASPBERRY_PI) - AddInt(vs, "videoscreen.screen", 240, 0, -1, 1, 32, SPIN_CONTROL_TEXT); - #endif -+ - // this setting would ideally not be saved, as its value is systematically derived from videoscreen.screenmode. - // contains an index to the g_settings.m_ResInfo array. the only meaningful fields are iScreen, iWidth, iHeight. - #if defined(TARGET_DARWIN) -diff --git a/xbmc/settings/GUIWindowSettingsCategory.cpp b/xbmc/settings/GUIWindowSettingsCategory.cpp -index 2af9315..b9f18e4 100644 ---- a/xbmc/settings/GUIWindowSettingsCategory.cpp -+++ b/xbmc/settings/GUIWindowSettingsCategory.cpp -@@ -528,6 +528,12 @@ void CGUIWindowSettingsCategory::CreateSettings() - FillInRefreshRates(strSetting, g_guiSettings.GetResolution(), false); - continue; - } -+ else if (strSetting.Equals("videoscreen.monitor")) -+ { -+ AddSetting(pSetting, group->GetWidth(), iControlID); -+ FillInMonitors(strSetting); -+ continue; -+ } - else if (strSetting.Equals("lookandfeel.skintheme")) - { - AddSetting(pSetting, group->GetWidth(), iControlID); -@@ -1477,6 +1483,20 @@ void CGUIWindowSettingsCategory::OnSettingChanged(BaseSettingControlPtr pSetting - // Cascade - FillInResolutions("videoscreen.resolution", mode, RES_DESKTOP, true); - } -+ else if (strSetting.Equals("videoscreen.monitor")) -+ { -+ CSettingString *pSettingString = (CSettingString *)pSettingControl->GetSetting(); -+ CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(pSettingControl->GetID()); -+ CStdString currentMonitor = pControl->GetCurrentLabel(); -+ if (!g_Windowing.IsCurrentOutput(currentMonitor)) -+ { -+ g_guiSettings.SetString("videoscreen.monitor", currentMonitor); -+ g_Windowing.UpdateResolutions(); -+ DisplayMode mode = g_guiSettings.GetInt("videoscreen.screen"); -+ // Cascade -+ FillInResolutions("videoscreen.resolution", mode, RES_DESKTOP, true); -+ } -+ } - else if (strSetting.Equals("videoscreen.resolution")) - { - RESOLUTION nextRes = (RESOLUTION) g_guiSettings.GetInt("videoscreen.resolution"); -@@ -2413,11 +2433,15 @@ DisplayMode CGUIWindowSettingsCategory::FillInScreens(CStdString strSetting, RES - if (g_advancedSettings.m_canWindowed) - pControl->AddLabel(g_localizeStrings.Get(242), -1); - -+#if !defined(HAS_GLX) - for (int idx = 0; idx < g_Windowing.GetNumScreens(); idx++) - { - strScreen.Format(g_localizeStrings.Get(241), g_settings.m_ResInfo[RES_DESKTOP + idx].iScreen + 1); - pControl->AddLabel(strScreen, g_settings.m_ResInfo[RES_DESKTOP + idx].iScreen); - } -+#else -+ pControl->AddLabel(g_localizeStrings.Get(244), 0); -+#endif - pControl->SetValue(mode); - g_guiSettings.SetInt("videoscreen.screen", mode); - } -@@ -2425,6 +2449,36 @@ DisplayMode CGUIWindowSettingsCategory::FillInScreens(CStdString strSetting, RES - return mode; - } - -+void CGUIWindowSettingsCategory::FillInMonitors(CStdString strSetting) -+{ -+ // we expect "videoscreen.monitor" but it might be hidden on some platforms, -+ // so check that we actually have a visable control. -+ CBaseSettingControl *control = GetSetting(strSetting); -+ if (control) -+ { -+ control->SetDelayed(); -+ CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(control->GetID()); -+ pControl->Clear(); -+ -+ std::vector monitors; -+ g_Windowing.GetConnectedOutputs(&monitors); -+ -+ int currentMonitor = 0; -+ for (unsigned int i=0; iAddLabel(monitors[i], i); -+ } -+ -+ pControl->SetValue(currentMonitor); -+ g_guiSettings.SetString("videoscreen.monitor", g_settings.m_ResInfo[RES_DESKTOP].strOutput); -+ } -+} -+ -+ - void CGUIWindowSettingsCategory::FillInResolutions(CStdString strSetting, DisplayMode mode, RESOLUTION res, bool UserChange) - { - BaseSettingControlPtr control = GetSetting(strSetting); -@@ -2553,13 +2607,15 @@ void CGUIWindowSettingsCategory::OnRefreshRateChanged(RESOLUTION nextRes) - RESOLUTION lastRes = g_graphicsContext.GetVideoResolution(); - bool cancelled = false; - -+ bool outputChanged = !g_Windowing.IsCurrentOutput(g_guiSettings.GetString("videoscreen.monitor")); -+ - g_guiSettings.SetResolution(nextRes); -- g_graphicsContext.SetVideoResolution(nextRes); -+ g_graphicsContext.SetVideoResolution(nextRes, outputChanged); - - if (!CGUIDialogYesNo::ShowAndGetInput(13110, 13111, 20022, 20022, -1, -1, cancelled, 10000)) - { - g_guiSettings.SetResolution(lastRes); -- g_graphicsContext.SetVideoResolution(lastRes); -+ g_graphicsContext.SetVideoResolution(lastRes, outputChanged); - - DisplayMode mode = FillInScreens("videoscreen.screen", lastRes); - FillInResolutions("videoscreen.resolution", mode, lastRes, false); -diff --git a/xbmc/settings/GUIWindowSettingsCategory.h b/xbmc/settings/GUIWindowSettingsCategory.h -index 5142c6e..0d4649d 100644 ---- a/xbmc/settings/GUIWindowSettingsCategory.h -+++ b/xbmc/settings/GUIWindowSettingsCategory.h -@@ -51,6 +51,7 @@ class CGUIWindowSettingsCategory : - void FillInSoundSkins(CSetting *pSetting); - void FillInLanguages(CSetting *pSetting, const std::vector &languages = std::vector(), const std::vector &languageKeys = std::vector()); - DisplayMode FillInScreens(CStdString strSetting, RESOLUTION res); -+ void FillInMonitors(CStdString strSetting); - void FillInResolutions(CStdString strSetting, DisplayMode mode, RESOLUTION res, bool UserChange); - void FillInRefreshRates(CStdString strSetting, RESOLUTION res, bool UserChange); - void OnRefreshRateChanged(RESOLUTION resolution); -diff --git a/xbmc/windowing/WinEventsX11.cpp b/xbmc/windowing/WinEventsX11.cpp -index 5946a33..6c22358 100644 ---- a/xbmc/windowing/WinEventsX11.cpp -+++ b/xbmc/windowing/WinEventsX11.cpp -@@ -517,9 +517,16 @@ bool CWinEventsX11::MessagePump() - break; - } - -+ case EnterNotify: -+ { -+ g_Windowing.NotifyMouseCoverage(true); -+ break; -+ } -+ - // lose mouse coverage - case LeaveNotify: - { -+ g_Windowing.NotifyMouseCoverage(false); - g_Mouse.SetActive(false); - break; - } -diff --git a/xbmc/windowing/X11/WinSystemX11.cpp b/xbmc/windowing/X11/WinSystemX11.cpp -index 6b0aa92..5f913f1 100644 ---- a/xbmc/windowing/X11/WinSystemX11.cpp -+++ b/xbmc/windowing/X11/WinSystemX11.cpp -@@ -33,6 +33,7 @@ - #include "cores/VideoRenderers/RenderManager.h" - #include "utils/TimeUtils.h" - #include "settings/GUISettings.h" -+#include "windowing/WindowingFactory.h" - - #if defined(HAS_XRANDR) - #include -@@ -54,6 +55,7 @@ - m_bIgnoreNextFocusMessage = false; - m_dpyLostTime = 0; - m_invisibleCursor = 0; -+ m_bIsInternalXrr = false; - - XSetErrorHandler(XErrorHandler); - } -@@ -66,7 +68,8 @@ bool CWinSystemX11::InitWindowSystem() - { - if ((m_dpy = XOpenDisplay(NULL))) - { -- return CWinSystemBase::InitWindowSystem(); -+ bool ret = CWinSystemBase::InitWindowSystem(); -+ return ret; - } - else - CLog::Log(LOGERROR, "GLX Error: No Display found"); -@@ -103,6 +106,8 @@ bool CWinSystemX11::DestroyWindowSystem() - - //we don't call XCloseDisplay() here, since ati keeps a pointer to our m_dpy - //so instead we just let m_dpy die on exit -+ // i have seen core dumps on ATI if the display is not closed here -+ XCloseDisplay(m_dpy); - } - - // m_SDLSurface is free()'d by SDL_Quit(). -@@ -125,7 +130,10 @@ bool CWinSystemX11::DestroyWindow() - return true; - - if (m_glContext) -+ { -+ glFinish(); - glXMakeCurrent(m_dpy, None, NULL); -+ } - - if (m_invisibleCursor) - { -@@ -155,7 +163,7 @@ bool CWinSystemX11::ResizeWindow(int newWidth, int newHeight, int newLeft, int n - && m_nHeight == newHeight) - return true; - -- if (!SetWindow(newWidth, newHeight, false)) -+ if (!SetWindow(newWidth, newHeight, false, g_guiSettings.GetString("videoscreen.monitor"))) - { - return false; - } -@@ -164,58 +172,11 @@ bool CWinSystemX11::ResizeWindow(int newWidth, int newHeight, int newLeft, int n - m_nWidth = newWidth; - m_nHeight = newHeight; - m_bFullScreen = false; -+ m_currentOutput = g_guiSettings.GetString("videoscreen.monitor"); - - return false; - } - --void CWinSystemX11::RefreshWindow() --{ -- if (!g_xrandr.Query(true)) -- { -- CLog::Log(LOGERROR, "WinSystemX11::RefreshWindow - failed to query xrandr"); -- return; -- } -- XOutput out = g_xrandr.GetCurrentOutput(); -- XMode mode = g_xrandr.GetCurrentMode(out.name); -- -- RotateResolutions(); -- -- // only overwrite desktop resolution, if we are not in fullscreen mode -- if (!g_graphicsContext.IsFullScreenVideo()) -- { -- CLog::Log(LOGDEBUG, "CWinSystemX11::RefreshWindow - store desktop resolution, width: %d, height: %d, hz: %2.2f", mode.w, mode.h, mode.hz); -- if (!out.isRotated) -- UpdateDesktopResolution(g_settings.m_ResInfo[RES_DESKTOP], 0, mode.w, mode.h, mode.hz); -- else -- UpdateDesktopResolution(g_settings.m_ResInfo[RES_DESKTOP], 0, mode.h, mode.w, mode.hz); -- g_settings.m_ResInfo[RES_DESKTOP].strId = mode.id; -- g_settings.m_ResInfo[RES_DESKTOP].strOutput = out.name; -- } -- -- RESOLUTION_INFO res; -- unsigned int i; -- bool found(false); -- for (i = RES_DESKTOP; i < g_settings.m_ResInfo.size(); ++i) -- { -- if (g_settings.m_ResInfo[i].strId == mode.id) -- { -- found = true; -- break; -- } -- } -- -- if (!found) -- { -- CLog::Log(LOGERROR, "CWinSystemX11::RefreshWindow - could not find resolution"); -- return; -- } -- -- if (g_graphicsContext.IsFullScreenRoot()) -- g_graphicsContext.SetVideoResolution((RESOLUTION)i, true); -- else -- g_graphicsContext.SetVideoResolution(RES_WINDOW, true); --} -- - bool CWinSystemX11::SetFullScreen(bool fullScreen, RESOLUTION_INFO& res, bool blankOtherDisplays) - { - -@@ -240,8 +201,7 @@ bool CWinSystemX11::SetFullScreen(bool fullScreen, RESOLUTION_INFO& res, bool bl - mode.id = g_settings.m_ResInfo[RES_DESKTOP].strId; - } - -- XOutput currout = g_xrandr.GetCurrentOutput(); -- XMode currmode = g_xrandr.GetCurrentMode(currout.name); -+ XMode currmode = g_xrandr.GetCurrentMode(out.name); - - // flip h/w when rotated - if (m_bIsRotated) -@@ -252,16 +212,17 @@ bool CWinSystemX11::SetFullScreen(bool fullScreen, RESOLUTION_INFO& res, bool bl - } - - // only call xrandr if mode changes -- if (currout.name != out.name || currmode.w != mode.w || currmode.h != mode.h || -+ if (currmode.w != mode.w || currmode.h != mode.h || - currmode.hz != mode.hz || currmode.id != mode.id) - { - CLog::Log(LOGNOTICE, "CWinSystemX11::SetFullScreen - calling xrandr"); - OnLostDevice(); -+ m_bIsInternalXrr = true; - g_xrandr.SetMode(out, mode); - } - #endif - -- if (!SetWindow(res.iWidth, res.iHeight, fullScreen)) -+ if (!SetWindow(res.iWidth, res.iHeight, fullScreen, g_guiSettings.GetString("videoscreen.monitor"))) - return false; - - RefreshGlxContext(); -@@ -269,6 +230,7 @@ bool CWinSystemX11::SetFullScreen(bool fullScreen, RESOLUTION_INFO& res, bool bl - m_nWidth = res.iWidth; - m_nHeight = res.iHeight; - m_bFullScreen = fullScreen; -+ m_currentOutput = g_guiSettings.GetString("videoscreen.monitor"); - - return true; - } -@@ -277,19 +239,30 @@ void CWinSystemX11::UpdateResolutions() - { - CWinSystemBase::UpdateResolutions(); - -- - #if defined(HAS_XRANDR) -- if(g_xrandr.Query()) -- { -- XOutput out = g_xrandr.GetCurrentOutput(); -- XMode mode = g_xrandr.GetCurrentMode(out.name); -- m_bIsRotated = out.isRotated; -+ CStdString currentMonitor; -+ int numScreens = XScreenCount(m_dpy); -+ g_xrandr.SetNumScreens(numScreens); -+ if(g_xrandr.Query(true)) -+ { -+ currentMonitor = g_guiSettings.GetString("videoscreen.monitor"); -+ // check if the monitor is connected -+ XOutput *out = g_xrandr.GetOutput(currentMonitor); -+ if (!out) -+ { -+ // choose first output -+ currentMonitor = g_xrandr.GetModes()[0].name; -+ out = g_xrandr.GetOutput(currentMonitor); -+ g_guiSettings.SetString("videoscreen.monitor", currentMonitor); -+ } -+ XMode mode = g_xrandr.GetCurrentMode(currentMonitor); -+ m_bIsRotated = out->isRotated; - if (!m_bIsRotated) -- UpdateDesktopResolution(g_settings.m_ResInfo[RES_DESKTOP], 0, mode.w, mode.h, mode.hz); -+ UpdateDesktopResolution(g_settings.m_ResInfo[RES_DESKTOP], out->screen, mode.w, mode.h, mode.hz); - else -- UpdateDesktopResolution(g_settings.m_ResInfo[RES_DESKTOP], 0, mode.h, mode.w, mode.hz); -+ UpdateDesktopResolution(g_settings.m_ResInfo[RES_DESKTOP], out->screen, mode.h, mode.w, mode.hz); - g_settings.m_ResInfo[RES_DESKTOP].strId = mode.id; -- g_settings.m_ResInfo[RES_DESKTOP].strOutput = out.name; -+ g_settings.m_ResInfo[RES_DESKTOP].strOutput = currentMonitor; - } - else - #endif -@@ -300,23 +273,26 @@ void CWinSystemX11::UpdateResolutions() - UpdateDesktopResolution(g_settings.m_ResInfo[RES_DESKTOP], 0, w, h, 0.0); - } - -- - #if defined(HAS_XRANDR) - -+ // erase previous stored modes -+ if (g_settings.m_ResInfo.size() > RES_CUSTOM) -+ { -+ std::vector::iterator firstCustom = g_settings.m_ResInfo.begin()+RES_CUSTOM; -+ g_settings.m_ResInfo.erase(firstCustom, g_settings.m_ResInfo.end()); -+ } -+ - CLog::Log(LOGINFO, "Available videomodes (xrandr):"); -- vector::iterator outiter; -- vector outs; -- outs = g_xrandr.GetModes(); -- CLog::Log(LOGINFO, "Number of connected outputs: %"PRIdS"", outs.size()); -+ -+ XOutput *out = g_xrandr.GetOutput(currentMonitor); - string modename = ""; - -- for (outiter = outs.begin() ; outiter != outs.end() ; outiter++) -+ if (out != NULL) - { -- XOutput out = *outiter; - vector::iterator modeiter; -- CLog::Log(LOGINFO, "Output '%s' has %"PRIdS" modes", out.name.c_str(), out.modes.size()); -+ CLog::Log(LOGINFO, "Output '%s' has %"PRIdS" modes", out->name.c_str(), out->modes.size()); - -- for (modeiter = out.modes.begin() ; modeiter!=out.modes.end() ; modeiter++) -+ for (modeiter = out->modes.begin() ; modeiter!=out->modes.end() ; modeiter++) - { - XMode mode = *modeiter; - CLog::Log(LOGINFO, "ID:%s Name:%s Refresh:%f Width:%d Height:%d", -@@ -336,15 +312,15 @@ void CWinSystemX11::UpdateResolutions() - res.iWidth = mode.h; - res.iHeight = mode.w; - } -- if (mode.h>0 && mode.w>0 && out.hmm>0 && out.wmm>0) -- res.fPixelRatio = ((float)out.wmm/(float)mode.w) / (((float)out.hmm/(float)mode.h)); -+ if (mode.h>0 && mode.w>0 && out->hmm>0 && out->wmm>0) -+ res.fPixelRatio = ((float)out->wmm/(float)mode.w) / (((float)out->hmm/(float)mode.h)); - else - res.fPixelRatio = 1.0f; - - CLog::Log(LOGINFO, "Pixel Ratio: %f", res.fPixelRatio); - -- res.strMode.Format("%s: %s @ %.2fHz", out.name.c_str(), mode.name.c_str(), mode.hz); -- res.strOutput = out.name; -+ res.strMode.Format("%s: %s @ %.2fHz", out->name.c_str(), mode.name.c_str(), mode.hz); -+ res.strOutput = out->name; - res.strId = mode.id; - res.iSubtitles = (int)(0.95*mode.h); - res.fRefreshRate = mode.hz; -@@ -363,28 +339,19 @@ void CWinSystemX11::UpdateResolutions() - - } - --void CWinSystemX11::RotateResolutions() -+void CWinSystemX11::GetConnectedOutputs(std::vector *outputs) - { --#if defined(HAS_XRANDR) -- XOutput out = g_xrandr.GetCurrentOutput(); -- if (out.isRotated == m_bIsRotated) -- return; -- -- for (unsigned int i = 0; i < g_settings.m_ResInfo.size(); ++i) -+ vector outs; -+ outs = g_xrandr.GetModes(); -+ for(unsigned int i=0; ipush_back(outs[i].name); - } -- // update desktop resolution --// int h = g_settings.m_ResInfo[RES_DESKTOP].iHeight; --// int w = g_settings.m_ResInfo[RES_DESKTOP].iWidth; --// float hz = g_settings.m_ResInfo[RES_DESKTOP].fRefreshRate; --// UpdateDesktopResolution(g_settings.m_ResInfo[RES_DESKTOP], 0, w, h, hz); -- -- m_bIsRotated = out.isRotated; -+} - --#endif -+bool CWinSystemX11::IsCurrentOutput(CStdString output) -+{ -+ return m_currentOutput.Equals(output); - } - - bool CWinSystemX11::IsSuitableVisual(XVisualInfo *vInfo) -@@ -414,8 +381,11 @@ bool CWinSystemX11::RefreshGlxContext() - if (m_glContext) - { - CLog::Log(LOGDEBUG, "CWinSystemX11::RefreshGlxContext: refreshing context"); -+ glFinish(); - glXMakeCurrent(m_dpy, None, NULL); - glXMakeCurrent(m_dpy, m_glWindow, m_glContext); -+ XSync(m_dpy, FALSE); -+ g_Windowing.ResetVSync(); - return true; - } - -@@ -481,6 +451,8 @@ bool CWinSystemX11::RefreshGlxContext() - { - // make this context current - glXMakeCurrent(m_dpy, m_glWindow, m_glContext); -+ g_Windowing.ResetVSync(); -+ XSync(m_dpy, False); - retVal = true; - } - else -@@ -522,24 +494,53 @@ void CWinSystemX11::ResetOSScreensaver() - - void CWinSystemX11::NotifyAppActiveChange(bool bActivated) - { -- if (bActivated && m_bWasFullScreenBeforeMinimize && !g_graphicsContext.IsFullScreenRoot()) -+ if (bActivated && m_bWasFullScreenBeforeMinimize && !m_bFullScreen) -+ { - g_graphicsContext.ToggleFullScreenRoot(); - -+ m_bWasFullScreenBeforeMinimize = false; -+ } - m_minimized = !bActivated; - } - - void CWinSystemX11::NotifyAppFocusChange(bool bGaining) - { - if (bGaining && m_bWasFullScreenBeforeMinimize && !m_bIgnoreNextFocusMessage && -- !g_graphicsContext.IsFullScreenRoot()) -+ !m_bFullScreen) -+ { -+ m_bWasFullScreenBeforeMinimize = false; - g_graphicsContext.ToggleFullScreenRoot(); -+ m_minimized = false; -+ } - if (!bGaining) - m_bIgnoreNextFocusMessage = false; - } - -+void CWinSystemX11::NotifyMouseCoverage(bool covered) -+{ -+ if (!m_bFullScreen) -+ return; -+ -+ if (covered) -+ { -+ int result = -1; -+ while (result != GrabSuccess && result != AlreadyGrabbed) -+ { -+ result = XGrabPointer(m_dpy, m_glWindow, True, ButtonPressMask, GrabModeAsync, GrabModeAsync, None, None, CurrentTime); -+ XbmcThreads::ThreadSleep(100); -+ } -+ XGrabKeyboard(m_dpy, m_glWindow, True, GrabModeAsync, GrabModeAsync, CurrentTime); -+ } -+ else -+ { -+ XUngrabKeyboard(m_dpy, CurrentTime); -+ XUngrabPointer(m_dpy, CurrentTime); -+ } -+} -+ - bool CWinSystemX11::Minimize() - { -- m_bWasFullScreenBeforeMinimize = g_graphicsContext.IsFullScreenRoot(); -+ m_bWasFullScreenBeforeMinimize = m_bFullScreen; - if (m_bWasFullScreenBeforeMinimize) - { - m_bIgnoreNextFocusMessage = true; -@@ -605,13 +606,46 @@ void CWinSystemX11::CheckDisplayEvents() - void CWinSystemX11::NotifyXRREvent() - { - CLog::Log(LOGDEBUG, "%s - notify display reset event", __FUNCTION__); -- RefreshWindow(); -+ m_windowDirty = true; - -- CSingleLock lock(m_resourceSection); -+ // if external event update resolutions -+ if (!m_bIsInternalXrr) -+ { -+ UpdateResolutions(); -+ } -+ else if (!g_xrandr.Query(true)) -+ { -+ CLog::Log(LOGERROR, "WinSystemX11::RefreshWindow - failed to query xrandr"); -+ return; -+ } -+ m_bIsInternalXrr = false; - -- // tell any shared resources -- for (vector::iterator i = m_resources.begin(); i != m_resources.end(); i++) -- (*i)->OnResetDevice(); -+ CStdString currentOutput = g_guiSettings.GetString("videoscreen.monitor"); -+ XOutput *out = g_xrandr.GetOutput(currentOutput); -+ XMode mode = g_xrandr.GetCurrentMode(currentOutput); -+ -+ RESOLUTION_INFO res; -+ unsigned int i; -+ bool found(false); -+ for (i = RES_DESKTOP; i < g_settings.m_ResInfo.size(); ++i) -+ { -+ if (g_settings.m_ResInfo[i].strId == mode.id) -+ { -+ found = true; -+ break; -+ } -+ } -+ -+ if (!found) -+ { -+ CLog::Log(LOGERROR, "CWinSystemX11::RefreshWindow - could not find resolution"); -+ i = RES_DESKTOP; -+ } -+ -+ if (g_graphicsContext.IsFullScreenRoot()) -+ g_graphicsContext.SetVideoResolution((RESOLUTION)i, true); -+ else -+ g_graphicsContext.SetVideoResolution(RES_WINDOW, true); - - } - -@@ -664,14 +698,14 @@ bool CWinSystemX11::EnableFrameLimiter() - return m_minimized; - } - --bool CWinSystemX11::SetWindow(int width, int height, bool fullscreen) -+bool CWinSystemX11::SetWindow(int width, int height, bool fullscreen, const CStdString &output) - { - bool changeWindow = false; - bool changeSize = false; - bool mouseActive = false; - float mouseX, mouseY; - -- if (m_glWindow && (m_bFullScreen != fullscreen)) -+ if (m_glWindow && ((m_bFullScreen != fullscreen) || !m_currentOutput.Equals(output) || m_windowDirty)) - { - mouseActive = g_Mouse.IsActive(); - if (mouseActive) -@@ -693,6 +727,7 @@ bool CWinSystemX11::SetWindow(int width, int height, bool fullscreen) - else - mouseActive = false; - } -+ OnLostDevice(); - DestroyWindow(); - } - -@@ -714,7 +749,11 @@ bool CWinSystemX11::SetWindow(int width, int height, bool fullscreen) - XSetWindowAttributes swa; - XVisualInfo *vi; - -- vi = glXChooseVisual(m_dpy, DefaultScreen(m_dpy), att); -+ XOutput *out = g_xrandr.GetOutput(output); -+ if (!out) -+ out = g_xrandr.GetOutput(m_currentOutput); -+ m_nScreen = out->screen; -+ vi = glXChooseVisual(m_dpy, m_nScreen, att); - cmap = XCreateColormap(m_dpy, RootWindow(m_dpy, vi->screen), vi->visual, AllocNone); - - int def_vis = (vi->visual == DefaultVisual(m_dpy, vi->screen)); -@@ -730,7 +769,7 @@ bool CWinSystemX11::SetWindow(int width, int height, bool fullscreen) - unsigned long mask = CWBackPixel | CWBorderPixel | CWColormap | CWOverrideRedirect | CWEventMask; - - m_glWindow = XCreateWindow(m_dpy, RootWindow(m_dpy, vi->screen), -- 0, 0, width, height, 0, vi->depth, -+ out->x, out->y, width, height, 0, vi->depth, - InputOutput, vi->visual, - mask, &swa); - -@@ -801,14 +840,19 @@ bool CWinSystemX11::SetWindow(int width, int height, bool fullscreen) - if (fullscreen) - { - int result = -1; -- while (result != GrabSuccess) -+ while (result != GrabSuccess && result != AlreadyGrabbed) - { -- result = XGrabPointer(m_dpy, m_glWindow, True, ButtonPressMask, GrabModeAsync, GrabModeAsync, m_glWindow, None, CurrentTime); -+ result = XGrabPointer(m_dpy, m_glWindow, True, ButtonPressMask, GrabModeAsync, GrabModeAsync, None, None, CurrentTime); - XbmcThreads::ThreadSleep(100); - } - XGrabKeyboard(m_dpy, m_glWindow, True, GrabModeAsync, GrabModeAsync, CurrentTime); -- - } -+ CSingleLock lock(m_resourceSection); -+ // tell any shared resources -+ for (vector::iterator i = m_resources.begin(); i != m_resources.end(); i++) -+ (*i)->OnResetDevice(); -+ -+ m_windowDirty = false; - } - return true; - } -diff --git a/xbmc/windowing/X11/WinSystemX11.h b/xbmc/windowing/X11/WinSystemX11.h -index 93cf5db..71034fc 100644 ---- a/xbmc/windowing/X11/WinSystemX11.h -+++ b/xbmc/windowing/X11/WinSystemX11.h -@@ -65,15 +65,16 @@ class CWinSystemX11 : public CWinSystemBase - Display* GetDisplay() { return m_dpy; } - GLXWindow GetWindow() { return m_glWindow; } - GLXContext GetGlxContext() { return m_glContext; } -- void RefreshWindow(); - void NotifyXRREvent(); -+ void GetConnectedOutputs(std::vector *outputs); -+ bool IsCurrentOutput(CStdString output); -+ void NotifyMouseCoverage(bool covered); - - protected: - bool RefreshGlxContext(); - void CheckDisplayEvents(); - void OnLostDevice(); -- bool SetWindow(int width, int height, bool fullscreen); -- void RotateResolutions(); -+ bool SetWindow(int width, int height, bool fullscreen, const CStdString &output); - - Window m_glWindow; - GLXContext m_glContext; -@@ -88,6 +89,9 @@ class CWinSystemX11 : public CWinSystemBase - CCriticalSection m_resourceSection; - std::vector m_resources; - uint64_t m_dpyLostTime; -+ CStdString m_currentOutput; -+ bool m_windowDirty; -+ bool m_bIsInternalXrr; - - private: - bool IsSuitableVisual(XVisualInfo *vInfo); --- -1.8.1.6 - - -From 72f4bcfafc19d89b23339537c5f019a9f065db94 Mon Sep 17 00:00:00 2001 -From: FernetMenta -Date: Thu, 5 Jul 2012 11:36:32 +0200 -Subject: [PATCH 44/94] X11: remove all DefaultScreen and RootWindow macros - ---- - xbmc/windowing/X11/WinSystemX11.cpp | 6 +++--- - xbmc/windowing/X11/WinSystemX11.h | 1 + - xbmc/windowing/X11/WinSystemX11GL.cpp | 2 +- - 3 files changed, 5 insertions(+), 4 deletions(-) - -diff --git a/xbmc/windowing/X11/WinSystemX11.cpp b/xbmc/windowing/X11/WinSystemX11.cpp -index 5f913f1..af1307c 100644 ---- a/xbmc/windowing/X11/WinSystemX11.cpp -+++ b/xbmc/windowing/X11/WinSystemX11.cpp -@@ -267,7 +267,7 @@ void CWinSystemX11::UpdateResolutions() - else - #endif - { -- int x11screen = DefaultScreen(m_dpy); -+ int x11screen = m_nScreen; - int w = DisplayWidth(m_dpy, x11screen); - int h = DisplayHeight(m_dpy, x11screen); - UpdateDesktopResolution(g_settings.m_ResInfo[RES_DESKTOP], 0, w, h, 0.0); -@@ -393,7 +393,7 @@ bool CWinSystemX11::RefreshGlxContext() - XVisualInfo *visuals; - XVisualInfo *vInfo = NULL; - int availableVisuals = 0; -- vMask.screen = DefaultScreen(m_dpy); -+ vMask.screen = m_nScreen; - XWindowAttributes winAttr; - - /* Assume a depth of 24 in case the below calls to XGetWindowAttributes() -@@ -547,7 +547,7 @@ bool CWinSystemX11::Minimize() - g_graphicsContext.ToggleFullScreenRoot(); - } - -- XIconifyWindow(m_dpy, m_glWindow, DefaultScreen(m_dpy)); -+ XIconifyWindow(m_dpy, m_glWindow, m_nScreen); - - m_minimized = true; - return true; -diff --git a/xbmc/windowing/X11/WinSystemX11.h b/xbmc/windowing/X11/WinSystemX11.h -index 71034fc..3bb4b8e 100644 ---- a/xbmc/windowing/X11/WinSystemX11.h -+++ b/xbmc/windowing/X11/WinSystemX11.h -@@ -47,6 +47,7 @@ class CWinSystemX11 : public CWinSystemBase - virtual bool SetFullScreen(bool fullScreen, RESOLUTION_INFO& res, bool blankOtherDisplays); - virtual void UpdateResolutions(); - virtual int GetNumScreens() { return 1; } -+ virtual int GetCurrentScreen() { return m_nScreen; } - virtual void ShowOSMouse(bool show); - virtual void ResetOSScreensaver(); - virtual bool EnableFrameLimiter(); -diff --git a/xbmc/windowing/X11/WinSystemX11GL.cpp b/xbmc/windowing/X11/WinSystemX11GL.cpp -index f858f88..d192697 100644 ---- a/xbmc/windowing/X11/WinSystemX11GL.cpp -+++ b/xbmc/windowing/X11/WinSystemX11GL.cpp -@@ -203,7 +203,7 @@ bool CWinSystemX11GL::CreateNewWindow(const CStdString& name, bool fullScreen, R - return false; - - m_glxext = " "; -- m_glxext += (const char*)glXQueryExtensionsString(m_dpy, DefaultScreen(m_dpy)); -+ m_glxext += (const char*)glXQueryExtensionsString(m_dpy, m_nScreen); - m_glxext += " "; - - CLog::Log(LOGDEBUG, "GLX_EXTENSIONS:%s", m_glxext.c_str()); --- -1.8.1.6 - - -From e787a6adc6f3959c1e2292b6ebf0248e2c677bfd Mon Sep 17 00:00:00 2001 -From: FernetMenta -Date: Thu, 5 Jul 2012 11:45:22 +0200 -Subject: [PATCH 45/94] X11: remove all DefaultScreen and RootWindow macros - (VideoRefClock) - -Note this is on a separate display connection. ---- - xbmc/video/VideoReferenceClock.cpp | 15 ++++++++------- - 1 file changed, 8 insertions(+), 7 deletions(-) - -diff --git a/xbmc/video/VideoReferenceClock.cpp b/xbmc/video/VideoReferenceClock.cpp -index 9785fe7..0004e07 100644 ---- a/xbmc/video/VideoReferenceClock.cpp -+++ b/xbmc/video/VideoReferenceClock.cpp -@@ -270,7 +270,7 @@ bool CVideoReferenceClock::SetupGLX() - } - - bool ExtensionFound = false; -- istringstream Extensions(glXQueryExtensionsString(m_Dpy, DefaultScreen(m_Dpy))); -+ istringstream Extensions(glXQueryExtensionsString(m_Dpy, g_Windowing.GetCurrentScreen())); - string ExtensionStr; - - while (!ExtensionFound) -@@ -297,7 +297,7 @@ bool CVideoReferenceClock::SetupGLX() - m_bIsATI = true; - } - -- m_vInfo = glXChooseVisual(m_Dpy, DefaultScreen(m_Dpy), singleBufferAttributes); -+ m_vInfo = glXChooseVisual(m_Dpy, g_Windowing.GetCurrentScreen(), singleBufferAttributes); - if (!m_vInfo) - { - CLog::Log(LOGDEBUG, "CVideoReferenceClock: glXChooseVisual returned NULL"); -@@ -308,15 +308,16 @@ bool CVideoReferenceClock::SetupGLX() - { - Swa.border_pixel = 0; - Swa.event_mask = StructureNotifyMask; -- Swa.colormap = XCreateColormap(m_Dpy, RootWindow(m_Dpy, m_vInfo->screen), m_vInfo->visual, AllocNone ); -+ Swa.colormap = XCreateColormap(m_Dpy, g_Windowing.GetWindow(), m_vInfo->visual, AllocNone ); - SwaMask = CWBorderPixel | CWColormap | CWEventMask; - -- m_Window = XCreateWindow(m_Dpy, RootWindow(m_Dpy, m_vInfo->screen), 0, 0, 256, 256, 0, -+ m_Window = XCreateWindow(m_Dpy, g_Windowing.GetWindow(), 0, 0, 256, 256, 0, - m_vInfo->depth, InputOutput, m_vInfo->visual, SwaMask, &Swa); - } - else - { -- m_pixmap = XCreatePixmap(m_Dpy, DefaultRootWindow(m_Dpy), 256, 256, m_vInfo->depth); -+ Window window = g_Windowing.GetWindow(); -+ m_pixmap = XCreatePixmap(m_Dpy, window, 256, 256, m_vInfo->depth); - if (!m_pixmap) - { - CLog::Log(LOGDEBUG, "CVideoReferenceClock: unable to create pixmap"); -@@ -383,7 +384,7 @@ bool CVideoReferenceClock::SetupGLX() - - //set up receiving of RandR events, we'll get one when the refreshrate changes - XRRQueryExtension(m_Dpy, &m_RREventBase, &ReturnV); -- XRRSelectInput(m_Dpy, RootWindow(m_Dpy, m_vInfo->screen), RRScreenChangeNotifyMask); -+ XRRSelectInput(m_Dpy, g_Windowing.GetWindow(), RRScreenChangeNotifyMask); - - UpdateRefreshrate(true); //forced refreshrate update - m_MissedVblanks = 0; -@@ -518,7 +519,7 @@ int CVideoReferenceClock::GetRandRRate() - int RefreshRate; - XRRScreenConfiguration *CurrInfo; - -- CurrInfo = XRRGetScreenInfo(m_Dpy, RootWindow(m_Dpy, m_vInfo->screen)); -+ CurrInfo = XRRGetScreenInfo(m_Dpy, g_Windowing.GetWindow()); - RefreshRate = XRRConfigCurrentRate(CurrInfo); - XRRFreeScreenConfigInfo(CurrInfo); - --- -1.8.1.6 - - -From a76601dd7f1ebbe3e753192152457f41c1951f36 Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Wed, 20 Jun 2012 17:37:11 +0200 -Subject: [PATCH 46/94] X11: recreate gl context after output has changed - ---- - xbmc/windowing/X11/WinSystemX11.cpp | 24 ++++++++++++++---------- - xbmc/windowing/X11/WinSystemX11.h | 1 + - xbmc/windowing/X11/WinSystemX11GL.cpp | 9 +++++++++ - 3 files changed, 24 insertions(+), 10 deletions(-) - -diff --git a/xbmc/windowing/X11/WinSystemX11.cpp b/xbmc/windowing/X11/WinSystemX11.cpp -index af1307c..d3d15e2 100644 ---- a/xbmc/windowing/X11/WinSystemX11.cpp -+++ b/xbmc/windowing/X11/WinSystemX11.cpp -@@ -168,7 +168,6 @@ bool CWinSystemX11::ResizeWindow(int newWidth, int newHeight, int newLeft, int n - return false; - } - -- RefreshGlxContext(); - m_nWidth = newWidth; - m_nHeight = newHeight; - m_bFullScreen = false; -@@ -219,14 +218,13 @@ bool CWinSystemX11::SetFullScreen(bool fullScreen, RESOLUTION_INFO& res, bool bl - OnLostDevice(); - m_bIsInternalXrr = true; - g_xrandr.SetMode(out, mode); -+ return true; - } - #endif - - if (!SetWindow(res.iWidth, res.iHeight, fullScreen, g_guiSettings.GetString("videoscreen.monitor"))) - return false; - -- RefreshGlxContext(); -- - m_nWidth = res.iWidth; - m_nHeight = res.iHeight; - m_bFullScreen = fullScreen; -@@ -381,11 +379,8 @@ bool CWinSystemX11::RefreshGlxContext() - if (m_glContext) - { - CLog::Log(LOGDEBUG, "CWinSystemX11::RefreshGlxContext: refreshing context"); -- glFinish(); - glXMakeCurrent(m_dpy, None, NULL); - glXMakeCurrent(m_dpy, m_glWindow, m_glContext); -- XSync(m_dpy, FALSE); -- g_Windowing.ResetVSync(); - return true; - } - -@@ -445,14 +440,14 @@ bool CWinSystemX11::RefreshGlxContext() - { - glXMakeCurrent(m_dpy, None, NULL); - glXDestroyContext(m_dpy, m_glContext); -+ XSync(m_dpy, FALSE); -+ m_newGlContext = true; - } - - if ((m_glContext = glXCreateContext(m_dpy, vInfo, NULL, True))) - { - // make this context current - glXMakeCurrent(m_dpy, m_glWindow, m_glContext); -- g_Windowing.ResetVSync(); -- XSync(m_dpy, False); - retVal = true; - } - else -@@ -729,6 +724,7 @@ bool CWinSystemX11::SetWindow(int width, int height, bool fullscreen, const CStd - } - OnLostDevice(); - DestroyWindow(); -+ m_windowDirty = true; - } - - // create main window -@@ -847,13 +843,21 @@ bool CWinSystemX11::SetWindow(int width, int height, bool fullscreen, const CStd - } - XGrabKeyboard(m_dpy, m_glWindow, True, GrabModeAsync, GrabModeAsync, CurrentTime); - } -+ -+ CDirtyRegionList dr; -+ RefreshGlxContext(); -+ XSync(m_dpy, FALSE); -+ g_graphicsContext.Clear(0); -+ g_graphicsContext.Flip(dr); -+ g_Windowing.ResetVSync(); -+ m_windowDirty = false; -+ - CSingleLock lock(m_resourceSection); - // tell any shared resources - for (vector::iterator i = m_resources.begin(); i != m_resources.end(); i++) - (*i)->OnResetDevice(); -- -- m_windowDirty = false; - } -+ - return true; - } - -diff --git a/xbmc/windowing/X11/WinSystemX11.h b/xbmc/windowing/X11/WinSystemX11.h -index 3bb4b8e..cc28f56 100644 ---- a/xbmc/windowing/X11/WinSystemX11.h -+++ b/xbmc/windowing/X11/WinSystemX11.h -@@ -93,6 +93,7 @@ class CWinSystemX11 : public CWinSystemBase - CStdString m_currentOutput; - bool m_windowDirty; - bool m_bIsInternalXrr; -+ bool m_newGlContext; - - private: - bool IsSuitableVisual(XVisualInfo *vInfo); -diff --git a/xbmc/windowing/X11/WinSystemX11GL.cpp b/xbmc/windowing/X11/WinSystemX11GL.cpp -index d192697..0f2d1d2 100644 ---- a/xbmc/windowing/X11/WinSystemX11GL.cpp -+++ b/xbmc/windowing/X11/WinSystemX11GL.cpp -@@ -23,6 +23,7 @@ - - #include "WinSystemX11GL.h" - #include "utils/log.h" -+#include "Application.h" - - CWinSystemX11GL::CWinSystemX11GL() - { -@@ -245,17 +246,25 @@ bool CWinSystemX11GL::CreateNewWindow(const CStdString& name, bool fullScreen, R - - bool CWinSystemX11GL::ResizeWindow(int newWidth, int newHeight, int newLeft, int newTop) - { -+ m_newGlContext = false; - CWinSystemX11::ResizeWindow(newWidth, newHeight, newLeft, newTop); - CRenderSystemGL::ResetRenderSystem(newWidth, newHeight, false, 0); - -+ if (m_newGlContext) -+ g_application.ReloadSkin(); -+ - return true; - } - - bool CWinSystemX11GL::SetFullScreen(bool fullScreen, RESOLUTION_INFO& res, bool blankOtherDisplays) - { -+ m_newGlContext = false; - CWinSystemX11::SetFullScreen(fullScreen, res, blankOtherDisplays); - CRenderSystemGL::ResetRenderSystem(res.iWidth, res.iHeight, fullScreen, res.fRefreshRate); - -+ if (m_newGlContext) -+ g_application.ReloadSkin(); -+ - return true; - } - --- -1.8.1.6 - - -From 6d48cbaa3fc53e646cc86da83534eaa6fc8cb449 Mon Sep 17 00:00:00 2001 -From: FernetMenta -Date: Thu, 5 Jul 2012 12:06:25 +0200 -Subject: [PATCH 47/94] X11: hook video reference clock in windowing - ---- - xbmc/video/VideoReferenceClock.cpp | 71 +++++++++++++++++++++++++++----------- - xbmc/video/VideoReferenceClock.h | 13 ++++++- - 2 files changed, 63 insertions(+), 21 deletions(-) - -diff --git a/xbmc/video/VideoReferenceClock.cpp b/xbmc/video/VideoReferenceClock.cpp -index 0004e07..fa8e35a 100644 ---- a/xbmc/video/VideoReferenceClock.cpp -+++ b/xbmc/video/VideoReferenceClock.cpp -@@ -135,12 +135,23 @@ - m_Context = NULL; - m_pixmap = None; - m_glPixmap = None; -- m_RREventBase = 0; - m_UseNvSettings = true; - m_bIsATI = false; - #endif - } - -+CVideoReferenceClock::~CVideoReferenceClock() -+{ -+#if defined(HAS_GLX) -+ // some ATI voodoo, if we don't close the display, we crash on exit -+ if (m_Dpy) -+ { -+ XCloseDisplay(m_Dpy); -+ m_Dpy = NULL; -+ } -+#endif -+} -+ - void CVideoReferenceClock::Process() - { - bool SetupSuccess = false; -@@ -151,6 +162,10 @@ void CVideoReferenceClock::Process() - m_D3dCallback.Reset(); - g_Windowing.Register(&m_D3dCallback); - #endif -+#if defined(HAS_GLX) && defined(HAS_XRANDR) -+ g_Windowing.Register(this); -+ m_xrrEvent = false; -+#endif - - while(!m_bStop) - { -@@ -211,6 +226,16 @@ void CVideoReferenceClock::Process() - //clean up the vblank clock - #if defined(HAS_GLX) && defined(HAS_XRANDR) - CleanupGLX(); -+ if (m_xrrEvent) -+ { -+ m_releaseEvent.Set(); -+ while (!m_bStop) -+ { -+ if (m_resetEvent.WaitMSec(100)) -+ break; -+ } -+ m_xrrEvent = false; -+ } - #elif defined(_WIN32) && defined(HAS_DX) - CleanupD3D(); - #elif defined(TARGET_DARWIN) -@@ -222,6 +247,9 @@ void CVideoReferenceClock::Process() - #if defined(_WIN32) && defined(HAS_DX) - g_Windowing.Unregister(&m_D3dCallback); - #endif -+#if defined(HAS_GLX) -+ g_Windowing.Unregister(this); -+#endif - } - - bool CVideoReferenceClock::WaitStarted(int MSecs) -@@ -231,6 +259,24 @@ bool CVideoReferenceClock::WaitStarted(int MSecs) - } - - #if defined(HAS_GLX) && defined(HAS_XRANDR) -+ -+void CVideoReferenceClock::OnLostDevice() -+{ -+ if (!m_xrrEvent) -+ { -+ m_releaseEvent.Reset(); -+ m_resetEvent.Reset(); -+ m_xrrEvent = true; -+ m_releaseEvent.Wait(); -+ } -+} -+ -+void CVideoReferenceClock::OnResetDevice() -+{ -+ m_xrrEvent = false; -+ m_resetEvent.Set(); -+} -+ - bool CVideoReferenceClock::SetupGLX() - { - int singleBufferAttributes[] = { -@@ -382,10 +428,6 @@ bool CVideoReferenceClock::SetupGLX() - return false; - } - -- //set up receiving of RandR events, we'll get one when the refreshrate changes -- XRRQueryExtension(m_Dpy, &m_RREventBase, &ReturnV); -- XRRSelectInput(m_Dpy, g_Windowing.GetWindow(), RRScreenChangeNotifyMask); -- - UpdateRefreshrate(true); //forced refreshrate update - m_MissedVblanks = 0; - -@@ -586,6 +628,9 @@ void CVideoReferenceClock::RunGLX() - - while(!m_bStop) - { -+ if (m_xrrEvent) -+ return; -+ - //wait for the next vblank - if (!m_bIsATI) - { -@@ -649,7 +694,6 @@ void CVideoReferenceClock::RunGLX() - UpdateClock((int)(VblankCount - PrevVblankCount), true); - SingleLock.Leave(); - SendVblankSignal(); -- UpdateRefreshrate(); - IsReset = false; - } - else if (!m_bStop) -@@ -1186,23 +1230,10 @@ bool CVideoReferenceClock::UpdateRefreshrate(bool Forced /*= false*/) - - #if defined(HAS_GLX) && defined(HAS_XRANDR) - -- //check for RandR events -- bool GotEvent = Forced || m_RefreshChanged == 2; -- XEvent Event; -- while (XCheckTypedEvent(m_Dpy, m_RREventBase + RRScreenChangeNotify, &Event)) -- { -- if (Event.type == m_RREventBase + RRScreenChangeNotify) -- { -- CLog::Log(LOGDEBUG, "CVideoReferenceClock: Received RandR event %i", Event.type); -- GotEvent = true; -- } -- XRRUpdateConfiguration(&Event); -- } -- - if (!Forced) - m_RefreshChanged = 0; - -- if (!GotEvent) //refreshrate did not change -+ if (!Forced) //refreshrate did not change - return false; - - //the refreshrate can be wrong on nvidia drivers, so read it from nvidia-settings when it's available -diff --git a/xbmc/video/VideoReferenceClock.h b/xbmc/video/VideoReferenceClock.h -index dcc4f09..7eb6317 100644 ---- a/xbmc/video/VideoReferenceClock.h -+++ b/xbmc/video/VideoReferenceClock.h -@@ -30,6 +30,7 @@ - #include - #include - #include -+ #include "guilib/DispResource.h" - #elif defined(_WIN32) && defined(HAS_DX) - #include - #include "guilib/D3DResource.h" -@@ -56,9 +57,13 @@ class CD3DCallback : public ID3DResource - #endif - - class CVideoReferenceClock : public CThread -+#if defined(HAS_GLX) && defined(HAS_XRANDR) -+ ,public IDispResource -+#endif - { - public: - CVideoReferenceClock(); -+ virtual ~CVideoReferenceClock(); - - int64_t GetTime(bool interpolated = true); - int64_t GetFrequency(); -@@ -75,6 +80,11 @@ class CVideoReferenceClock : public CThread - void VblankHandler(int64_t nowtime, double fps); - #endif - -+#if defined(HAS_GLX) && defined(HAS_XRANDR) -+ virtual void OnLostDevice(); -+ virtual void OnResetDevice(); -+#endif -+ - private: - void Process(); - bool UpdateRefreshrate(bool Forced = false); -@@ -121,7 +131,8 @@ class CVideoReferenceClock : public CThread - GLXContext m_Context; - Pixmap m_pixmap; - GLXPixmap m_glPixmap; -- int m_RREventBase; -+ bool m_xrrEvent; -+ CEvent m_releaseEvent, m_resetEvent; - - bool m_UseNvSettings; - bool m_bIsATI; --- -1.8.1.6 - - -From 1636c5e745fc2a37ad6bb735628342a6251bf9ad Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Thu, 21 Jun 2012 17:26:51 +0200 -Subject: [PATCH 48/94] X11: fix video calibrations - ---- - xbmc/settings/Settings.cpp | 1 + - xbmc/windowing/WinSystem.h | 1 + - xbmc/windowing/X11/WinSystemX11.cpp | 36 +++++++++++++++++++++++++++++++++++- - xbmc/windowing/X11/WinSystemX11.h | 1 + - 4 files changed, 38 insertions(+), 1 deletion(-) - -diff --git a/xbmc/settings/Settings.cpp b/xbmc/settings/Settings.cpp -index 8a430ad..fde6e4e 100644 ---- a/xbmc/settings/Settings.cpp -+++ b/xbmc/settings/Settings.cpp -@@ -55,6 +55,7 @@ - #include "filesystem/File.h" - #include "filesystem/DirectoryCache.h" - #include "DatabaseManager.h" -+#include "windowing/WindowingFactory.h" - - using namespace std; - using namespace XFILE; -diff --git a/xbmc/windowing/WinSystem.h b/xbmc/windowing/WinSystem.h -index 05c5eda..852d085 100644 ---- a/xbmc/windowing/WinSystem.h -+++ b/xbmc/windowing/WinSystem.h -@@ -100,6 +100,7 @@ class CWinSystemBase - std::vector ScreenResolutions(int screen); - std::vector RefreshRates(int screen, int width, int height, uint32_t dwFlags); - REFRESHRATE DefaultRefreshRate(int screen, std::vector rates); -+ virtual bool HasCalibration(const RESOLUTION_INFO &resInfo) { return true; }; - - protected: - void UpdateDesktopResolution(RESOLUTION_INFO& newRes, int screen, int width, int height, float refreshRate, uint32_t dwFlags = 0); -diff --git a/xbmc/windowing/X11/WinSystemX11.cpp b/xbmc/windowing/X11/WinSystemX11.cpp -index d3d15e2..487b324 100644 ---- a/xbmc/windowing/X11/WinSystemX11.cpp -+++ b/xbmc/windowing/X11/WinSystemX11.cpp -@@ -320,7 +320,7 @@ void CWinSystemX11::UpdateResolutions() - res.strMode.Format("%s: %s @ %.2fHz", out->name.c_str(), mode.name.c_str(), mode.hz); - res.strOutput = out->name; - res.strId = mode.id; -- res.iSubtitles = (int)(0.95*mode.h); -+ res.iSubtitles = (int)(0.965*mode.h); - res.fRefreshRate = mode.hz; - res.bFullScreen = true; - -@@ -333,8 +333,42 @@ void CWinSystemX11::UpdateResolutions() - g_settings.m_ResInfo.push_back(res); - } - } -+ g_settings.ApplyCalibrations(); - #endif -+} -+ -+bool CWinSystemX11::HasCalibration(const RESOLUTION_INFO &resInfo) -+{ -+ XOutput *out = g_xrandr.GetOutput(m_currentOutput); -+ -+ // keep calibrations done on a not connected output -+ if (!out->name.Equals(resInfo.strOutput)) -+ return true; -+ -+ // keep calibrations not updated with resolution data -+ if (resInfo.iWidth == 0) -+ return true; -+ -+ float fPixRatio; -+ if (resInfo.iHeight>0 && resInfo.iWidth>0 && out->hmm>0 && out->wmm>0) -+ fPixRatio = ((float)out->wmm/(float)resInfo.iWidth) / (((float)out->hmm/(float)resInfo.iHeight)); -+ else -+ fPixRatio = 1.0f; - -+ if (resInfo.Overscan.left != 0) -+ return true; -+ if (resInfo.Overscan.top != 0) -+ return true; -+ if (resInfo.Overscan.right != resInfo.iWidth) -+ return true; -+ if (resInfo.Overscan.bottom != resInfo.iHeight) -+ return true; -+ if (resInfo.fPixelRatio != fPixRatio) -+ return true; -+ if (resInfo.iSubtitles != (int)(0.965*resInfo.iHeight)) -+ return true; -+ -+ return false; - } - - void CWinSystemX11::GetConnectedOutputs(std::vector *outputs) -diff --git a/xbmc/windowing/X11/WinSystemX11.h b/xbmc/windowing/X11/WinSystemX11.h -index cc28f56..c046c86 100644 ---- a/xbmc/windowing/X11/WinSystemX11.h -+++ b/xbmc/windowing/X11/WinSystemX11.h -@@ -61,6 +61,7 @@ class CWinSystemX11 : public CWinSystemBase - virtual bool Show(bool raise = true); - virtual void Register(IDispResource *resource); - virtual void Unregister(IDispResource *resource); -+ virtual bool HasCalibration(const RESOLUTION_INFO &resInfo); - - // Local to WinSystemX11 only - Display* GetDisplay() { return m_dpy; } --- -1.8.1.6 - - -From 83dbf0a3c154fd544a53a26399e659ed6f88bcd4 Mon Sep 17 00:00:00 2001 -From: FernetMenta -Date: Thu, 5 Jul 2012 12:00:26 +0200 -Subject: [PATCH 49/94] X11: deactivate screen saver on startup - ---- - xbmc/windowing/X11/WinSystemX11.cpp | 29 +++++++++++++++++++++++++++++ - xbmc/windowing/X11/WinSystemX11.h | 1 + - 2 files changed, 30 insertions(+) - -diff --git a/xbmc/windowing/X11/WinSystemX11.cpp b/xbmc/windowing/X11/WinSystemX11.cpp -index 487b324..b3e7ab5 100644 ---- a/xbmc/windowing/X11/WinSystemX11.cpp -+++ b/xbmc/windowing/X11/WinSystemX11.cpp -@@ -521,6 +521,33 @@ void CWinSystemX11::ResetOSScreensaver() - } - } - -+void CWinSystemX11::EnableSystemScreenSaver(bool bEnable) -+{ -+ if (!m_dpy) -+ return; -+ -+ if (bEnable) -+ XForceScreenSaver(m_dpy, ScreenSaverActive); -+ else -+ { -+ Window root_return, child_return; -+ int root_x_return, root_y_return; -+ int win_x_return, win_y_return; -+ unsigned int mask_return; -+ bool isInWin = XQueryPointer(m_dpy, RootWindow(m_dpy, m_nScreen), &root_return, &child_return, -+ &root_x_return, &root_y_return, -+ &win_x_return, &win_y_return, -+ &mask_return); -+ -+ XWarpPointer(m_dpy, None, RootWindow(m_dpy, m_nScreen), 0, 0, 0, 0, root_x_return+300, root_y_return+300); -+ XSync(m_dpy, FALSE); -+ XWarpPointer(m_dpy, None, RootWindow(m_dpy, m_nScreen), 0, 0, 0, 0, 0, 0); -+ XSync(m_dpy, FALSE); -+ XWarpPointer(m_dpy, None, RootWindow(m_dpy, m_nScreen), 0, 0, 0, 0, root_x_return, root_y_return); -+ XSync(m_dpy, FALSE); -+ } -+} -+ - void CWinSystemX11::NotifyAppActiveChange(bool bActivated) - { - if (bActivated && m_bWasFullScreenBeforeMinimize && !m_bFullScreen) -@@ -764,6 +791,8 @@ bool CWinSystemX11::SetWindow(int width, int height, bool fullscreen, const CStd - // create main window - if (!m_glWindow) - { -+ EnableSystemScreenSaver(false); -+ - GLint att[] = - { - GLX_RGBA, -diff --git a/xbmc/windowing/X11/WinSystemX11.h b/xbmc/windowing/X11/WinSystemX11.h -index c046c86..e953d2d 100644 ---- a/xbmc/windowing/X11/WinSystemX11.h -+++ b/xbmc/windowing/X11/WinSystemX11.h -@@ -51,6 +51,7 @@ class CWinSystemX11 : public CWinSystemBase - virtual void ShowOSMouse(bool show); - virtual void ResetOSScreensaver(); - virtual bool EnableFrameLimiter(); -+ virtual void EnableSystemScreenSaver(bool bEnable); - - virtual void NotifyAppActiveChange(bool bActivated); - virtual void NotifyAppFocusChange(bool bGaining); --- -1.8.1.6 - - -From c0123c262e1b251bc4c9f05e9bb13b67be4341a5 Mon Sep 17 00:00:00 2001 -From: FernetMenta -Date: Thu, 5 Jul 2012 12:10:09 +0200 -Subject: [PATCH 50/94] X11: change method of going full-screen - ---- - xbmc/windowing/X11/WinSystemX11.cpp | 9 ++++++++- - 1 file changed, 8 insertions(+), 1 deletion(-) - -diff --git a/xbmc/windowing/X11/WinSystemX11.cpp b/xbmc/windowing/X11/WinSystemX11.cpp -index b3e7ab5..91f92c1 100644 ---- a/xbmc/windowing/X11/WinSystemX11.cpp -+++ b/xbmc/windowing/X11/WinSystemX11.cpp -@@ -34,6 +34,7 @@ - #include "utils/TimeUtils.h" - #include "settings/GUISettings.h" - #include "windowing/WindowingFactory.h" -+#include - - #if defined(HAS_XRANDR) - #include -@@ -816,7 +817,7 @@ bool CWinSystemX11::SetWindow(int width, int height, bool fullscreen, const CStd - cmap = XCreateColormap(m_dpy, RootWindow(m_dpy, vi->screen), vi->visual, AllocNone); - - int def_vis = (vi->visual == DefaultVisual(m_dpy, vi->screen)); -- swa.override_redirect = fullscreen ? True : False; -+ swa.override_redirect = False; - swa.border_pixel = fullscreen ? 0 : 5; - swa.background_pixel = def_vis ? BlackPixel(m_dpy, vi->screen) : 0; - swa.colormap = cmap; -@@ -832,6 +833,12 @@ bool CWinSystemX11::SetWindow(int width, int height, bool fullscreen, const CStd - InputOutput, vi->visual, - mask, &swa); - -+ if (fullscreen) -+ { -+ Atom fs = XInternAtom(m_dpy, "_NET_WM_STATE_FULLSCREEN", True); -+ XChangeProperty(m_dpy, m_glWindow, XInternAtom(m_dpy, "_NET_WM_STATE", True), XA_ATOM, 32, PropModeReplace, (unsigned char *) &fs, 1); -+ } -+ - // define invisible cursor - Pixmap bitmapNoData; - XColor black; --- -1.8.1.6 - - -From 779f1492b78e0784c44abcc52baf1574f416a411 Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Thu, 28 Jun 2012 19:12:39 +0200 -Subject: [PATCH 51/94] X11: reset key repeat and key modifier on focus lost - and gain - ---- - xbmc/windowing/WinEventsX11.cpp | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/xbmc/windowing/WinEventsX11.cpp b/xbmc/windowing/WinEventsX11.cpp -index 6c22358..d86205d 100644 ---- a/xbmc/windowing/WinEventsX11.cpp -+++ b/xbmc/windowing/WinEventsX11.cpp -@@ -359,6 +359,8 @@ bool CWinEventsX11::MessagePump() - if (WinEvents->m_xic) - XSetICFocus(WinEvents->m_xic); - g_application.m_AppFocused = true; -+ memset(&(WinEvents->m_lastKey), 0, sizeof(XBMC_Event)); -+ WinEvents->m_keymodState = 0; - if (serial == xevent.xfocus.serial) - break; - g_Windowing.NotifyAppFocusChange(g_application.m_AppFocused); -@@ -370,6 +372,7 @@ bool CWinEventsX11::MessagePump() - if (WinEvents->m_xic) - XUnsetICFocus(WinEvents->m_xic); - g_application.m_AppFocused = false; -+ memset(&(WinEvents->m_lastKey), 0, sizeof(XBMC_Event)); - g_Windowing.NotifyAppFocusChange(g_application.m_AppFocused); - serial = xevent.xfocus.serial; - break; --- -1.8.1.6 - - -From 09f5f756e289e497f26b8bf389b816ce1061fc4a Mon Sep 17 00:00:00 2001 -From: Joakim Plate -Date: Thu, 5 Jul 2012 14:18:46 +0200 -Subject: [PATCH 52/94] X11: replace custom utf8 to unicode with charset - convertor (squash to x11 events) - ---- - xbmc/windowing/WinEventsX11.cpp | 119 ++++------------------------------------ - xbmc/windowing/WinEventsX11.h | 2 - - 2 files changed, 11 insertions(+), 110 deletions(-) - -diff --git a/xbmc/windowing/WinEventsX11.cpp b/xbmc/windowing/WinEventsX11.cpp -index d86205d..76702e6 100644 ---- a/xbmc/windowing/WinEventsX11.cpp -+++ b/xbmc/windowing/WinEventsX11.cpp -@@ -32,6 +32,7 @@ - #include "X11/keysymdef.h" - #include "X11/XF86keysym.h" - #include "utils/log.h" -+#include "utils/CharsetConverter.h" - #include "guilib/GUIWindowManager.h" - #include "input/MouseStat.h" - -@@ -161,7 +162,6 @@ - m_display = 0; - m_window = 0; - m_keybuf = 0; -- m_utf16buf = 0; - } - - CWinEventsX11::~CWinEventsX11() -@@ -172,12 +172,6 @@ - m_keybuf = 0; - } - -- if (m_utf16buf) -- { -- free(m_utf16buf); -- m_utf16buf = 0; -- } -- - if (m_xic) - { - XUnsetICFocus(m_xic); -@@ -203,7 +197,6 @@ bool CWinEventsX11::Init(Display *dpy, Window win) - WinEvents->m_display = dpy; - WinEvents->m_window = win; - WinEvents->m_keybuf = (char*)malloc(32*sizeof(char)); -- WinEvents->m_utf16buf = (uint16_t*)malloc(32*sizeof(uint16_t)); - WinEvents->m_keymodState = 0; - WinEvents->m_wmDeleteMessage = XInternAtom(dpy, "WM_DELETE_WINDOW", False); - WinEvents->m_structureChanged = false; -@@ -433,8 +426,6 @@ bool CWinEventsX11::MessagePump() - } - - Status status; -- int utf16size; -- int utf16length; - int len; - len = Xutf8LookupString(WinEvents->m_xic, &xevent.xkey, - WinEvents->m_keybuf, sizeof(WinEvents->m_keybuf), -@@ -453,36 +444,29 @@ bool CWinEventsX11::MessagePump() - case XLookupChars: - case XLookupBoth: - { -- if (len == 0) -- break; -- utf16size = len * sizeof(uint16_t); -- if (utf16size > sizeof(WinEvents->m_utf16buf)) -- { -- WinEvents->m_utf16buf = (uint16_t *)realloc(WinEvents->m_utf16buf,utf16size); -- if (WinEvents->m_utf16buf == NULL) -- { -- break; -- } -- } -- utf16length = Utf8ToUnicode(WinEvents->m_keybuf, len, WinEvents->m_utf16buf, utf16size); -- if (utf16length < 0) -+ CStdString data(WinEvents->m_keybuf, len); -+ CStdStringW keys; -+ g_charsetConverter.utf8ToW(data, keys, false); -+ -+ if (keys.length() == 0) - { - break; - } -- for (unsigned int i = 0; i < utf16length - 1; i++) -+ -+ for (unsigned int i = 0; i < keys.length() - 1; i++) - { - newEvent.key.keysym.sym = XBMCK_UNKNOWN; -- newEvent.key.keysym.unicode = WinEvents->m_utf16buf[i]; -+ newEvent.key.keysym.unicode = keys[i]; - newEvent.key.state = xevent.xkey.state; - newEvent.key.type = xevent.xkey.type; - ret |= ProcessKey(newEvent, 500); - } -- if (utf16length > 0) -+ if (keys.length() > 0) - { - newEvent.key.keysym.scancode = xevent.xkey.keycode; - xkeysym = XLookupKeysym(&xevent.xkey, 0); - newEvent.key.keysym.sym = LookupXbmcKeySym(xkeysym); -- newEvent.key.keysym.unicode = WinEvents->m_utf16buf[utf16length - 1]; -+ newEvent.key.keysym.unicode = keys[keys.length() - 1]; - newEvent.key.state = xevent.xkey.state; - newEvent.key.type = xevent.xkey.type; - -@@ -743,87 +727,6 @@ bool CWinEventsX11::ProcessKeyRepeat() - return false; - } - --int CWinEventsX11::Utf8ToUnicode(const char *utf8, const int utf8Length, uint16_t *utf16, const int utf16MaxLength) --{ -- // p moves over the output buffer. max_ptr points to the next to the last slot of the buffer. -- uint16_t *p = utf16; -- uint16_t const *const maxPtr = utf16 + utf16MaxLength; -- -- // end_of_input points to the last byte of input as opposed to the next to the last byte. -- char const *const endOfInput = utf8 + utf8Length - 1; -- -- while (utf8 <= endOfInput) -- { -- unsigned char const c = *utf8; -- if (p >= maxPtr) -- { -- //No more output space. -- return -1; -- } -- if (c < 0x80) -- { -- //One byte ASCII. -- *p++ = c; -- utf8 += 1; -- } -- else if (c < 0xC0) -- { -- // Follower byte without preceding leader bytes. -- return -1; -- } -- // 11 bits -- else if (c < 0xE0) -- { -- // Two byte sequence. We need one follower byte. -- if (endOfInput - utf8 < 1 || (((utf8[1] ^ 0x80)) & 0xC0)) -- { -- return -1; -- } -- *p++ = (uint16_t)(((c & 0x1F) << 6) + (utf8[1] & 0x3F)); -- utf8 += 2; -- } -- // 16 bis -- else if (c < 0xF0) -- { -- // Three byte sequence. We need two follower byte. -- if (endOfInput - utf8 < 2 || ((utf8[1] ^ 0x80) & 0xC0) || ((utf8[2] ^ 0x80) & 0xC0)) -- { -- return -1; -- } -- *p++ = (uint16_t)(((c & 0xF) << 12) + ((utf8[1] & 0x3F) << 6) + (utf8[2] & 0x3F)); -- utf8 += 3; -- } -- // 21 bits -- else if (c < 0xF8) -- { -- int plane; -- // Four byte sequence. We need three follower bytes. -- if (endOfInput - utf8 < 3 || ((utf8[1] ^ 0x80) & 0xC0) || -- ((utf8[2] ^ 0x80) & 0xC0) || ((utf8[3] ^ 0x80) & 0xC0)) -- { -- return -1; -- } -- uint32_t unicode = ((c & 0x7) << 18) + ((utf8[1] & 0x3F) << 12) + -- ((utf8[2] & 0x3F) << 6) + (utf8[3] & 0x3F); -- utf8 += 4; -- CLog::Log(LOGERROR, "CWinEventsX11::Utf8ToUnicode: 4 byte unicode not supported"); -- } -- // 26 bits -- else if (c < 0xFC) -- { -- CLog::Log(LOGERROR, "CWinEventsX11::Utf8ToUnicode: 4 byte unicode not supported"); -- utf8 += 5; -- } -- // 31 bit -- else -- { -- CLog::Log(LOGERROR, "CWinEventsX11::Utf8ToUnicode: 4 byte unicode not supported"); -- utf8 += 6; -- } -- } -- return p - utf16; --} -- - XBMCKey CWinEventsX11::LookupXbmcKeySym(KeySym keysym) - { - // try direct mapping first -diff --git a/xbmc/windowing/WinEventsX11.h b/xbmc/windowing/WinEventsX11.h -index 6100933..72955ad 100644 ---- a/xbmc/windowing/WinEventsX11.h -+++ b/xbmc/windowing/WinEventsX11.h -@@ -38,7 +38,6 @@ class CWinEventsX11 : public CWinEventsBase - static bool MessagePump(); - - protected: -- static int Utf8ToUnicode(const char *utf8, const int utf8Length, uint16_t *utf16, const int utf16MaxLength); - static XBMCKey LookupXbmcKeySym(KeySym keysym); - static bool ProcessKey(XBMC_Event &event, int repeatDelay); - static bool ProcessKeyRepeat(); -@@ -48,7 +47,6 @@ class CWinEventsX11 : public CWinEventsBase - Window m_window; - Atom m_wmDeleteMessage; - char *m_keybuf; -- uint16_t *m_utf16buf; - XIM m_xim; - XIC m_xic; - XBMC_Event m_lastKey; --- -1.8.1.6 - - -From dc954e75c70003fb6cfa29965f525a8addb69052 Mon Sep 17 00:00:00 2001 -From: Joakim Plate -Date: Thu, 5 Jul 2012 14:23:54 +0200 -Subject: [PATCH 53/94] X11: fixed invalid usage of sizeof() (squash into x11 - changes) - ---- - xbmc/windowing/WinEventsX11.cpp | 11 +++++++---- - xbmc/windowing/WinEventsX11.h | 1 + - 2 files changed, 8 insertions(+), 4 deletions(-) - -diff --git a/xbmc/windowing/WinEventsX11.cpp b/xbmc/windowing/WinEventsX11.cpp -index 76702e6..c31877e 100644 ---- a/xbmc/windowing/WinEventsX11.cpp -+++ b/xbmc/windowing/WinEventsX11.cpp -@@ -162,6 +162,7 @@ - m_display = 0; - m_window = 0; - m_keybuf = 0; -+ m_keybuf_len = 0; - } - - CWinEventsX11::~CWinEventsX11() -@@ -196,7 +197,8 @@ bool CWinEventsX11::Init(Display *dpy, Window win) - WinEvents = new CWinEventsX11(); - WinEvents->m_display = dpy; - WinEvents->m_window = win; -- WinEvents->m_keybuf = (char*)malloc(32*sizeof(char)); -+ WinEvents->m_keybuf_len = 32*sizeof(char); -+ WinEvents->m_keybuf = (char*)malloc(WinEvents->m_keybuf_len); - WinEvents->m_keymodState = 0; - WinEvents->m_wmDeleteMessage = XInternAtom(dpy, "WM_DELETE_WINDOW", False); - WinEvents->m_structureChanged = false; -@@ -428,13 +430,14 @@ bool CWinEventsX11::MessagePump() - Status status; - int len; - len = Xutf8LookupString(WinEvents->m_xic, &xevent.xkey, -- WinEvents->m_keybuf, sizeof(WinEvents->m_keybuf), -+ WinEvents->m_keybuf, WinEvents->m_keybuf_len, - &xkeysym, &status); - if (status == XBufferOverflow) - { -- WinEvents->m_keybuf = (char*)realloc(WinEvents->m_keybuf, len*sizeof(char)); -+ WinEvents->m_keybuf_len = len; -+ WinEvents->m_keybuf = (char*)realloc(WinEvents->m_keybuf, WinEvents->m_keybuf_len); - len = Xutf8LookupString(WinEvents->m_xic, &xevent.xkey, -- WinEvents->m_keybuf, sizeof(WinEvents->m_keybuf), -+ WinEvents->m_keybuf, WinEvents->m_keybuf_len, - &xkeysym, &status); - } - switch (status) -diff --git a/xbmc/windowing/WinEventsX11.h b/xbmc/windowing/WinEventsX11.h -index 72955ad..102a076 100644 ---- a/xbmc/windowing/WinEventsX11.h -+++ b/xbmc/windowing/WinEventsX11.h -@@ -47,6 +47,7 @@ class CWinEventsX11 : public CWinEventsBase - Window m_window; - Atom m_wmDeleteMessage; - char *m_keybuf; -+ size_t m_keybuf_len; - XIM m_xim; - XIC m_xic; - XBMC_Event m_lastKey; --- -1.8.1.6 - - -From b64d1ae858587c3b62f19ee08517956ceebf77a9 Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Sat, 9 Jun 2012 18:23:53 +0200 -Subject: [PATCH 54/94] add missing keys to xbmc keytable - ---- - xbmc/input/XBMC_keytable.cpp | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/xbmc/input/XBMC_keytable.cpp b/xbmc/input/XBMC_keytable.cpp -index aaf65ba..9d7922f 100644 ---- a/xbmc/input/XBMC_keytable.cpp -+++ b/xbmc/input/XBMC_keytable.cpp -@@ -179,6 +179,8 @@ - , { XBMCK_LAUNCH_APP2, 0, 0, XBMCVK_LAUNCH_APP2, "launch_app2_pc_icon" } - , { XBMCK_LAUNCH_FILE_BROWSER, 0, 0, XBMCVK_LAUNCH_FILE_BROWSER, "launch_file_browser" } - , { XBMCK_LAUNCH_MEDIA_CENTER, 0, 0, XBMCVK_LAUNCH_MEDIA_CENTER, "launch_media_center" } -+, { XBMCK_PLAY, 0, 0, XBMCVK_MEDIA_PLAY_PAUSE, "play_pause" } -+, { XBMCK_STOP, 0, 0, XBMCVK_MEDIA_STOP, "stop" } - - // Function keys - , { XBMCK_F1, 0, 0, XBMCVK_F1, "f1"} --- -1.8.1.6 - - -From 39406f7e4f0a5a338109941303fd7afefc5e85b5 Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Fri, 16 Mar 2012 15:57:51 +0100 -Subject: [PATCH 55/94] videorefclock: temp deactivate of nv settings - ---- - xbmc/video/VideoReferenceClock.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/xbmc/video/VideoReferenceClock.cpp b/xbmc/video/VideoReferenceClock.cpp -index fa8e35a..85e36c7 100644 ---- a/xbmc/video/VideoReferenceClock.cpp -+++ b/xbmc/video/VideoReferenceClock.cpp -@@ -135,7 +135,7 @@ - m_Context = NULL; - m_pixmap = None; - m_glPixmap = None; -- m_UseNvSettings = true; -+ m_UseNvSettings = false; - m_bIsATI = false; - #endif - } --- -1.8.1.6 - - -From 7810f1067b553e70f08df4bdb67c9bb9b8e83f83 Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Mon, 20 Aug 2012 09:09:09 +0200 -Subject: [PATCH 56/94] videorefclock: ask graphics context for refresh rate - ---- - xbmc/video/VideoReferenceClock.cpp | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/xbmc/video/VideoReferenceClock.cpp b/xbmc/video/VideoReferenceClock.cpp -index 85e36c7..8209163 100644 ---- a/xbmc/video/VideoReferenceClock.cpp -+++ b/xbmc/video/VideoReferenceClock.cpp -@@ -30,6 +30,7 @@ - #include - #include - #include "windowing/WindowingFactory.h" -+ #include "guilib/GraphicContext.h" - #define NVSETTINGSCMD "nvidia-settings -nt -q RefreshRate3" - #elif defined(TARGET_DARWIN_OSX) - #include -@@ -1254,7 +1255,7 @@ bool CVideoReferenceClock::UpdateRefreshrate(bool Forced /*= false*/) - } - - CSingleLock SingleLock(m_CritSection); -- m_RefreshRate = GetRandRRate(); -+ m_RefreshRate = MathUtils::round_int(g_graphicsContext.GetFPS()); - - CLog::Log(LOGDEBUG, "CVideoReferenceClock: Detected refreshrate: %i hertz", (int)m_RefreshRate); - --- -1.8.1.6 - - -From 36fcc0c608b65e7ff2a63ff752656eda9e45179b Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Mon, 9 Jul 2012 14:00:18 +0200 -Subject: [PATCH 57/94] X11: fix icon texture after - cc5ed3c2474084ebc0373a3046410e6f766e03f4 - ---- - xbmc/windowing/X11/WinSystemX11.cpp | 43 ++++++++++++++++++++++--------------- - 1 file changed, 26 insertions(+), 17 deletions(-) - -diff --git a/xbmc/windowing/X11/WinSystemX11.cpp b/xbmc/windowing/X11/WinSystemX11.cpp -index 91f92c1..174ccef 100644 ---- a/xbmc/windowing/X11/WinSystemX11.cpp -+++ b/xbmc/windowing/X11/WinSystemX11.cpp -@@ -874,22 +874,24 @@ bool CWinSystemX11::SetWindow(int width, int height, bool fullscreen, const CStd - if (!fullscreen) - { - CreateIconPixmap(); -- XWMHints wm_hints; -- XClassHint class_hints; -+ XWMHints *wm_hints; - XTextProperty windowName, iconName; - std::string titleString = "XBMC Media Center"; - char *title = (char*)titleString.c_str(); - - XStringListToTextProperty(&title, 1, &windowName); - XStringListToTextProperty(&title, 1, &iconName); -- wm_hints.initial_state = NormalState; -- wm_hints.input = True; -- wm_hints.icon_pixmap = m_icon; -- wm_hints.flags = StateHint | IconPixmapHint | InputHint; - -+ wm_hints = XAllocWMHints(); -+ wm_hints->initial_state = NormalState; -+ wm_hints->icon_pixmap = m_icon; -+ wm_hints->flags = StateHint | IconPixmapHint; -+ -+ XSync(m_dpy,False); - XSetWMProperties(m_dpy, m_glWindow, &windowName, &iconName, -- NULL, 0, NULL, &wm_hints, -+ NULL, 0, NULL, wm_hints, - NULL); -+ XFree(wm_hints); - - // register interest in the delete window message - Atom wmDeleteMessage = XInternAtom(m_dpy, "WM_DELETE_WINDOW", False); -@@ -974,16 +976,21 @@ bool CWinSystemX11::CreateIconPixmap() - gRatio = vis->green_mask / 255.0; - bRatio = vis->blue_mask / 255.0; - -- CTexture iconTexture; -- iconTexture.LoadFromFile("special://xbmc/media/icon.png"); -- buf = iconTexture.GetPixels(); -+ CBaseTexture *iconTexture = CBaseTexture::LoadFromFile("special://xbmc/media/icon.png"); -+ -+ if (!iconTexture) -+ return false; - -- numBufBytes = iconTexture.GetWidth() * iconTexture.GetHeight() * 4; -+ buf = iconTexture->GetPixels(); -+ -+ numBufBytes = iconTexture->GetWidth() * iconTexture->GetHeight() * 4; -+ int wid = iconTexture->GetWidth(); -+ int hi = iconTexture->GetHeight(); - - if (depth>=24) -- numNewBufBytes = (4 * (iconTexture.GetWidth() * iconTexture.GetHeight())); -+ numNewBufBytes = (4 * (iconTexture->GetWidth() * iconTexture->GetHeight())); - else -- numNewBufBytes = (2 * (iconTexture.GetWidth() * iconTexture.GetHeight())); -+ numNewBufBytes = (2 * (iconTexture->GetWidth() * iconTexture->GetHeight())); - - newBuf = (uint32_t*)malloc(numNewBufBytes); - if (!newBuf) -@@ -992,11 +999,11 @@ bool CWinSystemX11::CreateIconPixmap() - return false; - } - -- for (i=0; iGetHeight();++i) - { -- for (j=0; jGetWidth();++j) - { -- unsigned int pos = i*iconTexture.GetPitch()+j*4; -+ unsigned int pos = i*iconTexture->GetPitch()+j*4; - unsigned int r, g, b; - r = (buf[pos+2] * rRatio); - g = (buf[pos+1] * gRatio); -@@ -1009,7 +1016,7 @@ bool CWinSystemX11::CreateIconPixmap() - } - } - img = XCreateImage(m_dpy, vis, depth,ZPixmap, 0, (char *)newBuf, -- iconTexture.GetWidth(), iconTexture.GetHeight(), -+ iconTexture->GetWidth(), iconTexture->GetHeight(), - (depth>=24)?32:16, 0); - if (!img) - { -@@ -1047,6 +1054,8 @@ bool CWinSystemX11::CreateIconPixmap() - XFreeGC(m_dpy, gc); - XDestroyImage(img); // this also frees newBuf - -+ delete iconTexture; -+ - return true; - } - --- -1.8.1.6 - - -From 18ae547a1813f27053d13195fc2c513da1f98f47 Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Tue, 10 Jul 2012 11:14:12 +0200 -Subject: [PATCH 58/94] X11: check for window manager - ---- - xbmc/windowing/X11/WinSystemX11.cpp | 74 ++++++++++++++++++++++++++++++++++++- - xbmc/windowing/X11/WinSystemX11.h | 1 + - 2 files changed, 73 insertions(+), 2 deletions(-) - -diff --git a/xbmc/windowing/X11/WinSystemX11.cpp b/xbmc/windowing/X11/WinSystemX11.cpp -index 174ccef..4f1ae26 100644 ---- a/xbmc/windowing/X11/WinSystemX11.cpp -+++ b/xbmc/windowing/X11/WinSystemX11.cpp -@@ -816,8 +816,10 @@ bool CWinSystemX11::SetWindow(int width, int height, bool fullscreen, const CStd - vi = glXChooseVisual(m_dpy, m_nScreen, att); - cmap = XCreateColormap(m_dpy, RootWindow(m_dpy, vi->screen), vi->visual, AllocNone); - -+ bool hasWM = HasWindowManager(); -+ - int def_vis = (vi->visual == DefaultVisual(m_dpy, vi->screen)); -- swa.override_redirect = False; -+ swa.override_redirect = hasWM ? False : True; - swa.border_pixel = fullscreen ? 0 : 5; - swa.background_pixel = def_vis ? BlackPixel(m_dpy, vi->screen) : 0; - swa.colormap = cmap; -@@ -833,7 +835,7 @@ bool CWinSystemX11::SetWindow(int width, int height, bool fullscreen, const CStd - InputOutput, vi->visual, - mask, &swa); - -- if (fullscreen) -+ if (fullscreen && hasWM) - { - Atom fs = XInternAtom(m_dpy, "_NET_WM_STATE_FULLSCREEN", True); - XChangeProperty(m_dpy, m_glWindow, XInternAtom(m_dpy, "_NET_WM_STATE", True), XA_ATOM, 32, PropModeReplace, (unsigned char *) &fs, 1); -@@ -1059,4 +1061,72 @@ bool CWinSystemX11::CreateIconPixmap() - return true; - } - -+bool CWinSystemX11::HasWindowManager() -+{ -+ Window wm_check; -+ unsigned char *data; -+ int status, real_format; -+ Atom real_type, prop; -+ unsigned long items_read, items_left, i; -+ char req = 0; -+ -+ prop = XInternAtom(m_dpy, "_NET_SUPPORTING_WM_CHECK", True); -+ if (prop == None) -+ return false; -+ status = XGetWindowProperty(m_dpy, DefaultRootWindow(m_dpy), prop, -+ 0L, 1L, False, XA_WINDOW, &real_type, &real_format, -+ &items_read, &items_left, &data); -+ if(status != Success || ! items_read) -+ { -+ if(status == Success) -+ XFree(data); -+ return false; -+ } -+ -+ wm_check = ((Window*)data)[0]; -+ XFree(data); -+ -+ status = XGetWindowProperty(m_dpy, wm_check, prop, -+ 0L, 1L, False, XA_WINDOW, &real_type, &real_format, -+ &items_read, &items_left, &data); -+ -+ if(status != Success || !items_read) -+ { -+ if(status == Success) -+ XFree(data); -+ return false; -+ } -+ -+ if(wm_check != ((Window*)data)[0]) -+ { -+ XFree(data); -+ return false; -+ } -+ -+ XFree(data); -+ -+ prop = XInternAtom(m_dpy, "_NET_WM_NAME", True); -+ if (prop == None) -+ { -+ CLog::Log(LOGDEBUG,"Window Manager Name: "); -+ return true; -+ } -+ -+ status = XGetWindowProperty(m_dpy, wm_check, prop, -+ 0L, (~0L), False, AnyPropertyType, &real_type, &real_format, -+ &items_read, &items_left, &data); -+ -+ if(status == Success && items_read) -+ { -+ CLog::Log(LOGDEBUG,"Window Manager Name: %s", data); -+ } -+ else -+ CLog::Log(LOGDEBUG,"Window Manager Name: "); -+ -+ if(status == Success) -+ XFree(data); -+ -+ return true; -+} -+ - #endif -diff --git a/xbmc/windowing/X11/WinSystemX11.h b/xbmc/windowing/X11/WinSystemX11.h -index e953d2d..0b7c10a 100644 ---- a/xbmc/windowing/X11/WinSystemX11.h -+++ b/xbmc/windowing/X11/WinSystemX11.h -@@ -101,6 +101,7 @@ class CWinSystemX11 : public CWinSystemBase - bool IsSuitableVisual(XVisualInfo *vInfo); - static int XErrorHandler(Display* dpy, XErrorEvent* error); - bool CreateIconPixmap(); -+ bool HasWindowManager(); - - CStopWatch m_screensaverReset; - }; --- -1.8.1.6 - - -From 3ba526d4c50a2ab5f80f71b2627a3affb03e02e3 Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Thu, 12 Jul 2012 11:11:47 +0200 -Subject: [PATCH 59/94] X11: dont set window on xrandr if no mode available - ---- - xbmc/windowing/X11/WinSystemX11.cpp | 11 ++++++----- - 1 file changed, 6 insertions(+), 5 deletions(-) - -diff --git a/xbmc/windowing/X11/WinSystemX11.cpp b/xbmc/windowing/X11/WinSystemX11.cpp -index 4f1ae26..c11ea89 100644 ---- a/xbmc/windowing/X11/WinSystemX11.cpp -+++ b/xbmc/windowing/X11/WinSystemX11.cpp -@@ -665,16 +665,17 @@ void CWinSystemX11::NotifyXRREvent() - CLog::Log(LOGDEBUG, "%s - notify display reset event", __FUNCTION__); - m_windowDirty = true; - -+ if (!g_xrandr.Query(true)) -+ { -+ CLog::Log(LOGERROR, "WinSystemX11::RefreshWindow - failed to query xrandr"); -+ return; -+ } -+ - // if external event update resolutions - if (!m_bIsInternalXrr) - { - UpdateResolutions(); - } -- else if (!g_xrandr.Query(true)) -- { -- CLog::Log(LOGERROR, "WinSystemX11::RefreshWindow - failed to query xrandr"); -- return; -- } - m_bIsInternalXrr = false; - - CStdString currentOutput = g_guiSettings.GetString("videoscreen.monitor"); --- -1.8.1.6 - - -From 474ca94e03b3f2c8875799054c058df5fd7631f8 Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Thu, 26 Jul 2012 09:34:28 +0200 -Subject: [PATCH 60/94] X11: fix crash after a resolution change on startup - ---- - xbmc/windowing/X11/WinSystemX11.cpp | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/xbmc/windowing/X11/WinSystemX11.cpp b/xbmc/windowing/X11/WinSystemX11.cpp -index c11ea89..0bd72d4 100644 ---- a/xbmc/windowing/X11/WinSystemX11.cpp -+++ b/xbmc/windowing/X11/WinSystemX11.cpp -@@ -219,7 +219,8 @@ bool CWinSystemX11::SetFullScreen(bool fullScreen, RESOLUTION_INFO& res, bool bl - OnLostDevice(); - m_bIsInternalXrr = true; - g_xrandr.SetMode(out, mode); -- return true; -+ if (m_glWindow) -+ return true; - } - #endif - --- -1.8.1.6 - - -From 28537693e86087cb858924447743a092e9d0dd02 Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Sat, 15 Sep 2012 18:27:29 +0200 -Subject: [PATCH 61/94] X11: lock graphics context in NotifyXRREvent - ---- - xbmc/windowing/X11/WinSystemX11.cpp | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/xbmc/windowing/X11/WinSystemX11.cpp b/xbmc/windowing/X11/WinSystemX11.cpp -index 0bd72d4..ef83133 100644 ---- a/xbmc/windowing/X11/WinSystemX11.cpp -+++ b/xbmc/windowing/X11/WinSystemX11.cpp -@@ -666,6 +666,8 @@ void CWinSystemX11::NotifyXRREvent() - CLog::Log(LOGDEBUG, "%s - notify display reset event", __FUNCTION__); - m_windowDirty = true; - -+ CSingleLock lock(g_graphicsContext); -+ - if (!g_xrandr.Query(true)) - { - CLog::Log(LOGERROR, "WinSystemX11::RefreshWindow - failed to query xrandr"); --- -1.8.1.6 - - -From 722894437d4fac824e3e136c970a5b74e4d235bd Mon Sep 17 00:00:00 2001 -From: Rainer Hochecker -Date: Sat, 8 Oct 2011 16:45:13 +0200 -Subject: [PATCH 62/94] ffmpeg: add xvba hwaccel - ---- - lib/ffmpeg/configure | 8 ++ - lib/ffmpeg/libavcodec/Makefile | 7 +- - lib/ffmpeg/libavcodec/allcodecs.c | 4 + - lib/ffmpeg/libavcodec/h264.c | 1 + - lib/ffmpeg/libavcodec/mpegvideo.c | 1 + - lib/ffmpeg/libavcodec/xvba.c | 66 ++++++++++++ - lib/ffmpeg/libavcodec/xvba.h | 71 +++++++++++++ - lib/ffmpeg/libavcodec/xvba_h264.c | 195 ++++++++++++++++++++++++++++++++++ - lib/ffmpeg/libavcodec/xvba_internal.h | 24 +++++ - lib/ffmpeg/libavcodec/xvba_mpeg2.c | 52 +++++++++ - lib/ffmpeg/libavcodec/xvba_vc1.c | 190 +++++++++++++++++++++++++++++++++ - lib/ffmpeg/libavcodec/xvmc_internal.h | 4 +- - lib/ffmpeg/libavutil/pixdesc.c | 6 ++ - lib/ffmpeg/libavutil/pixfmt.h | 1 + - 14 files changed, 628 insertions(+), 2 deletions(-) - create mode 100644 lib/ffmpeg/libavcodec/xvba.c - create mode 100644 lib/ffmpeg/libavcodec/xvba.h - create mode 100644 lib/ffmpeg/libavcodec/xvba_h264.c - create mode 100644 lib/ffmpeg/libavcodec/xvba_internal.h - create mode 100644 lib/ffmpeg/libavcodec/xvba_mpeg2.c - create mode 100644 lib/ffmpeg/libavcodec/xvba_vc1.c - -diff --git a/lib/ffmpeg/configure b/lib/ffmpeg/configure -index c06005b..157cfd3 100755 ---- a/lib/ffmpeg/configure -+++ b/lib/ffmpeg/configure -@@ -113,6 +113,7 @@ Configuration options: - --enable-vdpau enable VDPAU code [autodetect] - --disable-dxva2 disable DXVA2 code - --disable-vda disable VDA code -+ --disable-xvba disable XVBA code - --enable-runtime-cpudetect detect cpu capabilities at runtime (bigger binary) - --enable-hardcoded-tables use hardcoded tables instead of runtime generation - --disable-safe-bitstream-reader -@@ -1084,6 +1085,7 @@ CONFIG_LIST=" - vaapi - vda - vdpau -+ xvba - version3 - x11grab - zlib -@@ -1423,6 +1425,7 @@ h264_dxva2_hwaccel_select="dxva2 h264_decoder" - h264_vaapi_hwaccel_select="vaapi h264_decoder" - h264_vda_hwaccel_deps="VideoDecodeAcceleration_VDADecoder_h pthreads" - h264_vda_hwaccel_select="vda h264_decoder" -+h264_xvba_hwaccel_select="xvba h264_decoder" - h264_vdpau_decoder_select="vdpau h264_decoder" - imc_decoder_select="fft mdct sinewin" - jpegls_decoder_select="golomb" -@@ -1459,6 +1462,7 @@ mpeg4_crystalhd_decoder_select="crystalhd" - mpeg4_decoder_select="h263_decoder mpeg4video_parser" - mpeg4_encoder_select="h263_encoder" - mpeg4_vaapi_hwaccel_select="vaapi mpeg4_decoder" -+mpeg2_xvba_hwaccel_select="xvba mpeg2video_decoder" - mpeg4_vdpau_decoder_select="vdpau mpeg4_decoder" - msmpeg4_crystalhd_decoder_select="crystalhd" - msmpeg4v1_decoder_select="h263_decoder" -@@ -1501,6 +1505,7 @@ vc1_decoder_select="h263_decoder h264chroma" - vc1_dxva2_hwaccel_deps="dxva2api_h" - vc1_dxva2_hwaccel_select="dxva2 vc1_decoder" - vc1_vaapi_hwaccel_select="vaapi vc1_decoder" -+vc1_xvba_hwaccel_select="xvba vc1_decoder" - vc1_vdpau_decoder_select="vdpau vc1_decoder" - vc1image_decoder_select="vc1_decoder" - vorbis_decoder_select="mdct" -@@ -1525,6 +1530,7 @@ wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel" - wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel" - wmv3_vdpau_decoder_select="vc1_vdpau_decoder" - wmv3image_decoder_select="wmv3_decoder" -+wmv3_xvba_hwaccel_select="vc1_xvba_hwaccel" - zlib_decoder_select="zlib" - zlib_encoder_select="zlib" - zmbv_decoder_select="zlib" -@@ -1533,6 +1539,7 @@ zmbv_encoder_select="zlib" - crystalhd_deps="libcrystalhd_libcrystalhd_if_h" - vaapi_deps="va_va_h" - vda_deps="VideoDecodeAcceleration_VDADecoder_h pthreads" -+xvba_deps="amd_amdxvba_h" - vdpau_deps="vdpau_vdpau_h vdpau_vdpau_x11_h" - - # parsers -@@ -3062,6 +3069,7 @@ check_header sys/select.h - check_header termios.h - check_header vdpau/vdpau.h - check_header vdpau/vdpau_x11.h -+check_header amd/amdxvba.h - check_cpp_condition vdpau/vdpau.h "defined(VDP_DECODER_PROFILE_MPEG4_PART2_SP)" && enable vdpau_mpeg4_support - - check_header X11/extensions/XvMClib.h -diff --git a/lib/ffmpeg/libavcodec/Makefile b/lib/ffmpeg/libavcodec/Makefile -index 972cc59..fc441bf 100644 ---- a/lib/ffmpeg/libavcodec/Makefile -+++ b/lib/ffmpeg/libavcodec/Makefile -@@ -3,7 +3,7 @@ include $(SUBDIR)../config.mak - NAME = avcodec - FFLIBS = avutil - --HEADERS = avcodec.h avfft.h dxva2.h opt.h vaapi.h vda.h vdpau.h version.h xvmc.h -+HEADERS = avcodec.h avfft.h dxva2.h opt.h vaapi.h vda.h vdpau.h version.h xvmc.h xvba.h - - OBJS = allcodecs.o \ - audioconvert.o \ -@@ -51,6 +51,7 @@ OBJS-$(CONFIG_SINEWIN) += sinewin.o - OBJS-$(CONFIG_VAAPI) += vaapi.o - OBJS-$(CONFIG_VDA) += vda.o - OBJS-$(CONFIG_VDPAU) += vdpau.o -+OBJS-$(CONFIG_XVBA) += xvba.o - - # decoders/encoders/hardware accelerators - OBJS-$(CONFIG_A64MULTI_ENCODER) += a64multienc.o elbg.o -@@ -201,6 +202,7 @@ OBJS-$(CONFIG_H264_DECODER) += h264.o \ - OBJS-$(CONFIG_H264_DXVA2_HWACCEL) += dxva2_h264.o - OBJS-$(CONFIG_H264_VAAPI_HWACCEL) += vaapi_h264.o - OBJS-$(CONFIG_H264_VDA_HWACCEL) += vda_h264.o -+OBJS-$(CONFIG_H264_XVBA_HWACCEL) += xvba_h264.o - OBJS-$(CONFIG_HUFFYUV_DECODER) += huffyuv.o - OBJS-$(CONFIG_HUFFYUV_ENCODER) += huffyuv.o - OBJS-$(CONFIG_IDCIN_DECODER) += idcinvideo.o -@@ -284,6 +286,7 @@ OBJS-$(CONFIG_MPEG1VIDEO_ENCODER) += mpeg12enc.o mpegvideo_enc.o \ - mpegvideo.o error_resilience.o - OBJS-$(CONFIG_MPEG2_DXVA2_HWACCEL) += dxva2_mpeg2.o - OBJS-$(CONFIG_MPEG2_VAAPI_HWACCEL) += vaapi_mpeg2.o -+OBJS-$(CONFIG_MPEG2_XVBA_HWACCEL) += xvba_mpeg2.o - OBJS-$(CONFIG_MPEG2VIDEO_DECODER) += mpeg12.o mpeg12data.o \ - mpegvideo.o error_resilience.o - OBJS-$(CONFIG_MPEG2VIDEO_ENCODER) += mpeg12enc.o mpegvideo_enc.o \ -@@ -431,6 +434,7 @@ OBJS-$(CONFIG_VC1_DECODER) += vc1dec.o vc1.o vc1data.o vc1dsp.o \ - intrax8.o intrax8dsp.o - OBJS-$(CONFIG_VC1_DXVA2_HWACCEL) += dxva2_vc1.o - OBJS-$(CONFIG_VC1_VAAPI_HWACCEL) += vaapi_vc1.o -+OBJS-$(CONFIG_VC1_XVBA_HWACCEL) += xvba_vc1.o - OBJS-$(CONFIG_VCR1_DECODER) += vcr1.o - OBJS-$(CONFIG_VCR1_ENCODER) += vcr1.o - OBJS-$(CONFIG_VMDAUDIO_DECODER) += vmdav.o -@@ -732,6 +736,7 @@ SKIPHEADERS-$(CONFIG_LIBDIRAC) += libdirac.h - SKIPHEADERS-$(CONFIG_LIBSCHROEDINGER) += libschroedinger.h - SKIPHEADERS-$(CONFIG_VAAPI) += vaapi_internal.h - SKIPHEADERS-$(CONFIG_VDA) += vda_internal.h -+SKIPHEADERS-$(CONFIG_XVBA) += xvba_internal.h - SKIPHEADERS-$(CONFIG_VDPAU) += vdpau.h - SKIPHEADERS-$(CONFIG_XVMC) += xvmc.h - SKIPHEADERS-$(HAVE_W32THREADS) += w32pthreads.h -diff --git a/lib/ffmpeg/libavcodec/allcodecs.c b/lib/ffmpeg/libavcodec/allcodecs.c -index 32f3f52..0ff178e 100644 ---- a/lib/ffmpeg/libavcodec/allcodecs.c -+++ b/lib/ffmpeg/libavcodec/allcodecs.c -@@ -59,14 +59,18 @@ void avcodec_register_all(void) - REGISTER_HWACCEL (H264_VAAPI, h264_vaapi); - REGISTER_HWACCEL (H264_VDA, h264_vda); - REGISTER_HWACCEL (MPEG1_VDPAU, mpeg1_vdpau); -+ REGISTER_HWACCEL (H264_XVBA, h264_xvba); - REGISTER_HWACCEL (MPEG2_DXVA2, mpeg2_dxva2); - REGISTER_HWACCEL (MPEG2_VAAPI, mpeg2_vaapi); - REGISTER_HWACCEL (MPEG2_VDPAU, mpeg2_vdpau); - REGISTER_HWACCEL (MPEG4_VAAPI, mpeg4_vaapi); -+ REGISTER_HWACCEL (MPEG2_XVBA, mpeg2_xvba); - REGISTER_HWACCEL (VC1_DXVA2, vc1_dxva2); - REGISTER_HWACCEL (VC1_VAAPI, vc1_vaapi); -+ REGISTER_HWACCEL (VC1_XVBA, vc1_xvba); - REGISTER_HWACCEL (WMV3_DXVA2, wmv3_dxva2); - REGISTER_HWACCEL (WMV3_VAAPI, wmv3_vaapi); -+ REGISTER_HWACCEL (WMV3_XVBA, wmv3_xvba); - - /* video codecs */ - REGISTER_ENCODER (A64MULTI, a64multi); -diff --git a/lib/ffmpeg/libavcodec/h264.c b/lib/ffmpeg/libavcodec/h264.c -index c4785db..e9e7546 100644 ---- a/lib/ffmpeg/libavcodec/h264.c -+++ b/lib/ffmpeg/libavcodec/h264.c -@@ -60,6 +60,7 @@ - PIX_FMT_DXVA2_VLD, - PIX_FMT_VAAPI_VLD, - PIX_FMT_VDA_VLD, -+ PIX_FMT_XVBA_VLD, - PIX_FMT_YUVJ420P, - PIX_FMT_NONE - }; -diff --git a/lib/ffmpeg/libavcodec/mpegvideo.c b/lib/ffmpeg/libavcodec/mpegvideo.c -index 04c149a..b22b631 100644 ---- a/lib/ffmpeg/libavcodec/mpegvideo.c -+++ b/lib/ffmpeg/libavcodec/mpegvideo.c -@@ -136,6 +136,7 @@ static void dct_unquantize_h263_inter_c(MpegEncContext *s, - PIX_FMT_DXVA2_VLD, - PIX_FMT_VAAPI_VLD, - PIX_FMT_VDA_VLD, -+ PIX_FMT_XVBA_VLD, - PIX_FMT_YUV420P, - PIX_FMT_NONE - }; -diff --git a/lib/ffmpeg/libavcodec/xvba.c b/lib/ffmpeg/libavcodec/xvba.c -new file mode 100644 -index 0000000..be29e5d ---- /dev/null -+++ b/lib/ffmpeg/libavcodec/xvba.c -@@ -0,0 +1,66 @@ -+/* -+ * HW decode acceleration for MPEG-2, H.264 and VC-1 -+ * -+ * Copyright (C) 2005-2011 Team XBMC -+ * -+ * This file is part of FFmpeg. -+ * -+ * FFmpeg is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * FFmpeg 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 -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with FFmpeg; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ */ -+ -+ -+/** -+ * \addtogroup XVBA_Decoding -+ * -+ * @{ -+ */ -+ -+#include -+#include "xvba.h" -+#include "xvba_internal.h" -+#include "avcodec.h" -+ -+int ff_xvba_translate_profile(int profile) { -+ -+ if (profile == 66) -+ return 1; -+ else if (profile == 77) -+ return 2; -+ else if (profile == 100) -+ return 3; -+ else if (profile == 0) -+ return 4; -+ else if (profile == 1) -+ return 5; -+ else if (profile == 3) -+ return 6; -+ else -+ return -1; -+} -+ -+void ff_xvba_add_slice_data(struct xvba_render_state *render, const uint8_t *buffer, uint32_t size) { -+ -+ render->buffers = av_fast_realloc( -+ render->buffers, -+ &render->buffers_alllocated, -+ sizeof(struct xvba_bitstream_buffers)*(render->num_slices + 1) -+ ); -+ -+ render->buffers[render->num_slices].buffer = buffer; -+ render->buffers[render->num_slices].size = size; -+ -+ render->num_slices++; -+} -+ -diff --git a/lib/ffmpeg/libavcodec/xvba.h b/lib/ffmpeg/libavcodec/xvba.h -new file mode 100644 -index 0000000..9f9ff0c ---- /dev/null -+++ b/lib/ffmpeg/libavcodec/xvba.h -@@ -0,0 +1,71 @@ -+/* -+ * HW decode acceleration for MPEG-2, H.264 and VC-1 -+ * -+ * Copyright (C) 2005-2011 Team XBMC -+ * -+ * This file is part of FFmpeg. -+ * -+ * FFmpeg is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * FFmpeg 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 -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with FFmpeg; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ */ -+ -+#ifndef AVCODEC_XVBA_H -+#define AVCODEC_XVBA_H -+ -+#include -+#include -+#include -+ -+ -+/** -+ * \defgroup XVBA_Decoding VA API Decoding -+ * \ingroup Decoder -+ * @{ -+ */ -+ -+/** \brief The videoSurface is used for rendering. */ -+#define FF_XVBA_STATE_USED_FOR_RENDER 1 -+ -+/** -+ * \brief The videoSurface is needed for reference/prediction. -+ * The codec manipulates this. -+ */ -+#define FF_XVBA_STATE_USED_FOR_REFERENCE 2 -+ -+/** -+ * \brief The videoSurface holds a decoded frame. -+ * The codec manipulates this. -+ */ -+#define FF_XVBA_STATE_DECODED 4 -+ -+/* @} */ -+ -+struct xvba_bitstream_buffers -+{ -+ const void *buffer; -+ unsigned int size; -+}; -+ -+struct xvba_render_state { -+ -+ int state; ///< Holds FF_XVBA_STATE_* values. -+ void *surface; -+ XVBAPictureDescriptor *picture_descriptor; -+ XVBAQuantMatrixAvc *iq_matrix; -+ unsigned int num_slices; -+ struct xvba_bitstream_buffers *buffers; -+ uint32_t buffers_alllocated; -+}; -+ -+#endif /* AVCODEC_XVBA_H */ -diff --git a/lib/ffmpeg/libavcodec/xvba_h264.c b/lib/ffmpeg/libavcodec/xvba_h264.c -new file mode 100644 -index 0000000..87af687 ---- /dev/null -+++ b/lib/ffmpeg/libavcodec/xvba_h264.c -@@ -0,0 +1,195 @@ -+/* -+ * H.264 HW decode acceleration through XVBA -+ * -+ * Copyright (C) 2005-2011 Team XBMC -+ * -+ * This file is part of FFmpeg. -+ * -+ * FFmpeg is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * FFmpeg 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 -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with FFmpeg; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ */ -+ -+#include "xvba.h" -+#include "xvba_internal.h" -+#include "h264.h" -+#include -+ -+/** @file -+ * This file implements the glue code between FFmpeg's and XvBA API's -+ * structures for H.264 decoding. -+ */ -+ -+ -+/** Initialize and start decoding a frame with XVBA. */ -+static int start_frame(AVCodecContext *avctx, -+ av_unused const uint8_t *buffer, -+ av_unused uint32_t size) -+{ -+ H264Context * const h = avctx->priv_data; -+ MpegEncContext * const s = &h->s; -+ struct xvba_render_state *render; -+ XVBAPictureDescriptor *pic_descriptor; -+ int i; -+ -+ render = (struct xvba_render_state *)s->current_picture_ptr->f.data[0]; -+ assert(render); -+ -+ if (render->picture_descriptor == 0) -+ return -1; -+ -+ pic_descriptor = render->picture_descriptor; -+ -+ for (i = 0; i < 2; ++i) { -+ int foc = s->current_picture_ptr->field_poc[i]; -+ if (foc == INT_MAX) -+ foc = 0; -+ pic_descriptor->avc_curr_field_order_cnt_list[i] = foc; -+ } -+ -+ pic_descriptor->avc_frame_num = h->frame_num; -+ -+ render->num_slices = 0; -+ -+ return 0; -+} -+ -+/** End a hardware decoding based frame. */ -+static int end_frame(AVCodecContext *avctx) -+{ -+ H264Context * const h = avctx->priv_data; -+ MpegEncContext * const s = &h->s; -+ struct xvba_render_state *render; -+ XVBAPictureDescriptor *pic_descriptor; -+ XVBAQuantMatrixAvc *iq_matrix; -+ -+ render = (struct xvba_render_state *)s->current_picture_ptr->f.data[0]; -+ assert(render); -+ -+ if (render->picture_descriptor == 0 || render->iq_matrix == 0) -+ return -1; -+ -+ pic_descriptor = render->picture_descriptor; -+ iq_matrix = render->iq_matrix; -+ -+ av_dlog(avctx, "end_frame()\n"); -+ -+ /* Fill in Picture Parameters*/ -+ pic_descriptor->profile = ff_xvba_translate_profile(avctx->profile); -+ pic_descriptor->level = avctx->level; -+ pic_descriptor->width_in_mb = s->mb_width; -+ pic_descriptor->height_in_mb = s->mb_height; -+ pic_descriptor->picture_structure = s->picture_structure; -+ pic_descriptor->chroma_format = s->chroma_format ? s->chroma_format : 1; -+ pic_descriptor->avc_intra_flag = (h->slice_type == AV_PICTURE_TYPE_I) ? 1 : 0; -+ pic_descriptor->avc_reference = (s->current_picture_ptr->f.reference & 3) ? 1 : 0; -+ -+ pic_descriptor->avc_bit_depth_luma_minus8 = h->sps.bit_depth_luma - 8; -+ pic_descriptor->avc_bit_depth_chroma_minus8 = h->sps.bit_depth_chroma - 8; -+ pic_descriptor->avc_log2_max_frame_num_minus4 = h->sps.log2_max_frame_num -4; -+ pic_descriptor->avc_pic_order_cnt_type = h->sps.poc_type; -+ pic_descriptor->avc_log2_max_pic_order_cnt_lsb_minus4 = h->sps.log2_max_poc_lsb - 4; -+ pic_descriptor->avc_num_ref_frames = h->sps.ref_frame_count; -+ pic_descriptor->avc_reserved_8bit = 0; -+ -+ /* Set a level that can decode stuff in every case without a lookup table -+ xvba seems to have problems only when the number of Reframes goes beyond -+ the max support number of Level4.1@High. So in praxis decoding a Level 3.0 -+ file that in deed has level4.1@High specs does not matter. We use this fact -+ and check if the ref_frames stay in the range Level4.1@high can decode if -+ not, we set Level5.1 */ -+ if (pic_descriptor->avc_num_ref_frames > 4) { -+ const unsigned int mbw = pic_descriptor->width_in_mb; -+ const unsigned int mbh = pic_descriptor->height_in_mb; -+ // this matches Level4.1@High stats to differ between <= 4.1 and 5.1 -+ const unsigned int max_ref_frames = 12288 * 1024 / (mbw * mbh * 384); -+ const unsigned int num_ref_frames = pic_descriptor->avc_num_ref_frames; -+ if (max_ref_frames < num_ref_frames) -+ pic_descriptor->level = 51; -+ } -+ -+ pic_descriptor->avc_num_slice_groups_minus1 = h->pps.slice_group_count - 1; -+ pic_descriptor->avc_num_ref_idx_l0_active_minus1 = h->pps.ref_count[0] - 1; -+ pic_descriptor->avc_num_ref_idx_l1_active_minus1 = h->pps.ref_count[1] - 1; -+ -+ pic_descriptor->avc_pic_init_qp_minus26 = h->pps.init_qp - 26; -+ pic_descriptor->avc_pic_init_qs_minus26 = h->pps.init_qs - 26; -+ pic_descriptor->avc_chroma_qp_index_offset = h->pps.chroma_qp_index_offset[0]; -+ pic_descriptor->avc_second_chroma_qp_index_offset = h->pps.chroma_qp_index_offset[1]; -+ pic_descriptor->avc_slice_group_change_rate_minus1 = 0; // not implemented in ffmpeg -+ pic_descriptor->avc_reserved_16bit = 0; // must be 0 -+ memset(pic_descriptor->avc_field_order_cnt_list,0,sizeof(pic_descriptor->avc_field_order_cnt_list)); // must be 0 -+ memset(pic_descriptor->avc_slice_group_map,0,sizeof(pic_descriptor->avc_slice_group_map)); // must be 0 -+ -+ // sps -+ pic_descriptor->sps_info.avc.delta_pic_always_zero_flag = h->sps.delta_pic_order_always_zero_flag; -+ pic_descriptor->sps_info.avc.direct_8x8_inference_flag = h->sps.direct_8x8_inference_flag; -+ pic_descriptor->sps_info.avc.frame_mbs_only_flag = h->sps.frame_mbs_only_flag; -+ pic_descriptor->sps_info.avc.gaps_in_frame_num_value_allowed_flag = h->sps.gaps_in_frame_num_allowed_flag; -+ pic_descriptor->sps_info.avc.mb_adaptive_frame_field_flag = h->sps.mb_aff; -+ pic_descriptor->sps_info.avc.residual_colour_transform_flag = h->sps.residual_color_transform_flag; -+ pic_descriptor->sps_info.avc.xvba_avc_sps_reserved = 0; -+ -+ // pps -+ pic_descriptor->pps_info.avc.entropy_coding_mode_flag = h->pps.cabac; -+ pic_descriptor->pps_info.avc.pic_order_present_flag = h->pps.pic_order_present; -+ pic_descriptor->pps_info.avc.weighted_pred_flag = h->pps.weighted_pred; -+ pic_descriptor->pps_info.avc.weighted_bipred_idc = h->pps.weighted_bipred_idc; -+ pic_descriptor->pps_info.avc.deblocking_filter_control_present_flag = h->pps.deblocking_filter_parameters_present; -+ pic_descriptor->pps_info.avc.constrained_intra_pred_flag = h->pps.constrained_intra_pred; -+ pic_descriptor->pps_info.avc.redundant_pic_cnt_present_flag = h->pps.redundant_pic_cnt_present; -+ pic_descriptor->pps_info.avc.transform_8x8_mode_flag = h->pps.transform_8x8_mode; -+ pic_descriptor->pps_info.avc.xvba_avc_pps_reserved = 0; // must be 0 -+ -+ memcpy(iq_matrix->bScalingLists4x4, h->pps.scaling_matrix4, sizeof(iq_matrix->bScalingLists4x4)); -+ memcpy(iq_matrix->bScalingLists8x8[0], h->pps.scaling_matrix8[0], sizeof(iq_matrix->bScalingLists8x8[0])); -+ memcpy(iq_matrix->bScalingLists8x8[1], h->pps.scaling_matrix8[3], sizeof(iq_matrix->bScalingLists8x8[0])); -+ -+ // Wait for an I-frame before start decoding. Workaround for ATI UVD and UVD+ GPUs -+ if (!h->got_first_iframe) { -+ if (h->slice_type != AV_PICTURE_TYPE_I && h->slice_type != AV_PICTURE_TYPE_SI) -+ return -1; -+ h->got_first_iframe = 1; -+ } -+ -+ ff_draw_horiz_band(s, 0, s->avctx->height); -+ -+ return 0; -+} -+ -+/** Decode the given H.264 slice with XVBA. */ -+static int decode_slice(AVCodecContext *avctx, -+ const uint8_t *buffer, -+ uint32_t size) -+{ -+ H264Context * const h = avctx->priv_data; -+ MpegEncContext * const s = &h->s; -+ struct xvba_render_state *render; -+ -+ render = (struct xvba_render_state *)s->current_picture_ptr->f.data[0]; -+ assert(render); -+ -+ ff_xvba_add_slice_data(render, buffer, size); -+ -+ return 0; -+} -+ -+AVHWAccel ff_h264_xvba_hwaccel = { -+ .name = "h264_xvba", -+ .type = AVMEDIA_TYPE_VIDEO, -+ .id = CODEC_ID_H264, -+ .pix_fmt = PIX_FMT_XVBA_VLD, -+ .start_frame = start_frame, -+ .end_frame = end_frame, -+ .decode_slice = decode_slice, -+}; -diff --git a/lib/ffmpeg/libavcodec/xvba_internal.h b/lib/ffmpeg/libavcodec/xvba_internal.h -new file mode 100644 -index 0000000..9653f85 ---- /dev/null -+++ b/lib/ffmpeg/libavcodec/xvba_internal.h -@@ -0,0 +1,24 @@ -+/* -+ * HW decode acceleration for MPEG-2, H.264 and VC-1 -+ * -+ * Copyright (C) 2005-2011 Team XBMC -+ * -+ * This file is part of FFmpeg. -+ * -+ * FFmpeg is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * FFmpeg 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 -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with FFmpeg; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ */ -+ -+int ff_xvba_translate_profile(int profile); -+void ff_xvba_add_slice_data(struct xvba_render_state *render, const uint8_t *buffer, uint32_t size); -diff --git a/lib/ffmpeg/libavcodec/xvba_mpeg2.c b/lib/ffmpeg/libavcodec/xvba_mpeg2.c -new file mode 100644 -index 0000000..552ef95 ---- /dev/null -+++ b/lib/ffmpeg/libavcodec/xvba_mpeg2.c -@@ -0,0 +1,52 @@ -+/* -+ * MPEG-2 HW decode acceleration through XVBA -+ * -+ * Copyright (C) 2005-2011 Team XBMC -+ * -+ * This file is part of FFmpeg. -+ * -+ * FFmpeg is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * FFmpeg 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 -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with FFmpeg; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ */ -+ -+#include "dsputil.h" -+ -+static int start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size) -+{ -+ struct MpegEncContext * const s = avctx->priv_data; -+ return 0; -+} -+ -+static int end_frame(AVCodecContext *avctx) -+{ -+ return 0; -+} -+ -+static int decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) -+{ -+ struct MpegEncContext * const s = avctx->priv_data; -+ return 0; -+} -+ -+AVHWAccel ff_mpeg2_xvba_hwaccel = { -+ .name = "mpeg2_xvba", -+ .type = AVMEDIA_TYPE_VIDEO, -+ .id = CODEC_ID_MPEG2VIDEO, -+ .pix_fmt = PIX_FMT_XVBA_VLD, -+ .capabilities = 0, -+ .start_frame = start_frame, -+ .end_frame = end_frame, -+ .decode_slice = decode_slice, -+ .priv_data_size = 0, -+}; -diff --git a/lib/ffmpeg/libavcodec/xvba_vc1.c b/lib/ffmpeg/libavcodec/xvba_vc1.c -new file mode 100644 -index 0000000..7315b62 ---- /dev/null -+++ b/lib/ffmpeg/libavcodec/xvba_vc1.c -@@ -0,0 +1,190 @@ -+/* -+ * VC-1 HW decode acceleration through XVBA -+ * -+ * Copyright (C) 2005-2011 Team XBMC -+ * -+ * This file is part of FFmpeg. -+ * -+ * FFmpeg is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * FFmpeg 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 -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with FFmpeg; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ */ -+ -+#include "xvba.h" -+#include "xvba_internal.h" -+#include "vc1.h" -+#include "vc1data.h" -+#include -+ -+ -+/** @file -+ * Implement structures of ffmpeg <-> XvBA -+ */ -+ -+/* Initialize and start decoding a frame with XvBA */ -+static int start_frame(AVCodecContext *avctx, -+ av_unused const uint8_t *buffer, -+ av_unused uint32_t size) -+{ -+ VC1Context * const v = avctx->priv_data; -+ MpegEncContext * const s = &v->s; -+ struct xvba_render_state *render; -+ -+ render = (struct xvba_render_state *)s->current_picture_ptr->f.data[0]; -+ assert(render); -+ -+ render->num_slices = 0; -+ return 0; -+} -+ -+/* End a hardware decoding based frame */ -+static int end_frame(AVCodecContext *avctx) -+{ -+ VC1Context* const v = avctx->priv_data; -+ MpegEncContext* const s = &v->s; -+ struct xvba_render_state *render, *last, *next; -+ XVBAPictureDescriptor *pic_descriptor; -+ -+ render = (struct xvba_render_state *)s->current_picture_ptr->f.data[0]; -+ assert(render); -+ -+ if (render->picture_descriptor == 0) -+ return -1; -+ -+ pic_descriptor = render->picture_descriptor; -+ -+ av_dlog(avctx, "xvba_vc1_end_frame()\n"); -+ -+ memset(pic_descriptor, 0, sizeof(*pic_descriptor)); -+ -+ /* Fill in Parameters - for reference see AMD sdk documentation */ -+ pic_descriptor->profile = ff_xvba_translate_profile(v->profile); -+ pic_descriptor->level = v->level; -+ //done like in va-driver and vaapi -+ if (v->profile == PROFILE_ADVANCED) { -+ pic_descriptor->width_in_mb = s->avctx->coded_width; -+ pic_descriptor->height_in_mb = s->avctx->coded_height; -+ } else { -+ pic_descriptor->width_in_mb = s->mb_width; -+ pic_descriptor->height_in_mb = s->mb_height; -+ } -+ pic_descriptor->picture_structure = s->picture_structure; -+ // xvba-video set this to 1 only 4:2:0 supported -+ // doc says: if not set, choose 1 - we try this -+ pic_descriptor->chroma_format = 1; -+ pic_descriptor->avc_intra_flag = s->pict_type == AV_PICTURE_TYPE_I || v->bi_type == 1; -+ pic_descriptor->avc_reference = (s->current_picture_ptr->f.reference & 3) ? 1 : 0; -+ -+ // VC-1 explicit parameters see page 30 of sdk -+ // sps_info -+ pic_descriptor->sps_info.vc1.postprocflag = v->postprocflag; -+ -+ // done as in vaapi -+ pic_descriptor->sps_info.vc1.pulldown = v->broadcast; -+ pic_descriptor->sps_info.vc1.interlace = v->interlace; -+ pic_descriptor->sps_info.vc1.tfcntrflag = v->tfcntrflag; -+ pic_descriptor->sps_info.vc1.finterpflag = v->finterpflag; -+ pic_descriptor->sps_info.vc1.reserved = 1; -+ // eventually check if this makes sense together with interlace -+ pic_descriptor->sps_info.vc1.psf = v->psf; -+ // what about if it is a frame (page 31) -+ // looked at xvba-driver -+ pic_descriptor->sps_info.vc1.second_field = !s->first_field; -+ pic_descriptor->sps_info.vc1.xvba_vc1_sps_reserved = 0; -+ -+ // VC-1 explicit parameters see page 30 of sdk -+ // pps_info -+ pic_descriptor->pps_info.vc1.panscan_flag = v->panscanflag; -+ pic_descriptor->pps_info.vc1.refdist_flag = v->refdist_flag; -+ pic_descriptor->pps_info.vc1.loopfilter = s->loop_filter; -+ pic_descriptor->pps_info.vc1.fastuvmc = v->fastuvmc; -+ pic_descriptor->pps_info.vc1.extended_mv = v->extended_mv; -+ pic_descriptor->pps_info.vc1.dquant = v->dquant; -+ pic_descriptor->pps_info.vc1.vstransform = v->vstransform; -+ pic_descriptor->pps_info.vc1.overlap = v->overlap; -+ pic_descriptor->pps_info.vc1.quantizer = v->quantizer_mode; -+ pic_descriptor->pps_info.vc1.extended_dmv = v->extended_dmv; -+ pic_descriptor->pps_info.vc1.maxbframes = s->avctx->max_b_frames; -+ pic_descriptor->pps_info.vc1.rangered = (pic_descriptor->profile == PROFILE_SIMPLE) ? 0 : v->rangered; -+ pic_descriptor->pps_info.vc1.syncmarker = (pic_descriptor->profile == PROFILE_SIMPLE) ? 0 : s->resync_marker; -+ pic_descriptor->pps_info.vc1.multires = v->multires; -+ pic_descriptor->pps_info.vc1.reserved = 1; -+ pic_descriptor->pps_info.vc1.range_mapy_flag = v->range_mapy_flag; -+ pic_descriptor->pps_info.vc1.range_mapy = v->range_mapy; -+ pic_descriptor->pps_info.vc1.range_mapuv_flag = v->range_mapuv_flag; -+ pic_descriptor->pps_info.vc1.range_mapuv = v->range_mapuv; -+ pic_descriptor->pps_info.vc1.xvba_vc1_pps_reserved = 0; -+ -+ pic_descriptor->past_surface = 0; -+ pic_descriptor->future_surface = 0; -+ switch (s->pict_type) { -+ case AV_PICTURE_TYPE_B: -+ next = (struct xvba_render_state *)s->next_picture.f.data[0]; -+ assert(next); -+ if (next) -+ pic_descriptor->past_surface = next->surface; -+ // fall-through -+ case AV_PICTURE_TYPE_P: -+ last = (struct xvba_render_state *)s->last_picture.f.data[0]; -+ assert(last); -+ if (last) -+ pic_descriptor->future_surface = last->surface; -+ break; -+ } -+ -+ ff_draw_horiz_band(s, 0, s->avctx->height); -+ -+ return 0; -+} -+ -+static int decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) -+{ -+ VC1Context* const v = avctx->priv_data; -+ MpegEncContext* const s = &v->s; -+ struct xvba_render_state *render; -+ -+ render = (struct xvba_render_state *)s->current_picture_ptr->f.data[0]; -+ assert(render); -+ -+ if (avctx->codec_id == CODEC_ID_VC1 && -+ size >= 4 && IS_MARKER(AV_RB32(buffer))) { -+ buffer += 4; -+ size -= 4; -+ } -+ -+ ff_xvba_add_slice_data(render, buffer, size); -+ -+ return 0; -+} -+ -+#if CONFIG_WMV3_XVBA_HWACCEL -+AVHWAccel ff_wmv3_xvba_hwaccel = { -+ .name = "wmv3_xvba", -+ .type = AVMEDIA_TYPE_VIDEO, -+ .id = CODEC_ID_WMV3, -+ .pix_fmt = PIX_FMT_XVBA_VLD, -+ .start_frame = start_frame, -+ .end_frame = end_frame, -+ .decode_slice = decode_slice, -+}; -+#endif -+ -+AVHWAccel ff_vc1_xvba_hwaccel = { -+ .name = "vc1_xvba", -+ .type = AVMEDIA_TYPE_VIDEO, -+ .id = CODEC_ID_VC1, -+ .pix_fmt = PIX_FMT_XVBA_VLD, -+ .start_frame = start_frame, -+ .end_frame = end_frame, -+ .decode_slice = decode_slice, -+}; -diff --git a/lib/ffmpeg/libavcodec/xvmc_internal.h b/lib/ffmpeg/libavcodec/xvmc_internal.h -index 04197ce..d925eb1 100644 ---- a/lib/ffmpeg/libavcodec/xvmc_internal.h -+++ b/lib/ffmpeg/libavcodec/xvmc_internal.h -@@ -1,5 +1,7 @@ - /* -- * XVideo Motion Compensation internal functions -+ * HW decode acceleration for MPEG-2, H.264 and VC-1 -+ * -+ * Copyright (C) 2005-2011 Team XBMC - * - * This file is part of FFmpeg. - * -diff --git a/lib/ffmpeg/libavutil/pixdesc.c b/lib/ffmpeg/libavutil/pixdesc.c -index e73fbfe..5abbd14 100644 ---- a/lib/ffmpeg/libavutil/pixdesc.c -+++ b/lib/ffmpeg/libavutil/pixdesc.c -@@ -874,6 +874,12 @@ void av_write_image_line(const uint16_t *src, uint8_t *data[4], const int linesi - .log2_chroma_h = 1, - .flags = PIX_FMT_HWACCEL, - }, -+ [PIX_FMT_XVBA_VLD] = { -+ .name = "xvba_vld", -+ .log2_chroma_w = 1, -+ .log2_chroma_h = 1, -+ .flags = PIX_FMT_HWACCEL, -+ }, - [PIX_FMT_YUV420P9LE] = { - .name = "yuv420p9le", - .nb_components = 3, -diff --git a/lib/ffmpeg/libavutil/pixfmt.h b/lib/ffmpeg/libavutil/pixfmt.h -index f0d9c01..0f8cf7b 100644 ---- a/lib/ffmpeg/libavutil/pixfmt.h -+++ b/lib/ffmpeg/libavutil/pixfmt.h -@@ -129,6 +129,7 @@ enum PixelFormat { - PIX_FMT_YUV444P16BE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian - PIX_FMT_VDPAU_MPEG4, ///< MPEG4 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers - PIX_FMT_DXVA2_VLD, ///< HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer -+ PIX_FMT_XVBA_VLD, ///< HW decoding through DXVA2, Picture.data[3] contains a vaapi_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers - - PIX_FMT_RGB444LE, ///< packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), little-endian, most significant bits to 0 - PIX_FMT_RGB444BE, ///< packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), big-endian, most significant bits to 0 --- -1.8.1.6 - - -From 3a35525b8fc4180312c55b6956955cbb405ba272 Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Thu, 12 Apr 2012 12:09:31 +0200 -Subject: [PATCH 63/94] xvba: add decoder - ---- - configure.in | 48 + - language/English/strings.po | 12 +- - xbmc/cores/VideoRenderers/LinuxRendererGL.cpp | 216 +- - xbmc/cores/VideoRenderers/LinuxRendererGL.h | 15 +- - xbmc/cores/VideoRenderers/RenderFormats.h | 1 + - xbmc/cores/VideoRenderers/RenderManager.cpp | 4 + - .../dvdplayer/DVDCodecs/Video/DVDVideoCodec.h | 4 + - .../DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp | 16 + - xbmc/cores/dvdplayer/DVDCodecs/Video/Makefile.in | 4 + - xbmc/cores/dvdplayer/DVDCodecs/Video/XVBA.cpp | 2367 ++++++++++++++++++++ - xbmc/cores/dvdplayer/DVDCodecs/Video/XVBA.h | 382 ++++ - xbmc/cores/dvdplayer/DVDPlayerVideo.cpp | 4 + - xbmc/settings/GUISettings.cpp | 3 + - xbmc/settings/VideoSettings.h | 2 + - xbmc/video/dialogs/GUIDialogVideoSettings.cpp | 1 + - 15 files changed, 3073 insertions(+), 6 deletions(-) - create mode 100644 xbmc/cores/dvdplayer/DVDCodecs/Video/XVBA.cpp - create mode 100644 xbmc/cores/dvdplayer/DVDCodecs/Video/XVBA.h - -diff --git a/configure.in b/configure.in -index e98cc95..f3c1d23 100644 ---- a/configure.in -+++ b/configure.in -@@ -124,6 +124,8 @@ vaapi_not_found="== Could not find libva. VAAPI support disabled. ==" - vaapi_disabled="== VAAPI support manually disabled. ==" - crystalhd_not_found="== Could not find libcrystalhd. CrystalHD support disabled. ==" - crystalhd_disabled="== CrystalHD support manually disabled. ==" -+xvba_not_found="== Could not find amdxvba.h. XVBA support disabled. ==" -+xvba_disabled="== XVBA support manually disabled. ==" - vdadecoder_enabled="== VDADecoder support enabled. ==" - vdadecoder_disabled="== VDADecoder support manually disabled. ==" - vtbdecoder_enabled="== VTBDecoder support enabled. ==" -@@ -245,6 +247,12 @@ AC_ARG_ENABLE([crystalhd], - [enable CrystalHD decoding (default is auto)])], - [use_crystalhd=$enableval], - [use_crystalhd=auto]) -+ -+AC_ARG_ENABLE([xvba], -+ [AS_HELP_STRING([--enable-xvba], -+ [enable XVBA decoding (default is auto)])], -+ [use_xvba=$enableval], -+ [use_xvba=auto]) - - AC_ARG_ENABLE([vdadecoder], - [AS_HELP_STRING([--enable-vdadecoder], -@@ -1727,6 +1735,38 @@ else - USE_CRYSTALHD=0 - fi - -+# XVBA -+if test "x$use_xvba" != "xno"; then -+ if test "$host_vendor" = "apple" ; then -+ if test "x$use_xvba" = "xyes"; then -+ AC_MSG_ERROR([XVBA not supported on this platform]) -+ else -+ use_xvba="no" -+ AC_MSG_NOTICE($xvba_disabled) -+ fi -+ USE_XVBA=0 -+ else -+ initial_val=$use_xvba -+ AC_CHECK_HEADER([amd/amdxvba.h],, use_xvba=no, [#include ]) -+ -+ if test "x$use_xvba" = "xno"; then -+ if test "x$initial_val" = "xyes"; then -+ AC_MSG_ERROR($xvba_not_found) -+ else -+ AC_MSG_RESULT($xvba_not_found) -+ fi -+ USE_XVBA=0 -+ else -+ AC_DEFINE([HAVE_LIBXVBA], [1], [Define to 1 if you have the 'xvba' header (amdxvba.h)]) -+ USE_XVBA=1 -+ fi -+ fi -+else -+ AC_MSG_NOTICE($xvba_disabled) -+ USE_XVBA=0 -+fi -+ -+ - # VDADecoder - if test "x$use_vdadecoder" != "xno"; then - if test "$host_vendor" = "apple" ; then -@@ -1938,6 +1978,12 @@ else - final_message="$final_message\n CrystalHD:\tNo" - fi - -+if test "x$use_xvba" != "xno"; then -+ final_message="$final_message\n XVBA:\t\tYes" -+else -+ final_message="$final_message\n XVBA:\t\tNo" -+fi -+ - if test "x$use_vdadecoder" != "xno"; then - final_message="$final_message\n VDADecoder:\tYes" - else -@@ -2406,6 +2452,7 @@ AC_SUBST(USE_OPENGLES) - AC_SUBST(USE_VDPAU) - AC_SUBST(USE_VAAPI) - AC_SUBST(USE_CRYSTALHD) -+AC_SUBST(USE_XVBA) - AC_SUBST(USE_LIBSMBCLIENT) - AC_SUBST(USE_LIBNFS) - AC_SUBST(USE_LIBAFPCLIENT) -@@ -2588,6 +2635,7 @@ XB_CONFIG_MODULE([lib/ffmpeg], [ - `if test "x$use_vdpau" != "xno"; then echo --enable-vdpau; else echo --disable-vdpau; fi` \ - `if test "x$use_vaapi" != "xno"; then echo --enable-vaapi; else echo --disable-vaapi; fi` \ - `if test "$use_optimizations" != "no"; then echo --enable-optimizations; else echo --disable-optimizations; fi` \ -+ `if test "x$use_xvba" != "xno"; then echo --enable-xvba; else echo --disable-xvba; fi` \ - --enable-protocol=http \ - --enable-pthreads \ - --enable-runtime-cpudetect \ -diff --git a/language/English/strings.po b/language/English/strings.po -index 6cefd26..6437aba 100644 ---- a/language/English/strings.po -+++ b/language/English/strings.po -@@ -5119,7 +5119,11 @@ msgctxt "#13436" - msgid "Prefer VDPAU Video Mixer" - msgstr "" - --#empty strings from id 13437 to 13499 -+msgctxt "#13437" -+msgid "Allow hardware acceleration (XVBA)" -+msgstr "" -+ -+#empty strings from id 13438 to 13499 - - msgctxt "#13500" - msgid "A/V sync method" -@@ -6341,7 +6345,11 @@ msgctxt "#16325" - msgid "VDPAU - Bob" - msgstr "" - --#empty strings from id 16326 to 16399 -+msgctxt "#16326" -+msgid "XVBA" -+msgstr "" -+ -+#empty strings from id 16327 to 16399 - - msgctxt "#16400" - msgid "Post-processing" -diff --git a/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp b/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp -index 6e6d97e..0bb924b 100644 ---- a/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp -+++ b/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp -@@ -63,6 +63,9 @@ - VA_MICRO_VERSION == 0 && VA_SDS_VERSION < 5))) - - #endif -+#ifdef HAVE_LIBXVBA -+#include "cores/dvdplayer/DVDCodecs/Video/XVBA.h" -+#endif - - #ifdef TARGET_DARWIN - #include "osx/CocoaInterface.h" -@@ -129,6 +132,9 @@ - #ifdef HAVE_LIBVDPAU - vdpau = NULL; - #endif -+#ifdef HAVE_LIBXVBA -+ xvba = NULL; -+#endif - } - - CLinuxRendererGL::YUVBUFFER::~YUVBUFFER() -@@ -604,6 +610,9 @@ void CLinuxRendererGL::ReleaseBuffer(int idx) - #ifdef HAVE_LIBVDPAU - SAFE_RELEASE(buf.vdpau); - #endif -+#ifdef HAVE_LIBXVBA -+ SAFE_RELEASE(buf.xvba); -+#endif - #ifdef HAVE_LIBVA - buf.vaapi.surface.reset(); - #endif -@@ -879,7 +888,7 @@ void CLinuxRendererGL::UpdateVideoFilter() - case VS_SCALINGMETHOD_LINEAR: - SetTextureFilter(m_scalingMethod == VS_SCALINGMETHOD_NEAREST ? GL_NEAREST : GL_LINEAR); - m_renderQuality = RQ_SINGLEPASS; -- if (((m_renderMethod & RENDER_VDPAU) || (m_renderMethod & RENDER_VAAPI)) && m_nonLinStretch) -+ if (((m_renderMethod & RENDER_VDPAU) || (m_renderMethod & RENDER_VAAPI) || (m_renderMethod & RENDER_XVBA)) && m_nonLinStretch) - { - m_pVideoFilterShader = new StretchFilterShader(); - if (!m_pVideoFilterShader->CompileAndLink()) -@@ -965,6 +974,11 @@ void CLinuxRendererGL::LoadShaders(int field) - CLog::Log(LOGNOTICE, "GL: Using CVBREF render method"); - m_renderMethod = RENDER_CVREF; - } -+ else if (m_format == RENDER_FMT_XVBA) -+ { -+ CLog::Log(LOGNOTICE, "GL: Using XVBA render method"); -+ m_renderMethod = RENDER_XVBA; -+ } - else - { - int requestedMethod = g_guiSettings.GetInt("videoplayer.rendermethod"); -@@ -1113,6 +1127,12 @@ void CLinuxRendererGL::LoadShaders(int field) - m_textureCreate = &CLinuxRendererGL::CreateCVRefTexture; - m_textureDelete = &CLinuxRendererGL::DeleteCVRefTexture; - } -+ else if (m_format == RENDER_FMT_XVBA) -+ { -+ m_textureUpload = &CLinuxRendererGL::UploadXVBATexture; -+ m_textureCreate = &CLinuxRendererGL::CreateXVBATexture; -+ m_textureDelete = &CLinuxRendererGL::DeleteXVBATexture; -+ } - else - { - // setup default YV12 texture handlers -@@ -1225,6 +1245,13 @@ void CLinuxRendererGL::Render(DWORD flags, int renderBuffer) - RenderVAAPI(renderBuffer, m_currentField); - } - #endif -+#ifdef HAVE_LIBXVBA -+ else if (m_renderMethod & RENDER_XVBA) -+ { -+ UpdateVideoFilter(); -+ RenderXVBA(renderBuffer, m_currentField); -+ } -+#endif - else - { - // RENDER_CVREF uses the same render as the default case -@@ -1732,6 +1759,77 @@ void CLinuxRendererGL::RenderVAAPI(int index, int field) - #endif - } - -+void CLinuxRendererGL::RenderXVBA(int index, int field) -+{ -+#ifdef HAVE_LIBXVBA -+ YUVPLANE &plane = m_buffers[index].fields[0][1]; -+ -+ glEnable(m_textureTarget); -+ glActiveTextureARB(GL_TEXTURE0); -+ -+ glBindTexture(m_textureTarget, plane.id); -+ -+ // Try some clamping or wrapping -+ glTexParameteri(m_textureTarget, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); -+ glTexParameteri(m_textureTarget, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); -+ -+ if (m_pVideoFilterShader) -+ { -+ GLint filter; -+ if (!m_pVideoFilterShader->GetTextureFilter(filter)) -+ filter = m_scalingMethod == VS_SCALINGMETHOD_NEAREST ? GL_NEAREST : GL_LINEAR; -+ -+ glTexParameteri(m_textureTarget, GL_TEXTURE_MAG_FILTER, filter); -+ glTexParameteri(m_textureTarget, GL_TEXTURE_MIN_FILTER, filter); -+ m_pVideoFilterShader->SetSourceTexture(0); -+ m_pVideoFilterShader->SetWidth(m_sourceWidth); -+ m_pVideoFilterShader->SetHeight(m_sourceHeight); -+ -+ //disable non-linear stretch when a dvd menu is shown, parts of the menu are rendered through the overlay renderer -+ //having non-linear stretch on breaks the alignment -+ if (g_application.m_pPlayer && g_application.m_pPlayer->IsInMenu()) -+ m_pVideoFilterShader->SetNonLinStretch(1.0); -+ else -+ m_pVideoFilterShader->SetNonLinStretch(pow(g_settings.m_fPixelRatio, g_advancedSettings.m_videoNonLinStretchRatio)); -+ -+ m_pVideoFilterShader->Enable(); -+ } -+ else -+ { -+ GLint filter = m_scalingMethod == VS_SCALINGMETHOD_NEAREST ? GL_NEAREST : GL_LINEAR; -+ glTexParameteri(m_textureTarget, GL_TEXTURE_MAG_FILTER, filter); -+ glTexParameteri(m_textureTarget, GL_TEXTURE_MIN_FILTER, filter); -+ } -+ -+ glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); -+ VerifyGLState(); -+ -+ glBegin(GL_QUADS); -+ if (m_textureTarget==GL_TEXTURE_2D) -+ { -+ glTexCoord2f(plane.rect.x1, plane.rect.y1); glVertex2f(m_destRect.x1, m_destRect.y1); -+ glTexCoord2f(plane.rect.x2, plane.rect.y1); glVertex2f(m_destRect.x2, m_destRect.y1); -+ glTexCoord2f(plane.rect.x2, plane.rect.y2); glVertex2f(m_destRect.x2, m_destRect.y2); -+ glTexCoord2f(plane.rect.x1, plane.rect.y2); glVertex2f(m_destRect.x1, m_destRect.y2); -+ } -+ else -+ { -+ glTexCoord2f(m_destRect.x1, m_destRect.y1); glVertex4f(m_destRect.x1, m_destRect.y1, 0.0f, 0.0f); -+ glTexCoord2f(m_destRect.x2, m_destRect.y1); glVertex4f(m_destRect.x2, m_destRect.y1, 1.0f, 0.0f); -+ glTexCoord2f(m_destRect.x2, m_destRect.y2); glVertex4f(m_destRect.x2, m_destRect.y2, 1.0f, 1.0f); -+ glTexCoord2f(m_destRect.x1, m_destRect.y2); glVertex4f(m_destRect.x1, m_destRect.y2, 0.0f, 1.0f); -+ } -+ glEnd(); -+ VerifyGLState(); -+ -+ if (m_pVideoFilterShader) -+ m_pVideoFilterShader->Disable(); -+ -+ glBindTexture (m_textureTarget, 0); -+ glDisable(m_textureTarget); -+#endif -+} -+ - void CLinuxRendererGL::RenderSoftware(int index, int field) - { - // used for textues uploaded from rgba or CVPixelBuffers. -@@ -2783,6 +2881,91 @@ bool CLinuxRendererGL::CreateCVRefTexture(int index) - return true; - } - -+void CLinuxRendererGL::DeleteXVBATexture(int index) -+{ -+#ifdef HAVE_LIBXVBA -+ YUVPLANE &plane = m_buffers[index].fields[0][0]; -+ YUVFIELDS &fields = m_buffers[index].fields; -+ -+ SAFE_RELEASE(m_buffers[index].xvba); -+ -+ if(plane.id && glIsTexture(plane.id)) -+ glDeleteTextures(1, &plane.id); -+ plane.id = 0; -+ fields[0][1].id = 0; -+#endif -+} -+ -+bool CLinuxRendererGL::CreateXVBATexture(int index) -+{ -+#ifdef HAVE_LIBXVBA -+ YV12Image &im = m_buffers[index].image; -+ YUVFIELDS &fields = m_buffers[index].fields; -+ YUVPLANE &plane = fields[0][0]; -+ -+ DeleteXVBATexture(index); -+ -+ memset(&im , 0, sizeof(im)); -+ memset(&fields, 0, sizeof(fields)); -+ -+ glGenTextures(1, &plane.id); -+ -+ m_eventTexturesDone[index]->Set(); -+#endif -+ return true; -+} -+ -+void CLinuxRendererGL::UploadXVBATexture(int index) -+{ -+#ifdef HAVE_LIBXVBA -+ XVBA::CXvbaRenderPicture *xvba = m_buffers[index].xvba; -+ YV12Image &im = m_buffers[index].image; -+ -+ YUVFIELDS &fields = m_buffers[index].fields; -+ YUVPLANE &plane = fields[0][1]; -+ -+ if (!xvba || !xvba->valid) -+ { -+ m_eventTexturesDone[index]->Set(); -+ m_skipRender = true; -+ return; -+ } -+ -+ plane.id = xvba->texture; -+ -+ im.height = xvba->texHeight; -+ im.width = xvba->texWidth; -+ -+ plane.texwidth = xvba->texWidth; -+ plane.texheight = xvba->texHeight; -+ plane.pixpertex_x = 1; -+ plane.pixpertex_y = 1; -+ -+ plane.rect = m_sourceRect; -+ plane.width = im.width; -+ plane.height = im.height; -+ -+ plane.height /= plane.pixpertex_y; -+ plane.rect.y1 /= plane.pixpertex_y; -+ plane.rect.y2 /= plane.pixpertex_y; -+ plane.width /= plane.pixpertex_x; -+ plane.rect.x1 /= plane.pixpertex_x; -+ plane.rect.x2 /= plane.pixpertex_x; -+ -+ if (m_textureTarget == GL_TEXTURE_2D) -+ { -+ plane.height /= plane.texheight; -+ plane.rect.y1 /= plane.texheight; -+ plane.rect.y2 /= plane.texheight; -+ plane.width /= plane.texwidth; -+ plane.rect.x1 /= plane.texwidth; -+ plane.rect.x2 /= plane.texwidth; -+ } -+ -+ m_eventTexturesDone[index]->Set(); -+#endif -+} -+ - void CLinuxRendererGL::UploadYUV422PackedTexture(int source) - { - YUVBUFFER& buf = m_buffers[source]; -@@ -3368,6 +3551,9 @@ bool CLinuxRendererGL::Supports(ERENDERFEATURE feature) - if (m_renderMethod & RENDER_VAAPI) - return false; - -+ if (m_renderMethod & RENDER_XVBA) -+ return false; -+ - return (m_renderMethod & RENDER_GLSL) - || (m_renderMethod & RENDER_ARB) - || ((m_renderMethod & RENDER_SW) && glewIsSupported("GL_ARB_imaging") == GL_TRUE); -@@ -3381,6 +3567,9 @@ bool CLinuxRendererGL::Supports(ERENDERFEATURE feature) - if (m_renderMethod & RENDER_VAAPI) - return false; - -+ if (m_renderMethod & RENDER_XVBA) -+ return false; -+ - return (m_renderMethod & RENDER_GLSL) - || (m_renderMethod & RENDER_ARB) - || ((m_renderMethod & RENDER_SW) && glewIsSupported("GL_ARB_imaging") == GL_TRUE); -@@ -3404,7 +3593,8 @@ bool CLinuxRendererGL::Supports(ERENDERFEATURE feature) - if (feature == RENDERFEATURE_NONLINSTRETCH) - { - if (((m_renderMethod & RENDER_GLSL) && !(m_renderMethod & RENDER_POT)) || -- (m_renderMethod & RENDER_VDPAU) || (m_renderMethod & RENDER_VAAPI)) -+ (m_renderMethod & RENDER_VDPAU) || (m_renderMethod & RENDER_VAAPI) || -+ (m_renderMethod & RENDER_XVBA)) - return true; - } - -@@ -3476,6 +3666,16 @@ bool CLinuxRendererGL::Supports(EINTERLACEMETHOD method) - return false; - } - -+ if(m_renderMethod & RENDER_XVBA) -+ { -+#ifdef HAVE_LIBXVBA -+ XVBA::CXvbaRenderPicture *xvba = m_buffers[m_iYV12RenderBuffer].xvba; -+ if(xvba) -+ return xvba->xvba->Supports(method); -+#endif -+ return false; -+ } -+ - #ifdef TARGET_DARWIN - // YADIF too slow for HD but we have no methods to fall back - // to something that works so just turn it off. -@@ -3518,7 +3718,7 @@ bool CLinuxRendererGL::Supports(ESCALINGMETHOD method) - || method == VS_SCALINGMETHOD_LANCZOS3) - { - if ((glewIsSupported("GL_EXT_framebuffer_object") && (m_renderMethod & RENDER_GLSL)) || -- (m_renderMethod & RENDER_VDPAU) || (m_renderMethod & RENDER_VAAPI)) -+ (m_renderMethod & RENDER_VDPAU) || (m_renderMethod & RENDER_VAAPI) || (m_renderMethod & RENDER_XVBA)) - { - // spline36 and lanczos3 are only allowed through advancedsettings.xml - if(method != VS_SCALINGMETHOD_SPLINE36 -@@ -3610,4 +3810,14 @@ void CLinuxRendererGL::AddProcessor(struct __CVBuffer *cvBufferRef, int index) - } - #endif - -+#ifdef HAVE_LIBXVBA -+void CLinuxRendererGL::AddProcessor(XVBA::CXvbaRenderPicture* xvba, int index) -+{ -+ YUVBUFFER &buf = m_buffers[index]; -+ XVBA::CXvbaRenderPicture *pic = xvba->Acquire(); -+ SAFE_RELEASE(buf.xvba); -+ buf.xvba = pic; -+} -+#endif -+ - #endif -diff --git a/xbmc/cores/VideoRenderers/LinuxRendererGL.h b/xbmc/cores/VideoRenderers/LinuxRendererGL.h -index 13217ce..a189892 100644 ---- a/xbmc/cores/VideoRenderers/LinuxRendererGL.h -+++ b/xbmc/cores/VideoRenderers/LinuxRendererGL.h -@@ -43,6 +43,8 @@ - namespace Shaders { class BaseVideoFilterShader; } - namespace VAAPI { struct CHolder; } - namespace VDPAU { class CVdpauRenderPicture; } -+namespace XVBA { class CXvbaRenderPicture; } -+ - - #undef ALIGN - #define ALIGN(value, alignment) (((value)+((alignment)-1))&~((alignment)-1)) -@@ -88,6 +90,7 @@ enum RenderMethod - RENDER_POT=0x10, - RENDER_VAAPI=0x20, - RENDER_CVREF = 0x40, -+ RENDER_XVBA=0x80, - }; - - enum RenderQuality -@@ -149,7 +152,9 @@ class CLinuxRendererGL : public CBaseRenderer - #ifdef TARGET_DARWIN - virtual void AddProcessor(struct __CVBuffer *cvBufferRef, int index); - #endif -- -+#ifdef HAVE_LIBXVBA -+ virtual void AddProcessor(XVBA::CXvbaRenderPicture* xvba, int index); -+#endif - virtual void RenderUpdate(bool clear, DWORD flags = 0, DWORD alpha = 255); - - // Feature support -@@ -208,6 +213,10 @@ class CLinuxRendererGL : public CBaseRenderer - void DeleteYUV422PackedTexture(int index); - bool CreateYUV422PackedTexture(int index); - -+ void UploadXVBATexture(int index); -+ void DeleteXVBATexture(int index); -+ bool CreateXVBATexture(int index); -+ - void UploadRGBTexture(int index); - void ToRGBFrame(YV12Image* im, unsigned flipIndexPlane, unsigned flipIndexBuf); - void ToRGBFields(YV12Image* im, unsigned flipIndexPlaneTop, unsigned flipIndexPlaneBot, unsigned flipIndexBuf); -@@ -223,6 +232,7 @@ class CLinuxRendererGL : public CBaseRenderer - void RenderVDPAU(int renderBuffer, int field); // render using vdpau hardware - void RenderProgressiveWeave(int renderBuffer, int field); // render using vdpau hardware - void RenderVAAPI(int renderBuffer, int field); // render using vdpau hardware -+ void RenderXVBA(int renderBuffer, int field); // render using xvba hardware - - struct - { -@@ -290,6 +300,9 @@ class CLinuxRendererGL : public CBaseRenderer - #ifdef TARGET_DARWIN_OSX - struct __CVBuffer *cvBufferRef; - #endif -+#ifdef HAVE_LIBXVBA -+ XVBA::CXvbaRenderPicture *xvba; -+#endif - }; - - typedef YUVBUFFER YUVBUFFERS[NUM_BUFFERS]; -diff --git a/xbmc/cores/VideoRenderers/RenderFormats.h b/xbmc/cores/VideoRenderers/RenderFormats.h -index 0262c60..a727d94 100644 ---- a/xbmc/cores/VideoRenderers/RenderFormats.h -+++ b/xbmc/cores/VideoRenderers/RenderFormats.h -@@ -35,6 +35,7 @@ enum ERenderFormat { - RENDER_FMT_OMXEGL, - RENDER_FMT_CVBREF, - RENDER_FMT_BYPASS, -+ RENDER_FMT_XVBA, - }; - - #endif -diff --git a/xbmc/cores/VideoRenderers/RenderManager.cpp b/xbmc/cores/VideoRenderers/RenderManager.cpp -index b89ec67..c99a555 100644 ---- a/xbmc/cores/VideoRenderers/RenderManager.cpp -+++ b/xbmc/cores/VideoRenderers/RenderManager.cpp -@@ -876,6 +876,10 @@ int CXBMCRenderManager::AddVideoPicture(DVDVideoPicture& pic) - else if(pic.format == RENDER_FMT_VAAPI) - m_pRenderer->AddProcessor(*pic.vaapi, index); - #endif -+#ifdef HAVE_LIBXVBA -+ else if(pic.format == RENDER_FMT_XVBA) -+ m_pRenderer->AddProcessor(pic.xvba, index); -+#endif - m_pRenderer->ReleaseImage(index, false); - - m_bRenderBufferUsed = true; -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h -index 64c5f5f..5fa52c3 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h -@@ -35,6 +35,7 @@ - namespace DXVA { class CSurfaceContext; } - namespace VAAPI { struct CHolder; } - namespace VDPAU { class CVdpauRenderPicture; } -+namespace XVBA { class CXvbaRenderPicture; } - class COpenMax; - class COpenMaxVideo; - struct OpenMaxVideoBuffer; -@@ -60,6 +61,9 @@ struct DVDVideoPicture - struct { - VAAPI::CHolder* vaapi; - }; -+ struct { -+ XVBA::CXvbaRenderPicture* xvba; -+ }; - - struct { - COpenMax *openMax; -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp -index e0c0f84..fc51dbf 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp -@@ -56,6 +56,9 @@ - #ifdef HAVE_LIBVA - #include "VAAPI.h" - #endif -+#ifdef HAVE_LIBXVBA -+#include "XVBA.h" -+#endif - - using namespace boost; - -@@ -100,6 +103,19 @@ enum PixelFormat CDVDVideoCodecFFmpeg::GetFormat( struct AVCodecContext * avctx - dec->Release(); - } - #endif -+#ifdef HAVE_LIBXVBA -+ if(*cur == PIX_FMT_XVBA_VLD && g_guiSettings.GetBool("videoplayer.usexvba")) -+ { -+ XVBA::CDecoder* dec = new XVBA::CDecoder(); -+ if(dec->Open(avctx, *cur, ctx->m_uSurfacesCount)) -+ { -+ ctx->SetHardware(dec); -+ return *cur; -+ } -+ else -+ dec->Release(); -+ } -+#endif - #ifdef HAVE_LIBVA - // mpeg4 vaapi decoding is disabled - if(*cur == PIX_FMT_VAAPI_VLD && g_guiSettings.GetBool("videoplayer.usevaapi") -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/Makefile.in b/xbmc/cores/dvdplayer/DVDCodecs/Video/Makefile.in -index 176ceff..c58422b 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/Makefile.in -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/Makefile.in -@@ -14,6 +14,10 @@ ifeq (@USE_CRYSTALHD@,1) - SRCS += CrystalHD.cpp - SRCS += DVDVideoCodecCrystalHD.cpp - endif -+ifeq (@USE_XVBA@,1) -+SRCS+= XVBA.cpp \ -+ -+endif - ifeq (@USE_VDA@,1) - SRCS += DVDVideoCodecVDA.cpp - endif -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/XVBA.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/XVBA.cpp -new file mode 100644 -index 0000000..47ff25f ---- /dev/null -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/XVBA.cpp -@@ -0,0 +1,2367 @@ -+/* -+ * Copyright (C) 2005-2011 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 "system.h" -+#ifdef HAVE_LIBXVBA -+ -+#include "system_gl.h" -+#include -+#include -+#include "XVBA.h" -+#include "windowing/WindowingFactory.h" -+#include "guilib/GraphicContext.h" -+#include "settings/GUISettings.h" -+#include "settings/Settings.h" -+#include "utils/TimeUtils.h" -+#include "cores/dvdplayer/DVDClock.h" -+ -+using namespace XVBA; -+ -+// XVBA interface -+ -+#define XVBA_LIBRARY "libXvBAW.so.1" -+ -+typedef Bool (*XVBAQueryExtensionProc) (Display *dpy, int *vers); -+typedef Status (*XVBACreateContextProc) (void *input, void *output); -+typedef Status (*XVBADestroyContextProc) (void *context); -+typedef Bool (*XVBAGetSessionInfoProc) (void *input, void *output); -+typedef Status (*XVBACreateSurfaceProc) (void *input, void *output); -+typedef Status (*XVBACreateGLSharedSurfaceProc)(void *input, void *output); -+typedef Status (*XVBADestroySurfaceProc) (void *surface); -+typedef Status (*XVBACreateDecodeBuffersProc) (void *input, void *output); -+typedef Status (*XVBADestroyDecodeBuffersProc) (void *input); -+typedef Status (*XVBAGetCapDecodeProc) (void *input, void *output); -+typedef Status (*XVBACreateDecodeProc) (void *input, void *output); -+typedef Status (*XVBADestroyDecodeProc) (void *session); -+typedef Status (*XVBAStartDecodePictureProc) (void *input); -+typedef Status (*XVBADecodePictureProc) (void *input); -+typedef Status (*XVBAEndDecodePictureProc) (void *input); -+typedef Status (*XVBASyncSurfaceProc) (void *input, void *output); -+typedef Status (*XVBAGetSurfaceProc) (void *input); -+typedef Status (*XVBATransferSurfaceProc) (void *input); -+ -+static struct -+{ -+ XVBAQueryExtensionProc QueryExtension; -+ XVBACreateContextProc CreateContext; -+ XVBADestroyContextProc DestroyContext; -+ XVBAGetSessionInfoProc GetSessionInfo; -+ XVBACreateSurfaceProc CreateSurface; -+ XVBACreateGLSharedSurfaceProc CreateGLSharedSurface; -+ XVBADestroySurfaceProc DestroySurface; -+ XVBACreateDecodeBuffersProc CreateDecodeBuffers; -+ XVBADestroyDecodeBuffersProc DestroyDecodeBuffers; -+ XVBAGetCapDecodeProc GetCapDecode; -+ XVBACreateDecodeProc CreateDecode; -+ XVBADestroyDecodeProc DestroyDecode; -+ XVBAStartDecodePictureProc StartDecodePicture; -+ XVBADecodePictureProc DecodePicture; -+ XVBAEndDecodePictureProc EndDecodePicture; -+ XVBASyncSurfaceProc SyncSurface; -+ XVBAGetSurfaceProc GetSurface; -+ XVBATransferSurfaceProc TransferSurface; -+}g_XVBA_vtable; -+ -+//----------------------------------------------------------------------------- -+//----------------------------------------------------------------------------- -+ -+CXVBAContext *CXVBAContext::m_context = 0; -+CCriticalSection CXVBAContext::m_section; -+Display *CXVBAContext::m_display = 0; -+void *CXVBAContext::m_dlHandle = 0; -+ -+CXVBAContext::CXVBAContext() -+{ -+ m_context = 0; -+// m_dlHandle = 0; -+ m_xvbaContext = 0; -+ m_refCount = 0; -+} -+ -+void CXVBAContext::Release() -+{ -+ CSingleLock lock(m_section); -+ -+ m_refCount--; -+ if (m_refCount <= 0) -+ { -+ Close(); -+ delete this; -+ m_context = 0; -+ } -+} -+ -+void CXVBAContext::Close() -+{ -+ CLog::Log(LOGNOTICE, "XVBA::Close - closing decoder context"); -+ -+ DestroyContext(); -+// if (m_dlHandle) -+// { -+// dlclose(m_dlHandle); -+// m_dlHandle = 0; -+// } -+} -+ -+bool CXVBAContext::EnsureContext(CXVBAContext **ctx) -+{ -+ CSingleLock lock(m_section); -+ -+ if (m_context) -+ { -+ m_context->m_refCount++; -+ *ctx = m_context; -+ return true; -+ } -+ -+ m_context = new CXVBAContext(); -+ *ctx = m_context; -+ { -+ CSingleLock gLock(g_graphicsContext); -+ if (!m_context->LoadSymbols() || !m_context->CreateContext()) -+ { -+ delete m_context; -+ m_context = 0; -+ return false; -+ } -+ } -+ -+ m_context->m_refCount++; -+ -+ *ctx = m_context; -+ return true; -+} -+ -+bool CXVBAContext::LoadSymbols() -+{ -+ if (!m_dlHandle) -+ { -+ m_dlHandle = dlopen(XVBA_LIBRARY, RTLD_LAZY); -+ if (!m_dlHandle) -+ { -+ const char* error = dlerror(); -+ if (!error) -+ error = "dlerror() returned NULL"; -+ -+ CLog::Log(LOGERROR,"XVBA::LoadSymbols: Unable to get handle to lib: %s", error); -+ return false; -+ } -+ } -+ else -+ return true; -+ -+#define INIT_PROC(PREFIX, PROC) do { \ -+ g_##PREFIX##_vtable.PROC = (PREFIX##PROC##Proc) \ -+ dlsym(m_dlHandle, #PREFIX #PROC); \ -+ } while (0) -+ -+#define INIT_PROC_CHECK(PREFIX, PROC) do { \ -+ dlerror(); \ -+ INIT_PROC(PREFIX, PROC); \ -+ if (dlerror()) { \ -+ dlclose(m_dlHandle); \ -+ m_dlHandle = NULL; \ -+ return false; \ -+ } \ -+ } while (0) -+ -+#define XVBA_INIT_PROC(PROC) INIT_PROC_CHECK(XVBA, PROC) -+ -+ XVBA_INIT_PROC(QueryExtension); -+ XVBA_INIT_PROC(CreateContext); -+ XVBA_INIT_PROC(DestroyContext); -+ XVBA_INIT_PROC(GetSessionInfo); -+ XVBA_INIT_PROC(CreateSurface); -+ XVBA_INIT_PROC(CreateGLSharedSurface); -+ XVBA_INIT_PROC(DestroySurface); -+ XVBA_INIT_PROC(CreateDecodeBuffers); -+ XVBA_INIT_PROC(DestroyDecodeBuffers); -+ XVBA_INIT_PROC(GetCapDecode); -+ XVBA_INIT_PROC(CreateDecode); -+ XVBA_INIT_PROC(DestroyDecode); -+ XVBA_INIT_PROC(StartDecodePicture); -+ XVBA_INIT_PROC(DecodePicture); -+ XVBA_INIT_PROC(EndDecodePicture); -+ XVBA_INIT_PROC(SyncSurface); -+ XVBA_INIT_PROC(GetSurface); -+ XVBA_INIT_PROC(TransferSurface); -+ -+#undef XVBA_INIT_PROC -+#undef INIT_PROC -+ -+ return true; -+} -+ -+bool CXVBAContext::CreateContext() -+{ -+ if (m_xvbaContext) -+ return true; -+ -+ CLog::Log(LOGNOTICE,"XVBA::CreateContext - creating decoder context"); -+ -+ Drawable window; -+ { CSingleLock lock(g_graphicsContext); -+ if (!m_display) -+ m_display = XOpenDisplay(NULL); -+ window = 0; -+ } -+ -+ int version; -+ if (!g_XVBA_vtable.QueryExtension(m_display, &version)) -+ return false; -+ CLog::Log(LOGNOTICE,"XVBA::CreateContext - opening xvba version: %i", version); -+ -+ // create XVBA Context -+ XVBA_Create_Context_Input contextInput; -+ XVBA_Create_Context_Output contextOutput; -+ contextInput.size = sizeof(contextInput); -+ contextInput.display = m_display; -+ contextInput.draw = window; -+ contextOutput.size = sizeof(contextOutput); -+ if(Success != g_XVBA_vtable.CreateContext(&contextInput, &contextOutput)) -+ { -+ CLog::Log(LOGERROR,"XVBA::CreateContext - failed to create context"); -+ return false; -+ } -+ m_xvbaContext = contextOutput.context; -+ -+ return true; -+} -+ -+void CXVBAContext::DestroyContext() -+{ -+ if (!m_xvbaContext) -+ return; -+ -+ g_XVBA_vtable.DestroyContext(m_xvbaContext); -+ m_xvbaContext = 0; -+// XCloseDisplay(m_display); -+} -+ -+void *CXVBAContext::GetContext() -+{ -+ return m_xvbaContext; -+} -+ -+//----------------------------------------------------------------------------- -+//----------------------------------------------------------------------------- -+ -+static unsigned int decoderId = 0; -+ -+CDecoder::CDecoder() : m_xvbaOutput(&m_inMsgEvent) -+{ -+ m_xvbaConfig.context = 0; -+ m_xvbaConfig.xvbaSession = 0; -+ m_xvbaConfig.videoSurfaces = &m_videoSurfaces; -+ m_xvbaConfig.videoSurfaceSec = &m_videoSurfaceSec; -+ m_xvbaConfig.apiSec = &m_apiSec; -+ -+ m_displayState = XVBA_OPEN; -+} -+ -+CDecoder::~CDecoder() -+{ -+ Close(); -+} -+ -+typedef struct { -+ unsigned int size; -+ unsigned int num_of_decodecaps; -+ XVBADecodeCap decode_caps_list[]; -+} XVBA_GetCapDecode_Output_Base; -+ -+void CDecoder::OnLostDevice() -+{ -+ CLog::Log(LOGNOTICE,"XVBA::OnLostDevice event"); -+ -+ CSingleLock lock(m_decoderSection); -+ DestroySession(); -+ if (m_xvbaConfig.context) -+ m_xvbaConfig.context->Release(); -+ m_xvbaConfig.context = 0; -+ -+ m_displayState = XVBA_LOST; -+ m_displayEvent.Reset(); -+} -+ -+void CDecoder::OnResetDevice() -+{ -+ CLog::Log(LOGNOTICE,"XVBA::OnResetDevice event"); -+ -+ CSingleLock lock(m_decoderSection); -+ if (m_displayState == XVBA_LOST) -+ { -+ m_displayState = XVBA_RESET; -+ lock.Leave(); -+ m_displayEvent.Set(); -+ } -+} -+ -+bool CDecoder::Open(AVCodecContext* avctx, const enum PixelFormat fmt, unsigned int surfaces) -+{ -+ std::string Vendor = g_Windowing.GetRenderVendor(); -+ std::transform(Vendor.begin(), Vendor.end(), Vendor.begin(), ::tolower); -+ if (Vendor.compare(0, 3, "ati") != 0) -+ { -+ return false; -+ } -+ -+ m_decoderId = decoderId++; -+ -+ CLog::Log(LOGNOTICE,"(XVBA::Open) opening xvba decoder, id: %d", m_decoderId); -+ -+ if(avctx->coded_width == 0 -+ || avctx->coded_height == 0) -+ { -+ CLog::Log(LOGWARNING,"(XVBA) no width/height available, can't init"); -+ return false; -+ } -+ -+ // Fixme: Revisit with new SDK -+ // Workaround for 0.74.01-AES-2 that does not signal if surfaces are too large -+ // it seems that xvba does not support anything > 2k -+ // return false, for files that are larger -+ // if you are unlucky, this would kill your decoder -+ // we limit to 2048x1536(+8) now - as this was tested working -+ int surfaceWidth = (avctx->coded_width+15) & ~15; -+ int surfaceHeight = (avctx->coded_height+15) & ~15; -+ if(surfaceHeight > 1544 || surfaceWidth > 2048) -+ { -+ CLog::Log(LOGERROR, "Surface too large, decoder skipped: surfaceWidth %u, surfaceHeight %u", -+ surfaceWidth, surfaceHeight); -+ return false; -+ } -+ -+ if (!m_dllAvUtil.Load()) -+ return false; -+ -+ if (!CXVBAContext::EnsureContext(&m_xvbaConfig.context)) -+ return false; -+ -+ // xvba get session info -+ XVBA_GetSessionInfo_Input sessionInput; -+ XVBA_GetSessionInfo_Output sessionOutput; -+ sessionInput.size = sizeof(sessionInput); -+ sessionInput.context = m_xvbaConfig.context->GetContext(); -+ sessionOutput.size = sizeof(sessionOutput); -+ if (Success != g_XVBA_vtable.GetSessionInfo(&sessionInput, &sessionOutput)) -+ { -+ CLog::Log(LOGERROR,"(XVBA) can't get session info"); -+ return false; -+ } -+ if (sessionOutput.getcapdecode_output_size == 0) -+ { -+ CLog::Log(LOGERROR,"(XVBA) session decode not supported"); -+ return false; -+ } -+ -+ // get decoder capabilities -+ XVBA_GetCapDecode_Input capInput; -+ XVBA_GetCapDecode_Output *capOutput; -+ capInput.size = sizeof(capInput); -+ capInput.context = m_xvbaConfig.context->GetContext(); -+ capOutput = (XVBA_GetCapDecode_Output *)calloc(sessionOutput.getcapdecode_output_size, 1); -+ capOutput->size = sessionOutput.getcapdecode_output_size; -+ if (Success != g_XVBA_vtable.GetCapDecode(&capInput, capOutput)) -+ { -+ CLog::Log(LOGERROR,"(XVBA) can't get decode capabilities"); -+ return false; -+ } -+ -+ int match = -1; -+ if (avctx->codec_id == CODEC_ID_H264) -+ { -+ // search for profile high -+ for (unsigned int i = 0; i < capOutput->num_of_decodecaps; ++i) -+ { -+ if (capOutput->decode_caps_list[i].capability_id == XVBA_H264 && -+ capOutput->decode_caps_list[i].flags == XVBA_H264_HIGH) -+ { -+ match = (int) i; -+ break; -+ } -+ } -+ if (match < 0) -+ { -+ CLog::Log(LOGNOTICE, "(XVBA::Open) - profile XVBA_H264_HIGH not found"); -+ } -+ } -+ else if (avctx->codec_id == CODEC_ID_VC1) -+ { -+ // search for profile advanced -+ for (unsigned int i = 0; i < capOutput->num_of_decodecaps; ++i) -+ { -+ if (capOutput->decode_caps_list[i].capability_id == XVBA_VC1 && -+ capOutput->decode_caps_list[i].flags == XVBA_VC1_ADVANCED) -+ { -+ match = (int) i; -+ break; -+ } -+ } -+ if (match < 0) -+ { -+ CLog::Log(LOGNOTICE, "(XVBA::Open) - profile XVBA_VC1_ADVANCED not found"); -+ } -+ } -+ else if (avctx->codec_id == CODEC_ID_MPEG2VIDEO) -+ { -+ // search for profile high -+ for (unsigned int i = 0; i < capOutput->num_of_decodecaps; ++i) -+ { -+ if (capOutput->decode_caps_list[i].capability_id == XVBA_MPEG2_VLD) -+ { -+ // XXX: uncomment when implemented -+ // match = (int) i; -+ // break; -+ } -+ } -+ if (match < 0) -+ { -+ CLog::Log(LOGNOTICE, "(XVBA::Open) - profile XVBA_MPEG2_VLD not found"); -+ } -+ } -+ else if (avctx->codec_id == CODEC_ID_WMV3) -+ { -+ // search for profile high -+ for (unsigned int i = 0; i < capOutput->num_of_decodecaps; ++i) -+ { -+ if (capOutput->decode_caps_list[i].capability_id == XVBA_VC1 && -+ capOutput->decode_caps_list[i].flags == XVBA_VC1_MAIN) -+ { -+ match = (int) i; -+ break; -+ } -+ } -+ if (match < 0) -+ { -+ CLog::Log(LOGNOTICE, "(XVBA::Open) - profile XVBA_VC1_MAIN not found"); -+ } -+ } -+ -+ if (match < 0) -+ { -+ free(capOutput); -+ return false; -+ } -+ -+ CLog::Log(LOGNOTICE,"(XVBA) using decoder capability id: %i flags: %i", -+ capOutput->decode_caps_list[match].capability_id, -+ capOutput->decode_caps_list[match].flags); -+ CLog::Log(LOGNOTICE,"(XVBA) using surface type: %x", -+ capOutput->decode_caps_list[match].surface_type); -+ -+ m_xvbaConfig.decoderCap = capOutput->decode_caps_list[match]; -+ -+ free(capOutput); -+ -+ // set some varables -+ m_xvbaConfig.xvbaSession = 0; -+ m_xvbaBufferPool.data_buffer = 0; -+ m_xvbaBufferPool.iq_matrix_buffer = 0; -+ m_xvbaBufferPool.picture_descriptor_buffer = 0; -+ m_presentPicture = 0; -+ m_xvbaConfig.numRenderBuffers = surfaces; -+ m_decoderThread = CThread::GetCurrentThreadId(); -+ m_speed = DVD_PLAYSPEED_NORMAL; -+ -+ if (1) //g_guiSettings.GetBool("videoplayer.usexvbasharedsurface")) -+ m_xvbaConfig.useSharedSurfaces = true; -+ else -+ m_xvbaConfig.useSharedSurfaces = false; -+ -+ m_displayState = XVBA_OPEN; -+ -+ // setup ffmpeg -+ avctx->thread_count = 1; -+ avctx->get_buffer = CDecoder::FFGetBuffer; -+ avctx->release_buffer = CDecoder::FFReleaseBuffer; -+ avctx->draw_horiz_band = CDecoder::FFDrawSlice; -+ avctx->slice_flags = SLICE_FLAG_CODED_ORDER|SLICE_FLAG_ALLOW_FIELD; -+ -+ g_Windowing.Register(this); -+ return true; -+} -+ -+void CDecoder::Close() -+{ -+ CLog::Log(LOGNOTICE, "XVBA::Close - closing decoder, id: %d", m_decoderId); -+ -+ if (!m_xvbaConfig.context) -+ return; -+ -+ DestroySession(); -+ if (m_xvbaConfig.context) -+ m_xvbaConfig.context->Release(); -+ m_xvbaConfig.context = 0; -+ -+ while (!m_videoSurfaces.empty()) -+ { -+ xvba_render_state *render = m_videoSurfaces.back(); -+ if(render->buffers_alllocated > 0) -+ m_dllAvUtil.av_free(render->buffers); -+ m_videoSurfaces.pop_back(); -+ free(render); -+ } -+ -+ g_Windowing.Unregister(this); -+ m_dllAvUtil.Unload(); -+} -+ -+long CDecoder::Release() -+{ -+ // check if we should do some pre-cleanup here -+ // a second decoder might need resources -+ if (m_xvbaConfig.xvbaSession) -+ { -+ CSingleLock lock(m_decoderSection); -+ CLog::Log(LOGNOTICE,"XVBA::Release pre-cleanup"); -+ DestroySession(true); -+ } -+ return IHardwareDecoder::Release(); -+} -+ -+long CDecoder::ReleasePicReference() -+{ -+ return IHardwareDecoder::Release(); -+} -+ -+bool CDecoder::Supports(EINTERLACEMETHOD method) -+{ -+ if(method == VS_INTERLACEMETHOD_AUTO) -+ return true; -+ -+ if (1) //g_guiSettings.GetBool("videoplayer.usexvbasharedsurface")) -+ { -+ if (method == VS_INTERLACEMETHOD_XVBA) -+ return true; -+ } -+ -+ return false; -+} -+ -+void CDecoder::ResetState() -+{ -+ m_displayState = XVBA_OPEN; -+} -+ -+int CDecoder::Check(AVCodecContext* avctx) -+{ -+ EDisplayState state; -+ -+ { CSingleLock lock(m_decoderSection); -+ state = m_displayState; -+ } -+ -+ if (state == XVBA_LOST) -+ { -+ CLog::Log(LOGNOTICE,"XVBA::Check waiting for display reset event"); -+ if (!m_displayEvent.WaitMSec(2000)) -+ { -+ CLog::Log(LOGERROR, "XVBA::Check - device didn't reset in reasonable time"); -+ state = XVBA_RESET;; -+ } -+ else -+ { CSingleLock lock(m_decoderSection); -+ state = m_displayState; -+ } -+ } -+ if (state == XVBA_RESET || state == XVBA_ERROR) -+ { -+ CLog::Log(LOGNOTICE,"XVBA::Check - Attempting recovery"); -+ -+ CSingleLock gLock(g_graphicsContext); -+ CSingleLock lock(m_decoderSection); -+ -+ DestroySession(); -+ ResetState(); -+ CXVBAContext::EnsureContext(&m_xvbaConfig.context); -+ -+ if (state == XVBA_RESET) -+ return VC_FLUSHED; -+ else -+ return VC_ERROR; -+ } -+ return 0; -+} -+ -+void CDecoder::SetError(const char* function, const char* msg, int line) -+{ -+ CLog::Log(LOGERROR, "XVBA::%s - %s, line %d", function, msg, line); -+ CSingleLock lock(m_decoderSection); -+ m_displayState = XVBA_ERROR; -+} -+ -+bool CDecoder::CreateSession(AVCodecContext* avctx) -+{ -+ m_xvbaConfig.surfaceWidth = (avctx->coded_width+15) & ~15; -+ m_xvbaConfig.surfaceHeight = (avctx->coded_height+15) & ~15; -+ -+ m_xvbaConfig.vidWidth = avctx->width; -+ m_xvbaConfig.vidHeight = avctx->height; -+ -+ XVBA_Create_Decode_Session_Input sessionInput; -+ XVBA_Create_Decode_Session_Output sessionOutput; -+ -+ sessionInput.size = sizeof(sessionInput); -+ sessionInput.width = m_xvbaConfig.surfaceWidth; -+ sessionInput.height = m_xvbaConfig.surfaceHeight; -+ sessionInput.context = m_xvbaConfig.context->GetContext(); -+ sessionInput.decode_cap = &m_xvbaConfig.decoderCap; -+ sessionOutput.size = sizeof(sessionOutput); -+ -+ if (Success != g_XVBA_vtable.CreateDecode(&sessionInput, &sessionOutput)) -+ { -+ SetError(__FUNCTION__, "failed to create decoder session", __LINE__); -+ CLog::Log(LOGERROR, "Decoder failed with following stats: m_surfaceWidth %u, m_surfaceHeight %u," -+ " m_vidWidth %u, m_vidHeight %u, coded_width %d, coded_height %d", -+ m_xvbaConfig.surfaceWidth, -+ m_xvbaConfig.surfaceHeight, -+ m_xvbaConfig.vidWidth, -+ m_xvbaConfig.vidHeight, -+ avctx->coded_width, -+ avctx->coded_height); -+ return false; -+ } -+ m_xvbaConfig.xvbaSession = sessionOutput.session; -+ -+ // create decode buffers -+ XVBA_Create_DecodeBuff_Input bufferInput; -+ XVBA_Create_DecodeBuff_Output bufferOutput; -+ -+ bufferInput.size = sizeof(bufferInput); -+ bufferInput.session = m_xvbaConfig.xvbaSession; -+ bufferInput.buffer_type = XVBA_PICTURE_DESCRIPTION_BUFFER; -+ bufferInput.num_of_buffers = 1; -+ bufferOutput.size = sizeof(bufferOutput); -+ if (Success != g_XVBA_vtable.CreateDecodeBuffers(&bufferInput, &bufferOutput) -+ || bufferOutput.num_of_buffers_in_list != 1) -+ { -+ SetError(__FUNCTION__, "failed to create picture buffer", __LINE__); -+ return false; -+ } -+ m_xvbaBufferPool.picture_descriptor_buffer = bufferOutput.buffer_list; -+ -+ // data buffer -+ bufferInput.buffer_type = XVBA_DATA_BUFFER; -+ if (Success != g_XVBA_vtable.CreateDecodeBuffers(&bufferInput, &bufferOutput) -+ || bufferOutput.num_of_buffers_in_list != 1) -+ { -+ SetError(__FUNCTION__, "failed to create data buffer", __LINE__); -+ return false; -+ } -+ m_xvbaBufferPool.data_buffer = bufferOutput.buffer_list; -+ -+ // QO Buffer -+ bufferInput.buffer_type = XVBA_QM_BUFFER; -+ if (Success != g_XVBA_vtable.CreateDecodeBuffers(&bufferInput, &bufferOutput) -+ || bufferOutput.num_of_buffers_in_list != 1) -+ { -+ SetError(__FUNCTION__, "failed to create qm buffer", __LINE__); -+ return false; -+ } -+ m_xvbaBufferPool.iq_matrix_buffer = bufferOutput.buffer_list; -+ -+ -+ // initialize output -+ CSingleLock lock(g_graphicsContext); -+ m_xvbaConfig.stats = &m_bufferStats; -+ m_bufferStats.Reset(); -+ m_xvbaOutput.Start(); -+ Message *reply; -+ if (m_xvbaOutput.m_controlPort.SendOutMessageSync(COutputControlProtocol::INIT, -+ &reply, -+ 2000, -+ &m_xvbaConfig, -+ sizeof(m_xvbaConfig))) -+ { -+ bool success = reply->signal == COutputControlProtocol::ACC ? true : false; -+ reply->Release(); -+ if (!success) -+ { -+ CLog::Log(LOGERROR, "XVBA::%s - vdpau output returned error", __FUNCTION__); -+ m_xvbaOutput.Dispose(); -+ return false; -+ } -+ } -+ else -+ { -+ CLog::Log(LOGERROR, "XVBA::%s - failed to init output", __FUNCTION__); -+ m_xvbaOutput.Dispose(); -+ return false; -+ } -+ m_inMsgEvent.Reset(); -+ -+ return true; -+} -+ -+void CDecoder::DestroySession(bool precleanup /*= false*/) -+{ -+ // wait for unfinished decoding jobs -+ XbmcThreads::EndTime timer; -+ if (m_xvbaConfig.xvbaSession) -+ { -+ for (unsigned int i = 0; i < m_videoSurfaces.size(); ++i) -+ { -+ xvba_render_state *render = m_videoSurfaces[i]; -+ if (render->surface) -+ { -+ XVBA_Surface_Sync_Input syncInput; -+ XVBA_Surface_Sync_Output syncOutput; -+ syncInput.size = sizeof(syncInput); -+ syncInput.session = m_xvbaConfig.xvbaSession; -+ syncInput.surface = render->surface; -+ syncInput.query_status = XVBA_GET_SURFACE_STATUS; -+ syncOutput.size = sizeof(syncOutput); -+ timer.Set(1000); -+ while(!timer.IsTimePast()) -+ { -+ if (Success != g_XVBA_vtable.SyncSurface(&syncInput, &syncOutput)) -+ { -+ CLog::Log(LOGERROR,"XVBA::DestroySession - failed sync surface"); -+ break; -+ } -+ if (!(syncOutput.status_flags & XVBA_STILL_PENDING)) -+ break; -+ Sleep(10); -+ } -+ if (timer.IsTimePast()) -+ CLog::Log(LOGERROR,"XVBA::DestroySession - unfinished decoding job"); -+ } -+ } -+ } -+ -+ if (precleanup) -+ { -+ Message *reply; -+ if (m_xvbaOutput.m_controlPort.SendOutMessageSync(COutputControlProtocol::PRECLEANUP, -+ &reply, -+ 2000)) -+ { -+ bool success = reply->signal == COutputControlProtocol::ACC ? true : false; -+ reply->Release(); -+ if (!success) -+ { -+ CLog::Log(LOGERROR, "XVBA::%s - pre-cleanup returned error", __FUNCTION__); -+ m_displayState = XVBA_ERROR; -+ } -+ } -+ else -+ { -+ CLog::Log(LOGERROR, "XVBA::%s - pre-cleanup timed out", __FUNCTION__); -+ m_displayState = XVBA_ERROR; -+ } -+ } -+ else -+ m_xvbaOutput.Dispose(); -+ -+ XVBA_Destroy_Decode_Buffers_Input bufInput; -+ bufInput.size = sizeof(bufInput); -+ bufInput.num_of_buffers_in_list = 1; -+ bufInput.session = m_xvbaConfig.xvbaSession; -+ -+ for (unsigned int i=0; isurface) -+ { -+ g_XVBA_vtable.DestroySurface(render->surface); -+ render->surface = 0; -+ render->state = 0; -+ render->picture_descriptor = 0; -+ render->iq_matrix = 0; -+ } -+ } -+ -+ if (m_xvbaConfig.xvbaSession) -+ g_XVBA_vtable.DestroyDecode(m_xvbaConfig.xvbaSession); -+ m_xvbaConfig.xvbaSession = 0; -+} -+ -+bool CDecoder::IsSurfaceValid(xvba_render_state *render) -+{ -+ // find render state in queue -+ bool found(false); -+ unsigned int i; -+ for(i = 0; i < m_videoSurfaces.size(); ++i) -+ { -+ if(m_videoSurfaces[i] == render) -+ { -+ found = true; -+ break; -+ } -+ } -+ if (!found) -+ { -+ CLog::Log(LOGERROR,"%s - video surface not found", __FUNCTION__); -+ return false; -+ } -+ if (m_videoSurfaces[i]->surface == 0) -+ { -+ m_videoSurfaces[i]->state = 0; -+ return false; -+ } -+ -+ return true; -+} -+ -+bool CDecoder::EnsureDataControlBuffers(unsigned int num) -+{ -+ if (m_xvbaBufferPool.data_control_buffers.size() >= num) -+ return true; -+ -+ unsigned int missing = num - m_xvbaBufferPool.data_control_buffers.size(); -+ -+ XVBA_Create_DecodeBuff_Input bufferInput; -+ XVBA_Create_DecodeBuff_Output bufferOutput; -+ bufferInput.size = sizeof(bufferInput); -+ bufferInput.session = m_xvbaConfig.xvbaSession; -+ bufferInput.buffer_type = XVBA_DATA_CTRL_BUFFER; -+ bufferInput.num_of_buffers = 1; -+ bufferOutput.size = sizeof(bufferOutput); -+ -+ for (unsigned int i=0; iopaque; -+ CDecoder* xvba = (CDecoder*)ctx->GetHardware(); -+ unsigned int i; -+ -+ CSingleLock lock(xvba->m_decoderSection); -+ -+ xvba_render_state * render = NULL; -+ render = (xvba_render_state*)pic->data[0]; -+ if(!render) -+ { -+ CLog::Log(LOGERROR, "XVBA::FFReleaseBuffer - invalid context handle provided"); -+ return; -+ } -+ -+ for(i=0; i<4; i++) -+ pic->data[i]= NULL; -+ -+ // find render state in queue -+ if (!xvba->IsSurfaceValid(render)) -+ { -+ CLog::Log(LOGDEBUG, "XVBA::FFReleaseBuffer - ignoring invalid buffer"); -+ return; -+ } -+ -+ render->state &= ~FF_XVBA_STATE_USED_FOR_REFERENCE; -+} -+ -+void CDecoder::FFDrawSlice(struct AVCodecContext *avctx, -+ const AVFrame *src, int offset[4], -+ int y, int type, int height) -+{ -+ CDVDVideoCodecFFmpeg* ctx = (CDVDVideoCodecFFmpeg*)avctx->opaque; -+ CDecoder* xvba = (CDecoder*)ctx->GetHardware(); -+ -+ CSingleLock lock(xvba->m_decoderSection); -+ -+ if(xvba->m_displayState != XVBA_OPEN) -+ return; -+ -+ if(src->linesize[0] || src->linesize[1] || src->linesize[2] -+ || offset[0] || offset[1] || offset[2]) -+ { -+ CLog::Log(LOGERROR, "XVBA::FFDrawSlice - invalid linesizes or offsets provided"); -+ return; -+ } -+ -+ xvba_render_state * render; -+ -+ render = (xvba_render_state*)src->data[0]; -+ if(!render) -+ { -+ CLog::Log(LOGERROR, "XVBA::FFDrawSlice - invalid context handle provided"); -+ return; -+ } -+ -+ // ffmpeg vc-1 decoder does not flush, make sure the data buffer is still valid -+ if (!xvba->IsSurfaceValid(render)) -+ { -+ CLog::Log(LOGWARNING, "XVBA::FFDrawSlice - ignoring invalid buffer"); -+ return; -+ } -+ -+ // decoding -+ XVBA_Decode_Picture_Start_Input startInput; -+ startInput.size = sizeof(startInput); -+ startInput.session = xvba->m_xvbaConfig.xvbaSession; -+ startInput.target_surface = render->surface; -+ { CSingleLock lock(xvba->m_apiSec); -+ if (Success != g_XVBA_vtable.StartDecodePicture(&startInput)) -+ { -+ xvba->SetError(__FUNCTION__, "failed to start decoding", __LINE__); -+ return; -+ } -+ } -+ -+ XVBA_Decode_Picture_Input picInput; -+ picInput.size = sizeof(picInput); -+ picInput.session = xvba->m_xvbaConfig.xvbaSession; -+ XVBABufferDescriptor *list[2]; -+ picInput.buffer_list = list; -+ list[0] = xvba->m_xvbaBufferPool.picture_descriptor_buffer; -+ picInput.num_of_buffers_in_list = 1; -+ if (avctx->codec_id == CODEC_ID_H264) -+ { -+ list[1] = xvba->m_xvbaBufferPool.iq_matrix_buffer; -+ picInput.num_of_buffers_in_list = 2; -+ } -+ -+ { CSingleLock lock(xvba->m_apiSec); -+ if (Success != g_XVBA_vtable.DecodePicture(&picInput)) -+ { -+ xvba->SetError(__FUNCTION__, "failed to decode picture 1", __LINE__); -+ return; -+ } -+ } -+ -+ if (!xvba->EnsureDataControlBuffers(render->num_slices)) -+ return; -+ -+ XVBADataCtrl *dataControl; -+ int location = 0; -+ xvba->m_xvbaBufferPool.data_buffer->data_size_in_buffer = 0; -+ for (unsigned int j = 0; j < render->num_slices; ++j) -+ { -+ int startCodeSize = 0; -+ uint8_t startCode[] = {0x00,0x00,0x01}; -+ if (avctx->codec_id == CODEC_ID_H264) -+ { -+ startCodeSize = 3; -+ memcpy((uint8_t*)xvba->m_xvbaBufferPool.data_buffer->bufferXVBA+location, -+ startCode, 3); -+ } -+ else if (avctx->codec_id == CODEC_ID_VC1 && -+ (memcmp(render->buffers[j].buffer, startCode, 3) != 0)) -+ { -+ startCodeSize = 4; -+ uint8_t sdf = 0x0d; -+ memcpy((uint8_t*)xvba->m_xvbaBufferPool.data_buffer->bufferXVBA+location, -+ startCode, 3); -+ memcpy((uint8_t*)xvba->m_xvbaBufferPool.data_buffer->bufferXVBA+location+3, -+ &sdf, 1); -+ } -+ // check for potential buffer overwrite -+ unsigned int bytesToCopy = render->buffers[j].size; -+ unsigned int freeBufferSize = xvba->m_xvbaBufferPool.data_buffer->buffer_size - -+ xvba->m_xvbaBufferPool.data_buffer->data_size_in_buffer; -+ if (bytesToCopy >= freeBufferSize) -+ { -+ xvba->SetError(__FUNCTION__, "bitstream buffer too large, maybe corrupted packet", __LINE__); -+ return; -+ } -+ memcpy((uint8_t*)xvba->m_xvbaBufferPool.data_buffer->bufferXVBA+location+startCodeSize, -+ render->buffers[j].buffer, -+ render->buffers[j].size); -+ dataControl = (XVBADataCtrl*)xvba->m_xvbaBufferPool.data_control_buffers[j]->bufferXVBA; -+ dataControl->SliceDataLocation = location; -+ dataControl->SliceBytesInBuffer = render->buffers[j].size+startCodeSize; -+ dataControl->SliceBitsInBuffer = dataControl->SliceBytesInBuffer * 8; -+ xvba->m_xvbaBufferPool.data_buffer->data_size_in_buffer += dataControl->SliceBytesInBuffer; -+ location += dataControl->SliceBytesInBuffer; -+ } -+ -+ int bufSize = xvba->m_xvbaBufferPool.data_buffer->data_size_in_buffer; -+ int padding = bufSize % 128; -+ if (padding) -+ { -+ padding = 128 - padding; -+ xvba->m_xvbaBufferPool.data_buffer->data_size_in_buffer += padding; -+ memset((uint8_t*)xvba->m_xvbaBufferPool.data_buffer->bufferXVBA+bufSize,0,padding); -+ } -+ -+ picInput.num_of_buffers_in_list = 2; -+ for (unsigned int i = 0; i < render->num_slices; ++i) -+ { -+ list[0] = xvba->m_xvbaBufferPool.data_buffer; -+ list[0]->data_offset = 0; -+ list[1] = xvba->m_xvbaBufferPool.data_control_buffers[i]; -+ list[1]->data_size_in_buffer = sizeof(*dataControl); -+ { CSingleLock lock(xvba->m_apiSec); -+ if (Success != g_XVBA_vtable.DecodePicture(&picInput)) -+ { -+ xvba->SetError(__FUNCTION__, "failed to decode picture 2", __LINE__); -+ return; -+ } -+ } -+ } -+ XVBA_Decode_Picture_End_Input endInput; -+ endInput.size = sizeof(endInput); -+ endInput.session = xvba->m_xvbaConfig.xvbaSession; -+ { CSingleLock lock(xvba->m_apiSec); -+ if (Success != g_XVBA_vtable.EndDecodePicture(&endInput)) -+ { -+ xvba->SetError(__FUNCTION__, "failed to decode picture 3", __LINE__); -+ return; -+ } -+ } -+ -+ // decode sync and error -+ XVBA_Surface_Sync_Input syncInput; -+ XVBA_Surface_Sync_Output syncOutput; -+ syncInput.size = sizeof(syncInput); -+ syncInput.session = xvba->m_xvbaConfig.xvbaSession; -+ syncInput.surface = render->surface; -+ syncInput.query_status = XVBA_GET_SURFACE_STATUS; -+ syncOutput.size = sizeof(syncOutput); -+ int64_t start = CurrentHostCounter(); -+ while (1) -+ { -+ { CSingleLock lock(xvba->m_apiSec); -+ if (Success != g_XVBA_vtable.SyncSurface(&syncInput, &syncOutput)) -+ { -+ xvba->SetError(__FUNCTION__, "failed sync surface 1", __LINE__); -+ return; -+ } -+ } -+ if (!(syncOutput.status_flags & XVBA_STILL_PENDING)) -+ break; -+ if (CurrentHostCounter() - start > CurrentHostFrequency()) -+ { -+ xvba->SetError(__FUNCTION__, "timed out waiting for surface", __LINE__); -+ break; -+ } -+ usleep(100); -+ } -+ render->state |= FF_XVBA_STATE_DECODED; -+} -+ -+int CDecoder::FFGetBuffer(AVCodecContext *avctx, AVFrame *pic) -+{ -+ CDVDVideoCodecFFmpeg* ctx = (CDVDVideoCodecFFmpeg*)avctx->opaque; -+ CDecoder* xvba = (CDecoder*)ctx->GetHardware(); -+ -+ pic->data[0] = -+ pic->data[1] = -+ pic->data[2] = -+ pic->data[3] = 0; -+ -+ pic->linesize[0] = -+ pic->linesize[1] = -+ pic->linesize[2] = -+ pic->linesize[3] = 0; -+ -+ CSingleLock lock(xvba->m_decoderSection); -+ -+ if(xvba->m_displayState != XVBA_OPEN) -+ return -1; -+ -+ if (xvba->m_xvbaConfig.xvbaSession == 0) -+ { -+ if (!xvba->CreateSession(avctx)) -+ return -1; -+ } -+ -+ xvba_render_state * render = NULL; -+ // find unused surface -+ { CSingleLock lock(xvba->m_videoSurfaceSec); -+ for(unsigned int i = 0; i < xvba->m_videoSurfaces.size(); ++i) -+ { -+ if(!(xvba->m_videoSurfaces[i]->state & (FF_XVBA_STATE_USED_FOR_REFERENCE | FF_XVBA_STATE_USED_FOR_RENDER))) -+ { -+ render = xvba->m_videoSurfaces[i]; -+ render->state = 0; -+ break; -+ } -+ } -+ } -+ -+ // create a new render state -+ if (render == NULL) -+ { -+ render = (xvba_render_state*)calloc(sizeof(xvba_render_state), 1); -+ if (render == NULL) -+ { -+ CLog::Log(LOGERROR, "XVBA::FFGetBuffer - calloc failed"); -+ return -1; -+ } -+ render->surface = 0; -+ render->buffers_alllocated = 0; -+ CSingleLock lock(xvba->m_videoSurfaceSec); -+ xvba->m_videoSurfaces.push_back(render); -+ } -+ -+ // create a new surface -+ if (render->surface == 0) -+ { -+ XVBA_Create_Surface_Input surfaceInput; -+ XVBA_Create_Surface_Output surfaceOutput; -+ surfaceInput.size = sizeof(surfaceInput); -+ surfaceInput.surface_type = xvba->m_xvbaConfig.decoderCap.surface_type; -+ surfaceInput.width = xvba->m_xvbaConfig.surfaceWidth; -+ surfaceInput.height = xvba->m_xvbaConfig.surfaceHeight; -+ surfaceInput.session = xvba->m_xvbaConfig.xvbaSession; -+ surfaceOutput.size = sizeof(surfaceOutput); -+ { CSingleLock lock(xvba->m_apiSec); -+ if (Success != g_XVBA_vtable.CreateSurface(&surfaceInput, &surfaceOutput)) -+ { -+ xvba->SetError(__FUNCTION__, "failed to create video surface", __LINE__); -+ return -1; -+ } -+ } -+ render->surface = surfaceOutput.surface; -+ render->picture_descriptor = (XVBAPictureDescriptor *)xvba->m_xvbaBufferPool.picture_descriptor_buffer->bufferXVBA; -+ render->iq_matrix = (XVBAQuantMatrixAvc *)xvba->m_xvbaBufferPool.iq_matrix_buffer->bufferXVBA; -+ CLog::Log(LOGDEBUG, "XVBA::FFGetBuffer - created video surface"); -+ } -+ -+ if (render == NULL) -+ return -1; -+ -+ pic->data[0] = (uint8_t*)render; -+ -+ pic->type= FF_BUFFER_TYPE_USER; -+ -+ render->state |= FF_XVBA_STATE_USED_FOR_REFERENCE; -+ render->state &= ~FF_XVBA_STATE_DECODED; -+ pic->reordered_opaque= avctx->reordered_opaque; -+ -+ return 0; -+} -+ -+int CDecoder::Decode(AVCodecContext* avctx, AVFrame* frame) -+{ -+ int result = Check(avctx); -+ if (result) -+ return result; -+ -+ CSingleLock lock(m_decoderSection); -+ -+ if(frame) -+ { // we have a new frame from decoder -+ -+ xvba_render_state * render = (xvba_render_state*)frame->data[0]; -+ if(!render) -+ { -+ CLog::Log(LOGERROR, "XVBA::Decode - no render buffer"); -+ return VC_ERROR; -+ } -+ -+ // ffmpeg vc-1 decoder does not flush, make sure the data buffer is still valid -+ if (!IsSurfaceValid(render)) -+ { -+ CLog::Log(LOGWARNING, "XVBA::Decode - ignoring invalid buffer"); -+ return VC_BUFFER; -+ } -+ if (!(render->state & FF_XVBA_STATE_DECODED)) -+ { -+ CLog::Log(LOGDEBUG, "XVBA::Decode - ffmpeg failed"); -+ return VC_BUFFER; -+ } -+ -+ CSingleLock lock(m_videoSurfaceSec); -+ render->state |= FF_XVBA_STATE_USED_FOR_RENDER; -+ lock.Leave(); -+ -+ // send frame to output for processing -+ CXvbaDecodedPicture pic; -+ memset(&pic.DVDPic, 0, sizeof(pic.DVDPic)); -+ ((CDVDVideoCodecFFmpeg*)avctx->opaque)->GetPictureCommon(&pic.DVDPic); -+ pic.render = render; -+ m_bufferStats.IncDecoded(); -+ m_xvbaOutput.m_dataPort.SendOutMessage(COutputDataProtocol::NEWFRAME, &pic, sizeof(pic)); -+ -+ m_codecControl = pic.DVDPic.iFlags & (DVP_FLAG_DRAIN | DVP_FLAG_NO_POSTPROC); -+ } -+ -+ int retval = 0; -+ uint16_t decoded, processed, render; -+ Message *msg; -+ while (m_xvbaOutput.m_controlPort.ReceiveInMessage(&msg)) -+ { -+ if (msg->signal == COutputControlProtocol::ERROR) -+ { -+ m_displayState = XVBA_ERROR; -+ retval |= VC_ERROR; -+ } -+ msg->Release(); -+ } -+ -+ m_bufferStats.Get(decoded, processed, render); -+ -+ uint64_t startTime = CurrentHostCounter(); -+ while (!retval) -+ { -+ if (m_xvbaOutput.m_dataPort.ReceiveInMessage(&msg)) -+ { -+ if (msg->signal == COutputDataProtocol::PICTURE) -+ { -+ if (m_presentPicture) -+ { -+ m_presentPicture->ReturnUnused(); -+ m_presentPicture = 0; -+ } -+ -+ m_presentPicture = *(CXvbaRenderPicture**)msg->data; -+ m_presentPicture->xvba = this; -+ m_bufferStats.DecRender(); -+ m_bufferStats.Get(decoded, processed, render); -+ retval |= VC_PICTURE; -+ } -+ msg->Release(); -+ } -+ else if (m_xvbaOutput.m_controlPort.ReceiveInMessage(&msg)) -+ { -+ if (msg->signal == COutputControlProtocol::STATS) -+ { -+ m_bufferStats.Get(decoded, processed, render); -+ } -+ else -+ { -+ m_displayState = XVBA_ERROR; -+ retval |= VC_ERROR; -+ } -+ msg->Release(); -+ } -+ -+ if ((m_codecControl & DVP_FLAG_DRAIN)) -+ { -+ if (decoded + processed + render < 2) -+ { -+ retval |= VC_BUFFER; -+ } -+ } -+ else -+ { -+ if (decoded + processed + render < 4) -+ { -+ retval |= VC_BUFFER; -+ } -+ } -+ -+ if (!retval && !m_inMsgEvent.WaitMSec(2000)) -+ break; -+ } -+ uint64_t diff = CurrentHostCounter() - startTime; -+ if (retval & VC_PICTURE) -+ { -+ m_bufferStats.SetParams(diff, m_speed); -+ if (diff*1000/CurrentHostFrequency() > 50) -+ CLog::Log(LOGDEBUG,"XVBA::Decode long wait: %d", (int)((diff*1000)/CurrentHostFrequency())); -+ } -+ -+ if (!retval) -+ { -+ CLog::Log(LOGERROR, "XVBA::%s - timed out waiting for output message", __FUNCTION__); -+ m_displayState = XVBA_ERROR; -+ retval |= VC_ERROR; -+ } -+ -+ return retval; -+ -+} -+ -+bool CDecoder::GetPicture(AVCodecContext* avctx, AVFrame* frame, DVDVideoPicture* picture) -+{ -+ CSingleLock lock(m_decoderSection); -+ -+ if (m_displayState != XVBA_OPEN) -+ return false; -+ -+ *picture = m_presentPicture->DVDPic; -+ picture->xvba = m_presentPicture; -+ -+ return true; -+} -+ -+void CDecoder::ReturnRenderPicture(CXvbaRenderPicture *renderPic) -+{ -+ m_xvbaOutput.m_dataPort.SendOutMessage(COutputDataProtocol::RETURNPIC, &renderPic, sizeof(renderPic)); -+} -+ -+ -+//void CDecoder::CopyYV12(int index, uint8_t *dest) -+//{ -+// CSharedLock lock(m_decoderSection); -+// -+// { CSharedLock dLock(m_displaySection); -+// if(m_displayState != XVBA_OPEN) -+// return; -+// } -+// -+// if (!m_flipBuffer[index].outPic) -+// { -+// CLog::Log(LOGWARNING, "XVBA::Present: present picture is NULL"); -+// return; -+// } -+// -+// XVBA_GetSurface_Target target; -+// target.size = sizeof(target); -+// target.surfaceType = XVBA_YV12; -+// target.flag = XVBA_FRAME; -+// -+// XVBA_Get_Surface_Input input; -+// input.size = sizeof(input); -+// input.session = m_xvbaSession; -+// input.src_surface = m_flipBuffer[index].outPic->render->surface; -+// input.target_buffer = dest; -+// input.target_pitch = m_surfaceWidth; -+// input.target_width = m_surfaceWidth; -+// input.target_height = m_surfaceHeight; -+// input.target_parameter = target; -+// { CSingleLock lock(m_apiSec); -+// if (Success != g_XVBA_vtable.GetSurface(&input)) -+// { -+// CLog::Log(LOGERROR,"(XVBA::CopyYV12) failed to get surface"); -+// } -+// } -+//} -+ -+void CDecoder::Reset() -+{ -+ CSingleLock lock(m_decoderSection); -+ -+ if (!m_xvbaConfig.xvbaSession) -+ return; -+ -+ Message *reply; -+ if (m_xvbaOutput.m_controlPort.SendOutMessageSync(COutputControlProtocol::FLUSH, -+ &reply, -+ 2000)) -+ { -+ bool success = reply->signal == COutputControlProtocol::ACC ? true : false; -+ reply->Release(); -+ if (!success) -+ { -+ CLog::Log(LOGERROR, "XVBA::%s - flush returned error", __FUNCTION__); -+ m_displayState = XVBA_ERROR; -+ } -+ else -+ m_bufferStats.Reset(); -+ } -+ else -+ { -+ CLog::Log(LOGERROR, "XVBA::%s - flush timed out", __FUNCTION__); -+ m_displayState = XVBA_ERROR; -+ } -+} -+ -+bool CDecoder::CanSkipDeint() -+{ -+ return m_bufferStats.CanSkipDeint(); -+} -+ -+void CDecoder::SetSpeed(int speed) -+{ -+ m_speed = speed; -+} -+ -+//----------------------------------------------------------------------------- -+// RenderPicture -+//----------------------------------------------------------------------------- -+ -+CXvbaRenderPicture* CXvbaRenderPicture::Acquire() -+{ -+ CSingleLock lock(*renderPicSection); -+ -+ if (refCount == 0) -+ xvba->Acquire(); -+ -+ refCount++; -+ return this; -+} -+ -+long CXvbaRenderPicture::Release() -+{ -+ CSingleLock lock(*renderPicSection); -+ -+ refCount--; -+ if (refCount > 0) -+ return refCount; -+ -+ lock.Leave(); -+ xvba->ReturnRenderPicture(this); -+ xvba->ReleasePicReference(); -+ -+ return refCount; -+} -+ -+void CXvbaRenderPicture::ReturnUnused() -+{ -+ { CSingleLock lock(*renderPicSection); -+ if (refCount > 0) -+ return; -+ } -+ if (xvba) -+ xvba->ReturnRenderPicture(this); -+} -+ -+//----------------------------------------------------------------------------- -+// Output -+//----------------------------------------------------------------------------- -+COutput::COutput(CEvent *inMsgEvent) : -+ CThread("XVBA Output Thread"), -+ m_controlPort("OutputControlPort", inMsgEvent, &m_outMsgEvent), -+ m_dataPort("OutputDataPort", inMsgEvent, &m_outMsgEvent) -+{ -+ m_inMsgEvent = inMsgEvent; -+ -+ CXvbaRenderPicture pic; -+ pic.renderPicSection = &m_bufferPool.renderPicSec; -+ pic.refCount = 0; -+ for (unsigned int i = 0; i < NUM_RENDER_PICS; i++) -+ { -+ m_bufferPool.allRenderPics.push_back(pic); -+ } -+ for (unsigned int i = 0; i < m_bufferPool.allRenderPics.size(); ++i) -+ { -+ m_bufferPool.freeRenderPics.push_back(&m_bufferPool.allRenderPics[i]); -+ } -+} -+ -+void COutput::Start() -+{ -+ Create(); -+} -+ -+COutput::~COutput() -+{ -+ Dispose(); -+ -+ m_bufferPool.freeRenderPics.clear(); -+ m_bufferPool.usedRenderPics.clear(); -+ m_bufferPool.allRenderPics.clear(); -+} -+ -+void COutput::Dispose() -+{ -+ CSingleLock lock(g_graphicsContext); -+ m_bStop = true; -+ m_outMsgEvent.Set(); -+ StopThread(); -+ m_controlPort.Purge(); -+ m_dataPort.Purge(); -+} -+ -+void COutput::OnStartup() -+{ -+ CLog::Log(LOGNOTICE, "COutput::OnStartup: Output Thread created"); -+} -+ -+void COutput::OnExit() -+{ -+ CLog::Log(LOGNOTICE, "COutput::OnExit: Output Thread terminated"); -+} -+ -+enum OUTPUT_STATES -+{ -+ O_TOP = 0, // 0 -+ O_TOP_ERROR, // 1 -+ O_TOP_UNCONFIGURED, // 2 -+ O_TOP_CONFIGURED, // 3 -+ O_TOP_CONFIGURED_WAIT_RES1, // 4 -+ O_TOP_CONFIGURED_WAIT_DEC, // 5 -+ O_TOP_CONFIGURED_STEP1, // 6 -+ O_TOP_CONFIGURED_WAIT_RES2, // 7 -+ O_TOP_CONFIGURED_STEP2, // 8 -+}; -+ -+int OUTPUT_parentStates[] = { -+ -1, -+ 0, //TOP_ERROR -+ 0, //TOP_UNCONFIGURED -+ 0, //TOP_CONFIGURED -+ 3, //TOP_CONFIGURED_WAIT_RES1 -+ 3, //TOP_CONFIGURED_WAIT_DEC -+ 3, //TOP_CONFIGURED_STEP1 -+ 3, //TOP_CONFIGURED_WAIT_RES2 -+ 3, //TOP_CONFIGURED_STEP2 -+}; -+ -+void COutput::StateMachine(int signal, Protocol *port, Message *msg) -+{ -+ for (int state = m_state; ; state = OUTPUT_parentStates[state]) -+ { -+ switch (state) -+ { -+ case O_TOP: // TOP -+ if (port == &m_controlPort) -+ { -+ switch (signal) -+ { -+ case COutputControlProtocol::FLUSH: -+ msg->Reply(COutputControlProtocol::ACC); -+ return; -+ case COutputControlProtocol::PRECLEANUP: -+ msg->Reply(COutputControlProtocol::ACC); -+ return; -+ default: -+ break; -+ } -+ } -+ else if (port == &m_dataPort) -+ { -+ switch (signal) -+ { -+ case COutputDataProtocol::RETURNPIC: -+ CXvbaRenderPicture *pic; -+ pic = *((CXvbaRenderPicture**)msg->data); -+ ProcessReturnPicture(pic); -+ return; -+ default: -+ break; -+ } -+ } -+ { -+ std::string portName = port == NULL ? "timer" : port->portName; -+ CLog::Log(LOGWARNING, "COutput::%s - signal: %d form port: %s not handled for state: %d", __FUNCTION__, signal, portName.c_str(), m_state); -+ } -+ return; -+ -+ case O_TOP_ERROR: -+ m_extTimeout = 1000; -+ break; -+ -+ case O_TOP_UNCONFIGURED: -+ if (port == &m_controlPort) -+ { -+ switch (signal) -+ { -+ case COutputControlProtocol::INIT: -+ CXvbaConfig *data; -+ data = (CXvbaConfig*)msg->data; -+ if (data) -+ { -+ m_config = *data; -+ } -+ Init(); -+ EnsureBufferPool(); -+ if (!m_xvbaError) -+ { -+ m_state = O_TOP_CONFIGURED_WAIT_RES1; -+ msg->Reply(COutputControlProtocol::ACC); -+ } -+ else -+ { -+ m_state = O_TOP_ERROR; -+ msg->Reply(COutputControlProtocol::ERROR); -+ } -+ return; -+ default: -+ break; -+ } -+ } -+ break; -+ -+ case O_TOP_CONFIGURED: -+ if (port == &m_controlPort) -+ { -+ switch (signal) -+ { -+ case COutputControlProtocol::FLUSH: -+ m_state = O_TOP_CONFIGURED_WAIT_RES1; -+ Flush(); -+ msg->Reply(COutputControlProtocol::ACC); -+ return; -+ case COutputControlProtocol::PRECLEANUP: -+ m_state = O_TOP_UNCONFIGURED; -+ m_extTimeout = 10000; -+ Flush(); -+ ReleaseBufferPool(true); -+ msg->Reply(COutputControlProtocol::ACC); -+ return; -+ default: -+ break; -+ } -+ } -+ else if (port == &m_dataPort) -+ { -+ switch (signal) -+ { -+ case COutputDataProtocol::NEWFRAME: -+ CXvbaDecodedPicture *frame; -+ frame = (CXvbaDecodedPicture*)msg->data; -+ if (frame) -+ { -+ m_decodedPics.push(*frame); -+ m_extTimeout = 0; -+ } -+ return; -+ case COutputDataProtocol::RETURNPIC: -+ CXvbaRenderPicture *pic; -+ pic = *((CXvbaRenderPicture**)msg->data); -+ ProcessReturnPicture(pic); -+ m_controlPort.SendInMessage(COutputControlProtocol::STATS); -+ m_extTimeout = 0; -+ return; -+ default: -+ break; -+ } -+ } -+ break; -+ -+ case O_TOP_CONFIGURED_WAIT_RES1: -+ if (port == NULL) // timeout -+ { -+ switch (signal) -+ { -+ case COutputControlProtocol::TIMEOUT: -+ if (!m_decodedPics.empty() && FindFreeSurface() >= 0 && !m_bufferPool.freeRenderPics.empty()) -+ { -+ m_state = O_TOP_CONFIGURED_WAIT_DEC; -+ m_bStateMachineSelfTrigger = true; -+ } -+ else -+ { -+ if (m_extTimeout != 0) -+ { -+ uint16_t decoded, processed, render; -+ m_config.stats->Get(decoded, processed, render); -+// CLog::Log(LOGDEBUG, "CVDPAU::COutput - timeout idle: decoded: %d, proc: %d, render: %d", decoded, processed, render); -+ } -+ m_extTimeout = 100; -+ } -+ return; -+ default: -+ break; -+ } -+ } -+ break; -+ -+ case O_TOP_CONFIGURED_WAIT_DEC: -+ if (port == NULL) // timeout -+ { -+ switch (signal) -+ { -+ case COutputControlProtocol::TIMEOUT: -+ if (IsDecodingFinished()) -+ { -+ m_state = O_TOP_CONFIGURED_STEP1; -+ m_bStateMachineSelfTrigger = true; -+ } -+ else -+ { -+ m_extTimeout = 1; -+ } -+ return; -+ default: -+ break; -+ } -+ } -+ break; -+ -+ case O_TOP_CONFIGURED_STEP1: -+ if (port == NULL) // timeout -+ { -+ switch (signal) -+ { -+ case COutputControlProtocol::TIMEOUT: -+ m_processPicture = m_decodedPics.front(); -+ m_decodedPics.pop(); -+ InitCycle(); -+ CXvbaRenderPicture *pic; -+ pic = ProcessPicture(); -+ if (pic) -+ { -+ m_config.stats->IncRender(); -+ m_dataPort.SendInMessage(COutputDataProtocol::PICTURE, &pic, sizeof(pic)); -+ } -+ if (m_xvbaError) -+ { -+ m_state = O_TOP_ERROR; -+ return; -+ } -+ if (m_deinterlacing && !m_deintSkip) -+ { -+ m_state = O_TOP_CONFIGURED_WAIT_RES2; -+ m_extTimeout = 0; -+ } -+ else -+ { -+ FiniCycle(); -+ m_state = O_TOP_CONFIGURED_WAIT_RES1; -+ m_extTimeout = 0; -+ } -+ return; -+ default: -+ break; -+ } -+ } -+ break; -+ -+ case O_TOP_CONFIGURED_WAIT_RES2: -+ if (port == NULL) // timeout -+ { -+ switch (signal) -+ { -+ case COutputControlProtocol::TIMEOUT: -+ if (FindFreeSurface() >= 0 && !m_bufferPool.freeRenderPics.empty()) -+ { -+ m_state = O_TOP_CONFIGURED_STEP2; -+ m_bStateMachineSelfTrigger = true; -+ } -+ else -+ { -+ if (m_extTimeout != 0) -+ { -+ uint16_t decoded, processed, render; -+ m_config.stats->Get(decoded, processed, render); -+ CLog::Log(LOGDEBUG, "CVDPAU::COutput - timeout idle: decoded: %d, proc: %d, render: %d", decoded, processed, render); -+ } -+ m_extTimeout = 100; -+ } -+ return; -+ default: -+ break; -+ } -+ } -+ break; -+ -+ case O_TOP_CONFIGURED_STEP2: -+ if (port == NULL) // timeout -+ { -+ switch (signal) -+ { -+ case COutputControlProtocol::TIMEOUT: -+ CXvbaRenderPicture *pic; -+ m_deintStep = 1; -+ pic = ProcessPicture(); -+ if (pic) -+ { -+ m_config.stats->IncRender(); -+ m_dataPort.SendInMessage(COutputDataProtocol::PICTURE, &pic, sizeof(pic)); -+ } -+ if (m_xvbaError) -+ { -+ m_state = O_TOP_ERROR; -+ return; -+ } -+ FiniCycle(); -+ m_state = O_TOP_CONFIGURED_WAIT_RES1; -+ m_extTimeout = 0; -+ return; -+ default: -+ break; -+ } -+ } -+ break; -+ -+ default: // we are in no state, should not happen -+ CLog::Log(LOGERROR, "COutput::%s - no valid state: %d", __FUNCTION__, m_state); -+ return; -+ } -+ } // for -+} -+ -+void COutput::Process() -+{ -+ Message *msg; -+ Protocol *port; -+ bool gotMsg; -+ -+ m_state = O_TOP_UNCONFIGURED; -+ m_extTimeout = 1000; -+ m_bStateMachineSelfTrigger = false; -+ -+ while (!m_bStop) -+ { -+ gotMsg = false; -+ -+ if (m_bStateMachineSelfTrigger) -+ { -+ m_bStateMachineSelfTrigger = false; -+ // self trigger state machine -+ StateMachine(msg->signal, port, msg); -+ if (!m_bStateMachineSelfTrigger) -+ { -+ msg->Release(); -+ msg = NULL; -+ } -+ continue; -+ } -+ // check control port -+ else if (m_controlPort.ReceiveOutMessage(&msg)) -+ { -+ gotMsg = true; -+ port = &m_controlPort; -+ } -+ // check data port -+ else if (m_dataPort.ReceiveOutMessage(&msg)) -+ { -+ gotMsg = true; -+ port = &m_dataPort; -+ } -+ if (gotMsg) -+ { -+ StateMachine(msg->signal, port, msg); -+ if (!m_bStateMachineSelfTrigger) -+ { -+ msg->Release(); -+ msg = NULL; -+ } -+ continue; -+ } -+ -+ // wait for message -+ else if (m_outMsgEvent.WaitMSec(m_extTimeout)) -+ { -+ continue; -+ } -+ // time out -+ else -+ { -+ msg = m_controlPort.GetMessage(); -+ msg->signal = COutputControlProtocol::TIMEOUT; -+ port = 0; -+ // signal timeout to state machine -+ StateMachine(msg->signal, port, msg); -+ if (!m_bStateMachineSelfTrigger) -+ { -+ msg->Release(); -+ msg = NULL; -+ } -+ } -+ } -+ Flush(); -+ Uninit(); -+} -+ -+bool COutput::Init() -+{ -+ if (!CreateGlxContext()) -+ return false; -+ -+ m_xvbaError = false; -+ m_processPicture.render = 0; -+ m_fence = None; -+ -+ return true; -+} -+ -+bool COutput::Uninit() -+{ -+ ReleaseBufferPool(); -+ DestroyGlxContext(); -+ return true; -+} -+ -+void COutput::Flush() -+{ -+ while (!m_decodedPics.empty()) -+ { -+ CXvbaDecodedPicture pic = m_decodedPics.front(); -+ m_decodedPics.pop(); -+ CSingleLock lock(*m_config.videoSurfaceSec); -+ if (pic.render) -+ pic.render->state &= ~(FF_XVBA_STATE_USED_FOR_RENDER | FF_XVBA_STATE_DECODED); -+ } -+ -+ if (m_processPicture.render) -+ { -+ CSingleLock lock(*m_config.videoSurfaceSec); -+ m_processPicture.render->state &= ~(FF_XVBA_STATE_USED_FOR_RENDER | FF_XVBA_STATE_DECODED); -+ m_processPicture.render = 0; -+ } -+ -+ Message *msg; -+ while (m_dataPort.ReceiveOutMessage(&msg)) -+ { -+ if (msg->signal == COutputDataProtocol::NEWFRAME) -+ { -+ CXvbaDecodedPicture pic = *(CXvbaDecodedPicture*)msg->data; -+ CSingleLock lock(*m_config.videoSurfaceSec); -+ if (pic.render) -+ pic.render->state &= ~(FF_XVBA_STATE_USED_FOR_RENDER | FF_XVBA_STATE_DECODED); -+ } -+ else if (msg->signal == COutputDataProtocol::RETURNPIC) -+ { -+ CXvbaRenderPicture *pic; -+ pic = *((CXvbaRenderPicture**)msg->data); -+ ProcessReturnPicture(pic); -+ } -+ msg->Release(); -+ } -+ -+ while (m_dataPort.ReceiveInMessage(&msg)) -+ { -+ if (msg->signal == COutputDataProtocol::PICTURE) -+ { -+ CXvbaRenderPicture *pic; -+ pic = *((CXvbaRenderPicture**)msg->data); -+ ProcessReturnPicture(pic); -+ } -+ } -+} -+ -+bool COutput::IsDecodingFinished() -+{ -+ // check for decoding to be finished -+ CXvbaDecodedPicture decodedPic = m_decodedPics.front(); -+ -+ XVBA_Surface_Sync_Input syncInput; -+ XVBA_Surface_Sync_Output syncOutput; -+ syncInput.size = sizeof(syncInput); -+ syncInput.session = m_config.xvbaSession; -+ syncInput.surface = decodedPic.render->surface; -+ syncInput.query_status = XVBA_GET_SURFACE_STATUS; -+ syncOutput.size = sizeof(syncOutput); -+ { CSingleLock lock(*(m_config.apiSec)); -+ if (Success != g_XVBA_vtable.SyncSurface(&syncInput, &syncOutput)) -+ { -+ CLog::Log(LOGERROR,"XVBA - failed sync surface"); -+ m_xvbaError = true; -+ return false; -+ } -+ } -+ if (!(syncOutput.status_flags & XVBA_STILL_PENDING)) -+ return true; -+ -+ return false; -+} -+ -+CXvbaRenderPicture* COutput::ProcessPicture() -+{ -+ CXvbaRenderPicture *retPic = 0; -+ -+ if (m_deintStep == 1) -+ { -+ if(m_field == XVBA_TOP_FIELD) -+ m_field = XVBA_BOTTOM_FIELD; -+ else -+ m_field = XVBA_TOP_FIELD; -+ } -+ -+ // find unused shared surface -+ unsigned int idx = FindFreeSurface(); -+ XvbaBufferPool::GLVideoSurface *glSurface = &m_bufferPool.glSurfaces[idx]; -+ glSurface->used = true; -+ glSurface->field = m_field; -+ glSurface->render = m_processPicture.render; -+ glSurface->transferred = false; -+ -+ int cmd = 0; -+ m_config.stats->GetCmd(cmd); -+ -+// if (m_fence) -+// glDeleteSync(m_fence); -+// m_fence = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); -+ -+ // transfer surface -+ XVBA_Transfer_Surface_Input transInput; -+ transInput.size = sizeof(transInput); -+ transInput.session = m_config.xvbaSession; -+ transInput.src_surface = m_processPicture.render->surface; -+ transInput.target_surface = glSurface->glSurface; -+ transInput.flag = m_field; -+ { CSingleLock lock(*(m_config.apiSec)); -+ if (Success != g_XVBA_vtable.TransferSurface(&transInput)) -+ { -+ CLog::Log(LOGERROR,"(XVBA) failed to transfer surface"); -+ m_xvbaError = true; -+ return retPic; -+ } -+ } -+ -+ // prepare render pic -+ retPic = m_bufferPool.freeRenderPics.front(); -+ m_bufferPool.freeRenderPics.pop_front(); -+ m_bufferPool.usedRenderPics.push_back(retPic); -+ retPic->sourceIdx = glSurface->id; -+ retPic->DVDPic = m_processPicture.DVDPic; -+ retPic->valid = true; -+ retPic->texture = glSurface->texture; -+ retPic->crop = CRect(0,0,0,0); -+ retPic->texWidth = m_config.surfaceWidth; -+ retPic->texHeight = m_config.surfaceHeight; -+ retPic->xvbaOutput = this; -+ -+ // set repeat pic for de-interlacing -+ if (m_deinterlacing) -+ { -+ if (m_deintStep == 1) -+ { -+ retPic->DVDPic.pts = DVD_NOPTS_VALUE; -+ retPic->DVDPic.dts = DVD_NOPTS_VALUE; -+ } -+ retPic->DVDPic.iRepeatPicture = 0.0; -+ } -+ -+ return retPic; -+} -+ -+void COutput::ProcessReturnPicture(CXvbaRenderPicture *pic) -+{ -+ std::deque::iterator it; -+ it = std::find(m_bufferPool.usedRenderPics.begin(), m_bufferPool.usedRenderPics.end(), pic); -+ if (it == m_bufferPool.usedRenderPics.end()) -+ { -+ CLog::Log(LOGWARNING, "COutput::ProcessReturnPicture - pic not found"); -+ return; -+ } -+ m_bufferPool.usedRenderPics.erase(it); -+ m_bufferPool.freeRenderPics.push_back(pic); -+ if (!pic->valid) -+ { -+ CLog::Log(LOGDEBUG, "COutput::%s - return of invalid render pic", __FUNCTION__); -+ return; -+ } -+ -+ xvba_render_state *render = m_bufferPool.glSurfaces[pic->sourceIdx].render; -+ if (render) -+ { -+ // check if video surface is referenced by other glSurfaces -+ bool referenced(false); -+ for (unsigned int i=0; isourceIdx) -+ continue; -+ if (m_bufferPool.glSurfaces[i].render == render) -+ { -+ referenced = true; -+ break; -+ } -+ } -+ if (m_processPicture.render == render) -+ referenced = true; -+ -+ // release video surface -+ if (!referenced) -+ { -+ CSingleLock lock(*m_config.videoSurfaceSec); -+ render->state &= ~(FF_XVBA_STATE_USED_FOR_RENDER | FF_XVBA_STATE_DECODED); -+ } -+ -+ // unreference video surface -+ m_bufferPool.glSurfaces[pic->sourceIdx].render = 0; -+ -+ m_bufferPool.glSurfaces[pic->sourceIdx].used = false; -+ return; -+ } -+} -+ -+int COutput::FindFreeSurface() -+{ -+ // find free shared surface -+ unsigned int i; -+ for (i = 0; i < m_bufferPool.glSurfaces.size(); ++i) -+ { -+ if (!m_bufferPool.glSurfaces[i].used) -+ break; -+ } -+ if (i == m_bufferPool.glSurfaces.size()) -+ return -1; -+ else -+ return i; -+} -+ -+void COutput::InitCycle() -+{ -+ uint64_t latency; -+ int speed; -+ m_config.stats->GetParams(latency, speed); -+ latency = (latency*1000)/CurrentHostFrequency(); -+ -+ m_config.stats->SetCanSkipDeint(false); -+ -+ EDEINTERLACEMODE mode = g_settings.m_currentVideoSettings.m_DeinterlaceMode; -+ EINTERLACEMETHOD method = g_settings.m_currentVideoSettings.m_InterlaceMethod; -+ bool interlaced = m_processPicture.DVDPic.iFlags & DVP_FLAG_INTERLACED; -+ -+ if (mode == VS_DEINTERLACEMODE_FORCE || -+ (mode == VS_DEINTERLACEMODE_AUTO && interlaced)) -+ { -+ if((method == VS_INTERLACEMETHOD_AUTO && interlaced) -+ || method == VS_INTERLACEMETHOD_XVBA) -+ { -+ m_deinterlacing = true; -+ m_deintSkip = false; -+ m_config.stats->SetCanSkipDeint(true); -+ -+ if (m_processPicture.DVDPic.iFlags & DVP_FLAG_DROPDEINT) -+ { -+ m_deintSkip = true; -+ } -+ -+ // do only half deinterlacing -+ if (speed != DVD_PLAYSPEED_NORMAL || !g_graphicsContext.IsFullScreenVideo()) -+ { -+ m_config.stats->SetCanSkipDeint(false); -+ m_deintSkip = true; -+ } -+ -+ if(m_processPicture.DVDPic.iFlags & DVP_FLAG_TOP_FIELD_FIRST) -+ m_field = XVBA_TOP_FIELD; -+ else -+ m_field = XVBA_BOTTOM_FIELD; -+ } -+ } -+ else -+ { -+ m_deinterlacing = false; -+ m_field = XVBA_FRAME; -+ } -+ -+ m_processPicture.DVDPic.format = RENDER_FMT_XVBA; -+ m_processPicture.DVDPic.iFlags &= ~(DVP_FLAG_TOP_FIELD_FIRST | -+ DVP_FLAG_REPEAT_TOP_FIELD | -+ DVP_FLAG_INTERLACED); -+ m_processPicture.DVDPic.iWidth = m_config.vidWidth; -+ m_processPicture.DVDPic.iHeight = m_config.vidHeight; -+ -+ m_deintStep = 0; -+} -+ -+void COutput::FiniCycle() -+{ -+// { CSingleLock lock(*m_config.videoSurfaceSec); -+// m_processPicture.render->state &= ~FF_XVBA_STATE_USED_FOR_RENDER; -+// } -+ m_processPicture.render = 0; -+ m_config.stats->DecDecoded(); -+} -+ -+bool COutput::EnsureBufferPool() -+{ -+ if (m_config.useSharedSurfaces && m_bufferPool.glSurfaces.empty()) -+ { -+ GLenum textureTarget; -+ if (!glewIsSupported("GL_ARB_texture_non_power_of_two") && glewIsSupported("GL_ARB_texture_rectangle")) -+ { -+ textureTarget = GL_TEXTURE_RECTANGLE_ARB; -+ } -+ else -+ textureTarget = GL_TEXTURE_2D; -+ -+ // create shared surfaces -+ XvbaBufferPool::GLVideoSurface surface; -+ for (unsigned int i = 0; i < NUM_RENDER_PICS; ++i) -+ { -+ glEnable(textureTarget); -+ glGenTextures(1, &surface.texture); -+ glBindTexture(textureTarget, surface.texture); -+ glTexParameteri(textureTarget, GL_TEXTURE_MIN_FILTER, GL_LINEAR); -+ glTexParameteri(textureTarget, GL_TEXTURE_MAG_FILTER, GL_LINEAR); -+ glTexParameteri(textureTarget, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); -+ glTexParameteri(textureTarget, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); -+ glPixelStorei(GL_UNPACK_ALIGNMENT, 4); -+ glTexImage2D(textureTarget, 0, GL_RGBA, m_config.surfaceWidth, m_config.surfaceHeight, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL); -+ -+ XVBA_Create_GLShared_Surface_Input surfInput; -+ XVBA_Create_GLShared_Surface_Output surfOutput; -+ surfInput.size = sizeof(surfInput); -+ surfInput.session = m_config.xvbaSession; -+ surfInput.gltexture = surface.texture; -+ surfInput.glcontext = m_glContext; -+ surfOutput.size = sizeof(surfOutput); -+ surfOutput.surface = 0; -+ if (Success != g_XVBA_vtable.CreateGLSharedSurface(&surfInput, &surfOutput)) -+ { -+ CLog::Log(LOGERROR,"(XVBA) failed to create shared surface"); -+ m_xvbaError = true; -+ break; -+ } -+ CLog::Log(LOGDEBUG, "XVBA::GetTexture - created shared surface"); -+ -+ surface.glSurface = surfOutput.surface; -+ surface.id = i; -+ surface.used = false; -+ surface.render = 0; -+ m_bufferPool.glSurfaces.push_back(surface); -+ } -+ glDisable(textureTarget); -+ } -+ -+ return true; -+} -+ -+void COutput::ReleaseBufferPool(bool precleanup /*= false*/) -+{ -+// if (m_fence) -+// { -+// uint64_t maxTimeout = 1000000000LL; -+// glClientWaitSync(m_fence, GL_SYNC_FLUSH_COMMANDS_BIT, maxTimeout); -+// glDeleteSync(m_fence); -+// m_fence = None; -+// } -+ -+ CSingleLock lock(m_bufferPool.renderPicSec); -+ -+ for (unsigned int i = 0; i < m_bufferPool.glSurfaces.size(); ++i) -+ { -+ if (m_bufferPool.glSurfaces[i].glSurface) -+ { -+ g_XVBA_vtable.DestroySurface(m_bufferPool.glSurfaces[i].glSurface); -+ m_bufferPool.glSurfaces[i].glSurface = 0; -+ } -+ if (m_bufferPool.glSurfaces[i].texture && !precleanup) -+ { -+ glDeleteTextures(1, &m_bufferPool.glSurfaces[i].texture); -+ m_bufferPool.glSurfaces[i].texture = 0; -+ } -+ m_bufferPool.glSurfaces[i].render = 0; -+ m_bufferPool.glSurfaces[i].used = true; -+ } -+ -+ if (!precleanup) -+ { -+ m_bufferPool.glSurfaces.clear(); -+ -+ // invalidate all used render pictures -+ for (unsigned int i = 0; i < m_bufferPool.usedRenderPics.size(); ++i) -+ { -+ m_bufferPool.usedRenderPics[i]->valid = false; -+ } -+ } -+} -+ -+void COutput::PreReleaseBufferPool() -+{ -+ CSingleLock lock(m_bufferPool.renderPicSec); -+ -+ if (m_config.useSharedSurfaces) -+ { -+ for (unsigned int i = 0; i < m_bufferPool.glSurfaces.size(); ++i) -+ { -+ if (!m_bufferPool.glSurfaces[i].used) -+ { -+ g_XVBA_vtable.DestroySurface(m_bufferPool.glSurfaces[i].glSurface); -+ glDeleteTextures(1, &m_bufferPool.glSurfaces[i].texture); -+ m_bufferPool.glSurfaces[i].glSurface = 0; -+ m_bufferPool.glSurfaces[i].used = true; -+ } -+ } -+ } -+} -+ -+bool COutput::CreateGlxContext() -+{ -+ GLXContext glContext; -+ -+ m_Display = g_Windowing.GetDisplay(); -+ glContext = g_Windowing.GetGlxContext(); -+ m_Window = g_Windowing.GetWindow(); -+ -+ // Get our window attribs. -+ XWindowAttributes wndattribs; -+ XGetWindowAttributes(m_Display, m_Window, &wndattribs); -+ -+ // Get visual Info -+ XVisualInfo visInfo; -+ visInfo.visualid = wndattribs.visual->visualid; -+ int nvisuals = 0; -+ XVisualInfo* visuals = XGetVisualInfo(m_Display, VisualIDMask, &visInfo, &nvisuals); -+ if (nvisuals != 1) -+ { -+ CLog::Log(LOGERROR, "XVBA::COutput::CreateGlxContext - could not find visual"); -+ return false; -+ } -+ visInfo = visuals[0]; -+ XFree(visuals); -+ -+ m_pixmap = XCreatePixmap(m_Display, -+ m_Window, -+ 192, -+ 108, -+ visInfo.depth); -+ if (!m_pixmap) -+ { -+ CLog::Log(LOGERROR, "XVBA::COutput::CreateGlxContext - Unable to create XPixmap"); -+ return false; -+ } -+ -+ // create gl pixmap -+ m_glPixmap = glXCreateGLXPixmap(m_Display, &visInfo, m_pixmap); -+ -+ if (!m_glPixmap) -+ { -+ CLog::Log(LOGINFO, "XVBA::COutput::CreateGlxContext - Could not create glPixmap"); -+ return false; -+ } -+ -+ m_glContext = glXCreateContext(m_Display, &visInfo, glContext, True); -+ -+ if (!glXMakeCurrent(m_Display, m_glPixmap, m_glContext)) -+ { -+ CLog::Log(LOGINFO, "XVBA::COutput::CreateGlxContext - Could not make Pixmap current"); -+ return false; -+ } -+ -+ CLog::Log(LOGNOTICE, "XVBA::COutput::CreateGlxContext - created context"); -+ return true; -+} -+ -+bool COutput::DestroyGlxContext() -+{ -+ if (m_glContext) -+ { -+ glXMakeCurrent(m_Display, None, NULL); -+ glXDestroyContext(m_Display, m_glContext); -+ } -+ m_glContext = 0; -+ -+ if (m_glPixmap) -+ glXDestroyPixmap(m_Display, m_glPixmap); -+ m_glPixmap = 0; -+ -+ if (m_pixmap) -+ XFreePixmap(m_Display, m_pixmap); -+ m_pixmap = 0; -+ -+ return true; -+} -+ -+#endif -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/XVBA.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/XVBA.h -new file mode 100644 -index 0000000..f38444c ---- /dev/null -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/XVBA.h -@@ -0,0 +1,382 @@ -+/* -+ * Copyright (C) 2005-2011 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 -+ -+#include "X11/Xlib.h" -+#include "amd/amdxvba.h" -+#include "DllAvCodec.h" -+#include "DVDCodecs/Video/DVDVideoCodecFFmpeg.h" -+#include "threads/Thread.h" -+#include "threads/CriticalSection.h" -+#include "threads/SharedSection.h" -+#include "threads/Event.h" -+#include "guilib/DispResource.h" -+#include "guilib/Geometry.h" -+#include "libavcodec/xvba.h" -+#include "utils/ActorProtocol.h" -+#include "settings/VideoSettings.h" -+#include -+#include -+#include -+ -+using namespace Actor; -+ -+ -+namespace XVBA -+{ -+ -+//----------------------------------------------------------------------------- -+// XVBA data structs -+//----------------------------------------------------------------------------- -+ -+class CDecoder; -+class CXVBAContext; -+class COutput; -+ -+#define NUM_RENDER_PICS 9 -+ -+/** -+ * Buffer statistics used to control number of frames in queue -+ */ -+ -+class CXvbaBufferStats -+{ -+public: -+ uint16_t decodedPics; -+ uint16_t processedPics; -+ uint16_t renderPics; -+ uint64_t latency; // time decoder has waited for a frame, ideally there is no latency -+ int playSpeed; -+ bool canSkipDeint; -+ int processCmd; -+ -+ void IncDecoded() { CSingleLock l(m_sec); decodedPics++;} -+ void DecDecoded() { CSingleLock l(m_sec); decodedPics--;} -+ void IncProcessed() { CSingleLock l(m_sec); processedPics++;} -+ void DecProcessed() { CSingleLock l(m_sec); processedPics--;} -+ void IncRender() { CSingleLock l(m_sec); renderPics++;} -+ void DecRender() { CSingleLock l(m_sec); renderPics--;} -+ void Reset() { CSingleLock l(m_sec); decodedPics=0; processedPics=0;renderPics=0;latency=0;} -+ void Get(uint16_t &decoded, uint16_t &processed, uint16_t &render) {CSingleLock l(m_sec); decoded = decodedPics, processed=processedPics, render=renderPics;} -+ void SetParams(uint64_t time, int speed) { CSingleLock l(m_sec); latency = time; playSpeed = speed; } -+ void GetParams(uint64_t &lat, int &speed) { CSingleLock l(m_sec); lat = latency; speed = playSpeed; } -+ void SetCmd(int cmd) { CSingleLock l(m_sec); processCmd = cmd; } -+ void GetCmd(int &cmd) { CSingleLock l(m_sec); cmd = processCmd; processCmd = 0; } -+ void SetCanSkipDeint(bool canSkip) { CSingleLock l(m_sec); canSkipDeint = canSkip; } -+ bool CanSkipDeint() { CSingleLock l(m_sec); if (canSkipDeint) return true; else return false;} -+private: -+ CCriticalSection m_sec; -+}; -+ -+/** -+ * CXvbaConfig holds all configuration parameters needed by vdpau -+ * The structure is sent to the internal classes CMixer and COutput -+ * for init. -+ */ -+ -+struct CXvbaConfig -+{ -+ int surfaceWidth; -+ int surfaceHeight; -+ int vidWidth; -+ int vidHeight; -+ int outWidth; -+ int outHeight; -+ bool useSharedSurfaces; -+ -+ CXVBAContext *context; -+ XVBADecodeCap decoderCap; -+ void *xvbaSession; -+ std::vector *videoSurfaces; -+ CCriticalSection *videoSurfaceSec; -+ CCriticalSection *apiSec; -+ -+ CXvbaBufferStats *stats; -+ int numRenderBuffers; -+ uint32_t maxReferences; -+}; -+ -+/** -+ * Holds a decoded frame -+ * Input to COutput for further processing -+ */ -+struct CXvbaDecodedPicture -+{ -+ DVDVideoPicture DVDPic; -+ xvba_render_state *render; -+}; -+ -+/** -+ * Ready to render textures -+ * Sent from COutput back to CDecoder -+ * Objects are referenced by DVDVideoPicture and are sent -+ * to renderer -+ */ -+class CXvbaRenderPicture -+{ -+ friend class CDecoder; -+ friend class COutput; -+public: -+ DVDVideoPicture DVDPic; -+ int texWidth, texHeight; -+ CRect crop; -+ GLuint texture; -+ uint32_t sourceIdx; -+ bool valid; -+ CDecoder *xvba; -+ CXvbaRenderPicture* Acquire(); -+ long Release(); -+private: -+ void ReturnUnused(); -+ int refCount; -+ CCriticalSection *renderPicSection; -+ COutput *xvbaOutput; -+}; -+ -+//----------------------------------------------------------------------------- -+// Output -+//----------------------------------------------------------------------------- -+ -+/** -+ * Buffer pool holds allocated xvba and gl resources -+ * Embedded in COutput -+ */ -+struct XvbaBufferPool -+{ -+ struct GLVideoSurface -+ { -+ unsigned int id; -+ bool used; -+ bool transferred; -+ GLuint texture; -+ void *glSurface; -+ xvba_render_state *render; -+ XVBA_SURFACE_FLAG field; -+ }; -+ std::vector glSurfaces; -+ std::vector allRenderPics; -+ std::deque usedRenderPics; -+ std::deque freeRenderPics; -+ CCriticalSection renderPicSec; -+}; -+ -+class COutputControlProtocol : public Protocol -+{ -+public: -+ COutputControlProtocol(std::string name, CEvent* inEvent, CEvent *outEvent) : Protocol(name, inEvent, outEvent) {}; -+ enum OutSignal -+ { -+ INIT, -+ FLUSH, -+ PRECLEANUP, -+ TIMEOUT, -+ }; -+ enum InSignal -+ { -+ ACC, -+ ERROR, -+ STATS, -+ }; -+}; -+ -+class COutputDataProtocol : public Protocol -+{ -+public: -+ COutputDataProtocol(std::string name, CEvent* inEvent, CEvent *outEvent) : Protocol(name, inEvent, outEvent) {}; -+ enum OutSignal -+ { -+ NEWFRAME = 0, -+ RETURNPIC, -+ }; -+ enum InSignal -+ { -+ PICTURE, -+ }; -+}; -+ -+/** -+ * COutput is embedded in CDecoder and embeds CMixer -+ * The class has its own OpenGl context which is shared with render thread -+ * COuput generated ready to render textures and passes them back to -+ * CDecoder -+ */ -+class COutput : private CThread -+{ -+public: -+ COutput(CEvent *inMsgEvent); -+ virtual ~COutput(); -+ void Start(); -+ void Dispose(); -+ COutputControlProtocol m_controlPort; -+ COutputDataProtocol m_dataPort; -+protected: -+ void OnStartup(); -+ void OnExit(); -+ void Process(); -+ void StateMachine(int signal, Protocol *port, Message *msg); -+ bool HasWork(); -+ bool IsDecodingFinished(); -+ CXvbaRenderPicture* ProcessPicture(); -+ void ProcessReturnPicture(CXvbaRenderPicture *pic); -+ int FindFreeSurface(); -+ void InitCycle(); -+ void FiniCycle(); -+ bool Init(); -+ bool Uninit(); -+ void Flush(); -+ bool CreateGlxContext(); -+ bool DestroyGlxContext(); -+ bool EnsureBufferPool(); -+ void ReleaseBufferPool(bool precleanup = false); -+ void PreReleaseBufferPool(); -+ CEvent m_outMsgEvent; -+ CEvent *m_inMsgEvent; -+ int m_state; -+ bool m_bStateMachineSelfTrigger; -+ -+ // extended state variables for state machine -+ int m_extTimeout; -+ bool m_xvbaError; -+ CXvbaConfig m_config; -+ XvbaBufferPool m_bufferPool; -+ Display *m_Display; -+ Window m_Window; -+ GLXContext m_glContext; -+ GLXWindow m_glWindow; -+ Pixmap m_pixmap; -+ GLXPixmap m_glPixmap; -+ GLsync m_fence; -+ std::queue m_decodedPics; -+ CXvbaDecodedPicture m_processPicture; -+ XVBA_SURFACE_FLAG m_field; -+ bool m_deinterlacing; -+ int m_deintStep; -+ bool m_deintSkip; -+}; -+ -+//----------------------------------------------------------------------------- -+// XVBA decoder -+//----------------------------------------------------------------------------- -+ -+class CXVBAContext -+{ -+public: -+ static bool EnsureContext(CXVBAContext **ctx); -+ void *GetContext(); -+ void Release(); -+private: -+ CXVBAContext(); -+ void Close(); -+ bool LoadSymbols(); -+ bool CreateContext(); -+ void DestroyContext(); -+ static CXVBAContext *m_context; -+ static CCriticalSection m_section; -+ static Display *m_display; -+ int m_refCount; -+ static void *m_dlHandle; -+ void *m_xvbaContext; -+}; -+ -+class CDecoder : public CDVDVideoCodecFFmpeg::IHardwareDecoder, -+ public IDispResource -+{ -+ friend class CXvbaRenderPicture; -+ -+public: -+ -+ struct pictureAge -+ { -+ int b_age; -+ int ip_age[2]; -+ }; -+ -+ enum EDisplayState -+ { XVBA_OPEN -+ , XVBA_RESET -+ , XVBA_LOST -+ , XVBA_ERROR -+ }; -+ -+ CDecoder(); -+ virtual ~CDecoder(); -+ virtual void OnLostDevice(); -+ virtual void OnResetDevice(); -+ -+ virtual bool Open(AVCodecContext* avctx, const enum PixelFormat fmt, unsigned int surfaces = 0); -+ virtual int Decode (AVCodecContext* avctx, AVFrame* frame); -+ virtual bool GetPicture(AVCodecContext* avctx, AVFrame* frame, DVDVideoPicture* picture); -+ virtual void Reset(); -+ virtual void Close(); -+ virtual int Check(AVCodecContext* avctx); -+ virtual long Release(); -+ virtual const std::string Name() { return "xvba"; } -+ virtual bool CanSkipDeint(); -+ virtual void SetSpeed(int speed); -+ -+ bool Supports(EINTERLACEMETHOD method); -+ long ReleasePicReference(); -+ -+protected: -+ bool CreateSession(AVCodecContext* avctx); -+ void DestroySession(bool precleanup = false); -+ bool EnsureDataControlBuffers(unsigned int num); -+ void ResetState(); -+ void SetError(const char* function, const char* msg, int line); -+ bool IsSurfaceValid(xvba_render_state *render); -+ void ReturnRenderPicture(CXvbaRenderPicture *renderPic); -+ -+ // callbacks for ffmpeg -+ static void FFReleaseBuffer(AVCodecContext *avctx, AVFrame *pic); -+ static void FFDrawSlice(struct AVCodecContext *avctx, -+ const AVFrame *src, int offset[4], -+ int y, int type, int height); -+ static int FFGetBuffer(AVCodecContext *avctx, AVFrame *pic); -+ -+ DllAvUtil m_dllAvUtil; -+ CCriticalSection m_decoderSection; -+ CEvent m_displayEvent; -+ EDisplayState m_displayState; -+ CXvbaConfig m_xvbaConfig; -+ std::vector m_videoSurfaces; -+ CCriticalSection m_apiSec, m_videoSurfaceSec; -+ ThreadIdentifier m_decoderThread; -+ -+ unsigned int m_decoderId; -+ struct XVBABufferPool -+ { -+ XVBABufferDescriptor *picture_descriptor_buffer; -+ XVBABufferDescriptor *iq_matrix_buffer; -+ XVBABufferDescriptor *data_buffer; -+ std::vector data_control_buffers; -+ }; -+ XVBABufferPool m_xvbaBufferPool; -+ -+ COutput m_xvbaOutput; -+ CXvbaBufferStats m_bufferStats; -+ CEvent m_inMsgEvent; -+ CXvbaRenderPicture *m_presentPicture; -+ -+ int m_speed; -+ int m_codecControl; -+}; -+ -+} -diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -index 92f62bb..1e5d2ac5 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -+++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -@@ -1174,6 +1174,10 @@ int CDVDPlayerVideo::OutputPicture(const DVDVideoPicture* src, double pts) - formatstr = "NONE"; - buffering = false; - break; -+ case RENDER_FMT_XVBA: -+ formatstr = "XVBA"; -+ buffering = true; -+ break; - } - - if(m_bAllowFullscreen) -diff --git a/xbmc/settings/GUISettings.cpp b/xbmc/settings/GUISettings.cpp -index 30b402d..67aeec9 100644 ---- a/xbmc/settings/GUISettings.cpp -+++ b/xbmc/settings/GUISettings.cpp -@@ -695,6 +695,9 @@ void CGUISettings::Initialize() - #ifdef HAVE_LIBVA - AddBool(vp, "videoplayer.usevaapi", 13426, true); - #endif -+#ifdef HAVE_LIBXVBA -+ AddBool(vp, "videoplayer.usexvba", 13437, true); -+#endif - #ifdef HAS_DX - AddBool(g_sysinfo.IsVistaOrHigher() ? vp: NULL, "videoplayer.usedxva2", 13427, g_sysinfo.IsVistaOrHigher() ? true : false); - #endif -diff --git a/xbmc/settings/VideoSettings.h b/xbmc/settings/VideoSettings.h -index f8093b2..f54a837 100644 ---- a/xbmc/settings/VideoSettings.h -+++ b/xbmc/settings/VideoSettings.h -@@ -65,6 +65,8 @@ enum EINTERLACEMETHOD - VS_INTERLACEMETHOD_SW_BLEND = 20, - VS_INTERLACEMETHOD_AUTO_ION = 21, - -+ VS_INTERLACEMETHOD_XVBA = 22, -+ - VS_INTERLACEMETHOD_MAX // do not use and keep as last enum value. - }; - -diff --git a/xbmc/video/dialogs/GUIDialogVideoSettings.cpp b/xbmc/video/dialogs/GUIDialogVideoSettings.cpp -index f25d10d..f6b1ea4 100644 ---- a/xbmc/video/dialogs/GUIDialogVideoSettings.cpp -+++ b/xbmc/video/dialogs/GUIDialogVideoSettings.cpp -@@ -110,6 +110,7 @@ void CGUIDialogVideoSettings::CreateSettings() - entries.push_back(make_pair(VS_INTERLACEMETHOD_DXVA_BOB , 16320)); - entries.push_back(make_pair(VS_INTERLACEMETHOD_DXVA_BEST , 16321)); - entries.push_back(make_pair(VS_INTERLACEMETHOD_AUTO_ION , 16325)); -+ entries.push_back(make_pair(VS_INTERLACEMETHOD_XVBA , 16326)); - - /* remove unsupported methods */ - for(vector >::iterator it = entries.begin(); it != entries.end();) --- -1.8.1.6 - - -From 4e72c3c72b1569934677c2ab97e0aa6e5875abfd Mon Sep 17 00:00:00 2001 -From: fritsch -Date: Sun, 4 Nov 2012 16:24:10 +0100 -Subject: [PATCH 64/94] xvba: add string for available decoders - we are - important so make sure we are there - ---- - xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp -index 0cea7a9..6fb74b7 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp -@@ -169,6 +169,11 @@ CDVDVideoCodec* CDVDFactoryCodec::CreateVideoCodec(CDVDStreamInfo &hint, unsigne - #elif defined(_LINUX) && !defined(TARGET_DARWIN) - hwSupport += "VAAPI:no "; - #endif -+#if defined(HAVE_LIBXVBA) && defined(TARGET_LINUX) -+ hwSupport += "XVBA:yes "; -+#elif defined(TARGET_LINUX) -+ hwSupport += "XVBA:no "; -+#endif - - CLog::Log(LOGDEBUG, "CDVDFactoryCodec: compiled in hardware support: %s", hwSupport.c_str()); - --- -1.8.1.6 - - -From 4eb0a1c62e0f2d6766f3364bec110ceb989de328 Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Sat, 16 Jun 2012 12:46:30 +0200 -Subject: [PATCH 65/94] xvba: do not use vaapi if xvba is present - ---- - xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp | 9 +++++++++ - 1 file changed, 9 insertions(+) - -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp -index a2b9195..43a05b3 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp -@@ -261,6 +261,15 @@ void CDecoder::Close() - - bool CDecoder::Open(AVCodecContext *avctx, enum PixelFormat fmt, unsigned int surfaces) - { -+#ifdef HAVE_LIBXVBA -+ std::string Vendor = g_Windowing.GetRenderVendor(); -+ std::transform(Vendor.begin(), Vendor.end(), Vendor.begin(), ::tolower); -+ if (Vendor.compare(0, 3, "ati") == 0) -+ { -+ return false; -+ } -+#endif -+ - VAEntrypoint entrypoint = VAEntrypointVLD; - VAProfile profile; - --- -1.8.1.6 - - -From b40ec058cfcfa0470d38d54062844285a8866ca4 Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Thu, 23 Aug 2012 19:39:49 +0200 -Subject: [PATCH 66/94] ffmpeg: add av_find_default_stream_index to interface - ---- - lib/DllAvFormat.h | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/lib/DllAvFormat.h b/lib/DllAvFormat.h -index 9bda3f3..bf31fcb 100644 ---- a/lib/DllAvFormat.h -+++ b/lib/DllAvFormat.h -@@ -98,6 +98,7 @@ class DllAvFormatInterface - virtual int avformat_write_header (AVFormatContext *s, AVDictionary **options)=0; - virtual int av_write_trailer(AVFormatContext *s)=0; - virtual int av_write_frame (AVFormatContext *s, AVPacket *pkt)=0; -+ virtual int av_find_default_stream_index(AVFormatContext *s)=0; - }; - - #if (defined USE_EXTERNAL_FFMPEG) || (defined TARGET_DARWIN) -@@ -153,6 +154,7 @@ class DllAvFormat : public DllDynamic, DllAvFormatInterface - virtual int avformat_write_header (AVFormatContext *s, AVDictionary **options) { return ::avformat_write_header (s, options); } - virtual int av_write_trailer(AVFormatContext *s) { return ::av_write_trailer(s); } - virtual int av_write_frame (AVFormatContext *s, AVPacket *pkt) { return ::av_write_frame(s, pkt); } -+ virtual int av_find_default_stream_index(AVFormatContext *s) { return ::av_find_default_stream_index(s); } - - // DLL faking. - virtual bool ResolveExports() { return true; } -@@ -209,6 +211,7 @@ class DllAvFormat : public DllDynamic, DllAvFormatInterface - DEFINE_METHOD2(int, avformat_write_header , (AVFormatContext *p1, AVDictionary **p2)) - DEFINE_METHOD1(int, av_write_trailer, (AVFormatContext *p1)) - DEFINE_METHOD2(int, av_write_frame , (AVFormatContext *p1, AVPacket *p2)) -+ DEFINE_METHOD1(int, av_find_default_stream_index, (AVFormatContext *p1)) - BEGIN_METHOD_RESOLVE() - RESOLVE_METHOD_RENAME(av_register_all, av_register_all_dont_call) - RESOLVE_METHOD(av_find_input_format) -@@ -243,6 +246,7 @@ class DllAvFormat : public DllDynamic, DllAvFormatInterface - RESOLVE_METHOD(avformat_write_header) - RESOLVE_METHOD(av_write_trailer) - RESOLVE_METHOD(av_write_frame) -+ RESOLVE_METHOD(av_find_default_stream_index) - END_METHOD_RESOLVE() - - /* dependencies of libavformat */ --- -1.8.1.6 - - -From f6cefb6c48c29b0d8fa8154b4dda24f318bc5208 Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Mon, 20 Aug 2012 16:06:39 +0200 -Subject: [PATCH 67/94] dvdplayer: observe pts counter overflow - ---- - .../cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp | 198 ++++++++++++++++++++- - xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.h | 3 + - 2 files changed, 200 insertions(+), 1 deletion(-) - -diff --git a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -index 35d0fc5..97d963a 100644 ---- a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -+++ b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -@@ -18,13 +18,13 @@ - * - */ - --#include "system.h" - #ifndef __STDC_CONSTANT_MACROS - #define __STDC_CONSTANT_MACROS - #endif - #ifndef __STDC_LIMIT_MACROS - #define __STDC_LIMIT_MACROS - #endif -+#include "system.h" - #ifdef _LINUX - #include "stdint.h" - #endif -@@ -499,6 +499,9 @@ bool CDVDDemuxFFmpeg::Open(CDVDInputStream* pInput) - AddStream(i); - } - -+ m_bPtsWrapChecked = false; -+ m_bPtsWrap = false; -+ - return true; - } - -@@ -603,6 +606,12 @@ double CDVDDemuxFFmpeg::ConvertTimestamp(int64_t pts, int den, int num) - if (pts == (int64_t)AV_NOPTS_VALUE) - return DVD_NOPTS_VALUE; - -+ if (m_bPtsWrap) -+ { -+ if (pts < m_iStartTime && pts < m_iEndTime) -+ pts += m_iMaxTime; -+ } -+ - // do calculations in floats as they can easily overflow otherwise - // we don't care for having a completly exact timestamp anyway - double timestamp = (double)pts * num / den; -@@ -725,6 +734,24 @@ DemuxPacket* CDVDDemuxFFmpeg::Read() - pkt.pts = AV_NOPTS_VALUE; - } - -+ if (!m_bPtsWrapChecked && m_pFormatContext->iformat->flags & AVFMT_TS_DISCONT) -+ { -+ int defaultStream = m_dllAvFormat.av_find_default_stream_index(m_pFormatContext); -+ int64_t duration = m_pFormatContext->streams[defaultStream]->duration * 1.5; -+ m_iMaxTime = 1LL<streams[defaultStream]->pts_wrap_bits; -+ m_iStartTime = m_pFormatContext->streams[defaultStream]->start_time; -+ if (m_iStartTime != DVD_NOPTS_VALUE) -+ { -+ m_iEndTime = (m_iStartTime + duration) & ~m_iMaxTime; -+ if (m_iEndTime < m_iStartTime) -+ { -+ CLog::Log(LOGNOTICE,"CDVDDemuxFFmpeg::Read - file contains pts overflow"); -+ m_bPtsWrap = true; -+ } -+ } -+ m_bPtsWrapChecked = true; -+ } -+ - // copy contents into our own packet - pPacket->iSize = pkt.size; - -@@ -839,10 +866,20 @@ bool CDVDDemuxFFmpeg::SeekTime(int time, bool backwords, double *startpts) - int ret; - { - CSingleLock lock(m_critSection); -+ - ret = m_dllAvFormat.av_seek_frame(m_pFormatContext, -1, seek_pts, backwords ? AVSEEK_FLAG_BACKWARD : 0); - - if(ret >= 0) -+ { - UpdateCurrentPTS(); -+ -+ // seek may fail silently on streams which allow discontinuity -+ // if current timestamp is way off asume a pts overflow and try bisect seek -+ if (m_bPtsWrap && fabs(time - m_iCurrentPts/1000) > 10000) -+ { -+ ret = SeekTimeDiscont(seek_pts, backwords) ? 1 : -1; -+ } -+ } - } - - if(m_iCurrentPts == DVD_NOPTS_VALUE) -@@ -861,6 +898,165 @@ bool CDVDDemuxFFmpeg::SeekTime(int time, bool backwords, double *startpts) - return (ret >= 0); - } - -+bool CDVDDemuxFFmpeg::SeekTimeDiscont(int64_t pts, bool backwards) -+{ -+ // this code is taken from ffmpeg function ff_gen_search -+ // it is modified to assume a pts overflow if timestamp < start_time -+ if (!m_pFormatContext->iformat->read_timestamp) -+ return false; -+ -+ int defaultStream = m_dllAvFormat.av_find_default_stream_index(m_pFormatContext); -+ -+ if (defaultStream < 0) -+ { -+ return false; -+ } -+ -+ // timestamp for default must be expressed in AV_TIME_BASE units -+ pts = m_dllAvUtil.av_rescale_rnd(pts, m_pFormatContext->streams[defaultStream]->time_base.den, -+ AV_TIME_BASE * (int64_t)m_pFormatContext->streams[defaultStream]->time_base.num, -+ AV_ROUND_NEAR_INF); -+ -+ int64_t pos, pos_min, pos_max, pos_limit, ts, ts_min, ts_max; -+ int64_t start_pos, filesize; -+ int no_change; -+ -+ pos_min = m_pFormatContext->data_offset; -+ ts_min = m_pFormatContext->iformat->read_timestamp(m_pFormatContext, defaultStream, -+ &pos_min, INT64_MAX); -+ if (ts_min == AV_NOPTS_VALUE) -+ return false; -+ -+ if(ts_min >= pts) -+ { -+ pos = pos_min; -+ return true; -+ } -+ -+ int step= 1024; -+ filesize = m_pInput->GetLength(); -+ pos_max = filesize - 1; -+ do -+ { -+ pos_max -= step; -+ ts_max = m_pFormatContext->iformat->read_timestamp(m_pFormatContext, defaultStream, -+ &pos_max, pos_max + step); -+ step += step; -+ }while (ts_max == AV_NOPTS_VALUE && pos_max >= step); -+ -+ if (ts_max == AV_NOPTS_VALUE) -+ return false; -+ -+ if (ts_max < m_iStartTime && ts_max < m_iEndTime) -+ ts_max += m_iMaxTime; -+ -+ for(;;) -+ { -+ int64_t tmp_pos = pos_max + 1; -+ int64_t tmp_ts = m_pFormatContext->iformat->read_timestamp(m_pFormatContext, defaultStream, -+ &tmp_pos, INT64_MAX); -+ if(tmp_ts == AV_NOPTS_VALUE) -+ break; -+ -+ if (tmp_ts < m_iStartTime && tmp_ts < m_iEndTime) -+ tmp_ts += m_iMaxTime; -+ -+ ts_max = tmp_ts; -+ pos_max = tmp_pos; -+ if (tmp_pos >= filesize) -+ break; -+ } -+ pos_limit = pos_max; -+ -+ if(ts_max <= pts) -+ { -+ bool ret = SeekByte(pos_max); -+ if (ret) -+ { -+ m_iCurrentPts = ConvertTimestamp(ts_max, m_pFormatContext->streams[defaultStream]->time_base.den, -+ m_pFormatContext->streams[defaultStream]->time_base.num); -+ } -+ return ret; -+ } -+ -+ if(ts_min > ts_max) -+ { -+ return false; -+ } -+ else if (ts_min == ts_max) -+ { -+ pos_limit = pos_min; -+ } -+ -+ no_change=0; -+ while (pos_min < pos_limit) -+ { -+ if (no_change == 0) -+ { -+ int64_t approximate_keyframe_distance= pos_max - pos_limit; -+ // interpolate position (better than dichotomy) -+ pos = m_dllAvUtil.av_rescale_rnd(pts - ts_min, pos_max - pos_min, -+ ts_max - ts_min, AV_ROUND_NEAR_INF) -+ + pos_min - approximate_keyframe_distance; -+ } -+ else if (no_change == 1) -+ { -+ // bisection, if interpolation failed to change min or max pos last time -+ pos = (pos_min + pos_limit) >> 1; -+ } -+ else -+ { -+ /* linear search if bisection failed, can only happen if there -+ are very few or no keyframes between min/max */ -+ pos = pos_min; -+ } -+ if (pos <= pos_min) -+ pos= pos_min + 1; -+ else if (pos > pos_limit) -+ pos= pos_limit; -+ start_pos = pos; -+ -+ ts = m_pFormatContext->iformat->read_timestamp(m_pFormatContext, defaultStream, -+ &pos, INT64_MAX); -+ if (pos == pos_max) -+ no_change++; -+ else -+ no_change=0; -+ -+ if (ts == AV_NOPTS_VALUE) -+ { -+ return false; -+ } -+ -+ if (ts < m_iStartTime && ts < m_iEndTime) -+ ts += m_iMaxTime; -+ -+ if (pts <= ts) -+ { -+ pos_limit = start_pos - 1; -+ pos_max = pos; -+ ts_max = ts; -+ } -+ if (pts >= ts) -+ { -+ pos_min = pos; -+ ts_min = ts; -+ } -+ } -+ -+ pos = (backwards) ? pos_min : pos_max; -+ ts = (backwards) ? ts_min : ts_max; -+ -+ bool ret = SeekByte(pos); -+ if (ret) -+ { -+ m_iCurrentPts = ConvertTimestamp(ts, m_pFormatContext->streams[defaultStream]->time_base.den, -+ m_pFormatContext->streams[defaultStream]->time_base.num); -+ } -+ -+ return ret; -+} -+ - bool CDVDDemuxFFmpeg::SeekByte(int64_t pos) - { - CSingleLock lock(m_critSection); -diff --git a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.h b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.h -index acef490..72ecc52 100644 ---- a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.h -+++ b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.h -@@ -97,6 +97,7 @@ class CDVDDemuxFFmpeg : public CDVDDemux - DemuxPacket* Read(); - - bool SeekTime(int time, bool backwords = false, double* startpts = NULL); -+ bool SeekTimeDiscont(int64_t pts, bool backwards); - bool SeekByte(int64_t pos); - int GetStreamLength(); - CDemuxStream* GetStream(int iStreamId); -@@ -141,5 +142,7 @@ class CDVDDemuxFFmpeg : public CDVDDemux - unsigned m_program; - XbmcThreads::EndTime m_timeout; - -+ bool m_bPtsWrap, m_bPtsWrapChecked; -+ int64_t m_iStartTime, m_iMaxTime, m_iEndTime; - }; - --- -1.8.1.6 - - -From 6451b4fbb7e662df575f3295479715fd35beb178 Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Tue, 2 Oct 2012 13:02:10 +0200 -Subject: [PATCH 68/94] dvdplayer: avoid short screen flicker caused by - unnecessary reconfigure of renderer - ---- - xbmc/cores/dvdplayer/DVDPlayerVideo.cpp | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -index 1e5d2ac5..69f45d4 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -+++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -@@ -1030,7 +1030,7 @@ int CDVDPlayerVideo::OutputPicture(const DVDVideoPicture* src, double pts) - || m_output.height != pPicture->iHeight - || m_output.dwidth != pPicture->iDisplayWidth - || m_output.dheight != pPicture->iDisplayHeight -- || m_output.framerate != config_framerate -+ || (!m_bFpsInvalid && fmod(m_output.framerate, config_framerate) != 0.0 ) - || m_output.color_format != (unsigned int)pPicture->format - || m_output.extended_format != pPicture->extended_format - || ( m_output.color_matrix != pPicture->color_matrix && pPicture->color_matrix != 0 ) // don't reconfigure on unspecified -@@ -1197,7 +1197,7 @@ int CDVDPlayerVideo::OutputPicture(const DVDVideoPicture* src, double pts) - m_output.height = pPicture->iHeight; - m_output.dwidth = pPicture->iDisplayWidth; - m_output.dheight = pPicture->iDisplayHeight; -- m_output.framerate = config_framerate; -+ m_output.framerate = config_framerate == 0.0 ? g_graphicsContext.GetFPS() : config_framerate; - m_output.color_format = pPicture->format; - m_output.extended_format = pPicture->extended_format; - m_output.color_matrix = pPicture->color_matrix; --- -1.8.1.6 - - -From d5540e46e039d6aa850a3134ad805f2a5fb1c947 Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Thu, 11 Oct 2012 12:05:50 +0200 -Subject: [PATCH 69/94] vdpau: advanced settings for auto deinterlacing - ---- - xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp | 8 ++++---- - xbmc/settings/AdvancedSettings.cpp | 4 ++++ - xbmc/settings/AdvancedSettings.h | 2 ++ - 3 files changed, 10 insertions(+), 4 deletions(-) - -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp -index 68cf36a..524efae 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp -@@ -1696,10 +1696,10 @@ EINTERLACEMETHOD CMixer::GetDeinterlacingMethod(bool log /* = false */) - if (method == VS_INTERLACEMETHOD_AUTO) - { - int deint = -1; --// if (m_config.outHeight >= 720) --// deint = g_advancedSettings.m_videoVDPAUdeintHD; --// else --// deint = g_advancedSettings.m_videoVDPAUdeintSD; -+ if (m_config.outHeight >= 720) -+ deint = g_advancedSettings.m_videoVDPAUdeintHD; -+ else -+ deint = g_advancedSettings.m_videoVDPAUdeintSD; - - if (deint != -1) - { -diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index 04a7c7c..0e68a80 100644 ---- a/xbmc/settings/AdvancedSettings.cpp -+++ b/xbmc/settings/AdvancedSettings.cpp -@@ -106,6 +106,8 @@ void CAdvancedSettings::Initialize() - m_videoAllowMpeg4VAAPI = false; - m_videoDisableBackgroundDeinterlace = false; - m_videoCaptureUseOcclusionQuery = -1; //-1 is auto detect -+ m_videoVDPAUdeintHD = -1; -+ m_videoVDPAUdeintSD = -1; - m_videoVDPAUtelecine = false; - m_videoVDPAUdeintSkipChromaHD = false; - m_DXVACheckCompatibility = false; -@@ -503,6 +505,8 @@ void CAdvancedSettings::ParseSettingsFile(const CStdString &file) - XMLUtils::GetBoolean(pElement,"allowmpeg4vaapi",m_videoAllowMpeg4VAAPI); - XMLUtils::GetBoolean(pElement, "disablebackgrounddeinterlace", m_videoDisableBackgroundDeinterlace); - XMLUtils::GetInt(pElement, "useocclusionquery", m_videoCaptureUseOcclusionQuery, -1, 1); -+ XMLUtils::GetInt(pElement,"vdpauHDdeint",m_videoVDPAUdeintHD); -+ XMLUtils::GetInt(pElement,"vdpauSDdeint",m_videoVDPAUdeintSD); - XMLUtils::GetBoolean(pElement,"vdpauInvTelecine",m_videoVDPAUtelecine); - XMLUtils::GetBoolean(pElement,"vdpauHDdeintSkipChroma",m_videoVDPAUdeintSkipChromaHD); - -diff --git a/xbmc/settings/AdvancedSettings.h b/xbmc/settings/AdvancedSettings.h -index 72718e5..aaa4702 100644 ---- a/xbmc/settings/AdvancedSettings.h -+++ b/xbmc/settings/AdvancedSettings.h -@@ -133,6 +133,8 @@ class CAdvancedSettings - int m_videoPercentSeekBackwardBig; - CStdString m_videoPPFFmpegDeint; - CStdString m_videoPPFFmpegPostProc; -+ int m_videoVDPAUdeintHD; -+ int m_videoVDPAUdeintSD; - bool m_videoVDPAUtelecine; - bool m_videoVDPAUdeintSkipChromaHD; - bool m_musicUseTimeSeeking; --- -1.8.1.6 - - -From c1360c2b0e3b49eb36a46425d3cc4231780d5156 Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Thu, 11 Oct 2012 13:01:08 +0200 -Subject: [PATCH 70/94] dvdplayer: correct determination if video is playing - ---- - xbmc/cores/dvdplayer/DVDPlayer.cpp | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp -index 21414ab..f7ede88 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayer.cpp -+++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp -@@ -2395,6 +2395,7 @@ bool CDVDPlayer::HasVideo() const - return m_HasVideo; - } - -+ - bool CDVDPlayer::HasAudio() const - { - return m_HasAudio; --- -1.8.1.6 - - -From a72371b3b3fab502a346a2e80896514be65780ba Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Fri, 2 Nov 2012 13:20:03 +0100 -Subject: [PATCH 71/94] player: fix rewind - ---- - xbmc/cores/dvdplayer/DVDMessage.h | 5 ++++- - xbmc/cores/dvdplayer/DVDPlayer.cpp | 30 +++++++++++++++++++----------- - xbmc/cores/dvdplayer/DVDPlayer.h | 7 ++++--- - xbmc/cores/dvdplayer/DVDPlayerVideo.cpp | 10 ++++++---- - xbmc/cores/dvdplayer/DVDPlayerVideo.h | 1 + - 5 files changed, 34 insertions(+), 19 deletions(-) - -diff --git a/xbmc/cores/dvdplayer/DVDMessage.h b/xbmc/cores/dvdplayer/DVDMessage.h -index 30b2f5c..b9831d4 100644 ---- a/xbmc/cores/dvdplayer/DVDMessage.h -+++ b/xbmc/cores/dvdplayer/DVDMessage.h -@@ -218,7 +218,7 @@ class CDVDMsgPlayerSetState : public CDVDMsg - class CDVDMsgPlayerSeek : public CDVDMsg - { - public: -- CDVDMsgPlayerSeek(int time, bool backward, bool flush = true, bool accurate = true, bool restore = true, bool trickplay = false) -+ CDVDMsgPlayerSeek(int time, bool backward, bool flush = true, bool accurate = true, bool restore = true, bool trickplay = false, bool sync = true) - : CDVDMsg(PLAYER_SEEK) - , m_time(time) - , m_backward(backward) -@@ -226,6 +226,7 @@ class CDVDMsgPlayerSeek : public CDVDMsg - , m_accurate(accurate) - , m_restore(restore) - , m_trickplay(trickplay) -+ , m_sync(sync) - {} - int GetTime() { return m_time; } - bool GetBackward() { return m_backward; } -@@ -233,6 +234,7 @@ class CDVDMsgPlayerSeek : public CDVDMsg - bool GetAccurate() { return m_accurate; } - bool GetRestore() { return m_restore; } - bool GetTrickPlay() { return m_trickplay; } -+ bool GetSync() { return m_sync; } - private: - int m_time; - bool m_backward; -@@ -240,6 +242,7 @@ class CDVDMsgPlayerSeek : public CDVDMsg - bool m_accurate; - bool m_restore; // whether to restore any EDL cut time - bool m_trickplay; -+ bool m_sync; - }; - - class CDVDMsgPlayerSeekChapter : public CDVDMsg -diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp -index f7ede88..2929db5 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayer.cpp -+++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp -@@ -1553,11 +1553,13 @@ void CDVDPlayer::HandlePlaySpeed() - } - else if (m_CurrentVideo.id >= 0 - && (m_CurrentVideo.inited == true || GetPlaySpeed() < 0) // allow rewind at end of file -- && m_SpeedState.lastpts != m_dvdPlayerVideo.GetCurrentPts() -+ && (m_SpeedState.lastpts != m_dvdPlayerVideo.GetCurrentPts() || fabs(m_SpeedState.lastabstime - CDVDClock::GetAbsoluteClock()) > DVD_MSEC_TO_TIME(200)) -+ && (m_dvdPlayerVideo.GetCurrentPts() != DVD_NOPTS_VALUE) - && m_SpeedState.lasttime != GetTime()) - { - m_SpeedState.lastpts = m_dvdPlayerVideo.GetCurrentPts(); - m_SpeedState.lasttime = GetTime(); -+ m_SpeedState.lastabstime = CDVDClock::GetAbsoluteClock(); - // check how much off clock video is when ff/rw:ing - // a problem here is that seeking isn't very accurate - // and since the clock will be resynced after seek -@@ -1576,7 +1578,7 @@ void CDVDPlayer::HandlePlaySpeed() - { - CLog::Log(LOGDEBUG, "CDVDPlayer::Process - Seeking to catch up"); - int64_t iTime = (int64_t)DVD_TIME_TO_MSEC(m_clock.GetClock() + m_State.time_offset + 500000.0 * m_playSpeed / DVD_PLAYSPEED_NORMAL); -- m_messenger.Put(new CDVDMsgPlayerSeek(iTime, (GetPlaySpeed() < 0), true, false, false, true)); -+ m_messenger.Put(new CDVDMsgPlayerSeek(iTime, (GetPlaySpeed() < 0), true, false, false, true, false)); - } - } - } -@@ -2040,7 +2042,7 @@ void CDVDPlayer::HandleMessages() - if(!m_pSubtitleDemuxer->SeekTime(time, msg.GetBackward())) - CLog::Log(LOGDEBUG, "failed to seek subtitle demuxer: %d, success", time); - } -- FlushBuffers(!msg.GetFlush(), start, msg.GetAccurate()); -+ FlushBuffers(!msg.GetFlush(), start, msg.GetAccurate(), msg.GetSync()); - } - else - CLog::Log(LOGWARNING, "error while seeking"); -@@ -2178,9 +2180,10 @@ void CDVDPlayer::HandleMessages() - double offset; - offset = CDVDClock::GetAbsoluteClock() - m_State.timestamp; - offset *= m_playSpeed / DVD_PLAYSPEED_NORMAL; -+ offset = DVD_TIME_TO_MSEC(offset); - if(offset > 1000) offset = 1000; - if(offset < -1000) offset = -1000; -- m_State.time += DVD_TIME_TO_MSEC(offset); -+ m_State.time += offset; - m_State.timestamp = CDVDClock::GetAbsoluteClock(); - } - -@@ -2196,7 +2199,8 @@ void CDVDPlayer::HandleMessages() - // do a seek after rewind, clock is not in sync with current pts - if (m_playSpeed < 0 && speed >= 0) - { -- m_messenger.Put(new CDVDMsgPlayerSeek(GetTime(), true, true, true)); -+ int64_t iTime = (int64_t)DVD_TIME_TO_MSEC(m_clock.GetClock() + m_State.time_offset); -+ m_messenger.Put(new CDVDMsgPlayerSeek(iTime, true, true, false, false, true)); - } - - // if playspeed is different then DVD_PLAYSPEED_NORMAL or DVD_PLAYSPEED_PAUSE -@@ -3145,7 +3149,7 @@ bool CDVDPlayer::CloseTeletextStream(bool bWaitForBuffers) - return true; - } - --void CDVDPlayer::FlushBuffers(bool queued, double pts, bool accurate) -+void CDVDPlayer::FlushBuffers(bool queued, double pts, bool accurate, bool sync) - { - double startpts; - if(accurate) -@@ -3157,19 +3161,23 @@ void CDVDPlayer::FlushBuffers(bool queued, double pts, bool accurate) - if(startpts != DVD_NOPTS_VALUE) - startpts -= m_offset_pts; - -- m_CurrentAudio.inited = false; -+ if (sync) -+ { -+ m_CurrentAudio.inited = false; -+ m_CurrentVideo.inited = false; -+ m_CurrentSubtitle.inited = false; -+ m_CurrentTeletext.inited = false; -+ } -+ - m_CurrentAudio.dts = DVD_NOPTS_VALUE; - m_CurrentAudio.startpts = startpts; - -- m_CurrentVideo.inited = false; - m_CurrentVideo.dts = DVD_NOPTS_VALUE; - m_CurrentVideo.startpts = startpts; - -- m_CurrentSubtitle.inited = false; - m_CurrentSubtitle.dts = DVD_NOPTS_VALUE; - m_CurrentSubtitle.startpts = startpts; - -- m_CurrentTeletext.inited = false; - m_CurrentTeletext.dts = DVD_NOPTS_VALUE; - m_CurrentTeletext.startpts = startpts; - -@@ -3213,7 +3221,7 @@ void CDVDPlayer::FlushBuffers(bool queued, double pts, bool accurate) - m_CurrentTeletext.started = false; - } - -- if(pts != DVD_NOPTS_VALUE) -+ if(pts != DVD_NOPTS_VALUE && sync) - m_clock.Discontinuity(pts); - UpdatePlayState(0); - } -diff --git a/xbmc/cores/dvdplayer/DVDPlayer.h b/xbmc/cores/dvdplayer/DVDPlayer.h -index ebe0ce8..d0a8bbc 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayer.h -+++ b/xbmc/cores/dvdplayer/DVDPlayer.h -@@ -310,7 +310,7 @@ class CDVDPlayer : public IPlayer, public CThread, public IDVDPlayer - bool GetCachingTimes(double& play_left, double& cache_left, double& file_offset); - - -- void FlushBuffers(bool queued, double pts = DVD_NOPTS_VALUE, bool accurate = true); -+ void FlushBuffers(bool queued, double pts = DVD_NOPTS_VALUE, bool accurate = true, bool sync = true); - - void HandleMessages(); - void HandlePlaySpeed(); -@@ -359,8 +359,9 @@ class CDVDPlayer : public IPlayer, public CThread, public IDVDPlayer - int m_playSpeed; - struct SSpeedState - { -- double lastpts; // holds last display pts during ff/rw operations -- double lasttime; -+ double lastpts; // holds last display pts during ff/rw operations -+ int64_t lasttime; -+ double lastabstime; - } m_SpeedState; - - int m_errorCount; -diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -index 69f45d4..0434cb9 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -+++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -@@ -1281,13 +1281,13 @@ int CDVDPlayerVideo::OutputPicture(const DVDVideoPicture* src, double pts) - - if( m_speed < 0 ) - { -- double decoderPts = m_droppingStats.m_lastDecoderPts; -+ double inputPts = m_droppingStats.m_lastPts; - double renderPts = m_droppingStats.m_lastRenderPts; - if (pts > renderPts) - { -- if (decoderPts >= renderPts) -+ if (inputPts >= renderPts) - { -- Sleep(200); -+ Sleep(50); - } - return result | EOS_DROPPED; - } -@@ -1584,7 +1584,7 @@ double CDVDPlayerVideo::GetCurrentPts() - - if( m_stalled ) - iRenderPts = DVD_NOPTS_VALUE; -- else -+ else if ( m_speed == DVD_PLAYSPEED_NORMAL) - iRenderPts = iRenderPts - max(0.0, iSleepTime); - - return iRenderPts; -@@ -1684,6 +1684,8 @@ int CDVDPlayerVideo::CalcDropRequirement(double pts) - int iSkippedDeint = 0; - int iBufferLevel; - -+ m_droppingStats.m_lastPts = pts; -+ - // get decoder stats - if (!m_pVideoCodec->GetCodecStats(iDecoderPts, iSkippedDeint, interlaced)) - iDecoderPts = pts; -diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.h b/xbmc/cores/dvdplayer/DVDPlayerVideo.h -index 509d5f7..7cddda7 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayerVideo.h -+++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.h -@@ -51,6 +51,7 @@ class CDroppingStats - double m_totalGain; - double m_lastDecoderPts; - double m_lastRenderPts; -+ double m_lastPts; - unsigned int m_lateFrames; - unsigned int m_dropRequests; - bool m_requestOutputDrop; --- -1.8.1.6 - - -From c08ecf582faf1b75494f059f52f89fa8889ef70a Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Fri, 23 Nov 2012 17:41:12 +0100 -Subject: [PATCH 72/94] xrandr: fix query for multiple screens - ---- - xbmc/windowing/X11/XRandR.cpp | 10 ++++++---- - 1 file changed, 6 insertions(+), 4 deletions(-) - -diff --git a/xbmc/windowing/X11/XRandR.cpp b/xbmc/windowing/X11/XRandR.cpp -index cc933b9..533e03d 100644 ---- a/xbmc/windowing/X11/XRandR.cpp -+++ b/xbmc/windowing/X11/XRandR.cpp -@@ -57,12 +57,14 @@ bool CXRandR::Query(bool force) - - m_outputs.clear(); - // query all screens -+ // we are happy if at least one screen returns results -+ bool success = false; - for(unsigned int screennum=0; screennum -Date: Sun, 2 Dec 2012 15:46:55 +0100 -Subject: [PATCH 73/94] X11: add debug log to print out refresh after xrr event - ---- - xbmc/windowing/X11/WinSystemX11.cpp | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/xbmc/windowing/X11/WinSystemX11.cpp b/xbmc/windowing/X11/WinSystemX11.cpp -index ef83133..76c6362 100644 ---- a/xbmc/windowing/X11/WinSystemX11.cpp -+++ b/xbmc/windowing/X11/WinSystemX11.cpp -@@ -685,6 +685,12 @@ void CWinSystemX11::NotifyXRREvent() - XOutput *out = g_xrandr.GetOutput(currentOutput); - XMode mode = g_xrandr.GetCurrentMode(currentOutput); - -+ if (out) -+ CLog::Log(LOGDEBUG, "%s - current output: %s, mode: %s, refresh: %.3f", __FUNCTION__ -+ , out->name.c_str(), mode.id.c_str(), mode.hz); -+ else -+ CLog::Log(LOGWARNING, "%s - output name not set", __FUNCTION__); -+ - RESOLUTION_INFO res; - unsigned int i; - bool found(false); --- -1.8.1.6 - - -From 73bb3c6b3ab54579e37fc1d282ee6749a542578f Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Tue, 11 Dec 2012 11:08:13 +0100 -Subject: [PATCH 74/94] X11: dont call XCloseDisplay on shutdown, it crashes - when powered doen by cec on ATI - ---- - xbmc/windowing/X11/WinSystemX11.cpp | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/xbmc/windowing/X11/WinSystemX11.cpp b/xbmc/windowing/X11/WinSystemX11.cpp -index 76c6362..e4e25b2 100644 ---- a/xbmc/windowing/X11/WinSystemX11.cpp -+++ b/xbmc/windowing/X11/WinSystemX11.cpp -@@ -108,7 +108,8 @@ bool CWinSystemX11::DestroyWindowSystem() - //we don't call XCloseDisplay() here, since ati keeps a pointer to our m_dpy - //so instead we just let m_dpy die on exit - // i have seen core dumps on ATI if the display is not closed here -- XCloseDisplay(m_dpy); -+ // crashes when shutting down via cec -+// XCloseDisplay(m_dpy); - } - - // m_SDLSurface is free()'d by SDL_Quit(). --- -1.8.1.6 - - -From fd28b5d6cbb3f3e6e465b6c259793830b236c33e Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Gr=C3=A9gory=20Coutant?= -Date: Wed, 12 Dec 2012 19:49:47 +0100 -Subject: [PATCH 75/94] x11: support for multiple x screens - ---- - xbmc/windowing/X11/XRandR.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/xbmc/windowing/X11/XRandR.cpp b/xbmc/windowing/X11/XRandR.cpp -index 533e03d..7a16488 100644 ---- a/xbmc/windowing/X11/XRandR.cpp -+++ b/xbmc/windowing/X11/XRandR.cpp -@@ -92,7 +92,7 @@ bool CXRandR::Query(bool force, int screennum) - pclose(file); - - TiXmlElement *pRootElement = xmlDoc.RootElement(); -- if (strcasecmp(pRootElement->Value(), "screen") != screennum) -+ if (atoi(pRootElement->Attribute("id")) != screennum) - { - // TODO ERROR - return false; --- -1.8.1.6 - - -From 6face143a4f3c50b4a173fab49df3036eca044f0 Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Thu, 20 Dec 2012 19:35:38 +0100 -Subject: [PATCH 76/94] fix compile error after recent change - ---- - xbmc/settings/GUIWindowSettingsCategory.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/xbmc/settings/GUIWindowSettingsCategory.cpp b/xbmc/settings/GUIWindowSettingsCategory.cpp -index b9f18e4..cacb32a 100644 ---- a/xbmc/settings/GUIWindowSettingsCategory.cpp -+++ b/xbmc/settings/GUIWindowSettingsCategory.cpp -@@ -2453,7 +2453,7 @@ void CGUIWindowSettingsCategory::FillInMonitors(CStdString strSetting) - { - // we expect "videoscreen.monitor" but it might be hidden on some platforms, - // so check that we actually have a visable control. -- CBaseSettingControl *control = GetSetting(strSetting); -+ BaseSettingControlPtr control = GetSetting(strSetting); - if (control) - { - control->SetDelayed(); --- -1.8.1.6 - - -From 23667e3eaacb154198ebf6c99b41633af25ad31a Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Mon, 24 Dec 2012 16:02:42 +0100 -Subject: [PATCH 77/94] pvr: increase changes counter of stream on stream - change, cosmetics after dd307930d39d92f145a01a16600cd00e01ec39be - ---- - xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxPVRClient.cpp | 5 ++--- - 1 file changed, 2 insertions(+), 3 deletions(-) - -diff --git a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxPVRClient.cpp b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxPVRClient.cpp -index 8c984f6..034e545 100644 ---- a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxPVRClient.cpp -+++ b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxPVRClient.cpp -@@ -348,9 +348,7 @@ void CDVDDemuxPVRClient::RequestStreams() - if (stm) - { - st = dynamic_cast(stm); -- if (!st -- || (st->codec != (CodecID)props.stream[i].iCodecId) -- || (st->iChannels != props.stream[i].iChannels)) -+ if (!st || (st->codec != (CodecID)props.stream[i].iCodecId)) - DisposeStream(i); - } - if (!m_streams[i]) -@@ -367,6 +365,7 @@ void CDVDDemuxPVRClient::RequestStreams() - st->iBitsPerSample = props.stream[i].iBitsPerSample; - m_streams[i] = st; - st->m_parser_split = true; -+ st->changes++; - } - else if (props.stream[i].iCodecType == AVMEDIA_TYPE_VIDEO) - { --- -1.8.1.6 - - -From 117af2d5845fdbe7aef7952bffe4939b78f96483 Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Thu, 17 Jan 2013 16:03:22 +0100 -Subject: [PATCH 78/94] X11: add keymapping for XF86XK_Sleep - ---- - xbmc/windowing/WinEventsX11.cpp | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/xbmc/windowing/WinEventsX11.cpp b/xbmc/windowing/WinEventsX11.cpp -index c31877e..ed31c04 100644 ---- a/xbmc/windowing/WinEventsX11.cpp -+++ b/xbmc/windowing/WinEventsX11.cpp -@@ -143,6 +143,7 @@ - , {XK_Break, XBMCK_BREAK} - , {XK_Menu, XBMCK_MENU} - , {XF86XK_PowerOff, XBMCK_POWER} -+, {XF86XK_Sleep, XBMCK_SLEEP} - , {XK_EcuSign, XBMCK_EURO} - , {XK_Undo, XBMCK_UNDO} - /* Media keys */ --- -1.8.1.6 - - -From 983313a0eacdcf1a86ef95a7362388c0efad2564 Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Mon, 21 Jan 2013 09:00:19 +0100 -Subject: [PATCH 79/94] X11: remove toggle full screen after resume - ---- - xbmc/powermanagement/PowerManager.cpp | 5 ----- - 1 file changed, 5 deletions(-) - -diff --git a/xbmc/powermanagement/PowerManager.cpp b/xbmc/powermanagement/PowerManager.cpp -index a5534c9..7e2ddc6 100644 ---- a/xbmc/powermanagement/PowerManager.cpp -+++ b/xbmc/powermanagement/PowerManager.cpp -@@ -223,11 +223,6 @@ void CPowerManager::OnWake() - #if defined(_WIN32) - ShowWindow(g_hWnd,SW_RESTORE); - SetForegroundWindow(g_hWnd); --#elif !defined(TARGET_DARWIN_OSX) -- // Hack to reclaim focus, thus rehiding system mouse pointer. -- // Surely there's a better way? -- g_graphicsContext.ToggleFullScreenRoot(); -- g_graphicsContext.ToggleFullScreenRoot(); - #endif - } - g_application.ResetScreenSaver(); --- -1.8.1.6 - - -From 40654c21bfe1647b1d5ffc26ef31694b73bd8ce8 Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Wed, 23 Jan 2013 17:03:02 +0100 -Subject: [PATCH 80/94] xrandr: set screen on mode change command - ---- - xbmc/windowing/X11/XRandR.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/xbmc/windowing/X11/XRandR.cpp b/xbmc/windowing/X11/XRandR.cpp -index 7a16488..6531ba3 100644 ---- a/xbmc/windowing/X11/XRandR.cpp -+++ b/xbmc/windowing/X11/XRandR.cpp -@@ -246,7 +246,7 @@ bool CXRandR::SetMode(XOutput output, XMode mode) - m_currentMode = modeFound.id; - char cmd[255]; - if (getenv("XBMC_BIN_HOME")) -- snprintf(cmd, sizeof(cmd), "%s/xbmc-xrandr --output %s --mode %s", getenv("XBMC_BIN_HOME"), outputFound.name.c_str(), modeFound.id.c_str()); -+ snprintf(cmd, sizeof(cmd), "%s/xbmc-xrandr --screen %d --output %s --mode %s", getenv("XBMC_BIN_HOME"), outputFound.screen, outputFound.name.c_str(), modeFound.id.c_str()); - else - return false; - CLog::Log(LOGINFO, "XRANDR: %s", cmd); --- -1.8.1.6 - - -From 5720e3242b3e70472b1f6ff3088190bf5709344e Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Wed, 23 Jan 2013 17:03:39 +0100 -Subject: [PATCH 81/94] X11: recreate glx context when output changes - ---- - xbmc/windowing/X11/WinSystemX11.cpp | 6 +++--- - xbmc/windowing/X11/WinSystemX11.h | 2 +- - 2 files changed, 4 insertions(+), 4 deletions(-) - -diff --git a/xbmc/windowing/X11/WinSystemX11.cpp b/xbmc/windowing/X11/WinSystemX11.cpp -index e4e25b2..b87e264 100644 ---- a/xbmc/windowing/X11/WinSystemX11.cpp -+++ b/xbmc/windowing/X11/WinSystemX11.cpp -@@ -409,11 +409,11 @@ bool CWinSystemX11::IsSuitableVisual(XVisualInfo *vInfo) - return true; - } - --bool CWinSystemX11::RefreshGlxContext() -+bool CWinSystemX11::RefreshGlxContext(bool force) - { - bool retVal = false; - -- if (m_glContext) -+ if (m_glContext && !force) - { - CLog::Log(LOGDEBUG, "CWinSystemX11::RefreshGlxContext: refreshing context"); - glXMakeCurrent(m_dpy, None, NULL); -@@ -930,7 +930,7 @@ bool CWinSystemX11::SetWindow(int width, int height, bool fullscreen, const CStd - } - - CDirtyRegionList dr; -- RefreshGlxContext(); -+ RefreshGlxContext(!m_currentOutput.Equals(output)); - XSync(m_dpy, FALSE); - g_graphicsContext.Clear(0); - g_graphicsContext.Flip(dr); -diff --git a/xbmc/windowing/X11/WinSystemX11.h b/xbmc/windowing/X11/WinSystemX11.h -index 0b7c10a..33b1739 100644 ---- a/xbmc/windowing/X11/WinSystemX11.h -+++ b/xbmc/windowing/X11/WinSystemX11.h -@@ -74,7 +74,7 @@ class CWinSystemX11 : public CWinSystemBase - void NotifyMouseCoverage(bool covered); - - protected: -- bool RefreshGlxContext(); -+ bool RefreshGlxContext(bool force); - void CheckDisplayEvents(); - void OnLostDevice(); - bool SetWindow(int width, int height, bool fullscreen, const CStdString &output); --- -1.8.1.6 - - -From e2af52335ec96e115fb53eb2250be7eab7b0733f Mon Sep 17 00:00:00 2001 -From: unknown -Date: Fri, 18 Jan 2013 15:16:38 +0100 -Subject: [PATCH 82/94] multi-screen: fix compilation on windows - ---- - xbmc/settings/GUIWindowSettingsCategory.cpp | 11 ++++++++++- - 1 file changed, 10 insertions(+), 1 deletion(-) - -diff --git a/xbmc/settings/GUIWindowSettingsCategory.cpp b/xbmc/settings/GUIWindowSettingsCategory.cpp -index cacb32a..cbf0acb 100644 ---- a/xbmc/settings/GUIWindowSettingsCategory.cpp -+++ b/xbmc/settings/GUIWindowSettingsCategory.cpp -@@ -528,12 +528,14 @@ void CGUIWindowSettingsCategory::CreateSettings() - FillInRefreshRates(strSetting, g_guiSettings.GetResolution(), false); - continue; - } -+#if defined(HAS_GLX) - else if (strSetting.Equals("videoscreen.monitor")) - { - AddSetting(pSetting, group->GetWidth(), iControlID); - FillInMonitors(strSetting); - continue; - } -+#endif - else if (strSetting.Equals("lookandfeel.skintheme")) - { - AddSetting(pSetting, group->GetWidth(), iControlID); -@@ -1483,6 +1485,7 @@ void CGUIWindowSettingsCategory::OnSettingChanged(BaseSettingControlPtr pSetting - // Cascade - FillInResolutions("videoscreen.resolution", mode, RES_DESKTOP, true); - } -+#if defined(HAS_GLX) - else if (strSetting.Equals("videoscreen.monitor")) - { - CSettingString *pSettingString = (CSettingString *)pSettingControl->GetSetting(); -@@ -1497,6 +1500,7 @@ void CGUIWindowSettingsCategory::OnSettingChanged(BaseSettingControlPtr pSetting - FillInResolutions("videoscreen.resolution", mode, RES_DESKTOP, true); - } - } -+#endif - else if (strSetting.Equals("videoscreen.resolution")) - { - RESOLUTION nextRes = (RESOLUTION) g_guiSettings.GetInt("videoscreen.resolution"); -@@ -2451,6 +2455,7 @@ DisplayMode CGUIWindowSettingsCategory::FillInScreens(CStdString strSetting, RES - - void CGUIWindowSettingsCategory::FillInMonitors(CStdString strSetting) - { -+#if defined(HAS_GLX) - // we expect "videoscreen.monitor" but it might be hidden on some platforms, - // so check that we actually have a visable control. - BaseSettingControlPtr control = GetSetting(strSetting); -@@ -2476,6 +2481,7 @@ void CGUIWindowSettingsCategory::FillInMonitors(CStdString strSetting) - pControl->SetValue(currentMonitor); - g_guiSettings.SetString("videoscreen.monitor", g_settings.m_ResInfo[RES_DESKTOP].strOutput); - } -+#endif - } - - -@@ -2607,7 +2613,10 @@ void CGUIWindowSettingsCategory::OnRefreshRateChanged(RESOLUTION nextRes) - RESOLUTION lastRes = g_graphicsContext.GetVideoResolution(); - bool cancelled = false; - -- bool outputChanged = !g_Windowing.IsCurrentOutput(g_guiSettings.GetString("videoscreen.monitor")); -+ bool outputChanged = true; -+#if defined(HAS_GLX) -+ outputChanged = !g_Windowing.IsCurrentOutput(g_guiSettings.GetString("videoscreen.monitor")); -+#endif - - g_guiSettings.SetResolution(nextRes); - g_graphicsContext.SetVideoResolution(nextRes, outputChanged); --- -1.8.1.6 - - -From f37a312359b0ad0a4162c450fc4e6937773194f7 Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Fri, 14 Dec 2012 14:19:15 +0100 -Subject: [PATCH 83/94] pvr: do not show selection dialog for a single menu - hook - ---- - xbmc/pvr/addons/PVRClients.cpp | 19 +++++++++++-------- - 1 file changed, 11 insertions(+), 8 deletions(-) - -diff --git a/xbmc/pvr/addons/PVRClients.cpp b/xbmc/pvr/addons/PVRClients.cpp -index 6e772a4..9fd9537 100644 ---- a/xbmc/pvr/addons/PVRClients.cpp -+++ b/xbmc/pvr/addons/PVRClients.cpp -@@ -715,16 +715,19 @@ void CPVRClients::ProcessMenuHooks(int iClientID, PVR_MENUHOOK_CAT cat) - if (GetConnectedClient(iClientID, client) && client->HaveMenuHooks(cat)) - { - hooks = client->GetMenuHooks(); -- std::vector hookIDs; -+ int selection = 0; - -- CGUIDialogSelect* pDialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT); -- pDialog->Reset(); -- pDialog->SetHeading(19196); -- for (unsigned int i = 0; i < hooks->size(); i++) -- pDialog->Add(client->GetString(hooks->at(i).iLocalizedStringId)); -- pDialog->DoModal(); -+ if (hooks->size() > 1) -+ { -+ CGUIDialogSelect* pDialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT); -+ pDialog->Reset(); -+ pDialog->SetHeading(19196); -+ for (unsigned int i = 0; i < hooks->size(); i++) -+ pDialog->Add(client->GetString(hooks->at(i).iLocalizedStringId)); -+ pDialog->DoModal(); -+ selection = pDialog->GetSelectedLabel(); -+ } - -- int selection = pDialog->GetSelectedLabel(); - if (selection >= 0) - client->CallMenuHook(hooks->at(selection)); - } --- -1.8.1.6 - - -From d7ef98cc0e178d3b9bc1ca2ef0d4bcffdbaea756 Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Sun, 3 Feb 2013 08:17:16 +0100 -Subject: [PATCH 84/94] X11: use default screen parameters if no output - connected - ---- - xbmc/windowing/X11/WinSystemX11.cpp | 55 ++++++++++++++++++++++--------------- - 1 file changed, 33 insertions(+), 22 deletions(-) - -diff --git a/xbmc/windowing/X11/WinSystemX11.cpp b/xbmc/windowing/X11/WinSystemX11.cpp -index b87e264..3cadd13 100644 ---- a/xbmc/windowing/X11/WinSystemX11.cpp -+++ b/xbmc/windowing/X11/WinSystemX11.cpp -@@ -203,25 +203,27 @@ bool CWinSystemX11::SetFullScreen(bool fullScreen, RESOLUTION_INFO& res, bool bl - } - - XMode currmode = g_xrandr.GetCurrentMode(out.name); -- -- // flip h/w when rotated -- if (m_bIsRotated) -+ if (!currmode.name.empty()) - { -- int w = mode.w; -- mode.w = mode.h; -- mode.h = w; -- } -+ // flip h/w when rotated -+ if (m_bIsRotated) -+ { -+ int w = mode.w; -+ mode.w = mode.h; -+ mode.h = w; -+ } - -- // only call xrandr if mode changes -- if (currmode.w != mode.w || currmode.h != mode.h || -- currmode.hz != mode.hz || currmode.id != mode.id) -- { -- CLog::Log(LOGNOTICE, "CWinSystemX11::SetFullScreen - calling xrandr"); -- OnLostDevice(); -- m_bIsInternalXrr = true; -- g_xrandr.SetMode(out, mode); -- if (m_glWindow) -- return true; -+ // only call xrandr if mode changes -+ if (currmode.w != mode.w || currmode.h != mode.h || -+ currmode.hz != mode.hz || currmode.id != mode.id) -+ { -+ CLog::Log(LOGNOTICE, "CWinSystemX11::SetFullScreen - calling xrandr"); -+ OnLostDevice(); -+ m_bIsInternalXrr = true; -+ g_xrandr.SetMode(out, mode); -+ if (m_glWindow) -+ return true; -+ } - } - #endif - -@@ -268,9 +270,10 @@ void CWinSystemX11::UpdateResolutions() - else - #endif - { -- int x11screen = m_nScreen; -- int w = DisplayWidth(m_dpy, x11screen); -- int h = DisplayHeight(m_dpy, x11screen); -+ g_guiSettings.SetString("videoscreen.monitor", "Default"); -+ m_nScreen = DefaultScreen(m_dpy); -+ int w = DisplayWidth(m_dpy, m_nScreen); -+ int h = DisplayHeight(m_dpy, m_nScreen); - UpdateDesktopResolution(g_settings.m_ResInfo[RES_DESKTOP], 0, w, h, 0.0); - } - -@@ -819,11 +822,19 @@ bool CWinSystemX11::SetWindow(int width, int height, bool fullscreen, const CStd - Colormap cmap; - XSetWindowAttributes swa; - XVisualInfo *vi; -+ int x0 = 0; -+ int y0 = 0; - - XOutput *out = g_xrandr.GetOutput(output); - if (!out) - out = g_xrandr.GetOutput(m_currentOutput); -- m_nScreen = out->screen; -+ if (out) -+ { -+ m_nScreen = out->screen; -+ x0 = out->x; -+ y0 = out->y; -+ } -+ - vi = glXChooseVisual(m_dpy, m_nScreen, att); - cmap = XCreateColormap(m_dpy, RootWindow(m_dpy, vi->screen), vi->visual, AllocNone); - -@@ -842,7 +853,7 @@ bool CWinSystemX11::SetWindow(int width, int height, bool fullscreen, const CStd - unsigned long mask = CWBackPixel | CWBorderPixel | CWColormap | CWOverrideRedirect | CWEventMask; - - m_glWindow = XCreateWindow(m_dpy, RootWindow(m_dpy, vi->screen), -- out->x, out->y, width, height, 0, vi->depth, -+ x0, y0, width, height, 0, vi->depth, - InputOutput, vi->visual, - mask, &swa); - --- -1.8.1.6 - - -From 98bab351e15f230b4a0cae794ead4332e8a5d12c Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Mon, 25 Feb 2013 08:47:10 +0100 -Subject: [PATCH 85/94] vdpau: release more resources on pre-cleanup - ---- - xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp | 72 +++++++++++++++++++++++--- - xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.h | 2 + - 2 files changed, 68 insertions(+), 6 deletions(-) - -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp -index 524efae..38ef375 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp -@@ -1142,6 +1142,11 @@ void CMixer::Dispose() - m_dataPort.Purge(); - } - -+bool CMixer::IsActive() -+{ -+ return IsRunning(); -+} -+ - void CMixer::OnStartup() - { - CLog::Log(LOGNOTICE, "CMixer::OnStartup: Output Thread created"); -@@ -2455,6 +2460,7 @@ void COutput::StateMachine(int signal, Protocol *port, Message *msg) - return; - case COutputControlProtocol::PRECLEANUP: - Flush(); -+ PreCleanup(); - msg->Reply(COutputControlProtocol::ACC); - return; - default: -@@ -2661,15 +2667,18 @@ bool COutput::Uninit() - - void COutput::Flush() - { -- Message *reply; -- if (m_mixer.m_controlPort.SendOutMessageSync(CMixerControlProtocol::FLUSH, -+ if (m_mixer.IsActive()) -+ { -+ Message *reply; -+ if (m_mixer.m_controlPort.SendOutMessageSync(CMixerControlProtocol::FLUSH, - &reply, - 2000)) -- { -- reply->Release(); -+ { -+ reply->Release(); -+ } -+ else -+ CLog::Log(LOGERROR, "Coutput::%s - failed to flush mixer", __FUNCTION__); - } -- else -- CLog::Log(LOGERROR, "Coutput::%s - failed to flush mixer", __FUNCTION__); - - Message *msg; - while (m_mixer.m_dataPort.ReceiveInMessage(&msg)) -@@ -3008,6 +3017,57 @@ void COutput::ReleaseBufferPool() - } - } - -+void COutput::PreCleanup() -+{ -+ -+ VdpStatus vdp_st; -+ -+ m_mixer.Dispose(); -+ -+ CSingleLock lock(m_bufferPool.renderPicSec); -+ for (unsigned int i = 0; i < m_bufferPool.outputSurfaces.size(); ++i) -+ { -+ if (m_bufferPool.outputSurfaces[i] == VDP_INVALID_HANDLE) -+ continue; -+ -+ // check if output surface is in use -+ bool used = false; -+ std::deque::iterator it; -+ for (it = m_bufferPool.usedRenderPics.begin(); it != m_bufferPool.usedRenderPics.end(); ++it) -+ { -+ if (((*it)->sourceIdx == m_bufferPool.outputSurfaces[i]) && (*it)->valid) -+ { -+ used = true; -+ break; -+ } -+ } -+ if (used) -+ continue; -+ -+#ifdef GL_NV_vdpau_interop -+ // unmap surface -+ std::map::iterator it_map; -+ it_map = m_bufferPool.glOutputSurfaceMap.find(m_bufferPool.outputSurfaces[i]); -+ if (it_map == m_bufferPool.glOutputSurfaceMap.end()) -+ { -+ CLog::Log(LOGERROR, "%s - could not find gl surface", __FUNCTION__); -+ continue; -+ } -+ glVDPAUUnregisterSurfaceNV(it_map->second.glVdpauSurface); -+ glDeleteTextures(1, it_map->second.texture); -+ m_bufferPool.glOutputSurfaceMap.erase(it_map); -+#endif -+ -+ vdp_st = m_config.vdpProcs.vdp_output_surface_destroy(m_bufferPool.outputSurfaces[i]); -+ CheckStatus(vdp_st, __LINE__); -+ -+ m_bufferPool.outputSurfaces[i] = VDP_INVALID_HANDLE; -+ -+ CLog::Log(LOGDEBUG, "VDPAU::PreCleanup - released output surface"); -+ } -+ -+} -+ - void COutput::InitMixer() - { - for (unsigned int i = 0; i < m_bufferPool.outputSurfaces.size(); ++i) -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.h -index 471ad68..e33b6f5 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.h -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.h -@@ -286,6 +286,7 @@ class CMixer : private CThread - virtual ~CMixer(); - void Start(); - void Dispose(); -+ bool IsActive(); - CMixerControlProtocol m_controlPort; - CMixerDataProtocol m_dataPort; - protected: -@@ -454,6 +455,7 @@ class COutput : private CThread - bool DestroyGlxContext(); - bool EnsureBufferPool(); - void ReleaseBufferPool(); -+ void PreCleanup(); - void InitMixer(); - bool GLInit(); - void GLMapSurfaces(); --- -1.8.1.6 - - -From 7aa861a120b8eed5a94c3966a2dfafd513e81210 Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Tue, 5 Mar 2013 17:01:53 +0100 -Subject: [PATCH 86/94] LinuxRendererGL: do not upscale if source equals dest - ---- - xbmc/cores/VideoRenderers/LinuxRendererGL.cpp | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp b/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp -index 0bb924b..b5b0838 100644 ---- a/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp -+++ b/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp -@@ -860,6 +860,14 @@ void CLinuxRendererGL::UpdateVideoFilter() - m_scalingMethod = VS_SCALINGMETHOD_LINEAR; - } - -+ // no need to scale if source equals dest -+ bool scale = ((float)m_sourceHeight != m_destRect.Height()) || -+ ((float)m_sourceWidth != m_destRect.Width()); -+ if(!scale) -+ { -+ m_scalingMethod = VS_SCALINGMETHOD_LINEAR; -+ } -+ - if (m_pVideoFilterShader) - { - m_pVideoFilterShader->Free(); --- -1.8.1.6 - - -From 5ec02cfe6a7d215228640644d244851c605533af Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Wed, 6 Mar 2013 07:35:10 +0100 -Subject: [PATCH 87/94] vdpau: set deinterlacing method to auto, if default - method not supported - ---- - xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp -index 38ef375..b69ae8c 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp -@@ -2091,13 +2091,15 @@ void CMixer::InitCycle() - } - else - { -- CLog::Log(LOGERROR, "CMixer::%s - interlace method not supported", __FUNCTION__); -+ CLog::Log(LOGERROR, "CMixer::%s - interlace method: %d not supported, setting to AUTO", __FUNCTION__, method); - m_mixersteps = 1; - m_mixerfield = VDP_VIDEO_MIXER_PICTURE_STRUCTURE_FRAME; - m_mixerInput[1].DVDPic.format = RENDER_FMT_VDPAU; - m_mixerInput[1].DVDPic.iFlags &= ~(DVP_FLAG_TOP_FIELD_FIRST | - DVP_FLAG_REPEAT_TOP_FIELD | - DVP_FLAG_INTERLACED); -+ -+ g_settings.m_currentVideoSettings.m_InterlaceMethod = VS_INTERLACEMETHOD_AUTO; - } - } - else --- -1.8.1.6 - - -From 777f525eab06ebb5954da18e9ca31bc6cf5043ca Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Sat, 9 Mar 2013 14:04:15 +0100 -Subject: [PATCH 88/94] buffering: do not drop in RenderManager - ---- - xbmc/cores/VideoRenderers/RenderManager.cpp | 24 ++++++++++++------------ - 1 file changed, 12 insertions(+), 12 deletions(-) - -diff --git a/xbmc/cores/VideoRenderers/RenderManager.cpp b/xbmc/cores/VideoRenderers/RenderManager.cpp -index c99a555..bc764da 100644 ---- a/xbmc/cores/VideoRenderers/RenderManager.cpp -+++ b/xbmc/cores/VideoRenderers/RenderManager.cpp -@@ -1067,18 +1067,18 @@ void CXBMCRenderManager::PrepareNextRender() - - // look ahead in the queue - // if the next frame is already late, skip the one we are about to render -- while (idx != m_iOutputRenderBuffer) -- { -- int idx_next = (idx + 1) % m_iNumRenderBuffers; -- if (m_renderBuffers[idx_next].timestamp <= clocktime) -- { -- FlipRenderBuffer(); -- idx = GetNextRenderBufferIndex(); -- CLog::Log(LOGDEBUG,"%s - skip frame at render buffer index: %d", __FUNCTION__, idx); -- } -- else -- break; -- } -+// while (idx != m_iOutputRenderBuffer) -+// { -+// int idx_next = (idx + 1) % m_iNumRenderBuffers; -+// if (m_renderBuffers[idx_next].timestamp <= clocktime) -+// { -+// FlipRenderBuffer(); -+// idx = GetNextRenderBufferIndex(); -+// CLog::Log(LOGDEBUG,"%s - skip frame at render buffer index: %d", __FUNCTION__, idx); -+// } -+// else -+// break; -+// } - - double presenttime = m_renderBuffers[idx].timestamp; - --- -1.8.1.6 - - -From 15ec9232d554ce0100b54dbe4bde0b783de5ada2 Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Sun, 21 Apr 2013 09:19:34 +0200 -Subject: [PATCH 89/94] vdpau: fix deadlock if decoder is closed while refresh - rate changes - ---- - xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp -index b69ae8c..cd3507c 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp -@@ -171,6 +171,8 @@ void CDecoder::Close() - { - CLog::Log(LOGNOTICE, " (VDPAU) %s", __FUNCTION__); - -+ g_Windowing.Unregister(this); -+ - CSingleLock lock(m_DecoderSection); - - FiniVDPAUOutput(); -@@ -187,7 +189,6 @@ void CDecoder::Close() - free(render); - } - -- g_Windowing.Unregister(this); - m_dllAvUtil.Unload(); - } - --- -1.8.1.6 - - -From ccfc625faf40ba765d5af43646f44f5ca85e4821 Mon Sep 17 00:00:00 2001 -From: fritsch -Date: Sat, 12 Jan 2013 13:03:50 +0100 -Subject: [PATCH 90/94] dvdplayer: Allow multithread decoding for hi10p content - by default - -This allows decoding of some hi10p material on e.g. AMD Fusion with -both cores at the max. This introduces a new advancedsetting named -disablehi10pmultithreading to disable hi10p decoded multithreaded. ---- - .../dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp | 18 ++++++++++++++++-- - .../dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.h | 1 + - xbmc/settings/AdvancedSettings.cpp | 2 ++ - xbmc/settings/AdvancedSettings.h | 1 + - 4 files changed, 20 insertions(+), 2 deletions(-) - -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp -index fc51dbf..e90b3b9 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp -@@ -154,6 +154,7 @@ enum PixelFormat CDVDVideoCodecFFmpeg::GetFormat( struct AVCodecContext * avctx - m_iScreenHeight = 0; - m_iOrientation = 0; - m_bSoftware = false; -+ m_isHi10p = false; - m_pHardware = NULL; - m_iLastKeyframe = 0; - m_dts = DVD_NOPTS_VALUE; -@@ -204,7 +205,10 @@ bool CDVDVideoCodecFFmpeg::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options - case FF_PROFILE_H264_HIGH_444_PREDICTIVE: - case FF_PROFILE_H264_HIGH_444_INTRA: - case FF_PROFILE_H264_CAVLC_444: -+ // this is needed to not open the decoders - m_bSoftware = true; -+ // this we need to enable multithreading for hi10p via advancedsettings -+ m_isHi10p = true; - break; - } - } -@@ -277,8 +281,18 @@ bool CDVDVideoCodecFFmpeg::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options - m_pCodecContext->codec_tag = hints.codec_tag; - /* Only allow slice threading, since frame threading is more - * sensitive to changes in frame sizes, and it causes crashes -- * during HW accell */ -- m_pCodecContext->thread_type = FF_THREAD_SLICE; -+ * during HW accell - so we unset it in this case. -+ * -+ * When we detect Hi10p and user did not disable hi10pmultithreading -+ * via advancedsettings.xml we keep the ffmpeg default thread type. -+ * */ -+ if(m_isHi10p && !g_advancedSettings.m_videoDisableHi10pMultithreading) -+ { -+ CLog::Log(LOGDEBUG,"CDVDVideoCodecFFmpeg::Open() Keep default threading for Hi10p: %d", -+ m_pCodecContext->thread_type); -+ } -+ else -+ m_pCodecContext->thread_type = FF_THREAD_SLICE; - - #if defined(TARGET_DARWIN_IOS) - // ffmpeg with enabled neon will crash and burn if this is enabled -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.h -index 17a12d0..ce3c1f7 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.h -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.h -@@ -116,6 +116,7 @@ class CDVDVideoCodecFFmpeg : public CDVDVideoCodec - - std::string m_name; - bool m_bSoftware; -+ bool m_isHi10p; - IHardwareDecoder *m_pHardware; - int m_iLastKeyframe; - double m_dts; -diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index 0e68a80..d390ec7 100644 ---- a/xbmc/settings/AdvancedSettings.cpp -+++ b/xbmc/settings/AdvancedSettings.cpp -@@ -116,6 +116,7 @@ void CAdvancedSettings::Initialize() - m_DXVANoDeintProcForProgressive = false; - m_videoFpsDetect = 1; - m_videoDefaultLatency = 0.0; -+ m_videoDisableHi10pMultithreading = false; - - m_musicUseTimeSeeking = true; - m_musicTimeSeekForward = 10; -@@ -502,6 +503,7 @@ void CAdvancedSettings::ParseSettingsFile(const CStdString &file) - XMLUtils::GetBoolean(pElement,"enablehighqualityhwscalers", m_videoEnableHighQualityHwScalers); - XMLUtils::GetFloat(pElement,"autoscalemaxfps",m_videoAutoScaleMaxFps, 0.0f, 1000.0f); - XMLUtils::GetBoolean(pElement,"allowmpeg4vdpau",m_videoAllowMpeg4VDPAU); -+ XMLUtils::GetBoolean(pElement,"disablehi10pmultithreading",m_videoDisableHi10pMultithreading); - XMLUtils::GetBoolean(pElement,"allowmpeg4vaapi",m_videoAllowMpeg4VAAPI); - XMLUtils::GetBoolean(pElement, "disablebackgrounddeinterlace", m_videoDisableBackgroundDeinterlace); - XMLUtils::GetInt(pElement, "useocclusionquery", m_videoCaptureUseOcclusionQuery, -1, 1); -diff --git a/xbmc/settings/AdvancedSettings.h b/xbmc/settings/AdvancedSettings.h -index aaa4702..863e4f3 100644 ---- a/xbmc/settings/AdvancedSettings.h -+++ b/xbmc/settings/AdvancedSettings.h -@@ -168,6 +168,7 @@ class CAdvancedSettings - bool m_DXVAForceProcessorRenderer; - bool m_DXVANoDeintProcForProgressive; - int m_videoFpsDetect; -+ bool m_videoDisableHi10pMultithreading; - - CStdString m_videoDefaultPlayer; - CStdString m_videoDefaultDVDPlayer; --- -1.8.1.6 - - -From 946eeb7e6785d0faa254e1dc8e4479a0e4a7bf7c Mon Sep 17 00:00:00 2001 -From: Bob van Loosen -Date: Tue, 14 May 2013 12:28:45 +0200 -Subject: [PATCH 91/94] fixed: when doing a format conversion from float to 32 - bit int, multiply with INT32_MAX - 127, since this is the maximum value that - can be stored in 32 bit float and int, if INT32_MAX gets converted to float, - it gets rounded to INT32_MAX + 1 which can cause wrap around distortion - ---- - xbmc/cores/AudioEngine/Utils/AEConvert.cpp | 32 +++++++++++++++++------------- - 1 file changed, 18 insertions(+), 14 deletions(-) - -diff --git a/xbmc/cores/AudioEngine/Utils/AEConvert.cpp b/xbmc/cores/AudioEngine/Utils/AEConvert.cpp -index 2e4da19..e57530e 100644 ---- a/xbmc/cores/AudioEngine/Utils/AEConvert.cpp -+++ b/xbmc/cores/AudioEngine/Utils/AEConvert.cpp -@@ -922,17 +922,21 @@ unsigned int CAEConvert::Float_S24NE3(float *data, const unsigned int samples, u - return samples * 3; - } - -+//float can't store INT32_MAX, it gets rounded up to INT32_MAX + 1 -+//INT32_MAX - 127 is the maximum value that can exactly be stored in both 32 bit float and int -+#define MUL32 ((float)(INT32_MAX - 127)) -+ - unsigned int CAEConvert::Float_S32LE(float *data, const unsigned int samples, uint8_t *dest) - { - int32_t *dst = (int32_t*)dest; - #ifdef __SSE__ -- const __m128 mul = _mm_set_ps1((float)INT32_MAX); -+ const __m128 mul = _mm_set_ps1(MUL32); - unsigned int count = samples; - - /* work around invalid alignment */ - while ((((uintptr_t)data & 0xF) || ((uintptr_t)dest & 0xF)) && count > 0) - { -- dst[0] = safeRound(data[0] * (float)INT32_MAX); -+ dst[0] = safeRound(data[0] * MUL32); - ++data; - ++dst; - --count; -@@ -955,7 +959,7 @@ unsigned int CAEConvert::Float_S32LE(float *data, const unsigned int samples, ui - const uint32_t odd = samples - even; - if (odd == 1) - { -- dst[0] = safeRound(data[0] * (float)INT32_MAX); -+ dst[0] = safeRound(data[0] * MUL32); - dst[0] = Endian_SwapLE32(dst[0]); - } - else -@@ -988,7 +992,7 @@ unsigned int CAEConvert::Float_S32LE(float *data, const unsigned int samples, ui - /* no SIMD */ - for (uint32_t i = 0; i < samples; ++i, ++data, ++dst) - { -- dst[0] = safeRound(data[0] * (float)INT32_MAX); -+ dst[0] = safeRound(data[0] * MUL32); - dst[0] = Endian_SwapLE32(dst[0]); - } - #endif -@@ -1002,7 +1006,7 @@ unsigned int CAEConvert::Float_S32LE_Neon(float *data, const unsigned int sample - int32_t *dst = (int32_t*)dest; - for (float *end = data + (samples & ~0x3); data < end; data += 4, dst += 4) - { -- float32x4_t val = vmulq_n_f32(vld1q_f32((const float32_t *)data), INT32_MAX); -+ float32x4_t val = vmulq_n_f32(vld1q_f32((const float32_t *)data), MUL32); - int32x4_t ret = vcvtq_s32_f32(val); - #ifdef __BIG_ENDIAN__ - ret = vrev64q_s32(ret); -@@ -1012,7 +1016,7 @@ unsigned int CAEConvert::Float_S32LE_Neon(float *data, const unsigned int sample - - if (samples & 0x2) - { -- float32x2_t val = vmul_n_f32(vld1_f32((const float32_t *)data), INT32_MAX); -+ float32x2_t val = vmul_n_f32(vld1_f32((const float32_t *)data), MUL32); - int32x2_t ret = vcvt_s32_f32(val); - #ifdef __BIG_ENDIAN__ - ret = vrev64_s32(ret); -@@ -1024,7 +1028,7 @@ unsigned int CAEConvert::Float_S32LE_Neon(float *data, const unsigned int sample - - if (samples & 0x1) - { -- dst[0] = safeRound(data[0] * (float)INT32_MAX); -+ dst[0] = safeRound(data[0] * MUL32); - dst[0] = Endian_SwapLE32(dst[0]); - } - #endif -@@ -1035,13 +1039,13 @@ unsigned int CAEConvert::Float_S32BE(float *data, const unsigned int samples, ui - { - int32_t *dst = (int32_t*)dest; - #ifdef __SSE__ -- const __m128 mul = _mm_set_ps1((float)INT32_MAX); -+ const __m128 mul = _mm_set_ps1(MUL32); - unsigned int count = samples; - - /* work around invalid alignment */ - while ((((uintptr_t)data & 0xF) || ((uintptr_t)dest & 0xF)) && count > 0) - { -- dst[0] = safeRound(data[0] * (float)INT32_MAX); -+ dst[0] = safeRound(data[0] * MUL32); - ++data; - ++dst; - --count; -@@ -1064,7 +1068,7 @@ unsigned int CAEConvert::Float_S32BE(float *data, const unsigned int samples, ui - const uint32_t odd = samples - even; - if (odd == 1) - { -- dst[0] = safeRound(data[0] * (float)INT32_MAX); -+ dst[0] = safeRound(data[0] * MUL32); - dst[0] = Endian_SwapBE32(dst[0]); - } - else -@@ -1096,7 +1100,7 @@ unsigned int CAEConvert::Float_S32BE(float *data, const unsigned int samples, ui - /* no SIMD */ - for (uint32_t i = 0; i < samples; ++i, ++data, ++dst) - { -- dst[0] = safeRound(data[0] * (float)INT32_MAX); -+ dst[0] = safeRound(data[0] * MUL32); - dst[0] = Endian_SwapBE32(dst[0]); - } - #endif -@@ -1110,7 +1114,7 @@ unsigned int CAEConvert::Float_S32BE_Neon(float *data, const unsigned int sample - int32_t *dst = (int32_t*)dest; - for (float *end = data + (samples & ~0x3); data < end; data += 4, dst += 4) - { -- float32x4_t val = vmulq_n_f32(vld1q_f32((const float32_t *)data), INT32_MAX); -+ float32x4_t val = vmulq_n_f32(vld1q_f32((const float32_t *)data), MUL32); - int32x4_t ret = vcvtq_s32_f32(val); - #ifndef __BIG_ENDIAN__ - ret = vrev64q_s32(ret); -@@ -1120,7 +1124,7 @@ unsigned int CAEConvert::Float_S32BE_Neon(float *data, const unsigned int sample - - if (samples & 0x2) - { -- float32x2_t val = vmul_n_f32(vld1_f32((const float32_t *)data), INT32_MAX); -+ float32x2_t val = vmul_n_f32(vld1_f32((const float32_t *)data), MUL32); - int32x2_t ret = vcvt_s32_f32(val); - #ifndef __BIG_ENDIAN__ - ret = vrev64_s32(ret); -@@ -1132,7 +1136,7 @@ unsigned int CAEConvert::Float_S32BE_Neon(float *data, const unsigned int sample - - if (samples & 0x1) - { -- dst[0] = safeRound(data[0] * (float)INT32_MAX); -+ dst[0] = safeRound(data[0] * MUL32); - dst[0] = Endian_SwapBE32(dst[0]); - } - #endif --- -1.8.1.6 - - -From 3b836009536642941d58d1f21d21ea7599854d75 Mon Sep 17 00:00:00 2001 -From: Bob van Loosen -Date: Tue, 14 May 2013 18:43:01 +0200 -Subject: [PATCH 92/94] rename: MUL32 -> AE_MUL32 - ---- - xbmc/cores/AudioEngine/Utils/AEConvert.cpp | 30 +++++++++++++++--------------- - 1 file changed, 15 insertions(+), 15 deletions(-) - -diff --git a/xbmc/cores/AudioEngine/Utils/AEConvert.cpp b/xbmc/cores/AudioEngine/Utils/AEConvert.cpp -index e57530e..a6ac060 100644 ---- a/xbmc/cores/AudioEngine/Utils/AEConvert.cpp -+++ b/xbmc/cores/AudioEngine/Utils/AEConvert.cpp -@@ -924,19 +924,19 @@ unsigned int CAEConvert::Float_S24NE3(float *data, const unsigned int samples, u - - //float can't store INT32_MAX, it gets rounded up to INT32_MAX + 1 - //INT32_MAX - 127 is the maximum value that can exactly be stored in both 32 bit float and int --#define MUL32 ((float)(INT32_MAX - 127)) -+#define AE_MUL32 ((float)(INT32_MAX - 127)) - - unsigned int CAEConvert::Float_S32LE(float *data, const unsigned int samples, uint8_t *dest) - { - int32_t *dst = (int32_t*)dest; - #ifdef __SSE__ -- const __m128 mul = _mm_set_ps1(MUL32); -+ const __m128 mul = _mm_set_ps1(AE_MUL32); - unsigned int count = samples; - - /* work around invalid alignment */ - while ((((uintptr_t)data & 0xF) || ((uintptr_t)dest & 0xF)) && count > 0) - { -- dst[0] = safeRound(data[0] * MUL32); -+ dst[0] = safeRound(data[0] * AE_MUL32); - ++data; - ++dst; - --count; -@@ -959,7 +959,7 @@ unsigned int CAEConvert::Float_S32LE(float *data, const unsigned int samples, ui - const uint32_t odd = samples - even; - if (odd == 1) - { -- dst[0] = safeRound(data[0] * MUL32); -+ dst[0] = safeRound(data[0] * AE_MUL32); - dst[0] = Endian_SwapLE32(dst[0]); - } - else -@@ -992,7 +992,7 @@ unsigned int CAEConvert::Float_S32LE(float *data, const unsigned int samples, ui - /* no SIMD */ - for (uint32_t i = 0; i < samples; ++i, ++data, ++dst) - { -- dst[0] = safeRound(data[0] * MUL32); -+ dst[0] = safeRound(data[0] * AE_MUL32); - dst[0] = Endian_SwapLE32(dst[0]); - } - #endif -@@ -1006,7 +1006,7 @@ unsigned int CAEConvert::Float_S32LE_Neon(float *data, const unsigned int sample - int32_t *dst = (int32_t*)dest; - for (float *end = data + (samples & ~0x3); data < end; data += 4, dst += 4) - { -- float32x4_t val = vmulq_n_f32(vld1q_f32((const float32_t *)data), MUL32); -+ float32x4_t val = vmulq_n_f32(vld1q_f32((const float32_t *)data), AE_MUL32); - int32x4_t ret = vcvtq_s32_f32(val); - #ifdef __BIG_ENDIAN__ - ret = vrev64q_s32(ret); -@@ -1016,7 +1016,7 @@ unsigned int CAEConvert::Float_S32LE_Neon(float *data, const unsigned int sample - - if (samples & 0x2) - { -- float32x2_t val = vmul_n_f32(vld1_f32((const float32_t *)data), MUL32); -+ float32x2_t val = vmul_n_f32(vld1_f32((const float32_t *)data), AE_MUL32); - int32x2_t ret = vcvt_s32_f32(val); - #ifdef __BIG_ENDIAN__ - ret = vrev64_s32(ret); -@@ -1028,7 +1028,7 @@ unsigned int CAEConvert::Float_S32LE_Neon(float *data, const unsigned int sample - - if (samples & 0x1) - { -- dst[0] = safeRound(data[0] * MUL32); -+ dst[0] = safeRound(data[0] * AE_MUL32); - dst[0] = Endian_SwapLE32(dst[0]); - } - #endif -@@ -1039,13 +1039,13 @@ unsigned int CAEConvert::Float_S32BE(float *data, const unsigned int samples, ui - { - int32_t *dst = (int32_t*)dest; - #ifdef __SSE__ -- const __m128 mul = _mm_set_ps1(MUL32); -+ const __m128 mul = _mm_set_ps1(AE_MUL32); - unsigned int count = samples; - - /* work around invalid alignment */ - while ((((uintptr_t)data & 0xF) || ((uintptr_t)dest & 0xF)) && count > 0) - { -- dst[0] = safeRound(data[0] * MUL32); -+ dst[0] = safeRound(data[0] * AE_MUL32); - ++data; - ++dst; - --count; -@@ -1068,7 +1068,7 @@ unsigned int CAEConvert::Float_S32BE(float *data, const unsigned int samples, ui - const uint32_t odd = samples - even; - if (odd == 1) - { -- dst[0] = safeRound(data[0] * MUL32); -+ dst[0] = safeRound(data[0] * AE_MUL32); - dst[0] = Endian_SwapBE32(dst[0]); - } - else -@@ -1100,7 +1100,7 @@ unsigned int CAEConvert::Float_S32BE(float *data, const unsigned int samples, ui - /* no SIMD */ - for (uint32_t i = 0; i < samples; ++i, ++data, ++dst) - { -- dst[0] = safeRound(data[0] * MUL32); -+ dst[0] = safeRound(data[0] * AE_MUL32); - dst[0] = Endian_SwapBE32(dst[0]); - } - #endif -@@ -1114,7 +1114,7 @@ unsigned int CAEConvert::Float_S32BE_Neon(float *data, const unsigned int sample - int32_t *dst = (int32_t*)dest; - for (float *end = data + (samples & ~0x3); data < end; data += 4, dst += 4) - { -- float32x4_t val = vmulq_n_f32(vld1q_f32((const float32_t *)data), MUL32); -+ float32x4_t val = vmulq_n_f32(vld1q_f32((const float32_t *)data), AE_MUL32); - int32x4_t ret = vcvtq_s32_f32(val); - #ifndef __BIG_ENDIAN__ - ret = vrev64q_s32(ret); -@@ -1124,7 +1124,7 @@ unsigned int CAEConvert::Float_S32BE_Neon(float *data, const unsigned int sample - - if (samples & 0x2) - { -- float32x2_t val = vmul_n_f32(vld1_f32((const float32_t *)data), MUL32); -+ float32x2_t val = vmul_n_f32(vld1_f32((const float32_t *)data), AE_MUL32); - int32x2_t ret = vcvt_s32_f32(val); - #ifndef __BIG_ENDIAN__ - ret = vrev64_s32(ret); -@@ -1136,7 +1136,7 @@ unsigned int CAEConvert::Float_S32BE_Neon(float *data, const unsigned int sample - - if (samples & 0x1) - { -- dst[0] = safeRound(data[0] * MUL32); -+ dst[0] = safeRound(data[0] * AE_MUL32); - dst[0] = Endian_SwapBE32(dst[0]); - } - #endif --- -1.8.1.6 - - -From b023eb13b42a5bc02ee2a58b40463a6da0bf445f Mon Sep 17 00:00:00 2001 -From: Rainer Hochecker -Date: Sat, 11 May 2013 11:35:08 +0200 -Subject: [PATCH 93/94] Linux: fix handling of zombie processes - ---- - xbmc/Util.cpp | 11 ++++++++++- - xbmc/main/main.cpp | 7 ------- - 2 files changed, 10 insertions(+), 8 deletions(-) - -diff --git a/xbmc/Util.cpp b/xbmc/Util.cpp -index a503ee5..e5cd053 100644 ---- a/xbmc/Util.cpp -+++ b/xbmc/Util.cpp -@@ -1632,6 +1632,15 @@ bool CUtil::Command(const CStdStringArray& arrArgs, bool waitExit) - int n = 0; - if (child == 0) - { -+ if (!waitExit) -+ { -+ // fork again in order not to leave a zombie process -+ child = fork(); -+ if (child == -1) -+ _exit(2); -+ else if (child != 0) -+ _exit(0); -+ } - close(0); - close(1); - close(2); -@@ -1646,7 +1655,7 @@ bool CUtil::Command(const CStdStringArray& arrArgs, bool waitExit) - } - else - { -- if (waitExit) waitpid(child, &n, 0); -+ waitpid(child, &n, 0); - } - - return (waitExit) ? (WEXITSTATUS(n) == 0) : true; -diff --git a/xbmc/main/main.cpp b/xbmc/main/main.cpp -index 8fe4226..81181a0 100644 ---- a/xbmc/main/main.cpp -+++ b/xbmc/main/main.cpp -@@ -66,13 +66,6 @@ int main(int argc, char* argv[]) - if (setrlimit(RLIMIT_CORE, &rlim) == -1) - CLog::Log(LOGDEBUG, "Failed to set core size limit (%s)", strerror(errno)); - #endif -- // Prevent child processes from becoming zombies on exit if not waited upon. See also Util::Command -- struct sigaction sa; -- memset(&sa, 0, sizeof(sa)); -- -- sa.sa_flags = SA_NOCLDWAIT; -- sa.sa_handler = SIG_IGN; -- sigaction(SIGCHLD, &sa, NULL); - #endif - setlocale(LC_NUMERIC, "C"); - g_advancedSettings.Initialize(); --- -1.8.1.6 - - -From cc55dcbd5defc86375764896e4c09ad3e9e977b0 Mon Sep 17 00:00:00 2001 -From: Rainer Hochecker -Date: Tue, 21 May 2013 21:16:16 +0200 -Subject: [PATCH 94/94] rendermanager: fix waitin gon buffer if all are - displayed - ---- - xbmc/cores/VideoRenderers/RenderManager.cpp | 22 +++++++--------------- - 1 file changed, 7 insertions(+), 15 deletions(-) - -diff --git a/xbmc/cores/VideoRenderers/RenderManager.cpp b/xbmc/cores/VideoRenderers/RenderManager.cpp -index bc764da..77f6e15 100644 ---- a/xbmc/cores/VideoRenderers/RenderManager.cpp -+++ b/xbmc/cores/VideoRenderers/RenderManager.cpp -@@ -1065,21 +1065,6 @@ void CXBMCRenderManager::PrepareNextRender() - double clocktime = GetPresentTime(); - double frametime = 1 / g_graphicsContext.GetFPS(); - -- // look ahead in the queue -- // if the next frame is already late, skip the one we are about to render --// while (idx != m_iOutputRenderBuffer) --// { --// int idx_next = (idx + 1) % m_iNumRenderBuffers; --// if (m_renderBuffers[idx_next].timestamp <= clocktime) --// { --// FlipRenderBuffer(); --// idx = GetNextRenderBufferIndex(); --// CLog::Log(LOGDEBUG,"%s - skip frame at render buffer index: %d", __FUNCTION__, idx); --// } --// else --// break; --// } -- - double presenttime = m_renderBuffers[idx].timestamp; - - if(presenttime - clocktime > MAXPRESENTDELAY) -@@ -1137,6 +1122,13 @@ void CXBMCRenderManager::NotifyDisplayFlip() - int last = m_iDisplayedRenderBuffer; - m_iDisplayedRenderBuffer = (m_iCurrentRenderBuffer + m_iNumRenderBuffers - 1) % m_iNumRenderBuffers; - -+ // we have caught up with output so all buffers are re-usable -+ if (last != m_iDisplayedRenderBuffer -+ && m_iDisplayedRenderBuffer == m_iOutputRenderBuffer) -+ { -+ m_bAllRenderBuffersDisplayed = true; -+ } -+ - if (last != m_iDisplayedRenderBuffer - && m_iDisplayedRenderBuffer != m_iCurrentRenderBuffer) - { --- -1.8.1.6 - diff --git a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-995.10-disable-alt-tab.patch b/packages/mediacenter/xbmc/patches/12.2.0/xbmc-995.10-disable-alt-tab.patch deleted file mode 100644 index 2ee2b7a271..0000000000 --- a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-995.10-disable-alt-tab.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/xbmc/windowing/WinEventsX11.cpp b/xbmc/windowing/WinEventsX11.cpp -index ed31c04..34fcfae 100644 ---- a/xbmc/windowing/WinEventsX11.cpp -+++ b/xbmc/windowing/WinEventsX11.cpp -@@ -709,7 +709,6 @@ bool CWinEventsX11::ProcessShortcuts(XBMC_Event& event) - switch(event.key.keysym.sym) - { - case XBMCK_TAB: // ALT+TAB to minimize/hide -- g_application.Minimize(); - return true; - - default: diff --git a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-996.02-xbmc-revert-799d6ff03-setwakeup.sh.patch b/packages/mediacenter/xbmc/patches/12.2.0/xbmc-996.02-xbmc-revert-799d6ff03-setwakeup.sh.patch deleted file mode 100644 index b6ac52b114..0000000000 --- a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-996.02-xbmc-revert-799d6ff03-setwakeup.sh.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 7abb1f31a53cc0147ba6f5ed5fc796e2ac8584ff Mon Sep 17 00:00:00 2001 -From: Stefan Saraev -Date: Thu, 9 May 2013 21:11:47 +0300 -Subject: [PATCH] xbmc: revert 799d6ff03 (setwakeup.sh) - -this reverts upstream commit 799d6ff03 -https://github.com/xbmc/xbmc/commit/799d6ff03 ---- - xbmc/settings/GUISettings.cpp | 2 +- - 1 files changed, 1 insertions(+), 1 deletions(-) - -diff --git a/xbmc/settings/GUISettings.cpp b/xbmc/settings/GUISettings.cpp -index 67aeec9..96f738c 100644 ---- a/xbmc/settings/GUISettings.cpp -+++ b/xbmc/settings/GUISettings.cpp -@@ -1001,7 +1001,7 @@ void CGUISettings::Initialize() - AddBool(pvrpwr, "pvrpowermanagement.enabled", 305, false); - AddSeparator(pvrpwr, "pvrpowermanagement.sep1"); - AddInt(pvrpwr, "pvrpowermanagement.backendidletime", 19244, 15, 0, 5, 360, SPIN_CONTROL_INT_PLUS, MASK_MINS, TEXT_OFF); -- AddString(pvrpwr, "pvrpowermanagement.setwakeupcmd", 19245, "", EDIT_CONTROL_INPUT, true); -+ AddString(pvrpwr, "pvrpowermanagement.setwakeupcmd", 19245, "/usr/bin/setwakeup.sh", EDIT_CONTROL_INPUT, true); - AddInt(pvrpwr, "pvrpowermanagement.prewakeup", 19246, 15, 0, 1, 60, SPIN_CONTROL_INT_PLUS, MASK_MINS, TEXT_OFF); - AddSeparator(pvrpwr, "pvrpowermanagement.sep2"); - AddBool(pvrpwr, "pvrpowermanagement.dailywakeup", 19247, false); --- -1.7.2.5 - diff --git a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-996.03-add_as.xml_busy_dialog_delay_control.patch b/packages/mediacenter/xbmc/patches/12.2.0/xbmc-996.03-add_as.xml_busy_dialog_delay_control.patch deleted file mode 100644 index 8300e13296..0000000000 --- a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-996.03-add_as.xml_busy_dialog_delay_control.patch +++ /dev/null @@ -1,57 +0,0 @@ -diff -Naur xbmc-12.1.8/xbmc/cores/dvdplayer/DVDPlayer.cpp xbmc-12.1.8.patch/xbmc/cores/dvdplayer/DVDPlayer.cpp ---- xbmc-12.1.8/xbmc/cores/dvdplayer/DVDPlayer.cpp 2013-04-24 23:38:36.000000000 +0200 -+++ xbmc-12.1.8.patch/xbmc/cores/dvdplayer/DVDPlayer.cpp 2013-04-26 00:49:07.732011721 +0200 -@@ -470,7 +470,7 @@ - #endif - - Create(); -- if(!m_ready.WaitMSec(100)) -+ if(!m_ready.WaitMSec(g_advancedSettings.m_videoBusyDialogDelay_ms)) - { - CGUIDialogBusy* dialog = (CGUIDialogBusy*)g_windowManager.GetWindow(WINDOW_DIALOG_BUSY); - if(dialog) -diff -Naur xbmc-12.1.8/xbmc/cores/omxplayer/OMXPlayer.cpp xbmc-12.1.8.patch/xbmc/cores/omxplayer/OMXPlayer.cpp ---- xbmc-12.1.8/xbmc/cores/omxplayer/OMXPlayer.cpp 2013-04-24 23:38:36.000000000 +0200 -+++ xbmc-12.1.8.patch/xbmc/cores/omxplayer/OMXPlayer.cpp 2013-04-26 00:50:56.974691417 +0200 -@@ -474,7 +474,7 @@ - g_renderManager.PreInit(); - - Create(); -- if(!m_ready.WaitMSec(100)) -+ if(!m_ready.WaitMSec(g_advancedSettings.m_videoBusyDialogDelay_ms)) - { - CGUIDialogBusy* dialog = (CGUIDialogBusy*)g_windowManager.GetWindow(WINDOW_DIALOG_BUSY); - if(dialog) -diff -Naur xbmc-12.1.8/xbmc/settings/AdvancedSettings.cpp xbmc-12.1.8.patch/xbmc/settings/AdvancedSettings.cpp ---- xbmc-12.1.8/xbmc/settings/AdvancedSettings.cpp 2013-04-26 00:48:59.375036542 +0200 -+++ xbmc-12.1.8.patch/xbmc/settings/AdvancedSettings.cpp 2013-04-26 00:49:07.732011721 +0200 -@@ -111,6 +111,7 @@ - m_DXVAForceProcessorRenderer = true; - m_DXVANoDeintProcForProgressive = false; - m_videoFpsDetect = 1; -+ m_videoBusyDialogDelay_ms = 100; - m_videoDefaultLatency = 0.0; - m_videoDisableHi10pMultithreading = false; - -@@ -592,6 +593,10 @@ - //0 = disable fps detect, 1 = only detect on timestamps with uniform spacing, 2 detect on all timestamps - XMLUtils::GetInt(pElement, "fpsdetect", m_videoFpsDetect, 0, 2); - -+ // controls the delay, in milliseconds, until -+ // the busy dialog is shown when starting video playback. -+ XMLUtils::GetInt(pElement, "busydialogdelayms", m_videoBusyDialogDelay_ms, 0, 1000); -+ - // Store global display latency settings - TiXmlElement* pVideoLatency = pElement->FirstChildElement("latency"); - if (pVideoLatency) -diff -Naur xbmc-12.1.8/xbmc/settings/AdvancedSettings.h xbmc-12.1.8.patch/xbmc/settings/AdvancedSettings.h ---- xbmc-12.1.8/xbmc/settings/AdvancedSettings.h 2013-04-26 00:48:59.383036518 +0200 -+++ xbmc-12.1.8.patch/xbmc/settings/AdvancedSettings.h 2013-04-26 00:49:07.732011721 +0200 -@@ -165,6 +165,7 @@ - bool m_DXVANoDeintProcForProgressive; - int m_videoFpsDetect; - bool m_videoDisableHi10pMultithreading; -+ int m_videoBusyDialogDelay_ms; - - CStdString m_videoDefaultPlayer; - CStdString m_videoDefaultDVDPlayer; diff --git a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-997.01-audio-engine-fix-buffer-access.patch b/packages/mediacenter/xbmc/patches/12.2.0/xbmc-997.01-audio-engine-fix-buffer-access.patch deleted file mode 100644 index 15e294c59d..0000000000 --- a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-997.01-audio-engine-fix-buffer-access.patch +++ /dev/null @@ -1,746 +0,0 @@ -From 546fccdd835c5d4e2a1917839ed9d84bd4c53bc2 Mon Sep 17 00:00:00 2001 -From: Joakim Plate -Date: Sat, 1 Jun 2013 03:10:19 +0200 -Subject: [PATCH 1/6] dvdplayer: clock was starting before expected - ---- - xbmc/cores/dvdplayer/DVDClock.cpp | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/xbmc/cores/dvdplayer/DVDClock.cpp b/xbmc/cores/dvdplayer/DVDClock.cpp -index 9eb744f..b8cceeb 100644 ---- a/xbmc/cores/dvdplayer/DVDClock.cpp -+++ b/xbmc/cores/dvdplayer/DVDClock.cpp -@@ -233,7 +233,8 @@ double CDVDClock::SystemToPlaying(int64_t system) - { - m_startClock = system; - m_systemUsed = m_systemFrequency; -- m_pauseClock = 0; -+ if(m_pauseClock) -+ m_pauseClock = m_startClock; - m_iDisc = 0; - m_bReset = false; - } --- -1.7.10.4 - - -From c047cc15cd5dcc35bd951e2992cc303b0cbc9b83 Mon Sep 17 00:00:00 2001 -From: Joakim Plate -Date: Tue, 28 May 2013 01:00:19 +0200 -Subject: [PATCH 2/6] SoftAE: make sure we hold sink lock when we consume and - write to sink - -This make sure that sink delay and buffers are kept in line. - -Conflicts: - xbmc/cores/AudioEngine/Sinks/AESinkNULL.cpp ---- - xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.cpp | 78 +++++++++----------- - xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.h | 2 + - xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp | 6 +- - xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.cpp | 4 - - xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.cpp | 3 +- - xbmc/cores/AudioEngine/Sinks/AESinkOSS.cpp | 11 +++ - xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp | 16 +--- - 7 files changed, 52 insertions(+), 68 deletions(-) - -diff --git a/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.cpp b/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.cpp -index 983cd9a..ec6cc38 100644 ---- a/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.cpp -+++ b/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.cpp -@@ -1212,6 +1212,34 @@ bool CSoftAE::FinalizeSamples(float *buffer, unsigned int samples, bool hasAudio - return true; - } - -+unsigned int CSoftAE::WriteSink(CAEBuffer& src, uint8_t *data, bool hasAudio) -+{ -+ CExclusiveLock lock(m_sinkLock); /* lock to maintain delay consistency */ -+ while(m_sink) -+ { -+ int frames = m_sink->AddPackets(data, m_sinkFormat.m_frames, hasAudio); -+ -+ /* Return value of INT_MAX signals error in sink - restart */ -+ if (frames == INT_MAX) -+ { -+ CLog::Log(LOGERROR, "CSoftAE::WriteSink - sink error - reinit flagged"); -+ m_reOpen = true; -+ break; -+ } -+ -+ if (frames) -+ { -+ m_buffer.Shift(NULL, frames * m_sinkFormat.m_frameSize); -+ return frames; -+ } -+ -+ lock.Leave(); -+ Sleep((500 * m_sinkFormat.m_frames) / m_sinkFormat.m_sampleRate); -+ lock.Enter(); -+ } -+ return 0; -+} -+ - int CSoftAE::RunOutputStage(bool hasAudio) - { - const unsigned int needSamples = m_sinkFormat.m_frames * m_sinkFormat.m_channelLayout.Count(); -@@ -1222,7 +1250,6 @@ int CSoftAE::RunOutputStage(bool hasAudio) - void *data = m_buffer.Raw(needBytes); - hasAudio = FinalizeSamples((float*)data, needSamples, hasAudio); - -- int wroteFrames = 0; - if (m_convertFn) - { - const unsigned int convertedBytes = m_sinkFormat.m_frames * m_sinkFormat.m_frameSize; -@@ -1232,22 +1259,7 @@ int CSoftAE::RunOutputStage(bool hasAudio) - data = m_converted; - } - -- /* Output frames to sink */ -- if (m_sink) -- wroteFrames = m_sink->AddPackets((uint8_t*)data, m_sinkFormat.m_frames, hasAudio); -- -- /* Return value of INT_MAX signals error in sink - restart */ -- if (wroteFrames == INT_MAX) -- { -- CLog::Log(LOGERROR, "CSoftAE::RunOutputStage - sink error - reinit flagged"); -- wroteFrames = 0; -- m_reOpen = true; -- } -- -- if (wroteFrames) -- m_buffer.Shift(NULL, wroteFrames * m_sinkFormat.m_channelLayout.Count() * sizeof(float)); -- -- return wroteFrames; -+ return WriteSink(m_buffer, (uint8_t*)data, hasAudio); - } - - int CSoftAE::RunRawOutputStage(bool hasAudio) -@@ -1275,20 +1287,7 @@ int CSoftAE::RunRawOutputStage(bool hasAudio) - data = m_converted; - } - -- int wroteFrames = 0; -- if (m_sink) -- wroteFrames = m_sink->AddPackets((uint8_t *)data, m_sinkFormat.m_frames, hasAudio); -- -- /* Return value of INT_MAX signals error in sink - restart */ -- if (wroteFrames == INT_MAX) -- { -- CLog::Log(LOGERROR, "CSoftAE::RunRawOutputStage - sink error - reinit flagged"); -- wroteFrames = 0; -- m_reOpen = true; -- } -- -- m_buffer.Shift(NULL, wroteFrames * m_sinkFormat.m_frameSize); -- return wroteFrames; -+ return WriteSink(m_buffer, (uint8_t*)data, hasAudio); - } - - int CSoftAE::RunTranscodeStage(bool hasAudio) -@@ -1316,33 +1315,24 @@ int CSoftAE::RunTranscodeStage(bool hasAudio) - buffer = m_buffer.Raw(block); - - encodedFrames = m_encoder->Encode((float*)buffer, m_encoderFormat.m_frames); -- m_buffer.Shift(NULL, encodedFrames * m_encoderFormat.m_frameSize); - - uint8_t *packet; - unsigned int size = m_encoder->GetData(&packet); - -+ CExclusiveLock sinkLock(m_sinkLock); /* lock to maintain delay consistency */ -+ - /* if there is not enough space for another encoded packet enlarge the buffer */ - if (m_encodedBuffer.Free() < size) - m_encodedBuffer.ReAlloc(m_encodedBuffer.Used() + size); - -+ m_buffer.Shift(NULL, encodedFrames * m_encoderFormat.m_frameSize); - m_encodedBuffer.Push(packet, size); - } - - /* if we have enough data to write */ - if (m_encodedBuffer.Used() >= sinkBlock) -- { -- int wroteFrames = m_sink->AddPackets((uint8_t*)m_encodedBuffer.Raw(sinkBlock), m_sinkFormat.m_frames, hasAudio); -- -- /* Return value of INT_MAX signals error in sink - restart */ -- if (wroteFrames == INT_MAX) -- { -- CLog::Log(LOGERROR, "CSoftAE::RunTranscodeStage - sink error - reinit flagged"); -- wroteFrames = 0; -- m_reOpen = true; -- } -+ WriteSink(m_encodedBuffer, (uint8_t*)m_encodedBuffer.Raw(sinkBlock), hasAudio); - -- m_encodedBuffer.Shift(NULL, wroteFrames * m_sinkFormat.m_frameSize); -- } - return encodedFrames; - } - -diff --git a/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.h b/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.h -index 3ddf727..bb2769e 100644 ---- a/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.h -+++ b/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.h -@@ -246,5 +246,7 @@ private: - - void RemoveStream(StreamList &streams, CSoftAEStream *stream); - void PrintSinks(); -+ -+ unsigned int WriteSink(CAEBuffer& src, uint8_t *data, bool hasAudio); - }; - -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp -index 1da026e..6a66859 100644 ---- a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp -+++ b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp -@@ -523,11 +523,7 @@ unsigned int CAESinkALSA::AddPackets(uint8_t *data, unsigned int frames, bool ha - } - - if ((unsigned int)ret < frames) -- { -- ret = snd_pcm_wait(m_pcm, m_timeout); -- if (ret < 0) -- HandleError("snd_pcm_wait", ret); -- } -+ return 0; - - ret = snd_pcm_writei(m_pcm, (void*)data, frames); - if (ret < 0) -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.cpp -index 8f23b41..4853302 100644 ---- a/xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.cpp -+++ b/xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.cpp -@@ -209,10 +209,6 @@ unsigned int CAESinkAUDIOTRACK::AddPackets(uint8_t *data, unsigned int frames, b - break; - } - } -- // AddPackets runs under a non-idled AE thread we must block or sleep. -- // Trying to calc the optimal sleep is tricky so just a minimal sleep. -- Sleep(10); -- - return hasAudio ? write_frames:frames; - } - -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.cpp -index f6dc62f..00058ff 100644 ---- a/xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.cpp -+++ b/xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.cpp -@@ -384,7 +384,8 @@ unsigned int CAESinkDirectSound::AddPackets(uint8_t *data, unsigned int frames, - { - if (m_isDirtyDS) - return INT_MAX; -- Sleep(total * 1000 / m_AvgBytesPerSec); -+ else -+ return 0; - } - - while (len) -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkOSS.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkOSS.cpp -index 970e236..664c761 100644 ---- a/xbmc/cores/AudioEngine/Sinks/AESinkOSS.cpp -+++ b/xbmc/cores/AudioEngine/Sinks/AESinkOSS.cpp -@@ -29,6 +29,7 @@ - #include - - #include -+#include - - #if defined(OSS4) || defined(TARGET_FREEBSD) - #include -@@ -320,6 +321,13 @@ bool CAESinkOSS::Initialize(AEAudioFormat &format, std::string &device) - return false; - } - -+ if (fcntl(m_fd, F_SETFL, fcntl(m_fd, F_GETFL, 0) | O_NONBLOCK) == -1) -+ { -+ close(m_fd); -+ CLog::Log(LOGERROR, "CAESinkOSS::Initialize - Failed to set non blocking writes"); -+ return false; -+ } -+ - format.m_sampleRate = oss_sr; - format.m_frameSize = (CAEUtil::DataFormatToBits(format.m_dataFormat) >> 3) * format.m_channelLayout.Count(); - format.m_frames = bi.fragsize / format.m_frameSize; -@@ -412,6 +420,9 @@ unsigned int CAESinkOSS::AddPackets(uint8_t *data, unsigned int frames, bool has - int wrote = write(m_fd, data, size); - if (wrote < 0) - { -+ if(errno == EAGAIN || errno == EWOULDBLOCK) -+ return 0; -+ - CLog::Log(LOGERROR, "CAESinkOSS::AddPackets - Failed to write"); - return INT_MAX; - } -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp -index f238d75..89116fa 100644 ---- a/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp -+++ b/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp -@@ -485,22 +485,10 @@ unsigned int CAESinkWASAPI::AddPackets(uint8_t *data, unsigned int frames, bool - #endif - - /* Wait for Audio Driver to tell us it's got a buffer available */ -- DWORD eventAudioCallback = WaitForSingleObject(m_needDataEvent, 1100); -+ DWORD eventAudioCallback = WaitForSingleObject(m_needDataEvent, 0); - -- if (eventAudioCallback != WAIT_OBJECT_0 || !&buf) -- { -- /* Event handle timed out - flag sink as dirty for re-initializing */ -- CLog::Log(LOGERROR, __FUNCTION__": Endpoint Buffer timed out"); -- if (g_advancedSettings.m_streamSilence) -- { -- m_isDirty = true; //flag new device or re-init needed -- Deinitialize(); -- m_running = false; -- return INT_MAX; -- } -- m_running = false; -+ if (eventAudioCallback != WAIT_OBJECT_0) - return 0; -- } - - if (!m_running) - return 0; --- -1.7.10.4 - - -From 35502583cb7cd56a59e68e1514a2fccb63b2a1a2 Mon Sep 17 00:00:00 2001 -From: Joakim Plate -Date: Tue, 28 May 2013 01:03:08 +0200 -Subject: [PATCH 3/6] SoftAE: let SoftAEStream share SoftAE stream lock - -This avoids holding an internal stream lock, while soft ae -is trying to read out new frames and allow us to properly -hold lock while requesting delays. ---- - xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.cpp | 2 +- - .../AudioEngine/Engines/SoftAE/SoftAEStream.cpp | 51 +++++++++++++------- - .../AudioEngine/Engines/SoftAE/SoftAEStream.h | 4 +- - 3 files changed, 37 insertions(+), 20 deletions(-) - -diff --git a/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.cpp b/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.cpp -index ec6cc38..faf6ccc 100644 ---- a/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.cpp -+++ b/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.cpp -@@ -775,7 +775,7 @@ IAEStream *CSoftAE::MakeStream(enum AEDataFormat dataFormat, unsigned int sample - ASSERT(encodedSampleRate); - - CSingleLock streamLock(m_streamLock); -- CSoftAEStream *stream = new CSoftAEStream(dataFormat, sampleRate, encodedSampleRate, channelLayout, options); -+ CSoftAEStream *stream = new CSoftAEStream(dataFormat, sampleRate, encodedSampleRate, channelLayout, options, m_streamLock); - m_newStreams.push_back(stream); - streamLock.Leave(); - // this is really needed here -diff --git a/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAEStream.cpp b/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAEStream.cpp -index 4e8134b..12d00ea 100644 ---- a/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAEStream.cpp -+++ b/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAEStream.cpp -@@ -34,7 +34,8 @@ - - using namespace std; - --CSoftAEStream::CSoftAEStream(enum AEDataFormat dataFormat, unsigned int sampleRate, unsigned int encodedSampleRate, CAEChannelInfo channelLayout, unsigned int options) : -+CSoftAEStream::CSoftAEStream(enum AEDataFormat dataFormat, unsigned int sampleRate, unsigned int encodedSampleRate, CAEChannelInfo channelLayout, unsigned int options, CCriticalSection& lock) : -+ m_lock (lock ), - m_resampleRatio (1.0 ), - m_internalRatio (1.0 ), - m_convertBuffer (NULL ), -@@ -74,7 +75,8 @@ CSoftAEStream::CSoftAEStream(enum AEDataFormat dataFormat, unsigned int sampleRa - - void CSoftAEStream::InitializeRemap() - { -- CExclusiveLock lock(m_lock); -+ CSingleLock lock(m_lock); -+ - if (!AE_IS_RAW(m_initDataFormat)) - { - /* re-init the remappers */ -@@ -96,7 +98,8 @@ void CSoftAEStream::InitializeRemap() - - void CSoftAEStream::Initialize() - { -- CExclusiveLock lock(m_lock); -+ CSingleLock lock(m_lock); -+ - if (m_valid) - { - InternalFlush(); -@@ -213,14 +216,15 @@ void CSoftAEStream::Initialize() - - void CSoftAEStream::Destroy() - { -- CExclusiveLock lock(m_lock); -+ CSingleLock lock(m_lock); -+ - m_valid = false; - m_delete = true; - } - - CSoftAEStream::~CSoftAEStream() - { -- CExclusiveLock lock(m_lock); -+ CSingleLock lock(m_lock); - - InternalFlush(); - if (m_convert) -@@ -241,6 +245,8 @@ CSoftAEStream::~CSoftAEStream() - - unsigned int CSoftAEStream::GetSpace() - { -+ CSingleLock lock(m_lock); -+ - if (!m_valid || m_draining) - return 0; - -@@ -252,7 +258,8 @@ unsigned int CSoftAEStream::GetSpace() - - unsigned int CSoftAEStream::AddData(void *data, unsigned int size) - { -- CExclusiveLock lock(m_lock); -+ CSingleLock lock(m_lock); -+ - if (!m_valid || size == 0 || data == NULL) - return 0; - -@@ -415,7 +422,7 @@ unsigned int CSoftAEStream::ProcessFrameBuffer() - - uint8_t* CSoftAEStream::GetFrame() - { -- CExclusiveLock lock(m_lock); -+ CSingleLock lock(m_lock); - - /* if we are fading, this runs even if we have underrun as it is time based */ - if (m_fadeRunning) -@@ -486,6 +493,8 @@ uint8_t* CSoftAEStream::GetFrame() - - double CSoftAEStream::GetDelay() - { -+ CSingleLock lock(m_lock); -+ - if (m_delete) - return 0.0; - -@@ -497,6 +506,8 @@ double CSoftAEStream::GetDelay() - - double CSoftAEStream::GetCacheTime() - { -+ CSingleLock lock(m_lock); -+ - if (m_delete) - return 0.0; - -@@ -508,6 +519,8 @@ double CSoftAEStream::GetCacheTime() - - double CSoftAEStream::GetCacheTotal() - { -+ CSingleLock lock(m_lock); -+ - if (m_delete) - return 0.0; - -@@ -519,6 +532,8 @@ double CSoftAEStream::GetCacheTotal() - - void CSoftAEStream::Pause() - { -+ CSingleLock lock(m_lock); -+ - if (m_paused) - return; - m_paused = true; -@@ -527,6 +542,8 @@ void CSoftAEStream::Pause() - - void CSoftAEStream::Resume() - { -+ CSingleLock lock(m_lock); -+ - if (!m_paused) - return; - m_paused = false; -@@ -536,20 +553,20 @@ void CSoftAEStream::Resume() - - void CSoftAEStream::Drain() - { -- CSharedLock lock(m_lock); -+ CSingleLock lock(m_lock); - m_draining = true; - } - - bool CSoftAEStream::IsDrained() - { -- CSharedLock lock(m_lock); -+ CSingleLock lock(m_lock); - return (m_draining && !m_packet && m_outBuffer.empty()); - } - - void CSoftAEStream::Flush() - { - CLog::Log(LOGDEBUG, "CSoftAEStream::Flush"); -- CExclusiveLock lock(m_lock); -+ CSingleLock lock(m_lock); - InternalFlush(); - - /* internal flush does not do this as these samples are still valid if we are re-initializing */ -@@ -591,10 +608,10 @@ void CSoftAEStream::InternalFlush() - - double CSoftAEStream::GetResampleRatio() - { -+ CSingleLock lock(m_lock); - if (!m_resample) - return 1.0f; - -- CSharedLock lock(m_lock); - return m_ssrcData.src_ratio; - } - -@@ -603,7 +620,7 @@ bool CSoftAEStream::SetResampleRatio(double ratio) - if (!m_resample) - return false; - -- CSharedLock lock(m_lock); -+ CSingleLock lock(m_lock); - - int oldRatioInt = (int)std::ceil(m_ssrcData.src_ratio); - -@@ -624,7 +641,7 @@ bool CSoftAEStream::SetResampleRatio(double ratio) - - void CSoftAEStream::RegisterAudioCallback(IAudioCallback* pCallback) - { -- CExclusiveLock lock(m_lock); -+ CSingleLock lock(m_lock); - m_vizBufferSamples = 0; - m_audioCallback = pCallback; - if (m_audioCallback) -@@ -633,7 +650,7 @@ void CSoftAEStream::RegisterAudioCallback(IAudioCallback* pCallback) - - void CSoftAEStream::UnRegisterAudioCallback() - { -- CExclusiveLock lock(m_lock); -+ CSingleLock lock(m_lock); - m_audioCallback = NULL; - m_vizBufferSamples = 0; - } -@@ -644,7 +661,7 @@ void CSoftAEStream::FadeVolume(float from, float target, unsigned int time) - if (AE_IS_RAW(m_initDataFormat)) - return; - -- CExclusiveLock lock(m_lock); -+ CSingleLock lock(m_lock); - float delta = target - from; - m_fadeDirUp = target > from; - m_fadeTarget = target; -@@ -654,13 +671,13 @@ void CSoftAEStream::FadeVolume(float from, float target, unsigned int time) - - bool CSoftAEStream::IsFading() - { -- CSharedLock lock(m_lock); -+ CSingleLock lock(m_lock); - return m_fadeRunning; - } - - void CSoftAEStream::RegisterSlave(IAEStream *slave) - { -- CSharedLock lock(m_lock); -+ CSingleLock lock(m_lock); - m_slave = (CSoftAEStream*)slave; - } - -diff --git a/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAEStream.h b/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAEStream.h -index 7e93215..1b715fc 100644 ---- a/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAEStream.h -+++ b/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAEStream.h -@@ -36,7 +36,7 @@ class CSoftAEStream : public IAEStream - { - protected: - friend class CSoftAE; -- CSoftAEStream(enum AEDataFormat format, unsigned int sampleRate, unsigned int encodedSamplerate, CAEChannelInfo channelLayout, unsigned int options); -+ CSoftAEStream(enum AEDataFormat format, unsigned int sampleRate, unsigned int encodedSamplerate, CAEChannelInfo channelLayout, unsigned int options, CCriticalSection& lock); - virtual ~CSoftAEStream(); - - void Initialize(); -@@ -91,7 +91,7 @@ private: - void InternalFlush(); - void CheckResampleBuffers(); - -- CSharedSection m_lock; -+ CCriticalSection& m_lock; - enum AEDataFormat m_initDataFormat; - unsigned int m_initSampleRate; - unsigned int m_initEncodedSampleRate; --- -1.7.10.4 - - -From 2fae6e49bf802e204e71e9016be6ba9c68262e46 Mon Sep 17 00:00:00 2001 -From: Joakim Plate -Date: Wed, 29 May 2013 22:59:01 +0200 -Subject: [PATCH 4/6] softae: use correct number of bytes when consuming from - src buffer - ---- - xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.cpp | 10 +++++----- - xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.h | 2 +- - 2 files changed, 6 insertions(+), 6 deletions(-) - -diff --git a/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.cpp b/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.cpp -index faf6ccc..991cb10 100644 ---- a/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.cpp -+++ b/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.cpp -@@ -1212,7 +1212,7 @@ bool CSoftAE::FinalizeSamples(float *buffer, unsigned int samples, bool hasAudio - return true; - } - --unsigned int CSoftAE::WriteSink(CAEBuffer& src, uint8_t *data, bool hasAudio) -+unsigned int CSoftAE::WriteSink(CAEBuffer& src, int src_len, uint8_t *data, bool hasAudio) - { - CExclusiveLock lock(m_sinkLock); /* lock to maintain delay consistency */ - while(m_sink) -@@ -1229,7 +1229,7 @@ unsigned int CSoftAE::WriteSink(CAEBuffer& src, uint8_t *data, bool hasAudio) - - if (frames) - { -- m_buffer.Shift(NULL, frames * m_sinkFormat.m_frameSize); -+ m_buffer.Shift(NULL, src_len); - return frames; - } - -@@ -1259,7 +1259,7 @@ int CSoftAE::RunOutputStage(bool hasAudio) - data = m_converted; - } - -- return WriteSink(m_buffer, (uint8_t*)data, hasAudio); -+ return WriteSink(m_buffer, needBytes, (uint8_t*)data, hasAudio); - } - - int CSoftAE::RunRawOutputStage(bool hasAudio) -@@ -1287,7 +1287,7 @@ int CSoftAE::RunRawOutputStage(bool hasAudio) - data = m_converted; - } - -- return WriteSink(m_buffer, (uint8_t*)data, hasAudio); -+ return WriteSink(m_buffer, m_sinkBlockSize, (uint8_t*)data, hasAudio); - } - - int CSoftAE::RunTranscodeStage(bool hasAudio) -@@ -1331,7 +1331,7 @@ int CSoftAE::RunTranscodeStage(bool hasAudio) - - /* if we have enough data to write */ - if (m_encodedBuffer.Used() >= sinkBlock) -- WriteSink(m_encodedBuffer, (uint8_t*)m_encodedBuffer.Raw(sinkBlock), hasAudio); -+ WriteSink(m_encodedBuffer, sinkBlock, (uint8_t*)m_encodedBuffer.Raw(sinkBlock), hasAudio); - - return encodedFrames; - } -diff --git a/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.h b/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.h -index bb2769e..62914bb 100644 ---- a/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.h -+++ b/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.h -@@ -247,6 +247,6 @@ private: - void RemoveStream(StreamList &streams, CSoftAEStream *stream); - void PrintSinks(); - -- unsigned int WriteSink(CAEBuffer& src, uint8_t *data, bool hasAudio); -+ unsigned int WriteSink(CAEBuffer& src, int src_len, uint8_t *data, bool hasAudio); - }; - --- -1.7.10.4 - - -From 2e9cd3d009ca93a74624503d9769863415267148 Mon Sep 17 00:00:00 2001 -From: Joakim Plate -Date: Wed, 29 May 2013 23:04:14 +0200 -Subject: [PATCH 5/6] softae: add fail safe to WriteSink to avoid deadlocking - on broken output - ---- - xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.cpp | 13 ++++++++++++- - xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.h | 1 + - 2 files changed, 13 insertions(+), 1 deletion(-) - -diff --git a/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.cpp b/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.cpp -index 991cb10..e4faf7b 100644 ---- a/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.cpp -+++ b/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.cpp -@@ -64,6 +64,7 @@ CSoftAE::CSoftAE(): - m_softSuspend (false ), - m_softSuspendTimer (0 ), - m_sink (NULL ), -+ m_sinkBlockTime (0 ), - m_transcode (false ), - m_rawPassthrough (false ), - m_soundMode (AE_SOUND_OFF), -@@ -350,6 +351,7 @@ void CSoftAE::InternalOpenSink() - m_sinkFormatSampleRateMul = 1.0 / (double)newFormat.m_sampleRate; - m_sinkFormatFrameSizeMul = 1.0 / (double)newFormat.m_frameSize; - m_sinkBlockSize = newFormat.m_frames * newFormat.m_frameSize; -+ m_sinkBlockTime = 1000 * newFormat.m_frames / newFormat.m_sampleRate; - // check if sink controls volume, if so, init the volume. - m_sinkHandlesVolume = m_sink->HasVolume(); - if (m_sinkHandlesVolume) -@@ -1215,6 +1217,8 @@ bool CSoftAE::FinalizeSamples(float *buffer, unsigned int samples, bool hasAudio - unsigned int CSoftAE::WriteSink(CAEBuffer& src, int src_len, uint8_t *data, bool hasAudio) - { - CExclusiveLock lock(m_sinkLock); /* lock to maintain delay consistency */ -+ -+ XbmcThreads::EndTime timeout(m_sinkBlockTime * 2); - while(m_sink) - { - int frames = m_sink->AddPackets(data, m_sinkFormat.m_frames, hasAudio); -@@ -1233,8 +1237,15 @@ unsigned int CSoftAE::WriteSink(CAEBuffer& src, int src_len, uint8_t *data, bool - return frames; - } - -+ if(timeout.IsTimePast()) -+ { -+ CLog::Log(LOGERROR, "CSoftAE::WriteSink - sink blocked- reinit flagged"); -+ m_reOpen = true; -+ break; -+ } -+ - lock.Leave(); -- Sleep((500 * m_sinkFormat.m_frames) / m_sinkFormat.m_sampleRate); -+ Sleep(m_sinkBlockTime / 4); - lock.Enter(); - } - return 0; -diff --git a/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.h b/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.h -index 62914bb..23e0ea3 100644 ---- a/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.h -+++ b/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.h -@@ -165,6 +165,7 @@ private: - double m_sinkFormatSampleRateMul; - double m_sinkFormatFrameSizeMul; - unsigned int m_sinkBlockSize; -+ unsigned int m_sinkBlockTime; - bool m_sinkHandlesVolume; - AEAudioFormat m_encoderFormat; - double m_encoderFrameSizeMul; --- -1.7.10.4 - - -From 7a81b2a0e9822688d9681756414b753815bf9e21 Mon Sep 17 00:00:00 2001 -From: Joakim Plate -Date: Sat, 1 Jun 2013 18:22:43 +0200 -Subject: [PATCH 6/6] softae: use passed buffer not something else when - consuming data - ---- - xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.cpp b/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.cpp -index e4faf7b..e641335 100644 ---- a/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.cpp -+++ b/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.cpp -@@ -1233,7 +1233,7 @@ unsigned int CSoftAE::WriteSink(CAEBuffer& src, int src_len, uint8_t *data, bool - - if (frames) - { -- m_buffer.Shift(NULL, src_len); -+ src.Shift(NULL, src_len); - return frames; - } - --- -1.7.10.4 - diff --git a/packages/multimedia/ffmpeg/meta b/packages/multimedia/ffmpeg/meta index 6b10b5df92..3d0fb8a4c7 100644 --- a/packages/multimedia/ffmpeg/meta +++ b/packages/multimedia/ffmpeg/meta @@ -21,7 +21,7 @@ PKG_NAME="ffmpeg" PKG_VERSION="0.10.7" if [ "$XBMC" = "master" ]; then - PKG_VERSION="1.2" + PKG_VERSION="1.2.1" fi PKG_REV="1" PKG_ARCH="any" diff --git a/packages/multimedia/ffmpeg/patches/0.10.7/ffmpeg-0.10.6-905.01-VFP_acceleration.patch b/packages/multimedia/ffmpeg/patches/0.10.7/ffmpeg-0.10.6-905.01-VFP_acceleration.patch new file mode 100644 index 0000000000..48da429b70 --- /dev/null +++ b/packages/multimedia/ffmpeg/patches/0.10.7/ffmpeg-0.10.6-905.01-VFP_acceleration.patch @@ -0,0 +1,4019 @@ +From d4b2cd80ab6f54590fecfbfbf0a414cec1cf1204 Mon Sep 17 00:00:00 2001 +From: Ben Avison +Date: Fri, 14 Jun 2013 16:07:53 +0100 +Subject: [PATCH 50/55] Add VFP-accelerated version of synth_filter_float(), + used by DTS Coherent Acoustics decoder + +--- + libavcodec/arm/Makefile | 1 + + libavcodec/arm/fft_init_arm.c | 8 ++ + libavcodec/arm/synth_filter_vfp.S | 206 +++++++++++++++++++++++++++ + 3 files changed, 215 insertions(+) + create mode 100644 libavcodec/arm/synth_filter_vfp.S + +diff --git a/libavcodec/arm/Makefile b/libavcodec/arm/Makefile +index 52709b6..b8b4df2 100644 +--- a/libavcodec/arm/Makefile ++++ b/libavcodec/arm/Makefile +@@ -37,6 +37,7 @@ OBJS-$(HAVE_ARMV6) += arm/dsputil_init_armv6.o \ + $(ARMV6-OBJS-yes) + + VFP-OBJS-$(HAVE_ARMV6) += arm/fmtconvert_vfp.o \ ++ arm/synth_filter_vfp.o + + OBJS-$(HAVE_ARMVFP) += arm/dsputil_vfp.o \ + arm/dsputil_init_vfp.o \ +diff --git a/libavcodec/arm/fft_init_arm.c b/libavcodec/arm/fft_init_arm.c +index cdb64e7..605b3dd 100644 +--- a/libavcodec/arm/fft_init_arm.c ++++ b/libavcodec/arm/fft_init_arm.c +@@ -31,6 +31,12 @@ + + void ff_rdft_calc_neon(struct RDFTContext *s, FFTSample *z); + ++void ff_synth_filter_float_vfp(FFTContext *imdct, ++ float *synth_buf_ptr, int *synth_buf_offset, ++ float synth_buf2[32], const float window[512], ++ float out[32], const float in[32], ++ float scale); ++ + void ff_synth_filter_float_neon(FFTContext *imdct, + float *synth_buf_ptr, int *synth_buf_offset, + float synth_buf2[32], const float window[512], +@@ -62,6 +68,8 @@ av_cold void ff_rdft_init_arm(RDFTContext *s) + #if CONFIG_DCA_DECODER + av_cold void ff_synth_filter_init_arm(SynthFilterContext *s) + { ++ if (HAVE_ARMVFP) ++ s->synth_filter_float = ff_synth_filter_float_vfp; + if (HAVE_NEON) + s->synth_filter_float = ff_synth_filter_float_neon; + } +diff --git a/libavcodec/arm/synth_filter_vfp.S b/libavcodec/arm/synth_filter_vfp.S +new file mode 100644 +index 0000000..8c54267 +--- /dev/null ++++ b/libavcodec/arm/synth_filter_vfp.S +@@ -0,0 +1,206 @@ ++/* ++ * Copyright (c) 2013 RISC OS Open Ltd ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg 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 ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ * ++ * Author: Ben Avison ++ */ ++ ++#include "libavcodec/arm/asm.S" ++ ++IMDCT .req r0 ++ORIG_P_SB .req r1 ++P_SB_OFF .req r2 ++I .req r0 ++P_SB2_UP .req r1 ++OLDFPSCR .req r2 ++P_SB2_DN .req r3 ++P_WIN_DN .req r4 ++P_OUT_DN .req r5 ++P_SB .req r6 ++J_WRAP .req r7 ++P_WIN_UP .req r12 ++P_OUT_UP .req r14 ++ ++SCALE .req s0 ++SBUF_DAT_REV0 .req s4 ++SBUF_DAT_REV1 .req s5 ++SBUF_DAT_REV2 .req s6 ++SBUF_DAT_REV3 .req s7 ++VA0 .req s8 ++VA3 .req s11 ++VB0 .req s12 ++VB3 .req s15 ++VC0 .req s8 ++VC3 .req s11 ++VD0 .req s12 ++VD3 .req s15 ++SBUF_DAT0 .req s16 ++SBUF_DAT1 .req s17 ++SBUF_DAT2 .req s18 ++SBUF_DAT3 .req s19 ++SBUF_DAT_ALT0 .req s20 ++SBUF_DAT_ALT1 .req s21 ++SBUF_DAT_ALT2 .req s22 ++SBUF_DAT_ALT3 .req s23 ++WIN_DN_DAT0 .req s24 ++WIN_UP_DAT0 .req s28 ++ ++ ++.macro inner_loop half, tail, head ++ .if (OFFSET & (64*4)) == 0 @ even numbered call ++ SBUF_DAT_THIS0 .req SBUF_DAT0 ++ SBUF_DAT_THIS1 .req SBUF_DAT1 ++ SBUF_DAT_THIS2 .req SBUF_DAT2 ++ SBUF_DAT_THIS3 .req SBUF_DAT3 ++ .ifnc "\head","" ++ vldr d8, [P_SB, #OFFSET] @ d8 = SBUF_DAT ++ vldr d9, [P_SB, #OFFSET+8] ++ .endif ++ .else ++ SBUF_DAT_THIS0 .req SBUF_DAT_ALT0 ++ SBUF_DAT_THIS1 .req SBUF_DAT_ALT1 ++ SBUF_DAT_THIS2 .req SBUF_DAT_ALT2 ++ SBUF_DAT_THIS3 .req SBUF_DAT_ALT3 ++ .ifnc "\head","" ++ vldr d10, [P_SB, #OFFSET] @ d10 = SBUF_DAT_ALT ++ vldr d11, [P_SB, #OFFSET+8] ++ .endif ++ .endif ++ .ifnc "\tail","" ++ .ifc "\half","ab" ++ vmls.f VA0, SBUF_DAT_REV0, WIN_DN_DAT0 @ all operands treated as vectors ++ .else ++ vmla.f VD0, SBUF_DAT_REV0, WIN_DN_DAT0 @ all operands treated as vectors ++ .endif ++ .endif ++ .ifnc "\head","" ++ vldr d14, [P_WIN_UP, #OFFSET] @ d14 = WIN_UP_DAT ++ vldr d15, [P_WIN_UP, #OFFSET+8] ++ vldr d12, [P_WIN_DN, #OFFSET] @ d12 = WIN_DN_DAT ++ vldr d13, [P_WIN_DN, #OFFSET+8] ++ vmov SBUF_DAT_REV3, SBUF_DAT_THIS0 ++ vmov SBUF_DAT_REV2, SBUF_DAT_THIS1 ++ vmov SBUF_DAT_REV1, SBUF_DAT_THIS2 ++ vmov SBUF_DAT_REV0, SBUF_DAT_THIS3 ++ .ifc "\half","ab" ++ vmla.f VB0, SBUF_DAT_THIS0, WIN_UP_DAT0 ++ .else ++ vmla.f VC0, SBUF_DAT_THIS0, WIN_UP_DAT0 ++ .endif ++ teq J_WRAP, #J ++ bne 2f @ strongly predictable, so better than cond exec in this case ++ sub P_SB, P_SB, #512*4 ++2: ++ .set J, J - 64 ++ .set OFFSET, OFFSET + 64*4 ++ .endif ++ .unreq SBUF_DAT_THIS0 ++ .unreq SBUF_DAT_THIS1 ++ .unreq SBUF_DAT_THIS2 ++ .unreq SBUF_DAT_THIS3 ++.endm ++ ++ ++/* void ff_synth_filter_float_vfp(FFTContext *imdct, ++ * float *synth_buf_ptr, int *synth_buf_offset, ++ * float synth_buf2[32], const float window[512], ++ * float out[32], const float in[32], float scale) ++ */ ++function ff_synth_filter_float_vfp, export=1 ++ push {r3-r7,lr} ++ vpush {s16-s31} ++ ldr lr, [P_SB_OFF] ++ add a2, ORIG_P_SB, lr, LSL #2 @ calculate synth_buf to pass to imdct_half ++ mov P_SB, a2 @ and keep a copy for ourselves ++ bic J_WRAP, lr, #63 @ mangled to make testing for wrap easier in inner loop ++ sub lr, lr, #32 ++ and lr, lr, #512-32 ++ str lr, [P_SB_OFF] @ rotate offset, modulo buffer size, ready for next call ++ ldr a3, [sp, #(16+6+2)*4] @ fetch in from stack, to pass to imdct_half ++VFP vmov s16, SCALE @ imdct_half is free to corrupt s0, but it contains one of our arguments in hardfp case ++ bl ff_imdct_half_c ++VFP vmov SCALE, s16 ++ ++ vmrs OLDFPSCR, FPSCR ++ ldr lr, =0x03030000 @ RunFast mode, short vectors of length 4, stride 1 ++ vmsr FPSCR, lr ++ ldr P_SB2_DN, [sp, #16*4] ++ ldr P_WIN_DN, [sp, #(16+6+0)*4] ++ ldr P_OUT_DN, [sp, #(16+6+1)*4] ++NOVFP vldr SCALE, [sp, #(16+6+3)*4] ++ ++#define IMM_OFF_SKEW 956 /* also valid immediate constant when you add 16*4 */ ++ add P_SB, P_SB, #IMM_OFF_SKEW @ so we can use -ve offsets to use full immediate offset range ++ add P_SB2_UP, P_SB2_DN, #16*4 ++ add P_WIN_UP, P_WIN_DN, #16*4+IMM_OFF_SKEW ++ add P_OUT_UP, P_OUT_DN, #16*4 ++ add P_SB2_DN, P_SB2_DN, #16*4 ++ add P_WIN_DN, P_WIN_DN, #12*4+IMM_OFF_SKEW ++ add P_OUT_DN, P_OUT_DN, #16*4 ++ mov I, #4 ++1: ++ vldmia P_SB2_UP!, {VB0-VB3} ++ vldmdb P_SB2_DN!, {VA0-VA3} ++ .set J, 512 - 64 ++ .set OFFSET, -IMM_OFF_SKEW ++ inner_loop ab,, head ++ .rept 7 ++ inner_loop ab, tail, head ++ .endr ++ inner_loop ab, tail ++ add P_WIN_UP, P_WIN_UP, #4*4 ++ sub P_WIN_DN, P_WIN_DN, #4*4 ++ vmul.f VB0, VB0, SCALE @ SCALE treated as scalar ++ add P_SB, P_SB, #(512+4)*4 ++ subs I, I, #1 ++ vmul.f VA0, VA0, SCALE ++ vstmia P_OUT_UP!, {VB0-VB3} ++ vstmdb P_OUT_DN!, {VA0-VA3} ++ bne 1b ++ ++ add P_SB2_DN, P_SB2_DN, #(16+28-12)*4 ++ sub P_SB2_UP, P_SB2_UP, #(16+16)*4 ++ add P_WIN_DN, P_WIN_DN, #(32+16+28-12)*4 ++ mov I, #4 ++1: ++ vldr.d d4, zero @ d4 = VC0 ++ vldr.d d5, zero ++ vldr.d d6, zero @ d6 = VD0 ++ vldr.d d7, zero ++ .set J, 512 - 64 ++ .set OFFSET, -IMM_OFF_SKEW ++ inner_loop cd,, head ++ .rept 7 ++ inner_loop cd, tail, head ++ .endr ++ inner_loop cd, tail ++ add P_WIN_UP, P_WIN_UP, #4*4 ++ sub P_WIN_DN, P_WIN_DN, #4*4 ++ add P_SB, P_SB, #(512+4)*4 ++ subs I, I, #1 ++ vstmia P_SB2_UP!, {VC0-VC3} ++ vstmdb P_SB2_DN!, {VD0-VD3} ++ bne 1b ++ ++ vmsr FPSCR, OLDFPSCR ++ vpop {s16-s31} ++ pop {r3-r7,pc} ++endfunc ++ ++ .align 3 ++zero: .word 0, 0 +-- +1.8.1.6 + + +From d32ba2d8b8aacc9efb8c8a80152ae0684600e874 Mon Sep 17 00:00:00 2001 +From: Ben Avison +Date: Tue, 25 Jun 2013 17:22:50 +0100 +Subject: [PATCH 51/55] 1st version of ff_int32_to_float_fmul_scalar_vfp + +--- + libavcodec/arm/fmtconvert_init_arm.c | 10 +++++-- + libavcodec/arm/fmtconvert_vfp.S | 38 +++++++++++++++++++++++++ + 2 files changed, 46 insertions(+), 2 deletions(-) + +diff --git a/libavcodec/arm/fmtconvert_init_arm.c b/libavcodec/arm/fmtconvert_init_arm.c +index 4b6e393..6eb6cd4 100644 +--- a/libavcodec/arm/fmtconvert_init_arm.c ++++ b/libavcodec/arm/fmtconvert_init_arm.c +@@ -29,12 +29,18 @@ void ff_int32_to_float_fmul_scalar_neon(float *dst, const int *src, + void ff_float_to_int16_neon(int16_t *dst, const float *src, long len); + void ff_float_to_int16_interleave_neon(int16_t *, const float **, long, int); + ++void ff_int32_to_float_fmul_scalar_vfp(float *dst, const int *src, ++ float mul, int len); ++ + void ff_float_to_int16_vfp(int16_t *dst, const float *src, long len); + + void ff_fmt_convert_init_arm(FmtConvertContext *c, AVCodecContext *avctx) + { +- if (HAVE_ARMVFP && HAVE_ARMV6) { +- c->float_to_int16 = ff_float_to_int16_vfp; ++ if (HAVE_ARMVFP) { ++ c->int32_to_float_fmul_scalar = ff_int32_to_float_fmul_scalar_vfp; ++ if (HAVE_ARMV6) { ++ c->float_to_int16 = ff_float_to_int16_vfp; ++ } + } + + if (HAVE_NEON) { +diff --git a/libavcodec/arm/fmtconvert_vfp.S b/libavcodec/arm/fmtconvert_vfp.S +index 7e2eb83..531a8ad 100644 +--- a/libavcodec/arm/fmtconvert_vfp.S ++++ b/libavcodec/arm/fmtconvert_vfp.S +@@ -1,5 +1,6 @@ + /* + * Copyright (c) 2008 Siarhei Siamashka ++ * Copyright (c) 2013 RISC OS Open Ltd + * + * This file is part of FFmpeg. + * +@@ -76,3 +77,40 @@ function ff_float_to_int16_vfp, export=1 + vpop {d8-d11} + pop {r4-r8,pc} + endfunc ++ ++/** ++ * ARM VFP optimised int32 to float conversion. ++ * Assume len is a multiple of 8, destination buffer is at least 4 bytes aligned ++ * (16 bytes alignment is best for BCM2835), little-endian. ++ */ ++@ void ff_int32_to_float_fmul_scalar_vfp(float *dst, const int *src, float mul, int len) ++function ff_int32_to_float_fmul_scalar_vfp, export=1 ++VFP tmp .req a4 ++VFP len .req a3 ++NOVFP tmp .req a3 ++NOVFP len .req a4 ++NOVFP vmov s0, a3 ++ ldr tmp, =0x03070000 @ RunFast mode, short vectors of length 8, stride 1 ++ vmrs ip, FPSCR ++ vmsr FPSCR, tmp ++1: ++ vldmia a2!, {s8-s15} ++ vcvt.f32.s32 s8, s8 ++ vcvt.f32.s32 s9, s9 ++ vcvt.f32.s32 s10, s10 ++ vcvt.f32.s32 s11, s11 ++ vcvt.f32.s32 s12, s12 ++ vcvt.f32.s32 s13, s13 ++ vcvt.f32.s32 s14, s14 ++ vcvt.f32.s32 s15, s15 ++ vmul.f32 s8, s8, s0 ++ subs len, len, #8 ++ vstmia a1!, {s8-s11} ++ vstmia a1!, {s12-s15} ++ bne 1b ++ ++ vmsr FPSCR, ip ++ bx lr ++endfunc ++ .unreq tmp ++ .unreq len +-- +1.8.1.6 + + +From e8ba866ef0bb68e43da157683d398ab7cce817a6 Mon Sep 17 00:00:00 2001 +From: Ben Avison +Date: Wed, 26 Jun 2013 00:49:15 +0100 +Subject: [PATCH 52/55] 2nd version of fmul_scalar + +--- + libavcodec/arm/fmtconvert_init_arm.c | 5 + + libavcodec/arm/fmtconvert_vfp.S | 162 ++ + libavcodec/dcadec.c | 2533 +++++++++++++++++++++++ + libavcodec/fmtconvert.c | 7 + + libavcodec/fmtconvert.h | 14 + + 5 files changed, 2721 insertions(+) + create mode 100644 libavcodec/dcadec.c + +diff --git a/libavcodec/arm/fmtconvert_init_arm.c b/libavcodec/arm/fmtconvert_init_arm.c +index 6eb6cd4..91c652e 100644 +--- a/libavcodec/arm/fmtconvert_init_arm.c ++++ b/libavcodec/arm/fmtconvert_init_arm.c +@@ -31,6 +31,8 @@ void ff_int32_to_float_fmul_scalar_neon(float *dst, const int *src, + + void ff_int32_to_float_fmul_scalar_vfp(float *dst, const int *src, + float mul, int len); ++void ff_int32_to_float_fmul_scalar_array_vfp(FmtConvertContext *c, float *dst, const int *src, ++ float *mul, int len); + + void ff_float_to_int16_vfp(int16_t *dst, const float *src, long len); + +@@ -38,6 +40,9 @@ void ff_fmt_convert_init_arm(FmtConvertContext *c, AVCodecContext *avctx) + { + if (HAVE_ARMVFP) { + c->int32_to_float_fmul_scalar = ff_int32_to_float_fmul_scalar_vfp; ++ if (!HAVE_NEON) { ++ c->int32_to_float_fmul_scalar_array = ff_int32_to_float_fmul_scalar_array_vfp; ++ } + if (HAVE_ARMV6) { + c->float_to_int16 = ff_float_to_int16_vfp; + } +diff --git a/libavcodec/arm/fmtconvert_vfp.S b/libavcodec/arm/fmtconvert_vfp.S +index 531a8ad..13f0bc0 100644 +--- a/libavcodec/arm/fmtconvert_vfp.S ++++ b/libavcodec/arm/fmtconvert_vfp.S +@@ -83,6 +83,168 @@ endfunc + * Assume len is a multiple of 8, destination buffer is at least 4 bytes aligned + * (16 bytes alignment is best for BCM2835), little-endian. + */ ++@ void ff_int32_to_float_fmul_scalar_array_vfp(if (FmtConvertContext *c, float *dst, const int *src, float *mul, int len) ++function ff_int32_to_float_fmul_scalar_array_vfp, export=1 ++ push {lr} ++ ldr a1, [sp, #4] ++ subs lr, a1, #3*8 ++ bcc 50f @ too short to pipeline ++ @ Now need to find (len / 8) % 3. The approximation ++ @ x / 24 = (x * 0xAB) >> 12 ++ @ is good for x < 4096, which is true for both AC3 and DCA. ++ mov a1, #0xAB ++ ldr ip, =0x03070000 @ RunFast mode, short vectors of length 8, stride 1 ++ mul a1, lr, a1 ++ vpush {s16-s31} ++ mov a1, a1, lsr #12 ++ add a1, a1, a1, lsl #1 ++ rsb a1, a1, lr, lsr #3 ++ cmp a1, #1 ++ vmrs a1, FPSCR ++ vmsr FPSCR, ip ++ beq 11f ++ blo 10f ++ @ Array is (2 + multiple of 3) x 8 floats long ++ @ drop through... ++ vldmia a3!, {s16-s23} ++ vldmia a4!, {s2,s3} ++ vldmia a3!, {s24-s31} ++ vcvt.f32.s32 s16, s16 ++ vcvt.f32.s32 s17, s17 ++ vcvt.f32.s32 s18, s18 ++ vcvt.f32.s32 s19, s19 ++ vcvt.f32.s32 s20, s20 ++ vcvt.f32.s32 s21, s21 ++ vcvt.f32.s32 s22, s22 ++ vcvt.f32.s32 s23, s23 ++ vmul.f32 s16, s16, s2 ++ @ drop through... ++3: ++ vldmia a3!, {s8-s15} ++ vldmia a4!, {s1} ++ vcvt.f32.s32 s24, s24 ++ vcvt.f32.s32 s25, s25 ++ vcvt.f32.s32 s26, s26 ++ vcvt.f32.s32 s27, s27 ++ vcvt.f32.s32 s28, s28 ++ vcvt.f32.s32 s29, s29 ++ vcvt.f32.s32 s30, s30 ++ vcvt.f32.s32 s31, s31 ++ vmul.f32 s24, s24, s3 ++ vstmia a2!, {s16-s19} ++ vstmia a2!, {s20-s23} ++2: ++ vldmia a3!, {s16-s23} ++ vldmia a4!, {s2} ++ vcvt.f32.s32 s8, s8 ++ vcvt.f32.s32 s9, s9 ++ vcvt.f32.s32 s10, s10 ++ vcvt.f32.s32 s11, s11 ++ vcvt.f32.s32 s12, s12 ++ vcvt.f32.s32 s13, s13 ++ vcvt.f32.s32 s14, s14 ++ vcvt.f32.s32 s15, s15 ++ vmul.f32 s8, s8, s1 ++ vstmia a2!, {s24-s27} ++ vstmia a2!, {s28-s31} ++1: ++ vldmia a3!, {s24-s31} ++ vldmia a4!, {s3} ++ vcvt.f32.s32 s16, s16 ++ vcvt.f32.s32 s17, s17 ++ vcvt.f32.s32 s18, s18 ++ vcvt.f32.s32 s19, s19 ++ vcvt.f32.s32 s20, s20 ++ vcvt.f32.s32 s21, s21 ++ vcvt.f32.s32 s22, s22 ++ vcvt.f32.s32 s23, s23 ++ vmul.f32 s16, s16, s2 ++ vstmia a2!, {s8-s11} ++ vstmia a2!, {s12-s15} ++ ++ subs lr, lr, #8*3 ++ bpl 3b ++ ++ vcvt.f32.s32 s24, s24 ++ vcvt.f32.s32 s25, s25 ++ vcvt.f32.s32 s26, s26 ++ vcvt.f32.s32 s27, s27 ++ vcvt.f32.s32 s28, s28 ++ vcvt.f32.s32 s29, s29 ++ vcvt.f32.s32 s30, s30 ++ vcvt.f32.s32 s31, s31 ++ vmul.f32 s24, s24, s3 ++ vstmia a2!, {s16-s19} ++ vstmia a2!, {s20-s23} ++ vstmia a2!, {s24-s27} ++ vstmia a2!, {s28-s31} ++ ++ vmsr FPSCR, a1 ++ vpop {s16-s31} ++ pop {pc} ++ ++10: @ Array is (multiple of 3) x 8 floats long ++ vldmia a3!, {s8-s15} ++ vldmia a4!, {s1,s2} ++ vldmia a3!, {s16-s23} ++ vcvt.f32.s32 s8, s8 ++ vcvt.f32.s32 s9, s9 ++ vcvt.f32.s32 s10, s10 ++ vcvt.f32.s32 s11, s11 ++ vcvt.f32.s32 s12, s12 ++ vcvt.f32.s32 s13, s13 ++ vcvt.f32.s32 s14, s14 ++ vcvt.f32.s32 s15, s15 ++ vmul.f32 s8, s8, s1 ++ b 1b ++ ++11: @ Array is (1 + multiple of 3) x 8 floats long ++ vldmia a3!, {s24-s31} ++ vldmia a4!, {s3} ++ vldmia a3!, {s8-s15} ++ vldmia a4!, {s1} ++ vcvt.f32.s32 s24, s24 ++ vcvt.f32.s32 s25, s25 ++ vcvt.f32.s32 s26, s26 ++ vcvt.f32.s32 s27, s27 ++ vcvt.f32.s32 s28, s28 ++ vcvt.f32.s32 s29, s29 ++ vcvt.f32.s32 s30, s30 ++ vcvt.f32.s32 s31, s31 ++ vmul.f32 s24, s24, s3 ++ b 2b ++ ++50: ++ ldr lr, =0x03070000 @ RunFast mode, short vectors of length 8, stride 1 ++ vmrs ip, FPSCR ++ vmsr FPSCR, lr ++51: ++ vldmia a3!, {s8-s15} ++ vldmia a4!, {s0} ++ vcvt.f32.s32 s8, s8 ++ vcvt.f32.s32 s9, s9 ++ vcvt.f32.s32 s10, s10 ++ vcvt.f32.s32 s11, s11 ++ vcvt.f32.s32 s12, s12 ++ vcvt.f32.s32 s13, s13 ++ vcvt.f32.s32 s14, s14 ++ vcvt.f32.s32 s15, s15 ++ vmul.f32 s8, s8, s0 ++ subs a1, a1, #8 ++ vstmia a2!, {s8-s11} ++ vstmia a2!, {s12-s15} ++ bne 51b ++ ++ vmsr FPSCR, ip ++ pop {pc} ++endfunc ++ ++/** ++ * ARM VFP optimised int32 to float conversion. ++ * Assume len is a multiple of 8, destination buffer is at least 4 bytes aligned ++ * (16 bytes alignment is best for BCM2835), little-endian. ++ * TODO: could be further optimised by unrolling and interleaving, as above ++ */ + @ void ff_int32_to_float_fmul_scalar_vfp(float *dst, const int *src, float mul, int len) + function ff_int32_to_float_fmul_scalar_vfp, export=1 + VFP tmp .req a4 +diff --git a/libavcodec/dcadec.c b/libavcodec/dcadec.c +new file mode 100644 +index 0000000..fe568ee +--- /dev/null ++++ b/libavcodec/dcadec.c +@@ -0,0 +1,2533 @@ ++/* ++ * DCA compatible decoder ++ * Copyright (C) 2004 Gildas Bazin ++ * Copyright (C) 2004 Benjamin Zores ++ * Copyright (C) 2006 Benjamin Larsson ++ * Copyright (C) 2007 Konstantin Shishkov ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg 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 ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#include ++#include ++#include ++ ++#include "libavutil/channel_layout.h" ++#include "libavutil/common.h" ++#include "libavutil/float_dsp.h" ++#include "libavutil/internal.h" ++#include "libavutil/intreadwrite.h" ++#include "libavutil/mathematics.h" ++#include "libavutil/samplefmt.h" ++#include "avcodec.h" ++#include "fft.h" ++#include "get_bits.h" ++#include "put_bits.h" ++#include "dcadata.h" ++#include "dcahuff.h" ++#include "dca.h" ++#include "dca_parser.h" ++#include "mathops.h" ++#include "synth_filter.h" ++#include "dcadsp.h" ++#include "fmtconvert.h" ++#include "internal.h" ++ ++#if ARCH_ARM ++# include "arm/dca.h" ++#endif ++ ++//#define TRACE ++ ++#define DCA_PRIM_CHANNELS_MAX (7) ++#define DCA_SUBBANDS (64) ++#define DCA_ABITS_MAX (32) /* Should be 28 */ ++#define DCA_SUBSUBFRAMES_MAX (4) ++#define DCA_SUBFRAMES_MAX (16) ++#define DCA_BLOCKS_MAX (16) ++#define DCA_LFE_MAX (3) ++#define DCA_CHSETS_MAX (4) ++#define DCA_CHSET_CHANS_MAX (8) ++ ++enum DCAMode { ++ DCA_MONO = 0, ++ DCA_CHANNEL, ++ DCA_STEREO, ++ DCA_STEREO_SUMDIFF, ++ DCA_STEREO_TOTAL, ++ DCA_3F, ++ DCA_2F1R, ++ DCA_3F1R, ++ DCA_2F2R, ++ DCA_3F2R, ++ DCA_4F2R ++}; ++ ++/* these are unconfirmed but should be mostly correct */ ++enum DCAExSSSpeakerMask { ++ DCA_EXSS_FRONT_CENTER = 0x0001, ++ DCA_EXSS_FRONT_LEFT_RIGHT = 0x0002, ++ DCA_EXSS_SIDE_REAR_LEFT_RIGHT = 0x0004, ++ DCA_EXSS_LFE = 0x0008, ++ DCA_EXSS_REAR_CENTER = 0x0010, ++ DCA_EXSS_FRONT_HIGH_LEFT_RIGHT = 0x0020, ++ DCA_EXSS_REAR_LEFT_RIGHT = 0x0040, ++ DCA_EXSS_FRONT_HIGH_CENTER = 0x0080, ++ DCA_EXSS_OVERHEAD = 0x0100, ++ DCA_EXSS_CENTER_LEFT_RIGHT = 0x0200, ++ DCA_EXSS_WIDE_LEFT_RIGHT = 0x0400, ++ DCA_EXSS_SIDE_LEFT_RIGHT = 0x0800, ++ DCA_EXSS_LFE2 = 0x1000, ++ DCA_EXSS_SIDE_HIGH_LEFT_RIGHT = 0x2000, ++ DCA_EXSS_REAR_HIGH_CENTER = 0x4000, ++ DCA_EXSS_REAR_HIGH_LEFT_RIGHT = 0x8000, ++}; ++ ++enum DCAXxchSpeakerMask { ++ DCA_XXCH_FRONT_CENTER = 0x0000001, ++ DCA_XXCH_FRONT_LEFT = 0x0000002, ++ DCA_XXCH_FRONT_RIGHT = 0x0000004, ++ DCA_XXCH_SIDE_REAR_LEFT = 0x0000008, ++ DCA_XXCH_SIDE_REAR_RIGHT = 0x0000010, ++ DCA_XXCH_LFE1 = 0x0000020, ++ DCA_XXCH_REAR_CENTER = 0x0000040, ++ DCA_XXCH_SURROUND_REAR_LEFT = 0x0000080, ++ DCA_XXCH_SURROUND_REAR_RIGHT = 0x0000100, ++ DCA_XXCH_SIDE_SURROUND_LEFT = 0x0000200, ++ DCA_XXCH_SIDE_SURROUND_RIGHT = 0x0000400, ++ DCA_XXCH_FRONT_CENTER_LEFT = 0x0000800, ++ DCA_XXCH_FRONT_CENTER_RIGHT = 0x0001000, ++ DCA_XXCH_FRONT_HIGH_LEFT = 0x0002000, ++ DCA_XXCH_FRONT_HIGH_CENTER = 0x0004000, ++ DCA_XXCH_FRONT_HIGH_RIGHT = 0x0008000, ++ DCA_XXCH_LFE2 = 0x0010000, ++ DCA_XXCH_SIDE_FRONT_LEFT = 0x0020000, ++ DCA_XXCH_SIDE_FRONT_RIGHT = 0x0040000, ++ DCA_XXCH_OVERHEAD = 0x0080000, ++ DCA_XXCH_SIDE_HIGH_LEFT = 0x0100000, ++ DCA_XXCH_SIDE_HIGH_RIGHT = 0x0200000, ++ DCA_XXCH_REAR_HIGH_CENTER = 0x0400000, ++ DCA_XXCH_REAR_HIGH_LEFT = 0x0800000, ++ DCA_XXCH_REAR_HIGH_RIGHT = 0x1000000, ++ DCA_XXCH_REAR_LOW_CENTER = 0x2000000, ++ DCA_XXCH_REAR_LOW_LEFT = 0x4000000, ++ DCA_XXCH_REAR_LOW_RIGHT = 0x8000000, ++}; ++ ++static const uint32_t map_xxch_to_native[28] = { ++ AV_CH_FRONT_CENTER, ++ AV_CH_FRONT_LEFT, ++ AV_CH_FRONT_RIGHT, ++ AV_CH_SIDE_LEFT, ++ AV_CH_SIDE_RIGHT, ++ AV_CH_LOW_FREQUENCY, ++ AV_CH_BACK_CENTER, ++ AV_CH_BACK_LEFT, ++ AV_CH_BACK_RIGHT, ++ AV_CH_SIDE_LEFT, /* side surround left -- dup sur side L */ ++ AV_CH_SIDE_RIGHT, /* side surround right -- dup sur side R */ ++ AV_CH_FRONT_LEFT_OF_CENTER, ++ AV_CH_FRONT_RIGHT_OF_CENTER, ++ AV_CH_TOP_FRONT_LEFT, ++ AV_CH_TOP_FRONT_CENTER, ++ AV_CH_TOP_FRONT_RIGHT, ++ AV_CH_LOW_FREQUENCY, /* lfe2 -- duplicate lfe1 position */ ++ AV_CH_FRONT_LEFT_OF_CENTER, /* side front left -- dup front cntr L */ ++ AV_CH_FRONT_RIGHT_OF_CENTER,/* side front right -- dup front cntr R */ ++ AV_CH_TOP_CENTER, /* overhead */ ++ AV_CH_TOP_FRONT_LEFT, /* side high left -- dup */ ++ AV_CH_TOP_FRONT_RIGHT, /* side high right -- dup */ ++ AV_CH_TOP_BACK_CENTER, ++ AV_CH_TOP_BACK_LEFT, ++ AV_CH_TOP_BACK_RIGHT, ++ AV_CH_BACK_CENTER, /* rear low center -- dup */ ++ AV_CH_BACK_LEFT, /* rear low left -- dup */ ++ AV_CH_BACK_RIGHT /* read low right -- dup */ ++}; ++ ++enum DCAExtensionMask { ++ DCA_EXT_CORE = 0x001, ///< core in core substream ++ DCA_EXT_XXCH = 0x002, ///< XXCh channels extension in core substream ++ DCA_EXT_X96 = 0x004, ///< 96/24 extension in core substream ++ DCA_EXT_XCH = 0x008, ///< XCh channel extension in core substream ++ DCA_EXT_EXSS_CORE = 0x010, ///< core in ExSS (extension substream) ++ DCA_EXT_EXSS_XBR = 0x020, ///< extended bitrate extension in ExSS ++ DCA_EXT_EXSS_XXCH = 0x040, ///< XXCh channels extension in ExSS ++ DCA_EXT_EXSS_X96 = 0x080, ///< 96/24 extension in ExSS ++ DCA_EXT_EXSS_LBR = 0x100, ///< low bitrate component in ExSS ++ DCA_EXT_EXSS_XLL = 0x200, ///< lossless extension in ExSS ++}; ++ ++/* -1 are reserved or unknown */ ++static const int dca_ext_audio_descr_mask[] = { ++ DCA_EXT_XCH, ++ -1, ++ DCA_EXT_X96, ++ DCA_EXT_XCH | DCA_EXT_X96, ++ -1, ++ -1, ++ DCA_EXT_XXCH, ++ -1, ++}; ++ ++/* extensions that reside in core substream */ ++#define DCA_CORE_EXTS (DCA_EXT_XCH | DCA_EXT_XXCH | DCA_EXT_X96) ++ ++/* Tables for mapping dts channel configurations to libavcodec multichannel api. ++ * Some compromises have been made for special configurations. Most configurations ++ * are never used so complete accuracy is not needed. ++ * ++ * L = left, R = right, C = center, S = surround, F = front, R = rear, T = total, OV = overhead. ++ * S -> side, when both rear and back are configured move one of them to the side channel ++ * OV -> center back ++ * All 2 channel configurations -> AV_CH_LAYOUT_STEREO ++ */ ++static const uint64_t dca_core_channel_layout[] = { ++ AV_CH_FRONT_CENTER, ///< 1, A ++ AV_CH_LAYOUT_STEREO, ///< 2, A + B (dual mono) ++ AV_CH_LAYOUT_STEREO, ///< 2, L + R (stereo) ++ AV_CH_LAYOUT_STEREO, ///< 2, (L + R) + (L - R) (sum-difference) ++ AV_CH_LAYOUT_STEREO, ///< 2, LT + RT (left and right total) ++ AV_CH_LAYOUT_STEREO | AV_CH_FRONT_CENTER, ///< 3, C + L + R ++ AV_CH_LAYOUT_STEREO | AV_CH_BACK_CENTER, ///< 3, L + R + S ++ AV_CH_LAYOUT_STEREO | AV_CH_FRONT_CENTER | AV_CH_BACK_CENTER, ///< 4, C + L + R + S ++ AV_CH_LAYOUT_STEREO | AV_CH_SIDE_LEFT | AV_CH_SIDE_RIGHT, ///< 4, L + R + SL + SR ++ ++ AV_CH_LAYOUT_STEREO | AV_CH_FRONT_CENTER | AV_CH_SIDE_LEFT | ++ AV_CH_SIDE_RIGHT, ///< 5, C + L + R + SL + SR ++ ++ AV_CH_LAYOUT_STEREO | AV_CH_SIDE_LEFT | AV_CH_SIDE_RIGHT | ++ AV_CH_FRONT_LEFT_OF_CENTER | AV_CH_FRONT_RIGHT_OF_CENTER, ///< 6, CL + CR + L + R + SL + SR ++ ++ AV_CH_LAYOUT_STEREO | AV_CH_BACK_LEFT | AV_CH_BACK_RIGHT | ++ AV_CH_FRONT_CENTER | AV_CH_BACK_CENTER, ///< 6, C + L + R + LR + RR + OV ++ ++ AV_CH_FRONT_CENTER | AV_CH_FRONT_RIGHT_OF_CENTER | ++ AV_CH_FRONT_LEFT_OF_CENTER | AV_CH_BACK_CENTER | ++ AV_CH_BACK_LEFT | AV_CH_BACK_RIGHT, ///< 6, CF + CR + LF + RF + LR + RR ++ ++ AV_CH_FRONT_LEFT_OF_CENTER | AV_CH_FRONT_CENTER | ++ AV_CH_FRONT_RIGHT_OF_CENTER | AV_CH_LAYOUT_STEREO | ++ AV_CH_SIDE_LEFT | AV_CH_SIDE_RIGHT, ///< 7, CL + C + CR + L + R + SL + SR ++ ++ AV_CH_FRONT_LEFT_OF_CENTER | AV_CH_FRONT_RIGHT_OF_CENTER | ++ AV_CH_LAYOUT_STEREO | AV_CH_SIDE_LEFT | AV_CH_SIDE_RIGHT | ++ AV_CH_BACK_LEFT | AV_CH_BACK_RIGHT, ///< 8, CL + CR + L + R + SL1 + SL2 + SR1 + SR2 ++ ++ AV_CH_FRONT_LEFT_OF_CENTER | AV_CH_FRONT_CENTER | ++ AV_CH_FRONT_RIGHT_OF_CENTER | AV_CH_LAYOUT_STEREO | ++ AV_CH_SIDE_LEFT | AV_CH_BACK_CENTER | AV_CH_SIDE_RIGHT, ///< 8, CL + C + CR + L + R + SL + S + SR ++}; ++ ++static const int8_t dca_lfe_index[] = { ++ 1, 2, 2, 2, 2, 3, 2, 3, 2, 3, 2, 3, 1, 3, 2, 3 ++}; ++ ++static const int8_t dca_channel_reorder_lfe[][9] = { ++ { 0, -1, -1, -1, -1, -1, -1, -1, -1}, ++ { 0, 1, -1, -1, -1, -1, -1, -1, -1}, ++ { 0, 1, -1, -1, -1, -1, -1, -1, -1}, ++ { 0, 1, -1, -1, -1, -1, -1, -1, -1}, ++ { 0, 1, -1, -1, -1, -1, -1, -1, -1}, ++ { 2, 0, 1, -1, -1, -1, -1, -1, -1}, ++ { 0, 1, 3, -1, -1, -1, -1, -1, -1}, ++ { 2, 0, 1, 4, -1, -1, -1, -1, -1}, ++ { 0, 1, 3, 4, -1, -1, -1, -1, -1}, ++ { 2, 0, 1, 4, 5, -1, -1, -1, -1}, ++ { 3, 4, 0, 1, 5, 6, -1, -1, -1}, ++ { 2, 0, 1, 4, 5, 6, -1, -1, -1}, ++ { 0, 6, 4, 5, 2, 3, -1, -1, -1}, ++ { 4, 2, 5, 0, 1, 6, 7, -1, -1}, ++ { 5, 6, 0, 1, 7, 3, 8, 4, -1}, ++ { 4, 2, 5, 0, 1, 6, 8, 7, -1}, ++}; ++ ++static const int8_t dca_channel_reorder_lfe_xch[][9] = { ++ { 0, 2, -1, -1, -1, -1, -1, -1, -1}, ++ { 0, 1, 3, -1, -1, -1, -1, -1, -1}, ++ { 0, 1, 3, -1, -1, -1, -1, -1, -1}, ++ { 0, 1, 3, -1, -1, -1, -1, -1, -1}, ++ { 0, 1, 3, -1, -1, -1, -1, -1, -1}, ++ { 2, 0, 1, 4, -1, -1, -1, -1, -1}, ++ { 0, 1, 3, 4, -1, -1, -1, -1, -1}, ++ { 2, 0, 1, 4, 5, -1, -1, -1, -1}, ++ { 0, 1, 4, 5, 3, -1, -1, -1, -1}, ++ { 2, 0, 1, 5, 6, 4, -1, -1, -1}, ++ { 3, 4, 0, 1, 6, 7, 5, -1, -1}, ++ { 2, 0, 1, 4, 5, 6, 7, -1, -1}, ++ { 0, 6, 4, 5, 2, 3, 7, -1, -1}, ++ { 4, 2, 5, 0, 1, 7, 8, 6, -1}, ++ { 5, 6, 0, 1, 8, 3, 9, 4, 7}, ++ { 4, 2, 5, 0, 1, 6, 9, 8, 7}, ++}; ++ ++static const int8_t dca_channel_reorder_nolfe[][9] = { ++ { 0, -1, -1, -1, -1, -1, -1, -1, -1}, ++ { 0, 1, -1, -1, -1, -1, -1, -1, -1}, ++ { 0, 1, -1, -1, -1, -1, -1, -1, -1}, ++ { 0, 1, -1, -1, -1, -1, -1, -1, -1}, ++ { 0, 1, -1, -1, -1, -1, -1, -1, -1}, ++ { 2, 0, 1, -1, -1, -1, -1, -1, -1}, ++ { 0, 1, 2, -1, -1, -1, -1, -1, -1}, ++ { 2, 0, 1, 3, -1, -1, -1, -1, -1}, ++ { 0, 1, 2, 3, -1, -1, -1, -1, -1}, ++ { 2, 0, 1, 3, 4, -1, -1, -1, -1}, ++ { 2, 3, 0, 1, 4, 5, -1, -1, -1}, ++ { 2, 0, 1, 3, 4, 5, -1, -1, -1}, ++ { 0, 5, 3, 4, 1, 2, -1, -1, -1}, ++ { 3, 2, 4, 0, 1, 5, 6, -1, -1}, ++ { 4, 5, 0, 1, 6, 2, 7, 3, -1}, ++ { 3, 2, 4, 0, 1, 5, 7, 6, -1}, ++}; ++ ++static const int8_t dca_channel_reorder_nolfe_xch[][9] = { ++ { 0, 1, -1, -1, -1, -1, -1, -1, -1}, ++ { 0, 1, 2, -1, -1, -1, -1, -1, -1}, ++ { 0, 1, 2, -1, -1, -1, -1, -1, -1}, ++ { 0, 1, 2, -1, -1, -1, -1, -1, -1}, ++ { 0, 1, 2, -1, -1, -1, -1, -1, -1}, ++ { 2, 0, 1, 3, -1, -1, -1, -1, -1}, ++ { 0, 1, 2, 3, -1, -1, -1, -1, -1}, ++ { 2, 0, 1, 3, 4, -1, -1, -1, -1}, ++ { 0, 1, 3, 4, 2, -1, -1, -1, -1}, ++ { 2, 0, 1, 4, 5, 3, -1, -1, -1}, ++ { 2, 3, 0, 1, 5, 6, 4, -1, -1}, ++ { 2, 0, 1, 3, 4, 5, 6, -1, -1}, ++ { 0, 5, 3, 4, 1, 2, 6, -1, -1}, ++ { 3, 2, 4, 0, 1, 6, 7, 5, -1}, ++ { 4, 5, 0, 1, 7, 2, 8, 3, 6}, ++ { 3, 2, 4, 0, 1, 5, 8, 7, 6}, ++}; ++ ++#define DCA_DOLBY 101 /* FIXME */ ++ ++#define DCA_CHANNEL_BITS 6 ++#define DCA_CHANNEL_MASK 0x3F ++ ++#define DCA_LFE 0x80 ++ ++#define HEADER_SIZE 14 ++ ++#define DCA_MAX_FRAME_SIZE 16384 ++#define DCA_MAX_EXSS_HEADER_SIZE 4096 ++ ++#define DCA_BUFFER_PADDING_SIZE 1024 ++ ++/** Bit allocation */ ++typedef struct { ++ int offset; ///< code values offset ++ int maxbits[8]; ///< max bits in VLC ++ int wrap; ///< wrap for get_vlc2() ++ VLC vlc[8]; ///< actual codes ++} BitAlloc; ++ ++static BitAlloc dca_bitalloc_index; ///< indexes for samples VLC select ++static BitAlloc dca_tmode; ///< transition mode VLCs ++static BitAlloc dca_scalefactor; ///< scalefactor VLCs ++static BitAlloc dca_smpl_bitalloc[11]; ///< samples VLCs ++ ++static av_always_inline int get_bitalloc(GetBitContext *gb, BitAlloc *ba, ++ int idx) ++{ ++ return get_vlc2(gb, ba->vlc[idx].table, ba->vlc[idx].bits, ba->wrap) + ++ ba->offset; ++} ++ ++typedef struct { ++ AVCodecContext *avctx; ++ /* Frame header */ ++ int frame_type; ///< type of the current frame ++ int samples_deficit; ///< deficit sample count ++ int crc_present; ///< crc is present in the bitstream ++ int sample_blocks; ///< number of PCM sample blocks ++ int frame_size; ///< primary frame byte size ++ int amode; ///< audio channels arrangement ++ int sample_rate; ///< audio sampling rate ++ int bit_rate; ///< transmission bit rate ++ int bit_rate_index; ///< transmission bit rate index ++ ++ int downmix; ///< embedded downmix enabled ++ int dynrange; ///< embedded dynamic range flag ++ int timestamp; ///< embedded time stamp flag ++ int aux_data; ///< auxiliary data flag ++ int hdcd; ///< source material is mastered in HDCD ++ int ext_descr; ///< extension audio descriptor flag ++ int ext_coding; ///< extended coding flag ++ int aspf; ///< audio sync word insertion flag ++ int lfe; ///< low frequency effects flag ++ int predictor_history; ///< predictor history flag ++ int header_crc; ///< header crc check bytes ++ int multirate_inter; ///< multirate interpolator switch ++ int version; ///< encoder software revision ++ int copy_history; ///< copy history ++ int source_pcm_res; ///< source pcm resolution ++ int front_sum; ///< front sum/difference flag ++ int surround_sum; ///< surround sum/difference flag ++ int dialog_norm; ///< dialog normalisation parameter ++ ++ /* Primary audio coding header */ ++ int subframes; ///< number of subframes ++ int total_channels; ///< number of channels including extensions ++ int prim_channels; ///< number of primary audio channels ++ int subband_activity[DCA_PRIM_CHANNELS_MAX]; ///< subband activity count ++ int vq_start_subband[DCA_PRIM_CHANNELS_MAX]; ///< high frequency vq start subband ++ int joint_intensity[DCA_PRIM_CHANNELS_MAX]; ///< joint intensity coding index ++ int transient_huffman[DCA_PRIM_CHANNELS_MAX]; ///< transient mode code book ++ int scalefactor_huffman[DCA_PRIM_CHANNELS_MAX]; ///< scale factor code book ++ int bitalloc_huffman[DCA_PRIM_CHANNELS_MAX]; ///< bit allocation quantizer select ++ int quant_index_huffman[DCA_PRIM_CHANNELS_MAX][DCA_ABITS_MAX]; ///< quantization index codebook select ++ float scalefactor_adj[DCA_PRIM_CHANNELS_MAX][DCA_ABITS_MAX]; ///< scale factor adjustment ++ ++ /* Primary audio coding side information */ ++ int subsubframes[DCA_SUBFRAMES_MAX]; ///< number of subsubframes ++ int partial_samples[DCA_SUBFRAMES_MAX]; ///< partial subsubframe samples count ++ int prediction_mode[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS]; ///< prediction mode (ADPCM used or not) ++ int prediction_vq[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS]; ///< prediction VQ coefs ++ int bitalloc[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS]; ///< bit allocation index ++ int transition_mode[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS]; ///< transition mode (transients) ++ int scale_factor[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS][2]; ///< scale factors (2 if transient) ++ int joint_huff[DCA_PRIM_CHANNELS_MAX]; ///< joint subband scale factors codebook ++ int joint_scale_factor[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS]; ///< joint subband scale factors ++ int downmix_coef[DCA_PRIM_CHANNELS_MAX][2]; ///< stereo downmix coefficients ++ int dynrange_coef; ///< dynamic range coefficient ++ ++ int high_freq_vq[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS]; ///< VQ encoded high frequency subbands ++ ++ float lfe_data[2 * DCA_LFE_MAX * (DCA_BLOCKS_MAX + 4)]; ///< Low frequency effect data ++ int lfe_scale_factor; ++ ++ /* Subband samples history (for ADPCM) */ ++ DECLARE_ALIGNED(16, float, subband_samples_hist)[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS][4]; ++ DECLARE_ALIGNED(32, float, subband_fir_hist)[DCA_PRIM_CHANNELS_MAX][512]; ++ DECLARE_ALIGNED(32, float, subband_fir_noidea)[DCA_PRIM_CHANNELS_MAX][32]; ++ int hist_index[DCA_PRIM_CHANNELS_MAX]; ++ DECLARE_ALIGNED(32, float, raXin)[32]; ++ ++ int output; ///< type of output ++ ++ DECLARE_ALIGNED(32, float, subband_samples)[DCA_BLOCKS_MAX][DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS][8]; ++ float *samples_chanptr[DCA_PRIM_CHANNELS_MAX + 1]; ++ float *extra_channels[DCA_PRIM_CHANNELS_MAX + 1]; ++ uint8_t *extra_channels_buffer; ++ unsigned int extra_channels_buffer_size; ++ ++ uint8_t dca_buffer[DCA_MAX_FRAME_SIZE + DCA_MAX_EXSS_HEADER_SIZE + DCA_BUFFER_PADDING_SIZE]; ++ int dca_buffer_size; ///< how much data is in the dca_buffer ++ ++ const int8_t *channel_order_tab; ///< channel reordering table, lfe and non lfe ++ GetBitContext gb; ++ /* Current position in DCA frame */ ++ int current_subframe; ++ int current_subsubframe; ++ ++ int core_ext_mask; ///< present extensions in the core substream ++ ++ /* XCh extension information */ ++ int xch_present; ///< XCh extension present and valid ++ int xch_base_channel; ///< index of first (only) channel containing XCH data ++ ++ /* XXCH extension information */ ++ int xxch_chset; ++ int xxch_nbits_spk_mask; ++ uint32_t xxch_core_spkmask; ++ uint32_t xxch_spk_masks[4]; /* speaker masks, last element is core mask */ ++ int xxch_chset_nch[4]; ++ float xxch_dmix_sf[DCA_CHSETS_MAX]; ++ ++ uint32_t xxch_dmix_embedded; /* lower layer has mix pre-embedded, per chset */ ++ float xxch_dmix_coeff[DCA_PRIM_CHANNELS_MAX][32]; /* worst case sizing */ ++ ++ int8_t xxch_order_tab[32]; ++ int8_t lfe_index; ++ ++ /* ExSS header parser */ ++ int static_fields; ///< static fields present ++ int mix_metadata; ///< mixing metadata present ++ int num_mix_configs; ///< number of mix out configurations ++ int mix_config_num_ch[4]; ///< number of channels in each mix out configuration ++ ++ int profile; ++ ++ int debug_flag; ///< used for suppressing repeated error messages output ++ AVFloatDSPContext fdsp; ++ FFTContext imdct; ++ SynthFilterContext synth; ++ DCADSPContext dcadsp; ++ FmtConvertContext fmt_conv; ++} DCAContext; ++ ++static const uint16_t dca_vlc_offs[] = { ++ 0, 512, 640, 768, 1282, 1794, 2436, 3080, 3770, 4454, 5364, ++ 5372, 5380, 5388, 5392, 5396, 5412, 5420, 5428, 5460, 5492, 5508, ++ 5572, 5604, 5668, 5796, 5860, 5892, 6412, 6668, 6796, 7308, 7564, ++ 7820, 8076, 8620, 9132, 9388, 9910, 10166, 10680, 11196, 11726, 12240, ++ 12752, 13298, 13810, 14326, 14840, 15500, 16022, 16540, 17158, 17678, 18264, ++ 18796, 19352, 19926, 20468, 21472, 22398, 23014, 23622, ++}; ++ ++static av_cold void dca_init_vlcs(void) ++{ ++ static int vlcs_initialized = 0; ++ int i, j, c = 14; ++ static VLC_TYPE dca_table[23622][2]; ++ ++ if (vlcs_initialized) ++ return; ++ ++ dca_bitalloc_index.offset = 1; ++ dca_bitalloc_index.wrap = 2; ++ for (i = 0; i < 5; i++) { ++ dca_bitalloc_index.vlc[i].table = &dca_table[dca_vlc_offs[i]]; ++ dca_bitalloc_index.vlc[i].table_allocated = dca_vlc_offs[i + 1] - dca_vlc_offs[i]; ++ init_vlc(&dca_bitalloc_index.vlc[i], bitalloc_12_vlc_bits[i], 12, ++ bitalloc_12_bits[i], 1, 1, ++ bitalloc_12_codes[i], 2, 2, INIT_VLC_USE_NEW_STATIC); ++ } ++ dca_scalefactor.offset = -64; ++ dca_scalefactor.wrap = 2; ++ for (i = 0; i < 5; i++) { ++ dca_scalefactor.vlc[i].table = &dca_table[dca_vlc_offs[i + 5]]; ++ dca_scalefactor.vlc[i].table_allocated = dca_vlc_offs[i + 6] - dca_vlc_offs[i + 5]; ++ init_vlc(&dca_scalefactor.vlc[i], SCALES_VLC_BITS, 129, ++ scales_bits[i], 1, 1, ++ scales_codes[i], 2, 2, INIT_VLC_USE_NEW_STATIC); ++ } ++ dca_tmode.offset = 0; ++ dca_tmode.wrap = 1; ++ for (i = 0; i < 4; i++) { ++ dca_tmode.vlc[i].table = &dca_table[dca_vlc_offs[i + 10]]; ++ dca_tmode.vlc[i].table_allocated = dca_vlc_offs[i + 11] - dca_vlc_offs[i + 10]; ++ init_vlc(&dca_tmode.vlc[i], tmode_vlc_bits[i], 4, ++ tmode_bits[i], 1, 1, ++ tmode_codes[i], 2, 2, INIT_VLC_USE_NEW_STATIC); ++ } ++ ++ for (i = 0; i < 10; i++) ++ for (j = 0; j < 7; j++) { ++ if (!bitalloc_codes[i][j]) ++ break; ++ dca_smpl_bitalloc[i + 1].offset = bitalloc_offsets[i]; ++ dca_smpl_bitalloc[i + 1].wrap = 1 + (j > 4); ++ dca_smpl_bitalloc[i + 1].vlc[j].table = &dca_table[dca_vlc_offs[c]]; ++ dca_smpl_bitalloc[i + 1].vlc[j].table_allocated = dca_vlc_offs[c + 1] - dca_vlc_offs[c]; ++ ++ init_vlc(&dca_smpl_bitalloc[i + 1].vlc[j], bitalloc_maxbits[i][j], ++ bitalloc_sizes[i], ++ bitalloc_bits[i][j], 1, 1, ++ bitalloc_codes[i][j], 2, 2, INIT_VLC_USE_NEW_STATIC); ++ c++; ++ } ++ vlcs_initialized = 1; ++} ++ ++static inline void get_array(GetBitContext *gb, int *dst, int len, int bits) ++{ ++ while (len--) ++ *dst++ = get_bits(gb, bits); ++} ++ ++static inline int dca_xxch2index(DCAContext *s, int xxch_ch) ++{ ++ int i, base, mask; ++ ++ /* locate channel set containing the channel */ ++ for (i = -1, base = 0, mask = (s->xxch_core_spkmask & ~DCA_XXCH_LFE1); ++ i <= s->xxch_chset && !(mask & xxch_ch); mask = s->xxch_spk_masks[++i]) ++ base += av_popcount(mask); ++ ++ return base + av_popcount(mask & (xxch_ch - 1)); ++} ++ ++static int dca_parse_audio_coding_header(DCAContext *s, int base_channel, ++ int xxch) ++{ ++ int i, j; ++ static const float adj_table[4] = { 1.0, 1.1250, 1.2500, 1.4375 }; ++ static const int bitlen[11] = { 0, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3 }; ++ static const int thr[11] = { 0, 1, 3, 3, 3, 3, 7, 7, 7, 7, 7 }; ++ int hdr_pos = 0, hdr_size = 0; ++ float sign, mag, scale_factor; ++ int this_chans, acc_mask; ++ int embedded_downmix; ++ int nchans, mask[8]; ++ int coeff, ichan; ++ ++ /* xxch has arbitrary sized audio coding headers */ ++ if (xxch) { ++ hdr_pos = get_bits_count(&s->gb); ++ hdr_size = get_bits(&s->gb, 7) + 1; ++ } ++ ++ nchans = get_bits(&s->gb, 3) + 1; ++ s->total_channels = nchans + base_channel; ++ s->prim_channels = s->total_channels; ++ ++ /* obtain speaker layout mask & downmix coefficients for XXCH */ ++ if (xxch) { ++ acc_mask = s->xxch_core_spkmask; ++ ++ this_chans = get_bits(&s->gb, s->xxch_nbits_spk_mask - 6) << 6; ++ s->xxch_spk_masks[s->xxch_chset] = this_chans; ++ s->xxch_chset_nch[s->xxch_chset] = nchans; ++ ++ for (i = 0; i <= s->xxch_chset; i++) ++ acc_mask |= s->xxch_spk_masks[i]; ++ ++ /* check for downmixing information */ ++ if (get_bits1(&s->gb)) { ++ embedded_downmix = get_bits1(&s->gb); ++ scale_factor = ++ 1.0f / dca_downmix_scale_factors[(get_bits(&s->gb, 6) - 1) << 2]; ++ ++ s->xxch_dmix_sf[s->xxch_chset] = scale_factor; ++ ++ for (i = base_channel; i < s->prim_channels; i++) { ++ mask[i] = get_bits(&s->gb, s->xxch_nbits_spk_mask); ++ } ++ ++ for (j = base_channel; j < s->prim_channels; j++) { ++ memset(s->xxch_dmix_coeff[j], 0, sizeof(s->xxch_dmix_coeff[0])); ++ s->xxch_dmix_embedded |= (embedded_downmix << j); ++ for (i = 0; i < s->xxch_nbits_spk_mask; i++) { ++ if (mask[j] & (1 << i)) { ++ if ((1 << i) == DCA_XXCH_LFE1) { ++ av_log(s->avctx, AV_LOG_WARNING, ++ "DCA-XXCH: dmix to LFE1 not supported.\n"); ++ continue; ++ } ++ ++ coeff = get_bits(&s->gb, 7); ++ sign = (coeff & 64) ? 1.0 : -1.0; ++ mag = dca_downmix_scale_factors[((coeff & 63) - 1) << 2]; ++ ichan = dca_xxch2index(s, 1 << i); ++ s->xxch_dmix_coeff[j][ichan] = sign * mag; ++ } ++ } ++ } ++ } ++ } ++ ++ if (s->prim_channels > DCA_PRIM_CHANNELS_MAX) ++ s->prim_channels = DCA_PRIM_CHANNELS_MAX; ++ ++ ++ for (i = base_channel; i < s->prim_channels; i++) { ++ s->subband_activity[i] = get_bits(&s->gb, 5) + 2; ++ if (s->subband_activity[i] > DCA_SUBBANDS) ++ s->subband_activity[i] = DCA_SUBBANDS; ++ } ++ for (i = base_channel; i < s->prim_channels; i++) { ++ s->vq_start_subband[i] = get_bits(&s->gb, 5) + 1; ++ if (s->vq_start_subband[i] > DCA_SUBBANDS) ++ s->vq_start_subband[i] = DCA_SUBBANDS; ++ } ++ get_array(&s->gb, s->joint_intensity + base_channel, s->prim_channels - base_channel, 3); ++ get_array(&s->gb, s->transient_huffman + base_channel, s->prim_channels - base_channel, 2); ++ get_array(&s->gb, s->scalefactor_huffman + base_channel, s->prim_channels - base_channel, 3); ++ get_array(&s->gb, s->bitalloc_huffman + base_channel, s->prim_channels - base_channel, 3); ++ ++ /* Get codebooks quantization indexes */ ++ if (!base_channel) ++ memset(s->quant_index_huffman, 0, sizeof(s->quant_index_huffman)); ++ for (j = 1; j < 11; j++) ++ for (i = base_channel; i < s->prim_channels; i++) ++ s->quant_index_huffman[i][j] = get_bits(&s->gb, bitlen[j]); ++ ++ /* Get scale factor adjustment */ ++ for (j = 0; j < 11; j++) ++ for (i = base_channel; i < s->prim_channels; i++) ++ s->scalefactor_adj[i][j] = 1; ++ ++ for (j = 1; j < 11; j++) ++ for (i = base_channel; i < s->prim_channels; i++) ++ if (s->quant_index_huffman[i][j] < thr[j]) ++ s->scalefactor_adj[i][j] = adj_table[get_bits(&s->gb, 2)]; ++ ++ if (!xxch) { ++ if (s->crc_present) { ++ /* Audio header CRC check */ ++ get_bits(&s->gb, 16); ++ } ++ } else { ++ /* Skip to the end of the header, also ignore CRC if present */ ++ i = get_bits_count(&s->gb); ++ if (hdr_pos + 8 * hdr_size > i) ++ skip_bits_long(&s->gb, hdr_pos + 8 * hdr_size - i); ++ } ++ ++ s->current_subframe = 0; ++ s->current_subsubframe = 0; ++ ++#ifdef TRACE ++ av_log(s->avctx, AV_LOG_DEBUG, "subframes: %i\n", s->subframes); ++ av_log(s->avctx, AV_LOG_DEBUG, "prim channels: %i\n", s->prim_channels); ++ for (i = base_channel; i < s->prim_channels; i++) { ++ av_log(s->avctx, AV_LOG_DEBUG, "subband activity: %i\n", ++ s->subband_activity[i]); ++ av_log(s->avctx, AV_LOG_DEBUG, "vq start subband: %i\n", ++ s->vq_start_subband[i]); ++ av_log(s->avctx, AV_LOG_DEBUG, "joint intensity: %i\n", ++ s->joint_intensity[i]); ++ av_log(s->avctx, AV_LOG_DEBUG, "transient mode codebook: %i\n", ++ s->transient_huffman[i]); ++ av_log(s->avctx, AV_LOG_DEBUG, "scale factor codebook: %i\n", ++ s->scalefactor_huffman[i]); ++ av_log(s->avctx, AV_LOG_DEBUG, "bit allocation quantizer: %i\n", ++ s->bitalloc_huffman[i]); ++ av_log(s->avctx, AV_LOG_DEBUG, "quant index huff:"); ++ for (j = 0; j < 11; j++) ++ av_log(s->avctx, AV_LOG_DEBUG, " %i", s->quant_index_huffman[i][j]); ++ av_log(s->avctx, AV_LOG_DEBUG, "\n"); ++ av_log(s->avctx, AV_LOG_DEBUG, "scalefac adj:"); ++ for (j = 0; j < 11; j++) ++ av_log(s->avctx, AV_LOG_DEBUG, " %1.3f", s->scalefactor_adj[i][j]); ++ av_log(s->avctx, AV_LOG_DEBUG, "\n"); ++ } ++#endif ++ ++ return 0; ++} ++ ++static int dca_parse_frame_header(DCAContext *s) ++{ ++ init_get_bits(&s->gb, s->dca_buffer, s->dca_buffer_size * 8); ++ ++ /* Sync code */ ++ skip_bits_long(&s->gb, 32); ++ ++ /* Frame header */ ++ s->frame_type = get_bits(&s->gb, 1); ++ s->samples_deficit = get_bits(&s->gb, 5) + 1; ++ s->crc_present = get_bits(&s->gb, 1); ++ s->sample_blocks = get_bits(&s->gb, 7) + 1; ++ s->frame_size = get_bits(&s->gb, 14) + 1; ++ if (s->frame_size < 95) ++ return AVERROR_INVALIDDATA; ++ s->amode = get_bits(&s->gb, 6); ++ s->sample_rate = avpriv_dca_sample_rates[get_bits(&s->gb, 4)]; ++ if (!s->sample_rate) ++ return AVERROR_INVALIDDATA; ++ s->bit_rate_index = get_bits(&s->gb, 5); ++ s->bit_rate = dca_bit_rates[s->bit_rate_index]; ++ if (!s->bit_rate) ++ return AVERROR_INVALIDDATA; ++ ++ s->downmix = get_bits(&s->gb, 1); /* note: this is FixedBit == 0 */ ++ s->dynrange = get_bits(&s->gb, 1); ++ s->timestamp = get_bits(&s->gb, 1); ++ s->aux_data = get_bits(&s->gb, 1); ++ s->hdcd = get_bits(&s->gb, 1); ++ s->ext_descr = get_bits(&s->gb, 3); ++ s->ext_coding = get_bits(&s->gb, 1); ++ s->aspf = get_bits(&s->gb, 1); ++ s->lfe = get_bits(&s->gb, 2); ++ s->predictor_history = get_bits(&s->gb, 1); ++ ++ if (s->lfe == 3) { ++ s->lfe = 0; ++ av_log_ask_for_sample(s->avctx, "LFE is 3\n"); ++ return AVERROR_PATCHWELCOME; ++ } ++ ++ /* TODO: check CRC */ ++ if (s->crc_present) ++ s->header_crc = get_bits(&s->gb, 16); ++ ++ s->multirate_inter = get_bits(&s->gb, 1); ++ s->version = get_bits(&s->gb, 4); ++ s->copy_history = get_bits(&s->gb, 2); ++ s->source_pcm_res = get_bits(&s->gb, 3); ++ s->front_sum = get_bits(&s->gb, 1); ++ s->surround_sum = get_bits(&s->gb, 1); ++ s->dialog_norm = get_bits(&s->gb, 4); ++ ++ /* FIXME: channels mixing levels */ ++ s->output = s->amode; ++ if (s->lfe) ++ s->output |= DCA_LFE; ++ ++#ifdef TRACE ++ av_log(s->avctx, AV_LOG_DEBUG, "frame type: %i\n", s->frame_type); ++ av_log(s->avctx, AV_LOG_DEBUG, "samples deficit: %i\n", s->samples_deficit); ++ av_log(s->avctx, AV_LOG_DEBUG, "crc present: %i\n", s->crc_present); ++ av_log(s->avctx, AV_LOG_DEBUG, "sample blocks: %i (%i samples)\n", ++ s->sample_blocks, s->sample_blocks * 32); ++ av_log(s->avctx, AV_LOG_DEBUG, "frame size: %i bytes\n", s->frame_size); ++ av_log(s->avctx, AV_LOG_DEBUG, "amode: %i (%i channels)\n", ++ s->amode, dca_channels[s->amode]); ++ av_log(s->avctx, AV_LOG_DEBUG, "sample rate: %i Hz\n", ++ s->sample_rate); ++ av_log(s->avctx, AV_LOG_DEBUG, "bit rate: %i bits/s\n", ++ s->bit_rate); ++ av_log(s->avctx, AV_LOG_DEBUG, "downmix: %i\n", s->downmix); ++ av_log(s->avctx, AV_LOG_DEBUG, "dynrange: %i\n", s->dynrange); ++ av_log(s->avctx, AV_LOG_DEBUG, "timestamp: %i\n", s->timestamp); ++ av_log(s->avctx, AV_LOG_DEBUG, "aux_data: %i\n", s->aux_data); ++ av_log(s->avctx, AV_LOG_DEBUG, "hdcd: %i\n", s->hdcd); ++ av_log(s->avctx, AV_LOG_DEBUG, "ext descr: %i\n", s->ext_descr); ++ av_log(s->avctx, AV_LOG_DEBUG, "ext coding: %i\n", s->ext_coding); ++ av_log(s->avctx, AV_LOG_DEBUG, "aspf: %i\n", s->aspf); ++ av_log(s->avctx, AV_LOG_DEBUG, "lfe: %i\n", s->lfe); ++ av_log(s->avctx, AV_LOG_DEBUG, "predictor history: %i\n", ++ s->predictor_history); ++ av_log(s->avctx, AV_LOG_DEBUG, "header crc: %i\n", s->header_crc); ++ av_log(s->avctx, AV_LOG_DEBUG, "multirate inter: %i\n", ++ s->multirate_inter); ++ av_log(s->avctx, AV_LOG_DEBUG, "version number: %i\n", s->version); ++ av_log(s->avctx, AV_LOG_DEBUG, "copy history: %i\n", s->copy_history); ++ av_log(s->avctx, AV_LOG_DEBUG, ++ "source pcm resolution: %i (%i bits/sample)\n", ++ s->source_pcm_res, dca_bits_per_sample[s->source_pcm_res]); ++ av_log(s->avctx, AV_LOG_DEBUG, "front sum: %i\n", s->front_sum); ++ av_log(s->avctx, AV_LOG_DEBUG, "surround sum: %i\n", s->surround_sum); ++ av_log(s->avctx, AV_LOG_DEBUG, "dialog norm: %i\n", s->dialog_norm); ++ av_log(s->avctx, AV_LOG_DEBUG, "\n"); ++#endif ++ ++ /* Primary audio coding header */ ++ s->subframes = get_bits(&s->gb, 4) + 1; ++ ++ return dca_parse_audio_coding_header(s, 0, 0); ++} ++ ++ ++static inline int get_scale(GetBitContext *gb, int level, int value, int log2range) ++{ ++ if (level < 5) { ++ /* huffman encoded */ ++ value += get_bitalloc(gb, &dca_scalefactor, level); ++ value = av_clip(value, 0, (1 << log2range) - 1); ++ } else if (level < 8) { ++ if (level + 1 > log2range) { ++ skip_bits(gb, level + 1 - log2range); ++ value = get_bits(gb, log2range); ++ } else { ++ value = get_bits(gb, level + 1); ++ } ++ } ++ return value; ++} ++ ++static int dca_subframe_header(DCAContext *s, int base_channel, int block_index) ++{ ++ /* Primary audio coding side information */ ++ int j, k; ++ ++ if (get_bits_left(&s->gb) < 0) ++ return AVERROR_INVALIDDATA; ++ ++ if (!base_channel) { ++ s->subsubframes[s->current_subframe] = get_bits(&s->gb, 2) + 1; ++ s->partial_samples[s->current_subframe] = get_bits(&s->gb, 3); ++ } ++ ++ for (j = base_channel; j < s->prim_channels; j++) { ++ for (k = 0; k < s->subband_activity[j]; k++) ++ s->prediction_mode[j][k] = get_bits(&s->gb, 1); ++ } ++ ++ /* Get prediction codebook */ ++ for (j = base_channel; j < s->prim_channels; j++) { ++ for (k = 0; k < s->subband_activity[j]; k++) { ++ if (s->prediction_mode[j][k] > 0) { ++ /* (Prediction coefficient VQ address) */ ++ s->prediction_vq[j][k] = get_bits(&s->gb, 12); ++ } ++ } ++ } ++ ++ /* Bit allocation index */ ++ for (j = base_channel; j < s->prim_channels; j++) { ++ for (k = 0; k < s->vq_start_subband[j]; k++) { ++ if (s->bitalloc_huffman[j] == 6) ++ s->bitalloc[j][k] = get_bits(&s->gb, 5); ++ else if (s->bitalloc_huffman[j] == 5) ++ s->bitalloc[j][k] = get_bits(&s->gb, 4); ++ else if (s->bitalloc_huffman[j] == 7) { ++ av_log(s->avctx, AV_LOG_ERROR, ++ "Invalid bit allocation index\n"); ++ return AVERROR_INVALIDDATA; ++ } else { ++ s->bitalloc[j][k] = ++ get_bitalloc(&s->gb, &dca_bitalloc_index, s->bitalloc_huffman[j]); ++ } ++ ++ if (s->bitalloc[j][k] > 26) { ++ av_dlog(s->avctx, "bitalloc index [%i][%i] too big (%i)\n", ++ j, k, s->bitalloc[j][k]); ++ return AVERROR_INVALIDDATA; ++ } ++ } ++ } ++ ++ /* Transition mode */ ++ for (j = base_channel; j < s->prim_channels; j++) { ++ for (k = 0; k < s->subband_activity[j]; k++) { ++ s->transition_mode[j][k] = 0; ++ if (s->subsubframes[s->current_subframe] > 1 && ++ k < s->vq_start_subband[j] && s->bitalloc[j][k] > 0) { ++ s->transition_mode[j][k] = ++ get_bitalloc(&s->gb, &dca_tmode, s->transient_huffman[j]); ++ } ++ } ++ } ++ ++ if (get_bits_left(&s->gb) < 0) ++ return AVERROR_INVALIDDATA; ++ ++ for (j = base_channel; j < s->prim_channels; j++) { ++ const uint32_t *scale_table; ++ int scale_sum, log_size; ++ ++ memset(s->scale_factor[j], 0, ++ s->subband_activity[j] * sizeof(s->scale_factor[0][0][0]) * 2); ++ ++ if (s->scalefactor_huffman[j] == 6) { ++ scale_table = scale_factor_quant7; ++ log_size = 7; ++ } else { ++ scale_table = scale_factor_quant6; ++ log_size = 6; ++ } ++ ++ /* When huffman coded, only the difference is encoded */ ++ scale_sum = 0; ++ ++ for (k = 0; k < s->subband_activity[j]; k++) { ++ if (k >= s->vq_start_subband[j] || s->bitalloc[j][k] > 0) { ++ scale_sum = get_scale(&s->gb, s->scalefactor_huffman[j], scale_sum, log_size); ++ s->scale_factor[j][k][0] = scale_table[scale_sum]; ++ } ++ ++ if (k < s->vq_start_subband[j] && s->transition_mode[j][k]) { ++ /* Get second scale factor */ ++ scale_sum = get_scale(&s->gb, s->scalefactor_huffman[j], scale_sum, log_size); ++ s->scale_factor[j][k][1] = scale_table[scale_sum]; ++ } ++ } ++ } ++ ++ /* Joint subband scale factor codebook select */ ++ for (j = base_channel; j < s->prim_channels; j++) { ++ /* Transmitted only if joint subband coding enabled */ ++ if (s->joint_intensity[j] > 0) ++ s->joint_huff[j] = get_bits(&s->gb, 3); ++ } ++ ++ if (get_bits_left(&s->gb) < 0) ++ return AVERROR_INVALIDDATA; ++ ++ /* Scale factors for joint subband coding */ ++ for (j = base_channel; j < s->prim_channels; j++) { ++ int source_channel; ++ ++ /* Transmitted only if joint subband coding enabled */ ++ if (s->joint_intensity[j] > 0) { ++ int scale = 0; ++ source_channel = s->joint_intensity[j] - 1; ++ ++ /* When huffman coded, only the difference is encoded ++ * (is this valid as well for joint scales ???) */ ++ ++ for (k = s->subband_activity[j]; k < s->subband_activity[source_channel]; k++) { ++ scale = get_scale(&s->gb, s->joint_huff[j], 64 /* bias */, 7); ++ s->joint_scale_factor[j][k] = scale; /*joint_scale_table[scale]; */ ++ } ++ ++ if (!(s->debug_flag & 0x02)) { ++ av_log(s->avctx, AV_LOG_DEBUG, ++ "Joint stereo coding not supported\n"); ++ s->debug_flag |= 0x02; ++ } ++ } ++ } ++ ++ /* Stereo downmix coefficients */ ++ if (!base_channel && s->prim_channels > 2) { ++ if (s->downmix) { ++ for (j = base_channel; j < s->prim_channels; j++) { ++ s->downmix_coef[j][0] = get_bits(&s->gb, 7); ++ s->downmix_coef[j][1] = get_bits(&s->gb, 7); ++ } ++ } else { ++ int am = s->amode & DCA_CHANNEL_MASK; ++ if (am >= FF_ARRAY_ELEMS(dca_default_coeffs)) { ++ av_log(s->avctx, AV_LOG_ERROR, ++ "Invalid channel mode %d\n", am); ++ return AVERROR_INVALIDDATA; ++ } ++ for (j = base_channel; j < FFMIN(s->prim_channels, FF_ARRAY_ELEMS(dca_default_coeffs[am])); j++) { ++ s->downmix_coef[j][0] = dca_default_coeffs[am][j][0]; ++ s->downmix_coef[j][1] = dca_default_coeffs[am][j][1]; ++ } ++ } ++ } ++ ++ /* Dynamic range coefficient */ ++ if (!base_channel && s->dynrange) ++ s->dynrange_coef = get_bits(&s->gb, 8); ++ ++ /* Side information CRC check word */ ++ if (s->crc_present) { ++ get_bits(&s->gb, 16); ++ } ++ ++ /* ++ * Primary audio data arrays ++ */ ++ ++ /* VQ encoded high frequency subbands */ ++ for (j = base_channel; j < s->prim_channels; j++) ++ for (k = s->vq_start_subband[j]; k < s->subband_activity[j]; k++) ++ /* 1 vector -> 32 samples */ ++ s->high_freq_vq[j][k] = get_bits(&s->gb, 10); ++ ++ /* Low frequency effect data */ ++ if (!base_channel && s->lfe) { ++ int quant7; ++ /* LFE samples */ ++ int lfe_samples = 2 * s->lfe * (4 + block_index); ++ int lfe_end_sample = 2 * s->lfe * (4 + block_index + s->subsubframes[s->current_subframe]); ++ float lfe_scale; ++ ++ for (j = lfe_samples; j < lfe_end_sample; j++) { ++ /* Signed 8 bits int */ ++ s->lfe_data[j] = get_sbits(&s->gb, 8); ++ } ++ ++ /* Scale factor index */ ++ quant7 = get_bits(&s->gb, 8); ++ if (quant7 > 127) { ++ av_log_ask_for_sample(s->avctx, "LFEScaleIndex larger than 127\n"); ++ return AVERROR_INVALIDDATA; ++ } ++ s->lfe_scale_factor = scale_factor_quant7[quant7]; ++ ++ /* Quantization step size * scale factor */ ++ lfe_scale = 0.035 * s->lfe_scale_factor; ++ ++ for (j = lfe_samples; j < lfe_end_sample; j++) ++ s->lfe_data[j] *= lfe_scale; ++ } ++ ++#ifdef TRACE ++ av_log(s->avctx, AV_LOG_DEBUG, "subsubframes: %i\n", ++ s->subsubframes[s->current_subframe]); ++ av_log(s->avctx, AV_LOG_DEBUG, "partial samples: %i\n", ++ s->partial_samples[s->current_subframe]); ++ ++ for (j = base_channel; j < s->prim_channels; j++) { ++ av_log(s->avctx, AV_LOG_DEBUG, "prediction mode:"); ++ for (k = 0; k < s->subband_activity[j]; k++) ++ av_log(s->avctx, AV_LOG_DEBUG, " %i", s->prediction_mode[j][k]); ++ av_log(s->avctx, AV_LOG_DEBUG, "\n"); ++ } ++ for (j = base_channel; j < s->prim_channels; j++) { ++ for (k = 0; k < s->subband_activity[j]; k++) ++ av_log(s->avctx, AV_LOG_DEBUG, ++ "prediction coefs: %f, %f, %f, %f\n", ++ (float) adpcm_vb[s->prediction_vq[j][k]][0] / 8192, ++ (float) adpcm_vb[s->prediction_vq[j][k]][1] / 8192, ++ (float) adpcm_vb[s->prediction_vq[j][k]][2] / 8192, ++ (float) adpcm_vb[s->prediction_vq[j][k]][3] / 8192); ++ } ++ for (j = base_channel; j < s->prim_channels; j++) { ++ av_log(s->avctx, AV_LOG_DEBUG, "bitalloc index: "); ++ for (k = 0; k < s->vq_start_subband[j]; k++) ++ av_log(s->avctx, AV_LOG_DEBUG, "%2.2i ", s->bitalloc[j][k]); ++ av_log(s->avctx, AV_LOG_DEBUG, "\n"); ++ } ++ for (j = base_channel; j < s->prim_channels; j++) { ++ av_log(s->avctx, AV_LOG_DEBUG, "Transition mode:"); ++ for (k = 0; k < s->subband_activity[j]; k++) ++ av_log(s->avctx, AV_LOG_DEBUG, " %i", s->transition_mode[j][k]); ++ av_log(s->avctx, AV_LOG_DEBUG, "\n"); ++ } ++ for (j = base_channel; j < s->prim_channels; j++) { ++ av_log(s->avctx, AV_LOG_DEBUG, "Scale factor:"); ++ for (k = 0; k < s->subband_activity[j]; k++) { ++ if (k >= s->vq_start_subband[j] || s->bitalloc[j][k] > 0) ++ av_log(s->avctx, AV_LOG_DEBUG, " %i", s->scale_factor[j][k][0]); ++ if (k < s->vq_start_subband[j] && s->transition_mode[j][k]) ++ av_log(s->avctx, AV_LOG_DEBUG, " %i(t)", s->scale_factor[j][k][1]); ++ } ++ av_log(s->avctx, AV_LOG_DEBUG, "\n"); ++ } ++ for (j = base_channel; j < s->prim_channels; j++) { ++ if (s->joint_intensity[j] > 0) { ++ int source_channel = s->joint_intensity[j] - 1; ++ av_log(s->avctx, AV_LOG_DEBUG, "Joint scale factor index:\n"); ++ for (k = s->subband_activity[j]; k < s->subband_activity[source_channel]; k++) ++ av_log(s->avctx, AV_LOG_DEBUG, " %i", s->joint_scale_factor[j][k]); ++ av_log(s->avctx, AV_LOG_DEBUG, "\n"); ++ } ++ } ++ if (!base_channel && s->prim_channels > 2 && s->downmix) { ++ av_log(s->avctx, AV_LOG_DEBUG, "Downmix coeffs:\n"); ++ for (j = 0; j < s->prim_channels; j++) { ++ av_log(s->avctx, AV_LOG_DEBUG, "Channel 0, %d = %f\n", j, ++ dca_downmix_coeffs[s->downmix_coef[j][0]]); ++ av_log(s->avctx, AV_LOG_DEBUG, "Channel 1, %d = %f\n", j, ++ dca_downmix_coeffs[s->downmix_coef[j][1]]); ++ } ++ av_log(s->avctx, AV_LOG_DEBUG, "\n"); ++ } ++ for (j = base_channel; j < s->prim_channels; j++) ++ for (k = s->vq_start_subband[j]; k < s->subband_activity[j]; k++) ++ av_log(s->avctx, AV_LOG_DEBUG, "VQ index: %i\n", s->high_freq_vq[j][k]); ++ if (!base_channel && s->lfe) { ++ int lfe_samples = 2 * s->lfe * (4 + block_index); ++ int lfe_end_sample = 2 * s->lfe * (4 + block_index + s->subsubframes[s->current_subframe]); ++ ++ av_log(s->avctx, AV_LOG_DEBUG, "LFE samples:\n"); ++ for (j = lfe_samples; j < lfe_end_sample; j++) ++ av_log(s->avctx, AV_LOG_DEBUG, " %f", s->lfe_data[j]); ++ av_log(s->avctx, AV_LOG_DEBUG, "\n"); ++ } ++#endif ++ ++ return 0; ++} ++ ++static void qmf_32_subbands(DCAContext *s, int chans, ++ float samples_in[32][8], float *samples_out, ++ float scale) ++{ ++ const float *prCoeff; ++ int i; ++ ++ int sb_act = s->subband_activity[chans]; ++ int subindex; ++ ++ scale *= sqrt(1 / 8.0); ++ ++ /* Select filter */ ++ if (!s->multirate_inter) /* Non-perfect reconstruction */ ++ prCoeff = fir_32bands_nonperfect; ++ else /* Perfect reconstruction */ ++ prCoeff = fir_32bands_perfect; ++ ++ for (i = sb_act; i < 32; i++) ++ s->raXin[i] = 0.0; ++ ++ /* Reconstructed channel sample index */ ++ for (subindex = 0; subindex < 8; subindex++) { ++ /* Load in one sample from each subband and clear inactive subbands */ ++ for (i = 0; i < sb_act; i++) { ++ unsigned sign = (i - 1) & 2; ++ uint32_t v = AV_RN32A(&samples_in[i][subindex]) ^ sign << 30; ++ AV_WN32A(&s->raXin[i], v); ++ } ++ ++ s->synth.synth_filter_float(&s->imdct, ++ s->subband_fir_hist[chans], ++ &s->hist_index[chans], ++ s->subband_fir_noidea[chans], prCoeff, ++ samples_out, s->raXin, scale); ++ samples_out += 32; ++ } ++} ++ ++static void lfe_interpolation_fir(DCAContext *s, int decimation_select, ++ int num_deci_sample, float *samples_in, ++ float *samples_out, float scale) ++{ ++ /* samples_in: An array holding decimated samples. ++ * Samples in current subframe starts from samples_in[0], ++ * while samples_in[-1], samples_in[-2], ..., stores samples ++ * from last subframe as history. ++ * ++ * samples_out: An array holding interpolated samples ++ */ ++ ++ int decifactor; ++ const float *prCoeff; ++ int deciindex; ++ ++ /* Select decimation filter */ ++ if (decimation_select == 1) { ++ decifactor = 64; ++ prCoeff = lfe_fir_128; ++ } else { ++ decifactor = 32; ++ prCoeff = lfe_fir_64; ++ } ++ /* Interpolation */ ++ for (deciindex = 0; deciindex < num_deci_sample; deciindex++) { ++ s->dcadsp.lfe_fir(samples_out, samples_in, prCoeff, decifactor, scale); ++ samples_in++; ++ samples_out += 2 * decifactor; ++ } ++} ++ ++/* downmixing routines */ ++#define MIX_REAR1(samples, s1, rs, coef) \ ++ samples[0][i] += samples[s1][i] * coef[rs][0]; \ ++ samples[1][i] += samples[s1][i] * coef[rs][1]; ++ ++#define MIX_REAR2(samples, s1, s2, rs, coef) \ ++ samples[0][i] += samples[s1][i] * coef[rs][0] + samples[s2][i] * coef[rs + 1][0]; \ ++ samples[1][i] += samples[s1][i] * coef[rs][1] + samples[s2][i] * coef[rs + 1][1]; ++ ++#define MIX_FRONT3(samples, coef) \ ++ t = samples[c][i]; \ ++ u = samples[l][i]; \ ++ v = samples[r][i]; \ ++ samples[0][i] = t * coef[0][0] + u * coef[1][0] + v * coef[2][0]; \ ++ samples[1][i] = t * coef[0][1] + u * coef[1][1] + v * coef[2][1]; ++ ++#define DOWNMIX_TO_STEREO(op1, op2) \ ++ for (i = 0; i < 256; i++) { \ ++ op1 \ ++ op2 \ ++ } ++ ++static void dca_downmix(float **samples, int srcfmt, ++ int downmix_coef[DCA_PRIM_CHANNELS_MAX][2], ++ const int8_t *channel_mapping) ++{ ++ int c, l, r, sl, sr, s; ++ int i; ++ float t, u, v; ++ float coef[DCA_PRIM_CHANNELS_MAX][2]; ++ ++ for (i = 0; i < DCA_PRIM_CHANNELS_MAX; i++) { ++ coef[i][0] = dca_downmix_coeffs[downmix_coef[i][0]]; ++ coef[i][1] = dca_downmix_coeffs[downmix_coef[i][1]]; ++ } ++ ++ switch (srcfmt) { ++ case DCA_MONO: ++ case DCA_CHANNEL: ++ case DCA_STEREO_TOTAL: ++ case DCA_STEREO_SUMDIFF: ++ case DCA_4F2R: ++ av_log(NULL, AV_LOG_ERROR, "Not implemented!\n"); ++ break; ++ case DCA_STEREO: ++ break; ++ case DCA_3F: ++ c = channel_mapping[0]; ++ l = channel_mapping[1]; ++ r = channel_mapping[2]; ++ DOWNMIX_TO_STEREO(MIX_FRONT3(samples, coef), ); ++ break; ++ case DCA_2F1R: ++ s = channel_mapping[2]; ++ DOWNMIX_TO_STEREO(MIX_REAR1(samples, s, 2, coef), ); ++ break; ++ case DCA_3F1R: ++ c = channel_mapping[0]; ++ l = channel_mapping[1]; ++ r = channel_mapping[2]; ++ s = channel_mapping[3]; ++ DOWNMIX_TO_STEREO(MIX_FRONT3(samples, coef), ++ MIX_REAR1(samples, s, 3, coef)); ++ break; ++ case DCA_2F2R: ++ sl = channel_mapping[2]; ++ sr = channel_mapping[3]; ++ DOWNMIX_TO_STEREO(MIX_REAR2(samples, sl, sr, 2, coef), ); ++ break; ++ case DCA_3F2R: ++ c = channel_mapping[0]; ++ l = channel_mapping[1]; ++ r = channel_mapping[2]; ++ sl = channel_mapping[3]; ++ sr = channel_mapping[4]; ++ DOWNMIX_TO_STEREO(MIX_FRONT3(samples, coef), ++ MIX_REAR2(samples, sl, sr, 3, coef)); ++ break; ++ } ++} ++ ++ ++#ifndef decode_blockcodes ++/* Very compact version of the block code decoder that does not use table ++ * look-up but is slightly slower */ ++static int decode_blockcode(int code, int levels, int *values) ++{ ++ int i; ++ int offset = (levels - 1) >> 1; ++ ++ for (i = 0; i < 4; i++) { ++ int div = FASTDIV(code, levels); ++ values[i] = code - offset - div * levels; ++ code = div; ++ } ++ ++ return code; ++} ++ ++static int decode_blockcodes(int code1, int code2, int levels, int *values) ++{ ++ return decode_blockcode(code1, levels, values) | ++ decode_blockcode(code2, levels, values + 4); ++} ++#endif ++ ++static const uint8_t abits_sizes[7] = { 7, 10, 12, 13, 15, 17, 19 }; ++static const uint8_t abits_levels[7] = { 3, 5, 7, 9, 13, 17, 25 }; ++ ++#ifndef int8x8_fmul_int32 ++static inline void int8x8_fmul_int32(float *dst, const int8_t *src, int scale) ++{ ++ float fscale = scale / 16.0; ++ int i; ++ for (i = 0; i < 8; i++) ++ dst[i] = src[i] * fscale; ++} ++#endif ++ ++static int dca_subsubframe(DCAContext *s, int base_channel, int block_index) ++{ ++ int k, l; ++ int subsubframe = s->current_subsubframe; ++ ++ const float *quant_step_table; ++ ++ /* FIXME */ ++ float (*subband_samples)[DCA_SUBBANDS][8] = s->subband_samples[block_index]; ++ LOCAL_ALIGNED_16(int, block, [8 * DCA_SUBBANDS]); ++ ++ /* ++ * Audio data ++ */ ++ ++ /* Select quantization step size table */ ++ if (s->bit_rate_index == 0x1f) ++ quant_step_table = lossless_quant_d; ++ else ++ quant_step_table = lossy_quant_d; ++ ++ for (k = base_channel; k < s->prim_channels; k++) { ++ float rscale[DCA_SUBBANDS]; ++ ++ if (get_bits_left(&s->gb) < 0) ++ return AVERROR_INVALIDDATA; ++ ++ for (l = 0; l < s->vq_start_subband[k]; l++) { ++ int m; ++ ++ /* Select the mid-tread linear quantizer */ ++ int abits = s->bitalloc[k][l]; ++ ++ float quant_step_size = quant_step_table[abits]; ++ ++ /* ++ * Determine quantization index code book and its type ++ */ ++ ++ /* Select quantization index code book */ ++ int sel = s->quant_index_huffman[k][abits]; ++ ++ /* ++ * Extract bits from the bit stream ++ */ ++ if (!abits) { ++ rscale[l] = 0; ++ memset(block + 8 * l, 0, 8 * sizeof(block[0])); ++ } else { ++ /* Deal with transients */ ++ int sfi = s->transition_mode[k][l] && subsubframe >= s->transition_mode[k][l]; ++ rscale[l] = quant_step_size * s->scale_factor[k][l][sfi] * ++ s->scalefactor_adj[k][sel]; ++ ++ if (abits >= 11 || !dca_smpl_bitalloc[abits].vlc[sel].table) { ++ if (abits <= 7) { ++ /* Block code */ ++ int block_code1, block_code2, size, levels, err; ++ ++ size = abits_sizes[abits - 1]; ++ levels = abits_levels[abits - 1]; ++ ++ block_code1 = get_bits(&s->gb, size); ++ block_code2 = get_bits(&s->gb, size); ++ err = decode_blockcodes(block_code1, block_code2, ++ levels, block + 8 * l); ++ if (err) { ++ av_log(s->avctx, AV_LOG_ERROR, ++ "ERROR: block code look-up failed\n"); ++ return AVERROR_INVALIDDATA; ++ } ++ } else { ++ /* no coding */ ++ for (m = 0; m < 8; m++) ++ block[8 * l + m] = get_sbits(&s->gb, abits - 3); ++ } ++ } else { ++ /* Huffman coded */ ++ for (m = 0; m < 8; m++) ++ block[8 * l + m] = get_bitalloc(&s->gb, ++ &dca_smpl_bitalloc[abits], sel); ++ } ++ ++ } ++ } ++ ++ s->fmt_conv.int32_to_float_fmul_scalar_array(&s->fmt_conv, subband_samples[k][0], ++ block, rscale, 8 * s->vq_start_subband[k]); ++ ++ for (l = 0; l < s->vq_start_subband[k]; l++) { ++ int m; ++ /* ++ * Inverse ADPCM if in prediction mode ++ */ ++ if (s->prediction_mode[k][l]) { ++ int n; ++ for (m = 0; m < 8; m++) { ++ for (n = 1; n <= 4; n++) ++ if (m >= n) ++ subband_samples[k][l][m] += ++ (adpcm_vb[s->prediction_vq[k][l]][n - 1] * ++ subband_samples[k][l][m - n] / 8192); ++ else if (s->predictor_history) ++ subband_samples[k][l][m] += ++ (adpcm_vb[s->prediction_vq[k][l]][n - 1] * ++ s->subband_samples_hist[k][l][m - n + 4] / 8192); ++ } ++ } ++ } ++ ++ /* ++ * Decode VQ encoded high frequencies ++ */ ++ for (l = s->vq_start_subband[k]; l < s->subband_activity[k]; l++) { ++ /* 1 vector -> 32 samples but we only need the 8 samples ++ * for this subsubframe. */ ++ int hfvq = s->high_freq_vq[k][l]; ++ ++ if (!s->debug_flag & 0x01) { ++ av_log(s->avctx, AV_LOG_DEBUG, ++ "Stream with high frequencies VQ coding\n"); ++ s->debug_flag |= 0x01; ++ } ++ ++ int8x8_fmul_int32(subband_samples[k][l], ++ &high_freq_vq[hfvq][subsubframe * 8], ++ s->scale_factor[k][l][0]); ++ } ++ } ++ ++ /* Check for DSYNC after subsubframe */ ++ if (s->aspf || subsubframe == s->subsubframes[s->current_subframe] - 1) { ++ if (0xFFFF == get_bits(&s->gb, 16)) { /* 0xFFFF */ ++#ifdef TRACE ++ av_log(s->avctx, AV_LOG_DEBUG, "Got subframe DSYNC\n"); ++#endif ++ } else { ++ av_log(s->avctx, AV_LOG_ERROR, "Didn't get subframe DSYNC\n"); ++ } ++ } ++ ++ /* Backup predictor history for adpcm */ ++ for (k = base_channel; k < s->prim_channels; k++) ++ for (l = 0; l < s->vq_start_subband[k]; l++) ++ memcpy(s->subband_samples_hist[k][l], ++ &subband_samples[k][l][4], ++ 4 * sizeof(subband_samples[0][0][0])); ++ ++ return 0; ++} ++ ++static int dca_filter_channels(DCAContext *s, int block_index) ++{ ++ float (*subband_samples)[DCA_SUBBANDS][8] = s->subband_samples[block_index]; ++ int k; ++ ++ /* 32 subbands QMF */ ++ for (k = 0; k < s->prim_channels; k++) { ++/* static float pcm_to_double[8] = { 32768.0, 32768.0, 524288.0, 524288.0, ++ 0, 8388608.0, 8388608.0 };*/ ++ if (s->channel_order_tab[k] >= 0) ++ qmf_32_subbands(s, k, subband_samples[k], ++ s->samples_chanptr[s->channel_order_tab[k]], ++ M_SQRT1_2 / 32768.0 /* pcm_to_double[s->source_pcm_res] */); ++ } ++ ++ /* Down mixing */ ++ if (s->avctx->request_channels == 2 && s->prim_channels > 2) { ++ dca_downmix(s->samples_chanptr, s->amode, s->downmix_coef, s->channel_order_tab); ++ } ++ ++ /* Generate LFE samples for this subsubframe FIXME!!! */ ++ if (s->output & DCA_LFE) { ++ lfe_interpolation_fir(s, s->lfe, 2 * s->lfe, ++ s->lfe_data + 2 * s->lfe * (block_index + 4), ++ s->samples_chanptr[s->lfe_index], ++ 1.0 / (256.0 * 32768.0)); ++ /* Outputs 20bits pcm samples */ ++ } ++ ++ return 0; ++} ++ ++ ++static int dca_subframe_footer(DCAContext *s, int base_channel) ++{ ++ int aux_data_count = 0, i; ++ ++ /* ++ * Unpack optional information ++ */ ++ ++ /* presumably optional information only appears in the core? */ ++ if (!base_channel) { ++ if (s->timestamp) ++ skip_bits_long(&s->gb, 32); ++ ++ if (s->aux_data) ++ aux_data_count = get_bits(&s->gb, 6); ++ ++ for (i = 0; i < aux_data_count; i++) ++ get_bits(&s->gb, 8); ++ ++ if (s->crc_present && (s->downmix || s->dynrange)) ++ get_bits(&s->gb, 16); ++ } ++ ++ return 0; ++} ++ ++/** ++ * Decode a dca frame block ++ * ++ * @param s pointer to the DCAContext ++ */ ++ ++static int dca_decode_block(DCAContext *s, int base_channel, int block_index) ++{ ++ int ret; ++ ++ /* Sanity check */ ++ if (s->current_subframe >= s->subframes) { ++ av_log(s->avctx, AV_LOG_DEBUG, "check failed: %i>%i", ++ s->current_subframe, s->subframes); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ if (!s->current_subsubframe) { ++#ifdef TRACE ++ av_log(s->avctx, AV_LOG_DEBUG, "DSYNC dca_subframe_header\n"); ++#endif ++ /* Read subframe header */ ++ if ((ret = dca_subframe_header(s, base_channel, block_index))) ++ return ret; ++ } ++ ++ /* Read subsubframe */ ++#ifdef TRACE ++ av_log(s->avctx, AV_LOG_DEBUG, "DSYNC dca_subsubframe\n"); ++#endif ++ if ((ret = dca_subsubframe(s, base_channel, block_index))) ++ return ret; ++ ++ /* Update state */ ++ s->current_subsubframe++; ++ if (s->current_subsubframe >= s->subsubframes[s->current_subframe]) { ++ s->current_subsubframe = 0; ++ s->current_subframe++; ++ } ++ if (s->current_subframe >= s->subframes) { ++#ifdef TRACE ++ av_log(s->avctx, AV_LOG_DEBUG, "DSYNC dca_subframe_footer\n"); ++#endif ++ /* Read subframe footer */ ++ if ((ret = dca_subframe_footer(s, base_channel))) ++ return ret; ++ } ++ ++ return 0; ++} ++ ++/** ++ * Return the number of channels in an ExSS speaker mask (HD) ++ */ ++static int dca_exss_mask2count(int mask) ++{ ++ /* count bits that mean speaker pairs twice */ ++ return av_popcount(mask) + ++ av_popcount(mask & (DCA_EXSS_CENTER_LEFT_RIGHT | ++ DCA_EXSS_FRONT_LEFT_RIGHT | ++ DCA_EXSS_FRONT_HIGH_LEFT_RIGHT | ++ DCA_EXSS_WIDE_LEFT_RIGHT | ++ DCA_EXSS_SIDE_LEFT_RIGHT | ++ DCA_EXSS_SIDE_HIGH_LEFT_RIGHT | ++ DCA_EXSS_SIDE_REAR_LEFT_RIGHT | ++ DCA_EXSS_REAR_LEFT_RIGHT | ++ DCA_EXSS_REAR_HIGH_LEFT_RIGHT)); ++} ++ ++/** ++ * Skip mixing coefficients of a single mix out configuration (HD) ++ */ ++static void dca_exss_skip_mix_coeffs(GetBitContext *gb, int channels, int out_ch) ++{ ++ int i; ++ ++ for (i = 0; i < channels; i++) { ++ int mix_map_mask = get_bits(gb, out_ch); ++ int num_coeffs = av_popcount(mix_map_mask); ++ skip_bits_long(gb, num_coeffs * 6); ++ } ++} ++ ++/** ++ * Parse extension substream asset header (HD) ++ */ ++static int dca_exss_parse_asset_header(DCAContext *s) ++{ ++ int header_pos = get_bits_count(&s->gb); ++ int header_size; ++ int channels = 0; ++ int embedded_stereo = 0; ++ int embedded_6ch = 0; ++ int drc_code_present; ++ int av_uninit(extensions_mask); ++ int i, j; ++ ++ if (get_bits_left(&s->gb) < 16) ++ return -1; ++ ++ /* We will parse just enough to get to the extensions bitmask with which ++ * we can set the profile value. */ ++ ++ header_size = get_bits(&s->gb, 9) + 1; ++ skip_bits(&s->gb, 3); // asset index ++ ++ if (s->static_fields) { ++ if (get_bits1(&s->gb)) ++ skip_bits(&s->gb, 4); // asset type descriptor ++ if (get_bits1(&s->gb)) ++ skip_bits_long(&s->gb, 24); // language descriptor ++ ++ if (get_bits1(&s->gb)) { ++ /* How can one fit 1024 bytes of text here if the maximum value ++ * for the asset header size field above was 512 bytes? */ ++ int text_length = get_bits(&s->gb, 10) + 1; ++ if (get_bits_left(&s->gb) < text_length * 8) ++ return -1; ++ skip_bits_long(&s->gb, text_length * 8); // info text ++ } ++ ++ skip_bits(&s->gb, 5); // bit resolution - 1 ++ skip_bits(&s->gb, 4); // max sample rate code ++ channels = get_bits(&s->gb, 8) + 1; ++ ++ if (get_bits1(&s->gb)) { // 1-to-1 channels to speakers ++ int spkr_remap_sets; ++ int spkr_mask_size = 16; ++ int num_spkrs[7]; ++ ++ if (channels > 2) ++ embedded_stereo = get_bits1(&s->gb); ++ if (channels > 6) ++ embedded_6ch = get_bits1(&s->gb); ++ ++ if (get_bits1(&s->gb)) { ++ spkr_mask_size = (get_bits(&s->gb, 2) + 1) << 2; ++ skip_bits(&s->gb, spkr_mask_size); // spkr activity mask ++ } ++ ++ spkr_remap_sets = get_bits(&s->gb, 3); ++ ++ for (i = 0; i < spkr_remap_sets; i++) { ++ /* std layout mask for each remap set */ ++ num_spkrs[i] = dca_exss_mask2count(get_bits(&s->gb, spkr_mask_size)); ++ } ++ ++ for (i = 0; i < spkr_remap_sets; i++) { ++ int num_dec_ch_remaps = get_bits(&s->gb, 5) + 1; ++ if (get_bits_left(&s->gb) < 0) ++ return -1; ++ ++ for (j = 0; j < num_spkrs[i]; j++) { ++ int remap_dec_ch_mask = get_bits_long(&s->gb, num_dec_ch_remaps); ++ int num_dec_ch = av_popcount(remap_dec_ch_mask); ++ skip_bits_long(&s->gb, num_dec_ch * 5); // remap codes ++ } ++ } ++ ++ } else { ++ skip_bits(&s->gb, 3); // representation type ++ } ++ } ++ ++ drc_code_present = get_bits1(&s->gb); ++ if (drc_code_present) ++ get_bits(&s->gb, 8); // drc code ++ ++ if (get_bits1(&s->gb)) ++ skip_bits(&s->gb, 5); // dialog normalization code ++ ++ if (drc_code_present && embedded_stereo) ++ get_bits(&s->gb, 8); // drc stereo code ++ ++ if (s->mix_metadata && get_bits1(&s->gb)) { ++ skip_bits(&s->gb, 1); // external mix ++ skip_bits(&s->gb, 6); // post mix gain code ++ ++ if (get_bits(&s->gb, 2) != 3) // mixer drc code ++ skip_bits(&s->gb, 3); // drc limit ++ else ++ skip_bits(&s->gb, 8); // custom drc code ++ ++ if (get_bits1(&s->gb)) // channel specific scaling ++ for (i = 0; i < s->num_mix_configs; i++) ++ skip_bits_long(&s->gb, s->mix_config_num_ch[i] * 6); // scale codes ++ else ++ skip_bits_long(&s->gb, s->num_mix_configs * 6); // scale codes ++ ++ for (i = 0; i < s->num_mix_configs; i++) { ++ if (get_bits_left(&s->gb) < 0) ++ return -1; ++ dca_exss_skip_mix_coeffs(&s->gb, channels, s->mix_config_num_ch[i]); ++ if (embedded_6ch) ++ dca_exss_skip_mix_coeffs(&s->gb, 6, s->mix_config_num_ch[i]); ++ if (embedded_stereo) ++ dca_exss_skip_mix_coeffs(&s->gb, 2, s->mix_config_num_ch[i]); ++ } ++ } ++ ++ switch (get_bits(&s->gb, 2)) { ++ case 0: extensions_mask = get_bits(&s->gb, 12); break; ++ case 1: extensions_mask = DCA_EXT_EXSS_XLL; break; ++ case 2: extensions_mask = DCA_EXT_EXSS_LBR; break; ++ case 3: extensions_mask = 0; /* aux coding */ break; ++ } ++ ++ /* not parsed further, we were only interested in the extensions mask */ ++ ++ if (get_bits_left(&s->gb) < 0) ++ return -1; ++ ++ if (get_bits_count(&s->gb) - header_pos > header_size * 8) { ++ av_log(s->avctx, AV_LOG_WARNING, "Asset header size mismatch.\n"); ++ return -1; ++ } ++ skip_bits_long(&s->gb, header_pos + header_size * 8 - get_bits_count(&s->gb)); ++ ++ if (extensions_mask & DCA_EXT_EXSS_XLL) ++ s->profile = FF_PROFILE_DTS_HD_MA; ++ else if (extensions_mask & (DCA_EXT_EXSS_XBR | DCA_EXT_EXSS_X96 | ++ DCA_EXT_EXSS_XXCH)) ++ s->profile = FF_PROFILE_DTS_HD_HRA; ++ ++ if (!(extensions_mask & DCA_EXT_CORE)) ++ av_log(s->avctx, AV_LOG_WARNING, "DTS core detection mismatch.\n"); ++ if ((extensions_mask & DCA_CORE_EXTS) != s->core_ext_mask) ++ av_log(s->avctx, AV_LOG_WARNING, ++ "DTS extensions detection mismatch (%d, %d)\n", ++ extensions_mask & DCA_CORE_EXTS, s->core_ext_mask); ++ ++ return 0; ++} ++ ++static int dca_xbr_parse_frame(DCAContext *s) ++{ ++ int scale_table_high[DCA_CHSET_CHANS_MAX][DCA_SUBBANDS][2]; ++ int active_bands[DCA_CHSETS_MAX][DCA_CHSET_CHANS_MAX]; ++ int abits_high[DCA_CHSET_CHANS_MAX][DCA_SUBBANDS]; ++ int anctemp[DCA_CHSET_CHANS_MAX]; ++ int chset_fsize[DCA_CHSETS_MAX]; ++ int n_xbr_ch[DCA_CHSETS_MAX]; ++ int hdr_size, num_chsets, xbr_tmode, hdr_pos; ++ int i, j, k, l, chset, chan_base; ++ ++ av_log(s->avctx, AV_LOG_DEBUG, "DTS-XBR: decoding XBR extension\n"); ++ ++ /* get bit position of sync header */ ++ hdr_pos = get_bits_count(&s->gb) - 32; ++ ++ hdr_size = get_bits(&s->gb, 6) + 1; ++ num_chsets = get_bits(&s->gb, 2) + 1; ++ ++ for(i = 0; i < num_chsets; i++) ++ chset_fsize[i] = get_bits(&s->gb, 14) + 1; ++ ++ xbr_tmode = get_bits1(&s->gb); ++ ++ for(i = 0; i < num_chsets; i++) { ++ n_xbr_ch[i] = get_bits(&s->gb, 3) + 1; ++ k = get_bits(&s->gb, 2) + 5; ++ for(j = 0; j < n_xbr_ch[i]; j++) ++ active_bands[i][j] = get_bits(&s->gb, k) + 1; ++ } ++ ++ /* skip to the end of the header */ ++ i = get_bits_count(&s->gb); ++ if(hdr_pos + hdr_size * 8 > i) ++ skip_bits_long(&s->gb, hdr_pos + hdr_size * 8 - i); ++ ++ /* loop over the channel data sets */ ++ /* only decode as many channels as we've decoded base data for */ ++ for(chset = 0, chan_base = 0; ++ chset < num_chsets && chan_base + n_xbr_ch[chset] <= s->prim_channels; ++ chan_base += n_xbr_ch[chset++]) { ++ int start_posn = get_bits_count(&s->gb); ++ int subsubframe = 0; ++ int subframe = 0; ++ ++ /* loop over subframes */ ++ for (k = 0; k < (s->sample_blocks / 8); k++) { ++ /* parse header if we're on first subsubframe of a block */ ++ if(subsubframe == 0) { ++ /* Parse subframe header */ ++ for(i = 0; i < n_xbr_ch[chset]; i++) { ++ anctemp[i] = get_bits(&s->gb, 2) + 2; ++ } ++ ++ for(i = 0; i < n_xbr_ch[chset]; i++) { ++ get_array(&s->gb, abits_high[i], active_bands[chset][i], anctemp[i]); ++ } ++ ++ for(i = 0; i < n_xbr_ch[chset]; i++) { ++ anctemp[i] = get_bits(&s->gb, 3); ++ if(anctemp[i] < 1) { ++ av_log(s->avctx, AV_LOG_ERROR, "DTS-XBR: SYNC ERROR\n"); ++ return AVERROR_INVALIDDATA; ++ } ++ } ++ ++ /* generate scale factors */ ++ for(i = 0; i < n_xbr_ch[chset]; i++) { ++ const uint32_t *scale_table; ++ int nbits; ++ ++ if (s->scalefactor_huffman[chan_base+i] == 6) { ++ scale_table = scale_factor_quant7; ++ } else { ++ scale_table = scale_factor_quant6; ++ } ++ ++ nbits = anctemp[i]; ++ ++ for(j = 0; j < active_bands[chset][i]; j++) { ++ if(abits_high[i][j] > 0) { ++ scale_table_high[i][j][0] = ++ scale_table[get_bits(&s->gb, nbits)]; ++ ++ if(xbr_tmode && s->transition_mode[i][j]) { ++ scale_table_high[i][j][1] = ++ scale_table[get_bits(&s->gb, nbits)]; ++ } ++ } ++ } ++ } ++ } ++ ++ /* decode audio array for this block */ ++ for(i = 0; i < n_xbr_ch[chset]; i++) { ++ for(j = 0; j < active_bands[chset][i]; j++) { ++ const int xbr_abits = abits_high[i][j]; ++ const float quant_step_size = lossless_quant_d[xbr_abits]; ++ const int sfi = xbr_tmode && s->transition_mode[i][j] && subsubframe >= s->transition_mode[i][j]; ++ const float rscale = quant_step_size * scale_table_high[i][j][sfi]; ++ float *subband_samples = s->subband_samples[k][chan_base+i][j]; ++ int block[8]; ++ ++ if(xbr_abits <= 0) ++ continue; ++ ++ if(xbr_abits > 7) { ++ get_array(&s->gb, block, 8, xbr_abits - 3); ++ } else { ++ int block_code1, block_code2, size, levels, err; ++ ++ size = abits_sizes[xbr_abits - 1]; ++ levels = abits_levels[xbr_abits - 1]; ++ ++ block_code1 = get_bits(&s->gb, size); ++ block_code2 = get_bits(&s->gb, size); ++ err = decode_blockcodes(block_code1, block_code2, ++ levels, block); ++ if (err) { ++ av_log(s->avctx, AV_LOG_ERROR, ++ "ERROR: DTS-XBR: block code look-up failed\n"); ++ return AVERROR_INVALIDDATA; ++ } ++ } ++ ++ /* scale & sum into subband */ ++ for(l = 0; l < 8; l++) ++ subband_samples[l] += (float)block[l] * rscale; ++ } ++ } ++ ++ /* check DSYNC marker */ ++ if(s->aspf || subsubframe == s->subsubframes[subframe] - 1) { ++ if(get_bits(&s->gb, 16) != 0xffff) { ++ av_log(s->avctx, AV_LOG_ERROR, "DTS-XBR: Didn't get subframe DSYNC\n"); ++ return AVERROR_INVALIDDATA; ++ } ++ } ++ ++ /* advance sub-sub-frame index */ ++ if(++subsubframe >= s->subsubframes[subframe]) { ++ subsubframe = 0; ++ subframe++; ++ } ++ } ++ ++ /* skip to next channel set */ ++ i = get_bits_count(&s->gb); ++ if(start_posn + chset_fsize[chset] * 8 != i) { ++ j = start_posn + chset_fsize[chset] * 8 - i; ++ if(j < 0 || j >= 8) ++ av_log(s->avctx, AV_LOG_ERROR, "DTS-XBR: end of channel set," ++ " skipping further than expected (%d bits)\n", j); ++ skip_bits_long(&s->gb, j); ++ } ++ } ++ ++ return 0; ++} ++ ++/* parse initial header for XXCH and dump details */ ++static int dca_xxch_decode_frame(DCAContext *s) ++{ ++ int hdr_size, spkmsk_bits, num_chsets, core_spk, hdr_pos; ++ int i, chset, base_channel, chstart, fsize[8]; ++ ++ /* assume header word has already been parsed */ ++ hdr_pos = get_bits_count(&s->gb) - 32; ++ hdr_size = get_bits(&s->gb, 6) + 1; ++ /*chhdr_crc =*/ skip_bits1(&s->gb); ++ spkmsk_bits = get_bits(&s->gb, 5) + 1; ++ num_chsets = get_bits(&s->gb, 2) + 1; ++ ++ for (i = 0; i < num_chsets; i++) ++ fsize[i] = get_bits(&s->gb, 14) + 1; ++ ++ core_spk = get_bits(&s->gb, spkmsk_bits); ++ s->xxch_core_spkmask = core_spk; ++ s->xxch_nbits_spk_mask = spkmsk_bits; ++ s->xxch_dmix_embedded = 0; ++ ++ /* skip to the end of the header */ ++ i = get_bits_count(&s->gb); ++ if (hdr_pos + hdr_size * 8 > i) ++ skip_bits_long(&s->gb, hdr_pos + hdr_size * 8 - i); ++ ++ for (chset = 0; chset < num_chsets; chset++) { ++ chstart = get_bits_count(&s->gb); ++ base_channel = s->prim_channels; ++ s->xxch_chset = chset; ++ ++ /* XXCH and Core headers differ, see 6.4.2 "XXCH Channel Set Header" vs. ++ 5.3.2 "Primary Audio Coding Header", DTS Spec 1.3.1 */ ++ dca_parse_audio_coding_header(s, base_channel, 1); ++ ++ /* decode channel data */ ++ for (i = 0; i < (s->sample_blocks / 8); i++) { ++ if (dca_decode_block(s, base_channel, i)) { ++ av_log(s->avctx, AV_LOG_ERROR, ++ "Error decoding DTS-XXCH extension\n"); ++ continue; ++ } ++ } ++ ++ /* skip to end of this section */ ++ i = get_bits_count(&s->gb); ++ if (chstart + fsize[chset] * 8 > i) ++ skip_bits_long(&s->gb, chstart + fsize[chset] * 8 - i); ++ } ++ s->xxch_chset = num_chsets; ++ ++ return 0; ++} ++ ++/** ++ * Parse extension substream header (HD) ++ */ ++static void dca_exss_parse_header(DCAContext *s) ++{ ++ int asset_size[8]; ++ int ss_index; ++ int blownup; ++ int num_audiop = 1; ++ int num_assets = 1; ++ int active_ss_mask[8]; ++ int i, j; ++ int start_posn; ++ int hdrsize; ++ uint32_t mkr; ++ ++ if (get_bits_left(&s->gb) < 52) ++ return; ++ ++ start_posn = get_bits_count(&s->gb) - 32; ++ ++ skip_bits(&s->gb, 8); // user data ++ ss_index = get_bits(&s->gb, 2); ++ ++ blownup = get_bits1(&s->gb); ++ hdrsize = get_bits(&s->gb, 8 + 4 * blownup) + 1; // header_size ++ skip_bits(&s->gb, 16 + 4 * blownup); // hd_size ++ ++ s->static_fields = get_bits1(&s->gb); ++ if (s->static_fields) { ++ skip_bits(&s->gb, 2); // reference clock code ++ skip_bits(&s->gb, 3); // frame duration code ++ ++ if (get_bits1(&s->gb)) ++ skip_bits_long(&s->gb, 36); // timestamp ++ ++ /* a single stream can contain multiple audio assets that can be ++ * combined to form multiple audio presentations */ ++ ++ num_audiop = get_bits(&s->gb, 3) + 1; ++ if (num_audiop > 1) { ++ av_log_ask_for_sample(s->avctx, "Multiple DTS-HD audio presentations."); ++ /* ignore such streams for now */ ++ return; ++ } ++ ++ num_assets = get_bits(&s->gb, 3) + 1; ++ if (num_assets > 1) { ++ av_log_ask_for_sample(s->avctx, "Multiple DTS-HD audio assets."); ++ /* ignore such streams for now */ ++ return; ++ } ++ ++ for (i = 0; i < num_audiop; i++) ++ active_ss_mask[i] = get_bits(&s->gb, ss_index + 1); ++ ++ for (i = 0; i < num_audiop; i++) ++ for (j = 0; j <= ss_index; j++) ++ if (active_ss_mask[i] & (1 << j)) ++ skip_bits(&s->gb, 8); // active asset mask ++ ++ s->mix_metadata = get_bits1(&s->gb); ++ if (s->mix_metadata) { ++ int mix_out_mask_size; ++ ++ skip_bits(&s->gb, 2); // adjustment level ++ mix_out_mask_size = (get_bits(&s->gb, 2) + 1) << 2; ++ s->num_mix_configs = get_bits(&s->gb, 2) + 1; ++ ++ for (i = 0; i < s->num_mix_configs; i++) { ++ int mix_out_mask = get_bits(&s->gb, mix_out_mask_size); ++ s->mix_config_num_ch[i] = dca_exss_mask2count(mix_out_mask); ++ } ++ } ++ } ++ ++ for (i = 0; i < num_assets; i++) ++ asset_size[i] = get_bits_long(&s->gb, 16 + 4 * blownup); ++ ++ for (i = 0; i < num_assets; i++) { ++ if (dca_exss_parse_asset_header(s)) ++ return; ++ } ++ ++ /* not parsed further, we were only interested in the extensions mask ++ * from the asset header */ ++ ++ if (num_assets > 0) { ++ j = get_bits_count(&s->gb); ++ if (start_posn + hdrsize * 8 > j) ++ skip_bits_long(&s->gb, start_posn + hdrsize * 8 - j); ++ ++ for (i = 0; i < num_assets; i++) { ++ start_posn = get_bits_count(&s->gb); ++ mkr = get_bits_long(&s->gb, 32); ++ ++ /* parse extensions that we know about */ ++ if (mkr == 0x655e315e) { ++ dca_xbr_parse_frame(s); ++ } else if (mkr == 0x47004a03) { ++ dca_xxch_decode_frame(s); ++ s->core_ext_mask |= DCA_EXT_XXCH; /* xxx use for chan reordering */ ++ } else { ++ av_log(s->avctx, AV_LOG_DEBUG, ++ "DTS-ExSS: unknown marker = 0x%08x\n", mkr); ++ } ++ ++ /* skip to end of block */ ++ j = get_bits_count(&s->gb); ++ if (start_posn + asset_size[i] * 8 > j) ++ skip_bits_long(&s->gb, start_posn + asset_size[i] * 8 - j); ++ } ++ } ++} ++ ++/** ++ * Main frame decoding function ++ * FIXME add arguments ++ */ ++static int dca_decode_frame(AVCodecContext *avctx, void *data, ++ int *got_frame_ptr, AVPacket *avpkt) ++{ ++ AVFrame *frame = data; ++ const uint8_t *buf = avpkt->data; ++ int buf_size = avpkt->size; ++ int channel_mask; ++ int channel_layout; ++ int lfe_samples; ++ int num_core_channels = 0; ++ int i, ret; ++ float **samples_flt; ++ float *src_chan; ++ float *dst_chan; ++ DCAContext *s = avctx->priv_data; ++ int core_ss_end; ++ int channels, full_channels; ++ float scale; ++ int achan; ++ int chset; ++ int mask; ++ int lavc; ++ int posn; ++ int j, k; ++ int endch; ++ ++ s->xch_present = 0; ++ ++ s->dca_buffer_size = ff_dca_convert_bitstream(buf, buf_size, s->dca_buffer, ++ DCA_MAX_FRAME_SIZE + DCA_MAX_EXSS_HEADER_SIZE); ++ if (s->dca_buffer_size == AVERROR_INVALIDDATA) { ++ av_log(avctx, AV_LOG_ERROR, "Not a valid DCA frame\n"); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ init_get_bits(&s->gb, s->dca_buffer, s->dca_buffer_size * 8); ++ if ((ret = dca_parse_frame_header(s)) < 0) { ++ //seems like the frame is corrupt, try with the next one ++ return ret; ++ } ++ //set AVCodec values with parsed data ++ avctx->sample_rate = s->sample_rate; ++ avctx->bit_rate = s->bit_rate; ++ ++ s->profile = FF_PROFILE_DTS; ++ ++ for (i = 0; i < (s->sample_blocks / 8); i++) { ++ if ((ret = dca_decode_block(s, 0, i))) { ++ av_log(avctx, AV_LOG_ERROR, "error decoding block\n"); ++ return ret; ++ } ++ } ++ ++ /* record number of core channels incase less than max channels are requested */ ++ num_core_channels = s->prim_channels; ++ ++ if (s->ext_coding) ++ s->core_ext_mask = dca_ext_audio_descr_mask[s->ext_descr]; ++ else ++ s->core_ext_mask = 0; ++ ++ core_ss_end = FFMIN(s->frame_size, s->dca_buffer_size) * 8; ++ ++ /* only scan for extensions if ext_descr was unknown or indicated a ++ * supported XCh extension */ ++ if (s->core_ext_mask < 0 || s->core_ext_mask & (DCA_EXT_XCH | DCA_EXT_XXCH)) { ++ ++ /* if ext_descr was unknown, clear s->core_ext_mask so that the ++ * extensions scan can fill it up */ ++ s->core_ext_mask = FFMAX(s->core_ext_mask, 0); ++ ++ /* extensions start at 32-bit boundaries into bitstream */ ++ skip_bits_long(&s->gb, (-get_bits_count(&s->gb)) & 31); ++ ++ while (core_ss_end - get_bits_count(&s->gb) >= 32) { ++ uint32_t bits = get_bits_long(&s->gb, 32); ++ ++ switch (bits) { ++ case 0x5a5a5a5a: { ++ int ext_amode, xch_fsize; ++ ++ s->xch_base_channel = s->prim_channels; ++ ++ /* validate sync word using XCHFSIZE field */ ++ xch_fsize = show_bits(&s->gb, 10); ++ if ((s->frame_size != (get_bits_count(&s->gb) >> 3) - 4 + xch_fsize) && ++ (s->frame_size != (get_bits_count(&s->gb) >> 3) - 4 + xch_fsize + 1)) ++ continue; ++ ++ /* skip length-to-end-of-frame field for the moment */ ++ skip_bits(&s->gb, 10); ++ ++ s->core_ext_mask |= DCA_EXT_XCH; ++ ++ /* extension amode(number of channels in extension) should be 1 */ ++ /* AFAIK XCh is not used for more channels */ ++ if ((ext_amode = get_bits(&s->gb, 4)) != 1) { ++ av_log(avctx, AV_LOG_ERROR, "XCh extension amode %d not" ++ " supported!\n", ext_amode); ++ continue; ++ } ++ ++ if (s->xch_base_channel < 2) { ++ av_log_ask_for_sample(avctx, "XCh with fewer than 2 base channels is not supported\n"); ++ continue; ++ } ++ ++ /* much like core primary audio coding header */ ++ dca_parse_audio_coding_header(s, s->xch_base_channel, 0); ++ ++ for (i = 0; i < (s->sample_blocks / 8); i++) ++ if ((ret = dca_decode_block(s, s->xch_base_channel, i))) { ++ av_log(avctx, AV_LOG_ERROR, "error decoding XCh extension\n"); ++ continue; ++ } ++ ++ s->xch_present = 1; ++ break; ++ } ++ case 0x47004a03: ++ /* XXCh: extended channels */ ++ /* usually found either in core or HD part in DTS-HD HRA streams, ++ * but not in DTS-ES which contains XCh extensions instead */ ++ s->core_ext_mask |= DCA_EXT_XXCH; ++ dca_xxch_decode_frame(s); ++ break; ++ ++ case 0x1d95f262: { ++ int fsize96 = show_bits(&s->gb, 12) + 1; ++ if (s->frame_size != (get_bits_count(&s->gb) >> 3) - 4 + fsize96) ++ continue; ++ ++ av_log(avctx, AV_LOG_DEBUG, "X96 extension found at %d bits\n", ++ get_bits_count(&s->gb)); ++ skip_bits(&s->gb, 12); ++ av_log(avctx, AV_LOG_DEBUG, "FSIZE96 = %d bytes\n", fsize96); ++ av_log(avctx, AV_LOG_DEBUG, "REVNO = %d\n", get_bits(&s->gb, 4)); ++ ++ s->core_ext_mask |= DCA_EXT_X96; ++ break; ++ } ++ } ++ ++ skip_bits_long(&s->gb, (-get_bits_count(&s->gb)) & 31); ++ } ++ } else { ++ /* no supported extensions, skip the rest of the core substream */ ++ skip_bits_long(&s->gb, core_ss_end - get_bits_count(&s->gb)); ++ } ++ ++ if (s->core_ext_mask & DCA_EXT_X96) ++ s->profile = FF_PROFILE_DTS_96_24; ++ else if (s->core_ext_mask & (DCA_EXT_XCH | DCA_EXT_XXCH)) ++ s->profile = FF_PROFILE_DTS_ES; ++ ++ /* check for ExSS (HD part) */ ++ if (s->dca_buffer_size - s->frame_size > 32 && ++ get_bits_long(&s->gb, 32) == DCA_HD_MARKER) ++ dca_exss_parse_header(s); ++ ++ avctx->profile = s->profile; ++ ++ full_channels = channels = s->prim_channels + !!s->lfe; ++ ++ /* If we have XXCH then the channel layout is managed differently */ ++ /* note that XLL will also have another way to do things */ ++ if (!(s->core_ext_mask & DCA_EXT_XXCH) ++ || (s->core_ext_mask & DCA_EXT_XXCH && avctx->request_channels > 0 ++ && avctx->request_channels ++ < num_core_channels + !!s->lfe + s->xxch_chset_nch[0])) ++ { /* xxx should also do MA extensions */ ++ if (s->amode < 16) { ++ avctx->channel_layout = dca_core_channel_layout[s->amode]; ++ ++ if (s->xch_present && (!avctx->request_channels || ++ avctx->request_channels ++ > num_core_channels + !!s->lfe)) { ++ avctx->channel_layout |= AV_CH_BACK_CENTER; ++ if (s->lfe) { ++ avctx->channel_layout |= AV_CH_LOW_FREQUENCY; ++ s->channel_order_tab = dca_channel_reorder_lfe_xch[s->amode]; ++ } else { ++ s->channel_order_tab = dca_channel_reorder_nolfe_xch[s->amode]; ++ } ++ if (s->channel_order_tab[s->xch_base_channel] < 0) ++ return AVERROR_INVALIDDATA; ++ } else { ++ channels = num_core_channels + !!s->lfe; ++ s->xch_present = 0; /* disable further xch processing */ ++ if (s->lfe) { ++ avctx->channel_layout |= AV_CH_LOW_FREQUENCY; ++ s->channel_order_tab = dca_channel_reorder_lfe[s->amode]; ++ } else ++ s->channel_order_tab = dca_channel_reorder_nolfe[s->amode]; ++ } ++ ++ if (channels > !!s->lfe && ++ s->channel_order_tab[channels - 1 - !!s->lfe] < 0) ++ return AVERROR_INVALIDDATA; ++ ++ if (av_get_channel_layout_nb_channels(avctx->channel_layout) != channels) { ++ av_log(avctx, AV_LOG_ERROR, "Number of channels %d mismatches layout %d\n", channels, av_get_channel_layout_nb_channels(avctx->channel_layout)); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ if (avctx->request_channels == 2 && s->prim_channels > 2) { ++ channels = 2; ++ s->output = DCA_STEREO; ++ avctx->channel_layout = AV_CH_LAYOUT_STEREO; ++ } ++ else if (avctx->request_channel_layout & AV_CH_LAYOUT_NATIVE) { ++ static const int8_t dca_channel_order_native[9] = { 0, 1, 2, 3, 4, 5, 6, 7, 8 }; ++ s->channel_order_tab = dca_channel_order_native; ++ } ++ s->lfe_index = dca_lfe_index[s->amode]; ++ } else { ++ av_log(avctx, AV_LOG_ERROR, ++ "Non standard configuration %d !\n", s->amode); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ s->xxch_dmix_embedded = 0; ++ } else { ++ /* we only get here if an XXCH channel set can be added to the mix */ ++ channel_mask = s->xxch_core_spkmask; ++ ++ if (avctx->request_channels > 0 ++ && avctx->request_channels < s->prim_channels) { ++ channels = num_core_channels + !!s->lfe; ++ for (i = 0; i < s->xxch_chset && channels + s->xxch_chset_nch[i] ++ <= avctx->request_channels; i++) { ++ channels += s->xxch_chset_nch[i]; ++ channel_mask |= s->xxch_spk_masks[i]; ++ } ++ } else { ++ channels = s->prim_channels + !!s->lfe; ++ for (i = 0; i < s->xxch_chset; i++) { ++ channel_mask |= s->xxch_spk_masks[i]; ++ } ++ } ++ ++ /* Given the DTS spec'ed channel mask, generate an avcodec version */ ++ channel_layout = 0; ++ for (i = 0; i < s->xxch_nbits_spk_mask; ++i) { ++ if (channel_mask & (1 << i)) { ++ channel_layout |= map_xxch_to_native[i]; ++ } ++ } ++ ++ /* make sure that we have managed to get equivelant dts/avcodec channel ++ * masks in some sense -- unfortunately some channels could overlap */ ++ if (av_popcount(channel_mask) != av_popcount(channel_layout)) { ++ av_log(avctx, AV_LOG_DEBUG, ++ "DTS-XXCH: Inconsistant avcodec/dts channel layouts\n"); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ avctx->channel_layout = channel_layout; ++ ++ if (!(avctx->request_channel_layout & AV_CH_LAYOUT_NATIVE)) { ++ /* Estimate DTS --> avcodec ordering table */ ++ for (chset = -1, j = 0; chset < s->xxch_chset; ++chset) { ++ mask = chset >= 0 ? s->xxch_spk_masks[chset] ++ : s->xxch_core_spkmask; ++ for (i = 0; i < s->xxch_nbits_spk_mask; i++) { ++ if (mask & ~(DCA_XXCH_LFE1 | DCA_XXCH_LFE2) & (1 << i)) { ++ lavc = map_xxch_to_native[i]; ++ posn = av_popcount(channel_layout & (lavc - 1)); ++ s->xxch_order_tab[j++] = posn; ++ } ++ } ++ } ++ ++ s->lfe_index = av_popcount(channel_layout & (AV_CH_LOW_FREQUENCY-1)); ++ } else { /* native ordering */ ++ for (i = 0; i < channels; i++) ++ s->xxch_order_tab[i] = i; ++ ++ s->lfe_index = channels - 1; ++ } ++ ++ s->channel_order_tab = s->xxch_order_tab; ++ } ++ ++ if (avctx->channels != channels) { ++ if (avctx->channels) ++ av_log(avctx, AV_LOG_INFO, "Number of channels changed in DCA decoder (%d -> %d)\n", avctx->channels, channels); ++ avctx->channels = channels; ++ } ++ ++ /* get output buffer */ ++ frame->nb_samples = 256 * (s->sample_blocks / 8); ++ if ((ret = ff_get_buffer(avctx, frame)) < 0) { ++ av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); ++ return ret; ++ } ++ samples_flt = (float **)frame->extended_data; ++ ++ /* allocate buffer for extra channels if downmixing */ ++ if (avctx->channels < full_channels) { ++ ret = av_samples_get_buffer_size(NULL, full_channels - channels, ++ frame->nb_samples, ++ avctx->sample_fmt, 0); ++ if (ret < 0) ++ return ret; ++ ++ av_fast_malloc(&s->extra_channels_buffer, ++ &s->extra_channels_buffer_size, ret); ++ if (!s->extra_channels_buffer) ++ return AVERROR(ENOMEM); ++ ++ ret = av_samples_fill_arrays((uint8_t **)s->extra_channels, NULL, ++ s->extra_channels_buffer, ++ full_channels - channels, ++ frame->nb_samples, avctx->sample_fmt, 0); ++ if (ret < 0) ++ return ret; ++ } ++ ++ /* filter to get final output */ ++ for (i = 0; i < (s->sample_blocks / 8); i++) { ++ int ch; ++ ++ for (ch = 0; ch < channels; ch++) ++ s->samples_chanptr[ch] = samples_flt[ch] + i * 256; ++ for (; ch < full_channels; ch++) ++ s->samples_chanptr[ch] = s->extra_channels[ch - channels] + i * 256; ++ ++ dca_filter_channels(s, i); ++ ++ /* If this was marked as a DTS-ES stream we need to subtract back- */ ++ /* channel from SL & SR to remove matrixed back-channel signal */ ++ if ((s->source_pcm_res & 1) && s->xch_present) { ++ float *back_chan = s->samples_chanptr[s->channel_order_tab[s->xch_base_channel]]; ++ float *lt_chan = s->samples_chanptr[s->channel_order_tab[s->xch_base_channel - 2]]; ++ float *rt_chan = s->samples_chanptr[s->channel_order_tab[s->xch_base_channel - 1]]; ++ s->fdsp.vector_fmac_scalar(lt_chan, back_chan, -M_SQRT1_2, 256); ++ s->fdsp.vector_fmac_scalar(rt_chan, back_chan, -M_SQRT1_2, 256); ++ } ++ ++ /* If stream contains XXCH, we might need to undo an embedded downmix */ ++ if (s->xxch_dmix_embedded) { ++ /* Loop over channel sets in turn */ ++ ch = num_core_channels; ++ for (chset = 0; chset < s->xxch_chset; chset++) { ++ endch = ch + s->xxch_chset_nch[chset]; ++ mask = s->xxch_dmix_embedded; ++ ++ /* undo downmix */ ++ for (j = ch; j < endch; j++) { ++ if (mask & (1 << j)) { /* this channel has been mixed-out */ ++ src_chan = s->samples_chanptr[s->channel_order_tab[j]]; ++ for (k = 0; k < endch; k++) { ++ achan = s->channel_order_tab[k]; ++ scale = s->xxch_dmix_coeff[j][k]; ++ if (scale != 0.0) { ++ dst_chan = s->samples_chanptr[achan]; ++ s->fdsp.vector_fmac_scalar(dst_chan, src_chan, ++ -scale, 256); ++ } ++ } ++ } ++ } ++ ++ /* if a downmix has been embedded then undo the pre-scaling */ ++ if ((mask & (1 << ch)) && s->xxch_dmix_sf[chset] != 1.0f) { ++ scale = s->xxch_dmix_sf[chset]; ++ ++ for (j = 0; j < ch; j++) { ++ src_chan = s->samples_chanptr[s->channel_order_tab[j]]; ++ for (k = 0; k < 256; k++) ++ src_chan[k] *= scale; ++ } ++ ++ /* LFE channel is always part of core, scale if it exists */ ++ if (s->lfe) { ++ src_chan = s->samples_chanptr[s->lfe_index]; ++ for (k = 0; k < 256; k++) ++ src_chan[k] *= scale; ++ } ++ } ++ ++ ch = endch; ++ } ++ ++ } ++ } ++ ++ /* update lfe history */ ++ lfe_samples = 2 * s->lfe * (s->sample_blocks / 8); ++ for (i = 0; i < 2 * s->lfe * 4; i++) ++ s->lfe_data[i] = s->lfe_data[i + lfe_samples]; ++ ++ *got_frame_ptr = 1; ++ ++ return buf_size; ++} ++ ++ ++ ++/** ++ * DCA initialization ++ * ++ * @param avctx pointer to the AVCodecContext ++ */ ++ ++static av_cold int dca_decode_init(AVCodecContext *avctx) ++{ ++ DCAContext *s = avctx->priv_data; ++ ++ s->avctx = avctx; ++ dca_init_vlcs(); ++ ++ avpriv_float_dsp_init(&s->fdsp, avctx->flags & CODEC_FLAG_BITEXACT); ++ ff_mdct_init(&s->imdct, 6, 1, 1.0); ++ ff_synth_filter_init(&s->synth); ++ ff_dcadsp_init(&s->dcadsp); ++ ff_fmt_convert_init(&s->fmt_conv, avctx); ++ ++ avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; ++ ++ /* allow downmixing to stereo */ ++ if (avctx->channels > 0 && avctx->request_channels < avctx->channels && ++ avctx->request_channels == 2) { ++ avctx->channels = avctx->request_channels; ++ } ++ ++ return 0; ++} ++ ++static av_cold int dca_decode_end(AVCodecContext *avctx) ++{ ++ DCAContext *s = avctx->priv_data; ++ ff_mdct_end(&s->imdct); ++ av_freep(&s->extra_channels_buffer); ++ return 0; ++} ++ ++static const AVProfile profiles[] = { ++ { FF_PROFILE_DTS, "DTS" }, ++ { FF_PROFILE_DTS_ES, "DTS-ES" }, ++ { FF_PROFILE_DTS_96_24, "DTS 96/24" }, ++ { FF_PROFILE_DTS_HD_HRA, "DTS-HD HRA" }, ++ { FF_PROFILE_DTS_HD_MA, "DTS-HD MA" }, ++ { FF_PROFILE_UNKNOWN }, ++}; ++ ++AVCodec ff_dca_decoder = { ++ .name = "dca", ++ .type = AVMEDIA_TYPE_AUDIO, ++ .id = AV_CODEC_ID_DTS, ++ .priv_data_size = sizeof(DCAContext), ++ .init = dca_decode_init, ++ .decode = dca_decode_frame, ++ .close = dca_decode_end, ++ .long_name = NULL_IF_CONFIG_SMALL("DCA (DTS Coherent Acoustics)"), ++ .capabilities = CODEC_CAP_CHANNEL_CONF | CODEC_CAP_DR1, ++ .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP, ++ AV_SAMPLE_FMT_NONE }, ++ .profiles = NULL_IF_CONFIG_SMALL(profiles), ++}; +diff --git a/libavcodec/fmtconvert.c b/libavcodec/fmtconvert.c +index c03117c..fab92e2 100644 +--- a/libavcodec/fmtconvert.c ++++ b/libavcodec/fmtconvert.c +@@ -29,6 +29,12 @@ static void int32_to_float_fmul_scalar_c(float *dst, const int *src, float mul, + dst[i] = src[i] * mul; + } + ++static void int32_to_float_fmul_scalar_array_c(FmtConvertContext *c, float *dst, const int *src, float *mul, int len){ ++ int i; ++ for(i=0; iint32_to_float_fmul_scalar(dst, src, *mul++, 8); ++} ++ + static av_always_inline int float_to_int16_one(const float *src){ + return av_clip_int16(lrintf(*src)); + } +@@ -78,6 +84,7 @@ void ff_float_interleave_c(float *dst, const float **src, unsigned int len, + av_cold void ff_fmt_convert_init(FmtConvertContext *c, AVCodecContext *avctx) + { + c->int32_to_float_fmul_scalar = int32_to_float_fmul_scalar_c; ++ c->int32_to_float_fmul_scalar_array = int32_to_float_fmul_scalar_array_c; + c->float_to_int16 = float_to_int16_c; + c->float_to_int16_interleave = float_to_int16_interleave_c; + c->float_interleave = ff_float_interleave_c; +diff --git a/libavcodec/fmtconvert.h b/libavcodec/fmtconvert.h +index c058475..ce44615 100644 +--- a/libavcodec/fmtconvert.h ++++ b/libavcodec/fmtconvert.h +@@ -38,6 +38,20 @@ + void (*int32_to_float_fmul_scalar)(float *dst, const int *src, float mul, int len); + + /** ++ * Convert an array of int32_t to float and multiply by a float value from another array, ++ * stepping along the float array once for each 8 integers. ++ * @param c pointer to FmtConvertContext. ++ * @param dst destination array of float. ++ * constraints: 16-byte aligned ++ * @param src source array of int32_t. ++ * constraints: 16-byte aligned ++ * @param mul source array of float multipliers. ++ * @param len number of elements to convert. ++ * constraints: multiple of 8 ++ */ ++ void (*int32_to_float_fmul_scalar_array)(struct FmtConvertContext *c, float *dst, const int *src, float *mul, int len); ++ ++ /** + * Convert an array of float to an array of int16_t. + * + * Convert floats from in the range [-32768.0,32767.0] to ints +-- +1.8.1.6 + + +From a54cb0a8b8e3fe207dfd0652cf339d988329f591 Mon Sep 17 00:00:00 2001 +From: Ben Avison +Date: Thu, 27 Jun 2013 23:11:44 +0100 +Subject: [PATCH 53/55] Add VFP-accelerated version of imdct_half + +--- + libavcodec/arm/Makefile | 1 + + libavcodec/arm/fft_init_arm.c | 6 + + libavcodec/arm/mdct_vfp.S | 193 +++++++++++++++++++++++++++ + libavcodec/arm/synth_filter_vfp.S | 2 +- + 4 files changed, 201 insertions(+), 1 deletion(-) + create mode 100644 libavcodec/arm/mdct_vfp.S + +diff --git a/libavcodec/arm/Makefile b/libavcodec/arm/Makefile +index b8b4df2..f6e683a 100644 +--- a/libavcodec/arm/Makefile ++++ b/libavcodec/arm/Makefile +@@ -37,6 +37,7 @@ OBJS-$(HAVE_ARMV6) += arm/dsputil_init_armv6.o \ + $(ARMV6-OBJS-yes) + + VFP-OBJS-$(HAVE_ARMV6) += arm/fmtconvert_vfp.o \ ++ arm/mdct_vfp.o \ + arm/synth_filter_vfp.o + + OBJS-$(HAVE_ARMVFP) += arm/dsputil_vfp.o \ +diff --git a/libavcodec/arm/fft_init_arm.c b/libavcodec/arm/fft_init_arm.c +index 605b3dd..baed753 100644 +--- a/libavcodec/arm/fft_init_arm.c ++++ b/libavcodec/arm/fft_init_arm.c +@@ -25,6 +25,8 @@ + void ff_fft_permute_neon(FFTContext *s, FFTComplex *z); + void ff_fft_calc_neon(FFTContext *s, FFTComplex *z); + ++void ff_imdct_half_vfp(FFTContext *s, FFTSample *output, const FFTSample *input); ++ + void ff_imdct_calc_neon(FFTContext *s, FFTSample *output, const FFTSample *input); + void ff_imdct_half_neon(FFTContext *s, FFTSample *output, const FFTSample *input); + void ff_mdct_calc_neon(FFTContext *s, FFTSample *output, const FFTSample *input); +@@ -46,6 +48,10 @@ void ff_synth_filter_float_neon(FFTContext *imdct, + av_cold void ff_fft_init_arm(FFTContext *s) + { + if (HAVE_NEON) { ++ if (HAVE_ARMVFP) { ++ s->imdct_half = ff_imdct_half_vfp; ++ } ++ + s->fft_permute = ff_fft_permute_neon; + s->fft_calc = ff_fft_calc_neon; + #if CONFIG_MDCT +diff --git a/libavcodec/arm/mdct_vfp.S b/libavcodec/arm/mdct_vfp.S +new file mode 100644 +index 0000000..2e2126e +--- /dev/null ++++ b/libavcodec/arm/mdct_vfp.S +@@ -0,0 +1,193 @@ ++/* ++ * Copyright (c) 2013 RISC OS Open Ltd ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg 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 ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ * ++ * Author: Ben Avison ++ */ ++ ++#include "libavcodec/arm/asm.S" ++ ++CONTEXT .req a1 ++ORIGOUT .req a2 ++IN .req a3 ++OUT .req v1 ++REVTAB .req v2 ++TCOS .req v3 ++TSIN .req v4 ++OLDFPSCR .req v5 ++J0 .req a2 ++J1 .req a4 ++J2 .req ip ++J3 .req lr ++ ++.macro prerotation_innerloop ++ .set trig_lo, k ++ .set trig_hi, n4 - k - 2 ++ .set in_lo, trig_lo * 2 ++ .set in_hi, trig_hi * 2 ++ vldr d8, [TCOS, #trig_lo*4] @ s16,s17 ++ vldr d9, [TCOS, #trig_hi*4] @ s18,s19 ++ vldr s0, [IN, #in_hi*4 + 12] ++ vldr s1, [IN, #in_hi*4 + 4] ++ vldr s2, [IN, #in_lo*4 + 12] ++ vldr s3, [IN, #in_lo*4 + 4] ++ vmul.f s8, s0, s16 @ vector operation ++ vldr d10, [TSIN, #trig_lo*4] @ s20,s21 ++ vldr d11, [TSIN, #trig_hi*4] @ s22,s23 ++ vldr s4, [IN, #in_lo*4] ++ vldr s5, [IN, #in_lo*4 + 8] ++ vldr s6, [IN, #in_hi*4] ++ vldr s7, [IN, #in_hi*4 + 8] ++ ldr J0, [REVTAB, #trig_lo*2] ++ vmul.f s12, s0, s20 @ vector operation ++ ldr J2, [REVTAB, #trig_hi*2] ++ mov J1, J0, lsr #16 ++ and J0, J0, #255 @ halfword value will be < n4 ++ vmls.f s8, s4, s20 @ vector operation ++ mov J3, J2, lsr #16 ++ and J2, J2, #255 @ halfword value will be < n4 ++ add J0, OUT, J0, lsl #3 ++ vmla.f s12, s4, s16 @ vector operation ++ add J1, OUT, J1, lsl #3 ++ add J2, OUT, J2, lsl #3 ++ add J3, OUT, J3, lsl #3 ++ vstr s8, [J0] ++ vstr s9, [J1] ++ vstr s10, [J2] ++ vstr s11, [J3] ++ vstr s12, [J0, #4] ++ vstr s13, [J1, #4] ++ vstr s14, [J2, #4] ++ vstr s15, [J3, #4] ++ .set k, k + 2 ++.endm ++ ++.macro postrotation_innerloop tail, head ++ .set trig_lo_head, n8 - k - 2 ++ .set trig_hi_head, n8 + k ++ .set out_lo_head, trig_lo_head * 2 ++ .set out_hi_head, trig_hi_head * 2 ++ .set trig_lo_tail, n8 - (k - 2) - 2 ++ .set trig_hi_tail, n8 + (k - 2) ++ .set out_lo_tail, trig_lo_tail * 2 ++ .set out_hi_tail, trig_hi_tail * 2 ++ .if (k & 2) == 0 ++ TCOS_D0_HEAD .req d10 @ s20,s21 ++ TCOS_D1_HEAD .req d11 @ s22,s23 ++ TCOS_S0_TAIL .req s24 ++ .else ++ TCOS_D0_HEAD .req d12 @ s24,s25 ++ TCOS_D1_HEAD .req d13 @ s26,s27 ++ TCOS_S0_TAIL .req s20 ++ .endif ++ .ifnc "\tail","" ++ vmls.f s8, s0, TCOS_S0_TAIL @ vector operation ++ .endif ++ .ifnc "\head","" ++ vldr d8, [TSIN, #trig_lo_head*4] @ s16,s17 ++ vldr d9, [TSIN, #trig_hi_head*4] @ s18,s19 ++ vldr TCOS_D0_HEAD, [TCOS, #trig_lo_head*4] ++ .endif ++ .ifnc "\tail","" ++ vmla.f s12, s4, TCOS_S0_TAIL @ vector operation ++ .endif ++ .ifnc "\head","" ++ vldr s0, [OUT, #out_lo_head*4] ++ vldr s1, [OUT, #out_lo_head*4 + 8] ++ vldr s2, [OUT, #out_hi_head*4] ++ vldr s3, [OUT, #out_hi_head*4 + 8] ++ vldr s4, [OUT, #out_lo_head*4 + 4] ++ vldr s5, [OUT, #out_lo_head*4 + 12] ++ vldr s6, [OUT, #out_hi_head*4 + 4] ++ vldr s7, [OUT, #out_hi_head*4 + 12] ++ .endif ++ .ifnc "\tail","" ++ vstr s8, [OUT, #out_lo_tail*4] ++ vstr s9, [OUT, #out_lo_tail*4 + 8] ++ vstr s10, [OUT, #out_hi_tail*4] ++ vstr s11, [OUT, #out_hi_tail*4 + 8] ++ .endif ++ .ifnc "\head","" ++ vmul.f s8, s4, s16 @ vector operation ++ .endif ++ .ifnc "\tail","" ++ vstr s12, [OUT, #out_hi_tail*4 + 12] ++ vstr s13, [OUT, #out_hi_tail*4 + 4] ++ vstr s14, [OUT, #out_lo_tail*4 + 12] ++ vstr s15, [OUT, #out_lo_tail*4 + 4] ++ .endif ++ .ifnc "\head","" ++ vmul.f s12, s0, s16 @ vector operation ++ vldr TCOS_D1_HEAD, [TCOS, #trig_hi_head*4] ++ .endif ++ .unreq TCOS_D0_HEAD ++ .unreq TCOS_D1_HEAD ++ .unreq TCOS_S0_TAIL ++ .ifnc "\head","" ++ .set k, k + 2 ++ .endif ++.endm ++ ++ ++/* void ff_imdct_half_vfp(FFTContext *s, ++ * FFTSample *output, ++ * const FFTSample *input) ++ */ ++function ff_imdct_half_vfp, export=1 ++ ldr ip, [CONTEXT, #5*4] @ mdct_bits ++ teq ip, #6 ++ bne ff_imdct_half_c @ only case currently accelerated is the one used by DCA ++ ++ .set n, 1<<6 ++ .set n2, n/2 ++ .set n4, n/4 ++ .set n8, n/8 ++ ++ push {v1-v5,lr} ++ vpush {s16-s27} ++ vmrs OLDFPSCR, FPSCR ++ ldr lr, =0x03030000 @ RunFast mode, short vectors of length 4, stride 1 ++ vmsr FPSCR, lr ++ mov OUT, ORIGOUT ++ ldr REVTAB, [CONTEXT, #2*4] ++ ldr TCOS, [CONTEXT, #6*4] ++ ldr TSIN, [CONTEXT, #7*4] ++ ++ .set k, 0 ++ .rept n8/2 ++ prerotation_innerloop ++ .endr ++ ++ vmsr FPSCR, OLDFPSCR ++ mov ORIGOUT, OUT ++ ldr ip, [CONTEXT, #9*4] ++ blx ip @ s->fft_calc(s, output) ++ ldr lr, =0x03030000 @ RunFast mode, short vectors of length 4, stride 1 ++ vmsr FPSCR, lr ++ ++ .set k, 0 ++ postrotation_innerloop , head ++ .rept n8/2 - 1 ++ postrotation_innerloop tail, head ++ .endr ++ postrotation_innerloop tail ++ ++ vmsr FPSCR, OLDFPSCR ++ vpop {s16-s27} ++ pop {v1-v5,pc} ++endfunc +diff --git a/libavcodec/arm/synth_filter_vfp.S b/libavcodec/arm/synth_filter_vfp.S +index 8c54267..40bf2c4 100644 +--- a/libavcodec/arm/synth_filter_vfp.S ++++ b/libavcodec/arm/synth_filter_vfp.S +@@ -133,7 +133,7 @@ function ff_synth_filter_float_vfp, export=1 + str lr, [P_SB_OFF] @ rotate offset, modulo buffer size, ready for next call + ldr a3, [sp, #(16+6+2)*4] @ fetch in from stack, to pass to imdct_half + VFP vmov s16, SCALE @ imdct_half is free to corrupt s0, but it contains one of our arguments in hardfp case +- bl ff_imdct_half_c ++ bl ff_imdct_half_vfp + VFP vmov SCALE, s16 + + vmrs OLDFPSCR, FPSCR +-- +1.8.1.6 + + +From 872db4f60fd2314cab83eeddf72a46a53708bf62 Mon Sep 17 00:00:00 2001 +From: Ben Avison +Date: Fri, 28 Jun 2013 21:21:06 +0100 +Subject: [PATCH 54/55] Add VFP_accelerated version of dca_lfe_fir + +--- + libavcodec/arm/Makefile | 3 +- + libavcodec/arm/dcadsp_init_arm.c | 4 + + libavcodec/arm/dcadsp_vfp.S | 189 ++++++++++++++++++++++++++++ + 3 files changed, 195 insertions(+), 1 deletion(-) + create mode 100644 libavcodec/arm/dcadsp_vfp.S + +diff --git a/libavcodec/arm/Makefile b/libavcodec/arm/Makefile +index f6e683a..ad1ae07 100644 +--- a/libavcodec/arm/Makefile ++++ b/libavcodec/arm/Makefile +@@ -36,7 +36,8 @@ OBJS-$(HAVE_ARMV6) += arm/dsputil_init_armv6.o \ + arm/simple_idct_armv6.o \ + $(ARMV6-OBJS-yes) + +-VFP-OBJS-$(HAVE_ARMV6) += arm/fmtconvert_vfp.o \ ++VFP-OBJS-$(HAVE_ARMV6) += arm/dcadsp_vfp.o \ ++ arm/fmtconvert_vfp.o \ + arm/mdct_vfp.o \ + arm/synth_filter_vfp.o + +diff --git a/libavcodec/arm/dcadsp_init_arm.c b/libavcodec/arm/dcadsp_init_arm.c +index 5663cd7..d62fc75 100644 +--- a/libavcodec/arm/dcadsp_init_arm.c ++++ b/libavcodec/arm/dcadsp_init_arm.c +@@ -22,11 +22,15 @@ + #include "libavutil/attributes.h" + #include "libavcodec/dcadsp.h" + ++void ff_dca_lfe_fir_vfp(float *out, const float *in, const float *coefs, ++ int decifactor, float scale); + void ff_dca_lfe_fir_neon(float *out, const float *in, const float *coefs, + int decifactor, float scale); + + void av_cold ff_dcadsp_init_arm(DCADSPContext *s) + { ++ if (HAVE_ARMVFP) ++ s->lfe_fir = ff_dca_lfe_fir_vfp; + if (HAVE_NEON) + s->lfe_fir = ff_dca_lfe_fir_neon; + } +diff --git a/libavcodec/arm/dcadsp_vfp.S b/libavcodec/arm/dcadsp_vfp.S +new file mode 100644 +index 0000000..606e4af +--- /dev/null ++++ b/libavcodec/arm/dcadsp_vfp.S +@@ -0,0 +1,189 @@ ++/* ++ * Copyright (c) 2013 RISC OS Open Ltd ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg 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 ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ * ++ * Author: Ben Avison ++ */ ++ ++#include "libavcodec/arm/asm.S" ++ ++POUT .req a1 ++PIN .req a2 ++PCOEF .req a3 ++DECIFACTOR .req a4 ++OLDFPSCR .req a4 ++COUNTER .req ip ++ ++SCALE32 .req s28 @ use vector of 4 in place of 9th scalar when decifactor=32 / JMAX=8 ++SCALE64 .req s0 @ spare register in scalar bank when decifactor=64 / JMAX=4 ++IN0 .req s4 ++IN1 .req s5 ++IN2 .req s6 ++IN3 .req s7 ++IN4 .req s0 ++IN5 .req s1 ++IN6 .req s2 ++IN7 .req s3 ++COEF0 .req s8 @ coefficient elements ++COEF1 .req s9 ++COEF2 .req s10 ++COEF3 .req s11 ++COEF4 .req s12 ++COEF5 .req s13 ++COEF6 .req s14 ++COEF7 .req s15 ++ACCUM0 .req s16 @ double-buffered multiply-accumulate results ++ACCUM4 .req s20 ++POST0 .req s24 @ do long-latency post-multiply in this vector in parallel ++POST1 .req s25 ++POST2 .req s26 ++POST3 .req s27 ++ ++ ++.macro inner_loop decifactor, dir, tail, head ++ .ifc "\dir","up" ++ .set X, 0 ++ .set Y, 4 ++ .else ++ .set X, 4*JMAX*4 - 4 ++ .set Y, -4 ++ .endif ++ .ifnc "\head","" ++ vldr COEF0, [PCOEF, #X + (0*JMAX + 0) * Y] ++ vldr COEF1, [PCOEF, #X + (1*JMAX + 0) * Y] ++ vldr COEF2, [PCOEF, #X + (2*JMAX + 0) * Y] ++ vldr COEF3, [PCOEF, #X + (3*JMAX + 0) * Y] ++ .endif ++ .ifnc "\tail","" ++ vadd.f POST0, ACCUM0, ACCUM4 @ vector operation ++ .endif ++ .ifnc "\head","" ++ vmul.f ACCUM0, COEF0, IN0 @ vector = vector * scalar ++ vldr COEF4, [PCOEF, #X + (0*JMAX + 1) * Y] ++ vldr COEF5, [PCOEF, #X + (1*JMAX + 1) * Y] ++ vldr COEF6, [PCOEF, #X + (2*JMAX + 1) * Y] ++ .endif ++ .ifnc "\tail","" ++ vmul.f POST0, POST0, SCALE\decifactor @ vector operation (SCALE may be scalar) ++ .endif ++ .ifnc "\head","" ++ vldr COEF7, [PCOEF, #X + (3*JMAX + 1) * Y] ++ .ifc "\tail","" ++ vmul.f ACCUM4, COEF4, IN1 @ vector operation ++ .endif ++ vldr COEF0, [PCOEF, #X + (0*JMAX + 2) * Y] ++ vldr COEF1, [PCOEF, #X + (1*JMAX + 2) * Y] ++ .ifnc "\tail","" ++ vmul.f ACCUM4, COEF4, IN1 @ vector operation ++ .endif ++ vldr COEF2, [PCOEF, #X + (2*JMAX + 2) * Y] ++ vldr COEF3, [PCOEF, #X + (3*JMAX + 2) * Y] ++ .endif ++ .ifnc "\tail","" ++ vstmia POUT!, {POST0-POST3} ++ .endif ++ .ifnc "\head","" ++ vmla.f ACCUM0, COEF0, IN2 @ vector = vector * scalar ++ vldr COEF4, [PCOEF, #X + (0*JMAX + 3) * Y] ++ vldr COEF5, [PCOEF, #X + (1*JMAX + 3) * Y] ++ vldr COEF6, [PCOEF, #X + (2*JMAX + 3) * Y] ++ vldr COEF7, [PCOEF, #X + (3*JMAX + 3) * Y] ++ vmla.f ACCUM4, COEF4, IN3 @ vector = vector * scalar ++ .if \decifactor == 32 ++ vldr COEF0, [PCOEF, #X + (0*JMAX + 4) * Y] ++ vldr COEF1, [PCOEF, #X + (1*JMAX + 4) * Y] ++ vldr COEF2, [PCOEF, #X + (2*JMAX + 4) * Y] ++ vldr COEF3, [PCOEF, #X + (3*JMAX + 4) * Y] ++ vmla.f ACCUM0, COEF0, IN4 @ vector = vector * scalar ++ vldr COEF4, [PCOEF, #X + (0*JMAX + 5) * Y] ++ vldr COEF5, [PCOEF, #X + (1*JMAX + 5) * Y] ++ vldr COEF6, [PCOEF, #X + (2*JMAX + 5) * Y] ++ vldr COEF7, [PCOEF, #X + (3*JMAX + 5) * Y] ++ vmla.f ACCUM4, COEF4, IN5 @ vector = vector * scalar ++ vldr COEF0, [PCOEF, #X + (0*JMAX + 6) * Y] ++ vldr COEF1, [PCOEF, #X + (1*JMAX + 6) * Y] ++ vldr COEF2, [PCOEF, #X + (2*JMAX + 6) * Y] ++ vldr COEF3, [PCOEF, #X + (3*JMAX + 6) * Y] ++ vmla.f ACCUM0, COEF0, IN6 @ vector = vector * scalar ++ vldr COEF4, [PCOEF, #X + (0*JMAX + 7) * Y] ++ vldr COEF5, [PCOEF, #X + (1*JMAX + 7) * Y] ++ vldr COEF6, [PCOEF, #X + (2*JMAX + 7) * Y] ++ vldr COEF7, [PCOEF, #X + (3*JMAX + 7) * Y] ++ vmla.f ACCUM4, COEF4, IN7 @ vector = vector * scalar ++ .endif ++ .endif ++.endm ++ ++.macro dca_lfe_fir decifactor ++ .if \decifactor == 32 ++ .set JMAX, 8 ++ vpush {s16-s31} ++ vmov SCALE32, s0 @ duplicate scalar across vector ++ vldr IN4, [PIN, #-4*4] ++ vldr IN5, [PIN, #-5*4] ++ vldr IN6, [PIN, #-6*4] ++ vldr IN7, [PIN, #-7*4] ++ .else ++ .set JMAX, 4 ++ vpush {s16-s27} ++ .endif ++ ++ mov COUNTER, #\decifactor/4 - 1 ++ inner_loop \decifactor, up,, head ++1: add PCOEF, PCOEF, #4*JMAX*4 ++ subs COUNTER, COUNTER, #1 ++ inner_loop \decifactor, up, tail, head ++ bne 1b ++ inner_loop \decifactor, up, tail ++ ++ mov COUNTER, #\decifactor/4 - 1 ++ inner_loop \decifactor, down,, head ++1: sub PCOEF, PCOEF, #4*JMAX*4 ++ subs COUNTER, COUNTER, #1 ++ inner_loop \decifactor, down, tail, head ++ bne 1b ++ inner_loop \decifactor, down, tail ++ ++ .if \decifactor == 32 ++ vpop {s16-s31} ++ .else ++ vpop {s16-s27} ++ .endif ++ vmsr FPSCR, OLDFPSCR ++ bx lr ++.endm ++ ++ ++/* void ff_dca_lfe_fir_vfp(float *out, const float *in, const float *coefs, ++ * int decifactor, float scale) ++ */ ++function ff_dca_lfe_fir_vfp, export=1 ++ teq DECIFACTOR, #32 ++ vmrs OLDFPSCR, FPSCR ++ ldr ip, =0x03030000 @ RunFast mode, short vectors of length 4, stride 1 ++ vmsr FPSCR, ip ++NOVFP vldr s0, [sp] ++ vldr IN0, [PIN, #-0*4] ++ vldr IN1, [PIN, #-1*4] ++ vldr IN2, [PIN, #-2*4] ++ vldr IN3, [PIN, #-3*4] ++ beq 32f ++64: dca_lfe_fir 64 ++ .ltorg ++32: dca_lfe_fir 32 ++endfunc +-- +1.8.1.6 + + +From 59230eeb1c1ac9bbb3089fd86172d5fafbdebe94 Mon Sep 17 00:00:00 2001 +From: Ben Avison +Date: Tue, 9 Jul 2013 17:44:50 +0100 +Subject: [PATCH 55/55] Add VFP-accelerated version of fft16 + +--- + libavcodec/arm/Makefile | 1 + + libavcodec/arm/fft_vfp.S | 299 +++++++++++++++++++++++++++++++++++ + libavcodec/arm/mdct_vfp.S | 5 +- + 3 files changed, 302 insertions(+), 3 deletions(-) + create mode 100644 libavcodec/arm/fft_vfp.S + +diff --git a/libavcodec/arm/Makefile b/libavcodec/arm/Makefile +index ad1ae07..798dfe3 100644 +--- a/libavcodec/arm/Makefile ++++ b/libavcodec/arm/Makefile +@@ -37,6 +37,7 @@ OBJS-$(HAVE_ARMV6) += arm/dsputil_init_armv6.o \ + $(ARMV6-OBJS-yes) + + VFP-OBJS-$(HAVE_ARMV6) += arm/dcadsp_vfp.o \ ++ arm/fft_vfp.o \ + arm/fmtconvert_vfp.o \ + arm/mdct_vfp.o \ + arm/synth_filter_vfp.o +diff --git a/libavcodec/arm/fft_vfp.S b/libavcodec/arm/fft_vfp.S +new file mode 100644 +index 0000000..a7106ea +--- /dev/null ++++ b/libavcodec/arm/fft_vfp.S +@@ -0,0 +1,299 @@ ++/* ++ * Copyright (c) 2013 RISC OS Open Ltd ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg 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 ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ * ++ * Author: Ben Avison ++ */ ++ ++#include "libavcodec/arm/asm.S" ++ ++@ TODO: * FFTs wider than 16 ++@ * dispatch code ++ ++function fft4_vfp ++ vldr d0, [a1, #0*2*4] @ s0,s1 = z[0] ++ vldr d4, [a1, #1*2*4] @ s8,s9 = z[1] ++ vldr d1, [a1, #2*2*4] @ s2,s3 = z[2] ++ vldr d5, [a1, #3*2*4] @ s10,s11 = z[3] ++ @ stall ++ vadd.f s12, s0, s8 @ i0 ++ vadd.f s13, s1, s9 @ i1 ++ vadd.f s14, s2, s10 @ i2 ++ vadd.f s15, s3, s11 @ i3 ++ vsub.f s8, s0, s8 @ i4 ++ vsub.f s9, s1, s9 @ i5 ++ vsub.f s10, s2, s10 @ i6 ++ vsub.f s11, s3, s11 @ i7 ++ @ stall ++ @ stall ++ vadd.f s0, s12, s14 @ z[0].re ++ vsub.f s4, s12, s14 @ z[2].re ++ vadd.f s1, s13, s15 @ z[0].im ++ vsub.f s5, s13, s15 @ z[2].im ++ vadd.f s7, s9, s10 @ z[3].im ++ vsub.f s3, s9, s10 @ z[1].im ++ vadd.f s2, s8, s11 @ z[1].re ++ vsub.f s6, s8, s11 @ z[3].re ++ @ stall ++ @ stall ++ vstr d0, [a1, #0*2*4] ++ vstr d2, [a1, #2*2*4] ++ @ stall ++ @ stall ++ vstr d1, [a1, #1*2*4] ++ vstr d3, [a1, #3*2*4] ++ ++ bx lr ++endfunc ++ ++.macro macro_fft8_head ++ @ FFT4 ++ vldr d4, [a1, #0 * 2*4] ++ vldr d6, [a1, #1 * 2*4] ++ vldr d5, [a1, #2 * 2*4] ++ vldr d7, [a1, #3 * 2*4] ++ @ BF ++ vldr d12, [a1, #4 * 2*4] ++ vadd.f s16, s8, s12 @ vector op ++ vldr d14, [a1, #5 * 2*4] ++ vldr d13, [a1, #6 * 2*4] ++ vldr d15, [a1, #7 * 2*4] ++ vsub.f s20, s8, s12 @ vector op ++ vadd.f s0, s16, s18 ++ vsub.f s2, s16, s18 ++ vadd.f s1, s17, s19 ++ vsub.f s3, s17, s19 ++ vadd.f s7, s21, s22 ++ vsub.f s5, s21, s22 ++ vadd.f s4, s20, s23 ++ vsub.f s6, s20, s23 ++ vsub.f s20, s24, s28 @ vector op ++ vstr d0, [a1, #0 * 2*4] @ transfer s0-s7 to s24-s31 via memory ++ vstr d1, [a1, #1 * 2*4] ++ vldr s0, cos1pi4 ++ vadd.f s16, s24, s28 @ vector op ++ vstr d2, [a1, #2 * 2*4] ++ vstr d3, [a1, #3 * 2*4] ++ vldr d12, [a1, #0 * 2*4] ++ @ TRANSFORM ++ vmul.f s20, s20, s0 @ vector x scalar op ++ vldr d13, [a1, #1 * 2*4] ++ vldr d14, [a1, #2 * 2*4] ++ vldr d15, [a1, #3 * 2*4] ++ @ BUTTERFLIES ++ vadd.f s0, s18, s16 ++ vadd.f s1, s17, s19 ++ vsub.f s2, s17, s19 ++ vsub.f s3, s18, s16 ++ vadd.f s4, s21, s20 ++ vsub.f s5, s21, s20 ++ vadd.f s6, s22, s23 ++ vsub.f s7, s22, s23 ++ vadd.f s8, s0, s24 @ vector op ++ vstr d0, [a1, #0 * 2*4] @ transfer s0-s3 to s12-s15 via memory ++ vstr d1, [a1, #1 * 2*4] ++ vldr d6, [a1, #0 * 2*4] ++ vldr d7, [a1, #1 * 2*4] ++ vadd.f s1, s5, s6 ++ vadd.f s0, s7, s4 ++ vsub.f s2, s5, s6 ++ vsub.f s3, s7, s4 ++ vsub.f s12, s24, s12 @ vector op ++ vsub.f s5, s29, s1 ++ vsub.f s4, s28, s0 ++ vsub.f s6, s30, s2 ++ vsub.f s7, s31, s3 ++ vadd.f s16, s0, s28 @ vector op ++ vstr d6, [a1, #4 * 2*4] ++ vstr d7, [a1, #6 * 2*4] ++ vstr d4, [a1, #0 * 2*4] ++ vstr d5, [a1, #2 * 2*4] ++ vstr d2, [a1, #5 * 2*4] ++ vstr d3, [a1, #7 * 2*4] ++.endm ++ ++.macro macro_fft8_tail ++ vstr d8, [a1, #1 * 2*4] ++ vstr d9, [a1, #3 * 2*4] ++.endm ++ ++function fft8_vfp ++ ldr a3, =0x03030000 @ RunFast mode, vector length 4, stride 1 ++ vmrs a2, FPSCR ++ vmsr FPSCR, a3 ++ vpush {s16-s31} ++ ++ macro_fft8_head ++ macro_fft8_tail ++ ++ vpop {s16-s31} ++ vmsr FPSCR, a2 ++ bx lr ++endfunc ++ ++.align 3 ++cos1pi4: @ cos(1*pi/4) = sqrt(2) ++ .float 0.707106769084930419921875 ++cos1pi8: @ cos(1*pi/8) = sqrt(2+sqrt(2))/2 ++ .float 0.92387950420379638671875 ++cos3pi8: @ cos(2*pi/8) = sqrt(2-sqrt(2))/2 ++ .float 0.3826834261417388916015625 ++ ++function ff_fft16_vfp, export=1 ++ ldr a3, =0x03030000 @ RunFast mode, vector length 4, stride 1 ++ vmrs a2, FPSCR ++ vmsr FPSCR, a3 ++ vpush {s16-s31} ++ ++ macro_fft8_head ++ @ FFT4(z+8) ++ vldr d10, [a1, #8 * 2*4] ++ vldr d12, [a1, #9 * 2*4] ++ vldr d11, [a1, #10 * 2*4] ++ vldr d13, [a1, #11 * 2*4] ++ macro_fft8_tail ++ vadd.f s16, s20, s24 @ vector op ++ @ FFT4(z+12) ++ vldr d4, [a1, #12 * 2*4] ++ vldr d6, [a1, #13 * 2*4] ++ vldr d5, [a1, #14 * 2*4] ++ vsub.f s20, s20, s24 @ vector op ++ vldr d7, [a1, #15 * 2*4] ++ vadd.f s0, s16, s18 ++ vsub.f s4, s16, s18 ++ vadd.f s1, s17, s19 ++ vsub.f s5, s17, s19 ++ vadd.f s7, s21, s22 ++ vsub.f s3, s21, s22 ++ vadd.f s2, s20, s23 ++ vsub.f s6, s20, s23 ++ vadd.f s16, s8, s12 @ vector op ++ vstr d0, [a1, #8 * 2*4] ++ vstr d2, [a1, #10 * 2*4] ++ vstr d1, [a1, #9 * 2*4] ++ vsub.f s20, s8, s12 ++ vstr d3, [a1, #11 * 2*4] ++ @ TRANSFORM(z[2],z[6],z[10],z[14],cos1pi4,cos1pi4) ++ vldr d12, [a1, #10 * 2*4] ++ vadd.f s0, s16, s18 ++ vadd.f s1, s17, s19 ++ vsub.f s6, s16, s18 ++ vsub.f s7, s17, s19 ++ vsub.f s3, s21, s22 ++ vadd.f s2, s20, s23 ++ vadd.f s5, s21, s22 ++ vsub.f s4, s20, s23 ++ vstr d0, [a1, #12 * 2*4] ++ vmov s0, s6 ++ @ TRANSFORM(z[1],z[5],z[9],z[13],cos1pi8,cos3pi8) ++ vldr d6, [a1, #9 * 2*4] ++ vstr d1, [a1, #13 * 2*4] ++ vldr d1, cos1pi4 @ s2 = cos1pi4, s3 = cos1pi8 ++ vstr d2, [a1, #15 * 2*4] ++ vldr d7, [a1, #13 * 2*4] ++ vadd.f s4, s25, s24 ++ vsub.f s5, s25, s24 ++ vsub.f s6, s0, s7 ++ vadd.f s7, s0, s7 ++ vmul.f s20, s12, s3 @ vector op ++ @ TRANSFORM(z[3],z[7],z[11],z[15],cos3pi8,cos1pi8) ++ vldr d4, [a1, #11 * 2*4] ++ vldr d5, [a1, #15 * 2*4] ++ vldr s1, cos3pi8 ++ vmul.f s24, s4, s2 @ vector * scalar op ++ vmul.f s28, s12, s1 @ vector * scalar op ++ vmul.f s12, s8, s1 @ vector * scalar op ++ vadd.f s4, s20, s29 ++ vsub.f s5, s21, s28 ++ vsub.f s6, s22, s31 ++ vadd.f s7, s23, s30 ++ vmul.f s8, s8, s3 @ vector * scalar op ++ vldr d8, [a1, #1 * 2*4] ++ vldr d9, [a1, #5 * 2*4] ++ vldr d10, [a1, #3 * 2*4] ++ vldr d11, [a1, #7 * 2*4] ++ vldr d14, [a1, #2 * 2*4] ++ vadd.f s0, s6, s4 ++ vadd.f s1, s5, s7 ++ vsub.f s2, s5, s7 ++ vsub.f s3, s6, s4 ++ vadd.f s4, s12, s9 ++ vsub.f s5, s13, s8 ++ vsub.f s6, s14, s11 ++ vadd.f s7, s15, s10 ++ vadd.f s12, s0, s16 @ vector op ++ vstr d0, [a1, #1 * 2*4] ++ vstr d1, [a1, #5 * 2*4] ++ vldr d4, [a1, #1 * 2*4] ++ vldr d5, [a1, #5 * 2*4] ++ vadd.f s0, s6, s4 ++ vadd.f s1, s5, s7 ++ vsub.f s2, s5, s7 ++ vsub.f s3, s6, s4 ++ vsub.f s8, s16, s8 @ vector op ++ vstr d6, [a1, #1 * 2*4] ++ vstr d7, [a1, #5 * 2*4] ++ vldr d15, [a1, #6 * 2*4] ++ vsub.f s4, s20, s0 ++ vsub.f s5, s21, s1 ++ vsub.f s6, s22, s2 ++ vsub.f s7, s23, s3 ++ vadd.f s20, s0, s20 @ vector op ++ vstr d4, [a1, #9 * 2*4] ++ @ TRANSFORM_ZERO(z[0],z[4],z[8],z[12]) ++ vldr d6, [a1, #8 * 2*4] ++ vstr d5, [a1, #13 * 2*4] ++ vldr d7, [a1, #12 * 2*4] ++ vstr d2, [a1, #11 * 2*4] ++ vldr d8, [a1, #0 * 2*4] ++ vstr d3, [a1, #15 * 2*4] ++ vldr d9, [a1, #4 * 2*4] ++ vadd.f s0, s26, s24 ++ vadd.f s1, s25, s27 ++ vsub.f s2, s25, s27 ++ vsub.f s3, s26, s24 ++ vadd.f s4, s14, s12 ++ vadd.f s5, s13, s15 ++ vsub.f s6, s13, s15 ++ vsub.f s7, s14, s12 ++ vadd.f s8, s0, s28 @ vector op ++ vstr d0, [a1, #3 * 2*4] ++ vstr d1, [a1, #7 * 2*4] ++ vldr d6, [a1, #3 * 2*4] ++ vldr d7, [a1, #7 * 2*4] ++ vsub.f s0, s16, s4 ++ vsub.f s1, s17, s5 ++ vsub.f s2, s18, s6 ++ vsub.f s3, s19, s7 ++ vsub.f s12, s28, s12 @ vector op ++ vadd.f s16, s4, s16 @ vector op ++ vstr d10, [a1, #3 * 2*4] ++ vstr d11, [a1, #7 * 2*4] ++ vstr d4, [a1, #2 * 2*4] ++ vstr d5, [a1, #6 * 2*4] ++ vstr d0, [a1, #8 * 2*4] ++ vstr d1, [a1, #12 * 2*4] ++ vstr d6, [a1, #10 * 2*4] ++ vstr d7, [a1, #14 * 2*4] ++ vstr d8, [a1, #0 * 2*4] ++ vstr d9, [a1, #4 * 2*4] ++ ++ vpop {s16-s31} ++ vmsr FPSCR, a2 ++ bx lr ++endfunc +diff --git a/libavcodec/arm/mdct_vfp.S b/libavcodec/arm/mdct_vfp.S +index 2e2126e..56ad48e 100644 +--- a/libavcodec/arm/mdct_vfp.S ++++ b/libavcodec/arm/mdct_vfp.S +@@ -174,9 +174,8 @@ function ff_imdct_half_vfp, export=1 + .endr + + vmsr FPSCR, OLDFPSCR +- mov ORIGOUT, OUT +- ldr ip, [CONTEXT, #9*4] +- blx ip @ s->fft_calc(s, output) ++ mov a1, OUT ++ bl ff_fft16_vfp + ldr lr, =0x03030000 @ RunFast mode, short vectors of length 4, stride 1 + vmsr FPSCR, lr + +-- +1.8.1.6 + diff --git a/packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0001-Support-raw-dvdsub-palette-as-stored-on-normal-dvd-s.patch b/packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-0001-Support-raw-dvdsub-palette-as-stored-on-normal-dvd-s.patch similarity index 100% rename from packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0001-Support-raw-dvdsub-palette-as-stored-on-normal-dvd-s.patch rename to packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-0001-Support-raw-dvdsub-palette-as-stored-on-normal-dvd-s.patch diff --git a/packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0002-Change-fallthrough-logic-for-read_seek-to-be-based-o.patch b/packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-0002-Change-fallthrough-logic-for-read_seek-to-be-based-o.patch similarity index 100% rename from packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0002-Change-fallthrough-logic-for-read_seek-to-be-based-o.patch rename to packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-0002-Change-fallthrough-logic-for-read_seek-to-be-based-o.patch diff --git a/packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0003-matroska-Check-return-value-of-avio_seek-and-avoid-m.patch b/packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-0003-matroska-Check-return-value-of-avio_seek-and-avoid-m.patch similarity index 100% rename from packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0003-matroska-Check-return-value-of-avio_seek-and-avoid-m.patch rename to packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-0003-matroska-Check-return-value-of-avio_seek-and-avoid-m.patch diff --git a/packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0004-asf-hacks.patch b/packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-0004-asf-hacks.patch similarity index 100% rename from packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0004-asf-hacks.patch rename to packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-0004-asf-hacks.patch diff --git a/packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0005-if-av_read_packet-returns-AVERROR_IO-we-are-done.-ff.patch b/packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-0005-if-av_read_packet-returns-AVERROR_IO-we-are-done.-ff.patch similarity index 100% rename from packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0005-if-av_read_packet-returns-AVERROR_IO-we-are-done.-ff.patch rename to packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-0005-if-av_read_packet-returns-AVERROR_IO-we-are-done.-ff.patch diff --git a/packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0006-added-Ticket-7187-TV-Teletext-support-for-DVB-EBU-Te.patch b/packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-0006-added-Ticket-7187-TV-Teletext-support-for-DVB-EBU-Te.patch similarity index 100% rename from packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0006-added-Ticket-7187-TV-Teletext-support-for-DVB-EBU-Te.patch rename to packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-0006-added-Ticket-7187-TV-Teletext-support-for-DVB-EBU-Te.patch diff --git a/packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0007-Don-t-accept-mpegts-PMT-that-isn-t-current.patch b/packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-0007-Don-t-accept-mpegts-PMT-that-isn-t-current.patch similarity index 100% rename from packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0007-Don-t-accept-mpegts-PMT-that-isn-t-current.patch rename to packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-0007-Don-t-accept-mpegts-PMT-that-isn-t-current.patch diff --git a/packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0008-Don-t-reparse-PMT-unless-it-s-version-has-changed.patch b/packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-0008-Don-t-reparse-PMT-unless-it-s-version-has-changed.patch similarity index 100% rename from packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0008-Don-t-reparse-PMT-unless-it-s-version-has-changed.patch rename to packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-0008-Don-t-reparse-PMT-unless-it-s-version-has-changed.patch diff --git a/packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0009-fixed-compile-with-VDPAU-header-versions-without-MPE.patch b/packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-0009-fixed-compile-with-VDPAU-header-versions-without-MPE.patch similarity index 100% rename from packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0009-fixed-compile-with-VDPAU-header-versions-without-MPE.patch rename to packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-0009-fixed-compile-with-VDPAU-header-versions-without-MPE.patch diff --git a/packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0010-Read-PID-timestamps-as-well-as-PCR-timestamps-to-fin.patch b/packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-0010-Read-PID-timestamps-as-well-as-PCR-timestamps-to-fin.patch similarity index 100% rename from packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0010-Read-PID-timestamps-as-well-as-PCR-timestamps-to-fin.patch rename to packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-0010-Read-PID-timestamps-as-well-as-PCR-timestamps-to-fin.patch diff --git a/packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0011-Get-stream-durations-using-read_timestamp.patch b/packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-0011-Get-stream-durations-using-read_timestamp.patch similarity index 100% rename from packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0011-Get-stream-durations-using-read_timestamp.patch rename to packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-0011-Get-stream-durations-using-read_timestamp.patch diff --git a/packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0013-aacenc-add-recognized-profiles-array.patch b/packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-0013-aacenc-add-recognized-profiles-array.patch similarity index 100% rename from packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0013-aacenc-add-recognized-profiles-array.patch rename to packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-0013-aacenc-add-recognized-profiles-array.patch diff --git a/packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0014-changed-allow-4-second-skew-between-streams-in-mov-b.patch b/packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-0014-changed-allow-4-second-skew-between-streams-in-mov-b.patch similarity index 100% rename from packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0014-changed-allow-4-second-skew-between-streams-in-mov-b.patch rename to packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-0014-changed-allow-4-second-skew-between-streams-in-mov-b.patch diff --git a/packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0015-fixed-memleak-in-mpegts-demuxer-on-some-malformed-mp.patch b/packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-0015-fixed-memleak-in-mpegts-demuxer-on-some-malformed-mp.patch similarity index 100% rename from packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0015-fixed-memleak-in-mpegts-demuxer-on-some-malformed-mp.patch rename to packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-0015-fixed-memleak-in-mpegts-demuxer-on-some-malformed-mp.patch diff --git a/packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0016-Speed-up-mpegts-av_find_stream_info.patch b/packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-0016-Speed-up-mpegts-av_find_stream_info.patch similarity index 100% rename from packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0016-Speed-up-mpegts-av_find_stream_info.patch rename to packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-0016-Speed-up-mpegts-av_find_stream_info.patch diff --git a/packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0017-allow-customizing-shared-library-soname-name-with-ma.patch b/packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-0017-allow-customizing-shared-library-soname-name-with-ma.patch similarity index 100% rename from packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0017-allow-customizing-shared-library-soname-name-with-ma.patch rename to packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-0017-allow-customizing-shared-library-soname-name-with-ma.patch diff --git a/packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0018-dxva-mpeg2-Allocate-slices-array-dynamically-fixes-v.patch b/packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-0018-dxva-mpeg2-Allocate-slices-array-dynamically-fixes-v.patch similarity index 100% rename from packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0018-dxva-mpeg2-Allocate-slices-array-dynamically-fixes-v.patch rename to packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-0018-dxva-mpeg2-Allocate-slices-array-dynamically-fixes-v.patch diff --git a/packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0019-dxva-mpeg2-speed-up-slice-allocation.patch b/packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-0019-dxva-mpeg2-speed-up-slice-allocation.patch similarity index 100% rename from packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0019-dxva-mpeg2-speed-up-slice-allocation.patch rename to packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-0019-dxva-mpeg2-speed-up-slice-allocation.patch diff --git a/packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0020-dxva-vc1-Take-BI-into-account-for-forward-and-backwa.patch b/packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-0020-dxva-vc1-Take-BI-into-account-for-forward-and-backwa.patch similarity index 100% rename from packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0020-dxva-vc1-Take-BI-into-account-for-forward-and-backwa.patch rename to packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-0020-dxva-vc1-Take-BI-into-account-for-forward-and-backwa.patch diff --git a/packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0021-dxva-vc1-Pass-overlapping-transforms-hint.patch b/packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-0021-dxva-vc1-Pass-overlapping-transforms-hint.patch similarity index 100% rename from packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0021-dxva-vc1-Pass-overlapping-transforms-hint.patch rename to packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-0021-dxva-vc1-Pass-overlapping-transforms-hint.patch diff --git a/packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0022-dxva-h264-Fix-dxva-playback-of-streams-that-don-t-st.patch b/packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-0022-dxva-h264-Fix-dxva-playback-of-streams-that-don-t-st.patch similarity index 100% rename from packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0022-dxva-h264-Fix-dxva-playback-of-streams-that-don-t-st.patch rename to packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-0022-dxva-h264-Fix-dxva-playback-of-streams-that-don-t-st.patch diff --git a/packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0024-add-public-version-of-ff_read_frame_flush.patch b/packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-0024-add-public-version-of-ff_read_frame_flush.patch similarity index 100% rename from packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0024-add-public-version-of-ff_read_frame_flush.patch rename to packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-0024-add-public-version-of-ff_read_frame_flush.patch diff --git a/packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0026-Handle-return-value-of-BeginFrame-better.patch b/packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-0026-Handle-return-value-of-BeginFrame-better.patch similarity index 100% rename from packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0026-Handle-return-value-of-BeginFrame-better.patch rename to packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-0026-Handle-return-value-of-BeginFrame-better.patch diff --git a/packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0028-ffmpeg-1.2-fixed-dvd-still-frames-ended-up-in-intern.patch b/packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-0028-ffmpeg-1.2-fixed-dvd-still-frames-ended-up-in-intern.patch similarity index 100% rename from packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0028-ffmpeg-1.2-fixed-dvd-still-frames-ended-up-in-intern.patch rename to packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-0028-ffmpeg-1.2-fixed-dvd-still-frames-ended-up-in-intern.patch diff --git a/packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0029-stop-forcing-gas-preprocessor-for-darwin.patch b/packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-0029-stop-forcing-gas-preprocessor-for-darwin.patch similarity index 100% rename from packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0029-stop-forcing-gas-preprocessor-for-darwin.patch rename to packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-0029-stop-forcing-gas-preprocessor-for-darwin.patch diff --git a/packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0036-backport-register-vdpau-hwaccel-for-mpeg12-fe1f36547d0be963e352de0cde1a6cba59ea2e78.patch b/packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-0036-backport-register-vdpau-hwaccel-for-mpeg12-fe1f36547d0be963e352de0cde1a6cba59ea2e78.patch similarity index 100% rename from packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0036-backport-register-vdpau-hwaccel-for-mpeg12-fe1f36547d0be963e352de0cde1a6cba59ea2e78.patch rename to packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-0036-backport-register-vdpau-hwaccel-for-mpeg12-fe1f36547d0be963e352de0cde1a6cba59ea2e78.patch diff --git a/packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0037-backport-fix-vdpau-vc1-interlace-modes-b37cc5995b88ec68a68cb8e496a008e1cd467077.patch b/packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-0037-backport-fix-vdpau-vc1-interlace-modes-b37cc5995b88ec68a68cb8e496a008e1cd467077.patch similarity index 100% rename from packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0037-backport-fix-vdpau-vc1-interlace-modes-b37cc5995b88ec68a68cb8e496a008e1cd467077.patch rename to packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-0037-backport-fix-vdpau-vc1-interlace-modes-b37cc5995b88ec68a68cb8e496a008e1cd467077.patch diff --git a/packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0038-backport-vaapi-return-early-from-ff_vaapi_render_picture-without-picture.patch b/packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-0038-backport-vaapi-return-early-from-ff_vaapi_render_picture-without-picture.patch similarity index 100% rename from packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0038-backport-vaapi-return-early-from-ff_vaapi_render_picture-without-picture.patch rename to packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-0038-backport-vaapi-return-early-from-ff_vaapi_render_picture-without-picture.patch diff --git a/packages/multimedia/ffmpeg/patches/1.2/ffmpeg-901.01-add_xvba_support.patch b/packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-901.01-add_xvba_support.patch similarity index 100% rename from packages/multimedia/ffmpeg/patches/1.2/ffmpeg-901.01-add_xvba_support.patch rename to packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-901.01-add_xvba_support.patch diff --git a/packages/multimedia/ffmpeg/patches/1.2/ffmpeg-901.05-XVBA-revisit_draw_functions.patch b/packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-901.05-XVBA-revisit_draw_functions.patch similarity index 100% rename from packages/multimedia/ffmpeg/patches/1.2/ffmpeg-901.05-XVBA-revisit_draw_functions.patch rename to packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-901.05-XVBA-revisit_draw_functions.patch diff --git a/packages/multimedia/ffmpeg/patches/1.2/ffmpeg-901.05-xvba_fix_pix_fmt_vda_vld_assert.patch b/packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-901.05-xvba_fix_pix_fmt_vda_vld_assert.patch similarity index 100% rename from packages/multimedia/ffmpeg/patches/1.2/ffmpeg-901.05-xvba_fix_pix_fmt_vda_vld_assert.patch rename to packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-901.05-xvba_fix_pix_fmt_vda_vld_assert.patch diff --git a/packages/multimedia/ffmpeg/patches/1.2/ffmpeg-901.06-XVBA-Make_XVBA_codec_available.patch b/packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-901.06-XVBA-Make_XVBA_codec_available.patch similarity index 100% rename from packages/multimedia/ffmpeg/patches/1.2/ffmpeg-901.06-XVBA-Make_XVBA_codec_available.patch rename to packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-901.06-XVBA-Make_XVBA_codec_available.patch diff --git a/packages/multimedia/ffmpeg/patches/1.2/ffmpeg-901.09-make_vc1_interlaced_working.patch b/packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-901.09-make_vc1_interlaced_working.patch similarity index 100% rename from packages/multimedia/ffmpeg/patches/1.2/ffmpeg-901.09-make_vc1_interlaced_working.patch rename to packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-901.09-make_vc1_interlaced_working.patch diff --git a/packages/multimedia/ffmpeg/patches/1.2/ffmpeg-901.10-XVBA_Only_set_second_field_when_we_are_interlaced_and_an_interlaced.patch b/packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-901.10-XVBA_Only_set_second_field_when_we_are_interlaced_and_an_interlaced.patch similarity index 100% rename from packages/multimedia/ffmpeg/patches/1.2/ffmpeg-901.10-XVBA_Only_set_second_field_when_we_are_interlaced_and_an_interlaced.patch rename to packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-901.10-XVBA_Only_set_second_field_when_we_are_interlaced_and_an_interlaced.patch diff --git a/packages/multimedia/ffmpeg/patches/1.2/ffmpeg-901.11-XVBA-translate_picture_structure_to_a_value_xvba_understands.patch b/packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-901.11-XVBA-translate_picture_structure_to_a_value_xvba_understands.patch similarity index 100% rename from packages/multimedia/ffmpeg/patches/1.2/ffmpeg-901.11-XVBA-translate_picture_structure_to_a_value_xvba_understands.patch rename to packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-901.11-XVBA-translate_picture_structure_to_a_value_xvba_understands.patch diff --git a/packages/multimedia/ffmpeg/patches/1.2/ffmpeg-901.12-XVBA-fix_vc1_field_interlace.patch b/packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-901.12-XVBA-fix_vc1_field_interlace.patch similarity index 100% rename from packages/multimedia/ffmpeg/patches/1.2/ffmpeg-901.12-XVBA-fix_vc1_field_interlace.patch rename to packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-901.12-XVBA-fix_vc1_field_interlace.patch diff --git a/packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-905.01-VFP_acceleration.patch b/packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-905.01-VFP_acceleration.patch new file mode 100644 index 0000000000..a756285072 --- /dev/null +++ b/packages/multimedia/ffmpeg/patches/1.2.1/ffmpeg-905.01-VFP_acceleration.patch @@ -0,0 +1,1560 @@ +From f097ecc4f42e29c6e8013a622bb569702ffe4546 Mon Sep 17 00:00:00 2001 +From: Ben Avison +Date: Fri, 14 Jun 2013 16:07:53 +0100 +Subject: [PATCH 1/6] Add VFP-accelerated version of synth_filter_float(), used + by DTS Coherent Acoustics decoder + +--- + libavcodec/arm/Makefile | 3 +- + libavcodec/arm/fft_init_arm.c | 8 ++ + libavcodec/arm/synth_filter_vfp.S | 206 +++++++++++++++++++++++++++ + 3 files changed, 216 insertions(+), 1 deletion(-) + create mode 100644 libavcodec/arm/synth_filter_vfp.S + +diff --git a/libavcodec/arm/Makefile b/libavcodec/arm/Makefile +index 1c91d62..9079270 100644 +--- a/libavcodec/arm/Makefile ++++ b/libavcodec/arm/Makefile +@@ -58,7 +58,8 @@ ARMV6-OBJS += arm/dsputil_init_armv6.o \ + arm/dsputil_armv6.o \ + arm/simple_idct_armv6.o \ + +-VFP-OBJS-$(HAVE_ARMV6) += arm/fmtconvert_vfp.o ++VFP-OBJS-$(HAVE_ARMV6) += arm/fmtconvert_vfp.o \ ++ arm/synth_filter_vfp.o + + NEON-OBJS-$(CONFIG_FFT) += arm/fft_neon.o \ + arm/fft_fixed_neon.o \ +diff --git a/libavcodec/arm/fft_init_arm.c b/libavcodec/arm/fft_init_arm.c +index 8c98abc..44c811d 100644 +--- a/libavcodec/arm/fft_init_arm.c ++++ b/libavcodec/arm/fft_init_arm.c +@@ -32,6 +32,12 @@ + + void ff_rdft_calc_neon(struct RDFTContext *s, FFTSample *z); + ++void ff_synth_filter_float_vfp(FFTContext *imdct, ++ float *synth_buf_ptr, int *synth_buf_offset, ++ float synth_buf2[32], const float window[512], ++ float out[32], const float in[32], ++ float scale); ++ + void ff_synth_filter_float_neon(FFTContext *imdct, + float *synth_buf_ptr, int *synth_buf_offset, + float synth_buf2[32], const float window[512], +@@ -71,6 +77,8 @@ av_cold void ff_synth_filter_init_arm(SynthFilterContext *s) + { + int cpu_flags = av_get_cpu_flags(); + ++ if (have_vfp(cpu_flags)) ++ s->synth_filter_float = ff_synth_filter_float_vfp; + if (have_neon(cpu_flags)) + s->synth_filter_float = ff_synth_filter_float_neon; + } +diff --git a/libavcodec/arm/synth_filter_vfp.S b/libavcodec/arm/synth_filter_vfp.S +new file mode 100644 +index 0000000..451fe5c +--- /dev/null ++++ b/libavcodec/arm/synth_filter_vfp.S +@@ -0,0 +1,206 @@ ++/* ++ * Copyright (c) 2013 RISC OS Open Ltd ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg 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 ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ * ++ * Author: Ben Avison ++ */ ++ ++#include "libavutil/arm/asm.S" ++ ++IMDCT .req r0 ++ORIG_P_SB .req r1 ++P_SB_OFF .req r2 ++I .req r0 ++P_SB2_UP .req r1 ++OLDFPSCR .req r2 ++P_SB2_DN .req r3 ++P_WIN_DN .req r4 ++P_OUT_DN .req r5 ++P_SB .req r6 ++J_WRAP .req r7 ++P_WIN_UP .req r12 ++P_OUT_UP .req r14 ++ ++SCALE .req s0 ++SBUF_DAT_REV0 .req s4 ++SBUF_DAT_REV1 .req s5 ++SBUF_DAT_REV2 .req s6 ++SBUF_DAT_REV3 .req s7 ++VA0 .req s8 ++VA3 .req s11 ++VB0 .req s12 ++VB3 .req s15 ++VC0 .req s8 ++VC3 .req s11 ++VD0 .req s12 ++VD3 .req s15 ++SBUF_DAT0 .req s16 ++SBUF_DAT1 .req s17 ++SBUF_DAT2 .req s18 ++SBUF_DAT3 .req s19 ++SBUF_DAT_ALT0 .req s20 ++SBUF_DAT_ALT1 .req s21 ++SBUF_DAT_ALT2 .req s22 ++SBUF_DAT_ALT3 .req s23 ++WIN_DN_DAT0 .req s24 ++WIN_UP_DAT0 .req s28 ++ ++ ++.macro inner_loop half, tail, head ++ .if (OFFSET & (64*4)) == 0 @ even numbered call ++ SBUF_DAT_THIS0 .req SBUF_DAT0 ++ SBUF_DAT_THIS1 .req SBUF_DAT1 ++ SBUF_DAT_THIS2 .req SBUF_DAT2 ++ SBUF_DAT_THIS3 .req SBUF_DAT3 ++ .ifnc "\head","" ++ vldr d8, [P_SB, #OFFSET] @ d8 = SBUF_DAT ++ vldr d9, [P_SB, #OFFSET+8] ++ .endif ++ .else ++ SBUF_DAT_THIS0 .req SBUF_DAT_ALT0 ++ SBUF_DAT_THIS1 .req SBUF_DAT_ALT1 ++ SBUF_DAT_THIS2 .req SBUF_DAT_ALT2 ++ SBUF_DAT_THIS3 .req SBUF_DAT_ALT3 ++ .ifnc "\head","" ++ vldr d10, [P_SB, #OFFSET] @ d10 = SBUF_DAT_ALT ++ vldr d11, [P_SB, #OFFSET+8] ++ .endif ++ .endif ++ .ifnc "\tail","" ++ .ifc "\half","ab" ++ vmls.f VA0, SBUF_DAT_REV0, WIN_DN_DAT0 @ all operands treated as vectors ++ .else ++ vmla.f VD0, SBUF_DAT_REV0, WIN_DN_DAT0 @ all operands treated as vectors ++ .endif ++ .endif ++ .ifnc "\head","" ++ vldr d14, [P_WIN_UP, #OFFSET] @ d14 = WIN_UP_DAT ++ vldr d15, [P_WIN_UP, #OFFSET+8] ++ vldr d12, [P_WIN_DN, #OFFSET] @ d12 = WIN_DN_DAT ++ vldr d13, [P_WIN_DN, #OFFSET+8] ++ vmov SBUF_DAT_REV3, SBUF_DAT_THIS0 ++ vmov SBUF_DAT_REV2, SBUF_DAT_THIS1 ++ vmov SBUF_DAT_REV1, SBUF_DAT_THIS2 ++ vmov SBUF_DAT_REV0, SBUF_DAT_THIS3 ++ .ifc "\half","ab" ++ vmla.f VB0, SBUF_DAT_THIS0, WIN_UP_DAT0 ++ .else ++ vmla.f VC0, SBUF_DAT_THIS0, WIN_UP_DAT0 ++ .endif ++ teq J_WRAP, #J ++ bne 2f @ strongly predictable, so better than cond exec in this case ++ sub P_SB, P_SB, #512*4 ++2: ++ .set J, J - 64 ++ .set OFFSET, OFFSET + 64*4 ++ .endif ++ .unreq SBUF_DAT_THIS0 ++ .unreq SBUF_DAT_THIS1 ++ .unreq SBUF_DAT_THIS2 ++ .unreq SBUF_DAT_THIS3 ++.endm ++ ++ ++/* void ff_synth_filter_float_vfp(FFTContext *imdct, ++ * float *synth_buf_ptr, int *synth_buf_offset, ++ * float synth_buf2[32], const float window[512], ++ * float out[32], const float in[32], float scale) ++ */ ++function ff_synth_filter_float_vfp, export=1 ++ push {r3-r7,lr} ++ vpush {s16-s31} ++ ldr lr, [P_SB_OFF] ++ add a2, ORIG_P_SB, lr, LSL #2 @ calculate synth_buf to pass to imdct_half ++ mov P_SB, a2 @ and keep a copy for ourselves ++ bic J_WRAP, lr, #63 @ mangled to make testing for wrap easier in inner loop ++ sub lr, lr, #32 ++ and lr, lr, #512-32 ++ str lr, [P_SB_OFF] @ rotate offset, modulo buffer size, ready for next call ++ ldr a3, [sp, #(16+6+2)*4] @ fetch in from stack, to pass to imdct_half ++VFP vmov s16, SCALE @ imdct_half is free to corrupt s0, but it contains one of our arguments in hardfp case ++ bl ff_imdct_half_c ++VFP vmov SCALE, s16 ++ ++ vmrs OLDFPSCR, FPSCR ++ ldr lr, =0x03030000 @ RunFast mode, short vectors of length 4, stride 1 ++ vmsr FPSCR, lr ++ ldr P_SB2_DN, [sp, #16*4] ++ ldr P_WIN_DN, [sp, #(16+6+0)*4] ++ ldr P_OUT_DN, [sp, #(16+6+1)*4] ++NOVFP vldr SCALE, [sp, #(16+6+3)*4] ++ ++#define IMM_OFF_SKEW 956 /* also valid immediate constant when you add 16*4 */ ++ add P_SB, P_SB, #IMM_OFF_SKEW @ so we can use -ve offsets to use full immediate offset range ++ add P_SB2_UP, P_SB2_DN, #16*4 ++ add P_WIN_UP, P_WIN_DN, #16*4+IMM_OFF_SKEW ++ add P_OUT_UP, P_OUT_DN, #16*4 ++ add P_SB2_DN, P_SB2_DN, #16*4 ++ add P_WIN_DN, P_WIN_DN, #12*4+IMM_OFF_SKEW ++ add P_OUT_DN, P_OUT_DN, #16*4 ++ mov I, #4 ++1: ++ vldmia P_SB2_UP!, {VB0-VB3} ++ vldmdb P_SB2_DN!, {VA0-VA3} ++ .set J, 512 - 64 ++ .set OFFSET, -IMM_OFF_SKEW ++ inner_loop ab,, head ++ .rept 7 ++ inner_loop ab, tail, head ++ .endr ++ inner_loop ab, tail ++ add P_WIN_UP, P_WIN_UP, #4*4 ++ sub P_WIN_DN, P_WIN_DN, #4*4 ++ vmul.f VB0, VB0, SCALE @ SCALE treated as scalar ++ add P_SB, P_SB, #(512+4)*4 ++ subs I, I, #1 ++ vmul.f VA0, VA0, SCALE ++ vstmia P_OUT_UP!, {VB0-VB3} ++ vstmdb P_OUT_DN!, {VA0-VA3} ++ bne 1b ++ ++ add P_SB2_DN, P_SB2_DN, #(16+28-12)*4 ++ sub P_SB2_UP, P_SB2_UP, #(16+16)*4 ++ add P_WIN_DN, P_WIN_DN, #(32+16+28-12)*4 ++ mov I, #4 ++1: ++ vldr.d d4, zero @ d4 = VC0 ++ vldr.d d5, zero ++ vldr.d d6, zero @ d6 = VD0 ++ vldr.d d7, zero ++ .set J, 512 - 64 ++ .set OFFSET, -IMM_OFF_SKEW ++ inner_loop cd,, head ++ .rept 7 ++ inner_loop cd, tail, head ++ .endr ++ inner_loop cd, tail ++ add P_WIN_UP, P_WIN_UP, #4*4 ++ sub P_WIN_DN, P_WIN_DN, #4*4 ++ add P_SB, P_SB, #(512+4)*4 ++ subs I, I, #1 ++ vstmia P_SB2_UP!, {VC0-VC3} ++ vstmdb P_SB2_DN!, {VD0-VD3} ++ bne 1b ++ ++ vmsr FPSCR, OLDFPSCR ++ vpop {s16-s31} ++ pop {r3-r7,pc} ++endfunc ++ ++ .align 3 ++zero: .word 0, 0 +-- +1.8.1.6 + + +From 36ddeb1bc2f84c42ea29333444efad04f82a0f92 Mon Sep 17 00:00:00 2001 +From: Ben Avison +Date: Tue, 25 Jun 2013 17:22:50 +0100 +Subject: [PATCH 2/6] 1st version of ff_int32_to_float_fmul_scalar_vfp + +--- + libavcodec/arm/fmtconvert_init_arm.c | 11 +++++-- + libavcodec/arm/fmtconvert_vfp.S | 38 +++++++++++++++++++++++++ + 2 files changed, 47 insertions(+), 2 deletions(-) + +diff --git a/libavcodec/arm/fmtconvert_init_arm.c b/libavcodec/arm/fmtconvert_init_arm.c +index 1d99c97..fc32bdd 100644 +--- a/libavcodec/arm/fmtconvert_init_arm.c ++++ b/libavcodec/arm/fmtconvert_init_arm.c +@@ -31,14 +31,21 @@ void ff_int32_to_float_fmul_scalar_neon(float *dst, const int *src, + void ff_float_to_int16_neon(int16_t *dst, const float *src, long len); + void ff_float_to_int16_interleave_neon(int16_t *, const float **, long, int); + ++void ff_int32_to_float_fmul_scalar_vfp(float *dst, const int *src, ++ float mul, int len); ++ + void ff_float_to_int16_vfp(int16_t *dst, const float *src, long len); + + av_cold void ff_fmt_convert_init_arm(FmtConvertContext *c, AVCodecContext *avctx) + { + int cpu_flags = av_get_cpu_flags(); + +- if (have_vfp(cpu_flags) && have_armv6(cpu_flags)) { +- c->float_to_int16 = ff_float_to_int16_vfp; ++ if (have_vfp(cpu_flags)) { ++ c->int32_to_float_fmul_scalar = ff_int32_to_float_fmul_scalar_vfp; ++ ++ if (have_armv6(cpu_flags)) { ++ c->float_to_int16 = ff_float_to_int16_vfp; ++ } + } + + if (have_neon(cpu_flags)) { +diff --git a/libavcodec/arm/fmtconvert_vfp.S b/libavcodec/arm/fmtconvert_vfp.S +index 7b012bc..817ce49 100644 +--- a/libavcodec/arm/fmtconvert_vfp.S ++++ b/libavcodec/arm/fmtconvert_vfp.S +@@ -1,5 +1,6 @@ + /* + * Copyright (c) 2008 Siarhei Siamashka ++ * Copyright (c) 2013 RISC OS Open Ltd + * + * This file is part of FFmpeg. + * +@@ -76,3 +77,40 @@ function ff_float_to_int16_vfp, export=1 + vpop {d8-d11} + pop {r4-r8,pc} + endfunc ++ ++/** ++ * ARM VFP optimised int32 to float conversion. ++ * Assume len is a multiple of 8, destination buffer is at least 4 bytes aligned ++ * (16 bytes alignment is best for BCM2835), little-endian. ++ */ ++@ void ff_int32_to_float_fmul_scalar_vfp(float *dst, const int *src, float mul, int len) ++function ff_int32_to_float_fmul_scalar_vfp, export=1 ++VFP tmp .req a4 ++VFP len .req a3 ++NOVFP tmp .req a3 ++NOVFP len .req a4 ++NOVFP vmov s0, a3 ++ ldr tmp, =0x03070000 @ RunFast mode, short vectors of length 8, stride 1 ++ vmrs ip, FPSCR ++ vmsr FPSCR, tmp ++1: ++ vldmia a2!, {s8-s15} ++ vcvt.f32.s32 s8, s8 ++ vcvt.f32.s32 s9, s9 ++ vcvt.f32.s32 s10, s10 ++ vcvt.f32.s32 s11, s11 ++ vcvt.f32.s32 s12, s12 ++ vcvt.f32.s32 s13, s13 ++ vcvt.f32.s32 s14, s14 ++ vcvt.f32.s32 s15, s15 ++ vmul.f32 s8, s8, s0 ++ subs len, len, #8 ++ vstmia a1!, {s8-s11} ++ vstmia a1!, {s12-s15} ++ bne 1b ++ ++ vmsr FPSCR, ip ++ bx lr ++endfunc ++ .unreq tmp ++ .unreq len +-- +1.8.1.6 + + +From 1e6f32e2f6330bfbf8ae661069eb3ce1cb1b33d3 Mon Sep 17 00:00:00 2001 +From: Ben Avison +Date: Wed, 26 Jun 2013 00:49:15 +0100 +Subject: [PATCH 3/6] 2nd version of fmul_scalar + +--- + libavcodec/arm/fmtconvert_init_arm.c | 5 + + libavcodec/arm/fmtconvert_vfp.S | 162 ++++++++++++++++++++++++ + libavcodec/dcadec.c | 23 ++-- + libavcodec/fmtconvert.c | 7 + + libavcodec/fmtconvert.h | 14 ++ + 5 files changed, 203 insertions(+), 8 deletions(-) + +diff --git a/libavcodec/arm/fmtconvert_init_arm.c b/libavcodec/arm/fmtconvert_init_arm.c +index fc32bdd..0a71417 100644 +--- a/libavcodec/arm/fmtconvert_init_arm.c ++++ b/libavcodec/arm/fmtconvert_init_arm.c +@@ -33,6 +33,8 @@ void ff_int32_to_float_fmul_scalar_neon(float *dst, const int *src, + + void ff_int32_to_float_fmul_scalar_vfp(float *dst, const int *src, + float mul, int len); ++void ff_int32_to_float_fmul_scalar_array_vfp(FmtConvertContext *c, float *dst, const int *src, ++ float *mul, int len); + + void ff_float_to_int16_vfp(int16_t *dst, const float *src, long len); + +@@ -43,6 +45,9 @@ av_cold void ff_fmt_convert_init_arm(FmtConvertContext *c, AVCodecContext *avctx + if (have_vfp(cpu_flags)) { + c->int32_to_float_fmul_scalar = ff_int32_to_float_fmul_scalar_vfp; + ++ if (!have_neon(cpu_flags)) { ++ c->int32_to_float_fmul_scalar_array = ff_int32_to_float_fmul_scalar_array_vfp; ++ } + if (have_armv6(cpu_flags)) { + c->float_to_int16 = ff_float_to_int16_vfp; + } +diff --git a/libavcodec/arm/fmtconvert_vfp.S b/libavcodec/arm/fmtconvert_vfp.S +index 817ce49..ae7a43c 100644 +--- a/libavcodec/arm/fmtconvert_vfp.S ++++ b/libavcodec/arm/fmtconvert_vfp.S +@@ -83,6 +83,168 @@ endfunc + * Assume len is a multiple of 8, destination buffer is at least 4 bytes aligned + * (16 bytes alignment is best for BCM2835), little-endian. + */ ++@ void ff_int32_to_float_fmul_scalar_array_vfp(if (FmtConvertContext *c, float *dst, const int *src, float *mul, int len) ++function ff_int32_to_float_fmul_scalar_array_vfp, export=1 ++ push {lr} ++ ldr a1, [sp, #4] ++ subs lr, a1, #3*8 ++ bcc 50f @ too short to pipeline ++ @ Now need to find (len / 8) % 3. The approximation ++ @ x / 24 = (x * 0xAB) >> 12 ++ @ is good for x < 4096, which is true for both AC3 and DCA. ++ mov a1, #0xAB ++ ldr ip, =0x03070000 @ RunFast mode, short vectors of length 8, stride 1 ++ mul a1, lr, a1 ++ vpush {s16-s31} ++ mov a1, a1, lsr #12 ++ add a1, a1, a1, lsl #1 ++ rsb a1, a1, lr, lsr #3 ++ cmp a1, #1 ++ vmrs a1, FPSCR ++ vmsr FPSCR, ip ++ beq 11f ++ blo 10f ++ @ Array is (2 + multiple of 3) x 8 floats long ++ @ drop through... ++ vldmia a3!, {s16-s23} ++ vldmia a4!, {s2,s3} ++ vldmia a3!, {s24-s31} ++ vcvt.f32.s32 s16, s16 ++ vcvt.f32.s32 s17, s17 ++ vcvt.f32.s32 s18, s18 ++ vcvt.f32.s32 s19, s19 ++ vcvt.f32.s32 s20, s20 ++ vcvt.f32.s32 s21, s21 ++ vcvt.f32.s32 s22, s22 ++ vcvt.f32.s32 s23, s23 ++ vmul.f32 s16, s16, s2 ++ @ drop through... ++3: ++ vldmia a3!, {s8-s15} ++ vldmia a4!, {s1} ++ vcvt.f32.s32 s24, s24 ++ vcvt.f32.s32 s25, s25 ++ vcvt.f32.s32 s26, s26 ++ vcvt.f32.s32 s27, s27 ++ vcvt.f32.s32 s28, s28 ++ vcvt.f32.s32 s29, s29 ++ vcvt.f32.s32 s30, s30 ++ vcvt.f32.s32 s31, s31 ++ vmul.f32 s24, s24, s3 ++ vstmia a2!, {s16-s19} ++ vstmia a2!, {s20-s23} ++2: ++ vldmia a3!, {s16-s23} ++ vldmia a4!, {s2} ++ vcvt.f32.s32 s8, s8 ++ vcvt.f32.s32 s9, s9 ++ vcvt.f32.s32 s10, s10 ++ vcvt.f32.s32 s11, s11 ++ vcvt.f32.s32 s12, s12 ++ vcvt.f32.s32 s13, s13 ++ vcvt.f32.s32 s14, s14 ++ vcvt.f32.s32 s15, s15 ++ vmul.f32 s8, s8, s1 ++ vstmia a2!, {s24-s27} ++ vstmia a2!, {s28-s31} ++1: ++ vldmia a3!, {s24-s31} ++ vldmia a4!, {s3} ++ vcvt.f32.s32 s16, s16 ++ vcvt.f32.s32 s17, s17 ++ vcvt.f32.s32 s18, s18 ++ vcvt.f32.s32 s19, s19 ++ vcvt.f32.s32 s20, s20 ++ vcvt.f32.s32 s21, s21 ++ vcvt.f32.s32 s22, s22 ++ vcvt.f32.s32 s23, s23 ++ vmul.f32 s16, s16, s2 ++ vstmia a2!, {s8-s11} ++ vstmia a2!, {s12-s15} ++ ++ subs lr, lr, #8*3 ++ bpl 3b ++ ++ vcvt.f32.s32 s24, s24 ++ vcvt.f32.s32 s25, s25 ++ vcvt.f32.s32 s26, s26 ++ vcvt.f32.s32 s27, s27 ++ vcvt.f32.s32 s28, s28 ++ vcvt.f32.s32 s29, s29 ++ vcvt.f32.s32 s30, s30 ++ vcvt.f32.s32 s31, s31 ++ vmul.f32 s24, s24, s3 ++ vstmia a2!, {s16-s19} ++ vstmia a2!, {s20-s23} ++ vstmia a2!, {s24-s27} ++ vstmia a2!, {s28-s31} ++ ++ vmsr FPSCR, a1 ++ vpop {s16-s31} ++ pop {pc} ++ ++10: @ Array is (multiple of 3) x 8 floats long ++ vldmia a3!, {s8-s15} ++ vldmia a4!, {s1,s2} ++ vldmia a3!, {s16-s23} ++ vcvt.f32.s32 s8, s8 ++ vcvt.f32.s32 s9, s9 ++ vcvt.f32.s32 s10, s10 ++ vcvt.f32.s32 s11, s11 ++ vcvt.f32.s32 s12, s12 ++ vcvt.f32.s32 s13, s13 ++ vcvt.f32.s32 s14, s14 ++ vcvt.f32.s32 s15, s15 ++ vmul.f32 s8, s8, s1 ++ b 1b ++ ++11: @ Array is (1 + multiple of 3) x 8 floats long ++ vldmia a3!, {s24-s31} ++ vldmia a4!, {s3} ++ vldmia a3!, {s8-s15} ++ vldmia a4!, {s1} ++ vcvt.f32.s32 s24, s24 ++ vcvt.f32.s32 s25, s25 ++ vcvt.f32.s32 s26, s26 ++ vcvt.f32.s32 s27, s27 ++ vcvt.f32.s32 s28, s28 ++ vcvt.f32.s32 s29, s29 ++ vcvt.f32.s32 s30, s30 ++ vcvt.f32.s32 s31, s31 ++ vmul.f32 s24, s24, s3 ++ b 2b ++ ++50: ++ ldr lr, =0x03070000 @ RunFast mode, short vectors of length 8, stride 1 ++ vmrs ip, FPSCR ++ vmsr FPSCR, lr ++51: ++ vldmia a3!, {s8-s15} ++ vldmia a4!, {s0} ++ vcvt.f32.s32 s8, s8 ++ vcvt.f32.s32 s9, s9 ++ vcvt.f32.s32 s10, s10 ++ vcvt.f32.s32 s11, s11 ++ vcvt.f32.s32 s12, s12 ++ vcvt.f32.s32 s13, s13 ++ vcvt.f32.s32 s14, s14 ++ vcvt.f32.s32 s15, s15 ++ vmul.f32 s8, s8, s0 ++ subs a1, a1, #8 ++ vstmia a2!, {s8-s11} ++ vstmia a2!, {s12-s15} ++ bne 51b ++ ++ vmsr FPSCR, ip ++ pop {pc} ++endfunc ++ ++/** ++ * ARM VFP optimised int32 to float conversion. ++ * Assume len is a multiple of 8, destination buffer is at least 4 bytes aligned ++ * (16 bytes alignment is best for BCM2835), little-endian. ++ * TODO: could be further optimised by unrolling and interleaving, as above ++ */ + @ void ff_int32_to_float_fmul_scalar_vfp(float *dst, const int *src, float mul, int len) + function ff_int32_to_float_fmul_scalar_vfp, export=1 + VFP tmp .req a4 +diff --git a/libavcodec/dcadec.c b/libavcodec/dcadec.c +index 1b955e4..fe568ee 100644 +--- a/libavcodec/dcadec.c ++++ b/libavcodec/dcadec.c +@@ -1302,7 +1302,7 @@ static int dca_subsubframe(DCAContext *s, int base_channel, int block_index) + + /* FIXME */ + float (*subband_samples)[DCA_SUBBANDS][8] = s->subband_samples[block_index]; +- LOCAL_ALIGNED_16(int, block, [8]); ++ LOCAL_ALIGNED_16(int, block, [8 * DCA_SUBBANDS]); + + /* + * Audio data +@@ -1315,6 +1315,8 @@ static int dca_subsubframe(DCAContext *s, int base_channel, int block_index) + quant_step_table = lossy_quant_d; + + for (k = base_channel; k < s->prim_channels; k++) { ++ float rscale[DCA_SUBBANDS]; ++ + if (get_bits_left(&s->gb) < 0) + return AVERROR_INVALIDDATA; + +@@ -1337,11 +1339,12 @@ static int dca_subsubframe(DCAContext *s, int base_channel, int block_index) + * Extract bits from the bit stream + */ + if (!abits) { +- memset(subband_samples[k][l], 0, 8 * sizeof(subband_samples[0][0][0])); ++ rscale[l] = 0; ++ memset(block + 8 * l, 0, 8 * sizeof(block[0])); + } else { + /* Deal with transients */ + int sfi = s->transition_mode[k][l] && subsubframe >= s->transition_mode[k][l]; +- float rscale = quant_step_size * s->scale_factor[k][l][sfi] * ++ rscale[l] = quant_step_size * s->scale_factor[k][l][sfi] * + s->scalefactor_adj[k][sel]; + + if (abits >= 11 || !dca_smpl_bitalloc[abits].vlc[sel].table) { +@@ -1355,7 +1358,7 @@ static int dca_subsubframe(DCAContext *s, int base_channel, int block_index) + block_code1 = get_bits(&s->gb, size); + block_code2 = get_bits(&s->gb, size); + err = decode_blockcodes(block_code1, block_code2, +- levels, block); ++ levels, block + 8 * l); + if (err) { + av_log(s->avctx, AV_LOG_ERROR, + "ERROR: block code look-up failed\n"); +@@ -1364,19 +1367,23 @@ static int dca_subsubframe(DCAContext *s, int base_channel, int block_index) + } else { + /* no coding */ + for (m = 0; m < 8; m++) +- block[m] = get_sbits(&s->gb, abits - 3); ++ block[8 * l + m] = get_sbits(&s->gb, abits - 3); + } + } else { + /* Huffman coded */ + for (m = 0; m < 8; m++) +- block[m] = get_bitalloc(&s->gb, ++ block[8 * l + m] = get_bitalloc(&s->gb, + &dca_smpl_bitalloc[abits], sel); + } + +- s->fmt_conv.int32_to_float_fmul_scalar(subband_samples[k][l], +- block, rscale, 8); + } ++ } + ++ s->fmt_conv.int32_to_float_fmul_scalar_array(&s->fmt_conv, subband_samples[k][0], ++ block, rscale, 8 * s->vq_start_subband[k]); ++ ++ for (l = 0; l < s->vq_start_subband[k]; l++) { ++ int m; + /* + * Inverse ADPCM if in prediction mode + */ +diff --git a/libavcodec/fmtconvert.c b/libavcodec/fmtconvert.c +index 79e9645..0fb2436 100644 +--- a/libavcodec/fmtconvert.c ++++ b/libavcodec/fmtconvert.c +@@ -30,6 +30,12 @@ static void int32_to_float_fmul_scalar_c(float *dst, const int *src, float mul, + dst[i] = src[i] * mul; + } + ++static void int32_to_float_fmul_scalar_array_c(FmtConvertContext *c, float *dst, const int *src, float *mul, int len){ ++ int i; ++ for(i=0; iint32_to_float_fmul_scalar(dst, src, *mul++, 8); ++} ++ + static av_always_inline int float_to_int16_one(const float *src){ + return av_clip_int16(lrintf(*src)); + } +@@ -79,6 +85,7 @@ void ff_float_interleave_c(float *dst, const float **src, unsigned int len, + av_cold void ff_fmt_convert_init(FmtConvertContext *c, AVCodecContext *avctx) + { + c->int32_to_float_fmul_scalar = int32_to_float_fmul_scalar_c; ++ c->int32_to_float_fmul_scalar_array = int32_to_float_fmul_scalar_array_c; + c->float_to_int16 = float_to_int16_c; + c->float_to_int16_interleave = float_to_int16_interleave_c; + c->float_interleave = ff_float_interleave_c; +diff --git a/libavcodec/fmtconvert.h b/libavcodec/fmtconvert.h +index 3fb9f4e..f5768c2 100644 +--- a/libavcodec/fmtconvert.h ++++ b/libavcodec/fmtconvert.h +@@ -38,6 +38,20 @@ + void (*int32_to_float_fmul_scalar)(float *dst, const int *src, float mul, int len); + + /** ++ * Convert an array of int32_t to float and multiply by a float value from another array, ++ * stepping along the float array once for each 8 integers. ++ * @param c pointer to FmtConvertContext. ++ * @param dst destination array of float. ++ * constraints: 16-byte aligned ++ * @param src source array of int32_t. ++ * constraints: 16-byte aligned ++ * @param mul source array of float multipliers. ++ * @param len number of elements to convert. ++ * constraints: multiple of 8 ++ */ ++ void (*int32_to_float_fmul_scalar_array)(struct FmtConvertContext *c, float *dst, const int *src, float *mul, int len); ++ ++ /** + * Convert an array of float to an array of int16_t. + * + * Convert floats from in the range [-32768.0,32767.0] to ints +-- +1.8.1.6 + + +From e8d7a9e5e58b9dd5b57713c0ce860b51e19b62a0 Mon Sep 17 00:00:00 2001 +From: Ben Avison +Date: Thu, 27 Jun 2013 23:11:44 +0100 +Subject: [PATCH 4/6] Add VFP-accelerated version of imdct_half + +--- + libavcodec/arm/Makefile | 1 + + libavcodec/arm/fft_init_arm.c | 6 + + libavcodec/arm/mdct_vfp.S | 193 +++++++++++++++++++++++++++ + libavcodec/arm/synth_filter_vfp.S | 2 +- + 4 files changed, 201 insertions(+), 1 deletion(-) + create mode 100644 libavcodec/arm/mdct_vfp.S + +diff --git a/libavcodec/arm/Makefile b/libavcodec/arm/Makefile +index 9079270..457e9a8 100644 +--- a/libavcodec/arm/Makefile ++++ b/libavcodec/arm/Makefile +@@ -59,6 +59,7 @@ ARMV6-OBJS += arm/dsputil_init_armv6.o \ + arm/simple_idct_armv6.o \ + + VFP-OBJS-$(HAVE_ARMV6) += arm/fmtconvert_vfp.o \ ++ arm/mdct_vfp.o \ + arm/synth_filter_vfp.o + + NEON-OBJS-$(CONFIG_FFT) += arm/fft_neon.o \ +diff --git a/libavcodec/arm/fft_init_arm.c b/libavcodec/arm/fft_init_arm.c +index 44c811d..131c6c4 100644 +--- a/libavcodec/arm/fft_init_arm.c ++++ b/libavcodec/arm/fft_init_arm.c +@@ -26,6 +26,8 @@ + void ff_fft_permute_neon(FFTContext *s, FFTComplex *z); + void ff_fft_calc_neon(FFTContext *s, FFTComplex *z); + ++void ff_imdct_half_vfp(FFTContext *s, FFTSample *output, const FFTSample *input); ++ + void ff_imdct_calc_neon(FFTContext *s, FFTSample *output, const FFTSample *input); + void ff_imdct_half_neon(FFTContext *s, FFTSample *output, const FFTSample *input); + void ff_mdct_calc_neon(FFTContext *s, FFTSample *output, const FFTSample *input); +@@ -48,6 +50,10 @@ av_cold void ff_fft_init_arm(FFTContext *s) + { + int cpu_flags = av_get_cpu_flags(); + ++ if (have_vfp(cpu_flags)) { ++ s->imdct_half = ff_imdct_half_vfp; ++ } ++ + if (have_neon(cpu_flags)) { + #if CONFIG_FFT + s->fft_permute = ff_fft_permute_neon; +diff --git a/libavcodec/arm/mdct_vfp.S b/libavcodec/arm/mdct_vfp.S +new file mode 100644 +index 0000000..7d55e7d +--- /dev/null ++++ b/libavcodec/arm/mdct_vfp.S +@@ -0,0 +1,193 @@ ++/* ++ * Copyright (c) 2013 RISC OS Open Ltd ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg 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 ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ * ++ * Author: Ben Avison ++ */ ++ ++#include "libavutil/arm/asm.S" ++ ++CONTEXT .req a1 ++ORIGOUT .req a2 ++IN .req a3 ++OUT .req v1 ++REVTAB .req v2 ++TCOS .req v3 ++TSIN .req v4 ++OLDFPSCR .req v5 ++J0 .req a2 ++J1 .req a4 ++J2 .req ip ++J3 .req lr ++ ++.macro prerotation_innerloop ++ .set trig_lo, k ++ .set trig_hi, n4 - k - 2 ++ .set in_lo, trig_lo * 2 ++ .set in_hi, trig_hi * 2 ++ vldr d8, [TCOS, #trig_lo*4] @ s16,s17 ++ vldr d9, [TCOS, #trig_hi*4] @ s18,s19 ++ vldr s0, [IN, #in_hi*4 + 12] ++ vldr s1, [IN, #in_hi*4 + 4] ++ vldr s2, [IN, #in_lo*4 + 12] ++ vldr s3, [IN, #in_lo*4 + 4] ++ vmul.f s8, s0, s16 @ vector operation ++ vldr d10, [TSIN, #trig_lo*4] @ s20,s21 ++ vldr d11, [TSIN, #trig_hi*4] @ s22,s23 ++ vldr s4, [IN, #in_lo*4] ++ vldr s5, [IN, #in_lo*4 + 8] ++ vldr s6, [IN, #in_hi*4] ++ vldr s7, [IN, #in_hi*4 + 8] ++ ldr J0, [REVTAB, #trig_lo*2] ++ vmul.f s12, s0, s20 @ vector operation ++ ldr J2, [REVTAB, #trig_hi*2] ++ mov J1, J0, lsr #16 ++ and J0, J0, #255 @ halfword value will be < n4 ++ vmls.f s8, s4, s20 @ vector operation ++ mov J3, J2, lsr #16 ++ and J2, J2, #255 @ halfword value will be < n4 ++ add J0, OUT, J0, lsl #3 ++ vmla.f s12, s4, s16 @ vector operation ++ add J1, OUT, J1, lsl #3 ++ add J2, OUT, J2, lsl #3 ++ add J3, OUT, J3, lsl #3 ++ vstr s8, [J0] ++ vstr s9, [J1] ++ vstr s10, [J2] ++ vstr s11, [J3] ++ vstr s12, [J0, #4] ++ vstr s13, [J1, #4] ++ vstr s14, [J2, #4] ++ vstr s15, [J3, #4] ++ .set k, k + 2 ++.endm ++ ++.macro postrotation_innerloop tail, head ++ .set trig_lo_head, n8 - k - 2 ++ .set trig_hi_head, n8 + k ++ .set out_lo_head, trig_lo_head * 2 ++ .set out_hi_head, trig_hi_head * 2 ++ .set trig_lo_tail, n8 - (k - 2) - 2 ++ .set trig_hi_tail, n8 + (k - 2) ++ .set out_lo_tail, trig_lo_tail * 2 ++ .set out_hi_tail, trig_hi_tail * 2 ++ .if (k & 2) == 0 ++ TCOS_D0_HEAD .req d10 @ s20,s21 ++ TCOS_D1_HEAD .req d11 @ s22,s23 ++ TCOS_S0_TAIL .req s24 ++ .else ++ TCOS_D0_HEAD .req d12 @ s24,s25 ++ TCOS_D1_HEAD .req d13 @ s26,s27 ++ TCOS_S0_TAIL .req s20 ++ .endif ++ .ifnc "\tail","" ++ vmls.f s8, s0, TCOS_S0_TAIL @ vector operation ++ .endif ++ .ifnc "\head","" ++ vldr d8, [TSIN, #trig_lo_head*4] @ s16,s17 ++ vldr d9, [TSIN, #trig_hi_head*4] @ s18,s19 ++ vldr TCOS_D0_HEAD, [TCOS, #trig_lo_head*4] ++ .endif ++ .ifnc "\tail","" ++ vmla.f s12, s4, TCOS_S0_TAIL @ vector operation ++ .endif ++ .ifnc "\head","" ++ vldr s0, [OUT, #out_lo_head*4] ++ vldr s1, [OUT, #out_lo_head*4 + 8] ++ vldr s2, [OUT, #out_hi_head*4] ++ vldr s3, [OUT, #out_hi_head*4 + 8] ++ vldr s4, [OUT, #out_lo_head*4 + 4] ++ vldr s5, [OUT, #out_lo_head*4 + 12] ++ vldr s6, [OUT, #out_hi_head*4 + 4] ++ vldr s7, [OUT, #out_hi_head*4 + 12] ++ .endif ++ .ifnc "\tail","" ++ vstr s8, [OUT, #out_lo_tail*4] ++ vstr s9, [OUT, #out_lo_tail*4 + 8] ++ vstr s10, [OUT, #out_hi_tail*4] ++ vstr s11, [OUT, #out_hi_tail*4 + 8] ++ .endif ++ .ifnc "\head","" ++ vmul.f s8, s4, s16 @ vector operation ++ .endif ++ .ifnc "\tail","" ++ vstr s12, [OUT, #out_hi_tail*4 + 12] ++ vstr s13, [OUT, #out_hi_tail*4 + 4] ++ vstr s14, [OUT, #out_lo_tail*4 + 12] ++ vstr s15, [OUT, #out_lo_tail*4 + 4] ++ .endif ++ .ifnc "\head","" ++ vmul.f s12, s0, s16 @ vector operation ++ vldr TCOS_D1_HEAD, [TCOS, #trig_hi_head*4] ++ .endif ++ .unreq TCOS_D0_HEAD ++ .unreq TCOS_D1_HEAD ++ .unreq TCOS_S0_TAIL ++ .ifnc "\head","" ++ .set k, k + 2 ++ .endif ++.endm ++ ++ ++/* void ff_imdct_half_vfp(FFTContext *s, ++ * FFTSample *output, ++ * const FFTSample *input) ++ */ ++function ff_imdct_half_vfp, export=1 ++ ldr ip, [CONTEXT, #5*4] @ mdct_bits ++ teq ip, #6 ++ bne ff_imdct_half_c @ only case currently accelerated is the one used by DCA ++ ++ .set n, 1<<6 ++ .set n2, n/2 ++ .set n4, n/4 ++ .set n8, n/8 ++ ++ push {v1-v5,lr} ++ vpush {s16-s27} ++ vmrs OLDFPSCR, FPSCR ++ ldr lr, =0x03030000 @ RunFast mode, short vectors of length 4, stride 1 ++ vmsr FPSCR, lr ++ mov OUT, ORIGOUT ++ ldr REVTAB, [CONTEXT, #2*4] ++ ldr TCOS, [CONTEXT, #6*4] ++ ldr TSIN, [CONTEXT, #7*4] ++ ++ .set k, 0 ++ .rept n8/2 ++ prerotation_innerloop ++ .endr ++ ++ vmsr FPSCR, OLDFPSCR ++ mov ORIGOUT, OUT ++ ldr ip, [CONTEXT, #9*4] ++ blx ip @ s->fft_calc(s, output) ++ ldr lr, =0x03030000 @ RunFast mode, short vectors of length 4, stride 1 ++ vmsr FPSCR, lr ++ ++ .set k, 0 ++ postrotation_innerloop , head ++ .rept n8/2 - 1 ++ postrotation_innerloop tail, head ++ .endr ++ postrotation_innerloop tail ++ ++ vmsr FPSCR, OLDFPSCR ++ vpop {s16-s27} ++ pop {v1-v5,pc} ++endfunc +diff --git a/libavcodec/arm/synth_filter_vfp.S b/libavcodec/arm/synth_filter_vfp.S +index 451fe5c..f5845fb 100644 +--- a/libavcodec/arm/synth_filter_vfp.S ++++ b/libavcodec/arm/synth_filter_vfp.S +@@ -133,7 +133,7 @@ function ff_synth_filter_float_vfp, export=1 + str lr, [P_SB_OFF] @ rotate offset, modulo buffer size, ready for next call + ldr a3, [sp, #(16+6+2)*4] @ fetch in from stack, to pass to imdct_half + VFP vmov s16, SCALE @ imdct_half is free to corrupt s0, but it contains one of our arguments in hardfp case +- bl ff_imdct_half_c ++ bl ff_imdct_half_vfp + VFP vmov SCALE, s16 + + vmrs OLDFPSCR, FPSCR +-- +1.8.1.6 + + +From b11427a8aa2ea581a8a8a28bf8e5847e42451f26 Mon Sep 17 00:00:00 2001 +From: Ben Avison +Date: Fri, 28 Jun 2013 21:21:06 +0100 +Subject: [PATCH 5/6] Add VFP_accelerated version of dca_lfe_fir + +--- + libavcodec/arm/Makefile | 3 +- + libavcodec/arm/dcadsp_init_arm.c | 4 + + libavcodec/arm/dcadsp_vfp.S | 189 ++++++++++++++++++++++++++++ + 3 files changed, 195 insertions(+), 1 deletion(-) + create mode 100644 libavcodec/arm/dcadsp_vfp.S + +diff --git a/libavcodec/arm/Makefile b/libavcodec/arm/Makefile +index 457e9a8..8538276 100644 +--- a/libavcodec/arm/Makefile ++++ b/libavcodec/arm/Makefile +@@ -58,7 +58,8 @@ ARMV6-OBJS += arm/dsputil_init_armv6.o \ + arm/dsputil_armv6.o \ + arm/simple_idct_armv6.o \ + +-VFP-OBJS-$(HAVE_ARMV6) += arm/fmtconvert_vfp.o \ ++VFP-OBJS-$(HAVE_ARMV6) += arm/dcadsp_vfp.o \ ++ arm/fmtconvert_vfp.o \ + arm/mdct_vfp.o \ + arm/synth_filter_vfp.o + +diff --git a/libavcodec/arm/dcadsp_init_arm.c b/libavcodec/arm/dcadsp_init_arm.c +index 56568e0..9406b86 100644 +--- a/libavcodec/arm/dcadsp_init_arm.c ++++ b/libavcodec/arm/dcadsp_init_arm.c +@@ -24,6 +24,8 @@ + #include "libavutil/attributes.h" + #include "libavcodec/dcadsp.h" + ++void ff_dca_lfe_fir_vfp(float *out, const float *in, const float *coefs, ++ int decifactor, float scale); + void ff_dca_lfe_fir_neon(float *out, const float *in, const float *coefs, + int decifactor, float scale); + +@@ -31,6 +33,8 @@ av_cold void ff_dcadsp_init_arm(DCADSPContext *s) + { + int cpu_flags = av_get_cpu_flags(); + ++ if (have_vfp(cpu_flags)) ++ s->lfe_fir = ff_dca_lfe_fir_vfp; + if (have_neon(cpu_flags)) + s->lfe_fir = ff_dca_lfe_fir_neon; + } +diff --git a/libavcodec/arm/dcadsp_vfp.S b/libavcodec/arm/dcadsp_vfp.S +new file mode 100644 +index 0000000..a479831 +--- /dev/null ++++ b/libavcodec/arm/dcadsp_vfp.S +@@ -0,0 +1,189 @@ ++/* ++ * Copyright (c) 2013 RISC OS Open Ltd ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg 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 ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ * ++ * Author: Ben Avison ++ */ ++ ++#include "libavutil/arm/asm.S" ++ ++POUT .req a1 ++PIN .req a2 ++PCOEF .req a3 ++DECIFACTOR .req a4 ++OLDFPSCR .req a4 ++COUNTER .req ip ++ ++SCALE32 .req s28 @ use vector of 4 in place of 9th scalar when decifactor=32 / JMAX=8 ++SCALE64 .req s0 @ spare register in scalar bank when decifactor=64 / JMAX=4 ++IN0 .req s4 ++IN1 .req s5 ++IN2 .req s6 ++IN3 .req s7 ++IN4 .req s0 ++IN5 .req s1 ++IN6 .req s2 ++IN7 .req s3 ++COEF0 .req s8 @ coefficient elements ++COEF1 .req s9 ++COEF2 .req s10 ++COEF3 .req s11 ++COEF4 .req s12 ++COEF5 .req s13 ++COEF6 .req s14 ++COEF7 .req s15 ++ACCUM0 .req s16 @ double-buffered multiply-accumulate results ++ACCUM4 .req s20 ++POST0 .req s24 @ do long-latency post-multiply in this vector in parallel ++POST1 .req s25 ++POST2 .req s26 ++POST3 .req s27 ++ ++ ++.macro inner_loop decifactor, dir, tail, head ++ .ifc "\dir","up" ++ .set X, 0 ++ .set Y, 4 ++ .else ++ .set X, 4*JMAX*4 - 4 ++ .set Y, -4 ++ .endif ++ .ifnc "\head","" ++ vldr COEF0, [PCOEF, #X + (0*JMAX + 0) * Y] ++ vldr COEF1, [PCOEF, #X + (1*JMAX + 0) * Y] ++ vldr COEF2, [PCOEF, #X + (2*JMAX + 0) * Y] ++ vldr COEF3, [PCOEF, #X + (3*JMAX + 0) * Y] ++ .endif ++ .ifnc "\tail","" ++ vadd.f POST0, ACCUM0, ACCUM4 @ vector operation ++ .endif ++ .ifnc "\head","" ++ vmul.f ACCUM0, COEF0, IN0 @ vector = vector * scalar ++ vldr COEF4, [PCOEF, #X + (0*JMAX + 1) * Y] ++ vldr COEF5, [PCOEF, #X + (1*JMAX + 1) * Y] ++ vldr COEF6, [PCOEF, #X + (2*JMAX + 1) * Y] ++ .endif ++ .ifnc "\tail","" ++ vmul.f POST0, POST0, SCALE\decifactor @ vector operation (SCALE may be scalar) ++ .endif ++ .ifnc "\head","" ++ vldr COEF7, [PCOEF, #X + (3*JMAX + 1) * Y] ++ .ifc "\tail","" ++ vmul.f ACCUM4, COEF4, IN1 @ vector operation ++ .endif ++ vldr COEF0, [PCOEF, #X + (0*JMAX + 2) * Y] ++ vldr COEF1, [PCOEF, #X + (1*JMAX + 2) * Y] ++ .ifnc "\tail","" ++ vmul.f ACCUM4, COEF4, IN1 @ vector operation ++ .endif ++ vldr COEF2, [PCOEF, #X + (2*JMAX + 2) * Y] ++ vldr COEF3, [PCOEF, #X + (3*JMAX + 2) * Y] ++ .endif ++ .ifnc "\tail","" ++ vstmia POUT!, {POST0-POST3} ++ .endif ++ .ifnc "\head","" ++ vmla.f ACCUM0, COEF0, IN2 @ vector = vector * scalar ++ vldr COEF4, [PCOEF, #X + (0*JMAX + 3) * Y] ++ vldr COEF5, [PCOEF, #X + (1*JMAX + 3) * Y] ++ vldr COEF6, [PCOEF, #X + (2*JMAX + 3) * Y] ++ vldr COEF7, [PCOEF, #X + (3*JMAX + 3) * Y] ++ vmla.f ACCUM4, COEF4, IN3 @ vector = vector * scalar ++ .if \decifactor == 32 ++ vldr COEF0, [PCOEF, #X + (0*JMAX + 4) * Y] ++ vldr COEF1, [PCOEF, #X + (1*JMAX + 4) * Y] ++ vldr COEF2, [PCOEF, #X + (2*JMAX + 4) * Y] ++ vldr COEF3, [PCOEF, #X + (3*JMAX + 4) * Y] ++ vmla.f ACCUM0, COEF0, IN4 @ vector = vector * scalar ++ vldr COEF4, [PCOEF, #X + (0*JMAX + 5) * Y] ++ vldr COEF5, [PCOEF, #X + (1*JMAX + 5) * Y] ++ vldr COEF6, [PCOEF, #X + (2*JMAX + 5) * Y] ++ vldr COEF7, [PCOEF, #X + (3*JMAX + 5) * Y] ++ vmla.f ACCUM4, COEF4, IN5 @ vector = vector * scalar ++ vldr COEF0, [PCOEF, #X + (0*JMAX + 6) * Y] ++ vldr COEF1, [PCOEF, #X + (1*JMAX + 6) * Y] ++ vldr COEF2, [PCOEF, #X + (2*JMAX + 6) * Y] ++ vldr COEF3, [PCOEF, #X + (3*JMAX + 6) * Y] ++ vmla.f ACCUM0, COEF0, IN6 @ vector = vector * scalar ++ vldr COEF4, [PCOEF, #X + (0*JMAX + 7) * Y] ++ vldr COEF5, [PCOEF, #X + (1*JMAX + 7) * Y] ++ vldr COEF6, [PCOEF, #X + (2*JMAX + 7) * Y] ++ vldr COEF7, [PCOEF, #X + (3*JMAX + 7) * Y] ++ vmla.f ACCUM4, COEF4, IN7 @ vector = vector * scalar ++ .endif ++ .endif ++.endm ++ ++.macro dca_lfe_fir decifactor ++ .if \decifactor == 32 ++ .set JMAX, 8 ++ vpush {s16-s31} ++ vmov SCALE32, s0 @ duplicate scalar across vector ++ vldr IN4, [PIN, #-4*4] ++ vldr IN5, [PIN, #-5*4] ++ vldr IN6, [PIN, #-6*4] ++ vldr IN7, [PIN, #-7*4] ++ .else ++ .set JMAX, 4 ++ vpush {s16-s27} ++ .endif ++ ++ mov COUNTER, #\decifactor/4 - 1 ++ inner_loop \decifactor, up,, head ++1: add PCOEF, PCOEF, #4*JMAX*4 ++ subs COUNTER, COUNTER, #1 ++ inner_loop \decifactor, up, tail, head ++ bne 1b ++ inner_loop \decifactor, up, tail ++ ++ mov COUNTER, #\decifactor/4 - 1 ++ inner_loop \decifactor, down,, head ++1: sub PCOEF, PCOEF, #4*JMAX*4 ++ subs COUNTER, COUNTER, #1 ++ inner_loop \decifactor, down, tail, head ++ bne 1b ++ inner_loop \decifactor, down, tail ++ ++ .if \decifactor == 32 ++ vpop {s16-s31} ++ .else ++ vpop {s16-s27} ++ .endif ++ vmsr FPSCR, OLDFPSCR ++ bx lr ++.endm ++ ++ ++/* void ff_dca_lfe_fir_vfp(float *out, const float *in, const float *coefs, ++ * int decifactor, float scale) ++ */ ++function ff_dca_lfe_fir_vfp, export=1 ++ teq DECIFACTOR, #32 ++ vmrs OLDFPSCR, FPSCR ++ ldr ip, =0x03030000 @ RunFast mode, short vectors of length 4, stride 1 ++ vmsr FPSCR, ip ++NOVFP vldr s0, [sp] ++ vldr IN0, [PIN, #-0*4] ++ vldr IN1, [PIN, #-1*4] ++ vldr IN2, [PIN, #-2*4] ++ vldr IN3, [PIN, #-3*4] ++ beq 32f ++64: dca_lfe_fir 64 ++ .ltorg ++32: dca_lfe_fir 32 ++endfunc +-- +1.8.1.6 + + +From 24b72b0117acebae215cb5abb997f68cd0fe1938 Mon Sep 17 00:00:00 2001 +From: Ben Avison +Date: Tue, 9 Jul 2013 17:44:50 +0100 +Subject: [PATCH 6/6] Add VFP-accelerated version of fft16 + +--- + libavcodec/arm/Makefile | 1 + + libavcodec/arm/fft_vfp.S | 299 +++++++++++++++++++++++++++++++++++ + libavcodec/arm/mdct_vfp.S | 5 +- + 3 files changed, 302 insertions(+), 3 deletions(-) + create mode 100644 libavcodec/arm/fft_vfp.S + +diff --git a/libavcodec/arm/Makefile b/libavcodec/arm/Makefile +index 8538276..660d1d4 100644 +--- a/libavcodec/arm/Makefile ++++ b/libavcodec/arm/Makefile +@@ -59,6 +59,7 @@ ARMV6-OBJS += arm/dsputil_init_armv6.o \ + arm/simple_idct_armv6.o \ + + VFP-OBJS-$(HAVE_ARMV6) += arm/dcadsp_vfp.o \ ++ arm/fft_vfp.o \ + arm/fmtconvert_vfp.o \ + arm/mdct_vfp.o \ + arm/synth_filter_vfp.o +diff --git a/libavcodec/arm/fft_vfp.S b/libavcodec/arm/fft_vfp.S +new file mode 100644 +index 0000000..32ea0aa +--- /dev/null ++++ b/libavcodec/arm/fft_vfp.S +@@ -0,0 +1,299 @@ ++/* ++ * Copyright (c) 2013 RISC OS Open Ltd ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg 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 ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ * ++ * Author: Ben Avison ++ */ ++ ++#include "libavutil/arm/asm.S" ++ ++@ TODO: * FFTs wider than 16 ++@ * dispatch code ++ ++function fft4_vfp ++ vldr d0, [a1, #0*2*4] @ s0,s1 = z[0] ++ vldr d4, [a1, #1*2*4] @ s8,s9 = z[1] ++ vldr d1, [a1, #2*2*4] @ s2,s3 = z[2] ++ vldr d5, [a1, #3*2*4] @ s10,s11 = z[3] ++ @ stall ++ vadd.f s12, s0, s8 @ i0 ++ vadd.f s13, s1, s9 @ i1 ++ vadd.f s14, s2, s10 @ i2 ++ vadd.f s15, s3, s11 @ i3 ++ vsub.f s8, s0, s8 @ i4 ++ vsub.f s9, s1, s9 @ i5 ++ vsub.f s10, s2, s10 @ i6 ++ vsub.f s11, s3, s11 @ i7 ++ @ stall ++ @ stall ++ vadd.f s0, s12, s14 @ z[0].re ++ vsub.f s4, s12, s14 @ z[2].re ++ vadd.f s1, s13, s15 @ z[0].im ++ vsub.f s5, s13, s15 @ z[2].im ++ vadd.f s7, s9, s10 @ z[3].im ++ vsub.f s3, s9, s10 @ z[1].im ++ vadd.f s2, s8, s11 @ z[1].re ++ vsub.f s6, s8, s11 @ z[3].re ++ @ stall ++ @ stall ++ vstr d0, [a1, #0*2*4] ++ vstr d2, [a1, #2*2*4] ++ @ stall ++ @ stall ++ vstr d1, [a1, #1*2*4] ++ vstr d3, [a1, #3*2*4] ++ ++ bx lr ++endfunc ++ ++.macro macro_fft8_head ++ @ FFT4 ++ vldr d4, [a1, #0 * 2*4] ++ vldr d6, [a1, #1 * 2*4] ++ vldr d5, [a1, #2 * 2*4] ++ vldr d7, [a1, #3 * 2*4] ++ @ BF ++ vldr d12, [a1, #4 * 2*4] ++ vadd.f s16, s8, s12 @ vector op ++ vldr d14, [a1, #5 * 2*4] ++ vldr d13, [a1, #6 * 2*4] ++ vldr d15, [a1, #7 * 2*4] ++ vsub.f s20, s8, s12 @ vector op ++ vadd.f s0, s16, s18 ++ vsub.f s2, s16, s18 ++ vadd.f s1, s17, s19 ++ vsub.f s3, s17, s19 ++ vadd.f s7, s21, s22 ++ vsub.f s5, s21, s22 ++ vadd.f s4, s20, s23 ++ vsub.f s6, s20, s23 ++ vsub.f s20, s24, s28 @ vector op ++ vstr d0, [a1, #0 * 2*4] @ transfer s0-s7 to s24-s31 via memory ++ vstr d1, [a1, #1 * 2*4] ++ vldr s0, cos1pi4 ++ vadd.f s16, s24, s28 @ vector op ++ vstr d2, [a1, #2 * 2*4] ++ vstr d3, [a1, #3 * 2*4] ++ vldr d12, [a1, #0 * 2*4] ++ @ TRANSFORM ++ vmul.f s20, s20, s0 @ vector x scalar op ++ vldr d13, [a1, #1 * 2*4] ++ vldr d14, [a1, #2 * 2*4] ++ vldr d15, [a1, #3 * 2*4] ++ @ BUTTERFLIES ++ vadd.f s0, s18, s16 ++ vadd.f s1, s17, s19 ++ vsub.f s2, s17, s19 ++ vsub.f s3, s18, s16 ++ vadd.f s4, s21, s20 ++ vsub.f s5, s21, s20 ++ vadd.f s6, s22, s23 ++ vsub.f s7, s22, s23 ++ vadd.f s8, s0, s24 @ vector op ++ vstr d0, [a1, #0 * 2*4] @ transfer s0-s3 to s12-s15 via memory ++ vstr d1, [a1, #1 * 2*4] ++ vldr d6, [a1, #0 * 2*4] ++ vldr d7, [a1, #1 * 2*4] ++ vadd.f s1, s5, s6 ++ vadd.f s0, s7, s4 ++ vsub.f s2, s5, s6 ++ vsub.f s3, s7, s4 ++ vsub.f s12, s24, s12 @ vector op ++ vsub.f s5, s29, s1 ++ vsub.f s4, s28, s0 ++ vsub.f s6, s30, s2 ++ vsub.f s7, s31, s3 ++ vadd.f s16, s0, s28 @ vector op ++ vstr d6, [a1, #4 * 2*4] ++ vstr d7, [a1, #6 * 2*4] ++ vstr d4, [a1, #0 * 2*4] ++ vstr d5, [a1, #2 * 2*4] ++ vstr d2, [a1, #5 * 2*4] ++ vstr d3, [a1, #7 * 2*4] ++.endm ++ ++.macro macro_fft8_tail ++ vstr d8, [a1, #1 * 2*4] ++ vstr d9, [a1, #3 * 2*4] ++.endm ++ ++function fft8_vfp ++ ldr a3, =0x03030000 @ RunFast mode, vector length 4, stride 1 ++ vmrs a2, FPSCR ++ vmsr FPSCR, a3 ++ vpush {s16-s31} ++ ++ macro_fft8_head ++ macro_fft8_tail ++ ++ vpop {s16-s31} ++ vmsr FPSCR, a2 ++ bx lr ++endfunc ++ ++.align 3 ++cos1pi4: @ cos(1*pi/4) = sqrt(2) ++ .float 0.707106769084930419921875 ++cos1pi8: @ cos(1*pi/8) = sqrt(2+sqrt(2))/2 ++ .float 0.92387950420379638671875 ++cos3pi8: @ cos(2*pi/8) = sqrt(2-sqrt(2))/2 ++ .float 0.3826834261417388916015625 ++ ++function ff_fft16_vfp, export=1 ++ ldr a3, =0x03030000 @ RunFast mode, vector length 4, stride 1 ++ vmrs a2, FPSCR ++ vmsr FPSCR, a3 ++ vpush {s16-s31} ++ ++ macro_fft8_head ++ @ FFT4(z+8) ++ vldr d10, [a1, #8 * 2*4] ++ vldr d12, [a1, #9 * 2*4] ++ vldr d11, [a1, #10 * 2*4] ++ vldr d13, [a1, #11 * 2*4] ++ macro_fft8_tail ++ vadd.f s16, s20, s24 @ vector op ++ @ FFT4(z+12) ++ vldr d4, [a1, #12 * 2*4] ++ vldr d6, [a1, #13 * 2*4] ++ vldr d5, [a1, #14 * 2*4] ++ vsub.f s20, s20, s24 @ vector op ++ vldr d7, [a1, #15 * 2*4] ++ vadd.f s0, s16, s18 ++ vsub.f s4, s16, s18 ++ vadd.f s1, s17, s19 ++ vsub.f s5, s17, s19 ++ vadd.f s7, s21, s22 ++ vsub.f s3, s21, s22 ++ vadd.f s2, s20, s23 ++ vsub.f s6, s20, s23 ++ vadd.f s16, s8, s12 @ vector op ++ vstr d0, [a1, #8 * 2*4] ++ vstr d2, [a1, #10 * 2*4] ++ vstr d1, [a1, #9 * 2*4] ++ vsub.f s20, s8, s12 ++ vstr d3, [a1, #11 * 2*4] ++ @ TRANSFORM(z[2],z[6],z[10],z[14],cos1pi4,cos1pi4) ++ vldr d12, [a1, #10 * 2*4] ++ vadd.f s0, s16, s18 ++ vadd.f s1, s17, s19 ++ vsub.f s6, s16, s18 ++ vsub.f s7, s17, s19 ++ vsub.f s3, s21, s22 ++ vadd.f s2, s20, s23 ++ vadd.f s5, s21, s22 ++ vsub.f s4, s20, s23 ++ vstr d0, [a1, #12 * 2*4] ++ vmov s0, s6 ++ @ TRANSFORM(z[1],z[5],z[9],z[13],cos1pi8,cos3pi8) ++ vldr d6, [a1, #9 * 2*4] ++ vstr d1, [a1, #13 * 2*4] ++ vldr d1, cos1pi4 @ s2 = cos1pi4, s3 = cos1pi8 ++ vstr d2, [a1, #15 * 2*4] ++ vldr d7, [a1, #13 * 2*4] ++ vadd.f s4, s25, s24 ++ vsub.f s5, s25, s24 ++ vsub.f s6, s0, s7 ++ vadd.f s7, s0, s7 ++ vmul.f s20, s12, s3 @ vector op ++ @ TRANSFORM(z[3],z[7],z[11],z[15],cos3pi8,cos1pi8) ++ vldr d4, [a1, #11 * 2*4] ++ vldr d5, [a1, #15 * 2*4] ++ vldr s1, cos3pi8 ++ vmul.f s24, s4, s2 @ vector * scalar op ++ vmul.f s28, s12, s1 @ vector * scalar op ++ vmul.f s12, s8, s1 @ vector * scalar op ++ vadd.f s4, s20, s29 ++ vsub.f s5, s21, s28 ++ vsub.f s6, s22, s31 ++ vadd.f s7, s23, s30 ++ vmul.f s8, s8, s3 @ vector * scalar op ++ vldr d8, [a1, #1 * 2*4] ++ vldr d9, [a1, #5 * 2*4] ++ vldr d10, [a1, #3 * 2*4] ++ vldr d11, [a1, #7 * 2*4] ++ vldr d14, [a1, #2 * 2*4] ++ vadd.f s0, s6, s4 ++ vadd.f s1, s5, s7 ++ vsub.f s2, s5, s7 ++ vsub.f s3, s6, s4 ++ vadd.f s4, s12, s9 ++ vsub.f s5, s13, s8 ++ vsub.f s6, s14, s11 ++ vadd.f s7, s15, s10 ++ vadd.f s12, s0, s16 @ vector op ++ vstr d0, [a1, #1 * 2*4] ++ vstr d1, [a1, #5 * 2*4] ++ vldr d4, [a1, #1 * 2*4] ++ vldr d5, [a1, #5 * 2*4] ++ vadd.f s0, s6, s4 ++ vadd.f s1, s5, s7 ++ vsub.f s2, s5, s7 ++ vsub.f s3, s6, s4 ++ vsub.f s8, s16, s8 @ vector op ++ vstr d6, [a1, #1 * 2*4] ++ vstr d7, [a1, #5 * 2*4] ++ vldr d15, [a1, #6 * 2*4] ++ vsub.f s4, s20, s0 ++ vsub.f s5, s21, s1 ++ vsub.f s6, s22, s2 ++ vsub.f s7, s23, s3 ++ vadd.f s20, s0, s20 @ vector op ++ vstr d4, [a1, #9 * 2*4] ++ @ TRANSFORM_ZERO(z[0],z[4],z[8],z[12]) ++ vldr d6, [a1, #8 * 2*4] ++ vstr d5, [a1, #13 * 2*4] ++ vldr d7, [a1, #12 * 2*4] ++ vstr d2, [a1, #11 * 2*4] ++ vldr d8, [a1, #0 * 2*4] ++ vstr d3, [a1, #15 * 2*4] ++ vldr d9, [a1, #4 * 2*4] ++ vadd.f s0, s26, s24 ++ vadd.f s1, s25, s27 ++ vsub.f s2, s25, s27 ++ vsub.f s3, s26, s24 ++ vadd.f s4, s14, s12 ++ vadd.f s5, s13, s15 ++ vsub.f s6, s13, s15 ++ vsub.f s7, s14, s12 ++ vadd.f s8, s0, s28 @ vector op ++ vstr d0, [a1, #3 * 2*4] ++ vstr d1, [a1, #7 * 2*4] ++ vldr d6, [a1, #3 * 2*4] ++ vldr d7, [a1, #7 * 2*4] ++ vsub.f s0, s16, s4 ++ vsub.f s1, s17, s5 ++ vsub.f s2, s18, s6 ++ vsub.f s3, s19, s7 ++ vsub.f s12, s28, s12 @ vector op ++ vadd.f s16, s4, s16 @ vector op ++ vstr d10, [a1, #3 * 2*4] ++ vstr d11, [a1, #7 * 2*4] ++ vstr d4, [a1, #2 * 2*4] ++ vstr d5, [a1, #6 * 2*4] ++ vstr d0, [a1, #8 * 2*4] ++ vstr d1, [a1, #12 * 2*4] ++ vstr d6, [a1, #10 * 2*4] ++ vstr d7, [a1, #14 * 2*4] ++ vstr d8, [a1, #0 * 2*4] ++ vstr d9, [a1, #4 * 2*4] ++ ++ vpop {s16-s31} ++ vmsr FPSCR, a2 ++ bx lr ++endfunc +diff --git a/libavcodec/arm/mdct_vfp.S b/libavcodec/arm/mdct_vfp.S +index 7d55e7d..5374dd5 100644 +--- a/libavcodec/arm/mdct_vfp.S ++++ b/libavcodec/arm/mdct_vfp.S +@@ -174,9 +174,8 @@ function ff_imdct_half_vfp, export=1 + .endr + + vmsr FPSCR, OLDFPSCR +- mov ORIGOUT, OUT +- ldr ip, [CONTEXT, #9*4] +- blx ip @ s->fft_calc(s, output) ++ mov a1, OUT ++ bl ff_fft16_vfp + ldr lr, =0x03030000 @ RunFast mode, short vectors of length 4, stride 1 + vmsr FPSCR, lr + +-- +1.8.1.6 + diff --git a/packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0030-vaapi-fix-argument-for-ff_vaapi_common_end_frame-cal.patch b/packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0030-vaapi-fix-argument-for-ff_vaapi_common_end_frame-cal.patch deleted file mode 100644 index 7246dbe306..0000000000 --- a/packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0030-vaapi-fix-argument-for-ff_vaapi_common_end_frame-cal.patch +++ /dev/null @@ -1,25 +0,0 @@ -From b066d90211072c7532e17c0c54d8475f10fc97ad Mon Sep 17 00:00:00 2001 -From: Janne Grunau -Date: Thu, 14 Mar 2013 15:12:30 +0100 -Subject: [PATCH] vaapi: fix argument for ff_vaapi_common_end_frame call - ---- - libavcodec/vaapi.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/libavcodec/vaapi.c b/libavcodec/vaapi.c -index 9c07c8d..0532daf 100644 ---- a/libavcodec/vaapi.c -+++ b/libavcodec/vaapi.c -@@ -212,7 +212,7 @@ int ff_vaapi_mpeg_end_frame(AVCodecContext *avctx) - ff_mpeg_draw_horiz_band(s, 0, s->avctx->height); - - finish: -- ff_vaapi_common_end_frame(avctx->priv_data); -+ ff_vaapi_common_end_frame(avctx); - return ret; - } - --- -1.8.1.5 - diff --git a/packages/network/avahi/config/avahi-daemon.conf b/packages/network/avahi/config/avahi-daemon.conf deleted file mode 100644 index cf1385644f..0000000000 --- a/packages/network/avahi/config/avahi-daemon.conf +++ /dev/null @@ -1,28 +0,0 @@ -[server] -#host-name=foo -#domain-name=local -use-ipv4=yes -use-ipv6=no -check-response-ttl=no -use-iff-running=no - -[publish] -publish-addresses=yes -publish-hinfo=yes -publish-workstation=no -publish-domain=yes -#publish-dns-servers=192.168.1.1 -#publish-resolv-conf-dns-servers=yes - -[reflector] -enable-reflector=no -reflect-ipv=no - -[rlimits] -#rlimit-as= -rlimit-core=0 -rlimit-data=4194304 -rlimit-fsize=0 -rlimit-nofile=30 -rlimit-stack=4194304 -rlimit-nproc=1 diff --git a/packages/network/avahi/config/avahi-daemon.init b/packages/network/avahi/config/avahi-daemon.init deleted file mode 100644 index 9a6acd02b6..0000000000 --- a/packages/network/avahi/config/avahi-daemon.init +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh /etc/rc.common -# Copyright (C) 2006 OpenWrt.org -START=50 - -BIN=avahi-daemon -DEFAULT=/etc/default/$BIN -OPTIONS="-D" -RUN_D=/var/run/$BIN - -start() { - [ -f $DEFAULT ] && . $DEFAULT - mkdir -p $RUN_D - $BIN $OPTIONS -} - -stop() { - $BIN -k -} - -reload() { - $BIN -r -} - diff --git a/packages/network/avahi/config/http.service b/packages/network/avahi/config/http.service deleted file mode 100644 index 6763a05cf8..0000000000 --- a/packages/network/avahi/config/http.service +++ /dev/null @@ -1,10 +0,0 @@ - - - - %h - - _http._tcp - 80 - path=/index.html - - diff --git a/packages/audio/alsa-utils/install b/packages/network/avahi/init.d/53_avahi old mode 100755 new mode 100644 similarity index 58% rename from packages/audio/alsa-utils/install rename to packages/network/avahi/init.d/53_avahi index 9374234270..1831782af0 --- a/packages/audio/alsa-utils/install +++ b/packages/network/avahi/init.d/53_avahi @@ -1,8 +1,6 @@ -#!/bin/sh - ################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2009-2010 OpenELEC.tv +# http://www.openelec.tv # # 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 @@ -20,19 +18,32 @@ # http://www.gnu.org/copyleft/gpl.html ################################################################################ -. config/options $1 +# start Avahi Daemon +# +# runlevels: openelec, textmode -mkdir -p $INSTALL/usr/bin - cp $PKG_BUILD/amixer/amixer $INSTALL/usr/bin - cp $PKG_BUILD/aplay/aplay $INSTALL/usr/bin - cp $PKG_BUILD/speaker-test/speaker-test $INSTALL/usr/bin +( + # can be called from openelec addon. + # ensure that environment is sane + . /etc/profile -mkdir -p $INSTALL/lib/udev - cp $PKG_DIR/scripts/soundconfig $INSTALL/lib/udev + # wait for network + wait_for_inet_addr force -mkdir -p $INSTALL/usr/sbin - cp $PKG_BUILD/alsactl/alsactl $INSTALL/usr/sbin + progress "Starting Avahi Daemon" -mkdir -p $INSTALL/usr/share/alsa/init - cp $PKG_BUILD/alsactl/init/* $INSTALL/usr/share/alsa/init - rm -rf $INSTALL/usr/share/alsa/init/Makefile* + mkdir -p /var/run/avahi-daemon + while true; do + AVAHI_ENABLED=true + if [ -f $CONFIG_CACHE/service_avahi.conf ]; then + . $CONFIG_CACHE/service_avahi.conf + fi + if [ "$AVAHI_ENABLED" == "true" ]; then + wait_for_dbus + avahi-daemon --syslog > /dev/null 2>&1 + else + break + fi + usleep 2000000 + done +)& diff --git a/packages/network/avahi/install b/packages/network/avahi/install index 9c5e607ee0..ec2ca0432b 100755 --- a/packages/network/avahi/install +++ b/packages/network/avahi/install @@ -31,16 +31,15 @@ add_user avahiautoipd x 496 496 "avahi-autoipd" "/var/lib/avahi-autoipd" "/bin/s add_group avahiautoipd 496 mkdir -p $INSTALL/etc/avahi - cp $PKG_BUILD/avahi-autoipd/avahi-autoipd.action $INSTALL/etc/avahi cp $PKG_BUILD/avahi-daemon/avahi-daemon.conf $INSTALL/etc/avahi # for some reason avai can fail to start see: http://forums.gentoo.org/viewtopic-p-7322172.html#7322172 sed -e "s,^.*disallow-other-stacks=.*$,disallow-other-stacks=yes,g" -i $INSTALL/etc/avahi/avahi-daemon.conf - cp $PKG_BUILD/avahi-dnsconfd/avahi-dnsconfd.action $INSTALL/etc/avahi + # disable wide-area + sed -e "s,^.*enable-wide-area=.*$,enable-wide-area=no,g" -i $INSTALL/etc/avahi/avahi-daemon.conf cp $PKG_BUILD/avahi-daemon/hosts $INSTALL/etc/avahi mkdir -p $INSTALL/etc/avahi/services - cp $PKG_BUILD/avahi-daemon/ssh.service $INSTALL/etc/avahi/services - cp $PKG_DIR/config/http.service $INSTALL/etc/avahi/services +# cp $PKG_BUILD/avahi-daemon/ssh.service $INSTALL/etc/avahi/services if [ $SAMBA_SERVER = "yes" ]; then if [ -f $PROJECT_DIR/$PROJECT/avahi/samba.service ]; then diff --git a/packages/audio/faad2/build b/packages/network/bluez/init.d/54_bluez old mode 100755 new mode 100644 similarity index 67% rename from packages/audio/faad2/build rename to packages/network/bluez/init.d/54_bluez index 8ad50d73d8..b3887cb6b9 --- a/packages/audio/faad2/build +++ b/packages/network/bluez/init.d/54_bluez @@ -1,5 +1,3 @@ -#!/bin/sh - ################################################################################ # This file is part of OpenELEC - http://www.openelec.tv # Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) @@ -20,22 +18,28 @@ # http://www.gnu.org/copyleft/gpl.html ################################################################################ -. config/options $1 +# +# start bluetooth daemon +# +# runlevels: openelec, textmode -# faad2 fails building with LTO support - strip_lto +( + # can be called from openelec addon. + # ensure that environment is sane + . /etc/profile -cd $PKG_BUILD -./configure --host=$TARGET_NAME \ - --build=$HOST_NAME \ - --prefix=/usr \ - --disable-static \ - --enable-shared \ - --without-xmms \ - --without-drm \ - --without-mpeg4ip \ - --with-gnu-ld + if [ "$DEBUG" = "yes" ]; then + BLUEZ_DEBUG="-d" + fi -make + BLUEZ_ENABLED=true + if [ -f $CONFIG_CACHE/service_bluez.conf ]; then + . $CONFIG_CACHE/service_bluez.conf + fi -$MAKEINSTALL + if [ "$BLUEZ_ENABLED" == "true" ]; then + progress "Starting bluetooth daemon" + wait_for_dbus + /usr/lib/bluetooth/bluetoothd $BLUEZ_DEBUG &>/dev/null + fi +)& diff --git a/packages/network/connman/init.d/21_network b/packages/network/connman/init.d/21_network index 71ce6d9709..47f5b99844 100644 --- a/packages/network/connman/init.d/21_network +++ b/packages/network/connman/init.d/21_network @@ -28,6 +28,7 @@ fi # starting loopback device progress "starting loopback device" + ifconfig lo 127.0.0.1 netmask 255.0.0.0 ifconfig lo up # creating initial settings file diff --git a/packages/network/connman/meta b/packages/network/connman/meta index 6e722aa2ed..143f46db64 100644 --- a/packages/network/connman/meta +++ b/packages/network/connman/meta @@ -19,7 +19,7 @@ ################################################################################ PKG_NAME="connman" -PKG_VERSION="8b952da" +PKG_VERSION="d052eb3" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" diff --git a/packages/network/connman/patches/connman-03-init-nat-after-tethering.patch b/packages/network/connman/patches/connman-03-init-nat-after-tethering.patch index a769f2499b..bf1f373c9c 100644 --- a/packages/network/connman/patches/connman-03-init-nat-after-tethering.patch +++ b/packages/network/connman/patches/connman-03-init-nat-after-tethering.patch @@ -1,26 +1,26 @@ -commit f5f3c66721ca595976def1a43195d6a64525e6ed +commit 2fa277df78416d75ab540ab64168e356d05ba5cc Author: Stefan Saraev -Date: Tue Jul 9 19:06:36 2013 +0300 +Date: Tue Jul 23 11:31:22 2013 +0300 do not touch nat table before enabling tethering TODO: remove when upstream does a better fix diff --git a/src/connman.h b/src/connman.h -index 6846b92..6cd24e2 100644 +index bc7a50d..e280bd7 100644 --- a/src/connman.h +++ b/src/connman.h -@@ -912,6 +912,8 @@ int __connman_nat_enable(const char *name, const char *address, +@@ -913,6 +913,8 @@ int __connman_nat_enable(const char *name, const char *address, unsigned char prefixlen); void __connman_nat_disable(const char *name); -+static connman_bool_t nat_enabled = FALSE; ++static bool nat_enabled = false; + struct firewall_context; struct firewall_context *__connman_firewall_create(void); diff --git a/src/firewall.c b/src/firewall.c -index c235d86..1e7dfa9 100644 +index bf05294..8ab34d9 100644 --- a/src/firewall.c +++ b/src/firewall.c @@ -421,7 +421,8 @@ static void flush_all_tables(void) @@ -34,14 +34,14 @@ index c235d86..1e7dfa9 100644 int __connman_firewall_init(void) diff --git a/src/nat.c b/src/nat.c -index 9308059..b198cf5 100644 +index 8d307eb..11c9def 100644 --- a/src/nat.c +++ b/src/nat.c @@ -81,6 +81,8 @@ static int enable_nat(struct connman_nat *nat) if (err < 0) return err; -+ nat_enabled = TRUE; ++ nat_enabled = true; + return __connman_firewall_enable(nat->fw); } diff --git a/packages/network/connman/patches/connman-04-ipv6-disabled-by-default.patch b/packages/network/connman/patches/connman-04-ipv6-disabled-by-default.patch index db9fafadb4..9199ec54e6 100644 --- a/packages/network/connman/patches/connman-04-ipv6-disabled-by-default.patch +++ b/packages/network/connman/patches/connman-04-ipv6-disabled-by-default.patch @@ -1,18 +1,18 @@ -commit 7b130774c0a0a31879218eedb680ed732a1ee94a +commit 707a0d73d7231b1821072712a7771c7aef140e21 Author: Stefan Saraev -Date: Thu Jul 4 22:43:17 2013 +0300 +Date: Tue Jul 23 11:28:10 2013 +0300 ipv6 disabled by default diff --git a/src/ipconfig.c b/src/ipconfig.c -index a97a6f3..2b43935 100644 +index fbeff8f..3eb61c4 100644 --- a/src/ipconfig.c +++ b/src/ipconfig.c -@@ -1118,10 +1118,7 @@ static struct connman_ipconfig *create_ipv6config(int index) - ipv6config->enabled = FALSE; +@@ -1123,10 +1123,7 @@ static struct connman_ipconfig *create_ipv6config(int index) + ipv6config->enabled = false; ipv6config->type = CONNMAN_IPCONFIG_TYPE_IPV6; -- if (is_ipv6_supported == FALSE) +- if (!is_ipv6_supported) - ipv6config->method = CONNMAN_IPCONFIG_METHOD_OFF; - else - ipv6config->method = CONNMAN_IPCONFIG_METHOD_AUTO; diff --git a/packages/network/connman/profile.d/21-connman.conf b/packages/network/connman/profile.d/21-connman.conf index 262ea9bb50..78ec568298 100644 --- a/packages/network/connman/profile.d/21-connman.conf +++ b/packages/network/connman/profile.d/21-connman.conf @@ -21,16 +21,16 @@ wait_for_inet_addr () { if [ -f $CONFIG_CACHE/openelec/network_wait ]; then . $CONFIG_CACHE/openelec/network_wait + fi - if [ "$WAIT_NETWORK" = "true" ] ; then - progress "Wait for network" - [ -z "$WAIT_NETWORK_TIME" ] && WAIT_NETWORK_TIME=10 - LOOP_COUNT=$((WAIT_NETWORK_TIME * 5)) - for i in $(seq 1 $LOOP_COUNT) ; do - cnt=$(ifconfig | sed -e '/inet addr:/!d' -e '/127.0.0.1/d' |wc -l) - [ $cnt -gt 0 ] && break - usleep 200000 - done - fi + if [ "$WAIT_NETWORK" = "true" -o "$1" == "force" ] ; then + progress "Wait for network" + [ -z "$WAIT_NETWORK_TIME" ] && WAIT_NETWORK_TIME=10 + LOOP_COUNT=$((WAIT_NETWORK_TIME * 5)) + for i in $(seq 1 $LOOP_COUNT) ; do + cnt=$(ifconfig | sed -e '/inet addr:/!d' -e '/127.0.0.1/d' |wc -l) + [ $cnt -gt 0 ] && break + usleep 200000 + done fi } diff --git a/packages/network/openssh/config/sshd_config b/packages/network/openssh/config/sshd_config index c6c33776f9..ad8166031e 100644 --- a/packages/network/openssh/config/sshd_config +++ b/packages/network/openssh/config/sshd_config @@ -106,9 +106,6 @@ SyslogFacility AUTHPRIV #PermitTunnel no #ChrootDirectory none -# no default banner path -Banner /etc/issue - # override default of no subsystems Subsystem sftp /usr/libexec/sftp-server diff --git a/packages/network/openssh/init.d/51_sshd b/packages/network/openssh/init.d/51_sshd index 9903a6fbd1..a5dc2f9ce7 100644 --- a/packages/network/openssh/init.d/51_sshd +++ b/packages/network/openssh/init.d/51_sshd @@ -22,10 +22,13 @@ # # runlevels: openelec, textmode - if [ -f /etc/sshd.conf ]; then - . /etc/sshd.conf - elif [ -f /storage/.config/sshd.conf ]; then - . /storage/.config/sshd.conf + # can be called from openelec addon. + # ensure that environment is sane + . /etc/profile + + SSHD_START=false + if [ -f $CONFIG_CACHE/service_ssh.conf ]; then + . $CONFIG_CACHE/service_ssh.conf fi # Check if password authentication is disabled @@ -66,13 +69,8 @@ chmod 600 $DSA2_KEY fi - # Check for predefined known hosts file - if [ -f /etc/ssh/known_hosts -a ! -f $HOME/.ssh/known_hosts ] ; then - progress "SSH: setup predefined known hosts" - cp /etc/ssh/known_hosts $HOME/.ssh - fi - progress "Starting SSH Server" + rm /var/run/sshd.pid &>/dev/null eval $SSHD $OPTIONS fi )& diff --git a/packages/network/samba/init.d/52_samba b/packages/network/samba/init.d/52_samba new file mode 100644 index 0000000000..47c8a06edb --- /dev/null +++ b/packages/network/samba/init.d/52_samba @@ -0,0 +1,93 @@ +################################################################################ +# Copyright (C) 2009-2010 OpenELEC.tv +# http://www.openelec.tv +# +# 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 OpenELEC.tv; see the file COPYING. If not, write to +# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ + +# start Samba Server +# +# runlevels: openelec, textmode + +( + # can be called from openelec addon. + # ensure that environment is sane + . /etc/profile + + SAMBA_ENABLED=true + if [ -f $CONFIG_CACHE/service_samba.conf ]; then + . $CONFIG_CACHE/service_samba.conf + fi + + if [ "$SAMBA_ENABLED" = "true" ]; then + + # wait for network + wait_for_inet_addr force + + progress "Starting Samba server" + + SMB_USERCONF="/storage/.config/samba.conf" + SMB_DEFCONF="/etc/samba/smb.conf" + SMB_CONF="/var/run/smb.conf" + + mkdir -p /var/run + if [ -f $SMB_USERCONF ]; then + cp $SMB_USERCONF $SMB_CONF + else + cp $SMB_DEFCONF $SMB_CONF + fi + + # only letters & numbers permitted for username & password + SAMBA_USERNAME=`echo $SAMBA_USERNAME | sed "s/[^a-zA-Z0-9]//g;"` + SAMBA_PASSWORD=`echo $SAMBA_PASSWORD | sed "s/[^a-zA-Z0-9]//g;"` + + if [ "$SAMBA_SECURE" == "true" -a ! "$SAMBA_USERNAME" == "" -a ! "$SAMBA_PASSWORD" == "" ] ; then + # username map: first line makes sure plain root does not work all the time + # processing continues, so if user chooses root as username, second line overrides the first + # this is done always in case user uses passwords in userconf. + # many thanks to viljoviitanen for this + echo -e "$SAMBA_PASSWORD\n$SAMBA_PASSWORD" | smbpasswd -s -a root >/dev/null 2>&1 + echo -e "nobody = root\nroot = $SAMBA_USERNAME" > /var/run/samba.map + + # set public = no + sed -e 's|^.[ \t]*.public.=.*| public = no |' $SMB_CONF > $SMB_CONF.tmp && \ + mv $SMB_CONF.tmp $SMB_CONF + # remove username map (if any in userconfig) + sed -e 's|^.[ \t]*.username map.=.*||' $SMB_CONF > $SMB_CONF.tmp && \ + mv $SMB_CONF.tmp $SMB_CONF + # set security = share, add username map + sed -e 's|^.[ \t]*.security.=.*| security = user\n username map = /var/run/samba.map|' $SMB_CONF > $SMB_CONF.tmp && \ + mv $SMB_CONF.tmp $SMB_CONF + else + # set public = yes + sed -e 's|^.[ \t]*.public.=.*| public = yes |' $SMB_CONF > $SMB_CONF.tmp && \ + mv $SMB_CONF.tmp $SMB_CONF + # remove username map (if any in userconfig) + sed -e 's|^.[ \t]*.username map.=.*||' $SMB_CONF > $SMB_CONF.tmp && \ + mv $SMB_CONF.tmp $SMB_CONF + # set security = share + sed -e 's|^.[ \t]*.security.=.*| security = share|' $SMB_CONF > $SMB_CONF.tmp && \ + mv $SMB_CONF.tmp $SMB_CONF + fi + + SMB_ARG="--configfile=$SMB_CONF" + mkdir -p /var/log/samba + rm /var/run/smbd-smb.conf.pid &>/dev/null + rm /var/run/nmbd-smb.conf.pid &>/dev/null + nmbd --daemon $SMB_ARG > /dev/null 2>&1 + smbd --daemon $SMB_ARG > /dev/null 2>&1 + fi +)& diff --git a/packages/network/wpa_supplicant/build b/packages/network/wpa_supplicant/build index d9d1c12e4b..3111eda243 100755 --- a/packages/network/wpa_supplicant/build +++ b/packages/network/wpa_supplicant/build @@ -29,7 +29,7 @@ LDFLAGS="$LDFLAGS -lpthread" cd $PKG_BUILD/$1 -cp $ROOT/$PKG_DIR/config/makefile.config .config +cp $PKG_DIR/config/makefile.config .config # echo "CONFIG_TLS=gnutls" >> .config # echo "CONFIG_GNUTLS_EXTRA=y" >> .config diff --git a/packages/other/fribidi/build b/packages/other/fribidi/build index 23ac8e611d..8a13f0b3a9 100755 --- a/packages/other/fribidi/build +++ b/packages/other/fribidi/build @@ -42,4 +42,4 @@ cd $PKG_BUILD make $MAKEINSTALL -cp -f $ROOT/$PKG_DIR/scripts/$1-config $ROOT/$TOOLCHAIN/bin/$1-config +cp -f $PKG_DIR/scripts/$1-config $ROOT/$TOOLCHAIN/bin/$1-config diff --git a/packages/print/freetype/build b/packages/print/freetype/build deleted file mode 100755 index a25c6a2b64..0000000000 --- a/packages/print/freetype/build +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -# unset LIBTOOL because freetype uses its own -unset LIBTOOL - -cd $PKG_BUILD - -sh autogen.sh -./configure --host=$TARGET_NAME \ - --build=$HOST_NAME \ - --prefix=/usr \ - --sysconfdir=/etc \ - --localstatedir=/var \ - --disable-static \ - --enable-shared \ - --with-zlib - -make - -$MAKEINSTALL - -$SED "s:\(['= ]\)/usr:\\1$SYSROOT_PREFIX/usr:g" \ - $SYSROOT_PREFIX/usr/bin/$1-config - -mv $SYSROOT_PREFIX/usr/bin/$1-config $ROOT/$TOOLCHAIN/bin - -ln -v -sf $SYSROOT_PREFIX/usr/include/freetype2/freetype $SYSROOT_PREFIX/usr/include diff --git a/packages/print/freetype/install b/packages/print/freetype/install deleted file mode 100755 index 32aedd9259..0000000000 --- a/packages/print/freetype/install +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -mkdir -p $INSTALL/usr/lib - cp -P $PKG_BUILD/objs/.libs/libfreetype.so* $INSTALL/usr/lib diff --git a/packages/print/freetype/meta b/packages/print/freetype/package.mk similarity index 74% rename from packages/print/freetype/meta rename to packages/print/freetype/package.mk index 35df10f1db..2d78de58fd 100644 --- a/packages/print/freetype/meta +++ b/packages/print/freetype/package.mk @@ -26,11 +26,30 @@ PKG_LICENSE="GPL" PKG_SITE="http://www.freetype.org" PKG_URL="http://download.savannah.gnu.org/releases/freetype/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS="zlib" -PKG_BUILD_DEPENDS="toolchain zlib libpng" +PKG_BUILD_DEPENDS_TARGET="toolchain zlib libpng" PKG_PRIORITY="optional" PKG_SECTION="print" PKG_SHORTDESC="freetype: TrueType font rendering library" PKG_LONGDESC="The FreeType engine is a free and portable TrueType font rendering engine. It has been developed to provide TT support to a great variety of platforms and environments." -PKG_IS_ADDON="no" +PKG_IS_ADDON="no" PKG_AUTORECONF="no" + +# package specific configure options +PKG_CONFIGURE_OPTS_TARGET="--with-zlib" + +pre_configure_target() { + # unset LIBTOOL because freetype uses its own + ( cd .. + unset LIBTOOL + sh autogen.sh + ) +} + +post_makeinstall_target() { + $SED "s:\(['= ]\)/usr:\\1$SYSROOT_PREFIX/usr:g" $SYSROOT_PREFIX/usr/bin/freetype-config + mv $SYSROOT_PREFIX/usr/bin/freetype-config $ROOT/$TOOLCHAIN/bin + ln -v -sf $SYSROOT_PREFIX/usr/include/freetype2/freetype $SYSROOT_PREFIX/usr/include + + rm -rf $INSTALL/usr/bin +} diff --git a/packages/python/devel/distutilscross/meta b/packages/python/devel/distutilscross/meta index 143790f4f4..92b8799140 100644 --- a/packages/python/devel/distutilscross/meta +++ b/packages/python/devel/distutilscross/meta @@ -26,7 +26,7 @@ PKG_LICENSE="GPL" PKG_SITE="http://bitbucket.org/lambacck/distutilscross/" PKG_URL="http://pypi.python.org/packages/source/d/distutilscross/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS="" -PKG_BUILD_DEPENDS="toolchain Python distribute" +PKG_BUILD_DEPENDS="toolchain Python setuptools" PKG_PRIORITY="optional" PKG_SECTION="python/devel" PKG_SHORTDESC="distutilscross: Cross Compile Python Extensions" diff --git a/packages/python/devel/distribute/build b/packages/python/devel/setuptools/build similarity index 100% rename from packages/python/devel/distribute/build rename to packages/python/devel/setuptools/build diff --git a/packages/python/devel/distribute/meta b/packages/python/devel/setuptools/meta similarity index 89% rename from packages/python/devel/distribute/meta rename to packages/python/devel/setuptools/meta index 217c0bfda6..f2c5e03260 100644 --- a/packages/python/devel/distribute/meta +++ b/packages/python/devel/setuptools/meta @@ -18,18 +18,18 @@ # http://www.gnu.org/copyleft/gpl.html ################################################################################ -PKG_NAME="distribute" -PKG_VERSION="0.6.34" +PKG_NAME="setuptools" +PKG_VERSION="0.9.6" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="OSS" -PKG_SITE="http://pypi.python.org/pypi/distribute" -PKG_URL="http://pypi.python.org/packages/source/d/$PKG_NAME/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_SITE="https://pypi.python.org/pypi/setuptools" +PKG_URL="http://pypi.python.org/packages/source/s/$PKG_NAME/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS="Python" PKG_BUILD_DEPENDS="toolchain Python" PKG_PRIORITY="optional" PKG_SECTION="python/devel" -PKG_SHORTDESC="distribute: A collection of enhancements to the Python distutils" +PKG_SHORTDESC="setuptools: A collection of enhancements to the Python distutils" PKG_LONGDESC="Distribute is intended to replace Setuptools as the standard method for working with Python module distributions. Packages built and distributed using distribute look to the user like ordinary Python packages based on the distutils. Your users don't need to install or even know about setuptools in order to use them, and you don't have to include the entire setuptools package in your distributions. By including just a single bootstrap module (a 7K .py file), your package will automatically download and install setuptools if the user is building your package from source and doesn't have a suitable version already installed." PKG_IS_ADDON="no" diff --git a/packages/sysutils/busybox-hosttools/build b/packages/sysutils/busybox-hosttools/build index 255ac4b6c6..d005eabfba 100755 --- a/packages/sysutils/busybox-hosttools/build +++ b/packages/sysutils/busybox-hosttools/build @@ -28,7 +28,7 @@ setup_toolchain host cd $BUILD/busybox* make distclean - cp $ROOT/$PKG_DIR/config/$1.conf .config + cp $PKG_DIR/config/$1.conf .config make oldconfig ARCH=$TARGET_ARCH make CROSS_COMPILE="" KBUILD_VERBOSE="1" install diff --git a/packages/sysutils/busybox/build b/packages/sysutils/busybox/build index fe45f90c3c..f4c7d1787e 100755 --- a/packages/sysutils/busybox/build +++ b/packages/sysutils/busybox/build @@ -25,7 +25,7 @@ if [ -f $PROJECT_DIR/$PROJECT/busybox/$1.conf ]; then BUSYBOX_CFG_FILE=$PROJECT_DIR/$PROJECT/busybox/$1.conf else - BUSYBOX_CFG_FILE=$ROOT/$PKG_DIR/config/$1.conf + BUSYBOX_CFG_FILE=$PKG_DIR/config/$1.conf fi # optimize for size @@ -44,6 +44,13 @@ cd $BUILD/busybox* sed -i -e "s|^CONFIG_FEATURE_CROND_D=.*$|# CONFIG_FEATURE_CROND_D is not set|" .config sed -i -e "s|^CONFIG_CRONTAB=.*$|# CONFIG_CRONTAB is not set|" .config fi + if [ ! "$NFS_SUPPORT" = yes ]; then + sed -i -e "s|^CONFIG_FEATURE_MOUNT_NFS=.*$|# CONFIG_FEATURE_MOUNT_NFS is not set|" .config + fi + if [ ! "$SAMBA_SUPPORT" = yes ]; then + sed -i -e "s|^CONFIG_FEATURE_MOUNT_CIFS=.*$|# CONFIG_FEATURE_MOUNT_CIFS is not set|" .config + fi + make oldconfig make ARCH=$TARGET_ARCH \ diff --git a/packages/sysutils/busybox/config/busybox.conf b/packages/sysutils/busybox/config/busybox.conf index 2a03a2794c..e52b291fdf 100644 --- a/packages/sysutils/busybox/config/busybox.conf +++ b/packages/sysutils/busybox/config/busybox.conf @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit -# Busybox version: 1.21.0 -# Mon Jun 3 15:48:13 2013 +# Busybox version: 1.21.1 +# Fri Jul 19 02:51:06 2013 # CONFIG_HAVE_DOT_CONFIG=y @@ -389,13 +389,13 @@ CONFIG_FEATURE_ALLOW_EXEC=y # CONFIG_FIND=y # CONFIG_FEATURE_FIND_PRINT0 is not set -# CONFIG_FEATURE_FIND_MTIME is not set -# CONFIG_FEATURE_FIND_MMIN is not set +CONFIG_FEATURE_FIND_MTIME=y +CONFIG_FEATURE_FIND_MMIN=y # CONFIG_FEATURE_FIND_PERM is not set CONFIG_FEATURE_FIND_TYPE=y # CONFIG_FEATURE_FIND_XDEV is not set # CONFIG_FEATURE_FIND_MAXDEPTH is not set -# CONFIG_FEATURE_FIND_NEWER is not set +CONFIG_FEATURE_FIND_NEWER=y # CONFIG_FEATURE_FIND_INUM is not set CONFIG_FEATURE_FIND_EXEC=y # CONFIG_FEATURE_FIND_USER is not set @@ -403,11 +403,11 @@ CONFIG_FEATURE_FIND_EXEC=y CONFIG_FEATURE_FIND_NOT=y # CONFIG_FEATURE_FIND_DEPTH is not set # CONFIG_FEATURE_FIND_PAREN is not set -# CONFIG_FEATURE_FIND_SIZE is not set -# CONFIG_FEATURE_FIND_PRUNE is not set +CONFIG_FEATURE_FIND_SIZE=y +CONFIG_FEATURE_FIND_PRUNE=y # CONFIG_FEATURE_FIND_DELETE is not set CONFIG_FEATURE_FIND_PATH=y -# CONFIG_FEATURE_FIND_REGEX is not set +CONFIG_FEATURE_FIND_REGEX=y # CONFIG_FEATURE_FIND_CONTEXT is not set CONFIG_FEATURE_FIND_LINKS=y CONFIG_GREP=y diff --git a/packages/sysutils/busybox/init.d/23_syslogd b/packages/sysutils/busybox/init.d/05_syslogd similarity index 92% rename from packages/sysutils/busybox/init.d/23_syslogd rename to packages/sysutils/busybox/init.d/05_syslogd index 4b26b023ef..d7f7989dcb 100644 --- a/packages/sysutils/busybox/init.d/23_syslogd +++ b/packages/sysutils/busybox/init.d/05_syslogd @@ -24,7 +24,9 @@ # runlevels: openelec, textmode ( - progress "Starting Syslog daemon" + # can be called from openelec addon. + # ensure that environment is sane + . /etc/profile if [ -e $CONFIG_CACHE/syslog/remote ] ; then source $CONFIG_CACHE/syslog/remote @@ -40,8 +42,12 @@ SYSLOGD_OPTIONS="$SYSLOGD_OPTIONS -f /storage/.config/syslog.conf" fi + rm /var/run/syslogd.pid &>/dev/null + syslogd $SYSLOGD_OPTIONS + progress "Starting Syslog daemon" + if [ "$SYSLOG_REMOTE" == "true" -a "$SYSLOG_SERVER" ]; then sleep 3 fi diff --git a/packages/sysutils/busybox/install b/packages/sysutils/busybox/install index 85f22b8a2b..edc5407618 100755 --- a/packages/sysutils/busybox/install +++ b/packages/sysutils/busybox/install @@ -39,6 +39,7 @@ USER_PWD="`$ROOT/$TOOLCHAIN/bin/cryptpw -m sha512 $USER_PASSWORD`" cp $PKG_DIR/scripts/createlog $INSTALL/usr/bin/ cp $PKG_DIR/scripts/lsb_release $INSTALL/usr/bin/ cp $PKG_DIR/scripts/apt-get $INSTALL/usr/bin/ + cp $PKG_DIR/scripts/passwd $INSTALL/usr/bin/ ln -sf /bin/busybox $INSTALL/usr/bin/env #/usr/bin/env is needed for most python scripts cp $PKG_DIR/scripts/pastebinit $INSTALL/usr/bin/ ln -sf pastebinit $INSTALL/usr/bin/paste @@ -77,3 +78,9 @@ USER_PWD="`$ROOT/$TOOLCHAIN/bin/cryptpw -m sha512 $USER_PASSWORD`" mkdir -p $INSTALL/usr/www/error echo "404" > $INSTALL/usr/www/error/404.html + + # cron support + if [ "$CRON_SUPPORT" = "yes" ] ; then + mkdir -p $INSTALL/etc/init.d + cp $PKG_DIR/scripts/09_crond $INSTALL/etc/init.d/ + fi diff --git a/packages/sysutils/busybox/meta b/packages/sysutils/busybox/meta index e9bb1698da..7ad27bf8e3 100644 --- a/packages/sysutils/busybox/meta +++ b/packages/sysutils/busybox/meta @@ -25,7 +25,7 @@ PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.busybox.net" PKG_URL="http://busybox.net/downloads/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS="kexec-tools hdparm dosfstools e2fsprogs speedcontrol zip pciutils usbutils less procps-ng rpcbind" +PKG_DEPENDS="kexec-tools hdparm dosfstools e2fsprogs speedcontrol zip pciutils usbutils less procps-ng" PKG_BUILD_DEPENDS="toolchain busybox-hosttools" PKG_PRIORITY="required" PKG_SECTION="system" @@ -39,3 +39,8 @@ PKG_AUTORECONF="no" if [ "$NANO_EDITOR" = "yes" ]; then PKG_DEPENDS="$PKG_DEPENDS nano" fi + +# nfs support +if [ "$NFS_SUPPORT" = yes ]; then + PKG_DEPENDS="$PKG_DEPENDS rpcbind" +fi diff --git a/packages/sysutils/busybox/patches/busybox-02_silence-crond-startup-logging.patch b/packages/sysutils/busybox/patches/busybox-02_silence-crond-startup-logging.patch new file mode 100644 index 0000000000..456ec1c487 --- /dev/null +++ b/packages/sysutils/busybox/patches/busybox-02_silence-crond-startup-logging.patch @@ -0,0 +1,24 @@ +From 5f4085ddb16c206b1dc36d481c2aa6684ba392ee Mon Sep 17 00:00:00 2001 +From: Stefan Saraev +Date: Thu, 18 Jul 2013 19:26:21 +0300 +Subject: [PATCH] silence crond startup logging + +--- + miscutils/crond.c | 1 - + 1 files changed, 0 insertions(+), 1 deletions(-) + +diff --git a/miscutils/crond.c b/miscutils/crond.c +index 582dc99..71514e3 100644 +--- a/miscutils/crond.c ++++ b/miscutils/crond.c +@@ -883,7 +883,6 @@ int crond_main(int argc UNUSED_PARAM, char **argv) + xchdir(G.crontab_dir_name); + //signal(SIGHUP, SIG_IGN); /* ? original crond dies on HUP... */ + xsetenv("SHELL", DEFAULT_SHELL); /* once, for all future children */ +- crondlog(LVL8 "crond (busybox "BB_VER") started, log level %d", G.log_level); + rescan_crontab_dir(); + write_pidfile(CONFIG_PID_FILE_PATH "/crond.pid"); + +-- +1.7.2.5 + diff --git a/packages/audio/libmodplug/build b/packages/sysutils/busybox/scripts/09_crond old mode 100755 new mode 100644 similarity index 72% rename from packages/audio/libmodplug/build rename to packages/sysutils/busybox/scripts/09_crond index eb9245b180..cd003d6210 --- a/packages/audio/libmodplug/build +++ b/packages/sysutils/busybox/scripts/09_crond @@ -1,5 +1,3 @@ -#!/bin/sh - ################################################################################ # This file is part of OpenELEC - http://www.openelec.tv # Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) @@ -20,15 +18,24 @@ # http://www.gnu.org/copyleft/gpl.html ################################################################################ -. config/options $1 +# +# start cron daemon +# +# runlevels: openelec, textmode -cd $PKG_BUILD -./configure --host=$TARGET_NAME \ - --build=$HOST_NAME \ - --prefix=/usr \ - --disable-static \ - --enable-shared \ +( + # can be called from openelec addon. + # ensure that environment is sane + . /etc/profile -make + CRON_ENABLED=true + if [ -f $CONFIG_CACHE/service_cron.conf ]; then + . $CONFIG_CACHE/service_cron.conf + fi -$MAKEINSTALL + if [ "$CRON_ENABLED" == "true" ]; then + progress "Starting cron daemon" + mkdir -p $CONFIG_CACHE/cron/crontabs + crond -b + fi +)& diff --git a/packages/audio/alsa-plugins/install b/packages/sysutils/busybox/scripts/passwd similarity index 58% rename from packages/audio/alsa-plugins/install rename to packages/sysutils/busybox/scripts/passwd index d3d0e2db5c..067f1fb280 100755 --- a/packages/audio/alsa-plugins/install +++ b/packages/sysutils/busybox/scripts/passwd @@ -20,14 +20,17 @@ # http://www.gnu.org/copyleft/gpl.html ################################################################################ -. config/options $1 +message="$message\n There is no working 'passwd'." +message="$message\n" +message="$message\n The 'passwd' command changes passwords for user accounts." +message="$message\n" +message="$message\n With OpenELEC it is not possible to change the system password" +message="$message\n" +message="$message\n SSH is included only as a last support resort. SSH is off by default." +message="$message\n Most users never need SSH and need help using it so we need a default" +message="$message\n password. If you need to keep SSH always on then this is unsupported" +message="$message\n but can be secured with certificates." +message="$message\n" +message="$message\n TIP: disable password authentication in ssh and use public key authentication." -mkdir -p $INSTALL/usr/lib/alsa - cp -P $PKG_BUILD/*/.libs/*.so $INSTALL/usr/lib/alsa - if [ -f $INSTALL/usr/lib/alsa/libasound_module_rate_speexrate.so ]; then - ln -sf libasound_module_rate_speexrate.so $INSTALL/usr/lib/alsa/libasound_module_rate_speexrate_best.so - ln -sf libasound_module_rate_speexrate.so $INSTALL/usr/lib/alsa/libasound_module_rate_speexrate_medium.so - fi - -mkdir -p $INSTALL/usr/share/alsa/pcm - cp -R $PKG_DIR/config/*.conf $INSTALL/usr/share/alsa/pcm +echo -e $message diff --git a/packages/sysutils/dbus-host/meta b/packages/sysutils/dbus-host/meta index f5e2351b6e..c2a814d55a 100644 --- a/packages/sysutils/dbus-host/meta +++ b/packages/sysutils/dbus-host/meta @@ -26,7 +26,7 @@ PKG_LICENSE="GPL" PKG_SITE="http://dbus.freedesktop.org" PKG_URL="" PKG_DEPENDS="" -PKG_BUILD_DEPENDS="toolchain expat-host" +PKG_BUILD_DEPENDS="toolchain expat:host" PKG_PRIORITY="optional" PKG_SECTION="system" PKG_SHORTDESC="dbus: simple interprocess messaging system" diff --git a/packages/sysutils/lcdproc/config/LCDd.conf b/packages/sysutils/lcdproc/config/LCDd.conf index 0c28b230de..bf5d7f1ca3 100644 --- a/packages/sysutils/lcdproc/config/LCDd.conf +++ b/packages/sysutils/lcdproc/config/LCDd.conf @@ -1138,6 +1138,11 @@ Device=/dev/lcd Speed=19200 +## vlsys_m428 for VFD/IR combination in Moneual MonCaso 320 ## +[vlsys_m428] + +# Select the output device to use [default: /dev/ttyUSB0] +#Device=/dev/ttyUSB0 ## OnScreen Display using libxosd ## [xosd] diff --git a/packages/textproc/expat-host/build b/packages/textproc/expat-host/build deleted file mode 100755 index 6a3a2409ee..0000000000 --- a/packages/textproc/expat-host/build +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -$SCRIPTS/unpack expat - -setup_toolchain host - -cd $BUILD/expat-* -do_autoreconf -I conftools - -mkdir -p .build-host && cd .build-host -../configure --host=$HOST_NAME \ - --build=$HOST_NAME \ - --prefix=$ROOT/$TOOLCHAIN \ - --enable-shared \ - --disable-static \ - -make -make install diff --git a/packages/textproc/expat-host/meta b/packages/textproc/expat-host/meta deleted file mode 100644 index 171fe85ac0..0000000000 --- a/packages/textproc/expat-host/meta +++ /dev/null @@ -1,36 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -PKG_NAME="expat-host" -PKG_VERSION="" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="OSS" -PKG_SITE="http://expat.sourceforge.net/" -PKG_URL="" -PKG_DEPENDS="" -PKG_BUILD_DEPENDS="ccache autotools" -PKG_PRIORITY="optional" -PKG_SECTION="textproc" -PKG_SHORTDESC="expat: XML parser library" -PKG_LONGDESC="Expat is an XML parser library written in C. It is a stream-oriented parser in which an application registers handlers for things the parser might find in the XML document (like start tags). An introductory article on using Expat is available on xml.com." -PKG_IS_ADDON="no" - -PKG_AUTORECONF="no" diff --git a/packages/textproc/expat/build b/packages/textproc/expat/build deleted file mode 100755 index 90008d376b..0000000000 --- a/packages/textproc/expat/build +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -cd $PKG_BUILD - -do_autoreconf -I conftools - -mkdir -p .build-target && cd .build-target -../configure --host=$TARGET_NAME \ - --build=$HOST_NAME \ - --prefix=/usr \ - --sysconfdir=/etc \ - --localstatedir=/var \ - --disable-static \ - --enable-shared \ - -make - -$MAKEINSTALL diff --git a/packages/textproc/expat/install b/packages/textproc/expat/install deleted file mode 100755 index ef204fef08..0000000000 --- a/packages/textproc/expat/install +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -mkdir -p $INSTALL/usr/lib - cp -P $PKG_BUILD/.build-target/.libs/libexpat.so* $INSTALL/usr/lib diff --git a/packages/textproc/expat/meta b/packages/textproc/expat/package.mk similarity index 86% rename from packages/textproc/expat/meta rename to packages/textproc/expat/package.mk index de94590b78..dbe33904c9 100644 --- a/packages/textproc/expat/meta +++ b/packages/textproc/expat/package.mk @@ -26,11 +26,25 @@ PKG_LICENSE="OSS" PKG_SITE="http://expat.sourceforge.net/" PKG_URL="$SOURCEFORGE_SRC/$PKG_NAME/$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS="" -PKG_BUILD_DEPENDS="toolchain" +PKG_BUILD_DEPENDS_HOST="ccache autotools" +PKG_BUILD_DEPENDS_TARGET="toolchain" PKG_PRIORITY="optional" PKG_SECTION="textproc" PKG_SHORTDESC="expat: XML parser library" PKG_LONGDESC="Expat is an XML parser library written in C. It is a stream-oriented parser in which an application registers handlers for things the parser might find in the XML document (like start tags). An introductory article on using Expat is available on xml.com." -PKG_IS_ADDON="no" +PKG_IS_ADDON="no" PKG_AUTORECONF="no" + +pre_configure_target() { + ( cd ..; do_autoreconf -I conftools) +} + +pre_configure_host() { + ( cd ..; do_autoreconf -I conftools) +} + +post_makeinstall_target() { + rm -rf $INSTALL/usr/bin +} + diff --git a/packages/textproc/libxml2-host/meta b/packages/textproc/libxml2-host/meta index 088c71522e..48d1764c2f 100644 --- a/packages/textproc/libxml2-host/meta +++ b/packages/textproc/libxml2-host/meta @@ -26,7 +26,7 @@ PKG_LICENSE="MIT" PKG_SITE="http://xmlsoft.org" PKG_URL="" PKG_DEPENDS="" -PKG_BUILD_DEPENDS="toolchain zlib-host Python-host" +PKG_BUILD_DEPENDS="toolchain zlib:host Python-host" PKG_PRIORITY="optional" PKG_SECTION="textproc" PKG_SHORTDESC="libxml: XML parser library for Gnome" diff --git a/packages/toolchain/archivers/lzo-host/build b/packages/toolchain/archivers/lzo-host/build deleted file mode 100755 index d1082d25ec..0000000000 --- a/packages/toolchain/archivers/lzo-host/build +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -$SCRIPTS/unpack lzo - -LZO_DIR=`ls -d $BUILD/lzo-[0-9]*` - -setup_toolchain host - -cd $LZO_DIR - -mkdir -p .build-host && cd .build-host -../configure --host=$HOST_NAME \ - --build=$HOST_NAME \ - --prefix=$ROOT/$TOOLCHAIN \ - --sysconfdir=$ROOT/$TOOLCHAIN/etc \ - --datadir=/usr/share \ - --enable-shared \ - --disable-static \ - -make -make install diff --git a/packages/toolchain/archivers/lzo-host/meta b/packages/toolchain/archivers/lzo-host/meta deleted file mode 100644 index 68c17713de..0000000000 --- a/packages/toolchain/archivers/lzo-host/meta +++ /dev/null @@ -1,36 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -PKG_NAME="lzo-host" -PKG_VERSION="" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="GPL" -PKG_SITE="http://www.oberhumer.com/opensource/lzo" -PKG_URL="" -PKG_DEPENDS="" -PKG_BUILD_DEPENDS="toolchain" -PKG_PRIORITY="optional" -PKG_SECTION="compress" -PKG_SHORTDESC="LZO data compressor" -PKG_LONGDESC="LZO is a data compression library which is suitable for data de-/compression in real-time. This means it favours speed over compression ratio." -PKG_IS_ADDON="no" - -PKG_AUTORECONF="no" diff --git a/packages/toolchain/devel/autotools/automake/build b/packages/toolchain/devel/autotools/automake/build index 1e3276cbde..836d3e6431 100755 --- a/packages/toolchain/devel/autotools/automake/build +++ b/packages/toolchain/devel/autotools/automake/build @@ -34,4 +34,4 @@ cd $PKG_BUILD make make install make prefix=$SYSROOT_PREFIX/usr install -cp -P $ROOT/$PKG_DIR/files/*.m4 $SYSROOT_PREFIX/usr/share/aclocal +cp -P $PKG_DIR/files/*.m4 $SYSROOT_PREFIX/usr/share/aclocal diff --git a/packages/toolchain/lang/Python-host/build b/packages/toolchain/lang/Python-host/build index a008832850..bcd368d169 100755 --- a/packages/toolchain/lang/Python-host/build +++ b/packages/toolchain/lang/Python-host/build @@ -59,6 +59,6 @@ cp Parser/pgen $ROOT/$TOOLCHAIN/bin rm -rf $ROOT/$TOOLCHAIN/bin/python*-config sed -e "s:%PREFIX%:$SYSROOT_PREFIX/usr:g" -e "s:%CFLAGS%:$TARGET_CFLAGS:g" \ - $ROOT/$PKG_DIR/scripts/python-config > $ROOT/$TOOLCHAIN/bin/python2.7-config + $PKG_DIR/scripts/python-config > $ROOT/$TOOLCHAIN/bin/python2.7-config chmod +x $ROOT/$TOOLCHAIN/bin/python2.7-config ln -s python2.7-config $ROOT/$TOOLCHAIN/bin/python-config diff --git a/packages/toolchain/lang/Python-host/meta b/packages/toolchain/lang/Python-host/meta index a6bc76c431..20e34a361c 100644 --- a/packages/toolchain/lang/Python-host/meta +++ b/packages/toolchain/lang/Python-host/meta @@ -25,8 +25,8 @@ PKG_ARCH="any" PKG_LICENSE="OSS" PKG_SITE="http://www.python.org/" PKG_URL="" -PKG_DEPENDS="zlib-host expat-host" -PKG_BUILD_DEPENDS="ccache zlib-host expat-host" +PKG_DEPENDS="" +PKG_BUILD_DEPENDS="ccache zlib:host expat:host" PKG_PRIORITY="optional" PKG_SECTION="lang" PKG_SHORTDESC="python: The Python programming language" diff --git a/packages/toolchain/lang/llvm-host/build b/packages/toolchain/lang/llvm-host/build deleted file mode 100755 index ff7e4d43dc..0000000000 --- a/packages/toolchain/lang/llvm-host/build +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -$SCRIPTS/unpack llvm - -setup_toolchain host - -if [ "$TARGET_ARCH" = i386 ]; then - ARCH=x86 -elif [ "$TARGET_ARCH" = x86_64 ]; then - ARCH=x86_64 -fi - -LLVM_DIR=`ls -d $BUILD/llvm-[0-9]*` - -cd $LLVM_DIR - -cd autoconf - aclocal --force --verbose -I m4 - autoconf --force --verbose -I m4 -o ../configure -cd .. - -mkdir -p .build-host && cd .build-host -../configure --host=$HOST_NAME \ - --build=$HOST_NAME \ - --prefix=$ROOT/$TOOLCHAIN \ - --enable-polly \ - --enable-optimized \ - --disable-profiling \ - --disable-assertions \ - --disable-expensive-checks \ - --disable-debug-runtime \ - --disable-debug-symbols \ - --enable-jit \ - --disable-docs \ - --disable-doxygen \ - --enable-threads \ - --enable-pthreads \ - --enable-pic \ - --enable-shared \ - --enable-embed-stdcxx \ - --enable-timestamps \ - --enable-targets=$ARCH \ - --disable-libffi \ - --enable-ltdl-install \ - -make -make install diff --git a/packages/toolchain/lang/llvm-host/meta b/packages/toolchain/lang/llvm-host/meta deleted file mode 100644 index 77eaaabe23..0000000000 --- a/packages/toolchain/lang/llvm-host/meta +++ /dev/null @@ -1,36 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -PKG_NAME="llvm" -PKG_VERSION="" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="GPL" -PKG_SITE="http://llvm.org/" -PKG_URL="" -PKG_DEPENDS="" -PKG_BUILD_DEPENDS="ccache gcc-final libffi-host" -PKG_PRIORITY="optional" -PKG_SECTION="toolchain/lang" -PKG_SHORTDESC="llvm: Low Level Virtual Machine" -PKG_LONGDESC="Low-Level Virtual Machine (LLVM) is a compiler infrastructure designed for compile-time, link-time, run-time, and "idle-time" optimization of programs from arbitrary programming languages. It currently supports compilation of C, Objective-C, and C++ programs, using front-ends derived from GCC 4.0, GCC 4.2, and a custom new front-end, "clang". It supports x86, x86-64, ia64, PowerPC, and SPARC, with support for Alpha and ARM under development." -PKG_IS_ADDON="no" - -PKG_AUTORECONF="no" diff --git a/packages/toolchain/math/ppl/build b/packages/toolchain/math/ppl/build index 35b1159527..19474c1eb7 100755 --- a/packages/toolchain/math/ppl/build +++ b/packages/toolchain/math/ppl/build @@ -35,7 +35,7 @@ mkdir -p objdir && cd objdir --enable-shared \ --disable-static \ --enable-interfaces="c,cxx" \ - --with-gmp-prefix="$ROOT/$TOOLCHAIN" \ + --with-gmp="$ROOT/$TOOLCHAIN" \ make -j1 make install diff --git a/packages/toolchain/sysutils/squashfs/meta b/packages/toolchain/sysutils/squashfs/meta index 17734809af..e87b555f1c 100644 --- a/packages/toolchain/sysutils/squashfs/meta +++ b/packages/toolchain/sysutils/squashfs/meta @@ -27,7 +27,7 @@ PKG_SITE="http://squashfs.sourceforge.net/" PKG_URL="$SOURCEFORGE_SRC/squashfs/squashfs/${PKG_NAME}${PKG_VERSION}/${PKG_NAME}${PKG_VERSION}.tar.gz" #PKG_URL="$DISTRO_SRC/${PKG_NAME}-${PKG_VERSION}.tar.gz" PKG_DEPENDS="" -PKG_BUILD_DEPENDS="ccache zlib-host lzo-host xz" +PKG_BUILD_DEPENDS="ccache zlib:host lzo:host xz" PKG_PRIORITY="optional" PKG_SECTION="toolchain/sysutils" PKG_SHORTDESC="squashfs-tools: A compressed read-only filesystem for Linux" diff --git a/packages/tools/bcm2835-bootloader/install b/packages/tools/bcm2835-bootloader/install deleted file mode 100755 index 7e95187b99..0000000000 --- a/packages/tools/bcm2835-bootloader/install +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -mkdir -p $INSTALL/usr/share/bootloader - cp $PKG_BUILD/LICENCE* $INSTALL/usr/share/bootloader - cp $PKG_BUILD/bootcode.bin $INSTALL/usr/share/bootloader - cp $PKG_BUILD/fixup_x.dat $INSTALL/usr/share/bootloader/fixup.dat - cp $PKG_BUILD/start_x.elf $INSTALL/usr/share/bootloader/start.elf - - cp $PKG_DIR/scripts/update.sh $INSTALL/usr/share/bootloader - cp $PKG_DIR/files/3rdparty/bootloader/config.txt $INSTALL/usr/share/bootloader diff --git a/packages/tools/bcm2835-bootloader/meta b/packages/tools/bcm2835-bootloader/package.mk similarity index 72% rename from packages/tools/bcm2835-bootloader/meta rename to packages/tools/bcm2835-bootloader/package.mk index ccc9a04b44..f9eb762fd0 100644 --- a/packages/tools/bcm2835-bootloader/meta +++ b/packages/tools/bcm2835-bootloader/package.mk @@ -19,18 +19,33 @@ ################################################################################ PKG_NAME="bcm2835-bootloader" -PKG_VERSION="0d1b1d8" +PKG_VERSION="82ca326" PKG_REV="1" PKG_ARCH="arm" PKG_LICENSE="nonfree" PKG_SITE="http://www.broadcom.com" PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" PKG_DEPENDS="" -PKG_BUILD_DEPENDS="toolchain linux Python" +PKG_BUILD_DEPENDS_TARGET="toolchain linux" PKG_PRIORITY="optional" PKG_SECTION="tools" PKG_SHORTDESC="bcm2835-bootloader: Tool to create a bootable kernel for RaspberryPi" PKG_LONGDESC="bcm2835-bootloader: Tool to create a bootable kernel for RaspberryPi" -PKG_IS_ADDON="no" +PKG_IS_ADDON="no" PKG_AUTORECONF="no" + +make_target() { + : # nothing to make +} + +makeinstall_target() { + mkdir -p $INSTALL/usr/share/bootloader + cp -PRv LICENCE* $INSTALL/usr/share/bootloader + cp -PRv bootcode.bin $INSTALL/usr/share/bootloader + cp -PRv fixup_x.dat $INSTALL/usr/share/bootloader/fixup.dat + cp -PRv start_x.elf $INSTALL/usr/share/bootloader/start.elf + + cp -PRv $PKG_DIR/scripts/update.sh $INSTALL/usr/share/bootloader + cp -PRv $PKG_DIR/files/3rdparty/bootloader/config.txt $INSTALL/usr/share/bootloader +} diff --git a/packages/unofficial b/packages/unofficial index b425b905f3..726e8ef3d6 160000 --- a/packages/unofficial +++ b/packages/unofficial @@ -1 +1 @@ -Subproject commit b425b905f3eb417bace156a4526fbc29d8439e39 +Subproject commit 726e8ef3d6addd5ff2cf4525be574d6e5abd5a57 diff --git a/packages/x11/app/xrandr/build b/packages/x11/app/xrandr/build deleted file mode 100755 index 7dda606dd2..0000000000 --- a/packages/x11/app/xrandr/build +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -cd $PKG_BUILD -./configure --host=$TARGET_NAME \ - --build=$HOST_NAME \ - --prefix=/usr \ - --sysconfdir=/etc \ - -make - -$STRIP $1 diff --git a/packages/x11/app/xrandr/install b/packages/x11/app/xrandr/install deleted file mode 100755 index b588c576f4..0000000000 --- a/packages/x11/app/xrandr/install +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -mkdir -p $INSTALL/usr/bin - cp $PKG_BUILD/$1 $INSTALL/usr/bin diff --git a/packages/x11/app/xrandr/meta b/packages/x11/app/xrandr/package.mk similarity index 91% rename from packages/x11/app/xrandr/meta rename to packages/x11/app/xrandr/package.mk index 92f5255180..6702d27998 100644 --- a/packages/x11/app/xrandr/meta +++ b/packages/x11/app/xrandr/package.mk @@ -19,18 +19,22 @@ ################################################################################ PKG_NAME="xrandr" -PKG_VERSION="1.4.0" +PKG_VERSION="1.4.1" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="OSS" PKG_SITE="http://www.X.org" PKG_URL="http://xorg.freedesktop.org/archive/individual/app/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS="libXrandr" -PKG_BUILD_DEPENDS="toolchain util-macros libXrandr" +PKG_BUILD_DEPENDS_TARGET="toolchain util-macros libXrandr" PKG_PRIORITY="optional" PKG_SECTION="x11/app" PKG_SHORTDESC="xrandr: A primitive command line interface to RandR extension" PKG_LONGDESC="Xrandr is a primitive command line interface to the RandR extension and used to set the screen size, orientation and/or reflection." -PKG_IS_ADDON="no" +PKG_IS_ADDON="no" PKG_AUTORECONF="yes" + +post_makeinstall_target() { + rm -rf $INSTALL/usr/bin/xkeystone +} \ No newline at end of file diff --git a/packages/x11/driver/xf86-video-fglrx-legacy/build b/packages/x11/driver/xf86-video-fglrx-legacy/build index e36301231b..c11e4ae8e5 100755 --- a/packages/x11/driver/xf86-video-fglrx-legacy/build +++ b/packages/x11/driver/xf86-video-fglrx-legacy/build @@ -51,7 +51,7 @@ cd $ROOT/$PKG_BUILD ln -sf /storage/.config/fglrx-legacy.conf $INSTALL_DIR/etc/ati/amdpcsdb # hack around a broken driver - cp $ROOT/$PKG_DIR/config/control $INSTALL_DIR/etc/ati + cp $PKG_DIR/config/control $INSTALL_DIR/etc/ati ( cd $INSTALL_DIR/ @@ -110,7 +110,7 @@ if [ "$XVBA" = yes ]; then # install needed files for toolchain mkdir -p $SYSROOT_PREFIX/usr/include/amd - cp $ROOT/$PKG_DIR/source/amdxvba.h $SYSROOT_PREFIX/usr/include/amd + cp $PKG_DIR/source/amdxvba.h $SYSROOT_PREFIX/usr/include/amd mkdir -p $SYSROOT_PREFIX/usr/lib cp arch/$FGLRX_ARCH/usr/X11R6/*/libXvBAW.so* $SYSROOT_PREFIX/usr/lib diff --git a/packages/x11/driver/xf86-video-fglrx/build b/packages/x11/driver/xf86-video-fglrx/build index 73141c114a..2581cf0abf 100755 --- a/packages/x11/driver/xf86-video-fglrx/build +++ b/packages/x11/driver/xf86-video-fglrx/build @@ -108,7 +108,7 @@ if [ "$XVBA" = yes ]; then # install needed files for toolchain mkdir -p $SYSROOT_PREFIX/usr/include/amd - cp $ROOT/$PKG_DIR/source/amdxvba.h $SYSROOT_PREFIX/usr/include/amd + cp $PKG_DIR/source/amdxvba.h $SYSROOT_PREFIX/usr/include/amd mkdir -p $SYSROOT_PREFIX/usr/lib cp arch/$FGLRX_ARCH/usr/X11R6/*/libXvBAW.so* $SYSROOT_PREFIX/usr/lib diff --git a/packages/x11/lib/libX11/meta b/packages/x11/lib/libX11/meta index f53cfa73c3..a9bc8e1bf6 100644 --- a/packages/x11/lib/libX11/meta +++ b/packages/x11/lib/libX11/meta @@ -26,7 +26,7 @@ PKG_LICENSE="OSS" PKG_SITE="http://www.x.org/" PKG_URL="http://xorg.freedesktop.org/archive/individual/lib/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS="" -PKG_BUILD_DEPENDS="toolchain xproto-host xproto util-macros xextproto xcmiscproto bigreqsproto kbproto inputproto xtrans libXau libxcb util-macros" +PKG_BUILD_DEPENDS="toolchain xproto:host xproto util-macros xextproto xcmiscproto bigreqsproto kbproto inputproto xtrans libXau libxcb util-macros" PKG_PRIORITY="optional" PKG_SECTION="x11/lib" PKG_SHORTDESC="libx11: The X11 library" diff --git a/packages/x11/lib/libpciaccess/build b/packages/x11/lib/libpciaccess/build deleted file mode 100755 index 3de4e2af83..0000000000 --- a/packages/x11/lib/libpciaccess/build +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE" - -export ac_cv_header_asm_mtrr_h=set - -cd $PKG_BUILD -./configure --host=$TARGET_NAME \ - --build=$HOST_NAME \ - --prefix=/usr \ - --sysconfdir=/etc \ - --disable-static \ - --enable-shared \ - --with-pciids-path=/usr/share \ - --with-zlib \ - -make -$MAKEINSTALL diff --git a/packages/x11/lib/libpciaccess/install b/packages/x11/lib/libpciaccess/install deleted file mode 100755 index a1999ce2e8..0000000000 --- a/packages/x11/lib/libpciaccess/install +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -mkdir -p $INSTALL/usr/lib - cp -P $PKG_BUILD/src/.libs/libpciaccess.so* $INSTALL/usr/lib - -mkdir -p $INSTALL/usr/bin - cp -P $PKG_BUILD/scanpci/.libs/scanpci $INSTALL/usr/bin - diff --git a/packages/x11/lib/libpciaccess/meta b/packages/x11/lib/libpciaccess/package.mk similarity index 84% rename from packages/x11/lib/libpciaccess/meta rename to packages/x11/lib/libpciaccess/package.mk index 9c4108e23d..fa7c5d46c5 100644 --- a/packages/x11/lib/libpciaccess/meta +++ b/packages/x11/lib/libpciaccess/package.mk @@ -19,18 +19,24 @@ ################################################################################ PKG_NAME="libpciaccess" -PKG_VERSION="0.13.1" +PKG_VERSION="0.13.2" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="OSS" PKG_SITE="http://freedesktop.org" PKG_URL="http://xorg.freedesktop.org/archive/individual/lib/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS="zlib" -PKG_BUILD_DEPENDS="toolchain util-macros zlib" +PKG_BUILD_DEPENDS_TARGET="toolchain util-macros zlib" PKG_PRIORITY="optional" PKG_SECTION="x11/lib" PKG_SHORTDESC="libpciaccess: X.org libpciaccess library" PKG_LONGDESC="X.org libpciaccess library." -PKG_IS_ADDON="no" +PKG_IS_ADDON="no" PKG_AUTORECONF="yes" + +CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE" + +PKG_CONFIGURE_OPTS_TARGET="ac_cv_header_asm_mtrr_h=set \ + --with-pciids-path=/usr/share \ + --with-zlib " diff --git a/packages/x11/proto/bigreqsproto/build b/packages/x11/proto/bigreqsproto/build deleted file mode 100755 index bdc0389305..0000000000 --- a/packages/x11/proto/bigreqsproto/build +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -cd $PKG_BUILD -./configure --host=$TARGET_NAME \ - --build=$HOST_NAME \ - --prefix=/usr \ - --sysconfdir=/etc \ - --localstatedir=/var \ - --without-xmlto - -make -$MAKEINSTALL diff --git a/packages/x11/proto/bigreqsproto/meta b/packages/x11/proto/bigreqsproto/package.mk similarity index 91% rename from packages/x11/proto/bigreqsproto/meta rename to packages/x11/proto/bigreqsproto/package.mk index ea2e8ce265..7f024c7511 100644 --- a/packages/x11/proto/bigreqsproto/meta +++ b/packages/x11/proto/bigreqsproto/package.mk @@ -26,11 +26,14 @@ PKG_LICENSE="OSS" PKG_SITE="http://www.X.org" PKG_URL="http://xorg.freedesktop.org/archive/individual/proto/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS="" -PKG_BUILD_DEPENDS="toolchain util-macros" +PKG_BUILD_DEPENDS_TARGET="toolchain util-macros" PKG_PRIORITY="optional" PKG_SECTION="x11/proto" PKG_SHORTDESC="bigreqsproto: BigReqs extension headers" PKG_LONGDESC="BigReqs extension headers" -PKG_IS_ADDON="no" +PKG_IS_ADDON="no" PKG_AUTORECONF="yes" + +# package specific configure options +PKG_CONFIGURE_OPTS_TARGET="--without-xmlto" diff --git a/packages/x11/proto/compositeproto/build b/packages/x11/proto/compositeproto/build deleted file mode 100755 index bdc0389305..0000000000 --- a/packages/x11/proto/compositeproto/build +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -cd $PKG_BUILD -./configure --host=$TARGET_NAME \ - --build=$HOST_NAME \ - --prefix=/usr \ - --sysconfdir=/etc \ - --localstatedir=/var \ - --without-xmlto - -make -$MAKEINSTALL diff --git a/packages/x11/proto/compositeproto/meta b/packages/x11/proto/compositeproto/package.mk similarity index 91% rename from packages/x11/proto/compositeproto/meta rename to packages/x11/proto/compositeproto/package.mk index 09305101c1..6fe599751e 100644 --- a/packages/x11/proto/compositeproto/meta +++ b/packages/x11/proto/compositeproto/package.mk @@ -26,11 +26,14 @@ PKG_LICENSE="OSS" PKG_SITE="http://www.X.org" PKG_URL="http://xorg.freedesktop.org/archive/individual/proto/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS="" -PKG_BUILD_DEPENDS="toolchain util-macros" +PKG_BUILD_DEPENDS_TARGET="toolchain util-macros" PKG_PRIORITY="optional" PKG_SECTION="x11/proto" PKG_SHORTDESC="compositeproto: Composite extension headers" PKG_LONGDESC="Composite extension headers" -PKG_IS_ADDON="no" +PKG_IS_ADDON="no" PKG_AUTORECONF="yes" + +# package specific configure options +PKG_CONFIGURE_OPTS_TARGET="--without-xmlto" diff --git a/packages/x11/proto/damageproto/build b/packages/x11/proto/damageproto/build deleted file mode 100755 index bdc0389305..0000000000 --- a/packages/x11/proto/damageproto/build +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -cd $PKG_BUILD -./configure --host=$TARGET_NAME \ - --build=$HOST_NAME \ - --prefix=/usr \ - --sysconfdir=/etc \ - --localstatedir=/var \ - --without-xmlto - -make -$MAKEINSTALL diff --git a/packages/x11/proto/damageproto/meta b/packages/x11/proto/damageproto/package.mk similarity index 91% rename from packages/x11/proto/damageproto/meta rename to packages/x11/proto/damageproto/package.mk index b8a1aa9781..a6c232a841 100644 --- a/packages/x11/proto/damageproto/meta +++ b/packages/x11/proto/damageproto/package.mk @@ -26,11 +26,14 @@ PKG_LICENSE="OSS" PKG_SITE="http://www.X.org" PKG_URL="http://xorg.freedesktop.org/archive/individual/proto/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS="" -PKG_BUILD_DEPENDS="toolchain util-macros" +PKG_BUILD_DEPENDS_TARGET="toolchain util-macros" PKG_PRIORITY="optional" PKG_SECTION="x11/proto" PKG_SHORTDESC="damageproto: Damage extension header" PKG_LONGDESC="Damage extension headers" -PKG_IS_ADDON="no" +PKG_IS_ADDON="no" PKG_AUTORECONF="yes" + +# package specific configure options +PKG_CONFIGURE_OPTS_TARGET="--without-xmlto" diff --git a/packages/x11/proto/dri2proto/build b/packages/x11/proto/dri2proto/build deleted file mode 100755 index bdc0389305..0000000000 --- a/packages/x11/proto/dri2proto/build +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -cd $PKG_BUILD -./configure --host=$TARGET_NAME \ - --build=$HOST_NAME \ - --prefix=/usr \ - --sysconfdir=/etc \ - --localstatedir=/var \ - --without-xmlto - -make -$MAKEINSTALL diff --git a/packages/x11/proto/dri2proto/meta b/packages/x11/proto/dri2proto/package.mk similarity index 91% rename from packages/x11/proto/dri2proto/meta rename to packages/x11/proto/dri2proto/package.mk index 8b515f6db2..e8179e57a0 100644 --- a/packages/x11/proto/dri2proto/meta +++ b/packages/x11/proto/dri2proto/package.mk @@ -26,11 +26,14 @@ PKG_LICENSE="OSS" PKG_SITE="http://www.X.org" PKG_URL="http://xorg.freedesktop.org/archive/individual/proto/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS="" -PKG_BUILD_DEPENDS="toolchain util-macros" +PKG_BUILD_DEPENDS_TARGET="toolchain util-macros" PKG_PRIORITY="optional" PKG_SECTION="x11/proto" PKG_SHORTDESC="dri2proto: X.Org DRI2 protocol headers" PKG_LONGDESC="X.Org DRI2 protocol headers." -PKG_IS_ADDON="no" +PKG_IS_ADDON="no" PKG_AUTORECONF="yes" + +# package specific configure options +PKG_CONFIGURE_OPTS_TARGET="--without-xmlto" diff --git a/packages/x11/proto/fixesproto/build b/packages/x11/proto/fixesproto/build deleted file mode 100755 index bdc0389305..0000000000 --- a/packages/x11/proto/fixesproto/build +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -cd $PKG_BUILD -./configure --host=$TARGET_NAME \ - --build=$HOST_NAME \ - --prefix=/usr \ - --sysconfdir=/etc \ - --localstatedir=/var \ - --without-xmlto - -make -$MAKEINSTALL diff --git a/packages/x11/proto/fixesproto/meta b/packages/x11/proto/fixesproto/package.mk similarity index 91% rename from packages/x11/proto/fixesproto/meta rename to packages/x11/proto/fixesproto/package.mk index dbab663908..7a520dde7c 100644 --- a/packages/x11/proto/fixesproto/meta +++ b/packages/x11/proto/fixesproto/package.mk @@ -26,11 +26,14 @@ PKG_LICENSE="OSS" PKG_SITE="http://www.X.org" PKG_URL="http://xorg.freedesktop.org/archive/individual/proto/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS="" -PKG_BUILD_DEPENDS="toolchain util-macros" +PKG_BUILD_DEPENDS_TARGET="toolchain util-macros" PKG_PRIORITY="optional" PKG_SECTION="x11/proto" PKG_SHORTDESC="fixesproto: Fixes extension headers" PKG_LONGDESC="Fixes extension headers" -PKG_IS_ADDON="no" +PKG_IS_ADDON="no" PKG_AUTORECONF="yes" + +# package specific configure options +PKG_CONFIGURE_OPTS_TARGET="--without-xmlto" diff --git a/packages/x11/proto/fontcacheproto/build b/packages/x11/proto/fontcacheproto/build deleted file mode 100755 index bdc0389305..0000000000 --- a/packages/x11/proto/fontcacheproto/build +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -cd $PKG_BUILD -./configure --host=$TARGET_NAME \ - --build=$HOST_NAME \ - --prefix=/usr \ - --sysconfdir=/etc \ - --localstatedir=/var \ - --without-xmlto - -make -$MAKEINSTALL diff --git a/packages/x11/proto/fontcacheproto/meta b/packages/x11/proto/fontcacheproto/package.mk similarity index 91% rename from packages/x11/proto/fontcacheproto/meta rename to packages/x11/proto/fontcacheproto/package.mk index 0fd724d16a..52db959cc9 100644 --- a/packages/x11/proto/fontcacheproto/meta +++ b/packages/x11/proto/fontcacheproto/package.mk @@ -26,11 +26,14 @@ PKG_LICENSE="OSS" PKG_SITE="http://www.X.org" PKG_URL="http://xorg.freedesktop.org/archive/individual/proto/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS="" -PKG_BUILD_DEPENDS="toolchain util-macros" +PKG_BUILD_DEPENDS_TARGET="toolchain util-macros" PKG_PRIORITY="optional" PKG_SECTION="x11/proto" PKG_SHORTDESC="fontcacheproto: Fontcache extension headers" PKG_LONGDESC="Fontcache extension headers" -PKG_IS_ADDON="no" +PKG_IS_ADDON="no" PKG_AUTORECONF="yes" + +# package specific configure options +PKG_CONFIGURE_OPTS_TARGET="--without-xmlto" diff --git a/packages/x11/proto/fontsproto/build b/packages/x11/proto/fontsproto/build deleted file mode 100755 index bdc0389305..0000000000 --- a/packages/x11/proto/fontsproto/build +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -cd $PKG_BUILD -./configure --host=$TARGET_NAME \ - --build=$HOST_NAME \ - --prefix=/usr \ - --sysconfdir=/etc \ - --localstatedir=/var \ - --without-xmlto - -make -$MAKEINSTALL diff --git a/packages/x11/proto/fontsproto/meta b/packages/x11/proto/fontsproto/package.mk similarity index 91% rename from packages/x11/proto/fontsproto/meta rename to packages/x11/proto/fontsproto/package.mk index bf73f90d39..13b5e5081c 100644 --- a/packages/x11/proto/fontsproto/meta +++ b/packages/x11/proto/fontsproto/package.mk @@ -26,11 +26,14 @@ PKG_LICENSE="OSS" PKG_SITE="http://www.X.org" PKG_URL="http://xorg.freedesktop.org/archive/individual/proto/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS="" -PKG_BUILD_DEPENDS="toolchain util-macros" +PKG_BUILD_DEPENDS_TARGET="toolchain util-macros" PKG_PRIORITY="optional" PKG_SECTION="x11/proto" PKG_SHORTDESC="fontsproto: Fonts extension headers" PKG_LONGDESC="Fonts extension headers" -PKG_IS_ADDON="no" +PKG_IS_ADDON="no" PKG_AUTORECONF="yes" + +# package specific configure options +PKG_CONFIGURE_OPTS_TARGET="--without-xmlto" diff --git a/packages/x11/proto/glproto/build b/packages/x11/proto/glproto/build deleted file mode 100755 index bdc0389305..0000000000 --- a/packages/x11/proto/glproto/build +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -cd $PKG_BUILD -./configure --host=$TARGET_NAME \ - --build=$HOST_NAME \ - --prefix=/usr \ - --sysconfdir=/etc \ - --localstatedir=/var \ - --without-xmlto - -make -$MAKEINSTALL diff --git a/packages/x11/proto/glproto/meta b/packages/x11/proto/glproto/package.mk similarity index 91% rename from packages/x11/proto/glproto/meta rename to packages/x11/proto/glproto/package.mk index 953232cc68..e015ba872a 100644 --- a/packages/x11/proto/glproto/meta +++ b/packages/x11/proto/glproto/package.mk @@ -26,11 +26,14 @@ PKG_LICENSE="OSS" PKG_SITE="http://www.x.org/" PKG_URL="http://xorg.freedesktop.org/archive/individual/proto/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS="" -PKG_BUILD_DEPENDS="toolchain util-macros" +PKG_BUILD_DEPENDS_TARGET="toolchain util-macros" PKG_PRIORITY="optional" PKG_SECTION="x11/proto" PKG_SHORTDESC="glproto: GL extension headers" PKG_LONGDESC="GL extension headers" -PKG_IS_ADDON="no" +PKG_IS_ADDON="no" PKG_AUTORECONF="yes" + +# package specific configure options +PKG_CONFIGURE_OPTS_TARGET="--without-xmlto" diff --git a/packages/x11/proto/inputproto/build b/packages/x11/proto/inputproto/build deleted file mode 100755 index 22c5091b13..0000000000 --- a/packages/x11/proto/inputproto/build +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -cd $PKG_BUILD -./configure --host=$TARGET_NAME \ - --build=$HOST_NAME \ - --prefix=/usr \ - --sysconfdir=/etc \ - --localstatedir=/var \ - -make -$MAKEINSTALL diff --git a/packages/x11/proto/inputproto/meta b/packages/x11/proto/inputproto/package.mk similarity index 91% rename from packages/x11/proto/inputproto/meta rename to packages/x11/proto/inputproto/package.mk index 1a528d977d..d713d69b0c 100644 --- a/packages/x11/proto/inputproto/meta +++ b/packages/x11/proto/inputproto/package.mk @@ -26,11 +26,14 @@ PKG_LICENSE="OSS" PKG_SITE="http://www.X.org" PKG_URL="http://xorg.freedesktop.org/archive/individual/proto/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS="" -PKG_BUILD_DEPENDS="toolchain util-macros" +PKG_BUILD_DEPENDS_TARGET="toolchain util-macros" PKG_PRIORITY="optional" PKG_SECTION="x11/proto" PKG_SHORTDESC="inputproto: Input extension headers" PKG_LONGDESC="Input extension headers" -PKG_IS_ADDON="no" +PKG_IS_ADDON="no" PKG_AUTORECONF="yes" + +# package specific configure options +PKG_CONFIGURE_OPTS_TARGET="--without-xmlto" diff --git a/packages/x11/proto/kbproto/build b/packages/x11/proto/kbproto/build deleted file mode 100755 index bdc0389305..0000000000 --- a/packages/x11/proto/kbproto/build +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -cd $PKG_BUILD -./configure --host=$TARGET_NAME \ - --build=$HOST_NAME \ - --prefix=/usr \ - --sysconfdir=/etc \ - --localstatedir=/var \ - --without-xmlto - -make -$MAKEINSTALL diff --git a/packages/x11/proto/kbproto/meta b/packages/x11/proto/kbproto/package.mk similarity index 91% rename from packages/x11/proto/kbproto/meta rename to packages/x11/proto/kbproto/package.mk index a811fdba6c..eb524e3819 100644 --- a/packages/x11/proto/kbproto/meta +++ b/packages/x11/proto/kbproto/package.mk @@ -26,11 +26,14 @@ PKG_LICENSE="OSS" PKG_SITE="http://www.x.org/" PKG_URL="http://xorg.freedesktop.org/archive/individual/proto/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS="" -PKG_BUILD_DEPENDS="toolchain util-macros" +PKG_BUILD_DEPENDS_TARGET="toolchain util-macros" PKG_PRIORITY="optional" PKG_SECTION="x11/proto" PKG_SHORTDESC="kbproto: KB extension headers" PKG_LONGDESC="KB extension headers" -PKG_IS_ADDON="no" +PKG_IS_ADDON="no" PKG_AUTORECONF="yes" + +# package specific configure options +PKG_CONFIGURE_OPTS_TARGET="--without-xmlto" diff --git a/packages/x11/proto/randrproto/build b/packages/x11/proto/randrproto/build deleted file mode 100755 index e4b2b6aa4b..0000000000 --- a/packages/x11/proto/randrproto/build +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -cd $PKG_BUILD -./configure --host=$TARGET_NAME \ - --build=$HOST_NAME \ - --prefix=/usr \ - --sysconfdir=/etc \ - --without-xmlto - -make -$MAKEINSTALL diff --git a/packages/x11/proto/randrproto/meta b/packages/x11/proto/randrproto/package.mk similarity index 91% rename from packages/x11/proto/randrproto/meta rename to packages/x11/proto/randrproto/package.mk index 9b36b4cba1..0eec2c3acd 100644 --- a/packages/x11/proto/randrproto/meta +++ b/packages/x11/proto/randrproto/package.mk @@ -26,11 +26,14 @@ PKG_LICENSE="OSS" PKG_SITE="http://www.X.org" PKG_URL="http://xorg.freedesktop.org/archive/individual/proto/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS="" -PKG_BUILD_DEPENDS="toolchain util-macros" +PKG_BUILD_DEPENDS_TARGET="toolchain util-macros" PKG_PRIORITY="optional" PKG_SECTION="x11/proto" PKG_SHORTDESC="randrproto: Randr extension headers" PKG_LONGDESC="Randr extension headers" -PKG_IS_ADDON="no" +PKG_IS_ADDON="no" PKG_AUTORECONF="yes" + +# package specific configure options +PKG_CONFIGURE_OPTS_TARGET="--without-xmlto" diff --git a/packages/x11/proto/recordproto/build b/packages/x11/proto/recordproto/build deleted file mode 100755 index e4b2b6aa4b..0000000000 --- a/packages/x11/proto/recordproto/build +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -cd $PKG_BUILD -./configure --host=$TARGET_NAME \ - --build=$HOST_NAME \ - --prefix=/usr \ - --sysconfdir=/etc \ - --without-xmlto - -make -$MAKEINSTALL diff --git a/packages/x11/proto/recordproto/meta b/packages/x11/proto/recordproto/package.mk similarity index 91% rename from packages/x11/proto/recordproto/meta rename to packages/x11/proto/recordproto/package.mk index 879eff2172..ac6f804975 100644 --- a/packages/x11/proto/recordproto/meta +++ b/packages/x11/proto/recordproto/package.mk @@ -26,11 +26,14 @@ PKG_LICENSE="OSS" PKG_SITE="http://www.X.org" PKG_URL="http://xorg.freedesktop.org/archive/individual/proto/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS="" -PKG_BUILD_DEPENDS="toolchain util-macros" +PKG_BUILD_DEPENDS_TARGET="toolchain util-macros" PKG_PRIORITY="optional" PKG_SECTION="x11/proto" PKG_SHORTDESC="recordproto: Record extension headers" PKG_LONGDESC="Record extension headers" -PKG_IS_ADDON="no" +PKG_IS_ADDON="no" PKG_AUTORECONF="yes" + +# package specific configure options +PKG_CONFIGURE_OPTS_TARGET="--without-xmlto" diff --git a/packages/x11/proto/renderproto/build b/packages/x11/proto/renderproto/build deleted file mode 100755 index e4b2b6aa4b..0000000000 --- a/packages/x11/proto/renderproto/build +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -cd $PKG_BUILD -./configure --host=$TARGET_NAME \ - --build=$HOST_NAME \ - --prefix=/usr \ - --sysconfdir=/etc \ - --without-xmlto - -make -$MAKEINSTALL diff --git a/packages/x11/proto/renderproto/meta b/packages/x11/proto/renderproto/package.mk similarity index 91% rename from packages/x11/proto/renderproto/meta rename to packages/x11/proto/renderproto/package.mk index ab80e4fcb7..4f67dec6f5 100644 --- a/packages/x11/proto/renderproto/meta +++ b/packages/x11/proto/renderproto/package.mk @@ -26,11 +26,14 @@ PKG_LICENSE="OSS" PKG_SITE="http://www.x.org/" PKG_URL="http://xorg.freedesktop.org/archive/individual/proto/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS="" -PKG_BUILD_DEPENDS="toolchain util-macros" +PKG_BUILD_DEPENDS_TARGET="toolchain util-macros" PKG_PRIORITY="optional" PKG_SECTION="x11/proto" PKG_SHORTDESC="renderproto: KB extension headers" PKG_LONGDESC="Render extension headers" -PKG_IS_ADDON="no" +PKG_IS_ADDON="no" PKG_AUTORECONF="yes" + +# package specific configure options +PKG_CONFIGURE_OPTS_TARGET="--without-xmlto" diff --git a/packages/x11/proto/scrnsaverproto/build b/packages/x11/proto/scrnsaverproto/build deleted file mode 100755 index e4b2b6aa4b..0000000000 --- a/packages/x11/proto/scrnsaverproto/build +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -cd $PKG_BUILD -./configure --host=$TARGET_NAME \ - --build=$HOST_NAME \ - --prefix=/usr \ - --sysconfdir=/etc \ - --without-xmlto - -make -$MAKEINSTALL diff --git a/packages/x11/proto/scrnsaverproto/meta b/packages/x11/proto/scrnsaverproto/package.mk similarity index 91% rename from packages/x11/proto/scrnsaverproto/meta rename to packages/x11/proto/scrnsaverproto/package.mk index 0d864724b8..a419a02567 100644 --- a/packages/x11/proto/scrnsaverproto/meta +++ b/packages/x11/proto/scrnsaverproto/package.mk @@ -26,11 +26,14 @@ PKG_LICENSE="OSS" PKG_SITE="http://www.X.org" PKG_URL="http://xorg.freedesktop.org/archive/individual/proto/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS="" -PKG_BUILD_DEPENDS="toolchain util-macros" +PKG_BUILD_DEPENDS_TARGET="toolchain util-macros" PKG_PRIORITY="optional" PKG_SECTION="x11/proto" PKG_SHORTDESC="scrnsaverproto: ScrnSaver extension headers" PKG_LONGDESC="ScrnSaver extension headers" -PKG_IS_ADDON="no" +PKG_IS_ADDON="no" PKG_AUTORECONF="yes" + +# package specific configure options +PKG_CONFIGURE_OPTS_TARGET="--without-xmlto" diff --git a/packages/x11/proto/videoproto/build b/packages/x11/proto/videoproto/build deleted file mode 100755 index e4b2b6aa4b..0000000000 --- a/packages/x11/proto/videoproto/build +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -cd $PKG_BUILD -./configure --host=$TARGET_NAME \ - --build=$HOST_NAME \ - --prefix=/usr \ - --sysconfdir=/etc \ - --without-xmlto - -make -$MAKEINSTALL diff --git a/packages/x11/proto/videoproto/meta b/packages/x11/proto/videoproto/package.mk similarity index 91% rename from packages/x11/proto/videoproto/meta rename to packages/x11/proto/videoproto/package.mk index 68f7da339c..2f1d55e124 100644 --- a/packages/x11/proto/videoproto/meta +++ b/packages/x11/proto/videoproto/package.mk @@ -26,11 +26,14 @@ PKG_LICENSE="OSS" PKG_SITE="http://www.x.org/" PKG_URL="http://xorg.freedesktop.org/archive/individual/proto/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS="" -PKG_BUILD_DEPENDS="toolchain util-macros" +PKG_BUILD_DEPENDS_TARGET="toolchain util-macros" PKG_PRIORITY="optional" PKG_SECTION="x11/proto" PKG_SHORTDESC="videoproto: KB extension headers" PKG_LONGDESC="Video extension headers" -PKG_IS_ADDON="no" +PKG_IS_ADDON="no" PKG_AUTORECONF="yes" + +# package specific configure options +PKG_CONFIGURE_OPTS_TARGET="--without-xmlto" diff --git a/packages/x11/proto/xcb-proto/build b/packages/x11/proto/xcb-proto/build deleted file mode 100755 index 4bd8726833..0000000000 --- a/packages/x11/proto/xcb-proto/build +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -cd $PKG_BUILD -./configure --host=$TARGET_NAME \ - --build=$HOST_NAME \ - --prefix=/usr \ - --without-xmlto - -make -$MAKEINSTALL diff --git a/packages/x11/proto/xcb-proto/meta b/packages/x11/proto/xcb-proto/package.mk similarity index 91% rename from packages/x11/proto/xcb-proto/meta rename to packages/x11/proto/xcb-proto/package.mk index d687c972ea..bcbdbdd3f8 100644 --- a/packages/x11/proto/xcb-proto/meta +++ b/packages/x11/proto/xcb-proto/package.mk @@ -26,11 +26,14 @@ PKG_LICENSE="OSS" PKG_SITE="http://www.X.org" PKG_URL="http://xcb.freedesktop.org/dist/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS="" -PKG_BUILD_DEPENDS="toolchain util-macros Python-host" +PKG_BUILD_DEPENDS_TARGET="toolchain util-macros Python-host" PKG_PRIORITY="optional" PKG_SECTION="x11/proto" PKG_SHORTDESC="xcb-proto: X C-language Bindings protocol headers" PKG_LONGDESC="X C-language Bindings protocol headers." -PKG_IS_ADDON="no" +PKG_IS_ADDON="no" PKG_AUTORECONF="yes" + +# package specific configure options +PKG_CONFIGURE_OPTS_TARGET="--without-xmlto" diff --git a/packages/x11/proto/xcmiscproto/build b/packages/x11/proto/xcmiscproto/build deleted file mode 100755 index e4b2b6aa4b..0000000000 --- a/packages/x11/proto/xcmiscproto/build +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -cd $PKG_BUILD -./configure --host=$TARGET_NAME \ - --build=$HOST_NAME \ - --prefix=/usr \ - --sysconfdir=/etc \ - --without-xmlto - -make -$MAKEINSTALL diff --git a/packages/x11/proto/xcmiscproto/meta b/packages/x11/proto/xcmiscproto/package.mk similarity index 91% rename from packages/x11/proto/xcmiscproto/meta rename to packages/x11/proto/xcmiscproto/package.mk index 888eda8110..40c0430ed4 100644 --- a/packages/x11/proto/xcmiscproto/meta +++ b/packages/x11/proto/xcmiscproto/package.mk @@ -26,11 +26,14 @@ PKG_LICENSE="OpenSource" PKG_SITE="http://www.X.org" PKG_URL="http://xorg.freedesktop.org/archive/individual/proto/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS="" -PKG_BUILD_DEPENDS="toolchain util-macros" +PKG_BUILD_DEPENDS_TARGET="toolchain util-macros" PKG_PRIORITY="optional" PKG_SECTION="x11/proto" PKG_SHORTDESC="xcmiscproto: XCMisc extension headers" PKG_LONGDESC="XCMisc extension headers" -PKG_IS_ADDON="no" +PKG_IS_ADDON="no" PKG_AUTORECONF="yes" + +# package specific configure options +PKG_CONFIGURE_OPTS_TARGET="--without-xmlto" diff --git a/packages/x11/proto/xextproto/build b/packages/x11/proto/xextproto/build deleted file mode 100755 index e4b2b6aa4b..0000000000 --- a/packages/x11/proto/xextproto/build +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -cd $PKG_BUILD -./configure --host=$TARGET_NAME \ - --build=$HOST_NAME \ - --prefix=/usr \ - --sysconfdir=/etc \ - --without-xmlto - -make -$MAKEINSTALL diff --git a/packages/x11/proto/xextproto/meta b/packages/x11/proto/xextproto/package.mk similarity index 91% rename from packages/x11/proto/xextproto/meta rename to packages/x11/proto/xextproto/package.mk index 0f2674bb3c..d29f5fed1b 100644 --- a/packages/x11/proto/xextproto/meta +++ b/packages/x11/proto/xextproto/package.mk @@ -26,11 +26,14 @@ PKG_LICENSE="OSS" PKG_SITE="http://www.x.org/" PKG_URL="http://xorg.freedesktop.org/archive/individual/proto/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS="" -PKG_BUILD_DEPENDS="toolchain util-macros" +PKG_BUILD_DEPENDS_TARGET="toolchain util-macros" PKG_PRIORITY="optional" PKG_SECTION="x11/proto" PKG_SHORTDESC="xextproto: KB extension headers" PKG_LONGDESC="Xext extension headers" -PKG_IS_ADDON="no" +PKG_IS_ADDON="no" PKG_AUTORECONF="yes" + +# package specific configure options +PKG_CONFIGURE_OPTS_TARGET="--without-xmlto" diff --git a/packages/x11/proto/xf86dgaproto/build b/packages/x11/proto/xf86dgaproto/build deleted file mode 100755 index e4b2b6aa4b..0000000000 --- a/packages/x11/proto/xf86dgaproto/build +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -cd $PKG_BUILD -./configure --host=$TARGET_NAME \ - --build=$HOST_NAME \ - --prefix=/usr \ - --sysconfdir=/etc \ - --without-xmlto - -make -$MAKEINSTALL diff --git a/packages/x11/proto/xf86dgaproto/meta b/packages/x11/proto/xf86dgaproto/package.mk similarity index 91% rename from packages/x11/proto/xf86dgaproto/meta rename to packages/x11/proto/xf86dgaproto/package.mk index a6c9c51941..f2de8b500c 100644 --- a/packages/x11/proto/xf86dgaproto/meta +++ b/packages/x11/proto/xf86dgaproto/package.mk @@ -26,11 +26,14 @@ PKG_LICENSE="OSS" PKG_SITE="http://www.X.org" PKG_URL="http://xorg.freedesktop.org/archive/individual/proto/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS="" -PKG_BUILD_DEPENDS="toolchain util-macros" +PKG_BUILD_DEPENDS_TARGET="toolchain util-macros" PKG_PRIORITY="optional" PKG_SECTION="x11/proto" PKG_SHORTDESC="xf86dgaproto: XF86DGA extension headers" PKG_LONGDESC="XF86DGA extension headers" -PKG_IS_ADDON="no" +PKG_IS_ADDON="no" PKG_AUTORECONF="yes" + +# package specific configure options +PKG_CONFIGURE_OPTS_TARGET="--without-xmlto" diff --git a/packages/x11/proto/xf86driproto/build b/packages/x11/proto/xf86driproto/build deleted file mode 100755 index e4b2b6aa4b..0000000000 --- a/packages/x11/proto/xf86driproto/build +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -cd $PKG_BUILD -./configure --host=$TARGET_NAME \ - --build=$HOST_NAME \ - --prefix=/usr \ - --sysconfdir=/etc \ - --without-xmlto - -make -$MAKEINSTALL diff --git a/packages/x11/proto/xf86driproto/meta b/packages/x11/proto/xf86driproto/package.mk similarity index 91% rename from packages/x11/proto/xf86driproto/meta rename to packages/x11/proto/xf86driproto/package.mk index d94607f614..f2679f77b4 100644 --- a/packages/x11/proto/xf86driproto/meta +++ b/packages/x11/proto/xf86driproto/package.mk @@ -26,11 +26,14 @@ PKG_LICENSE="OSS" PKG_SITE="http://www.X.org" PKG_URL="http://xorg.freedesktop.org/archive/individual/proto/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS="" -PKG_BUILD_DEPENDS="toolchain util-macros" +PKG_BUILD_DEPENDS_TARGET="toolchain util-macros" PKG_PRIORITY="optional" PKG_SECTION="x11/proto" PKG_SHORTDESC="xf86driproto: XF86DRI extension headers" PKG_LONGDESC="XF86DRI extension headers" -PKG_IS_ADDON="no" +PKG_IS_ADDON="no" PKG_AUTORECONF="yes" + +# package specific configure options +PKG_CONFIGURE_OPTS_TARGET="--without-xmlto" diff --git a/packages/x11/proto/xf86miscproto/build b/packages/x11/proto/xf86miscproto/build deleted file mode 100755 index e4b2b6aa4b..0000000000 --- a/packages/x11/proto/xf86miscproto/build +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -cd $PKG_BUILD -./configure --host=$TARGET_NAME \ - --build=$HOST_NAME \ - --prefix=/usr \ - --sysconfdir=/etc \ - --without-xmlto - -make -$MAKEINSTALL diff --git a/packages/x11/proto/xf86miscproto/meta b/packages/x11/proto/xf86miscproto/package.mk similarity index 91% rename from packages/x11/proto/xf86miscproto/meta rename to packages/x11/proto/xf86miscproto/package.mk index e286f0388f..bf36c66460 100644 --- a/packages/x11/proto/xf86miscproto/meta +++ b/packages/x11/proto/xf86miscproto/package.mk @@ -26,11 +26,14 @@ PKG_LICENSE="OSS" PKG_SITE="http://www.X.org" PKG_URL="http://xorg.freedesktop.org/archive/individual/proto/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS="" -PKG_BUILD_DEPENDS="toolchain util-macros" +PKG_BUILD_DEPENDS_TARGET="toolchain util-macros" PKG_PRIORITY="optional" PKG_SECTION="x11/proto" PKG_SHORTDESC="xf86miscproto: XF86Misc extension headers" PKG_LONGDESC="XF86Misc extension headers" -PKG_IS_ADDON="no" +PKG_IS_ADDON="no" PKG_AUTORECONF="yes" + +# package specific configure options +PKG_CONFIGURE_OPTS_TARGET="--without-xmlto" diff --git a/packages/x11/proto/xf86vidmodeproto/build b/packages/x11/proto/xf86vidmodeproto/build deleted file mode 100755 index e4b2b6aa4b..0000000000 --- a/packages/x11/proto/xf86vidmodeproto/build +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -cd $PKG_BUILD -./configure --host=$TARGET_NAME \ - --build=$HOST_NAME \ - --prefix=/usr \ - --sysconfdir=/etc \ - --without-xmlto - -make -$MAKEINSTALL diff --git a/packages/x11/proto/xf86vidmodeproto/meta b/packages/x11/proto/xf86vidmodeproto/package.mk similarity index 91% rename from packages/x11/proto/xf86vidmodeproto/meta rename to packages/x11/proto/xf86vidmodeproto/package.mk index f3152f9edb..9ba5644410 100644 --- a/packages/x11/proto/xf86vidmodeproto/meta +++ b/packages/x11/proto/xf86vidmodeproto/package.mk @@ -26,11 +26,14 @@ PKG_LICENSE="OSS" PKG_SITE="http://www.X.org" PKG_URL="http://xorg.freedesktop.org/archive/individual/proto/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS="" -PKG_BUILD_DEPENDS="toolchain util-macros" +PKG_BUILD_DEPENDS_TARGET="toolchain util-macros" PKG_PRIORITY="optional" PKG_SECTION="x11/proto" PKG_SHORTDESC="xf86vidmodeproto: XF86VidMode extension headers" PKG_LONGDESC="XF86VidMode extension headers" -PKG_IS_ADDON="no" +PKG_IS_ADDON="no" PKG_AUTORECONF="yes" + +# package specific configure options +PKG_CONFIGURE_OPTS_TARGET="--without-xmlto" diff --git a/packages/x11/proto/xineramaproto/build b/packages/x11/proto/xineramaproto/build deleted file mode 100755 index e4b2b6aa4b..0000000000 --- a/packages/x11/proto/xineramaproto/build +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -cd $PKG_BUILD -./configure --host=$TARGET_NAME \ - --build=$HOST_NAME \ - --prefix=/usr \ - --sysconfdir=/etc \ - --without-xmlto - -make -$MAKEINSTALL diff --git a/packages/x11/proto/xineramaproto/meta b/packages/x11/proto/xineramaproto/package.mk similarity index 91% rename from packages/x11/proto/xineramaproto/meta rename to packages/x11/proto/xineramaproto/package.mk index eda2ea6293..bfe668d6f8 100644 --- a/packages/x11/proto/xineramaproto/meta +++ b/packages/x11/proto/xineramaproto/package.mk @@ -26,11 +26,14 @@ PKG_LICENSE="OSS" PKG_SITE="http://www.X.org" PKG_URL="http://xorg.freedesktop.org/archive/individual/proto/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS="" -PKG_BUILD_DEPENDS="toolchain util-macros" +PKG_BUILD_DEPENDS_TARGET="toolchain util-macros" PKG_PRIORITY="optional" PKG_SECTION="x11/proto" PKG_SHORTDESC="xineramaproto: Xinerama extension headers" PKG_LONGDESC="Xinerama extension headers" -PKG_IS_ADDON="no" +PKG_IS_ADDON="no" PKG_AUTORECONF="yes" + +# package specific configure options +PKG_CONFIGURE_OPTS_TARGET="--without-xmlto" diff --git a/packages/x11/proto/xproto-host/build b/packages/x11/proto/xproto-host/build deleted file mode 100755 index 5012c65ec6..0000000000 --- a/packages/x11/proto/xproto-host/build +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -$SCRIPTS/unpack xproto - -XPROTO_DIR=`ls -d $BUILD/xproto-[0-9]*` - -setup_toolchain host - -cd $XPROTO_DIR -mkdir -p .objdir-host && cd .objdir-host - -../configure --host=$HOST_NAME \ - --build=$HOST_NAME \ - --prefix=$ROOT/$TOOLCHAIN \ - --without-xmlto - -make -make install diff --git a/packages/x11/proto/xproto-host/meta b/packages/x11/proto/xproto-host/meta deleted file mode 100644 index 690aa8fa11..0000000000 --- a/packages/x11/proto/xproto-host/meta +++ /dev/null @@ -1,36 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -PKG_NAME="xproto-host" -PKG_VERSION="" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="OSS" -PKG_SITE="http://www.x.org/" -PKG_URL="" -PKG_DEPENDS="" -PKG_BUILD_DEPENDS="toolchain util-macros" -PKG_PRIORITY="optional" -PKG_SECTION="x11/proto" -PKG_SHORTDESC="xproto: KB extension headers" -PKG_LONGDESC="X11 extension headers" -PKG_IS_ADDON="no" - -PKG_AUTORECONF="no" diff --git a/packages/x11/proto/xproto/build b/packages/x11/proto/xproto/build deleted file mode 100755 index 6805cc4eaa..0000000000 --- a/packages/x11/proto/xproto/build +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -cd $PKG_BUILD -mkdir -p .objdir-target && cd .objdir-target - -../configure --host=$TARGET_NAME \ - --build=$HOST_NAME \ - --prefix=/usr \ - --without-xmlto - -make -$MAKEINSTALL diff --git a/packages/x11/proto/xproto/meta b/packages/x11/proto/xproto/package.mk similarity index 86% rename from packages/x11/proto/xproto/meta rename to packages/x11/proto/xproto/package.mk index bf09426a57..0435e9b4d1 100644 --- a/packages/x11/proto/xproto/meta +++ b/packages/x11/proto/xproto/package.mk @@ -26,11 +26,16 @@ PKG_LICENSE="OSS" PKG_SITE="http://www.x.org/" PKG_URL="http://xorg.freedesktop.org/archive/individual/proto/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS="" -PKG_BUILD_DEPENDS="toolchain util-macros" +PKG_BUILD_DEPENDS_TARGET="toolchain util-macros" +PKG_BUILD_DEPENDS_HOST="toolchain util-macros" PKG_PRIORITY="optional" PKG_SECTION="x11/proto" PKG_SHORTDESC="xproto: KB extension headers" PKG_LONGDESC="X11 extension headers" -PKG_IS_ADDON="no" +PKG_IS_ADDON="no" PKG_AUTORECONF="yes" + +# package specific configure options +PKG_CONFIGURE_OPTS_TARGET="--without-xmlto" +PKG_CONFIGURE_OPTS_HOST="--without-xmlto" diff --git a/packages/x11/util/makedepend/meta b/packages/x11/util/makedepend/meta index 9991972ab8..05bc34c1c0 100644 --- a/packages/x11/util/makedepend/meta +++ b/packages/x11/util/makedepend/meta @@ -26,7 +26,7 @@ PKG_LICENSE="OSS" PKG_SITE="http://www.X.org" PKG_URL="http://xorg.freedesktop.org/archive/individual/util/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS="" -PKG_BUILD_DEPENDS="toolchain xproto-host" +PKG_BUILD_DEPENDS="toolchain xproto:host" PKG_PRIORITY="optional" PKG_SECTION="x11/util" PKG_SHORTDESC="makedepend: Creates dependencies in makefiles" diff --git a/packages/x11/xserver/xorg-server/meta b/packages/x11/xserver/xorg-server/meta index 11705b41cd..c30b9a858c 100644 --- a/packages/x11/xserver/xorg-server/meta +++ b/packages/x11/xserver/xorg-server/meta @@ -71,7 +71,3 @@ fi if [ -n "$WINDOWMANAGER" -a "$WINDOWMANAGER" != "none" ]; then PKG_DEPENDS="$PKG_DEPENDS $WINDOWMANAGER" fi - -if [ "$DEVTOOLS" = yes ]; then - PKG_DEPENDS="$PKG_DEPENDS mrxvt" -fi diff --git a/packages/x11/xserver/xorg-server/scripts/xorg_start b/packages/x11/xserver/xorg-server/scripts/xorg_start index 29ab52e9fa..844df1db53 100755 --- a/packages/x11/xserver/xorg-server/scripts/xorg_start +++ b/packages/x11/xserver/xorg-server/scripts/xorg_start @@ -45,7 +45,7 @@ if [ "$RUNLEVEL" = openelec ]; then XORG_ARGS="-s 0 -noreset -allowMouseOpenFail" - if [ "$DEBUG" = yes ]; then + if [ "$DEBUG" = yes -o -f $HOME/.config/debug.xorg ]; then XORG_ARGS="$XORG_ARGS -logverbose 6 -verbose 6" else XORG_ARGS="$XORG_ARGS -logverbose 0 -verbose 0" diff --git a/projects/ARCTIC_MC/linux/linux.x86_64.conf b/projects/ARCTIC_MC/linux/linux.x86_64.conf index bf600d9547..1ac2d81744 100644 --- a/projects/ARCTIC_MC/linux/linux.x86_64.conf +++ b/projects/ARCTIC_MC/linux/linux.x86_64.conf @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/x86_64 3.10.0 Kernel Configuration +# Linux/x86_64 3.10.2 Kernel Configuration # CONFIG_64BIT=y CONFIG_X86_64=y @@ -1419,7 +1419,7 @@ CONFIG_B43LEGACY_DMA_AND_PIO_MODE=y # CONFIG_B43LEGACY_PIO_MODE is not set CONFIG_BRCMUTIL=m CONFIG_BRCMFMAC=m -CONFIG_BRCMFMAC_SDIO=y +# CONFIG_BRCMFMAC_SDIO is not set CONFIG_BRCMFMAC_USB=y # CONFIG_BRCM_TRACING is not set # CONFIG_BRCMDBG is not set diff --git a/projects/ARCTIC_MC/options b/projects/ARCTIC_MC/options index 1d4a0700f3..79e4e07119 100755 --- a/projects/ARCTIC_MC/options +++ b/projects/ARCTIC_MC/options @@ -206,7 +206,7 @@ AFP_SUPPORT="yes" # build and install Samba Client support (yes / no) - SAMBA_CLIENT="yes" + SAMBA_SUPPORT="yes" # build and install Samba Server (yes / no) SAMBA_SERVER="yes" @@ -295,7 +295,7 @@ # joy,lb216,lcdm001,lcterm,lirc,lis,MD8800,mdm166a, # ms6931,mtc_s16209x,MtxOrb,mx5000,NoritakeVFD, # picolcd,pyramid,sed1330,sed1520,serialPOS, -# serialVFD,shuttleVFD,sli,stv5730,SureElec,svga, +# serialVFD,shuttleVFD,sli,stv5730,SureElec,svga,vlsys_m428 # 'all' compiles all drivers; # 'all,!xxx,!yyy' de-selects previously selected drivers # "none" for disable LCD support diff --git a/projects/ATV/linux/linux.i386.conf b/projects/ATV/linux/linux.i386.conf index 7fb6b2859b..80da55de68 100644 --- a/projects/ATV/linux/linux.i386.conf +++ b/projects/ATV/linux/linux.i386.conf @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/i386 3.10.0 Kernel Configuration +# Linux/i386 3.10.2 Kernel Configuration # # CONFIG_64BIT is not set CONFIG_X86_32=y @@ -1323,7 +1323,11 @@ CONFIG_AR5523=m # CONFIG_WIL6210 is not set # CONFIG_B43 is not set # CONFIG_B43LEGACY is not set -# CONFIG_BRCMFMAC is not set +CONFIG_BRCMUTIL=m +CONFIG_BRCMFMAC=m +CONFIG_BRCMFMAC_USB=y +# CONFIG_BRCM_TRACING is not set +# CONFIG_BRCMDBG is not set CONFIG_HOSTAP=m CONFIG_HOSTAP_FIRMWARE=y CONFIG_HOSTAP_FIRMWARE_NVRAM=y diff --git a/projects/ATV/options b/projects/ATV/options index b3e0b0c596..84eee1c200 100755 --- a/projects/ATV/options +++ b/projects/ATV/options @@ -206,7 +206,7 @@ AFP_SUPPORT="yes" # build and install Samba Client support (yes / no) - SAMBA_CLIENT="yes" + SAMBA_SUPPORT="yes" # build and install Samba Server (yes / no) SAMBA_SERVER="yes" @@ -295,7 +295,7 @@ # joy,lb216,lcdm001,lcterm,lirc,lis,MD8800,mdm166a, # ms6931,mtc_s16209x,MtxOrb,mx5000,NoritakeVFD, # picolcd,pyramid,sed1330,sed1520,serialPOS, -# serialVFD,shuttleVFD,sli,stv5730,SureElec,svga, +# serialVFD,shuttleVFD,sli,stv5730,SureElec,svga,vlsys_m428 # 'all' compiles all drivers; # 'all,!xxx,!yyy' de-selects previously selected drivers # "none" for disable LCD support diff --git a/projects/Fusion/linux/linux.i386.conf b/projects/Fusion/linux/linux.i386.conf index f62efed3a5..08eb513357 100644 --- a/projects/Fusion/linux/linux.i386.conf +++ b/projects/Fusion/linux/linux.i386.conf @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/i386 3.10.0 Kernel Configuration +# Linux/i386 3.10.2 Kernel Configuration # # CONFIG_64BIT is not set CONFIG_X86_32=y @@ -1377,7 +1377,11 @@ CONFIG_B43LEGACY_PIO=y CONFIG_B43LEGACY_DMA_AND_PIO_MODE=y # CONFIG_B43LEGACY_DMA_MODE is not set # CONFIG_B43LEGACY_PIO_MODE is not set -# CONFIG_BRCMFMAC is not set +CONFIG_BRCMUTIL=m +CONFIG_BRCMFMAC=m +CONFIG_BRCMFMAC_USB=y +# CONFIG_BRCM_TRACING is not set +# CONFIG_BRCMDBG is not set CONFIG_HOSTAP=m CONFIG_HOSTAP_FIRMWARE=y CONFIG_HOSTAP_FIRMWARE_NVRAM=y diff --git a/projects/Fusion/linux/linux.x86_64.conf b/projects/Fusion/linux/linux.x86_64.conf index faad957d28..10a4e9bb94 100644 --- a/projects/Fusion/linux/linux.x86_64.conf +++ b/projects/Fusion/linux/linux.x86_64.conf @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/x86_64 3.10.0 Kernel Configuration +# Linux/x86_64 3.10.2 Kernel Configuration # CONFIG_64BIT=y CONFIG_X86_64=y @@ -1156,6 +1156,7 @@ CONFIG_TUN=m # CONFIG_NET_DSA_MV88E6131 is not set # CONFIG_NET_DSA_MV88E6123_61_65 is not set CONFIG_ETHERNET=y +CONFIG_MDIO=y # CONFIG_NET_VENDOR_3COM is not set # CONFIG_NET_VENDOR_ADAPTEC is not set # CONFIG_NET_VENDOR_ALTEON is not set @@ -1343,7 +1344,11 @@ CONFIG_B43LEGACY_PIO=y CONFIG_B43LEGACY_DMA_AND_PIO_MODE=y # CONFIG_B43LEGACY_DMA_MODE is not set # CONFIG_B43LEGACY_PIO_MODE is not set -# CONFIG_BRCMFMAC is not set +CONFIG_BRCMUTIL=m +CONFIG_BRCMFMAC=m +CONFIG_BRCMFMAC_USB=y +# CONFIG_BRCM_TRACING is not set +# CONFIG_BRCMDBG is not set CONFIG_HOSTAP=m CONFIG_HOSTAP_FIRMWARE=y CONFIG_HOSTAP_FIRMWARE_NVRAM=y diff --git a/projects/Fusion/options b/projects/Fusion/options index acc73e5e1c..dbd27ac3fa 100755 --- a/projects/Fusion/options +++ b/projects/Fusion/options @@ -206,7 +206,7 @@ AFP_SUPPORT="yes" # build and install Samba Client support (yes / no) - SAMBA_CLIENT="yes" + SAMBA_SUPPORT="yes" # build and install Samba Server (yes / no) SAMBA_SERVER="yes" @@ -295,11 +295,11 @@ # joy,lb216,lcdm001,lcterm,lirc,lis,MD8800,mdm166a, # ms6931,mtc_s16209x,MtxOrb,mx5000,NoritakeVFD, # picolcd,pyramid,sed1330,sed1520,serialPOS, -# serialVFD,shuttleVFD,sli,stv5730,SureElec,svga, +# serialVFD,shuttleVFD,sli,stv5730,SureElec,svga,vlsys_m428 # 'all' compiles all drivers; # 'all,!xxx,!yyy' de-selects previously selected drivers # "none" for disable LCD support - LCD_DRIVER="irtrans,imon,imonlcd,mdm166a,MtxOrb,lis,dm140,hd44780,CFontz,SureElec" + LCD_DRIVER="irtrans,imon,imonlcd,mdm166a,MtxOrb,lis,dm140,hd44780,CFontz,SureElec,vlsys_m428" # Modules to install in initramfs for early boot INITRAMFS_MODULES="uvesafb xhci-hcd" diff --git a/projects/Generic/linux/linux.i386.conf b/projects/Generic/linux/linux.i386.conf index 569ead3cb8..f2fe25d6e1 100644 --- a/projects/Generic/linux/linux.i386.conf +++ b/projects/Generic/linux/linux.i386.conf @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/i386 3.10.0 Kernel Configuration +# Linux/i386 3.10.2 Kernel Configuration # # CONFIG_64BIT is not set CONFIG_X86_32=y @@ -1200,6 +1200,7 @@ CONFIG_TUN=m # CONFIG_NET_DSA_MV88E6131 is not set # CONFIG_NET_DSA_MV88E6123_61_65 is not set CONFIG_ETHERNET=y +CONFIG_MDIO=y CONFIG_NET_VENDOR_3COM=y CONFIG_VORTEX=y # CONFIG_TYPHOON is not set @@ -1438,7 +1439,7 @@ CONFIG_B43LEGACY_DMA_AND_PIO_MODE=y # CONFIG_B43LEGACY_PIO_MODE is not set CONFIG_BRCMUTIL=m CONFIG_BRCMFMAC=m -CONFIG_BRCMFMAC_SDIO=y +# CONFIG_BRCMFMAC_SDIO is not set CONFIG_BRCMFMAC_USB=y # CONFIG_BRCM_TRACING is not set # CONFIG_BRCMDBG is not set diff --git a/projects/Generic/linux/linux.x86_64.conf b/projects/Generic/linux/linux.x86_64.conf index 988171ee47..67d131c21a 100644 --- a/projects/Generic/linux/linux.x86_64.conf +++ b/projects/Generic/linux/linux.x86_64.conf @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/x86_64 3.10.0 Kernel Configuration +# Linux/x86_64 3.10.2 Kernel Configuration # CONFIG_64BIT=y CONFIG_X86_64=y @@ -1181,6 +1181,7 @@ CONFIG_TUN=m # CONFIG_NET_DSA_MV88E6131 is not set # CONFIG_NET_DSA_MV88E6123_61_65 is not set CONFIG_ETHERNET=y +CONFIG_MDIO=y CONFIG_NET_VENDOR_3COM=y CONFIG_VORTEX=y # CONFIG_TYPHOON is not set @@ -1419,7 +1420,7 @@ CONFIG_B43LEGACY_DMA_AND_PIO_MODE=y # CONFIG_B43LEGACY_PIO_MODE is not set CONFIG_BRCMUTIL=m CONFIG_BRCMFMAC=m -CONFIG_BRCMFMAC_SDIO=y +# CONFIG_BRCMFMAC_SDIO is not set CONFIG_BRCMFMAC_USB=y # CONFIG_BRCM_TRACING is not set # CONFIG_BRCMDBG is not set diff --git a/projects/Generic/options b/projects/Generic/options index 0439fcace4..eb421a149b 100755 --- a/projects/Generic/options +++ b/projects/Generic/options @@ -206,7 +206,7 @@ AFP_SUPPORT="yes" # build and install Samba Client support (yes / no) - SAMBA_CLIENT="yes" + SAMBA_SUPPORT="yes" # build and install Samba Server (yes / no) SAMBA_SERVER="yes" @@ -295,11 +295,11 @@ # joy,lb216,lcdm001,lcterm,lirc,lis,MD8800,mdm166a, # ms6931,mtc_s16209x,MtxOrb,mx5000,NoritakeVFD, # picolcd,pyramid,sed1330,sed1520,serialPOS, -# serialVFD,shuttleVFD,sli,stv5730,SureElec,svga, +# serialVFD,shuttleVFD,sli,stv5730,SureElec,svga,vlsys_m428 # 'all' compiles all drivers; # 'all,!xxx,!yyy' de-selects previously selected drivers # "none" for disable LCD support - LCD_DRIVER="irtrans,imon,imonlcd,mdm166a,MtxOrb,lis,dm140,hd44780,CFontz,SureElec" + LCD_DRIVER="irtrans,imon,imonlcd,mdm166a,MtxOrb,lis,dm140,hd44780,CFontz,SureElec,vlsys_m428" # Modules to install in initramfs for early boot INITRAMFS_MODULES="uvesafb xhci-hcd" diff --git a/projects/Generic_OSS/linux/linux.i386.conf b/projects/Generic_OSS/linux/linux.i386.conf index 3e74b4c0e3..86d355806c 100644 --- a/projects/Generic_OSS/linux/linux.i386.conf +++ b/projects/Generic_OSS/linux/linux.i386.conf @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/i386 3.10.0 Kernel Configuration +# Linux/i386 3.10.2 Kernel Configuration # # CONFIG_64BIT is not set CONFIG_X86_32=y @@ -1200,6 +1200,7 @@ CONFIG_TUN=m # CONFIG_NET_DSA_MV88E6131 is not set # CONFIG_NET_DSA_MV88E6123_61_65 is not set CONFIG_ETHERNET=y +CONFIG_MDIO=y CONFIG_NET_VENDOR_3COM=y CONFIG_VORTEX=y # CONFIG_TYPHOON is not set @@ -1436,7 +1437,7 @@ CONFIG_B43LEGACY_DMA_AND_PIO_MODE=y # CONFIG_B43LEGACY_PIO_MODE is not set CONFIG_BRCMUTIL=m CONFIG_BRCMFMAC=m -CONFIG_BRCMFMAC_SDIO=y +# CONFIG_BRCMFMAC_SDIO is not set CONFIG_BRCMFMAC_USB=y # CONFIG_BRCM_TRACING is not set # CONFIG_BRCMDBG is not set diff --git a/projects/Generic_OSS/options b/projects/Generic_OSS/options index d88c5e6dd6..4cf93f83cc 100755 --- a/projects/Generic_OSS/options +++ b/projects/Generic_OSS/options @@ -206,7 +206,7 @@ AFP_SUPPORT="yes" # build and install Samba Client support (yes / no) - SAMBA_CLIENT="yes" + SAMBA_SUPPORT="yes" # build and install Samba Server (yes / no) SAMBA_SERVER="yes" @@ -295,11 +295,11 @@ # joy,lb216,lcdm001,lcterm,lirc,lis,MD8800,mdm166a, # ms6931,mtc_s16209x,MtxOrb,mx5000,NoritakeVFD, # picolcd,pyramid,sed1330,sed1520,serialPOS, -# serialVFD,shuttleVFD,sli,stv5730,SureElec,svga, +# serialVFD,shuttleVFD,sli,stv5730,SureElec,svga,vlsys_m428 # 'all' compiles all drivers; # 'all,!xxx,!yyy' de-selects previously selected drivers # "none" for disable LCD support - LCD_DRIVER="irtrans,imon,imonlcd,mdm166a,MtxOrb,lis,dm140,hd44780,CFontz,SureElec" + LCD_DRIVER="irtrans,imon,imonlcd,mdm166a,MtxOrb,lis,dm140,hd44780,CFontz,SureElec,vlsys_m428" # Modules to install in initramfs for early boot INITRAMFS_MODULES="uvesafb xhci-hcd" diff --git a/projects/ION/linux/linux.i386.conf b/projects/ION/linux/linux.i386.conf index 389b29831c..2b1821f9a0 100644 --- a/projects/ION/linux/linux.i386.conf +++ b/projects/ION/linux/linux.i386.conf @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/i386 3.10.0 Kernel Configuration +# Linux/i386 3.10.2 Kernel Configuration # # CONFIG_64BIT is not set CONFIG_X86_32=y @@ -1378,7 +1378,12 @@ CONFIG_B43_PHY_LP=y CONFIG_B43_LEDS=y # CONFIG_B43_DEBUG is not set # CONFIG_B43LEGACY is not set -# CONFIG_BRCMFMAC is not set +CONFIG_BRCMUTIL=m +CONFIG_BRCMFMAC=m +# CONFIG_BRCMFMAC_SDIO is not set +CONFIG_BRCMFMAC_USB=y +# CONFIG_BRCM_TRACING is not set +# CONFIG_BRCMDBG is not set CONFIG_HOSTAP=m CONFIG_HOSTAP_FIRMWARE=y CONFIG_HOSTAP_FIRMWARE_NVRAM=y diff --git a/projects/ION/linux/linux.x86_64.conf b/projects/ION/linux/linux.x86_64.conf index 690f271063..161b7c3851 100644 --- a/projects/ION/linux/linux.x86_64.conf +++ b/projects/ION/linux/linux.x86_64.conf @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/x86_64 3.10.0 Kernel Configuration +# Linux/x86_64 3.10.2 Kernel Configuration # CONFIG_64BIT=y CONFIG_X86_64=y @@ -1143,6 +1143,7 @@ CONFIG_TUN=m # CONFIG_NET_DSA_MV88E6131 is not set # CONFIG_NET_DSA_MV88E6123_61_65 is not set CONFIG_ETHERNET=y +CONFIG_MDIO=y # CONFIG_NET_VENDOR_3COM is not set # CONFIG_NET_VENDOR_ADAPTEC is not set # CONFIG_NET_VENDOR_ALTEON is not set @@ -1326,7 +1327,12 @@ CONFIG_B43_PHY_LP=y CONFIG_B43_LEDS=y # CONFIG_B43_DEBUG is not set # CONFIG_B43LEGACY is not set -# CONFIG_BRCMFMAC is not set +CONFIG_BRCMUTIL=m +CONFIG_BRCMFMAC=m +# CONFIG_BRCMFMAC_SDIO is not set +CONFIG_BRCMFMAC_USB=y +# CONFIG_BRCM_TRACING is not set +# CONFIG_BRCMDBG is not set CONFIG_HOSTAP=m CONFIG_HOSTAP_FIRMWARE=y CONFIG_HOSTAP_FIRMWARE_NVRAM=y diff --git a/projects/ION/options b/projects/ION/options index 197c1b68c1..a158e1b09b 100755 --- a/projects/ION/options +++ b/projects/ION/options @@ -206,7 +206,7 @@ AFP_SUPPORT="yes" # build and install Samba Client support (yes / no) - SAMBA_CLIENT="yes" + SAMBA_SUPPORT="yes" # build and install Samba Server (yes / no) SAMBA_SERVER="yes" @@ -295,11 +295,11 @@ # joy,lb216,lcdm001,lcterm,lirc,lis,MD8800,mdm166a, # ms6931,mtc_s16209x,MtxOrb,mx5000,NoritakeVFD, # picolcd,pyramid,sed1330,sed1520,serialPOS, -# serialVFD,shuttleVFD,sli,stv5730,SureElec,svga, +# serialVFD,shuttleVFD,sli,stv5730,SureElec,svga,vlsys_m428 # 'all' compiles all drivers; # 'all,!xxx,!yyy' de-selects previously selected drivers # "none" for disable LCD support - LCD_DRIVER="irtrans,imon,imonlcd,mdm166a,MtxOrb,lis,dm140,hd44780,CFontz,SureElec" + LCD_DRIVER="irtrans,imon,imonlcd,mdm166a,MtxOrb,lis,dm140,hd44780,CFontz,SureElec,vlsys_m428" # Modules to install in initramfs for early boot INITRAMFS_MODULES="uvesafb xhci-hcd" diff --git a/projects/Intel/linux/linux.i386.conf b/projects/Intel/linux/linux.i386.conf index 5e1b290b36..74a7fb69f3 100644 --- a/projects/Intel/linux/linux.i386.conf +++ b/projects/Intel/linux/linux.i386.conf @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/i386 3.10.0 Kernel Configuration +# Linux/i386 3.10.2 Kernel Configuration # # CONFIG_64BIT is not set CONFIG_X86_32=y @@ -1388,7 +1388,12 @@ CONFIG_B43_PHY_LP=y CONFIG_B43_LEDS=y # CONFIG_B43_DEBUG is not set # CONFIG_B43LEGACY is not set -# CONFIG_BRCMFMAC is not set +CONFIG_BRCMUTIL=m +CONFIG_BRCMFMAC=m +# CONFIG_BRCMFMAC_SDIO is not set +CONFIG_BRCMFMAC_USB=y +# CONFIG_BRCM_TRACING is not set +# CONFIG_BRCMDBG is not set CONFIG_HOSTAP=m CONFIG_HOSTAP_FIRMWARE=y CONFIG_HOSTAP_FIRMWARE_NVRAM=y diff --git a/projects/Intel/linux/linux.x86_64.conf b/projects/Intel/linux/linux.x86_64.conf index 8d9ce91748..6520b4e4e5 100644 --- a/projects/Intel/linux/linux.x86_64.conf +++ b/projects/Intel/linux/linux.x86_64.conf @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/x86_64 3.10.0 Kernel Configuration +# Linux/x86_64 3.10.2 Kernel Configuration # CONFIG_64BIT=y CONFIG_X86_64=y @@ -1158,6 +1158,7 @@ CONFIG_TUN=m # CONFIG_NET_DSA_MV88E6131 is not set # CONFIG_NET_DSA_MV88E6123_61_65 is not set CONFIG_ETHERNET=y +CONFIG_MDIO=y # CONFIG_NET_VENDOR_3COM is not set # CONFIG_NET_VENDOR_ADAPTEC is not set # CONFIG_NET_VENDOR_ALTEON is not set @@ -1349,7 +1350,12 @@ CONFIG_B43_PHY_LP=y CONFIG_B43_LEDS=y # CONFIG_B43_DEBUG is not set # CONFIG_B43LEGACY is not set -# CONFIG_BRCMFMAC is not set +CONFIG_BRCMUTIL=m +CONFIG_BRCMFMAC=m +# CONFIG_BRCMFMAC_SDIO is not set +CONFIG_BRCMFMAC_USB=y +# CONFIG_BRCM_TRACING is not set +# CONFIG_BRCMDBG is not set CONFIG_HOSTAP=m CONFIG_HOSTAP_FIRMWARE=y CONFIG_HOSTAP_FIRMWARE_NVRAM=y diff --git a/projects/Intel/options b/projects/Intel/options index 9cd723b2cf..d8b75e0117 100755 --- a/projects/Intel/options +++ b/projects/Intel/options @@ -206,7 +206,7 @@ AFP_SUPPORT="yes" # build and install Samba Client support (yes / no) - SAMBA_CLIENT="yes" + SAMBA_SUPPORT="yes" # build and install Samba Server (yes / no) SAMBA_SERVER="yes" @@ -295,11 +295,11 @@ # joy,lb216,lcdm001,lcterm,lirc,lis,MD8800,mdm166a, # ms6931,mtc_s16209x,MtxOrb,mx5000,NoritakeVFD, # picolcd,pyramid,sed1330,sed1520,serialPOS, -# serialVFD,shuttleVFD,sli,stv5730,SureElec,svga, +# serialVFD,shuttleVFD,sli,stv5730,SureElec,svga,vlsys_m428 # 'all' compiles all drivers; # 'all,!xxx,!yyy' de-selects previously selected drivers # "none" for disable LCD support - LCD_DRIVER="irtrans,imon,imonlcd,mdm166a,MtxOrb,lis,dm140,hd44780,CFontz,SureElec" + LCD_DRIVER="irtrans,imon,imonlcd,mdm166a,MtxOrb,lis,dm140,hd44780,CFontz,SureElec,vlsys_m428" # Modules to install in initramfs for early boot INITRAMFS_MODULES="xhci-hcd" diff --git a/projects/RPi/linux/linux.arm.conf b/projects/RPi/linux/linux.arm.conf index ea284fd915..3611556bee 100644 --- a/projects/RPi/linux/linux.arm.conf +++ b/projects/RPi/linux/linux.arm.conf @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm 3.10.0 Kernel Configuration +# Linux/arm 3.10.2 Kernel Configuration # CONFIG_ARM=y CONFIG_SYS_SUPPORTS_APM_EMULATION=y @@ -956,7 +956,12 @@ CONFIG_B43_LEDS=y CONFIG_B43_HWRNG=y # CONFIG_B43_DEBUG is not set # CONFIG_B43LEGACY is not set -# CONFIG_BRCMFMAC is not set +CONFIG_BRCMUTIL=m +CONFIG_BRCMFMAC=m +# CONFIG_BRCMFMAC_SDIO is not set +CONFIG_BRCMFMAC_USB=y +# CONFIG_BRCM_TRACING is not set +# CONFIG_BRCMDBG is not set # CONFIG_HOSTAP is not set # CONFIG_LIBERTAS is not set CONFIG_P54_COMMON=m diff --git a/projects/RPi/options b/projects/RPi/options index c381d3bb3a..4f9904e6e1 100755 --- a/projects/RPi/options +++ b/projects/RPi/options @@ -206,7 +206,7 @@ AFP_SUPPORT="yes" # build and install Samba Client support (yes / no) - SAMBA_CLIENT="yes" + SAMBA_SUPPORT="yes" # build and install Samba Server (yes / no) SAMBA_SERVER="yes" @@ -295,11 +295,11 @@ # joy,lb216,lcdm001,lcterm,lirc,lis,MD8800,mdm166a, # ms6931,mtc_s16209x,MtxOrb,mx5000,NoritakeVFD, # picolcd,pyramid,sed1330,sed1520,serialPOS, -# serialVFD,shuttleVFD,sli,stv5730,SureElec,svga, +# serialVFD,shuttleVFD,sli,stv5730,SureElec,svga,vlsys_m428 # 'all' compiles all drivers; # 'all,!xxx,!yyy' de-selects previously selected drivers # "none" for disable LCD support - LCD_DRIVER="irtrans,imon,imonlcd,mdm166a,MtxOrb,lis,dm140,hd44780,CFontz,SureElec" + LCD_DRIVER="irtrans,imon,imonlcd,mdm166a,MtxOrb,lis,dm140,hd44780,CFontz,SureElec,vlsys_m428" # Modules to install in initramfs for early boot INITRAMFS_MODULES="" diff --git a/projects/RPi/patches/linux/linux-01-RPi_support-2fa497b.patch b/projects/RPi/patches/linux/linux-01-RPi_support-b04d3b1.patch similarity index 98% rename from projects/RPi/patches/linux/linux-01-RPi_support-2fa497b.patch rename to projects/RPi/patches/linux/linux-01-RPi_support-b04d3b1.patch index 43e658b2bd..d1ba3eb691 100644 --- a/projects/RPi/patches/linux/linux-01-RPi_support-2fa497b.patch +++ b/projects/RPi/patches/linux/linux-01-RPi_support-b04d3b1.patch @@ -1,7 +1,7 @@ -From 6080f53cd84a39e1c8245ad0730fb1a3011f0769 Mon Sep 17 00:00:00 2001 +From c8c2c38e2e6f946c4eb5bec85a4d119f9e4187fb Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 12 May 2013 12:24:19 +0100 -Subject: [PATCH 01/91] Main bcm2708 linux port +Subject: [PATCH 01/99] Main bcm2708 linux port Signed-off-by: popcornmix --- @@ -8259,10 +8259,10 @@ index b838ffc..f3a39c1 100644 1.8.1.6 -From 17f5dfb674bf0a817f8f3075d4d16ea0da3e2451 Mon Sep 17 00:00:00 2001 +From ebc13205d511583860ae7ba112a89135329c4dda Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 1 May 2013 19:46:17 +0100 -Subject: [PATCH 02/91] Add dwc_otg driver +Subject: [PATCH 02/99] Add dwc_otg driver Signed-off-by: popcornmix --- @@ -65341,10 +65341,10 @@ index 0000000..abcf284 1.8.1.6 -From 08a588f1e93ac1f3ca0eaa232928b0a3a67a6544 Mon Sep 17 00:00:00 2001 +From e5b4e5d798579eb1f9e596acf6c17b0549e2f873 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 1 May 2013 19:54:32 +0100 -Subject: [PATCH 03/91] bcm2708 watchdog driver +Subject: [PATCH 03/99] bcm2708 watchdog driver Signed-off-by: popcornmix --- @@ -65778,10 +65778,10 @@ index 0000000..dd33c35 1.8.1.6 -From 9aa24fa38df74e7bb63e7c5f1e6f0cd7930926f4 Mon Sep 17 00:00:00 2001 +From 378f91f6bc45eb06c549f8cf1b09995715327701 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 1 May 2013 19:55:09 +0100 -Subject: [PATCH 04/91] bcm2708 framebuffer driver +Subject: [PATCH 04/99] bcm2708 framebuffer driver Signed-off-by: popcornmix --- @@ -68816,10 +68816,10 @@ index 3c14e43..7626beb 100644 1.8.1.6 -From 0a4f13f76c049e4819d9f80cf754e0681c299c06 Mon Sep 17 00:00:00 2001 +From da834fbe72658bafb431c63b0160b0a57a0ea06d Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 2 Jul 2013 23:42:01 +0100 -Subject: [PATCH 05/91] bcm2708 vchiq driver +Subject: [PATCH 05/99] bcm2708 vchiq driver Signed-off-by: popcornmix --- @@ -81267,10 +81267,10 @@ index 0000000..b6bfa21 1.8.1.6 -From a2d8faeec6f4dfa0f81df73ecf86d58f2d25bf8f Mon Sep 17 00:00:00 2001 +From 00bd6a3906ca51ab52a07aad2c908fc76b1da39c Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 3 Jul 2013 00:31:47 +0100 -Subject: [PATCH 06/91] cma: Add vc_cma driver to enable use of CMA +Subject: [PATCH 06/99] cma: Add vc_cma driver to enable use of CMA Signed-off-by: popcornmix --- @@ -82566,10 +82566,10 @@ index 0000000..bdc9d79 1.8.1.6 -From 9171ef805ac273e7eabf444b3338ed3a42d7070d Mon Sep 17 00:00:00 2001 +From d7f919d0ce6207f0e98520ca9045f4dc18de52c9 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 26 Mar 2012 22:15:50 +0100 -Subject: [PATCH 07/91] bcm2708: alsa sound driver +Subject: [PATCH 07/99] bcm2708: alsa sound driver Signed-off-by: popcornmix --- @@ -84892,10 +84892,10 @@ index 0000000..af3e6eb 1.8.1.6 -From debf621c3999ce1d7ff13cbcc8de7beaa85aa14d Mon Sep 17 00:00:00 2001 +From bf8b3a360e26791caa1d9114df7c80d5c27a0711 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 26 Mar 2013 17:26:38 +0000 -Subject: [PATCH 08/91] Allow mac address to be set in smsc95xx +Subject: [PATCH 08/99] Allow mac address to be set in smsc95xx Signed-off-by: popcornmix --- @@ -84989,10 +84989,10 @@ index 3f38ba8..60076fe 100644 1.8.1.6 -From b4a73b853b9734a668aaacdb4b5935bcc883695b Mon Sep 17 00:00:00 2001 +From 43f606bf172f727d4d65c74c4f42cf58db19fcf8 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 8 May 2012 23:12:13 +0100 -Subject: [PATCH 09/91] possible fix for sdcard missing status. Thank naren +Subject: [PATCH 09/99] possible fix for sdcard missing status. Thank naren --- drivers/mmc/host/sdhci-bcm2708.c | 9 +++++++++ @@ -85029,10 +85029,10 @@ index e79723d..a405114 100644 1.8.1.6 -From 93779f0e37d786e6360ea7b388ddbc76c3cf4daf Mon Sep 17 00:00:00 2001 +From d725e274b999e4326449ff3629066edb42d00c3a Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 17 May 2012 14:44:19 +0100 -Subject: [PATCH 10/91] sdcard patch improvements from naren +Subject: [PATCH 10/99] sdcard patch improvements from naren --- drivers/mmc/host/sdhci-bcm2708.c | 23 +++++++---------------- @@ -85091,10 +85091,10 @@ index a405114..ae8edf7 100644 1.8.1.6 -From c79be143c5db0159c96c8301b1ae4ce50bebeeb1 Mon Sep 17 00:00:00 2001 +From 14a9f7efae05898a45ac550af36323e2c9682e28 Mon Sep 17 00:00:00 2001 From: Grigori Goronzy Date: Mon, 4 Jun 2012 04:27:48 +0200 -Subject: [PATCH 11/91] sdhci-bcm2708: speed up DMA sync +Subject: [PATCH 11/99] sdhci-bcm2708: speed up DMA sync Experiments show that it doesn't really take that long to sync, so we can reduce the poll interval slightly. Might improve performance a bit. @@ -85119,10 +85119,10 @@ index ae8edf7..a6bdc25 100644 1.8.1.6 -From 7e3d10edf2cb0657e032863034b280697eb92d32 Mon Sep 17 00:00:00 2001 +From ad970a2722da54be80dc810d81c75a6938d3e58a Mon Sep 17 00:00:00 2001 From: Grigori Goronzy Date: Mon, 11 Jun 2012 18:52:04 +0200 -Subject: [PATCH 12/91] sdhci-bcm2708: remove custom clock handling +Subject: [PATCH 12/99] sdhci-bcm2708: remove custom clock handling The custom clock handling code is redundant and buggy. The MMC/SDHCI subsystem does a better job than it, so remove it for good. @@ -85220,10 +85220,10 @@ index a6bdc25..0ed4d85 100644 1.8.1.6 -From 864e235c6c115a57215cfa40107b180a3d61e3a0 Mon Sep 17 00:00:00 2001 +From 38cd27c91c8ea233aec8ae9477a2108a3ca519ea Mon Sep 17 00:00:00 2001 From: Grigori Goronzy Date: Mon, 11 Jun 2012 18:53:59 +0200 -Subject: [PATCH 13/91] sdhci-bcm2708: add additional quirks +Subject: [PATCH 13/99] sdhci-bcm2708: add additional quirks Some additional quirks are needed for correct operation. There's no SDHCI capabilities register documented, and it always reads @@ -85253,10 +85253,10 @@ index 0ed4d85..3001836 100644 1.8.1.6 -From f012cd2c3be22b5ac4b6bd2e7fed17b5a47a376c Mon Sep 17 00:00:00 2001 +From f14d342ff13c3262cb31b9138cd1d3833c75a5a7 Mon Sep 17 00:00:00 2001 From: Grigori Goronzy Date: Mon, 11 Jun 2012 18:57:13 +0200 -Subject: [PATCH 14/91] sdhci-bcm2708: add allow_highspeed parameter +Subject: [PATCH 14/99] sdhci-bcm2708: add allow_highspeed parameter Add a parameter to disable high-speed mode for the few cards that still might have problems. High-speed mode is enabled by default. @@ -85304,10 +85304,10 @@ index 3001836..c64de21 100644 1.8.1.6 -From de4d917a430e9b1c6ee890eb02e707bdbb5551b7 Mon Sep 17 00:00:00 2001 +From 02fd8aacce57a8c77e02ceb3e6aff3e46fb06a72 Mon Sep 17 00:00:00 2001 From: Grigori Goronzy Date: Mon, 11 Jun 2012 18:58:40 +0200 -Subject: [PATCH 15/91] sdhci-bcm2708: assume 50 MHz eMMC clock +Subject: [PATCH 15/99] sdhci-bcm2708: assume 50 MHz eMMC clock 80 MHz clock isnt't suited well to be dividable to get SD clocks of 25 MHz (default mode) or 50 MHz (high speed mode). 50 MHz are perfect to @@ -85333,10 +85333,10 @@ index c64de21..d174938 100644 1.8.1.6 -From ca9519b849238cc00d7fdc045683476152cd680d Mon Sep 17 00:00:00 2001 +From 2186ee5f876aad0d666d6f31692ad2a883f60196 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 16 Jun 2012 22:31:55 +0100 -Subject: [PATCH 16/91] Allow emmc clock to be specified as command line +Subject: [PATCH 16/99] Allow emmc clock to be specified as command line parameter --- @@ -85383,10 +85383,10 @@ index d174938..0ee983c 100644 1.8.1.6 -From 68681c00fe7e60b3d3205d24531b2a10d8596ea7 Mon Sep 17 00:00:00 2001 +From bd13f67e2f81a783890c9083fcba77dde0b29809 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 16 Jun 2012 22:35:38 +0100 -Subject: [PATCH 17/91] sdhci-bcm2708: raise DMA sync timeout +Subject: [PATCH 17/99] sdhci-bcm2708: raise DMA sync timeout Commit d64b84c by accident reduced the maximum overall DMA sync timeout. The maximum overall timeout was reduced from 100ms to 30ms, @@ -85416,10 +85416,10 @@ index 0ee983c..b0cdd7d 100644 1.8.1.6 -From db66a7b0ff1eb7b63ba25003405f7e67d59d497e Mon Sep 17 00:00:00 2001 +From a892f560e785c614c47ef60fc38950e47cf644be Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 22 Jun 2012 12:57:42 +0100 -Subject: [PATCH 18/91] Use ndelay rather than udelay. Thanks lb +Subject: [PATCH 18/99] Use ndelay rather than udelay. Thanks lb --- drivers/mmc/host/sdhci-bcm2708.c | 8 ++++---- @@ -85466,10 +85466,10 @@ index b0cdd7d..7bba950 100644 1.8.1.6 -From 71392b4e1322e0cd972cb3e7b8efa88b37f3578e Mon Sep 17 00:00:00 2001 +From 20c684aea3aafbbb1424905b7cd63e241db44b88 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 3 Jul 2013 00:41:10 +0100 -Subject: [PATCH 19/91] Backport of Chris Boot's i2c and spi drivers. +Subject: [PATCH 19/99] Backport of Chris Boot's i2c and spi drivers. --- arch/arm/configs/bcmrpi_cutdown_defconfig | 10 + @@ -86758,10 +86758,10 @@ index 0000000..9f1580e 1.8.1.6 -From 30d5060bcf0883c2b72e362bd76d2d32ea90ba2a Mon Sep 17 00:00:00 2001 +From fa218dd798563865e7d1845fbd3cdf88ddac4568 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 19 Jul 2012 16:00:28 +0100 -Subject: [PATCH 20/91] Add SPI_SPI_DEV module +Subject: [PATCH 20/99] Add SPI_SPI_DEV module --- arch/arm/configs/bcmrpi_defconfig | 1 + @@ -86783,10 +86783,10 @@ index 6219df3..31f5afaa 100644 1.8.1.6 -From 0139a2bbd4f30ba7b59a44d7f11a38c8ae15c24c Mon Sep 17 00:00:00 2001 +From 65bfccc3a8523cef7b80230e972f4d6fff68bcc8 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 13 Jul 2012 18:34:18 +0100 -Subject: [PATCH 21/91] Fix for quitting X hang. Interrupted mailbox reads are +Subject: [PATCH 21/99] Fix for quitting X hang. Interrupted mailbox reads are not something we can reliably recover from, so down_interruptable is not a safe call. @@ -86821,10 +86821,10 @@ index 799a0ac..3874051 100644 1.8.1.6 -From a53fbe6aab3b6e996741b0bc12b964c5c39c5da3 Mon Sep 17 00:00:00 2001 +From 98a3d88e3a7f8e3e51f0a7e87bacf9779bbeac06 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 17 Jul 2012 00:48:27 +0100 -Subject: [PATCH 22/91] Add sync_after_dma module parameter +Subject: [PATCH 22/99] Add sync_after_dma module parameter --- drivers/mmc/host/sdhci-bcm2708.c | 60 +++++++++++++++++++++------------------- @@ -86941,10 +86941,10 @@ index 7bba950..3792b9f 100644 1.8.1.6 -From d55680e3f7f80bb0cfd1cff2b94e2e00874e7ade Mon Sep 17 00:00:00 2001 +From 53a6e2c9df4180d614cd49425b0387569788f4a8 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 12 May 2013 12:25:52 +0100 -Subject: [PATCH 23/91] sdhci-bcm2708: use extension FIFO to buffer DMA +Subject: [PATCH 23/99] sdhci-bcm2708: use extension FIFO to buffer DMA transfers The additional FIFO might speed up transfers in some cases. @@ -86996,10 +86996,10 @@ index 3792b9f..326b962 100644 1.8.1.6 -From 55cdffec9f1d501823c9899867f775b97fa38785 Mon Sep 17 00:00:00 2001 +From 889c54183fcb491aa8738f73b569c8f64a2f83b6 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 3 Jul 2013 00:42:49 +0100 -Subject: [PATCH 24/91] sdhci-bcm2708: use multiblock-type transfers for single +Subject: [PATCH 24/99] sdhci-bcm2708: use multiblock-type transfers for single blocks There are issues with both single block reads (missed completion) @@ -87055,10 +87055,10 @@ index e326ae2..70020e3 100644 1.8.1.6 -From ce3c78e01628a7fd80625223a2377a6c58562b0e Mon Sep 17 00:00:00 2001 +From 3dbb84a60f62598345aa3a5aa0478753c8d2058f Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 1 Aug 2012 19:02:14 +0100 -Subject: [PATCH 25/91] Add module parameter for missing_status quirk. +Subject: [PATCH 25/99] Add module parameter for missing_status quirk. sdhci-bcm2708.missing_status=0 may improve interrupt latency --- @@ -87114,10 +87114,10 @@ index c6d6bb0..8243593 100644 1.8.1.6 -From 6fa717aa060b8d60006aa6bee5f223884d5f8bcf Mon Sep 17 00:00:00 2001 +From 669d28370d45ac6cfe4dc07b2889abffbd1aff52 Mon Sep 17 00:00:00 2001 From: ddv2005 Date: Sun, 5 Aug 2012 10:42:12 -0400 -Subject: [PATCH 26/91] Fix spinlock recursion in sdhci-bcm2708.c +Subject: [PATCH 26/99] Fix spinlock recursion in sdhci-bcm2708.c --- drivers/mmc/host/sdhci-bcm2708.c | 14 +++++++------- @@ -87186,10 +87186,10 @@ index 8243593..7a703c2 100644 1.8.1.6 -From eba5eb2eae782a05538df7404ef4dfa00403144e Mon Sep 17 00:00:00 2001 +From bb9a79055bf7d1596b9f1c6d08c9526fa3d616ed Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 21 Aug 2012 18:49:44 +0100 -Subject: [PATCH 27/91] Read memory size for vc_mem through mailbox property +Subject: [PATCH 27/99] Read memory size for vc_mem through mailbox property channel --- @@ -87360,10 +87360,10 @@ index fd9d4be..7a7748e 100644 1.8.1.6 -From 23effc5826fd97a33418646601e5aea1cef1143d Mon Sep 17 00:00:00 2001 +From 375ad1bb17db91b98602924bbbbc6a9ac7fa5e11 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 8 May 2013 11:46:50 +0100 -Subject: [PATCH 28/91] enabling the realtime clock 1-wire chip DS1307 and +Subject: [PATCH 28/99] enabling the realtime clock 1-wire chip DS1307 and 1-wire on GPIO4 (as a module) --- @@ -87426,10 +87426,10 @@ index 510be0b..d61e747 100644 1.8.1.6 -From 6bfb747cf6be7dd680c15753d78ffcc9117fabb2 Mon Sep 17 00:00:00 2001 +From 4154023606fb33c371aca4c5075218b0df54d864 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 12 May 2013 12:27:48 +0100 -Subject: [PATCH 29/91] Add low-latency mode to sdcard driver. Disable with +Subject: [PATCH 29/99] Add low-latency mode to sdcard driver. Disable with sdhci-bcm2708.enable_llm=0. Thanks ddv2005. --- @@ -87952,10 +87952,10 @@ index f3a39c1..58bfab0 100644 1.8.1.6 -From 56b675fceebb97e27686cdfaa918591d28e6f1bb Mon Sep 17 00:00:00 2001 +From 681651078bf2d1cad92b3eb803ccb5f141b06db0 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 3 Jul 2013 00:46:42 +0100 -Subject: [PATCH 30/91] Add FIQ patch to dwc_otg driver. Enable with +Subject: [PATCH 30/99] Add FIQ patch to dwc_otg driver. Enable with dwc_otg.fiq_fix_enable=1. Should give about 10% more ARM performance. Thanks to Gordon and Costas @@ -89115,10 +89115,10 @@ index a7e9076..bb1c42d 100644 1.8.1.6 -From d2c50dbe9f75e1b89aadfb87eafea7874ec0fe63 Mon Sep 17 00:00:00 2001 +From 02516ae111bbdec2a3e03ef8f42e6a54f7ebc48d Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 12 Apr 2013 23:58:47 +0100 -Subject: [PATCH 33/91] Add verious user config requests. +Subject: [PATCH 33/99] Add verious user config requests. CONFIG_DEVTMPFS_MOUNT, CONFIG_NFS_V4_1=y CONFIG_NFSD_V3_ACL=y CONFIG_NFSD_V4=y, drbd and IPSEC modules @@ -89528,10 +89528,10 @@ index 31f5afaa..ef43466 100644 1.8.1.6 -From 41886846d6954160e12a8a615670aa75c008f74c Mon Sep 17 00:00:00 2001 +From d9f05b5596f47c80bebf7acd9a2bbce6d4521375 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 8 Sep 2012 15:17:53 +0100 -Subject: [PATCH 34/91] Avoid dynamic memory allocation for channel lock in USB +Subject: [PATCH 34/99] Avoid dynamic memory allocation for channel lock in USB driver. Thanks ddv2005. --- @@ -89638,10 +89638,10 @@ index f1658fa..21e8f09 100644 1.8.1.6 -From f7ac5d29e294fd756c952b0a58fba1ede77221e5 Mon Sep 17 00:00:00 2001 +From b7e56e22e1128f99388c5869769590c812ee3467 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 3 Jul 2013 00:49:20 +0100 -Subject: [PATCH 35/91] Add cpufreq driver +Subject: [PATCH 35/99] Add cpufreq driver --- arch/arm/Kconfig | 1 + @@ -90168,10 +90168,10 @@ index 0000000..aa6fc66 1.8.1.6 -From 9a13f810caf54c783f29731af4a50da242bca676 Mon Sep 17 00:00:00 2001 +From bde86bb81df0a9119108b8baadd3c87bc7394167 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 8 Apr 2013 21:12:48 +0100 -Subject: [PATCH 36/91] Add NAK holdoff scheme. Enabled by default, disable +Subject: [PATCH 36/99] Add NAK holdoff scheme. Enabled by default, disable with dwc_otg.nak_holdoff_enable=0. Thanks gsh --- @@ -90381,10 +90381,10 @@ index ac10323..e6b2a7b 100644 1.8.1.6 -From 8a29d2cd7f9c46ad76010620b3fca8082dd34f1f Mon Sep 17 00:00:00 2001 +From c9748c8b0dab670e3e963708b253b471a14cc4b6 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 26 Mar 2013 19:24:24 +0000 -Subject: [PATCH 37/91] Added hwmon/thermal driver for reporting core +Subject: [PATCH 37/99] Added hwmon/thermal driver for reporting core temperature. Thanks Dorian --- @@ -90908,10 +90908,10 @@ index 0000000..f1ecdb2 1.8.1.6 -From f10623b14323b7fd230da611043b7098b0353cba Mon Sep 17 00:00:00 2001 +From 278f0aa4868514d23a3c21fd71782638105b3cc1 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 12 Apr 2013 23:59:27 +0100 -Subject: [PATCH 38/91] Add config options for thermal sensor, L2TP, +Subject: [PATCH 38/99] Add config options for thermal sensor, L2TP, RT2800USB_UNKNOWN, and various I2C and SPI RTCs. Tidy of thermal driver. --- @@ -91079,10 +91079,10 @@ index f1ecdb2..3f9a733 100644 1.8.1.6 -From d7c871a20faf02c4a9e4fa9434f7109c870de68a Mon Sep 17 00:00:00 2001 +From cb7b29a8bab3312bea4b37cff8fb08477a9dd280 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 28 Mar 2013 01:19:54 +0000 -Subject: [PATCH 39/91] 2708fb: Remove some unnecessary dmesg output. +Subject: [PATCH 39/99] 2708fb: Remove some unnecessary dmesg output. --- drivers/video/bcm2708_fb.c | 34 +++++++++++++++++++--------------- @@ -91209,10 +91209,10 @@ index c82dd90..08d9238 100644 1.8.1.6 -From 80027aa78529bb27b8b368eecdc73ddb99b87dca Mon Sep 17 00:00:00 2001 +From 317d5b4df2b5ef8a2227d778a3d267657940d8f5 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 28 Mar 2013 01:20:34 +0000 -Subject: [PATCH 40/91] cpufreq: Remove some unnecessary dmesg output. +Subject: [PATCH 40/99] cpufreq: Remove some unnecessary dmesg output. --- drivers/cpufreq/bcm2835-cpufreq.c | 2 +- @@ -91235,10 +91235,10 @@ index aa6fc66..6ff1edb 100755 1.8.1.6 -From c1d625a495bda54a60b56a5bd0f5449b7ac53d49 Mon Sep 17 00:00:00 2001 +From 371d191f321a252cfac87e7ffb09e24cc6e0f452 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 17 Sep 2012 22:57:29 +0100 -Subject: [PATCH 41/91] Switch to powersave governor. We'll enable ondemand in +Subject: [PATCH 41/99] Switch to powersave governor. We'll enable ondemand in the distribution --- @@ -91266,10 +91266,10 @@ index d11f688..c1afa47 100644 1.8.1.6 -From c33b7bcc3a6de49b94381096f6a0c2e4879682af Mon Sep 17 00:00:00 2001 +From 707f3a7af88b74b654c77687f276e1afbc480e82 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 17 Apr 2013 12:16:36 +0100 -Subject: [PATCH 42/91] Enable multiple ALSA channels +Subject: [PATCH 42/99] Enable multiple ALSA channels --- arch/arm/mach-bcm2708/bcm2708.c | 54 ++++++++++++++++++++++++++++++++++++----- @@ -91344,10 +91344,10 @@ index 2875cd2..27e9553 100644 1.8.1.6 -From 86cd9547f7bc2f8c427e34527be3d8e27a44f298 Mon Sep 17 00:00:00 2001 +From a6db2e423dc8ce4d6fa43c2237258805a1146ee5 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 3 Oct 2012 20:08:19 +0100 -Subject: [PATCH 43/91] set i2c speed via module-parameter or menuconfig. +Subject: [PATCH 43/99] set i2c speed via module-parameter or menuconfig. Thanks FrankBoesing --- @@ -91422,10 +91422,10 @@ index 7cae615..3391889 100644 1.8.1.6 -From dc1c709396bd2711af5c4e285a223bb0f026244f Mon Sep 17 00:00:00 2001 +From 1d18bb9dd8c8b62e45cad2d0dcc30eaecc2c6a69 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 3 Oct 2012 21:31:48 +0100 -Subject: [PATCH 44/91] Allow the number of cycles delay between sdcard +Subject: [PATCH 44/99] Allow the number of cycles delay between sdcard peripheral writes to be specified on command line with sdhci-bcm2708.cycle_delay @@ -91467,10 +91467,10 @@ index 7ce2829..ffd7310 100644 1.8.1.6 -From c372f2d12122085d55d03268a0cb4c2d670a7064 Mon Sep 17 00:00:00 2001 +From 4aecef94dd8c0705a023c89db4c370500f340e10 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 17 Apr 2013 14:37:25 +0100 -Subject: [PATCH 45/91] Fix vc-mem by using module parameters +Subject: [PATCH 45/99] Fix vc-mem by using module parameters --- arch/arm/mach-bcm2708/bcm2708.c | 12 ++--- @@ -91705,10 +91705,10 @@ index 5ef68b3..057f74f 100644 1.8.1.6 -From 9578fd3da96819661e04f6d856c3fd0cb4d4dcdf Mon Sep 17 00:00:00 2001 +From d4d52a1403731c1c673e97be27b28d9e3a8a4136 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 5 Oct 2012 22:44:47 +0100 -Subject: [PATCH 46/91] Support dummy vc-mem ioctl used by vcdbg +Subject: [PATCH 46/99] Support dummy vc-mem ioctl used by vcdbg --- arch/arm/mach-bcm2708/include/mach/vc_mem.h | 1 + @@ -91756,10 +91756,10 @@ index 057f74f..aeae4d5 100644 1.8.1.6 -From 321f91d1c01a6dfb91ccc3a05d01f487ddb67c5e Mon Sep 17 00:00:00 2001 +From ea6d83f5c4fa383d86f7b8c410c62cceea3ecb36 Mon Sep 17 00:00:00 2001 From: dero Date: Mon, 19 Nov 2012 12:46:06 +0100 -Subject: [PATCH 47/91] Lazy CRC quirk: Implemented retrying mechanisms for SD +Subject: [PATCH 47/99] Lazy CRC quirk: Implemented retrying mechanisms for SD SSR and SCR, disabled missing_status and spurious CRC ACMD51 quirks by default (should be fixed by the retrying-mechanishm) @@ -91991,10 +91991,10 @@ index ffd7310..3556ed3 100644 1.8.1.6 -From 5fd69f8d1c8b53b52319bb712c9d925b429caa5e Mon Sep 17 00:00:00 2001 +From 3bcecc233a96399a4e88a2a209a34fcfac8dc3fd Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 28 Mar 2013 00:10:32 +0000 -Subject: [PATCH 48/91] bcm2708: Add vc_cma driver to enable use of CMA +Subject: [PATCH 48/99] bcm2708: Add vc_cma driver to enable use of CMA --- arch/arm/mach-bcm2708/bcm2708.c | 18 ++++++++++++++++++ @@ -92055,10 +92055,10 @@ index e010515..9d38d40 100644 1.8.1.6 -From b243d68cd0e3e1ac8fe4d9313e44a6c94886ee5a Mon Sep 17 00:00:00 2001 +From 027f6c9ff7ef276abc540ad4269803884d3099e2 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 24 Oct 2012 22:00:43 +0100 -Subject: [PATCH 49/91] Fix reboot with new restart method of machine driver +Subject: [PATCH 49/99] Fix reboot with new restart method of machine driver --- arch/arm/mach-bcm2708/bcm2708.c | 18 +++++++++++++++++- @@ -92136,10 +92136,10 @@ index bc9d458..2d0b821 100644 1.8.1.6 -From dafd5e9e557ffa7494f6a5c11ab62b5c2dab6139 Mon Sep 17 00:00:00 2001 +From 5a11b596dde3ab3f1ed7e3bc26ba213461c5aa35 Mon Sep 17 00:00:00 2001 From: Gordon Hollingworth Date: Sun, 4 Nov 2012 15:55:01 +0000 -Subject: [PATCH 50/91] Make sure we wait for the reset to finish +Subject: [PATCH 50/99] Make sure we wait for the reset to finish --- drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c | 2 ++ @@ -92162,10 +92162,10 @@ index 3e762e2..e8c91e7 100644 1.8.1.6 -From cf9d13622e80e613716a03de85045247d7382bfd Mon Sep 17 00:00:00 2001 +From 4b12c94e5ad7ea1e93ba52d7c6160cc0fefd4c61 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 19 Nov 2012 18:27:05 +0000 -Subject: [PATCH 51/91] Add Simon Hall's dma helper module, useful in future +Subject: [PATCH 51/99] Add Simon Hall's dma helper module, useful in future for X acceleration --- @@ -93503,10 +93503,10 @@ index 0000000..5cb1335 1.8.1.6 -From 6ffd27277fcf553852d92aa961714aef6104d98e Mon Sep 17 00:00:00 2001 +From 7ba8d6a7442791f9c67095d49705ce9fa94c58a3 Mon Sep 17 00:00:00 2001 From: Aron Szabo Date: Sat, 16 Jun 2012 12:15:55 +0200 -Subject: [PATCH 52/91] lirc: added support for RaspberryPi GPIO +Subject: [PATCH 52/99] lirc: added support for RaspberryPi GPIO --- drivers/staging/media/lirc/Kconfig | 6 + @@ -94241,10 +94241,10 @@ index 0000000..96acab0 1.8.1.6 -From bcf9c84e3c30f79d9beae9bad42f7a18ccd15c3c Mon Sep 17 00:00:00 2001 +From 8372f6fe360b00d43a27f3fce9b24a47d088dd75 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 25 Nov 2012 18:28:09 +0000 -Subject: [PATCH 53/91] Allow mailbox driver to be called from user code though +Subject: [PATCH 53/99] Allow mailbox driver to be called from user code though ioctl --- @@ -94481,10 +94481,10 @@ index 468fdef..09b78b5 100644 1.8.1.6 -From f7048aa2a847de942629ce21d11345a57c2e66e4 Mon Sep 17 00:00:00 2001 +From 3182ee5f146dddc9bbcbb4d73c670b5a5b6c2866 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 11 Dec 2012 18:23:03 +0000 -Subject: [PATCH 54/91] Default to dwc_otp.lpm_enable=0 +Subject: [PATCH 54/99] Default to dwc_otp.lpm_enable=0 --- drivers/usb/host/dwc_otg/dwc_otg_driver.c | 2 +- @@ -94507,10 +94507,10 @@ index d353a9a..cea8fcb 100644 1.8.1.6 -From a49eddff6d55578a3caa1d2e5cd11c92df4f278a Mon Sep 17 00:00:00 2001 +From d25b264279de2a98dfeb74d68dd8b6bb8838ef93 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 11 Dec 2012 19:04:27 +0000 -Subject: [PATCH 55/91] Increase default coherent pool so vchiq starts up +Subject: [PATCH 55/99] Increase default coherent pool so vchiq starts up --- arch/arm/mach-bcm2708/bcm2708.c | 4 +--- @@ -94535,10 +94535,10 @@ index 9f456e9..87fd348 100644 1.8.1.6 -From f5adca2359cd6b7bb40d41ddc66e290141e05a58 Mon Sep 17 00:00:00 2001 +From 540d544c17f3ee3614f50c7807989639ba15fc91 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 7 Jan 2013 21:34:59 +0000 -Subject: [PATCH 56/91] Add mutex around bcm_mailbox_property function +Subject: [PATCH 56/99] Add mutex around bcm_mailbox_property function --- arch/arm/mach-bcm2708/vcio.c | 5 ++++- @@ -94578,10 +94578,10 @@ index 09b78b5..599eb63 100644 1.8.1.6 -From de86ee42fc5f624a9879bce5b2603c0555741016 Mon Sep 17 00:00:00 2001 +From db66ac826bbca8163eaa233ae74d93611a1d6830 Mon Sep 17 00:00:00 2001 From: P33M Date: Wed, 9 Jan 2013 16:12:04 +0000 -Subject: [PATCH 57/91] dwc_otg: fix bug in dwc_otg_hcd.c resulting in silent +Subject: [PATCH 57/99] dwc_otg: fix bug in dwc_otg_hcd.c resulting in silent kernel memory corruption, escalating to OOPS under high USB load. --- @@ -94618,10 +94618,10 @@ index e6b2a7b..b337e1b 100644 1.8.1.6 -From f6156c223969196d360586d6e09d81a1fe85e8de Mon Sep 17 00:00:00 2001 +From 6be8954eb70b616249353fdf4ea69d4c43df36aa Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 21 Jan 2013 23:03:53 +0000 -Subject: [PATCH 58/91] Return error value from bcm2708_setup_state. Thanks +Subject: [PATCH 58/99] Return error value from bcm2708_setup_state. Thanks notro --- @@ -94644,10 +94644,10 @@ index 9f1580e..8513704 100644 1.8.1.6 -From 3c635bdecfe28dbbaabaf0f7afc9f70066d470ab Mon Sep 17 00:00:00 2001 +From 1962bb39b3a61eac199da29f057c5998a3b3fb26 Mon Sep 17 00:00:00 2001 From: Kamal Mostafa Date: Mon, 22 Oct 2012 15:52:44 -0700 -Subject: [PATCH 59/91] spi/spi-bcm2708: respect per-transfer SPI clock +Subject: [PATCH 59/99] spi/spi-bcm2708: respect per-transfer SPI clock speed_hz value The bcm2708 SPI driver's bcm2708_process_transfer() was ignoring the @@ -94692,10 +94692,10 @@ index 8513704..b74aa32 100644 1.8.1.6 -From 43d6cf5febd600a9ef11ba7b8656519d2c356346 Mon Sep 17 00:00:00 2001 +From 2b5353b5e7245753a6709986b79f413838ad38e4 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 3 Jul 2013 00:51:55 +0100 -Subject: [PATCH 60/91] Add hwrng (hardware random number generator) driver +Subject: [PATCH 60/99] Add hwrng (hardware random number generator) driver --- arch/arm/mach-bcm2708/include/mach/platform.h | 1 + @@ -94873,10 +94873,10 @@ index 0000000..1ffa7d7 1.8.1.6 -From ee3463d963f75ec8d1b13d81d7ab583255e1d890 Mon Sep 17 00:00:00 2001 +From 1a7fa1b69ae87ca896420024791322ad9eb53184 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 7 Feb 2013 17:04:13 +0000 -Subject: [PATCH 61/91] Add missing newlines to log messages +Subject: [PATCH 61/99] Add missing newlines to log messages --- drivers/cpufreq/bcm2835-cpufreq.c | 20 ++++++++++---------- @@ -94975,10 +94975,10 @@ index 6ff1edb..5a19212 100755 1.8.1.6 -From 9f3f17339f5165e1060883db422398a7f165c2be Mon Sep 17 00:00:00 2001 +From 91d1e7dc598707cc207231eb3da6af7fb4220dfe Mon Sep 17 00:00:00 2001 From: Technion Date: Mon, 11 Feb 2013 22:08:53 +1100 -Subject: [PATCH 62/91] Changed wording on logging. Previously, we received +Subject: [PATCH 62/99] Changed wording on logging. Previously, we received errors like this: mmc0: could read SD Status register (SSR) at the 3th attempt A more sensible response is now returned. A typo also fixed in comments. @@ -95013,10 +95013,10 @@ index 1ee6cf3..90228f9 100644 1.8.1.6 -From bbdfaf49aa05257794d7ddc19717e3e1f035285a Mon Sep 17 00:00:00 2001 +From c7d43ef857410811f7e87deca3cae3ede61a6960 Mon Sep 17 00:00:00 2001 From: P33M Date: Fri, 15 Feb 2013 22:36:47 +0000 -Subject: [PATCH 63/91] dwc_otg: Fix unsafe access of QTD during URB enqueue +Subject: [PATCH 63/99] dwc_otg: Fix unsafe access of QTD during URB enqueue In dwc_otg_hcd_urb_enqueue during qtd creation, it was possible that the transaction could complete almost immediately after the qtd was assigned @@ -95103,10 +95103,10 @@ index b337e1b..b3e6e52 100644 1.8.1.6 -From f385db71cd990d3e6d5e7020127357afabe0b4e4 Mon Sep 17 00:00:00 2001 +From 0d56c0c2af666dbc6760d0ac1da67b4da2556fc3 Mon Sep 17 00:00:00 2001 From: P33M Date: Fri, 15 Feb 2013 22:38:40 +0000 -Subject: [PATCH 64/91] dwc_otg: Fix incorrect URB allocation error handling +Subject: [PATCH 64/99] dwc_otg: Fix incorrect URB allocation error handling If the memory allocation for a dwc_otg_urb failed, the kernel would OOPS because for some reason a member of the *unallocated* struct was set to @@ -95147,10 +95147,10 @@ index e653d84..fcec97f 100644 1.8.1.6 -From 9cb0f13eb3ffc4f82a8756f6b79e3653406f529b Mon Sep 17 00:00:00 2001 +From 317fc23a9cd49bbf6afd6fadf89edddb817db9a9 Mon Sep 17 00:00:00 2001 From: pjennings Date: Wed, 20 Feb 2013 17:51:43 -0600 -Subject: [PATCH 65/91] Added inverted transmitter support +Subject: [PATCH 65/99] Added inverted transmitter support --- drivers/staging/media/lirc/lirc_rpi.c | 17 +++++++++++------ @@ -95231,10 +95231,10 @@ index 96acab0..5bb0dfe 100644 1.8.1.6 -From c332df8c672e573f6ba42e011fa9d2a6fc5ce527 Mon Sep 17 00:00:00 2001 +From 95ed7f785da984ace8ccf7524fb450d0a44e9d9c Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 24 Feb 2013 16:30:57 +0000 -Subject: [PATCH 66/91] Add retry on error and tidy of temperature driver +Subject: [PATCH 66/99] Add retry on error and tidy of temperature driver --- drivers/thermal/bcm2835-thermal.c | 78 ++++++++++++++------------------------- @@ -95361,10 +95361,10 @@ index 3f9a733..85fceb5 100644 1.8.1.6 -From 01690a39d2700286bb67bed762b88b4895a40c76 Mon Sep 17 00:00:00 2001 +From f6c2e77434c76596ffd86e09ccd5d108ea124a0b Mon Sep 17 00:00:00 2001 From: P33M Date: Thu, 28 Feb 2013 16:52:51 +0000 -Subject: [PATCH 67/91] dwc_otg: fix potential use-after-free case in interrupt +Subject: [PATCH 67/99] dwc_otg: fix potential use-after-free case in interrupt handler If a transaction had previously aborted, certain interrupts are @@ -95396,10 +95396,10 @@ index e8c91e7..0c81a64 100644 1.8.1.6 -From d3ebe68a2b7629d107b31ae0644ebce63ccee58a Mon Sep 17 00:00:00 2001 +From 749b88c3d2636de12adfdb247f0da98f331dbe88 Mon Sep 17 00:00:00 2001 From: P33M Date: Sun, 3 Mar 2013 14:45:53 +0000 -Subject: [PATCH 68/91] dwc_otg: add handling of SPLIT transaction data toggle +Subject: [PATCH 68/99] dwc_otg: add handling of SPLIT transaction data toggle errors Previously a data toggle error on packets from a USB1.1 device behind @@ -95454,10 +95454,10 @@ index 0c81a64..16e8c6c 100644 1.8.1.6 -From 56cbbf3c61827a1a3e795ba0d2e8ecaa9e3e73da Mon Sep 17 00:00:00 2001 +From 39c5e0cc5dec38fb9c530fad0250c3047c752dc0 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 1 May 2013 21:14:28 +0100 -Subject: [PATCH 69/91] Add bitbanging pullups, use them for w1-gpio +Subject: [PATCH 69/99] Add bitbanging pullups, use them for w1-gpio Allows parasite power to work, uses module option pullup=1 --- @@ -95596,10 +95596,10 @@ index e10acc2..667fdd5 100644 1.8.1.6 -From 8af17a0ad8e286c71468d15076f9209791971149 Mon Sep 17 00:00:00 2001 +From b8fab4e6dfef8a0c150536a9232477c67cdd8065 Mon Sep 17 00:00:00 2001 From: notro Date: Sat, 26 Jan 2013 20:38:03 +0100 -Subject: [PATCH 70/91] spi-bcm2708: add 9-bit support using LoSSI mode +Subject: [PATCH 70/99] spi-bcm2708: add 9-bit support using LoSSI mode --- drivers/spi/spi-bcm2708.c | 30 ++++++++++++++++++++++++++++-- @@ -95669,10 +95669,10 @@ index b74aa32..abaa5a6 100644 1.8.1.6 -From ddd6ba1219a97ec27e002ecc6bc8d41bc0b8e591 Mon Sep 17 00:00:00 2001 +From d9028dd04d2ad83ebc5713159603fffd24f3a22b Mon Sep 17 00:00:00 2001 From: P33M Date: Thu, 21 Mar 2013 19:36:17 +0000 -Subject: [PATCH 71/91] dwc_otg: implement tasklet for returning URBs to +Subject: [PATCH 71/99] dwc_otg: implement tasklet for returning URBs to usbcore hcd layer The dwc_otg driver interrupt handler for transfer completion will spend @@ -95914,10 +95914,10 @@ index 9702f81..7bb133a 100644 1.8.1.6 -From f33f65ca756725be996e508fba215f7d5457341b Mon Sep 17 00:00:00 2001 +From c71f14fd40a4fadb40a7449f583de733895dc2e2 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 16 Apr 2013 15:36:01 +0100 -Subject: [PATCH 73/91] Add v6wbi_flush_kern_tlb_range to allow zsmalloc to be +Subject: [PATCH 73/99] Add v6wbi_flush_kern_tlb_range to allow zsmalloc to be built as a module --- @@ -95940,10 +95940,10 @@ index 60d3b73..cba4d28 100644 1.8.1.6 -From f79f0fd16fe7e180db35b21566fbb9adf9ff9978 Mon Sep 17 00:00:00 2001 +From 07b4444a2c199eebf90b6d3556c06be61162a4aa Mon Sep 17 00:00:00 2001 From: P33M Date: Mon, 22 Apr 2013 00:08:36 +0100 -Subject: [PATCH 74/91] dwc_otg: fix NAK holdoff and allow on split +Subject: [PATCH 74/99] dwc_otg: fix NAK holdoff and allow on split transactions only This corrects a bug where if a single active non-periodic endpoint @@ -96013,10 +96013,10 @@ index 91eefecd..eaa8f38 100644 1.8.1.6 -From 4de35edee9be469614d1632a198cfd800ae5b25e Mon Sep 17 00:00:00 2001 +From 847b720d29f170f59838851ef89fa16d4e8be328 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 26 Apr 2013 10:08:31 -0700 -Subject: [PATCH 75/91] Merge pull request #286 from +Subject: [PATCH 75/99] Merge pull request #286 from martinezjavier/rpi-3.6.y-dev add mmap support and some cleanups to bcm2835 ALSA driver @@ -96497,10 +96497,10 @@ index b966e28..08c763d 100755 1.8.1.6 -From 911b47b068b6e7e15f1abbc918b28b294856870b Mon Sep 17 00:00:00 2001 +From b084004a4e4956baa6caae26892c987a814e5b86 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 7 May 2013 22:20:24 +0100 -Subject: [PATCH 76/91] Add quick config. +Subject: [PATCH 76/99] Add quick config. This is designed for quick compiling when developing. No modules are needed and it includes all Pi specific drivers @@ -96716,10 +96716,10 @@ index 0000000..e5efe75 1.8.1.6 -From aacfe85df55f02c51b405a01f4391a2eb790fdff Mon Sep 17 00:00:00 2001 +From ce78b69a10967de55daa264905bf5c3c082fa58e Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 10 May 2013 19:42:38 +0100 -Subject: [PATCH 77/91] mmc: suppress sdcard warnings we are happy about by +Subject: [PATCH 77/99] mmc: suppress sdcard warnings we are happy about by default --- @@ -96785,10 +96785,10 @@ index 3556ed3..c2409b9 100644 1.8.1.6 -From 84d80662cd68320b63ed25cfa4f611b96f2e6f82 Mon Sep 17 00:00:00 2001 +From 82a33c8bf57a7973e6a9e691b26b2302623cc283 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 14 May 2013 11:42:25 +0100 -Subject: [PATCH 78/91] Allow reboot=q on command line to set a flag that +Subject: [PATCH 78/99] Allow reboot=q on command line to set a flag that bootcode.bin can use to boot from alternate partition --- @@ -96819,10 +96819,10 @@ index 87fd348..1ed4d73 100644 1.8.1.6 -From d88ada9ddccea359ee02e044f86cd9e33aecc02f Mon Sep 17 00:00:00 2001 +From c59cd6c169dbd7bfbaac7f0db70202d1ea77f998 Mon Sep 17 00:00:00 2001 From: hutorny Date: Mon, 13 May 2013 10:26:14 +0300 -Subject: [PATCH 80/91] Update bcm2708.c to use CONFIG_BCM2708_SPIDEV rather +Subject: [PATCH 80/99] Update bcm2708.c to use CONFIG_BCM2708_SPIDEV rather than CONFIG_SPI --- @@ -96872,10 +96872,10 @@ index 1ed4d73..68c577a 100644 1.8.1.6 -From 8b2532eaea9f27d74973aa563c209e95a6436377 Mon Sep 17 00:00:00 2001 +From f49ef700428e660617cb2af4c5ac3b7b21422d3e Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 8 Jun 2013 22:14:13 +0100 -Subject: [PATCH 82/91] Only init gpio pins of selected i2c bus +Subject: [PATCH 82/99] Only init gpio pins of selected i2c bus --- drivers/i2c/busses/i2c-bcm2708.c | 8 +++++--- @@ -96919,10 +96919,10 @@ index 3391889..edc90c0 100644 1.8.1.6 -From b87736ed6ed5d4d5cc534f679ab8b832e693d452 Mon Sep 17 00:00:00 2001 +From 10bf7045ddd880bbe4f7dde8b4f49598d83b6efa Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 13 Jun 2013 16:46:54 +0100 -Subject: [PATCH 83/91] Avoid responding to unexpected I2C interrupts +Subject: [PATCH 83/99] Avoid responding to unexpected I2C interrupts --- drivers/i2c/busses/i2c-bcm2708.c | 6 ++++++ @@ -96956,10 +96956,10 @@ index edc90c0..33f4e7d 100644 1.8.1.6 -From c9e3680fe3d1b66ec5e8947b52cf582001d39690 Mon Sep 17 00:00:00 2001 +From 2b64a5202b8a2de9976bea21b8b2274bd42ef958 Mon Sep 17 00:00:00 2001 From: Harm Hanemaaijer Date: Thu, 20 Jun 2013 20:21:39 +0200 -Subject: [PATCH 84/91] Speed up console framebuffer imageblit function +Subject: [PATCH 84/99] Speed up console framebuffer imageblit function Especially on platforms with a slower CPU but a relatively high framebuffer fill bandwidth, like current ARM devices, the existing @@ -97171,10 +97171,10 @@ index baed57d..ce91bf2 100644 1.8.1.6 -From 37fa288e60b2f5cdfde5a392504bf1097699c0d8 Mon Sep 17 00:00:00 2001 +From e61adeb1dbd2011d96b2c0be749694577232a547 Mon Sep 17 00:00:00 2001 From: Siarhei Siamashka Date: Mon, 17 Jun 2013 13:32:11 +0300 -Subject: [PATCH 85/91] fbdev: add FBIOCOPYAREA ioctl +Subject: [PATCH 85/99] fbdev: add FBIOCOPYAREA ioctl Based on the patch authored by Ali Gholami Rudi at https://lkml.org/lkml/2009/7/13/153 @@ -97270,10 +97270,10 @@ index fb795c3..fa72af0 100644 1.8.1.6 -From 511c5dd60c2023b810e0f419fd37b2bc3f078cdc Mon Sep 17 00:00:00 2001 +From c989cdcb64873668a5fd83cf853c0a229ee55292 Mon Sep 17 00:00:00 2001 From: Siarhei Siamashka Date: Mon, 17 Jun 2013 16:00:25 +0300 -Subject: [PATCH 86/91] bcm2708_fb: DMA acceleration for fb_copyarea +Subject: [PATCH 86/99] bcm2708_fb: DMA acceleration for fb_copyarea Based on http://www.raspberrypi.org/phpBB3/viewtopic.php?p=62425#p62425 Also used Simon's dmaer_master module as a reference for tweaking DMA @@ -97517,10 +97517,10 @@ index 08d9238..c10c5ee 100644 1.8.1.6 -From 44aa1f6534dbd06e3529d8496a1dd494be5f9b98 Mon Sep 17 00:00:00 2001 +From d1ea37d0b0639cce0beae86bae421df4d55701ee Mon Sep 17 00:00:00 2001 From: Mike Bradley Date: Mon, 17 Jun 2013 11:31:42 -0700 -Subject: [PATCH 87/91] dwc_otg: Call usb_hcd_unlink_urb_from_ep with lock held +Subject: [PATCH 87/99] dwc_otg: Call usb_hcd_unlink_urb_from_ep with lock held in completion handler usb_hcd_unlink_urb_from_ep must be called with the HCD lock held. Calling it @@ -97607,10 +97607,10 @@ index 7bb133a..fef557d 100644 1.8.1.6 -From 1fdd347791b4e01e811427ab5974b3659b805982 Mon Sep 17 00:00:00 2001 +From 3a7b4e1205985ac992799c956d9a9e2085a43f06 Mon Sep 17 00:00:00 2001 From: Gordon Hollingworth Date: Thu, 4 Apr 2013 11:05:21 +0100 -Subject: [PATCH 88/91] USB fix using a FIQ to implement split transactions +Subject: [PATCH 88/99] USB fix using a FIQ to implement split transactions This commit adds a FIQ implementaion that schedules the split transactions using a FIQ so we don't get @@ -99029,10 +99029,10 @@ index 27061d3..9720937 100644 1.8.1.6 -From 03c3eeff807818fc5d7587e556b86f4ea705e93c Mon Sep 17 00:00:00 2001 +From ba0e64bf9cdac248ffe00961a6fa07e3fbdbdf7b Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 3 Jul 2013 11:39:46 +0100 -Subject: [PATCH 89/91] dwc_otg: fix device attributes and avoid kernel +Subject: [PATCH 89/99] dwc_otg: fix device attributes and avoid kernel warnings on boot --- @@ -99101,1431 +99101,10 @@ index 95eb7f8..9602fda 100644 1.8.1.6 -From 1c11989d30ada6ad6a8de30998d08fdc29d2d406 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Wed, 3 Jul 2013 13:39:19 +0100 -Subject: [PATCH 90/91] Revert "USB fix using a FIQ to implement split - transactions" - -This reverts commit 1fdd347791b4e01e811427ab5974b3659b805982. ---- - .../usb/host/dwc_common_port/dwc_common_linux.c | 7 +- - drivers/usb/host/dwc_otg/dwc_otg_cil_intr.c | 37 +- - drivers/usb/host/dwc_otg/dwc_otg_driver.c | 6 +- - drivers/usb/host/dwc_otg/dwc_otg_hcd.c | 125 +---- - drivers/usb/host/dwc_otg/dwc_otg_hcd.h | 20 +- - drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c | 538 +++------------------ - drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c | 18 +- - drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c | 31 +- - drivers/usb/host/dwc_otg/dwc_otg_mphi_fix.h | 26 +- - drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c | 2 +- - 10 files changed, 114 insertions(+), 696 deletions(-) - -diff --git a/drivers/usb/host/dwc_common_port/dwc_common_linux.c b/drivers/usb/host/dwc_common_port/dwc_common_linux.c -index 0812d3a..6814e51 100644 ---- a/drivers/usb/host/dwc_common_port/dwc_common_linux.c -+++ b/drivers/usb/host/dwc_common_port/dwc_common_linux.c -@@ -580,12 +580,7 @@ void DWC_WRITE_REG64(uint64_t volatile *reg, uint64_t value) - - void DWC_MODIFY_REG32(uint32_t volatile *reg, uint32_t clear_mask, uint32_t set_mask) - { -- unsigned long flags; -- -- local_irq_save(flags); -- local_fiq_disable(); - writel((readl(reg) & ~clear_mask) | set_mask, reg); -- local_irq_restore(flags); - } - - #if 0 -@@ -1306,7 +1301,7 @@ int DWC_WORKQ_PENDING(dwc_workq_t *wq) - EXPORT_SYMBOL(__DWC_DEBUG); - #endif - --EXPORT_SYMBOL(__DWC_DMA_ALLOC); -+EXPORT_SYMBOL(__DWC_DMA_ALLOC); - EXPORT_SYMBOL(__DWC_DMA_ALLOC_ATOMIC); - EXPORT_SYMBOL(__DWC_DMA_FREE); - EXPORT_SYMBOL(__DWC_ALLOC); -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_cil_intr.c b/drivers/usb/host/dwc_otg/dwc_otg_cil_intr.c -index b5a007d..b861b55 100644 ---- a/drivers/usb/host/dwc_otg/dwc_otg_cil_intr.c -+++ b/drivers/usb/host/dwc_otg/dwc_otg_cil_intr.c -@@ -47,6 +47,8 @@ - #include "dwc_otg_hcd.h" - #include "dwc_otg_mphi_fix.h" - -+extern bool fiq_fix_enable; -+ - #ifdef DEBUG - inline const char *op_state_str(dwc_otg_core_if_t * core_if) - { -@@ -1319,7 +1321,7 @@ static int32_t dwc_otg_handle_lpm_intr(dwc_otg_core_if_t * core_if) - /** - * This function returns the Core Interrupt register. - */ --static inline uint32_t dwc_otg_read_common_intr(dwc_otg_core_if_t * core_if, gintmsk_data_t *reenable_gintmsk) -+static inline uint32_t dwc_otg_read_common_intr(dwc_otg_core_if_t * core_if) - { - gahbcfg_data_t gahbcfg = {.d32 = 0 }; - gintsts_data_t gintsts; -@@ -1336,33 +1338,19 @@ static inline uint32_t dwc_otg_read_common_intr(dwc_otg_core_if_t * core_if, gin - gintmsk_common.b.lpmtranrcvd = 1; - #endif - gintmsk_common.b.restoredone = 1; -- if(dwc_otg_is_device_mode(core_if)) -- { -- /** @todo: The port interrupt occurs while in device -- * mode. Added code to CIL to clear the interrupt for now! -- */ -- gintmsk_common.b.portintr = 1; -- } -+ /** @todo: The port interrupt occurs while in device -+ * mode. Added code to CIL to clear the interrupt for now! -+ */ -+ gintmsk_common.b.portintr = 1; -+ - gintsts.d32 = DWC_READ_REG32(&core_if->core_global_regs->gintsts); - gintmsk.d32 = DWC_READ_REG32(&core_if->core_global_regs->gintmsk); -- { -- unsigned long flags; -- -- // Re-enable the saved interrupts -- local_irq_save(flags); -- local_fiq_disable(); -- gintmsk.d32 |= gintmsk_common.d32; -- gintsts_saved.d32 &= ~gintmsk_common.d32; -- reenable_gintmsk->d32 = gintmsk.d32; -- local_irq_restore(flags); -- } -- - gahbcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->gahbcfg); - - #ifdef DEBUG - /* if any common interrupts set */ - if (gintsts.d32 & gintmsk_common.d32) { -- DWC_DEBUGPL(DBG_ANY, "common_intr: gintsts=%08x gintmsk=%08x\n", -+ DWC_DEBUGPL(DBG_ANY, "gintsts=%08x gintmsk=%08x\n", - gintsts.d32, gintmsk.d32); - } - #endif -@@ -1406,7 +1394,6 @@ int32_t dwc_otg_handle_common_intr(void *dev) - { - int retval = 0; - gintsts_data_t gintsts; -- gintmsk_data_t reenable_gintmsk; - gpwrdn_data_t gpwrdn = {.d32 = 0 }; - dwc_otg_device_t *otg_dev = dev; - dwc_otg_core_if_t *core_if = otg_dev->core_if; -@@ -1428,7 +1415,7 @@ int32_t dwc_otg_handle_common_intr(void *dev) - } - - if (core_if->hibernation_suspend <= 0) { -- gintsts.d32 = dwc_otg_read_common_intr(core_if, &reenable_gintmsk); -+ gintsts.d32 = dwc_otg_read_common_intr(core_if); - - if (gintsts.b.modemismatch) { - retval |= dwc_otg_handle_mode_mismatch_intr(core_if); -@@ -1525,12 +1512,8 @@ int32_t dwc_otg_handle_common_intr(void *dev) - gintsts.b.portintr = 1; - DWC_WRITE_REG32(&core_if->core_global_regs->gintsts,gintsts.d32); - retval |= 1; -- reenable_gintmsk.b.portintr = 1; - - } -- -- DWC_WRITE_REG32(&core_if->core_global_regs->gintmsk, reenable_gintmsk.d32); -- - } else { - DWC_DEBUGPL(DBG_ANY, "gpwrdn=%08x\n", gpwrdn.d32); - -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_driver.c b/drivers/usb/host/dwc_otg/dwc_otg_driver.c -index 6c89a69..cea8fcb 100644 ---- a/drivers/usb/host/dwc_otg/dwc_otg_driver.c -+++ b/drivers/usb/host/dwc_otg/dwc_otg_driver.c -@@ -242,8 +242,7 @@ struct dwc_otg_driver_module_params { - - //Global variable to switch the fiq fix on or off (declared in bcm2708.c) - extern bool fiq_fix_enable; --// Global variable to enable the split transaction fix --bool fiq_split_enable = true; -+ - //Global variable to switch the nak holdoff on or off - bool nak_holdoff_enable = true; - -@@ -1091,7 +1090,6 @@ static int __init dwc_otg_driver_init(void) - } - printk(KERN_DEBUG "dwc_otg: FIQ %s\n", fiq_fix_enable ? "enabled":"disabled"); - printk(KERN_DEBUG "dwc_otg: NAK holdoff %s\n", nak_holdoff_enable ? "enabled":"disabled"); -- printk(KERN_DEBUG "dwc_otg: FIQ split fix %s\n", fiq_split_enable ? "enabled":"disabled"); - - error = driver_create_file(drv, &driver_attr_version); - #ifdef DEBUG -@@ -1376,8 +1374,6 @@ static void __exit dwc_otg_driver_cleanup(void) - MODULE_PARM_DESC(fiq_fix_enable, "Enable the fiq fix"); - module_param(nak_holdoff_enable, bool, 0444); - MODULE_PARM_DESC(nak_holdoff_enable, "Enable the NAK holdoff"); --module_param(fiq_split_enable, bool, 0444); --MODULE_PARM_DESC(fiq_split_enable, "Enable the FIQ fix on split transactions"); - - /** @page "Module Parameters" - * -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd.c -index af9108c..9c2e71a 100644 ---- a/drivers/usb/host/dwc_otg/dwc_otg_hcd.c -+++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd.c -@@ -45,7 +45,6 @@ - - #include "dwc_otg_hcd.h" - #include "dwc_otg_regs.h" --#include "dwc_otg_mphi_fix.h" - - extern bool microframe_schedule, nak_holdoff_enable; - -@@ -582,8 +581,6 @@ int dwc_otg_hcd_urb_dequeue(dwc_otg_hcd_t * hcd, - */ - dwc_otg_hc_halt(hcd->core_if, qh->channel, - DWC_OTG_HC_XFER_URB_DEQUEUE); -- -- dwc_otg_hcd_release_port(hcd, qh); - } - } - -@@ -719,8 +716,6 @@ static void completion_tasklet_func(void *ptr) - - usb_hcd_giveback_urb(hcd->priv, urb, urb->status); - -- fiq_print(FIQDBG_PORTHUB, "COMPLETE"); -- - DWC_SPINLOCK_IRQSAVE(hcd->lock, &flags); - } - DWC_SPINUNLOCK_IRQRESTORE(hcd->lock, flags); -@@ -984,10 +979,6 @@ int dwc_otg_hcd_init(dwc_otg_hcd_t * hcd, dwc_otg_core_if_t * core_if) - hcd->frame_list = NULL; - hcd->frame_list_dma = 0; - hcd->periodic_qh_count = 0; -- -- DWC_MEMSET(hcd->hub_port, 0, sizeof(hcd->hub_port)); -- DWC_MEMSET(hcd->hub_port_alloc, -1, sizeof(hcd->hub_port_alloc)); -- - out: - return retval; - } -@@ -1133,12 +1124,7 @@ static void assign_and_init_hc(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) - uint32_t hub_addr, port_addr; - hc->do_split = 1; - hc->xact_pos = qtd->isoc_split_pos; -- /* We don't need to do complete splits anymore */ -- if(fiq_split_enable) -- hc->complete_split = qtd->complete_split = 0; -- else -- hc->complete_split = qtd->complete_split; -- -+ hc->complete_split = qtd->complete_split; - hcd->fops->hub_info(hcd, urb->priv, &hub_addr, &port_addr); - hc->hub_addr = (uint8_t) hub_addr; - hc->port_addr = (uint8_t) port_addr; -@@ -1285,62 +1271,6 @@ static void assign_and_init_hc(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) - hc->qh = qh; - } - --/* --** Check the transaction to see if the port / hub has already been assigned for --** a split transaction --** --** Return 0 - Port is already in use --*/ --int dwc_otg_hcd_allocate_port(dwc_otg_hcd_t * hcd, dwc_otg_qh_t *qh) --{ -- uint32_t hub_addr, port_addr; -- -- if(!fiq_split_enable) -- return 0; -- -- hcd->fops->hub_info(hcd, DWC_CIRCLEQ_FIRST(&qh->qtd_list)->urb->priv, &hub_addr, &port_addr); -- -- if(hcd->hub_port[hub_addr] & (1 << port_addr)) -- { -- fiq_print(FIQDBG_PORTHUB, "H%dP%d:S%02d", hub_addr, port_addr, qh->skip_count); -- -- qh->skip_count++; -- -- if(qh->skip_count > 40000) -- { -- printk_once(KERN_ERR "Error: Having to skip port allocation"); -- local_fiq_disable(); -- BUG(); -- return 0; -- } -- return 1; -- } -- else -- { -- qh->skip_count = 0; -- hcd->hub_port[hub_addr] |= 1 << port_addr; -- fiq_print(FIQDBG_PORTHUB, "H%dP%d:A %d", hub_addr, port_addr, DWC_CIRCLEQ_FIRST(&qh->qtd_list)->urb->pipe_info.ep_num); -- hcd->hub_port_alloc[hub_addr * 16 + port_addr] = dwc_otg_hcd_get_frame_number(hcd); -- return 0; -- } --} --void dwc_otg_hcd_release_port(dwc_otg_hcd_t * hcd, dwc_otg_qh_t *qh) --{ -- uint32_t hub_addr, port_addr; -- -- if(!fiq_split_enable) -- return; -- -- hcd->fops->hub_info(hcd, DWC_CIRCLEQ_FIRST(&qh->qtd_list)->urb->priv, &hub_addr, &port_addr); -- -- hcd->hub_port[hub_addr] &= ~(1 << port_addr); -- hcd->hub_port_alloc[hub_addr * 16 + port_addr] = -1; -- -- fiq_print(FIQDBG_PORTHUB, "H%dP%d:RO%d", hub_addr, port_addr, DWC_CIRCLEQ_FIRST(&qh->qtd_list)->urb->pipe_info.ep_num); -- --} -- -- - /** - * This function selects transactions from the HCD transfer schedule and - * assigns them to available host channels. It is called from HCD interrupt -@@ -1374,22 +1304,11 @@ dwc_otg_transaction_type_e dwc_otg_hcd_select_transactions(dwc_otg_hcd_t * hcd) - - while (qh_ptr != &hcd->periodic_sched_ready && - !DWC_CIRCLEQ_EMPTY(&hcd->free_hc_list)) { -- -- qh = DWC_LIST_ENTRY(qh_ptr, dwc_otg_qh_t, qh_list_entry); -- -- if(qh->do_split && dwc_otg_hcd_allocate_port(hcd, qh)) -- { -- qh_ptr = DWC_LIST_NEXT(qh_ptr); -- g_next_sched_frame = dwc_frame_num_inc(dwc_otg_hcd_get_frame_number(hcd), 1); -- continue; -- } -- - if (microframe_schedule) { - // Make sure we leave one channel for non periodic transactions. - DWC_SPINLOCK_IRQSAVE(channel_lock, &flags); - if (hcd->available_host_channels <= 1) { - DWC_SPINUNLOCK_IRQRESTORE(channel_lock, flags); -- if(qh->do_split) dwc_otg_hcd_release_port(hcd, qh); - break; - } - hcd->available_host_channels--; -@@ -1410,6 +1329,8 @@ dwc_otg_transaction_type_e dwc_otg_hcd_select_transactions(dwc_otg_hcd_t * hcd) - DWC_LIST_MOVE_HEAD(&hcd->periodic_sched_assigned, - &qh->qh_list_entry); - DWC_SPINUNLOCK_IRQRESTORE(channel_lock, flags); -+ -+ ret_val = DWC_OTG_TRANSACTION_PERIODIC; - } - - /* -@@ -1448,19 +1369,10 @@ dwc_otg_transaction_type_e dwc_otg_hcd_select_transactions(dwc_otg_hcd_t * hcd) - qh->nak_frame = 0xffff; - } - } -- -- if (qh->do_split && dwc_otg_hcd_allocate_port(hcd, qh)) -- { -- g_next_sched_frame = dwc_frame_num_inc(dwc_otg_hcd_get_frame_number(hcd), 1); -- qh_ptr = DWC_LIST_NEXT(qh_ptr); -- continue; -- } -- - if (microframe_schedule) { - DWC_SPINLOCK_IRQSAVE(channel_lock, &flags); - if (hcd->available_host_channels < 1) { - DWC_SPINUNLOCK_IRQRESTORE(channel_lock, flags); -- if(qh->do_split) dwc_otg_hcd_release_port(hcd, qh); - break; - } - hcd->available_host_channels--; -@@ -1484,17 +1396,16 @@ dwc_otg_transaction_type_e dwc_otg_hcd_select_transactions(dwc_otg_hcd_t * hcd) - - g_np_sent++; - -+ if (ret_val == DWC_OTG_TRANSACTION_NONE) { -+ ret_val = DWC_OTG_TRANSACTION_NON_PERIODIC; -+ } else { -+ ret_val = DWC_OTG_TRANSACTION_ALL; -+ } -+ - if (!microframe_schedule) - hcd->non_periodic_channels++; - } - -- if(!DWC_LIST_EMPTY(&hcd->periodic_sched_assigned)) -- ret_val |= DWC_OTG_TRANSACTION_PERIODIC; -- -- if(!DWC_LIST_EMPTY(&hcd->non_periodic_sched_active)) -- ret_val |= DWC_OTG_TRANSACTION_NON_PERIODIC; -- -- - #ifdef DEBUG_HOST_CHANNELS - last_sel_trans_num_avail_hc_at_end = hcd->available_host_channels; - #endif /* DEBUG_HOST_CHANNELS */ -@@ -1611,15 +1522,6 @@ static void process_periodic_channels(dwc_otg_hcd_t * hcd) - - qh = DWC_LIST_ENTRY(qh_ptr, dwc_otg_qh_t, qh_list_entry); - -- // Do not send a split start transaction any later than frame .6 -- // Note, we have to schedule a periodic in .5 to make it go in .6 -- if(fiq_split_enable && qh->do_split && ((dwc_otg_hcd_get_frame_number(hcd) + 1) & 7) > 6) -- { -- qh_ptr = qh_ptr->next; -- g_next_sched_frame = dwc_otg_hcd_get_frame_number(hcd) | 7; -- continue; -- } -- - /* - * Set a flag if we're queuing high-bandwidth in slave mode. - * The flag prevents any halts to get into the request queue in -@@ -1749,15 +1651,6 @@ static void process_non_periodic_channels(dwc_otg_hcd_t * hcd) - - qh = DWC_LIST_ENTRY(hcd->non_periodic_qh_ptr, dwc_otg_qh_t, - qh_list_entry); -- -- // Do not send a split start transaction any later than frame .5 -- // non periodic transactions will start immediately in this uframe -- if(fiq_split_enable && qh->do_split && ((dwc_otg_hcd_get_frame_number(hcd) + 1) & 7) > 6) -- { -- g_next_sched_frame = dwc_otg_hcd_get_frame_number(hcd) | 7; -- break; -- } -- - status = - queue_transaction(hcd, qh->channel, - tx_status.b.nptxfspcavail); -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd.h b/drivers/usb/host/dwc_otg/dwc_otg_hcd.h -index d3d6e997..0493dbf 100644 ---- a/drivers/usb/host/dwc_otg/dwc_otg_hcd.h -+++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd.h -@@ -168,10 +168,10 @@ static inline void dwc_otg_hcd_fill_pipe(struct dwc_otg_hcd_pipe_info *pipe, - - /** Transaction types. */ - typedef enum dwc_otg_transaction_type { -- DWC_OTG_TRANSACTION_NONE = 0, -- DWC_OTG_TRANSACTION_PERIODIC = 1, -- DWC_OTG_TRANSACTION_NON_PERIODIC = 2, -- DWC_OTG_TRANSACTION_ALL = DWC_OTG_TRANSACTION_PERIODIC + DWC_OTG_TRANSACTION_NON_PERIODIC -+ DWC_OTG_TRANSACTION_NONE, -+ DWC_OTG_TRANSACTION_PERIODIC, -+ DWC_OTG_TRANSACTION_NON_PERIODIC, -+ DWC_OTG_TRANSACTION_ALL - } dwc_otg_transaction_type_e; - - struct dwc_otg_qh; -@@ -370,8 +370,6 @@ static inline void dwc_otg_hcd_fill_pipe(struct dwc_otg_hcd_pipe_info *pipe, - - uint16_t speed; - uint16_t frame_usecs[8]; -- -- uint32_t skip_count; - } dwc_otg_qh_t; - - DWC_CIRCLEQ_HEAD(hc_list, dwc_hc); -@@ -576,10 +574,6 @@ struct dwc_otg_hcd { - /** Frame List */ - uint32_t *frame_list; - -- /** Hub - Port assignment */ -- int hub_port[16]; -- int hub_port_alloc[256]; -- - /** Frame List DMA address */ - dma_addr_t frame_list_dma; - -@@ -610,16 +604,12 @@ extern dwc_otg_transaction_type_e dwc_otg_hcd_select_transactions(dwc_otg_hcd_t - extern void dwc_otg_hcd_queue_transactions(dwc_otg_hcd_t * hcd, - dwc_otg_transaction_type_e tr_type); - --int dwc_otg_hcd_allocate_port(dwc_otg_hcd_t * hcd, dwc_otg_qh_t *qh); --void dwc_otg_hcd_release_port(dwc_otg_hcd_t * dwc_otg_hcd, dwc_otg_qh_t *qh); -- -- - /** @} */ - - /** @name Interrupt Handler Functions */ - /** @{ */ - extern int32_t dwc_otg_hcd_handle_intr(dwc_otg_hcd_t * dwc_otg_hcd); --extern int32_t dwc_otg_hcd_handle_sof_intr(dwc_otg_hcd_t * dwc_otg_hcd); -+extern int32_t dwc_otg_hcd_handle_sof_intr(dwc_otg_hcd_t * dwc_otg_hcd, int32_t); - extern int32_t dwc_otg_hcd_handle_rx_status_q_level_intr(dwc_otg_hcd_t * - dwc_otg_hcd); - extern int32_t dwc_otg_hcd_handle_np_tx_fifo_empty_intr(dwc_otg_hcd_t * -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c -index e8b4d35..16e8c6c 100644 ---- a/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c -+++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c -@@ -38,7 +38,6 @@ - - #include - #include --#include - - - extern bool microframe_schedule; -@@ -53,295 +52,21 @@ - - void * dummy_send; - mphi_regs_t c_mphi_regs; --volatile void *dwc_regs_base; - int fiq_done, int_done; -- --gintsts_data_t gintsts_saved = {.d32 = 0}; --hcint_data_t hcint_saved[MAX_EPS_CHANNELS]; --hcintmsk_data_t hcintmsk_saved[MAX_EPS_CHANNELS]; --int split_out_xfersize[MAX_EPS_CHANNELS]; --haint_data_t haint_saved; -- --int g_next_sched_frame, g_np_count, g_np_sent; -+int g_next_sched_frame, g_np_count, g_np_sent, g_work_expected; - static int mphi_int_count = 0 ; - -+extern bool fiq_fix_enable, nak_holdoff_enable; -+ - hcchar_data_t nak_hcchar; - hctsiz_data_t nak_hctsiz; - hcsplt_data_t nak_hcsplt; - int nak_count; - --int complete_sched[MAX_EPS_CHANNELS] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; --int split_start_frame[MAX_EPS_CHANNELS]; --int queued_port[MAX_EPS_CHANNELS]; -- --#ifdef FIQ_DEBUG --char buffer[1000*16]; --int wptr; --void _fiq_print(FIQDBG_T dbg_lvl, char *fmt, ...) --{ -- FIQDBG_T dbg_lvl_req = FIQDBG_PORTHUB; -- va_list args; -- char text[17]; -- hfnum_data_t hfnum = { .d32 = FIQ_READ(dwc_regs_base + 0x408) }; -- unsigned long flags; -- -- local_irq_save(flags); -- local_fiq_disable(); -- if(dbg_lvl & dbg_lvl_req || dbg_lvl == FIQDBG_ERR) -- { -- snprintf(text, 9, "%4d%d:%d ", hfnum.b.frnum/8, hfnum.b.frnum%8, 8 - hfnum.b.frrem/937); -- va_start(args, fmt); -- vsnprintf(text+8, 9, fmt, args); -- va_end(args); -- -- memcpy(buffer + wptr, text, 16); -- wptr = (wptr + 16) % sizeof(buffer); -- } -- local_irq_restore(flags); --} --#endif -- --void fiq_queue_request(int channel, int odd_frame) --{ -- hcchar_data_t hcchar = { .d32 = FIQ_READ(dwc_regs_base + 0x500 + (channel * 0x20) + 0x0) }; -- hcsplt_data_t hcsplt = { .d32 = FIQ_READ(dwc_regs_base + 0x500 + (channel * 0x20) + 0x4) }; -- hctsiz_data_t hctsiz = { .d32 = FIQ_READ(dwc_regs_base + 0x500 + (channel * 0x20) + 0x10) }; -- -- if(hcsplt.b.spltena == 0) -- { -- fiq_print(FIQDBG_ERR, "SPLTENA "); -- BUG(); -- } -- -- if(hcchar.b.epdir == 1) -- { -- fiq_print(FIQDBG_SCHED, "IN Ch %d", channel); -- } -- else -- { -- hctsiz.b.xfersize = 0; -- fiq_print(FIQDBG_SCHED, "OUT Ch %d", channel); -- } -- FIQ_WRITE((dwc_regs_base + 0x500 + (channel * 0x20) + 0x10), hctsiz.d32); -- -- hcsplt.b.compsplt = 1; -- FIQ_WRITE((dwc_regs_base + 0x500 + (channel * 0x20) + 0x4), hcsplt.d32); -- -- // Send the Split complete -- hcchar.b.chen = 1; -- hcchar.b.oddfrm = odd_frame ? 1 : 0; -- -- // Post this for transmit on the next frame for periodic or this frame for non-periodic -- fiq_print(FIQDBG_SCHED, "SND_%s", odd_frame ? "ODD " : "EVEN"); -- -- FIQ_WRITE((dwc_regs_base + 0x500 + (channel * 0x20) + 0x0), hcchar.d32); --} -- --static int last_sof = -1; -- --/* --** Function to handle the start of frame interrupt, choose whether we need to do anything and --** therefore trigger the main interrupt --** --** returns int != 0 - interrupt has been handled --*/ --int diff; -- --int fiq_sof_handle(hfnum_data_t hfnum) --{ -- int handled = 0; -- int i; -- -- // Just check that once we're running we don't miss a SOF -- /*if(last_sof != -1 && (hfnum.b.frnum != ((last_sof + 1) & 0x3fff))) -- { -- fiq_print(FIQDBG_ERR, "LASTSOF "); -- fiq_print(FIQDBG_ERR, "%4d%d ", last_sof / 8, last_sof & 7); -- fiq_print(FIQDBG_ERR, "%4d%d ", hfnum.b.frnum / 8, hfnum.b.frnum & 7); -- BUG(); -- }*/ -- -- // Only start remembering the last sof when the interrupt has been -- // enabled (we don't check the mask to come in here...) -- if(last_sof != -1 || FIQ_READ(dwc_regs_base + 0x18) & (1<<3)) -- last_sof = hfnum.b.frnum; -- -- for(i = 0; i < MAX_EPS_CHANNELS; i++) -- { -- if(complete_sched[i] != -1) -- { -- if(complete_sched[i] <= hfnum.b.frnum || (complete_sched[i] > 0x3f00 && hfnum.b.frnum < 0xf0)) -- { -- fiq_queue_request(i, hfnum.b.frnum & 1); -- complete_sched[i] = -1; -- } -- } -- -- if(complete_sched[i] != -1) -- { -- // This is because we've seen a split complete occur with no start... -- // most likely because missed the complete 0x3fff frames ago! -- -- diff = (hfnum.b.frnum + 0x3fff - complete_sched[i]) & 0x3fff ; -- if(diff > 32 && diff < 0x3f00) -- { -- fiq_print(FIQDBG_ERR, "SPLTMISS"); -- BUG(); -- } -- } -- } -- -- if(g_np_count == g_np_sent && dwc_frame_num_gt(g_next_sched_frame, hfnum.b.frnum)) -- { -- /* -- * If np_count != np_sent that means we need to queue non-periodic (bulk) packets this packet -- * g_next_sched_frame is the next frame we have periodic packets for -- * -- * if neither of these are required for this frame then just clear the interrupt -- */ -- handled = 1; -- -- } -- -- return handled; --} -- --int port_id(hcsplt_data_t hcsplt) --{ -- return hcsplt.b.prtaddr + (hcsplt.b.hubaddr << 8); --} -- --int fiq_hcintr_handle(int channel, hfnum_data_t hfnum) --{ -- hcchar_data_t hcchar = { .d32 = FIQ_READ(dwc_regs_base + 0x500 + (channel * 0x20) + 0x0) }; -- hcsplt_data_t hcsplt = { .d32 = FIQ_READ(dwc_regs_base + 0x500 + (channel * 0x20) + 0x4) }; -- hcint_data_t hcint = { .d32 = FIQ_READ(dwc_regs_base + 0x500 + (channel * 0x20) + 0x8) }; -- hcintmsk_data_t hcintmsk = { .d32 = FIQ_READ(dwc_regs_base + 0x500 + (channel * 0x20) + 0xc) }; -- hctsiz_data_t hctsiz = { .d32 = FIQ_READ(dwc_regs_base + 0x500 + (channel * 0x20) + 0x10)}; -- -- hcint_saved[channel].d32 |= hcint.d32; -- hcintmsk_saved[channel].d32 = hcintmsk.d32; -- -- if(hcsplt.b.spltena) -- { -- fiq_print(FIQDBG_PORTHUB, "ph: %4x", port_id(hcsplt)); -- if(hcint.b.chhltd) -- { -- fiq_print(FIQDBG_SCHED, "CH HLT %d", channel); -- fiq_print(FIQDBG_SCHED, "%08x", hcint_saved[channel]); -- } -- if(hcint.b.stall || hcint.b.xacterr || hcint.b.bblerr || hcint.b.frmovrun || hcint.b.datatglerr) -- { -- queued_port[channel] = 0; -- fiq_print(FIQDBG_ERR, "CHAN ERR"); -- } -- if(hcint.b.xfercomp) -- { -- // Clear the port allocation and transmit anything also on this port -- queued_port[channel] = 0; -- fiq_print(FIQDBG_SCHED, "XFERCOMP"); -- } -- if(hcint.b.nak) -- { -- queued_port[channel] = 0; -- fiq_print(FIQDBG_SCHED, "NAK"); -- } -- if(hcint.b.ack && !hcsplt.b.compsplt) -- { -- int i; -- -- // Do not complete isochronous out transactions -- if(hcchar.b.eptype == 1 && hcchar.b.epdir == 0) -- { -- queued_port[channel] = 0; -- fiq_print(FIQDBG_SCHED, "ISOC_OUT"); -- } -- else -- { -- // Make sure we check the port / hub combination that we sent this split on. -- // Do not queue a second request to the same port -- for(i = 0; i < MAX_EPS_CHANNELS; i++) -- { -- if(port_id(hcsplt) == queued_port[i]) -- { -- fiq_print(FIQDBG_ERR, "PORTERR "); -- //BUG(); -- } -- } -- -- split_start_frame[channel] = (hfnum.b.frnum + 1) & ~7; -- -- // Note, the size of an OUT is in the start split phase, not -- // the complete split -- split_out_xfersize[channel] = hctsiz.b.xfersize; -- -- hcint_saved[channel].b.chhltd = 0; -- hcint_saved[channel].b.ack = 0; -- -- queued_port[channel] = port_id(hcsplt); -- -- if(hcchar.b.eptype & 1) -- { -- // Send the periodic complete in the same oddness frame as the ACK went... -- fiq_queue_request(channel, !(hfnum.b.frnum & 1)); -- // complete_sched[channel] = dwc_frame_num_inc(hfnum.b.frnum, 1); -- } -- else -- { -- // Schedule the split complete to occur later -- complete_sched[channel] = dwc_frame_num_inc(hfnum.b.frnum, 2); -- fiq_print(FIQDBG_SCHED, "ACK%04d%d", complete_sched[channel]/8, complete_sched[channel]%8); -- } -- } -- } -- if(hcint.b.nyet) -- { -- fiq_print(FIQDBG_ERR, "NYETERR1"); -- //BUG(); -- // Can transmit a split complete up to uframe .0 of the next frame -- if(hfnum.b.frnum <= dwc_frame_num_inc(split_start_frame[channel], 8)) -- { -- // Send it next frame -- if(hcchar.b.eptype & 1) // type 1 & 3 are interrupt & isoc -- { -- fiq_print(FIQDBG_SCHED, "NYT:SEND"); -- fiq_queue_request(channel, !(hfnum.b.frnum & 1)); -- } -- else -- { -- // Schedule non-periodic access for next frame (the odd-even bit doesn't effect NP) -- complete_sched[channel] = dwc_frame_num_inc(hfnum.b.frnum, 1); -- fiq_print(FIQDBG_SCHED, "NYT%04d%d", complete_sched[channel]/8, complete_sched[channel]%8); -- } -- hcint_saved[channel].b.chhltd = 0; -- hcint_saved[channel].b.nyet = 0; -- } -- else -- { -- queued_port[channel] = 0; -- fiq_print(FIQDBG_ERR, "NYETERR2"); -- //BUG(); -- } -- } -- } -- -- // Clear the interrupt, this will also clear the HAINT bit -- FIQ_WRITE((dwc_regs_base + 0x500 + (channel * 0x20) + 0x8), hcint.d32); -- return hcint_saved[channel].d32 == 0; --} -- --gintsts_data_t gintsts; --gintmsk_data_t gintmsk; --// triggered: The set of interrupts that were triggered --// handled: The set of interrupts that have been handled (no IRQ is --// required) --// keep: The set of interrupts we want to keep unmasked even though we --// want to trigger an IRQ to handle it (SOF and HCINTR) --gintsts_data_t triggered, handled, keep; --hfnum_data_t hfnum; -- - void __attribute__ ((naked)) dwc_otg_hcd_handle_fiq(void) - { -+ gintsts_data_t gintsts; -+ hfnum_data_t hfnum; - - /* entry takes care to store registers we will be treading on here */ - asm __volatile__ ( -@@ -349,112 +74,43 @@ void __attribute__ ((naked)) dwc_otg_hcd_handle_fiq(void) - /* stash FIQ and normal regs */ - "stmdb sp!, {r0-r12, lr};" - /* !! THIS SETS THE FRAME, adjust to > sizeof locals */ -- "sub fp, ip, #512 ;" -+ "sub fp, ip, #256 ;" - ); - -- // Cannot put local variables at the beginning of the function -- // because otherwise 'C' will play with the stack pointer. any locals -- // need to be inside the following block -- do -+ fiq_done++; -+ gintsts.d32 = FIQ_READ_IO_ADDRESS(USB_BASE + 0x14) & FIQ_READ_IO_ADDRESS(USB_BASE + 0x18); -+ hfnum.d32 = FIQ_READ_IO_ADDRESS(USB_BASE + 0x408); -+ -+ if(gintsts.d32) - { -- fiq_done++; -- gintsts.d32 = FIQ_READ(dwc_regs_base + 0x14); -- gintmsk.d32 = FIQ_READ(dwc_regs_base + 0x18); -- hfnum.d32 = FIQ_READ(dwc_regs_base + 0x408); -- triggered.d32 = gintsts.d32 & gintmsk.d32; -- handled.d32 = 0; -- keep.d32 = 0; -- fiq_print(FIQDBG_INT, "FIQ "); -- fiq_print(FIQDBG_INT, "%08x", gintsts.d32); -- fiq_print(FIQDBG_INT, "%08x", gintmsk.d32); -- if(gintsts.d32) -+ if(gintsts.b.sofintr && g_np_count == g_np_sent && dwc_frame_num_gt(g_next_sched_frame, hfnum.b.frnum)) - { -- // If port enabled -- if((FIQ_READ(dwc_regs_base + 0x440) & 0xf) == 0x5) -- { -- if(gintsts.b.sofintr) -- { -- if(fiq_sof_handle(hfnum)) -- { -- handled.b.sofintr = 1; /* Handled in FIQ */ -- } -- else -- { -- /* Keer interrupt unmasked */ -- keep.b.sofintr = 1; -- } -- { -- // Need to make sure the read and clearing of the SOF interrupt is as close as possible to avoid the possibility of missing -- // a start of frame interrupt -- gintsts_data_t gintsts = { .b.sofintr = 1 }; -- FIQ_WRITE((dwc_regs_base + 0x14), gintsts.d32); -- } -- } -- -- if(fiq_split_enable && gintsts.b.hcintr) -- { -- int i; -- haint_data_t haint; -- haintmsk_data_t haintmsk; -- -- haint.d32 = FIQ_READ(dwc_regs_base + 0x414); -- haintmsk.d32 = FIQ_READ(dwc_regs_base + 0x418); -- haint.d32 &= haintmsk.d32; -- haint_saved.d32 |= haint.d32; -- -- fiq_print(FIQDBG_INT, "hcintr"); -- fiq_print(FIQDBG_INT, "%08x", FIQ_READ(dwc_regs_base + 0x414)); -- -- // Go through each channel that has an enabled interrupt -- for(i = 0; i < 16; i++) -- if((haint.d32 >> i) & 1) -- if(fiq_hcintr_handle(i, hfnum)) -- haint_saved.d32 &= ~(1 << i); /* this was handled */ -- -- /* If we've handled all host channel interrupts then don't trigger the interrupt */ -- if(haint_saved.d32 == 0) -- { -- handled.b.hcintr = 1; -- } -- else -- { -- /* Make sure we keep the channel interrupt unmasked when triggering the IRQ */ -- keep.b.hcintr = 1; -- } -- -- { -- gintsts_data_t gintsts = { .b.hcintr = 1 }; -+ /* -+ * If np_count != np_sent that means we need to queue non-periodic (bulk) packets this packet -+ * g_next_sched_frame is the next frame we have periodic packets for -+ * -+ * if neither of these are required for this frame then just clear the interrupt -+ */ -+ gintsts.d32 = 0; -+ gintsts.b.sofintr = 1; -+ FIQ_WRITE_IO_ADDRESS((USB_BASE + 0x14), gintsts.d32); - -- // Always clear the channel interrupt -- FIQ_WRITE((dwc_regs_base + 0x14), gintsts.d32); -- } -- } -- } -- else -- { -- last_sof = -1; -- } -+ g_work_expected = 0; - } -- -- // Mask out the interrupts triggered - those handled - don't mask out the ones we want to keep -- gintmsk.d32 = keep.d32 | (gintmsk.d32 & ~(triggered.d32 & ~handled.d32)); -- // Save those that were triggered but not handled -- gintsts_saved.d32 |= triggered.d32 & ~handled.d32; -- FIQ_WRITE(dwc_regs_base + 0x18, gintmsk.d32); -- -- // Clear and save any unhandled interrupts and trigger the interrupt -- if(gintsts_saved.d32) -+ else - { -+ g_work_expected = 1; - /* To enable the MPHI interrupt (INT 32) - */ -- FIQ_WRITE( c_mphi_regs.outdda, (int) dummy_send); -+ FIQ_WRITE( c_mphi_regs.outdda, (int) dummy_send); - FIQ_WRITE( c_mphi_regs.outddb, (1 << 29)); - - mphi_int_count++; -+ /* Clear the USB global interrupt so we don't just sit in the FIQ */ -+ FIQ_MODIFY_IO_ADDRESS((USB_BASE + 0x8),1,0); -+ - } - } -- while(0); -- - mb(); - - /* exit back to normal mode restoring everything */ -@@ -477,7 +133,6 @@ int32_t dwc_otg_hcd_handle_intr(dwc_otg_hcd_t * dwc_otg_hcd) - - dwc_otg_core_if_t *core_if = dwc_otg_hcd->core_if; - gintsts_data_t gintsts; -- gintmsk_data_t gintmsk; - hfnum_data_t hfnum; - - #ifdef DEBUG -@@ -485,9 +140,6 @@ int32_t dwc_otg_hcd_handle_intr(dwc_otg_hcd_t * dwc_otg_hcd) - - #endif - -- gintsts.d32 = DWC_READ_REG32(&core_if->core_global_regs->gintsts); -- gintmsk.d32 = DWC_READ_REG32(&core_if->core_global_regs->gintmsk); -- - /* Exit from ISR if core is hibernated */ - if (core_if->hibernation_suspend == 1) { - goto exit_handler_routine; -@@ -495,18 +147,11 @@ int32_t dwc_otg_hcd_handle_intr(dwc_otg_hcd_t * dwc_otg_hcd) - DWC_SPINLOCK(dwc_otg_hcd->lock); - /* Check if HOST Mode */ - if (dwc_otg_is_host_mode(core_if)) { -- local_fiq_disable(); -- gintmsk.d32 |= gintsts_saved.d32; -- gintsts.d32 |= gintsts_saved.d32; -- gintsts_saved.d32 = 0; -- local_fiq_enable(); -+ gintsts.d32 = dwc_otg_read_core_intr(core_if); - if (!gintsts.d32) { - goto exit_handler_routine; - } -- gintsts.d32 &= gintmsk.d32; -- - #ifdef DEBUG -- // We should be OK doing this because the common interrupts should already have been serviced - /* Don't print debug message in the interrupt handler on SOF */ - #ifndef DEBUG_SOF - if (gintsts.d32 != DWC_SOF_INTR_MASK) -@@ -526,12 +171,11 @@ int32_t dwc_otg_hcd_handle_intr(dwc_otg_hcd_t * dwc_otg_hcd) - if (gintsts.b.sofintr && g_np_count == g_np_sent && dwc_frame_num_gt(g_next_sched_frame, hfnum.b.frnum)) - { - /* Note, we should never get here if the FIQ is doing it's job properly*/ -- retval |= dwc_otg_hcd_handle_sof_intr(dwc_otg_hcd); -+ retval |= dwc_otg_hcd_handle_sof_intr(dwc_otg_hcd, g_work_expected); - } - else if (gintsts.b.sofintr) { -- retval |= dwc_otg_hcd_handle_sof_intr(dwc_otg_hcd); -+ retval |= dwc_otg_hcd_handle_sof_intr(dwc_otg_hcd, g_work_expected); - } -- - if (gintsts.b.rxstsqlvl) { - retval |= - dwc_otg_hcd_handle_rx_status_q_level_intr -@@ -546,10 +190,7 @@ int32_t dwc_otg_hcd_handle_intr(dwc_otg_hcd_t * dwc_otg_hcd) - /** @todo Implement i2cintr handler. */ - } - if (gintsts.b.portintr) { -- -- gintmsk_data_t gintmsk = { .b.portintr = 1}; - retval |= dwc_otg_hcd_handle_port_intr(dwc_otg_hcd); -- DWC_MODIFY_REG32(&core_if->core_global_regs->gintmsk, 0, gintmsk.d32); - } - if (gintsts.b.hcintr) { - retval |= dwc_otg_hcd_handle_hc_intr(dwc_otg_hcd); -@@ -586,35 +227,26 @@ int32_t dwc_otg_hcd_handle_intr(dwc_otg_hcd_t * dwc_otg_hcd) - - if (fiq_fix_enable) - { -- local_fiq_disable(); -- // Make sure that we don't clear the interrupt if we've still got pending work to do -- if(gintsts_saved.d32 == 0) -+ /* Clear the MPHI interrupt */ -+ DWC_WRITE_REG32(c_mphi_regs.intstat, (1<<16)); -+ if (mphi_int_count >= 60) - { -- /* Clear the MPHI interrupt */ -- DWC_WRITE_REG32(c_mphi_regs.intstat, (1<<16)); -- if (mphi_int_count >= 60) -- { -- DWC_WRITE_REG32(c_mphi_regs.ctrl, ((1<<31) + (1<<16))); -- while(!(DWC_READ_REG32(c_mphi_regs.ctrl) & (1 << 17))) -- ; -- DWC_WRITE_REG32(c_mphi_regs.ctrl, (1<<31)); -- mphi_int_count = 0; -- } -- int_done++; -+ DWC_WRITE_REG32(c_mphi_regs.ctrl, ((1<<31) + (1<<16))); -+ while(!(DWC_READ_REG32(c_mphi_regs.ctrl) & (1 << 17))) -+ ; -+ DWC_WRITE_REG32(c_mphi_regs.ctrl, (1<<31)); -+ mphi_int_count = 0; - } -- -- // Unmask handled interrupts -- FIQ_WRITE(dwc_regs_base + 0x18, gintmsk.d32); -- //DWC_MODIFY_REG32((uint32_t *)IO_ADDRESS(USB_BASE + 0x8), 0 , 1); -- -- local_fiq_enable(); -- -+ int_done++; - if((jiffies / HZ) > last_time) - { - /* Once a second output the fiq and irq numbers, useful for debug */ - last_time = jiffies / HZ; - DWC_DEBUGPL(DBG_USER, "int_done = %d fiq_done = %d\n", int_done, fiq_done); - } -+ -+ /* Re-Enable FIQ interrupt from USB peripheral */ -+ DWC_MODIFY_REG32((uint32_t *)IO_ADDRESS(USB_BASE + 0x8), 0 , 1); - } - - DWC_SPINUNLOCK(dwc_otg_hcd->lock); -@@ -662,12 +294,13 @@ static inline void track_missed_sofs(uint16_t curr_frame_number) - * (micro)frame. Periodic transactions may be queued to the controller for the - * next (micro)frame. - */ --int32_t dwc_otg_hcd_handle_sof_intr(dwc_otg_hcd_t * hcd) -+int32_t dwc_otg_hcd_handle_sof_intr(dwc_otg_hcd_t * hcd, int32_t work_expected) - { - hfnum_data_t hfnum; - dwc_list_link_t *qh_entry; - dwc_otg_qh_t *qh; - dwc_otg_transaction_type_e tr_type; -+ gintsts_data_t gintsts = {.d32 = 0 }; - int did_something = 0; - int32_t next_sched_frame = -1; - -@@ -693,7 +326,6 @@ int32_t dwc_otg_hcd_handle_sof_intr(dwc_otg_hcd_t * hcd) - qh = DWC_LIST_ENTRY(qh_entry, dwc_otg_qh_t, qh_list_entry); - qh_entry = qh_entry->next; - if (dwc_frame_num_le(qh->sched_frame, hcd->frame_number)) { -- - /* - * Move QH to the ready list to be executed next - * (micro)frame. -@@ -719,10 +351,15 @@ int32_t dwc_otg_hcd_handle_sof_intr(dwc_otg_hcd_t * hcd) - dwc_otg_hcd_queue_transactions(hcd, tr_type); - did_something = 1; - } -+ if(work_expected && !did_something) -+ DWC_DEBUGPL(DBG_USER, "Nothing to do !! frame = %x, g_next_sched_frame = %x\n", (int) hfnum.b.frnum, g_next_sched_frame); -+ if(!work_expected && did_something) -+ DWC_DEBUGPL(DBG_USER, "Unexpected work done !! frame = %x, g_next_sched_frame = %x\n", (int) hfnum.b.frnum, g_next_sched_frame); -+ - - /* Clear interrupt */ -- //gintsts.b.sofintr = 1; -- //DWC_WRITE_REG32(&hcd->core_if->core_global_regs->gintsts, gintsts.d32); -+ gintsts.b.sofintr = 1; -+ DWC_WRITE_REG32(&hcd->core_if->core_global_regs->gintsts, gintsts.d32); - - return 1; - } -@@ -1006,15 +643,6 @@ int32_t dwc_otg_hcd_handle_hc_intr(dwc_otg_hcd_t * dwc_otg_hcd) - - haint.d32 = dwc_otg_read_host_all_channels_intr(dwc_otg_hcd->core_if); - -- // Overwrite with saved interrupts from fiq handler -- if(fiq_split_enable) -- { -- local_fiq_disable(); -- haint.d32 = haint_saved.d32; -- haint_saved.d32 = 0; -- local_fiq_enable(); -- } -- - for (i = 0; i < dwc_otg_hcd->core_if->core_params->host_channels; i++) { - if (haint.b2.chint & (1 << i)) { - retval |= dwc_otg_hcd_handle_hc_n_intr(dwc_otg_hcd, i); -@@ -1055,10 +683,7 @@ static uint32_t get_actual_xfer_length(dwc_hc_t * hc, - *short_read = (hctsiz.b.xfersize != 0); - } - } else if (hc->qh->do_split) { -- if(fiq_split_enable) -- length = split_out_xfersize[hc->hc_num]; -- else -- length = qtd->ssplit_out_xfer_count; -+ length = qtd->ssplit_out_xfer_count; - } else { - length = hc->xfer_len; - } -@@ -1102,6 +727,7 @@ static int update_urb_state_xfer_comp(dwc_hc_t * hc, - DWC_OTG_HC_XFER_COMPLETE, - &short_read); - -+ - /* non DWORD-aligned buffer case handling. */ - if (hc->align_buff && xfer_length && hc->ep_is_in) { - dwc_memcpy(urb->buf + urb->actual_length, hc->qh->dw_align_buf, -@@ -1304,9 +930,6 @@ static void release_channel(dwc_otg_hcd_t * hcd, - int free_qtd; - dwc_irqflags_t flags; - dwc_spinlock_t *channel_lock = hcd->channel_lock; --#ifdef FIQ_DEBUG -- int endp = qtd->urb ? qtd->urb->pipe_info.ep_num : 0; --#endif - - DWC_DEBUGPL(DBG_HCDV, " %s: channel %d, halt_status %d, xfer_len %d\n", - __func__, hc->hc_num, halt_status, hc->xfer_len); -@@ -1385,24 +1008,9 @@ static void release_channel(dwc_otg_hcd_t * hcd, - - DWC_SPINLOCK_IRQSAVE(channel_lock, &flags); - hcd->available_host_channels++; -- fiq_print(FIQDBG_PORTHUB, "AHC = %d ", hcd->available_host_channels); - DWC_SPINUNLOCK_IRQRESTORE(channel_lock, flags); - } - -- if(fiq_split_enable && hc->do_split) -- { -- if(!(hcd->hub_port[hc->hub_addr] & (1 << hc->port_addr))) -- { -- fiq_print(FIQDBG_ERR, "PRTNOTAL"); -- //BUG(); -- } -- -- hcd->hub_port[hc->hub_addr] &= ~(1 << hc->port_addr); -- hcd->hub_port_alloc[hc->hub_addr * 16 + hc->port_addr] = -1; -- -- fiq_print(FIQDBG_PORTHUB, "H%dP%d:RR%d", hc->hub_addr, hc->port_addr, endp); -- } -- - /* Try to queue more transfers now that there's a free channel. */ - tr_type = dwc_otg_hcd_select_transactions(hcd); - if (tr_type != DWC_OTG_TRANSACTION_NONE) { -@@ -2025,10 +1633,8 @@ static int32_t handle_hc_nyet_intr(dwc_otg_hcd_t * hcd, - hc->ep_type == DWC_OTG_EP_TYPE_ISOC) { - int frnum = dwc_otg_hcd_get_frame_number(hcd); - -- // With the FIQ running we only ever see the failed NYET - if (dwc_full_frame_num(frnum) != -- dwc_full_frame_num(hc->qh->sched_frame) || -- fiq_split_enable) { -+ dwc_full_frame_num(hc->qh->sched_frame)) { - /* - * No longer in the same full speed frame. - * Treat this as a transaction error. -@@ -2406,10 +2012,10 @@ static inline int halt_status_ok(dwc_otg_hcd_t * hcd, - static void handle_hc_chhltd_intr_dma(dwc_otg_hcd_t * hcd, - dwc_hc_t * hc, - dwc_otg_hc_regs_t * hc_regs, -- dwc_otg_qtd_t * qtd, -- hcint_data_t hcint, -- hcintmsk_data_t hcintmsk) -+ dwc_otg_qtd_t * qtd) - { -+ hcint_data_t hcint; -+ hcintmsk_data_t hcintmsk; - int out_nak_enh = 0; - - /* For core with OUT NAK enhancement, the flow for high- -@@ -2441,11 +2047,8 @@ static void handle_hc_chhltd_intr_dma(dwc_otg_hcd_t * hcd, - } - - /* Read the HCINTn register to determine the cause for the halt. */ -- if(!fiq_split_enable) -- { -- hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); -- hcintmsk.d32 = DWC_READ_REG32(&hc_regs->hcintmsk); -- } -+ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); -+ hcintmsk.d32 = DWC_READ_REG32(&hc_regs->hcintmsk); - - if (hcint.b.xfercomp) { - /** @todo This is here because of a possible hardware bug. Spec -@@ -2558,15 +2161,13 @@ static void handle_hc_chhltd_intr_dma(dwc_otg_hcd_t * hcd, - static int32_t handle_hc_chhltd_intr(dwc_otg_hcd_t * hcd, - dwc_hc_t * hc, - dwc_otg_hc_regs_t * hc_regs, -- dwc_otg_qtd_t * qtd, -- hcint_data_t hcint, -- hcintmsk_data_t hcintmsk) -+ dwc_otg_qtd_t * qtd) - { - DWC_DEBUGPL(DBG_HCDI, "--Host Channel %d Interrupt: " - "Channel Halted--\n", hc->hc_num); - - if (hcd->core_if->dma_enable) { -- handle_hc_chhltd_intr_dma(hcd, hc, hc_regs, qtd, hcint, hcintmsk); -+ handle_hc_chhltd_intr_dma(hcd, hc, hc_regs, qtd); - } else { - #ifdef DEBUG - if (!halt_status_ok(hcd, hc, hc_regs, qtd)) { -@@ -2583,7 +2184,7 @@ static int32_t handle_hc_chhltd_intr(dwc_otg_hcd_t * hcd, - int32_t dwc_otg_hcd_handle_hc_n_intr(dwc_otg_hcd_t * dwc_otg_hcd, uint32_t num) - { - int retval = 0; -- hcint_data_t hcint, hcint_orig; -+ hcint_data_t hcint; - hcintmsk_data_t hcintmsk; - dwc_hc_t *hc; - dwc_otg_hc_regs_t *hc_regs; -@@ -2596,23 +2197,12 @@ int32_t dwc_otg_hcd_handle_hc_n_intr(dwc_otg_hcd_t * dwc_otg_hcd, uint32_t num) - qtd = DWC_CIRCLEQ_FIRST(&hc->qh->qtd_list); - - hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); -- hcint_orig = hcint; - hcintmsk.d32 = DWC_READ_REG32(&hc_regs->hcintmsk); - DWC_DEBUGPL(DBG_HCDV, - " hcint 0x%08x, hcintmsk 0x%08x, hcint&hcintmsk 0x%08x\n", - hcint.d32, hcintmsk.d32, (hcint.d32 & hcintmsk.d32)); - hcint.d32 = hcint.d32 & hcintmsk.d32; - -- if(fiq_split_enable) -- { -- // replace with the saved interrupts from the fiq handler -- local_fiq_disable(); -- hcint_orig.d32 = hcint_saved[num].d32; -- hcint.d32 = hcint_orig.d32 & hcintmsk_saved[num].d32; -- hcint_saved[num].d32 = 0; -- local_fiq_enable(); -- } -- - if (!dwc_otg_hcd->core_if->dma_enable) { - if (hcint.b.chhltd && hcint.d32 != 0x2) { - hcint.b.chhltd = 0; -@@ -2630,7 +2220,7 @@ int32_t dwc_otg_hcd_handle_hc_n_intr(dwc_otg_hcd_t * dwc_otg_hcd, uint32_t num) - hcint.b.nyet = 0; - } - if (hcint.b.chhltd) { -- retval |= handle_hc_chhltd_intr(dwc_otg_hcd, hc, hc_regs, qtd, hcint_orig, hcintmsk_saved[num]); -+ retval |= handle_hc_chhltd_intr(dwc_otg_hcd, hc, hc_regs, qtd); - } - if (hcint.b.ahberr) { - retval |= handle_hc_ahberr_intr(dwc_otg_hcd, hc, hc_regs, qtd); -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c -index 0d6f5f4..fef557d 100644 ---- a/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c -+++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c -@@ -392,11 +392,7 @@ static int _complete(dwc_otg_hcd_t * hcd, void *urb_handle, - static struct fiq_handler fh = { - .name = "usb_fiq", - }; --struct fiq_stack_s { -- int magic1; -- uint8_t stack[2048]; -- int magic2; --} fiq_stack; -+static uint8_t fiqStack[1024]; - - extern mphi_regs_t c_mphi_regs; - /** -@@ -438,11 +434,9 @@ int hcd_init(dwc_bus_dev_t *_dev) - memset(®s,0,sizeof(regs)); - regs.ARM_r8 = (long)dwc_otg_hcd_handle_fiq; - regs.ARM_r9 = (long)0; -- regs.ARM_sp = (long)fiq_stack.stack + sizeof(fiq_stack.stack) - 4; -+ regs.ARM_sp = (long)fiqStack + sizeof(fiqStack) - 4; - set_fiq_regs(®s); -- fiq_stack.magic1 = 0xdeadbeef; -- fiq_stack.magic2 = 0xaa995566; -- } -+ } - - /* - * Allocate memory for the base HCD plus the DWC OTG HCD. -@@ -465,8 +459,6 @@ int hcd_init(dwc_bus_dev_t *_dev) - - if (fiq_fix_enable) - { -- volatile extern void *dwc_regs_base; -- - //Set the mphi periph to the required registers - c_mphi_regs.base = otg_dev->os_dep.mphi_base; - c_mphi_regs.ctrl = otg_dev->os_dep.mphi_base + 0x4c; -@@ -474,8 +466,6 @@ int hcd_init(dwc_bus_dev_t *_dev) - c_mphi_regs.outddb = otg_dev->os_dep.mphi_base + 0x2c; - c_mphi_regs.intstat = otg_dev->os_dep.mphi_base + 0x50; - -- dwc_regs_base = otg_dev->os_dep.base; -- - //Enable mphi peripheral - writel((1<<31),c_mphi_regs.ctrl); - #ifdef DEBUG -@@ -849,8 +839,6 @@ static int dwc_otg_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) - usb_hcd_unlink_urb_from_ep(hcd, urb); - #endif - DWC_SPINUNLOCK_IRQRESTORE(dwc_otg_hcd->lock, flags); -- -- - #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) - usb_hcd_giveback_urb(hcd, urb); - #else -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c -index 8125307..b3e6e52 100644 ---- a/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c -+++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c -@@ -41,7 +41,6 @@ - - #include "dwc_otg_hcd.h" - #include "dwc_otg_regs.h" --#include "dwc_otg_mphi_fix.h" - - extern bool microframe_schedule; - -@@ -192,7 +191,6 @@ void qh_init(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh, dwc_otg_hcd_urb_t * urb) - dwc_otg_hcd_get_ep_num(&urb->pipe_info), hub_addr, - hub_port); - qh->do_split = 1; -- qh->skip_count = 0; - } - - if (qh->ep_type == UE_INTERRUPT || qh->ep_type == UE_ISOCHRONOUS) { -@@ -739,9 +737,6 @@ void dwc_otg_hcd_qh_remove(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) - hcd->non_periodic_qh_ptr->next; - } - DWC_LIST_REMOVE_INIT(&qh->qh_list_entry); -- -- // If we've removed the last non-periodic entry then there are none left! -- g_np_count = g_np_sent; - } else { - deschedule_periodic(hcd, qh); - hcd->periodic_qh_count--; -@@ -771,21 +766,21 @@ void dwc_otg_hcd_qh_deactivate(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh, - { - if (dwc_qh_is_non_per(qh)) { - -- dwc_otg_qh_t *qh_tmp; -- dwc_list_link_t *qh_list; -- DWC_LIST_FOREACH(qh_list, &hcd->non_periodic_sched_inactive) -+ dwc_otg_qh_t *qh_tmp; -+ dwc_list_link_t *qh_list; -+ DWC_LIST_FOREACH(qh_list, &hcd->non_periodic_sched_inactive) -+ { -+ qh_tmp = DWC_LIST_ENTRY(qh_list, struct dwc_otg_qh, qh_list_entry); -+ if(qh_tmp == qh) - { -- qh_tmp = DWC_LIST_ENTRY(qh_list, struct dwc_otg_qh, qh_list_entry); -- if(qh_tmp == qh) -- { -- /* -- * FIQ is being disabled because this one nevers gets a np_count increment -- * This is still not absolutely correct, but it should fix itself with -- * just an unnecessary extra interrupt -- */ -- g_np_sent = g_np_count; -- } -+ /* -+ * FIQ is being disabled because this one nevers gets a np_count increment -+ * This is still not absolutely correct, but it should fix itself with -+ * just an unnecessary extra interrupt -+ */ -+ g_np_sent = g_np_count; - } -+ } - - - dwc_otg_hcd_qh_remove(hcd, qh); -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_mphi_fix.h b/drivers/usb/host/dwc_otg/dwc_otg_mphi_fix.h -index ca17379..22f28e1 100755 ---- a/drivers/usb/host/dwc_otg/dwc_otg_mphi_fix.h -+++ b/drivers/usb/host/dwc_otg/dwc_otg_mphi_fix.h -@@ -1,7 +1,10 @@ - #ifndef __DWC_OTG_MPHI_FIX_H__ - #define __DWC_OTG_MPHI_FIX_H__ --#define FIQ_WRITE(_addr_,_data_) (*(volatile uint32_t *) (_addr_) = (_data_)) --#define FIQ_READ(_addr_) (*(volatile uint32_t *) (_addr_)) -+ -+#define FIQ_WRITE_IO_ADDRESS(_addr_,_data_) *(volatile uint32_t *) IO_ADDRESS(_addr_) = _data_ -+#define FIQ_READ_IO_ADDRESS(_addr_) *(volatile uint32_t *) IO_ADDRESS(_addr_) -+#define FIQ_MODIFY_IO_ADDRESS(_addr_,_clear_,_set_) FIQ_WRITE_IO_ADDRESS(_addr_ , (FIQ_READ_IO_ADDRESS(_addr_)&~_clear_)|_set_) -+#define FIQ_WRITE(_addr_,_data_) *(volatile uint32_t *) _addr_ = _data_ - - typedef struct { - volatile void* base; -@@ -9,13 +12,13 @@ - volatile void* outdda; - volatile void* outddb; - volatile void* intstat; --} mphi_regs_t; -+} mphi_regs_t; - - void dwc_debug_print_core_int_reg(gintsts_data_t gintsts, const char* function_name); - void dwc_debug_core_int_mask(gintsts_data_t gintmsk, const char* function_name); - void dwc_debug_otg_int(gotgint_data_t gotgint, const char* function_name); - --extern gintsts_data_t gintsts_saved; -+ - - #ifdef DEBUG - #define DWC_DBG_PRINT_CORE_INT(_arg_) dwc_debug_print_core_int_reg(_arg_,__func__) -@@ -27,22 +30,7 @@ - #define DWC_DBG_PRINT_CORE_INT_MASK(_arg_) - #define DWC_DBG_PRINT_OTG_INT(_arg_) - --#endif -- --typedef enum { -- FIQDBG_SCHED = (1 << 0), -- FIQDBG_INT = (1 << 1), -- FIQDBG_ERR = (1 << 2), -- FIQDBG_PORTHUB = (1 << 3), --} FIQDBG_T; - --void _fiq_print(FIQDBG_T dbg_lvl, char *fmt, ...); --#ifdef FIQ_DEBUG --#define fiq_print _fiq_print --#else --#define fiq_print(x, y, ...) - #endif - --extern bool fiq_fix_enable, nak_holdoff_enable, fiq_split_enable; -- - #endif -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c b/drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c -index 9720937..27061d3 100644 ---- a/drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c -+++ b/drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c -@@ -4276,7 +4276,7 @@ static int32_t dwc_otg_pcd_handle_out_ep_intr(dwc_otg_pcd_t * pcd) - && (pcd->ep0state == EP0_OUT_DATA_PHASE)) - status.d32 = core_if->dev_if->out_desc_addr->status.d32; - if (pcd->ep0state == EP0_OUT_STATUS_PHASE) -- status.d32 = core_if->dev_if-> -+ status.d32 = status.d32 = core_if->dev_if-> - out_desc_addr->status.d32; - - if (status.b.sr) { --- -1.8.1.6 - - -From 2fa497bfb56426ce8934f3a0ca3ac85a5c2e6008 Mon Sep 17 00:00:00 2001 +From 36657f543f34a08f35d438911997ac6eab7a9bfd Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 3 Jul 2013 13:55:00 +0100 -Subject: [PATCH 91/91] hack: fix for incorrect uart fifo size detection +Subject: [PATCH 90/99] hack: fix for incorrect uart fifo size detection --- drivers/tty/serial/amba-pl011.c | 2 +- @@ -100547,3 +99126,496 @@ index e2774f9..5254f10 100644 -- 1.8.1.6 + +From 894b002d9f89d5e68ef2b28fb190b4a983096ec7 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Wed, 10 Jul 2013 23:53:31 +0100 +Subject: [PATCH 93/99] sdhci-bcm2807: Increase sync_after_dma timeout + +The current timeout is being hit with some cards that complete successfully with a longer timeout. +The timeout is not handled well, and is believed to be a code path that causes corruption. +872a8ff suggests that crappy cards can take up to 3 seconds to respond +--- + drivers/mmc/host/sdhci-bcm2708.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/mmc/host/sdhci-bcm2708.c b/drivers/mmc/host/sdhci-bcm2708.c +index c2409b9..4770680 100644 +--- a/drivers/mmc/host/sdhci-bcm2708.c ++++ b/drivers/mmc/host/sdhci-bcm2708.c +@@ -842,7 +842,7 @@ static void sdhci_bcm2708_dma_complete_irq(struct sdhci_host *host, + We get CRC and DEND errors unless we wait for + the SD controller to finish reading/writing to the card. */ + u32 state_mask; +- int timeout=30*5000; ++ int timeout=3*1000*1000; + + DBG("PDMA over - sync card\n"); + if (data->flags & MMC_DATA_READ) +-- +1.8.1.6 + + +From 7d1ed3501217a5c3d40fbdf2d8168ceca2517c54 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Mon, 15 Jul 2013 23:55:52 +0100 +Subject: [PATCH 94/99] dcw_otg: avoid logging function that can cause panics + +See: https://github.com/raspberrypi/firmware/issues/21 +Thanks to cleverca22 for fix +--- + drivers/usb/host/dwc_otg/dwc_otg_attr.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_attr.c b/drivers/usb/host/dwc_otg/dwc_otg_attr.c +index 9602fda..c6966af 100644 +--- a/drivers/usb/host/dwc_otg/dwc_otg_attr.c ++++ b/drivers/usb/host/dwc_otg/dwc_otg_attr.c +@@ -920,7 +920,7 @@ static ssize_t spramdump_show(struct device *_dev, + { + dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); + +- dwc_otg_dump_spram(otg_dev->core_if); ++ //dwc_otg_dump_spram(otg_dev->core_if); + + return sprintf(buf, "SPRAM Dump\n"); + } +-- +1.8.1.6 + + +From 2b902d2bcd1ae9e5801a24615aaaa9129680a639 Mon Sep 17 00:00:00 2001 +From: P33M +Date: Sat, 13 Jul 2013 20:41:26 +0100 +Subject: [PATCH 95/99] dwc_otg: mask correct interrupts after transaction + error recovery + +The dwc_otg driver will unmask certain interrupts on a transaction +that previously halted in the error state in order to reset the +QTD error count. The various fine-grained interrupt handlers do not +consider that other interrupts besides themselves were unmasked. + +By disabling the two other interrupts only ever enabled in DMA mode +for this purpose, we can avoid unnecessary function calls in the +IRQ handler. This will also prevent an unneccesary FIQ interrupt +from being generated if the FIQ is enabled. +--- + drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c | 21 +++++++++++++++++++++ + 1 file changed, 21 insertions(+) + +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c +index e8b4d35..27b673f 100644 +--- a/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c ++++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c +@@ -1851,7 +1851,11 @@ static int32_t handle_hc_nak_intr(dwc_otg_hcd_t * hcd, + * transfers in DMA mode for the sole purpose of + * resetting the error count after a transaction error + * occurs. The core will continue transferring data. ++ * Disable other interrupts unmasked for the same ++ * reason. + */ ++ disable_hc_int(hc_regs, datatglerr); ++ disable_hc_int(hc_regs, ack); + qtd->error_count = 0; + goto handle_nak_done; + } +@@ -1963,6 +1967,15 @@ static int32_t handle_hc_ack_intr(dwc_otg_hcd_t * hcd, + halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_ACK); + } + } else { ++ /* ++ * An unmasked ACK on a non-split DMA transaction is ++ * for the sole purpose of resetting error counts. Disable other ++ * interrupts unmasked for the same reason. ++ */ ++ if(hcd->core_if->dma_enable) { ++ disable_hc_int(hc_regs, datatglerr); ++ disable_hc_int(hc_regs, nak); ++ } + qtd->error_count = 0; + + if (hc->qh->ping_state) { +@@ -2328,6 +2341,14 @@ static int32_t handle_hc_datatglerr_intr(dwc_otg_hcd_t * hcd, + qtd->urb, qtd, DWC_OTG_HC_XFER_XACT_ERR); + halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_XACT_ERR); + } else if (hc->ep_is_in) { ++ /* An unmasked data toggle error on a non-split DMA transaction is ++ * for the sole purpose of resetting error counts. Disable other ++ * interrupts unmasked for the same reason. ++ */ ++ if(hcd->core_if->dma_enable) { ++ disable_hc_int(hc_regs, ack); ++ disable_hc_int(hc_regs, nak); ++ } + qtd->error_count = 0; + } + +-- +1.8.1.6 + + +From 07ce82f9461cb966d2ee549bcd44e59d4019bf5e Mon Sep 17 00:00:00 2001 +From: P33M +Date: Sat, 13 Jul 2013 21:48:41 +0100 +Subject: [PATCH 96/99] dwc_otg: fiq: prevent FIQ thrash and incorrect state + passing to IRQ + +In the case of a transaction to a device that had previously aborted +due to an error, several interrupts are enabled to reset the error +count when a device responds. This has the side-effect of making the +FIQ thrash because the hardware will generate multiple instances of +a NAK on an IN bulk/interrupt endpoint and multiple instances of ACK +on an OUT bulk/interrupt endpoint. Make the FIQ mask and clear the +associated interrupts. + +Additionally, on non-split transactions make sure that only unmasked +interrupts are cleared. This caused a hard-to-trigger but serious +race condition when you had the combination of an endpoint awaiting +error recovery and a transaction completed on an endpoint - due to +the sequencing and timing of interrupts generated by the dwc_otg core, +it was possible to confuse the IRQ handler. +--- + drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c | 21 +++++++++++++++++++++ + 1 file changed, 21 insertions(+) + +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c +index 27b673f..d655363 100644 +--- a/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c ++++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c +@@ -324,6 +324,27 @@ int fiq_hcintr_handle(int channel, hfnum_data_t hfnum) + } + } + } ++ else ++ { ++ /* ++ * If we have any of NAK, ACK, Datatlgerr active on a ++ * non-split channel, the sole reason is to reset error ++ * counts for a previously broken transaction. The FIQ ++ * will thrash on NAK IN and ACK OUT in particular so ++ * handle it "once" and allow the IRQ to do the rest. ++ */ ++ hcint.d32 &= hcintmsk.d32; ++ if(hcint.b.nak) ++ { ++ hcintmsk.b.nak = 0; ++ FIQ_WRITE((dwc_regs_base + 0x500 + (channel * 0x20) + 0xc), hcintmsk.d32); ++ } ++ if (hcint.b.ack) ++ { ++ hcintmsk.b.ack = 0; ++ FIQ_WRITE((dwc_regs_base + 0x500 + (channel * 0x20) + 0xc), hcintmsk.d32); ++ } ++ } + + // Clear the interrupt, this will also clear the HAINT bit + FIQ_WRITE((dwc_regs_base + 0x500 + (channel * 0x20) + 0x8), hcint.d32); +-- +1.8.1.6 + + +From 2538878c1c3ec2da6d3cbf13d3e2820b06ce5ac5 Mon Sep 17 00:00:00 2001 +From: Gordon Hollingworth +Date: Mon, 8 Jul 2013 04:12:19 +0100 +Subject: [PATCH 97/99] Fix function tracing + +--- + drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c +index d655363..765451b 100644 +--- a/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c ++++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c +@@ -77,7 +77,7 @@ + #ifdef FIQ_DEBUG + char buffer[1000*16]; + int wptr; +-void _fiq_print(FIQDBG_T dbg_lvl, char *fmt, ...) ++void notrace _fiq_print(FIQDBG_T dbg_lvl, char *fmt, ...) + { + FIQDBG_T dbg_lvl_req = FIQDBG_PORTHUB; + va_list args; +@@ -101,7 +101,7 @@ void _fiq_print(FIQDBG_T dbg_lvl, char *fmt, ...) + } + #endif + +-void fiq_queue_request(int channel, int odd_frame) ++void notrace fiq_queue_request(int channel, int odd_frame) + { + hcchar_data_t hcchar = { .d32 = FIQ_READ(dwc_regs_base + 0x500 + (channel * 0x20) + 0x0) }; + hcsplt_data_t hcsplt = { .d32 = FIQ_READ(dwc_regs_base + 0x500 + (channel * 0x20) + 0x4) }; +@@ -147,7 +147,7 @@ void fiq_queue_request(int channel, int odd_frame) + */ + int diff; + +-int fiq_sof_handle(hfnum_data_t hfnum) ++int notrace fiq_sof_handle(hfnum_data_t hfnum) + { + int handled = 0; + int i; +@@ -206,12 +206,12 @@ int fiq_sof_handle(hfnum_data_t hfnum) + return handled; + } + +-int port_id(hcsplt_data_t hcsplt) ++int notrace port_id(hcsplt_data_t hcsplt) + { + return hcsplt.b.prtaddr + (hcsplt.b.hubaddr << 8); + } + +-int fiq_hcintr_handle(int channel, hfnum_data_t hfnum) ++int notrace fiq_hcintr_handle(int channel, hfnum_data_t hfnum) + { + hcchar_data_t hcchar = { .d32 = FIQ_READ(dwc_regs_base + 0x500 + (channel * 0x20) + 0x0) }; + hcsplt_data_t hcsplt = { .d32 = FIQ_READ(dwc_regs_base + 0x500 + (channel * 0x20) + 0x4) }; +@@ -361,7 +361,7 @@ int fiq_hcintr_handle(int channel, hfnum_data_t hfnum) + gintsts_data_t triggered, handled, keep; + hfnum_data_t hfnum; + +-void __attribute__ ((naked)) dwc_otg_hcd_handle_fiq(void) ++void __attribute__ ((naked)) notrace dwc_otg_hcd_handle_fiq(void) + { + + /* entry takes care to store registers we will be treading on here */ +-- +1.8.1.6 + + +From 3199ec63629973afe0dc99a9f11cf83b0f0a3c12 Mon Sep 17 00:00:00 2001 +From: P33M +Date: Thu, 18 Jul 2013 16:32:41 +0100 +Subject: [PATCH 98/99] dwc_otg: whitespace cleanup in dwc_otg_urb_enqueue + +--- + drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c | 59 ++++++++++++++-------------- + 1 file changed, 29 insertions(+), 30 deletions(-) + +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c +index 0d6f5f4..0f72bd5 100644 +--- a/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c ++++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c +@@ -733,10 +733,10 @@ static int dwc_otg_urb_enqueue(struct usb_hcd *hcd, + if(dwc_otg_urb == NULL) + return -ENOMEM; + +- urb->hcpriv = dwc_otg_urb; +- if (!dwc_otg_urb && urb->number_of_packets) +- return -ENOMEM; +- ++ urb->hcpriv = dwc_otg_urb; ++ if (!dwc_otg_urb && urb->number_of_packets) ++ return -ENOMEM; ++ + dwc_otg_hcd_urb_set_pipeinfo(dwc_otg_urb, usb_pipedevice(urb->pipe), + usb_pipeendpoint(urb->pipe), ep_type, + usb_pipein(urb->pipe), +@@ -776,36 +776,35 @@ static int dwc_otg_urb_enqueue(struct usb_hcd *hcd, + } + + #if USB_URB_EP_LINKING +- DWC_SPINLOCK_IRQSAVE(dwc_otg_hcd->lock, &irqflags); ++ DWC_SPINLOCK_IRQSAVE(dwc_otg_hcd->lock, &irqflags); + retval = usb_hcd_link_urb_to_ep(hcd, urb); +- DWC_SPINUNLOCK_IRQRESTORE(dwc_otg_hcd->lock, irqflags); +- if (0 == retval) ++ DWC_SPINUNLOCK_IRQRESTORE(dwc_otg_hcd->lock, irqflags); ++ if (0 == retval) + #endif +- { +- retval = dwc_otg_hcd_urb_enqueue(dwc_otg_hcd, dwc_otg_urb, +- /*(dwc_otg_qh_t **)*/ +- ref_ep_hcpriv, +- mem_flags == GFP_ATOMIC ? 1 : 0); +- if (0 == retval) { +- if (alloc_bandwidth) { +- allocate_bus_bandwidth(hcd, +- dwc_otg_hcd_get_ep_bandwidth( +- dwc_otg_hcd, *ref_ep_hcpriv), +- urb); +- } +- } else { ++ { ++ retval = dwc_otg_hcd_urb_enqueue(dwc_otg_hcd, dwc_otg_urb, ++ /*(dwc_otg_qh_t **)*/ ++ ref_ep_hcpriv, ++ mem_flags == GFP_ATOMIC ? 1 : 0); ++ if (0 == retval) { ++ if (alloc_bandwidth) { ++ allocate_bus_bandwidth(hcd, ++ dwc_otg_hcd_get_ep_bandwidth( ++ dwc_otg_hcd, *ref_ep_hcpriv), ++ urb); ++ } ++ } else { + #if USB_URB_EP_LINKING +- dwc_irqflags_t irqflags; +- DWC_DEBUGPL(DBG_HCD, "DWC OTG dwc_otg_hcd_urb_enqueue failed rc %d\n", retval); +- DWC_SPINLOCK_IRQSAVE(dwc_otg_hcd->lock, &irqflags); +- usb_hcd_unlink_urb_from_ep(hcd, urb); +- DWC_SPINUNLOCK_IRQRESTORE(dwc_otg_hcd->lock, irqflags); ++ dwc_irqflags_t irqflags; ++ DWC_DEBUGPL(DBG_HCD, "DWC OTG dwc_otg_hcd_urb_enqueue failed rc %d\n", retval); ++ DWC_SPINLOCK_IRQSAVE(dwc_otg_hcd->lock, &irqflags); ++ usb_hcd_unlink_urb_from_ep(hcd, urb); ++ DWC_SPINUNLOCK_IRQRESTORE(dwc_otg_hcd->lock, irqflags); + #endif +- if (retval == -DWC_E_NO_DEVICE) { +- retval = -ENODEV; +- } +- } +- } ++ if (retval == -DWC_E_NO_DEVICE) ++ retval = -ENODEV; ++ } ++ } + return retval; + } + +-- +1.8.1.6 + + +From b04d3b18742ce3a66b166c4bd7dabce67950c0ec Mon Sep 17 00:00:00 2001 +From: P33M +Date: Thu, 18 Jul 2013 17:07:26 +0100 +Subject: [PATCH 99/99] dwc_otg: prevent OOPSes during device disconnects + +The dwc_otg_urb_enqueue function is thread-unsafe. In particular the +access of urb->hcpriv, usb_hcd_link_urb_to_ep, dwc_otg_urb->qtd and +friends does not occur within a critical section and so if a device +was unplugged during activity there was a high chance that the +usbcore hub_thread would try to disable the endpoint with partially- +formed entries in the URB queue. This would result in BUG() or null +pointer dereferences. + +Fix so that access of urb->hcpriv, enqueuing to the hardware and +adding to usbcore endpoint URB lists is contained within a single +critical section. +--- + drivers/usb/host/dwc_otg/dwc_otg_hcd.c | 3 --- + drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c | 14 +++++--------- + drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c | 6 +----- + 3 files changed, 6 insertions(+), 17 deletions(-) + +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd.c +index af9108c..a1970dc 100644 +--- a/drivers/usb/host/dwc_otg/dwc_otg_hcd.c ++++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd.c +@@ -464,7 +464,6 @@ int dwc_otg_hcd_urb_enqueue(dwc_otg_hcd_t * hcd, + dwc_otg_hcd_urb_t * dwc_otg_urb, void **ep_handle, + int atomic_alloc) + { +- dwc_irqflags_t flags; + int retval = 0; + uint8_t needs_scheduling = 0; + dwc_otg_transaction_type_e tr_type; +@@ -515,12 +514,10 @@ int dwc_otg_hcd_urb_enqueue(dwc_otg_hcd_t * hcd, + } + + if(needs_scheduling) { +- DWC_SPINLOCK_IRQSAVE(hcd->lock, &flags); + tr_type = dwc_otg_hcd_select_transactions(hcd); + if (tr_type != DWC_OTG_TRANSACTION_NONE) { + dwc_otg_hcd_queue_transactions(hcd, tr_type); + } +- DWC_SPINUNLOCK_IRQRESTORE(hcd->lock, flags); + } + return retval; + } +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c +index 0f72bd5..ad03ff1 100644 +--- a/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c ++++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c +@@ -679,9 +679,7 @@ static int dwc_otg_urb_enqueue(struct usb_hcd *hcd, + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28) + struct usb_host_endpoint *ep = urb->ep; + #endif +-#if USB_URB_EP_LINKING + dwc_irqflags_t irqflags; +-#endif + void **ref_ep_hcpriv = &ep->hcpriv; + dwc_otg_hcd_t *dwc_otg_hcd = hcd_to_dwc_otg_hcd(hcd); + dwc_otg_hcd_urb_t *dwc_otg_urb; +@@ -733,7 +731,6 @@ static int dwc_otg_urb_enqueue(struct usb_hcd *hcd, + if(dwc_otg_urb == NULL) + return -ENOMEM; + +- urb->hcpriv = dwc_otg_urb; + if (!dwc_otg_urb && urb->number_of_packets) + return -ENOMEM; + +@@ -775,10 +772,10 @@ static int dwc_otg_urb_enqueue(struct usb_hcd *hcd, + iso_frame_desc[i].length); + } + +-#if USB_URB_EP_LINKING + DWC_SPINLOCK_IRQSAVE(dwc_otg_hcd->lock, &irqflags); ++ urb->hcpriv = dwc_otg_urb; ++#if USB_URB_EP_LINKING + retval = usb_hcd_link_urb_to_ep(hcd, urb); +- DWC_SPINUNLOCK_IRQRESTORE(dwc_otg_hcd->lock, irqflags); + if (0 == retval) + #endif + { +@@ -794,17 +791,16 @@ static int dwc_otg_urb_enqueue(struct usb_hcd *hcd, + urb); + } + } else { +-#if USB_URB_EP_LINKING +- dwc_irqflags_t irqflags; + DWC_DEBUGPL(DBG_HCD, "DWC OTG dwc_otg_hcd_urb_enqueue failed rc %d\n", retval); +- DWC_SPINLOCK_IRQSAVE(dwc_otg_hcd->lock, &irqflags); ++#if USB_URB_EP_LINKING + usb_hcd_unlink_urb_from_ep(hcd, urb); +- DWC_SPINUNLOCK_IRQRESTORE(dwc_otg_hcd->lock, irqflags); + #endif ++ urb->hcpriv = NULL; + if (retval == -DWC_E_NO_DEVICE) + retval = -ENODEV; + } + } ++ DWC_SPINUNLOCK_IRQRESTORE(dwc_otg_hcd->lock, irqflags); + return retval; + } + +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c +index 8125307..5aed416 100644 +--- a/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c ++++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c +@@ -919,6 +919,7 @@ void dwc_otg_hcd_qtd_init(dwc_otg_qtd_t * qtd, dwc_otg_hcd_urb_t * urb) + * QH to place the QTD into. If it does not find a QH, then it will create a + * new QH. If the QH to which the QTD is added is not currently scheduled, it + * is placed into the proper schedule based on its EP type. ++ * HCD lock must be held and interrupts must be disabled on entry + * + * @param[in] qtd The QTD to add + * @param[in] hcd The DWC HCD structure +@@ -931,8 +932,6 @@ int dwc_otg_hcd_qtd_add(dwc_otg_qtd_t * qtd, + dwc_otg_hcd_t * hcd, dwc_otg_qh_t ** qh, int atomic_alloc) + { + int retval = 0; +- dwc_irqflags_t flags; +- + dwc_otg_hcd_urb_t *urb = qtd->urb; + + /* +@@ -946,15 +945,12 @@ int dwc_otg_hcd_qtd_add(dwc_otg_qtd_t * qtd, + goto done; + } + } +- DWC_SPINLOCK_IRQSAVE(hcd->lock, &flags); + retval = dwc_otg_hcd_qh_add(hcd, *qh); + if (retval == 0) { + DWC_CIRCLEQ_INSERT_TAIL(&((*qh)->qtd_list), qtd, + qtd_list_entry); + qtd->qh = *qh; + } +- DWC_SPINUNLOCK_IRQRESTORE(hcd->lock, flags); +- + done: + + return retval; +-- +1.8.1.6 + diff --git a/projects/Ultra/linux/linux.x86_64.conf b/projects/Ultra/linux/linux.x86_64.conf index 007b35cdf6..0b619f8cb1 100644 --- a/projects/Ultra/linux/linux.x86_64.conf +++ b/projects/Ultra/linux/linux.x86_64.conf @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/x86_64 3.10.0 Kernel Configuration +# Linux/x86_64 3.10.2 Kernel Configuration # CONFIG_64BIT=y CONFIG_X86_64=y @@ -1290,7 +1290,11 @@ CONFIG_AR5523=m # CONFIG_WIL6210 is not set # CONFIG_B43 is not set # CONFIG_B43LEGACY is not set -# CONFIG_BRCMFMAC is not set +CONFIG_BRCMUTIL=m +CONFIG_BRCMFMAC=m +CONFIG_BRCMFMAC_USB=y +# CONFIG_BRCM_TRACING is not set +# CONFIG_BRCMDBG is not set CONFIG_HOSTAP=m CONFIG_HOSTAP_FIRMWARE=y CONFIG_HOSTAP_FIRMWARE_NVRAM=y diff --git a/projects/Ultra/options b/projects/Ultra/options index 8980bd4780..e88189243c 100755 --- a/projects/Ultra/options +++ b/projects/Ultra/options @@ -206,7 +206,7 @@ AFP_SUPPORT="yes" # build and install Samba Client support (yes / no) - SAMBA_CLIENT="yes" + SAMBA_SUPPORT="yes" # build and install Samba Server (yes / no) SAMBA_SERVER="yes" @@ -295,7 +295,7 @@ # joy,lb216,lcdm001,lcterm,lirc,lis,MD8800,mdm166a, # ms6931,mtc_s16209x,MtxOrb,mx5000,NoritakeVFD, # picolcd,pyramid,sed1330,sed1520,serialPOS, -# serialVFD,shuttleVFD,sli,stv5730,SureElec,svga, +# serialVFD,shuttleVFD,sli,stv5730,SureElec,svga,vlsys_m428 # 'all' compiles all drivers; # 'all,!xxx,!yyy' de-selects previously selected drivers # "none" for disable LCD support diff --git a/projects/Virtual/linux/linux.i386.conf b/projects/Virtual/linux/linux.i386.conf index 6ee5f48413..5a193b25fa 100644 --- a/projects/Virtual/linux/linux.i386.conf +++ b/projects/Virtual/linux/linux.i386.conf @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/i386 3.10.0 Kernel Configuration +# Linux/i386 3.10.2 Kernel Configuration # # CONFIG_64BIT is not set CONFIG_X86_32=y @@ -1438,7 +1438,7 @@ CONFIG_B43LEGACY_DMA_AND_PIO_MODE=y # CONFIG_B43LEGACY_PIO_MODE is not set CONFIG_BRCMUTIL=m CONFIG_BRCMFMAC=m -CONFIG_BRCMFMAC_SDIO=y +# CONFIG_BRCMFMAC_SDIO is not set CONFIG_BRCMFMAC_USB=y # CONFIG_BRCM_TRACING is not set # CONFIG_BRCMDBG is not set diff --git a/projects/Virtual/linux/linux.x86_64.conf b/projects/Virtual/linux/linux.x86_64.conf index bf600d9547..1ac2d81744 100644 --- a/projects/Virtual/linux/linux.x86_64.conf +++ b/projects/Virtual/linux/linux.x86_64.conf @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/x86_64 3.10.0 Kernel Configuration +# Linux/x86_64 3.10.2 Kernel Configuration # CONFIG_64BIT=y CONFIG_X86_64=y @@ -1419,7 +1419,7 @@ CONFIG_B43LEGACY_DMA_AND_PIO_MODE=y # CONFIG_B43LEGACY_PIO_MODE is not set CONFIG_BRCMUTIL=m CONFIG_BRCMFMAC=m -CONFIG_BRCMFMAC_SDIO=y +# CONFIG_BRCMFMAC_SDIO is not set CONFIG_BRCMFMAC_USB=y # CONFIG_BRCM_TRACING is not set # CONFIG_BRCMDBG is not set diff --git a/projects/Virtual/options b/projects/Virtual/options index d62fd29709..78f994a37a 100755 --- a/projects/Virtual/options +++ b/projects/Virtual/options @@ -201,7 +201,7 @@ AFP_SUPPORT="yes" # build and install Samba Client support (yes / no) - SAMBA_CLIENT="yes" + SAMBA_SUPPORT="yes" # build and install Samba Server (yes / no) SAMBA_SERVER="yes" @@ -290,11 +290,11 @@ # joy,lb216,lcdm001,lcterm,lirc,lis,MD8800,mdm166a, # ms6931,mtc_s16209x,MtxOrb,mx5000,NoritakeVFD, # picolcd,pyramid,sed1330,sed1520,serialPOS, -# serialVFD,shuttleVFD,sli,stv5730,SureElec,svga, +# serialVFD,shuttleVFD,sli,stv5730,SureElec,svga,vlsys_m428 # 'all' compiles all drivers; # 'all,!xxx,!yyy' de-selects previously selected drivers # "none" for disable LCD support - LCD_DRIVER="irtrans,imon,imonlcd,mdm166a,MtxOrb,lis,dm140,hd44780,CFontz,SureElec" + LCD_DRIVER="irtrans,imon,imonlcd,mdm166a,MtxOrb,lis,dm140,hd44780,CFontz,SureElec,vlsys_m428" # Modules to install in initramfs for early boot INITRAMFS_MODULES="uvesafb xhci-hcd" diff --git a/scripts/autoreconf b/scripts/autoreconf index 9690053c7b..3ab0684714 100755 --- a/scripts/autoreconf +++ b/scripts/autoreconf @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash ################################################################################ # This file is part of OpenELEC - http://www.openelec.tv diff --git a/scripts/build b/scripts/build index b5aaff04db..31fb5e4d84 100755 --- a/scripts/build +++ b/scripts/build @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash ################################################################################ # This file is part of OpenELEC - http://www.openelec.tv @@ -23,10 +23,21 @@ . config/options $1 if [ -z "$1" ]; then - echo "usage: $0 package_name" + echo "usage: $0 package_name[:host|target]" exit 1 fi +# set defaults + PKG_CONFIGURE_SCRIPT="" + PKG_MAKE_OPTS="" + PKG_MAKEINSTALL_OPTS="" + + PACKAGE_NAME=$(echo $1 | awk -F : '{print $1}') + TARGET=$(echo $1 | awk -F : '{print $2}') + if [ -z "$TARGET" ]; then + TARGET="target" + fi + if [ -n "$PKG_ARCH" -a ! "$PKG_ARCH" = "any" ]; then echo "$PKG_ARCH" | grep -q "$TARGET_ARCH" || exit 0 echo "$PKG_ARCH" | grep -q "\-$TARGET_ARCH" && exit 0 @@ -34,54 +45,282 @@ fi unset INSTALL -mkdir -p $STAMPS/$1 -STAMP=$STAMPS/$1/build +mkdir -p $STAMPS/$PACKAGE_NAME +STAMP=$STAMPS/$PACKAGE_NAME/build_$TARGET -$SCRIPTS/unpack $1 +$SCRIPTS/unpack $PACKAGE_NAME if [ -f $STAMP -a -f $PKG_DIR/need_build ]; then - $PKG_DIR/need_build $@ + $PKG_DIR/need_build $PACKAGE_NAME fi -if [ -f $STAMP -a $PKG_DIR/build -nt $STAMP ]; then - rm -f $STAMP +if [ -f $PKG_DIR/package.mk ]; then + if [ -f $STAMP -a $PKG_DIR/package.mk -nt $STAMP ]; then + rm -f $STAMP + fi +elif [ -f $PKG_DIR/build ]; then + if [ -f $STAMP -a $PKG_DIR/build -nt $STAMP ]; then + rm -f $STAMP + fi fi if [ ! -f $STAMP ]; then rm -f $STAMP - printf "%${BUILD_INDENT}c BUILD $1\n" ' '>&$SILENT_OUT + if [ -f $PKG_DIR/package.mk ]; then + printf "%${BUILD_INDENT}c BUILD $PACKAGE_NAME ($TARGET)\n" ' '>&$SILENT_OUT + elif [ -f $PKG_DIR/build ]; then + printf "%${BUILD_INDENT}c BUILD $PACKAGE_NAME (deprecated packageformat, please convert soon!)\n" ' '>&$SILENT_OUT + fi export BUILD_INDENT=$((${BUILD_INDENT:-1}+$BUILD_INDENT_SIZE)) - for p in $PKG_BUILD_DEPENDS; do - $SCRIPTS/build $p - done + if [ -f $PKG_DIR/package.mk ]; then + setup_toolchain $TARGET - [ -d $BUILD/${PKG_NAME}[-_.]${PKG_VERSION} ] && PKG_BUILD=`ls -d $BUILD/${PKG_NAME}[-_.]${PKG_VERSION}` - [ -d $BUILD/${PKG_NAME}${PKG_VERSION} ] && PKG_BUILD=`ls -d $BUILD/${PKG_NAME}${PKG_VERSION}` - [ "$PKG_AUTORECONF" = yes ] && $SCRIPTS/autoreconf $1 + # unset functions + unset -f pre_build_target + unset -f pre_configure_target + unset -f configure_target + unset -f post_configure_target + unset -f pre_make_target + unset -f make_target + unset -f post_make_target + unset -f pre_makeinstall_target + unset -f makeinstall_target + unset -f post_makeinstall_target - if [ -f $PKG_DIR/build ]; then - $PKG_DIR/build $@ >&$VERBOSE_OUT - if [ ! "$DEBUG" = yes ]; then - $STRIP `find $BUILD/$1* -name "*.so"` 2>/dev/null || \ - echo "Information: no *.so libs found" - $STRIP `find $BUILD/$1* -name "*.so.[0-9]*"` 2>/dev/null ||\ - echo "Information: no *.so.[0-9]* libs found" + unset -f pre_build_host + unset -f pre_configure_host + unset -f configure_host + unset -f post_configure_host + unset -f pre_make_host + unset -f make_host + unset -f post_make_host + unset -f pre_makeinstall_host + unset -f makeinstall_host + unset -f post_makeinstall_host + + + # configure TARGET build defaults + unset -v TARGET_CONFIGURE_OPTS + TARGET_CONFIGURE_OPTS="--host=$TARGET_NAME \ + --build=$HOST_NAME \ + --prefix=/usr \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ + --sysconfdir=/etc \ + --libexecdir=/usr/lib \ + --localstatedir=/var \ + --disable-static \ + --enable-shared" + + # configure HOST build defaults + unset -v HOST_CONFIGURE_OPTS + HOST_CONFIGURE_OPTS="--host=$HOST_NAME \ + --build=$HOST_NAME \ + --prefix=$ROOT/$TOOLCHAIN \ + --bindir=$ROOT/$TOOLCHAIN/bin \ + --sbindir=$ROOT/$TOOLCHAIN/sbin \ + --sysconfdir=$ROOT/$TOOLCHAIN/etc \ + --libexecdir=$ROOT/$TOOLCHAIN/lib \ + --localstatedir=$ROOT/$TOOLCHAIN/var \ + --disable-static \ + --enable-shared" + + # include buildfile + . $PKG_DIR/package.mk + + if [ "$TARGET" = "target" ]; then + for p in $PKG_BUILD_DEPENDS_TARGET; do + $SCRIPTS/build $p + done + elif [ "$TARGET" = "host" ]; then + for p in $PKG_BUILD_DEPENDS_HOST; do + $SCRIPTS/build $p + done + fi + + if [ "$PKG_AUTORECONF" = yes ]; then + $SCRIPTS/autoreconf $PACKAGE_NAME + fi + + # virtual packages dont must be build, they only contains dependencies, so dont go further here + if [ ! "$PKG_SECTION" = "virtual" ]; then + + if [ -z "$PKG_BUILD" ]; then + if [ -d "$BUILD/${PKG_NAME}-${PKG_VERSION}" ]; then + PKG_BUILD="$BUILD/${PKG_NAME}-${PKG_VERSION}" + elif [ -d "$BUILD/${PKG_NAME}_${PKG_VERSION}" ]; then + PKG_BUILD="$BUILD/${PKG_NAME}_${PKG_VERSION}" + elif [ -d "$BUILD/${PKG_NAME}.${PKG_VERSION}" ]; then + PKG_BUILD="$BUILD/${PKG_NAME}.${PKG_VERSION}" + elif [ -d "$BUILD/${PKG_NAME}${PKG_VERSION}" ]; then + PKG_BUILD="$BUILD/${PKG_NAME}${PKG_VERSION}" + elif [ -d "$BUILD/${PKG_NAME}" ]; then + PKG_BUILD="$BUILD/${PKG_NAME}" + fi + fi + + # configure other variables + INSTALL=$ROOT/$PKG_BUILD/.install_pkg + + # setup configure script + if [ -z "$PKG_CONFIGURE_SCRIPT" ]; then + PKG_CONFIGURE_SCRIPT="$ROOT/$PKG_BUILD/configure" + else + PKG_CONFIGURE_SCRIPT="$ROOT/$PKG_BUILD/$PKG_CONFIGURE_SCRIPT" + fi + if [ -z "$PKG_CMAKE_SCRIPT" ]; then + PKG_CMAKE_SCRIPT="$ROOT/$PKG_BUILD/CMakeLists.txt" + else + PKG_CMAKE_SCRIPT="$ROOT/$PKG_BUILD/$PKG_CMAKE_SCRIPT" + fi + + # include build template and build + if [ "$(type -t pre_build_$TARGET)" = "function" ]; then + pre_build_$TARGET + fi + + cd $PKG_BUILD + + if [ "$TARGET" = "target" ]; then + if [ -f "$PKG_CONFIGURE_SCRIPT" -o -f "$PKG_CMAKE_SCRIPT" ]; then + mkdir -p .$TARGET_NAME + cd .$TARGET_NAME + fi + elif [ "$TARGET" = "host" ]; then + if [ -f "$PKG_CONFIGURE_SCRIPT" -o -f "$PKG_CMAKE_SCRIPT" ]; then + mkdir -p .$HOST_NAME + cd .$HOST_NAME + fi + fi + + # configure + if [ "$(type -t pre_configure_$TARGET)" = "function" ]; then + pre_configure_$TARGET + fi + if [ "$(type -t configure_$TARGET)" = "function" ]; then + configure_$TARGET + elif [ -f "$PKG_CONFIGURE_SCRIPT" ]; then + if [ "$TARGET" = "target" ]; then + $PKG_CONFIGURE_SCRIPT $TARGET_CONFIGURE_OPTS $PKG_CONFIGURE_OPTS_TARGET + elif [ "$TARGET" = "host" ]; then + $PKG_CONFIGURE_SCRIPT $HOST_CONFIGURE_OPTS $PKG_CONFIGURE_OPTS_HOST + fi + fi + if [ "$(type -t post_configure_$TARGET)" = "function" ]; then + post_configure_$TARGET + fi + + # make + if [ "$(type -t pre_make_$TARGET)" = "function" ]; then + pre_make_$TARGET + fi + if [ "$(type -t make_$TARGET)" = "function" ]; then + make_$TARGET + else + if [ "$TARGET" = "target" ]; then + make $PKG_MAKE_OPTS_TARGET + elif [ "$TARGET" = "host" ]; then + make $PKG_MAKE_OPTS_HOST + fi + fi + if [ "$(type -t post_make_$TARGET)" = "function" ]; then + post_make_$TARGET + fi + + # make install + if [ "$(type -t pre_makeinstall_$TARGET)" = "function" ]; then + pre_makeinstall_$TARGET + fi + if [ "$(type -t makeinstall_$TARGET)" = "function" ]; then + makeinstall_$TARGET + else + if [ "$TARGET" = "target" ]; then + $MAKEINSTALL $PKG_MAKEINSTALL_OPTS_TARGET + make install DESTDIR=$INSTALL $PKG_MAKEINSTALL_OPTS_TARGET + elif [ "$TARGET" = "host" ]; then + make install $PKG_MAKEINSTALL_OPTS_HOST + fi + fi + if [ "$(type -t post_makeinstall_$TARGET)" = "function" ]; then + post_makeinstall_$TARGET + fi + + if [ "$TARGET" = "target" ]; then + rm -rf $INSTALL/usr/include + rm -rf $INSTALL/usr/lib/pkgconfig + rm -rf $INSTALL/usr/share/aclocal + rm -rf $INSTALL/usr/share/bash-completion + rm -rf $INSTALL/usr/share/doc + rm -rf $INSTALL/usr/share/gtk-doc + rm -rf $INSTALL/usr/share/info + rm -rf $INSTALL/usr/share/locale + rm -rf $INSTALL/usr/share/man + find $INSTALL/lib -name "*.la" -exec rm -rf "{}" ";" 2>/dev/null || true + find $INSTALL/usr/lib -name "*.la" -exec rm -rf "{}" ";" 2>/dev/null || true + find $INSTALL/lib -name "*.a" -exec rm -rf "{}" ";" 2>/dev/null || true + find $INSTALL/usr/lib -name "*.a" -exec rm -rf "{}" ";" 2>/dev/null || true + find $INSTALL/lib -name "*.so*T" -exec rm -rf "{}" ";" 2>/dev/null || true + find $INSTALL/usr/lib -name "*.so*T" -exec rm -rf "{}" ";" 2>/dev/null || true + find $INSTALL -type d -exec rmdir -p "{}" ";" 2>/dev/null || true + + if [ ! "$DEBUG" = yes ]; then + $STRIP `find $INSTALL -name "*.so"` 2>/dev/null || echo "Information: no *.so libs found" + $STRIP `find $INSTALL -name "*.so.[0-9]*"` 2>/dev/null || echo "Information: no *.so.[0-9]* libs found" + fi + fi + + cd $ROOT + + fi # ! "$PKG_SECTION" = "virtual" + + elif [ -f $PKG_DIR/meta ]; then + + for p in $PKG_BUILD_DEPENDS; do + $SCRIPTS/build $p + done + + if [ "$PKG_AUTORECONF" = yes ]; then + $SCRIPTS/autoreconf $PACKAGE_NAME fi - for i in `find $SYSROOT_PREFIX/usr/lib/ -name "*.la"`; do \ - $SED "s:\(['= ]\)/usr:\\1$SYSROOT_PREFIX/usr:g" $i; \ - done - elif [ -f $PKG_BUILD/Makefile ]; then - $SCRIPTS/build toolchain - make -C $PKG_BUILD >&$VERBOSE_OUT - for i in `find $SYSROOT_PREFIX/usr/lib/ -name "*.la"`; do \ - $SED "s:\(['= ]\)/usr:\\1$SYSROOT_PREFIX/usr:g" $i; \ - done - elif [ -f $PKG_BUILD/$1.c ]; then - $SCRIPTS/build toolchain - make -C $PKG_BUILD $1 >&$VERBOSE_OUT - fi + + if [ -d "$BUILD/${PKG_NAME}-${PKG_VERSION}" ]; then + PKG_BUILD="$BUILD/${PKG_NAME}-${PKG_VERSION}" + elif [ -d "$BUILD/${PKG_NAME}_${PKG_VERSION}" ]; then + PKG_BUILD="$BUILD/${PKG_NAME}_${PKG_VERSION}" + elif [ -d "$BUILD/${PKG_NAME}.${PKG_VERSION}" ]; then + PKG_BUILD="$BUILD/${PKG_NAME}.${PKG_VERSION}" + elif [ -d "$BUILD/${PKG_NAME}${PKG_VERSION}" ]; then + PKG_BUILD="$BUILD/${PKG_NAME}${PKG_VERSION}" + elif [ -d "$BUILD/${PKG_NAME}" ]; then + PKG_BUILD="$BUILD/${PKG_NAME}" + fi + + if [ -f $PKG_DIR/build ]; then + $PKG_DIR/build $@ >&$VERBOSE_OUT + + if [ ! "$DEBUG" = yes ]; then + $STRIP `find $BUILD/$PACKAGE_NAME* -name "*.so"` 2>/dev/null || \ + echo "Information: no *.so libs found" + $STRIP `find $BUILD/$PACKAGE_NAME* -name "*.so.[0-9]*"` 2>/dev/null ||\ + echo "Information: no *.so.[0-9]* libs found" + fi + + elif [ -f $PKG_BUILD/Makefile ]; then + $SCRIPTS/build toolchain + make -C $PKG_BUILD >&$VERBOSE_OUT + + elif [ -f $PKG_BUILD/$PACKAGE_NAME.c ]; then + $SCRIPTS/build toolchain + make -C $PKG_BUILD $PACKAGE_NAME >&$VERBOSE_OUT + + fi # -f $PKG_DIR/build + fi # -f $PKG_DIR/meta + + for i in `find $SYSROOT_PREFIX/usr/lib/ -name "*.la"`; do \ + $SED "s:\(['= ]\)/usr:\\1$SYSROOT_PREFIX/usr:g" $i; \ + done for i in `sed -n "s/^\([^#].*\)=\".*$/\1/p" $PROJECT_DIR/$PROJECT/options | grep -v "#"`; do eval val=\$$i diff --git a/scripts/checkdeps b/scripts/checkdeps index 1ffd64e734..20567cd829 100755 --- a/scripts/checkdeps +++ b/scripts/checkdeps @@ -33,8 +33,8 @@ case $1 in deps_pkg="wget" ;; build) - deps="bc gcc g++ sed patch touch tar bzip2 gzip perl cp gawk makeinfo gperf cvs zip unzip mkfontscale diff xsltproc java" - deps_pkg="bc gcc g++ sed patch fileutils tar bzip2 gzip perl coreutils gawk texinfo gperf cvs zip unzip xutils diff xsltproc default-jre" + deps="bash bc gcc g++ sed patch touch tar bzip2 gzip perl cp gawk makeinfo gperf cvs zip unzip mkfontscale diff xsltproc java" + deps_pkg="bash bc gcc g++ sed patch fileutils tar bzip2 gzip perl coreutils gawk texinfo gperf cvs zip unzip xutils diff xsltproc default-jre" files="/usr/include/stdio.h /usr/include/ncurses.h" files_pkg="libc6-dev libncurses5-dev" ;; diff --git a/scripts/clean b/scripts/clean index e7cc9c797a..47c08431df 100755 --- a/scripts/clean +++ b/scripts/clean @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash ################################################################################ # This file is part of OpenELEC - http://www.openelec.tv @@ -39,7 +39,7 @@ clean () else rm -rf $PKG_BUILD rm -f $STAMPS/$1*/unpack - rm -f $STAMPS/$1*/build + rm -f $STAMPS/$1*/build_* fi } diff --git a/scripts/create_addon b/scripts/create_addon index 88035ba73e..d72b7c0cb0 100755 --- a/scripts/create_addon +++ b/scripts/create_addon @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash ################################################################################ # This file is part of OpenELEC - http://www.openelec.tv diff --git a/scripts/extract b/scripts/extract index 7446862ecf..32a2218bec 100755 --- a/scripts/extract +++ b/scripts/extract @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash ################################################################################ # This file is part of OpenELEC - http://www.openelec.tv diff --git a/scripts/get b/scripts/get index f69436fb55..5d58970205 100755 --- a/scripts/get +++ b/scripts/get @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash ################################################################################ # This file is part of OpenELEC - http://www.openelec.tv @@ -23,6 +23,10 @@ . config/options $1 if [ -z "$1" ]; then + for i in `find packages/ -type f -name package.mk`; do + GET_PKG=`grep ^PKG_NAME= $i | sed -e "s,\",,g" -e "s,PKG_NAME=,,"` + $SCRIPTS/get $GET_PKG + done for i in `find packages/ -type f -name meta`; do GET_PKG=`grep ^PKG_NAME= $i | sed -e "s,\",,g" -e "s,PKG_NAME=,,"` $SCRIPTS/get $GET_PKG diff --git a/scripts/image b/scripts/image index f1b62b31bf..787b02a141 100755 --- a/scripts/image +++ b/scripts/image @@ -30,8 +30,6 @@ $SCRIPTS/build squashfs $SCRIPTS/build fakeroot $SCRIPTS/build module-init-tools -export INSTALL=$BUILD/image/system - BUILD_DATE=`date +%Y%m%d%H%M%S` if [ "$OPENELEC_VERSION" = devel -o "$OPENELEC_VERSION" = debug ]; then @@ -103,6 +101,8 @@ IMAGE_NAME="$DISTRONAME-$TARGET_VERSION" echo "$DISTRONAME git: $GIT_HASH" >> $INSTALL/etc/issue fi + ln -sf /etc/issue $INSTALL/etc/motd + # Basissystem... $SCRIPTS/install eglibc $SCRIPTS/install gcc-final diff --git a/scripts/install b/scripts/install index 30dc72dbae..87947163bc 100755 --- a/scripts/install +++ b/scripts/install @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash ################################################################################ # This file is part of OpenELEC - http://www.openelec.tv @@ -47,6 +47,34 @@ if [ -n "$PKG_ARCH" -a ! "$PKG_ARCH" = "any" ]; then echo "$PKG_ARCH" | grep -q "\-$TARGET_ARCH" && exit 0 fi +$SCRIPTS/build $@ + +printf "%${BUILD_INDENT}c INSTALL $1\n" ' '>&$SILENT_OUT +export BUILD_INDENT=$((${BUILD_INDENT:-1}+$BUILD_INDENT_SIZE)) + +for p in $PKG_DEPENDS $PKG_DEPENDS_TARGET; do + $SCRIPTS/install $p +done + +if [ -d "$BUILD/${PKG_NAME}-${PKG_VERSION}" ]; then + PKG_BUILD="$BUILD/${PKG_NAME}-${PKG_VERSION}" +elif [ -d "$BUILD/${PKG_NAME}_${PKG_VERSION}" ]; then + PKG_BUILD="$BUILD/${PKG_NAME}_${PKG_VERSION}" +elif [ -d "$BUILD/${PKG_NAME}.${PKG_VERSION}" ]; then + PKG_BUILD="$BUILD/${PKG_NAME}.${PKG_VERSION}" +elif [ -d "$BUILD/${PKG_NAME}${PKG_VERSION}" ]; then + PKG_BUILD="$BUILD/${PKG_NAME}${PKG_VERSION}" +elif [ -d "$BUILD/${PKG_NAME}" ]; then + PKG_BUILD="$BUILD/${PKG_NAME}" +fi + +if [ -d $PKG_BUILD/.install_pkg ]; then + mkdir -p $INSTALL + cp -PR $PKG_BUILD/.install_pkg/* $INSTALL +elif [ -f $PKG_DIR/install ]; then + $PKG_DIR/install $@ >&$VERBOSE_OUT +fi + if [ -d $PKG_DIR/init.d ]; then mkdir -p $INSTALL/etc/init.d cp $PKG_DIR/init.d/* $INSTALL/etc/init.d/ @@ -72,19 +100,6 @@ if [ -d $PKG_DIR/init.network ]; then cp $PKG_DIR/init.network/* $INSTALL/etc/init.d/network/ fi -$SCRIPTS/build $@ - -printf "%${BUILD_INDENT}c INSTALL $1\n" ' '>&$SILENT_OUT -export BUILD_INDENT=$((${BUILD_INDENT:-1}+$BUILD_INDENT_SIZE)) - -for p in $PKG_DEPENDS; do - $SCRIPTS/install $p -done - -if [ -f $PKG_DIR/install ]; then - $PKG_DIR/install $@ >&$VERBOSE_OUT -fi - for i in `sed -n "s/^\([^#].*\)=\".*$/\1/p" $PROJECT_DIR/$PROJECT/options | grep -v "#"`; do eval val=\$$i echo "STAMP_$i=\"$val"\" >> $STAMP diff --git a/scripts/unpack b/scripts/unpack index eaf3673a55..cf418ad34e 100755 --- a/scripts/unpack +++ b/scripts/unpack @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash ################################################################################ # This file is part of OpenELEC - http://www.openelec.tv @@ -73,9 +73,17 @@ if [ -d "$PKG_DIR/sources" ]; then cp -PRf $PKG_DIR/sources/* $BUILD/${PKG_NAME}-${PKG_VERSION} fi -[ -d $BUILD/${PKG_NAME}[-_.]${PKG_VERSION} ] && PKG_BUILD=`ls -d $BUILD/${PKG_NAME}[-_.]${PKG_VERSION}` -[ -d $BUILD/${PKG_NAME}${PKG_VERSION} ] && PKG_BUILD=`ls -d $BUILD/${PKG_NAME}${PKG_VERSION}` -[ -d $BUILD/${PKG_NAME} ] && PKG_BUILD=`ls -d $BUILD/${PKG_NAME}` +if [ -d "$BUILD/${PKG_NAME}-${PKG_VERSION}" ]; then + PKG_BUILD="$BUILD/${PKG_NAME}-${PKG_VERSION}" +elif [ -d "$BUILD/${PKG_NAME}_${PKG_VERSION}" ]; then + PKG_BUILD="$BUILD/${PKG_NAME}_${PKG_VERSION}" +elif [ -d "$BUILD/${PKG_NAME}.${PKG_VERSION}" ]; then + PKG_BUILD="$BUILD/${PKG_NAME}.${PKG_VERSION}" +elif [ -d "$BUILD/${PKG_NAME}${PKG_VERSION}" ]; then + PKG_BUILD="$BUILD/${PKG_NAME}${PKG_VERSION}" +elif [ -d "$BUILD/${PKG_NAME}" ]; then + PKG_BUILD="$BUILD/${PKG_NAME}" +fi for i in $PKG_DIR/patches/$PKG_NAME-*.patch ; do if [ -f "$i" ]; then @@ -130,7 +138,7 @@ for config in `find $BUILD/$1* -name config.guess | sed 's/config.guess//'`; do [ -f "$config/configure.sub" ] && cp -f $SCRIPTS/configtools/config.sub $config/configure.sub done -rm -f $STAMPS/$1/build +rm -f $STAMPS/$1/build_* for i in `sed -n "s/^\([^#].*\)=\".*$/\1/p" $PROJECT_DIR/$PROJECT/options | grep -v "#"`; do eval val=\$$i diff --git a/tools/mkpkg/mkpkg_maraschino b/tools/mkpkg/mkpkg_maraschino deleted file mode 100755 index 454934bc92..0000000000 --- a/tools/mkpkg/mkpkg_maraschino +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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 OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -echo "getting sources..." - if [ ! -d maraschino.git ]; then - git clone git://github.com/mrkipling/maraschino.git maraschino.git - fi - - cd maraschino.git - git pull - GIT_REV=`git log -n1 --format=%h` - cd .. - -echo "copying sources..." - rm -rf maraschino-$GIT_REV - cp -R maraschino.git maraschino-$GIT_REV - -echo "cleaning sources..." - rm -rf maraschino-$GIT_REV/.git - -echo "packing sources..." - tar cvJf maraschino-$GIT_REV.tar.xz maraschino-$GIT_REV - -echo "remove temporary sourcedir..." - rm -rf maraschino-$GIT_REV diff --git a/tools/mkpkg/mkpkg_xbmc-frodo-oe b/tools/mkpkg/mkpkg_xbmc-frodo-oe new file mode 100755 index 0000000000..56bd32b19b --- /dev/null +++ b/tools/mkpkg/mkpkg_xbmc-frodo-oe @@ -0,0 +1,81 @@ +#!/bin/sh +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) +# +# 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 OpenELEC.tv; see the file COPYING. If not, write to +# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ + +PKG_NAME="xbmc" +PKG_VERSION="" +GIT_REPO="-b openelec-Frodo git://github.com/OpenELEC/xbmc.git" +DEST_DIR="$PKG_NAME-frodo-openelec" + +echo "getting sources..." + if [ ! -d $DEST_DIR-latest ]; then + git clone $GIT_REPO $DEST_DIR-latest + fi + + cd $DEST_DIR-latest + git pull + + echo "getting version..." + GIT_REV=`git log -n1 --format=%h` + echo $GIT_REV + cd .. + + if [ -z "$PKG_VERSION" ]; then + PKG_VERSION="12.2-$GIT_REV" + fi + +echo "copying sources..." + rm -rf $PKG_NAME-$PKG_VERSION + cp -R $DEST_DIR-latest $PKG_NAME-$PKG_VERSION + echo "$GIT_REV" > $PKG_NAME-$PKG_VERSION/VERSION + +echo "cleaning sources..." + rm -rf $PKG_NAME-$PKG_VERSION/.git + +echo "seperating theme..." + rm -rf $PKG_NAME-theme-Confluence-$PKG_VERSION + mv $PKG_NAME-$PKG_VERSION/addons/skin.confluence $PKG_NAME-theme-Confluence-$PKG_VERSION + +echo "cleaning sources..." + rm -rf $PKG_NAME-$PKG_VERSION/visualisations + rm -rf $PKG_NAME-$PKG_VERSION/lib/libSDL-* + rm -rf $PKG_NAME-$PKG_VERSION/lib/libcurl-* + rm -rf $PKG_NAME-$PKG_VERSION/project + + for i in "Changelog" "Fake\ Episode\ Maker" "MingwBuildEnvironment" \ + "PackageMaker" "Translator" "XBMCLive" "XprPack" \ + "HardwareConfigure" "Mach5" "osx" "UpdateThumbs.py" "XBMCTex"; do + rm -rf $PKG_NAME-$PKG_VERSION/tools/$i + done + + for i in dll a lib so bat; do + find $PKG_NAME-$PKG_VERSION -name *.$i -exec rm -rf {} ";" + done + + # bundled win32 binaries + rm -r $PKG_NAME-$PKG_VERSION/xbmc/visualizations/XBMCProjectM/win32 + +echo "packing sources..." + tar cvJf $PKG_NAME-$PKG_VERSION.tar.xz $PKG_NAME-$PKG_VERSION + tar cvJf $PKG_NAME-theme-Confluence-$PKG_VERSION.tar.xz $PKG_NAME-theme-Confluence-$PKG_VERSION + +echo "remove temporary sourcedir..." + rm -rf $PKG_NAME-$PKG_VERSION + rm -rf $PKG_NAME-theme-Confluence-$PKG_VERSION