Browse Source

tvheadend: multiple improvements

- Added menuconfig options:
  - TV sources and protocols: SAT>IP, IPTV, HDHomeRun
  - SoftCAM (3 options)
  - Image cache (default changed to OFF)
  - Trace debug option (default changed to OFF)
- Added menuconfig descriptions.
- Removed codecs.
- Made PIE option dependent on global OpenWRT PIE setting.
- Run as regular user, not root.
- Added USB hotplug script to change DVB tuners permissions.
- Fixed a first-start bug(?) that I encountered: admin account created but not saved.

Signed-off-by: Marius Dinu <m95d+git@psihoexpert.ro>
lilik-openwrt-22.03
Marius Dinu 3 years ago
parent
commit
4a387bc568
4 changed files with 175 additions and 9 deletions
  1. +89
    -5
      multimedia/tvheadend/Config.in
  2. +62
    -2
      multimedia/tvheadend/Makefile
  3. +7
    -0
      multimedia/tvheadend/files/dvb.hotplug
  4. +17
    -2
      multimedia/tvheadend/files/tvheadend.init

+ 89
- 5
multimedia/tvheadend/Config.in View File

@ -1,17 +1,101 @@
config TVHEADEND_CWC_SUPPORT
bool "NewCamd support"
default y
comment "Input & output support"
config TVHEADEND_LINUXDVB_SUPPORT config TVHEADEND_LINUXDVB_SUPPORT
bool "Linux DVB support"
bool "DVB tuners"
default y default y
help
Include support for DVB tuners.
Note: Kernel driver(s) and firmware must also be installed.
config TVHEADEND_DVBSCAN_SUPPORT config TVHEADEND_DVBSCAN_SUPPORT
bool "Fetch DVB-scan data" bool "Fetch DVB-scan data"
depends on TVHEADEND_LINUXDVB_SUPPORT depends on TVHEADEND_LINUXDVB_SUPPORT
default TVHEADEND_LINUXDVB_SUPPORT default TVHEADEND_LINUXDVB_SUPPORT
help
Download and include DVB scan tables.
config TVHEADEND_IPTV
bool "IPTV client"
default y
help
Include IP-TV client.
config TVHEADEND_SATIP_CLIENT
bool "SAT>IP client"
default y
help
Include SAT>IP client. This allows tvheadend to receive streams from a SAT>IP server.
SAT>IP is a client-server communication protocol in which SAT>IP servers,
connected to one or more DVB broadcast sources, send the program requested
by an SAT>IP client over an IP based network.
The main difference of SAT>IP to other IP-based TV distribution systems
such as IP-TV and DLNA is that the SAT>IP client does not select a program
from a server specific list, but has to specify the DVB reception parameters
such as the signal source, frequency, polarisation, modulation, PIDs and others.
config TVHEADEND_SATIP_SERVER
bool "SAT>IP server"
default y
help
Include SAT>IP server. This allows tvheadend to stream to SAT>IP clients.
SAT>IP is a client-server communication protocol in which SAT>IP servers,
connected to one or more DVB broadcast sources, send the program requested
by an SAT>IP client over an IP based network.
The main difference of SAT>IP to other IP-based TV distribution systems
such as IP-TV and DLNA is that the SAT>IP client does not select a program
from a server specific list, but has to specify the DVB reception parameters
such as the signal source, frequency, polarisation, modulation, PIDs and others.
config TVHEADEND_HDHOMERUN_CLIENT
bool "HDHomeRun client"
default y
help
Include HDHomeRun client.
HDHomeRun is a network-attached, digital television tuner box.
comment "SoftCAM (Software Conditional Access Module)"
config TVHEADEND_CWC_SUPPORT
bool "CWC newcamd"
default y
help
Support descrambling using Code Word Client newcamd protocol.
config TVHEADEND_CAPMT_SUPPORT
bool "CWC capmnt"
default y
help
Support descrambling using Code Word Client capmnt (Linux Network DVBAPI) protocol.
config TVHEADEND_CONSTCW_SUPPORT
bool "CCW"
default y
help
Support descrambling using Constant Code Word.
comment "Other options"
config TVHEADEND_AVAHI_SUPPORT config TVHEADEND_AVAHI_SUPPORT
bool "Avahi client support"
bool "Avahi client"
select PACKAGE_libavahi-client select PACKAGE_libavahi-client
default n default n
help
Enables the opensource implementation of Apple's zero configuration protocol.
Tvheadend will advertise itself on the network using this protocol.
config TVHEADEND_IMAGECACHE
bool "Image cache"
default n
help
Support caching TV station logos and other images on disk.
Note: Activating disk cache will increase fash memory wear.
Selecting this option does not automatically enable disk caching. It only includes support for it.
config TVHEADEND_TRACE
bool "Low level debug trace"
default n
help
Support low level debug trace for tvheadend subsystems.
For a list of available subsystems, run "tvheadend --subsystems" in OpenWRT console.
Note: Selecting this option does not automatically enable trace logging.
It only includes support for --trace command line option and GUI.

+ 62
- 2
multimedia/tvheadend/Makefile View File

@ -30,6 +30,7 @@ define Package/tvheadend
CATEGORY:=Multimedia CATEGORY:=Multimedia
TITLE:=Tvheadend is a TV streaming server for Linux TITLE:=Tvheadend is a TV streaming server for Linux
DEPENDS:=+libopenssl +librt +zlib +libffi +TVHEADEND_AVAHI_SUPPORT:libavahi-client $(ICONV_DEPENDS) DEPENDS:=+libopenssl +librt +zlib +libffi +TVHEADEND_AVAHI_SUPPORT:libavahi-client $(ICONV_DEPENDS)
USERID:=tvheadend:dvb
URL:=https://tvheadend.org URL:=https://tvheadend.org
MAINTAINER:=Marius Dinu <m95d+git@psihoexpert.ro> MAINTAINER:=Marius Dinu <m95d+git@psihoexpert.ro>
endef endef
@ -48,10 +49,12 @@ define Package/tvheadend/config
endmenu endmenu
endef endef
ifeq ($(CONFIG_TVHEADEND_CWC_SUPPORT),)
CONFIGURE_ARGS += --disable-cwc
# Generic build options
ifneq ($(CONFIG_PKG_ASLR_PIE_NONE),)
CONFIGURE_ARGS += --disable-pie
endif endif
# TV sources
ifeq ($(CONFIG_TVHEADEND_LINUXDVB_SUPPORT),) ifeq ($(CONFIG_TVHEADEND_LINUXDVB_SUPPORT),)
CONFIGURE_ARGS += --disable-linuxdvb CONFIGURE_ARGS += --disable-linuxdvb
endif endif
@ -60,17 +63,72 @@ ifeq ($(CONFIG_TVHEADEND_DVBSCAN_SUPPORT),)
CONFIGURE_ARGS += --disable-dvbscan CONFIGURE_ARGS += --disable-dvbscan
endif endif
ifeq ($(CONFIG_TVHEADEND_IPTV),)
CONFIGURE_ARGS += --disable-iptv
endif
ifeq ($(CONFIG_TVHEADEND_SATIP_SERVER),)
CONFIGURE_ARGS += --disable-satip_server
endif
ifeq ($(CONFIG_TVHEADEND_SATIP_CLIENT),)
CONFIGURE_ARGS += --disable-satip_client
endif
ifeq ($(CONFIG_TVHEADEND_HDHOMERUN_CLIENT),)
CONFIGURE_ARGS += --disable-hdhomerun_static
else
CONFIGURE_ARGS += --enable-hdhomerun_client
endif
# Descrambling
ifeq ($(CONFIG_TVHEADEND_CWC_SUPPORT),)
CONFIGURE_ARGS += --disable-cwc
endif
ifeq ($(CONFIG_TVHEADEND_CAPMT_SUPPORT),)
CONFIGURE_ARGS += --disable-capmt
endif
ifeq ($(CONFIG_TVHEADEND_CCW_SUPPORT),)
CONFIGURE_ARGS += --disable-constcw
endif
# Other options
ifeq ($(CONFIG_TVHEADEND_AVAHI_SUPPORT),) ifeq ($(CONFIG_TVHEADEND_AVAHI_SUPPORT),)
CONFIGURE_ARGS += --disable-avahi CONFIGURE_ARGS += --disable-avahi
else else
CONFIGURE_ARGS += --enable-avahi CONFIGURE_ARGS += --enable-avahi
endif endif
ifeq ($(CONFIG_TVHEADEND_IMAGECACHE),)
CONFIGURE_ARGS += --disable-imagecache
else
CONFIGURE_ARGS += --enable-imagecache
endif
ifeq ($(CONFIG_TVHEADEND_TRACE),)
CONFIGURE_ARGS += --disable-trace
endif
# libav and ffmpeg are broken, so remove codecs too.
CONFIGURE_ARGS += \ CONFIGURE_ARGS += \
--arch=$(ARCH) \ --arch=$(ARCH) \
--disable-dbus_1 \ --disable-dbus_1 \
--disable-libav \ --disable-libav \
--disable-ffmpeg_static \ --disable-ffmpeg_static \
--disable-libx264 \
--disable-libx264_static \
--disable-libx265 \
--disable-libx265_static \
--disable-libvpx \
--disable-libvpx_static \
--disable-libtheora \
--disable-libtheora_static \
--disable-libvorbis \
--disable-libvorbis_static \
--disable-libfdkaac \
--disable-libfdkaac_static \
--enable-bundle \ --enable-bundle \
--nowerror=unused-variable --nowerror=unused-variable
@ -89,6 +147,8 @@ define Package/tvheadend/install
$(INSTALL_BIN) ./files/tvheadend.init $(1)/etc/init.d/tvheadend $(INSTALL_BIN) ./files/tvheadend.init $(1)/etc/init.d/tvheadend
$(INSTALL_DIR) $(1)/etc/config $(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) ./files/tvheadend.config $(1)/etc/config/tvheadend $(INSTALL_CONF) ./files/tvheadend.config $(1)/etc/config/tvheadend
$(INSTALL_DIR) $(1)/etc/hotplug.d/usb
$(INSTALL_BIN) ./files/dvb.hotplug $(1)/etc/hotplug.d/usb/50-dvb
$(INSTALL_DIR) $(1)/usr/bin $(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/build.linux/tvheadend $(1)/usr/bin/ $(INSTALL_BIN) $(PKG_BUILD_DIR)/build.linux/tvheadend $(1)/usr/bin/


+ 7
- 0
multimedia/tvheadend/files/dvb.hotplug View File

@ -0,0 +1,7 @@
#!/bin/sh
case "$ACTION" in
add)
chown -R root:dvb /dev/dvb/*/*
chmod -R 660 /dev/dvb/*/*
;;
esac

+ 17
- 2
multimedia/tvheadend/files/tvheadend.init View File

@ -9,8 +9,22 @@ PROG=/usr/bin/tvheadend
TEMP_CONFIG=/tmp/tvheadend TEMP_CONFIG=/tmp/tvheadend
PERSISTENT_CONFIG=/etc/tvheadend PERSISTENT_CONFIG=/etc/tvheadend
# If you change the user, update the owner of tvheadend configuration directory and files!
# If you change the group, update USB hotplug script for DVB devices in /dev/hotplug.d/usb/
# otherwise, tvheadend won't have permissions to open newly connected tuners!
# Also update all other packages that use the dvb group.
TVH_USER=tvheadend
TVH_GROUP=dvb
execute_first_run() { execute_first_run() {
"$PROG" -c "$1" -B -C -A >/dev/null 2>&1
mkdir -p "$1"
chown -R $TVH_USER "$1"
# This should create a new configuration including an admin account with no name and no password,
# but it aborts (-A) without saving it:
#"$PROG" -c "$1" -B -C -A -u $TVH_USER -g $TVH_GROUP >/dev/null 2>&1
# Instead, run it for 10s then kill it:
"$PROG" -c "$1" -B -C -u $TVH_USER -g $TVH_GROUP & TVH_PID=$! ; sleep 10 ; kill $TVH_PID ; sleep 2
} }
ensure_config_exists() { ensure_config_exists() {
@ -65,7 +79,8 @@ start_service() {
ensure_config_exists ensure_config_exists
procd_open_instance procd_open_instance
procd_set_param file /etc/config/tvheadend procd_set_param file /etc/config/tvheadend
procd_set_param command "$PROG" -B
chown -R root:$TVH_GROUP /dev/dvb/*/*
procd_set_param command "$PROG" -B -u $TVH_USER -g $TVH_GROUP
load_uci_config load_uci_config
procd_close_instance procd_close_instance
} }

Loading…
Cancel
Save