Skip to content

Commit

Permalink
addons: introduce new package Tvheadend 4.3
Browse files Browse the repository at this point in the history
added more recent version of TVH Backend, based on master branch,
commit 221c29b Nov 28, 2019.
  • Loading branch information
JimmyS83 authored and adamg committed Apr 5, 2020
1 parent f2726ef commit 8f37035
Show file tree
Hide file tree
Showing 25 changed files with 1,077 additions and 0 deletions.
34 changes: 34 additions & 0 deletions packages/addons/service/tvheadend43/addon.xml
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="@PKG_ADDON_ID@"
name="@ADDON_NAME@"
version="@ADDON_VERSION@"
provider-name="@PROVIDER_NAME@">
<requires>
<import addon="xbmc.python" version="2.1.0"/>
@REQUIRES@
</requires>
<extension point="xbmc.service" library="default.py">
<provides>@PKG_ADDON_PROVIDES@</provides>
</extension>
<extension point="xbmc.python.script" library="download.py">
<provides>@PKG_ADDON_PROVIDES@</provides>
</extension>
<extension point="xbmc.addon.metadata">
<summary>@PKG_SHORTDESC@</summary>
<description>
@PKG_LONGDESC@
</description>
<disclaimer>
@PKG_DISCLAIMER@
</disclaimer>
<platform>all</platform>
<news>
@PKG_ADDON_NEWS@
</news>
<assets>
<icon>resources/icon.png</icon>
<fanart>resources/fanart.png</fanart>
@PKG_ADDON_SCREENSHOT@
</assets>
</extension>
</addon>
2 changes: 2 additions & 0 deletions packages/addons/service/tvheadend43/changelog.txt
@@ -0,0 +1,2 @@
100
- initial CoreELEC version
Binary file added packages/addons/service/tvheadend43/icon/icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
133 changes: 133 additions & 0 deletions packages/addons/service/tvheadend43/package.mk
@@ -0,0 +1,133 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2018-present Team CoreELEC (https://coreelec.org)

PKG_NAME="tvheadend43"
PKG_VERSION="221c29b40b1e53ae09a69d9458442dd4fea665f5"
PKG_SHA256="0c2cc2ee09d21b34f2d72d971557a843b20a9e7da3d6550c4ce2fbe37c35ba13"
PKG_VERSION_NUMBER="221c29b"
PKG_REV="100"
PKG_ARCH="any"
PKG_LICENSE="GPL"
PKG_SITE="http://www.tvheadend.org"
PKG_URL="https://github.com/tvheadend/tvheadend/archive/$PKG_VERSION.tar.gz"
PKG_DEPENDS_TARGET="toolchain avahi comskip curl dvb-apps ffmpegx libdvbcsa libhdhomerun \
libiconv openssl pngquant:host Python2:host tvh-dtv-scan-tables"
PKG_SECTION="service"
PKG_SHORTDESC="Tvheadend: a TV streaming server for Linux"
PKG_LONGDESC="Tvheadend ($PKG_VERSION_NUMBER): is a TV streaming server for Linux supporting DVB-S/S2, DVB-C, DVB-T/T2, IPTV, SAT>IP, ATSC and ISDB-T"

PKG_IS_ADDON="yes"
PKG_ADDON_NAME="Tvheadend Server 4.3"
PKG_ADDON_TYPE="xbmc.service"

# basic transcoding options
PKG_TVH_TRANSCODING="\
--disable-ffmpeg_static \
--disable-libfdkaac_static \
--disable-libopus_static \
--disable-libtheora \
--disable-libtheora_static \
--disable-libvorbis_static \
--disable-libvpx_static \
--disable-libx264_static \
--disable-libx265_static \
--enable-libav \
--enable-libfdkaac \
--enable-libopus \
--enable-libvorbis \
--enable-libvpx \
--enable-libx264 \
--enable-libx265"

# specific transcoding options
if [[ "$TARGET_ARCH" != "x86_64" ]]; then
PKG_TVH_TRANSCODING="$PKG_TVH_TRANSCODING \
--disable-libvpx \
--disable-libx265"
fi

post_unpack() {
sed -e 's/VER="0.0.0~unknown"/VER="'$PKG_VERSION_NUMBER' ~ CoreELEC Tvh-addon v'$ADDON_VERSION'.'$PKG_REV'"/g' -i $PKG_BUILD/support/version
sed -e 's|'/usr/bin/pngquant'|'$TOOLCHAIN/bin/pngquant'|g' -i $PKG_BUILD/support/mkbundle
}

pre_configure_target() {
PKG_CONFIGURE_OPTS_TARGET="--prefix=/usr \
--arch=$TARGET_ARCH \
--cpu=$TARGET_CPU \
--cc=$CC \
$PKG_TVH_TRANSCODING \
--enable-avahi \
--enable-bundle \
--disable-dbus_1 \
--enable-dvbcsa \
--disable-dvben50221 \
--disable-dvbscan \
--enable-hdhomerun_client \
--disable-hdhomerun_static \
--enable-epoll \
--enable-inotify \
--enable-pngquant \
--disable-libmfx_static \
--disable-nvenc \
--disable-uriparser \
--enable-tvhcsa \
--enable-trace \
--nowerror \
--disable-bintray_cache \
--python=$TOOLCHAIN/bin/python"

# fails to build in subdirs
cd $PKG_BUILD
rm -rf .$TARGET_NAME

# pass ffmpegx to build
PKG_CONFIG_PATH="$(get_build_dir ffmpegx)/.INSTALL_PKG/usr/local/lib/pkgconfig"
CFLAGS+=" -I$(get_build_dir ffmpegx)/.INSTALL_PKG/usr/local/include"
LDFLAGS+=" -L$(get_build_dir ffmpegx)/.INSTALL_PKG/usr/local/lib"

# pass gnutls to build
LDFLAGS="$LDFLAGS -L$(get_build_dir gnutls)/.INSTALL_PKG/usr/lib"

# pass libhdhomerun to build
CFLAGS+=" -I$(get_build_dir libhdhomerun)"

export CROSS_COMPILE="$TARGET_PREFIX"
export CFLAGS+=" -I$SYSROOT_PREFIX/usr/include/iconv -L$SYSROOT_PREFIX/usr/lib/iconv"
}

post_make_target() {
$CC -O -fbuiltin -fomit-frame-pointer -fPIC -shared -o capmt_ca.so src/extra/capmt_ca.c -ldl
}

makeinstall_target() {
:
}

addon() {
mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin

cp $PKG_DIR/addon.xml $ADDON_BUILD/$PKG_ADDON_ID

# copy gnutls lib that is needed for ffmpeg
mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/lib
cp -PL $(get_build_dir gnutls)/.INSTALL_PKG/usr/lib/libgnutls.so.30 $ADDON_BUILD/$PKG_ADDON_ID/lib
cp -PL $(get_build_dir nettle)/.install_pkg/usr/lib/libnettle.so.6 $ADDON_BUILD/$PKG_ADDON_ID/lib
cp -PL $(get_build_dir nettle)/.install_pkg/usr/lib/libhogweed.so.4 $ADDON_BUILD/$PKG_ADDON_ID/lib
cp -PL $(get_build_dir gmp)/.install_pkg/usr/lib/libgmp.so.10 $ADDON_BUILD/$PKG_ADDON_ID/lib

# set only version (revision will be added by buildsystem)
sed -e "s|@ADDON_VERSION@|$ADDON_VERSION|g" \
-i $ADDON_BUILD/$PKG_ADDON_ID/addon.xml

cp -P $PKG_BUILD/build.linux/tvheadend $ADDON_BUILD/$PKG_ADDON_ID/bin
cp -P $PKG_BUILD/capmt_ca.so $ADDON_BUILD/$PKG_ADDON_ID/bin
cp -P $(get_build_dir comskip)/.install_pkg/usr/bin/comskip $ADDON_BUILD/$PKG_ADDON_ID/bin

# dvb-scan files
mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/dvb-scan
cp -r $(get_build_dir tvh-dtv-scan-tables)/atsc \
$(get_build_dir tvh-dtv-scan-tables)/dvb-* \
$(get_build_dir tvh-dtv-scan-tables)/isdb-t \
$ADDON_BUILD/$PKG_ADDON_ID/dvb-scan
}
@@ -0,0 +1,11 @@
--- a/src/input/mpegts/scanfile.c
+++ b/src/input/mpegts/scanfile.c
@@ -903,7 +903,7 @@ scanfile_init ( const char *muxconf_path, int lock )
#elif defined(PLATFORM_FREEBSD)
path = "/usr/local/share/dtv-scan-tables";
#else
- path = "/usr/share/dvb";
+ path = "/storage/.kodi/addons/service.tvheadend43/dvb-scan";
#endif

if (!initialized) {
@@ -0,0 +1,37 @@
fix libhdhomerun includes

--- a/configure
+++ b/configure
@@ -362,7 +362,7 @@ if enabled hdhomerun_static; then
else

if enabled_or_auto hdhomerun_client; then
- if check_cc_header 'libhdhomerun/hdhomerun' libhdhomerun; then
+ if check_cc_header 'hdhomerun' libhdhomerun; then
enable hdhomerun_client
LDFLAGS="$LDFLAGS -lhdhomerun"
fi

--- a/src/input/mpegts/tvhdhomerun/tvhdhomerun.c
+++ b/src/input/mpegts/tvhdhomerun/tvhdhomerun.c
@@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

-#include "libhdhomerun/hdhomerun.h"
+#include "hdhomerun.h"

#include "tvheadend.h"
#include "input.h"

--- a/src/input/mpegts/tvhdhomerun/tvhdhomerun_frontend.c
+++ b/src/input/mpegts/tvhdhomerun/tvhdhomerun_frontend.c
@@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

-#include "libhdhomerun/hdhomerun.h"
+#include "hdhomerun.h"

#include <fcntl.h>
#include "tvheadend.h"
69 changes: 69 additions & 0 deletions packages/addons/service/tvheadend43/source/bin/tv_grab_file
@@ -0,0 +1,69 @@
#!/bin/sh

# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2018-present Team CoreELEC (https://coreelec.org)

if [ $# -lt 1 ]
then
. /etc/profile

ADDON_HOME="$HOME/.kodi/userdata/addon_data/service.tvheadend43"
ADDON_SETTINGS="$ADDON_HOME/settings.xml"
XML_SETTINGS_VER="$(xmlstarlet sel -t -m settings -v @version $ADDON_SETTINGS)"
if [ "$XML_SETTINGS_VER" = "2" ]; then
XMLTV_TYPE="$(xmlstarlet sel -t -v '/settings/setting[@id="XMLTV_TYPE"]' $ADDON_SETTINGS)"
XMLTV_LOCATION_FILE="$(xmlstarlet sel -t -v '/settings/setting[@id="XMLTV_LOCATION_FILE"]' $ADDON_SETTINGS)"
XMLTV_LOCATION_WEB="$(xmlstarlet sel -t -v '/settings/setting[@id="XMLTV_LOCATION_WEB"]' $ADDON_SETTINGS | xmlstarlet unesc)"
XMLTV_LOCATION_SCRIPT="$(xmlstarlet sel -t -v '/settings/setting[@id="XMLTV_LOCATION_SCRIPT"]' $ADDON_SETTINGS)"
else
XMLTV_TYPE="$(xmlstarlet sel -t -m '/settings/setting[@id="XMLTV_TYPE"]' -v @value $ADDON_SETTINGS)"
XMLTV_LOCATION_FILE="$(xmlstarlet sel -t -m '/settings/setting[@id="XMLTV_LOCATION_FILE"]' -v @value $ADDON_SETTINGS)"
XMLTV_LOCATION_WEB="$(xmlstarlet sel -t -m '/settings/setting[@id="XMLTV_LOCATION_WEB"]' -v @value $ADDON_SETTINGS | xmlstarlet unesc)"
XMLTV_LOCATION_SCRIPT="$(xmlstarlet sel -t -m '/settings/setting[@id="XMLTV_LOCATION_SCRIPT"]' -v @value $ADDON_SETTINGS)"
fi

if [ "$XMLTV_TYPE" = "FILE" ]; then
case "$XMLTV_LOCATION_FILE" in
*.gz | *.bz2 | *.xz)
zcat "$XMLTV_LOCATION_FILE"
;;
*)
cat "$XMLTV_LOCATION_FILE"
;;
esac
exit 0
elif [ "$XMLTV_TYPE" = "SCRIPT" ]; then
if [ -e "$XMLTV_LOCATION_SCRIPT" ] ; then
exec "$XMLTV_LOCATION_SCRIPT"
fi
elif [ "$XMLTV_TYPE" = "WEB" ]; then
wget -qO - "$XMLTV_LOCATION_WEB"
exit 0
fi
fi

dflag=
vflag=
cflag=

for a in "$@"
do
[ "$a" = "-d" -o "$a" = "--description" ] && dflag=1
[ "$a" = "-v" -o "$a" = "--version" ] && vflag=1
[ "$a" = "-c" -o "$a" = "--capabilities" ] && cflag=1
done

if [ -n "$dflag" ]
then
echo "tv_grab_file is a simple grabber that can be configured through the addon settings from Kodi"
fi

if [ -n "$vflag" ]
then
echo "1.0"
fi

if [ -n "$cflag" ]
then
echo "baseline"
fi

0 comments on commit 8f37035

Please sign in to comment.