mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-02 12:43:56 +08:00
🌴 Sync 2026-03-05 23:51:42
This commit is contained in:
1 parent
97c049ed0a
commit
0acff03804
14253 files changed
+3893239
No files matched your search
@@ -0,0 +1,54 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
#
|
||||
# Copyright (C) 2022 ImmortalWrt.org
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=msd_lite
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/rozhuk-im/msd_lite.git
|
||||
PKG_SOURCE_DATE:=2025-05-02
|
||||
PKG_SOURCE_VERSION:=79a6c62c8fced6128a5e445ee110709b3b51bb78
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
PKG_MAINTAINER:=Tianling Shen <cnsztl@immrotalwrt.org>
|
||||
PKG_LICENSE:=BSD-2-Clause
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/cmake.mk
|
||||
|
||||
define Package/msd_lite
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=Program for IP TV streaming on the network via HTTP
|
||||
URL:=http://www.netlab.linkpc.net/wiki/ru:software:msd:lite
|
||||
endef
|
||||
|
||||
define Package/msd_lite/description
|
||||
msd_lite - Multi stream daemon lite. The lightweight version of
|
||||
Multi Stream daemon (msd) Program for organizing IP TV streaming
|
||||
on the network via HTTP.
|
||||
endef
|
||||
|
||||
define Package/msd_lite/conffiles
|
||||
/etc/config/msd_lite
|
||||
endef
|
||||
|
||||
CMAKE_OPTIONS+= -DCONFDIR=../etc/msd_lite
|
||||
|
||||
define Package/msd_lite/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/msd_lite $(1)/usr/bin/
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/msd_lite
|
||||
$(CP) $(CURDIR)/files/msd_lite.sample $(1)/etc/msd_lite/msd_lite.conf.sample
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_CONF) $(CURDIR)/files/msd_lite.config $(1)/etc/config/msd_lite
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) $(CURDIR)/files/msd_lite.init $(1)/etc/init.d/msd_lite
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,msd_lite))
|
||||
@@ -0,0 +1,31 @@
|
||||
|
||||
config instance
|
||||
option 'enabled' '0'
|
||||
|
||||
# Bind address
|
||||
list 'address' '0.0.0.0:7088'
|
||||
list 'address' '[::]:7088'
|
||||
# For multicast receive
|
||||
option 'network' ''
|
||||
|
||||
# syslog Severity level: 0=emerg - 7=debug
|
||||
#option loglevel '0'
|
||||
|
||||
# Worker threads (0 = auto detect)
|
||||
#option 'threads' '0'
|
||||
# Bind threads to CPUs
|
||||
#option 'bind_to_cpu' '0'
|
||||
|
||||
# Disconnect slow clients
|
||||
#option 'drop_slow_clients' '0'
|
||||
# Pre cache size
|
||||
#option 'precache_size' '4096'
|
||||
# Stream receive ring buffer size
|
||||
#option 'ring_buffer_size' '4096'
|
||||
# Multicast receive socket buffer size
|
||||
#option 'multicast_recv_buffer_size' '512'
|
||||
# Multicast receive timeout
|
||||
#option 'multicast_recv_timeout' '2'
|
||||
# Do IGMP/MLD leave+join every X seconds
|
||||
#option 'rejoin_time' '0'
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2022 ImmortalWrt.org
|
||||
|
||||
. /lib/functions/network.sh
|
||||
|
||||
START=99
|
||||
USE_PROCD=1
|
||||
|
||||
NAME="msd_lite"
|
||||
PROG="/usr/bin/$NAME"
|
||||
|
||||
CONF="/etc/$NAME/$NAME.conf.sample"
|
||||
CONFDIR="/var/run/$NAME"
|
||||
|
||||
add_interface_tiggers() {
|
||||
local enabled network
|
||||
config_get_bool enabled "$1" "enabled" "1"
|
||||
config_get network "$1" "network"
|
||||
|
||||
[ "$enabled" -eq "0" -o -z "$network" ] || procd_add_reload_interface_trigger "$network"
|
||||
}
|
||||
|
||||
validate_msd_lite_section() {
|
||||
uci_load_validate "$NAME" "instance" "$1" "$2" \
|
||||
'enabled:bool:0' \
|
||||
'address:string' \
|
||||
'interface:string' \
|
||||
'network:string' \
|
||||
'loglevel:uinteger:0' \
|
||||
'threads:uinteger:0' \
|
||||
'bind_to_cpu:bool:0' \
|
||||
'drop_slow_clients:bool:0' \
|
||||
'precache_size:uinteger:4096' \
|
||||
'ring_buffer_size:uinteger:4096' \
|
||||
'multicast_recv_buffer_size:uinteger:512' \
|
||||
'multicast_recv_timeout:uinteger:2' \
|
||||
'rejoin_time:uinteger:0'
|
||||
}
|
||||
|
||||
start_instance() {
|
||||
local section="$1"
|
||||
local seconds="0"
|
||||
|
||||
[ "$2" -eq "0" ] || { logger -p daemon.err -t "$NAME" "$section Validation failed."; return 1; }
|
||||
[ "$enabled" -eq "1" ] || return 1
|
||||
|
||||
if [ -n "$network" ]; then
|
||||
while [ "$seconds" -le 10 ]; do
|
||||
network_flush_cache
|
||||
network_get_device interface "$network"
|
||||
if [ -n "$interface" ]; then
|
||||
break
|
||||
else
|
||||
let seconds+=2
|
||||
sleep 2
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -n "$address" ]; then
|
||||
local addr bindlist
|
||||
for addr in $address; do
|
||||
bindlist="${bindlist:+$bindlist\\n\\t\\t\\t}<bind><address>$addr</address></bind>"
|
||||
done
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
|
||||
[ "$bind_to_cpu" = "1" ] && bind_to_cpu="yes" || bind_to_cpu="no"
|
||||
[ "$drop_slow_clients" = "1" ] && drop_slow_clients="yes" || drop_slow_clients="no"
|
||||
|
||||
mkdir -p "$CONFDIR"
|
||||
sed -e "s,@logLevel@,$loglevel,g" \
|
||||
-e "s,@threadsCountMax@,$threads,g" \
|
||||
-e "s,@fBindToCPU@,$bind_to_cpu,g" \
|
||||
-e "s,@bindList@,$bindlist,g" \
|
||||
-e "s,@ifName@,$interface,g" \
|
||||
-e "s,@fDropSlowClients@,$drop_slow_clients,g" \
|
||||
-e "s,@precache@,$precache_size,g" \
|
||||
-e "s,@ringBufSize@,$ring_buffer_size,g" \
|
||||
-e "s,@rcvBuf@,$multicast_recv_buffer_size,g" \
|
||||
-e "s,@rcvTimeout@,$multicast_recv_timeout,g" \
|
||||
-e "s,@rejoinTime@,$rejoin_time,g" \
|
||||
"$CONF" > "$CONFDIR/$section.conf"
|
||||
|
||||
procd_open_instance "$section"
|
||||
procd_set_param command "$PROG"
|
||||
procd_append_param command -c "$CONFDIR/$section.conf"
|
||||
|
||||
procd_set_param limits core="unlimited"
|
||||
procd_set_param limits nofile="1000000 1000000"
|
||||
procd_set_param respawn
|
||||
procd_set_param stderr 1
|
||||
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
start_service() {
|
||||
config_load "$NAME"
|
||||
|
||||
config_foreach validate_msd_lite_section "instance" start_instance
|
||||
}
|
||||
|
||||
stop_service() {
|
||||
rm -rf "$CONFDIR"
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger "$NAME"
|
||||
|
||||
config_load "$NAME"
|
||||
config_foreach add_interface_tiggers "instance"
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Sizes in kb, time in seconds
|
||||
-->
|
||||
<!--
|
||||
<skt> <rcvLoWatermark>XXXX</rcvLoWatermark> - DOES NOT WORK on Linux!
|
||||
man socket(7):
|
||||
...
|
||||
The select(2) and poll(2) system calls currently do not respect the SO_RCVLOWAT
|
||||
setting on Linux, and mark a socket readable when even a single byte of data is
|
||||
available.
|
||||
...
|
||||
-->
|
||||
<msd>
|
||||
<log>
|
||||
<!-- syslog Severity level: 0=emerg - 7=debug. -->
|
||||
<level>@logLevel@</level>
|
||||
</log>
|
||||
<threadPool>
|
||||
<threadsCountMax>@threadsCountMax@</threadsCountMax>
|
||||
<!-- 0 = auto -->
|
||||
<fBindToCPU>@fBindToCPU@</fBindToCPU>
|
||||
<!-- Bind threads to CPUs. -->
|
||||
</threadPool>
|
||||
<!-- HTTP server -->
|
||||
<HTTP>
|
||||
<bindList>
|
||||
@bindList@
|
||||
</bindList>
|
||||
<hostnameList>
|
||||
<!-- Host names for all bindings. -->
|
||||
<hostname>*</hostname>
|
||||
</hostnameList>
|
||||
</HTTP>
|
||||
<hubProfileList>
|
||||
<!-- Stream hub profiles templates. -->
|
||||
<hubProfile>
|
||||
<fDropSlowClients>@fDropSlowClients@</fDropSlowClients>
|
||||
<!-- Disconnect slow clients. -->
|
||||
<fSocketHalfClosed>no</fSocketHalfClosed>
|
||||
<!-- Enable shutdown(SHUT_RD) for clients. -->
|
||||
<fSocketTCPNoDelay>yes</fSocketTCPNoDelay>
|
||||
<!-- Enable TCP_NODELAY for clients. -->
|
||||
<fSocketTCPNoPush>yes</fSocketTCPNoPush>
|
||||
<!-- Enable TCP_NOPUSH / TCP_CORK for clients. -->
|
||||
<precache>@precache@</precache>
|
||||
<!-- Pre cache size. Can be overwritten by arg from user request. -->
|
||||
<ringBufSize>@ringBufSize@</ringBufSize>
|
||||
<!-- Stream receive ring buffer size. Must be multiple of sndBlockSize. -->
|
||||
<skt>
|
||||
<sndBuf>512</sndBuf>
|
||||
<!-- Max send block size, apply to clients sockets only, must be > sndBlockSize. -->
|
||||
<sndLoWatermark>64</sndLoWatermark>
|
||||
<!-- Send block size. Must be multiple of 4. -->
|
||||
<!-- <congestionControl>htcp</congestionControl> -->
|
||||
<!-- TCP_CONGESTION: this value replace/overwrite(!) all others cc settings: cc from http req args, http server settings, OS default -->
|
||||
</skt>
|
||||
<headersList>
|
||||
<!-- Custom HTTP headers (sended before stream). -->
|
||||
<header>Pragma: no-cache</header>
|
||||
<header>Content-Type: video/mpeg</header>
|
||||
<header>ContentFeatures.DLNA.ORG: DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01700000000000000000000000000000</header>
|
||||
<header>TransferMode.DLNA.ORG: Streaming</header>
|
||||
</headersList>
|
||||
</hubProfile>
|
||||
</hubProfileList>
|
||||
<sourceProfileList>
|
||||
<!-- Stream source profiles templates. -->
|
||||
<sourceProfile>
|
||||
<skt>
|
||||
<rcvBuf>@rcvBuf@</rcvBuf>
|
||||
<!-- Multicast recv socket buf size. -->
|
||||
<rcvLoWatermark>48</rcvLoWatermark>
|
||||
<!-- Actual cli_snd_block_min if polling is off. -->
|
||||
<rcvTimeout>@rcvTimeout@</rcvTimeout>
|
||||
<!-- STATUS, Multicast recv timeout. -->
|
||||
</skt>
|
||||
<multicast>
|
||||
<!-- For: multicast-udp and multicast-udp-rtp. -->
|
||||
<ifName>@ifName@</ifName>
|
||||
<rejoinTime>@rejoinTime@</rejoinTime> <!-- Do IGMP/MLD leave+join every X seconds. -->
|
||||
<!-- For multicast receive. -->
|
||||
</multicast>
|
||||
</sourceProfile>
|
||||
</sourceProfileList>
|
||||
</msd>
|
||||
Reference in new issue
Block a user