mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-10-26 23:12:52 +08:00
⛄ Sync 2026-09-19 19:02:49
This commit is contained in:
1 parent
1fbd83b7cb
commit
9892df6eb8
3 files changed
+272
No files matched your search
@@ -0,0 +1,54 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
# Copyright (C) 2026 ImmortalWrt.org
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=rtp2httpd
|
||||
PKG_VERSION:=3.17.1
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://codeload.github.com/stackia/rtp2httpd/tar.gz/v$(PKG_VERSION)?
|
||||
PKG_HASH:=skip
|
||||
|
||||
PKG_MAINTAINER:=Tianling Shen <cnsztl@immrotalwrt.org>
|
||||
PKG_LICENSE:=GPL-2.0-or-later
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/cmake.mk
|
||||
|
||||
define Package/rtp2httpd
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=Multicast RTP/RTSP to Unicast HTTP stream converter
|
||||
URL:=https://rtp2httpd.com/en/
|
||||
endef
|
||||
|
||||
define Package/rtp2httpd/description
|
||||
rtp2httpd converts RTP/UDP/RTSP media into http stream.
|
||||
It acts as a tiny HTTP server. When client connect,
|
||||
pre-configured multicast RTP service is choosen by URL.
|
||||
Program then join pre-configured multicast address and translate
|
||||
incoming RTP data to HTTP stream.
|
||||
endef
|
||||
|
||||
define Package/rtp2httpd/conffiles
|
||||
/etc/config/rtp2httpd
|
||||
endef
|
||||
|
||||
CMAKE_OPTIONS += -DENABLE_AGGRESSIVE_OPT=ON
|
||||
|
||||
export RELEASE_VERSION=$(PKG_VERSION)
|
||||
|
||||
define Package/rtp2httpd/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/rtp2httpd $(1)/usr/bin/
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_CONF) $(CURDIR)/files/rtp2httpd.config $(1)/etc/config/rtp2httpd
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) $(CURDIR)/files/rtp2httpd.init $(1)/etc/init.d/rtp2httpd
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,rtp2httpd))
|
||||
@@ -0,0 +1,82 @@
|
||||
|
||||
config instance
|
||||
option 'enabled' '0'
|
||||
|
||||
# bind address
|
||||
list 'listen' '0.0.0.0:5140'
|
||||
list 'listen' '[::]:5140'
|
||||
|
||||
# Increase verbosity (0 = Fatal, 1 = Error, 2 = Warn, 3 = Info, 4 = Debug)
|
||||
#option verbose '1'
|
||||
|
||||
# Disable UDPxy compatibility
|
||||
#option noudpxy '0'
|
||||
|
||||
# Default interface for all upstream traffic (lowest priority)
|
||||
#option upstream_interface ''
|
||||
# Interface for FCC unicast traffic (overrides upstream_interface)
|
||||
#option upstream_interface_fcc ''
|
||||
# Interface for HTTP proxy upstream traffic (overrides upstream_interface)
|
||||
#option upstream_interface_http ''
|
||||
# Interface for multicast traffic (overrides upstream_interface)
|
||||
#option upstream_interface_multicast ''
|
||||
# Interface for RTSP unicast traffic (overrides upstream_interface)
|
||||
#option upstream_interface_rtsp ''
|
||||
|
||||
# Restrict FCC UDP listen sockets to specific ports (start[-end])
|
||||
#option fcc_listen_port_range ''
|
||||
|
||||
# Override User-Agent header for upstream HTTP proxy requests
|
||||
#option http_proxy_user_agent ''
|
||||
|
||||
# Periodic multicast rejoin interval (0-86400, 0 = disable)
|
||||
#option mcast_rejoin_interval '0'
|
||||
|
||||
# STUN server for RTSP NAT traversal (host[:port])
|
||||
#option rtsp_stun_server ''
|
||||
# User-Agent header for upstream RTSP requests
|
||||
#option rtsp_user_agent ''
|
||||
|
||||
# Serve max N requests simultaneously (1-5000)
|
||||
#option maxclients '5'
|
||||
# Number of worker processes with SO_REUSEPORT (1-64)
|
||||
#option workers '1'
|
||||
# Maximum number of buffers in zero-copy pool (1024-1048576)
|
||||
#option buffer_pool_max_size '16384'
|
||||
# UDP socket receive buffer size (in bytes) for multicast/FCC/RTSP (65536-16777216)
|
||||
#option udp_rcvbuf_size '524288'
|
||||
# Enable zero-copy send with MSG_ZEROCOPY for better performance
|
||||
#option zerocopy_on_send '0'
|
||||
|
||||
# Hostname to check in the host: HTTP header
|
||||
#option hostname ''
|
||||
# Authentication token for HTTP requests
|
||||
#option r2h_token ''
|
||||
# Set Access-Control-Allow-Origin header
|
||||
#option cors_allow_origin ''
|
||||
# Enable X-Forwarded-For header recognize
|
||||
#option xff '0'
|
||||
# Public mount path prefix for all HTTP resources
|
||||
#option app_path_prefix ''
|
||||
# HTTP path for player UI
|
||||
#option player_page_path '/player'
|
||||
# HTTP path for status UI
|
||||
#option status_page_path '/status'
|
||||
# External M3U playlist URL (file://, http://, https://)
|
||||
#option external_m3u ''
|
||||
# Auto-update interval in seconds (0=disabled)
|
||||
#option external_m3u_update_interval '7200'
|
||||
# Use root-relative URLs in generated and rewritten M3U playlists
|
||||
#option use_relative_path_in_m3u '0'
|
||||
|
||||
# Write access logs to this file
|
||||
#option access_log ''
|
||||
# Access log format (nginx-style $variables)
|
||||
#option log_format ''
|
||||
|
||||
# Path to ffmpeg executable
|
||||
#option ffmpeg_path 'ffmpeg'
|
||||
# Additional ffmpeg arguments
|
||||
#option ffmpeg_args '-hwaccel none'
|
||||
# Enable video snapshot feature
|
||||
#option video_snapshot '0'
|
||||
@@ -0,0 +1,136 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=99
|
||||
USE_PROCD=1
|
||||
|
||||
CONF="rtp2httpd"
|
||||
PROG="/usr/bin/$CONF"
|
||||
|
||||
append_param_arg() {
|
||||
eval "local val=\"\${$1}\""
|
||||
[ -n "$val" ] && procd_append_param command "--${1//_/-}" "$val"
|
||||
}
|
||||
|
||||
append_param_bool() {
|
||||
eval "local val=\"\${$1}\""
|
||||
[ "$val" -eq "1" ] && procd_append_param command "--${1//_/-}"
|
||||
}
|
||||
|
||||
validate_rtp2httpd_section() {
|
||||
uci_load_validate "$CONF" "instance" "$1" "$2" \
|
||||
'enabled:bool:0' \
|
||||
'listen:string' \
|
||||
\
|
||||
'verbose:uinteger' \
|
||||
'noudpxy:uinteger' \
|
||||
\
|
||||
'upstream_interface:string' \
|
||||
'upstream_interface_fcc:string' \
|
||||
'upstream_interface_http:string' \
|
||||
'upstream_interface_multicast:string' \
|
||||
'upstream_interface_rtsp:string' \
|
||||
\
|
||||
'fcc_listen_port_range:or(port,portrange)' \
|
||||
'http_proxy_user_agent:string' \
|
||||
'mcast_rejoin_interval:and(uinteger, range(0,86400))' \
|
||||
'rtsp_stun_server:string' \
|
||||
'rtsp_user_agent:string' \
|
||||
\
|
||||
'maxclients:and(uinteger, range(1,5000))' \
|
||||
'workers:and(uinteger, range(1,64))' \
|
||||
'buffer_pool_max_size:and(uinteger, range(1024,1048576))' \
|
||||
'udp_rcvbuf_size:and(uinteger, range(65536,16777216))' \
|
||||
'zerocopy_on_send:bool' \
|
||||
\
|
||||
'hostname:host' \
|
||||
'r2h_token:string' \
|
||||
'cors_allow_origin:string' \
|
||||
'xff:bool' \
|
||||
'app_path_prefix:string' \
|
||||
'player_page_path:string' \
|
||||
'status_page_path:string' \
|
||||
'external_m3u:string' \
|
||||
'external_m3u_update_interval:uinteger' \
|
||||
'use_relative_path_in_m3u:bool' \
|
||||
\
|
||||
'access_log:string' \
|
||||
'log_format:string' \
|
||||
\
|
||||
'ffmpeg_path:string' \
|
||||
'ffmpeg_args:string' \
|
||||
'video_snapshot:bool'
|
||||
}
|
||||
|
||||
start_instance() {
|
||||
local section="$1"
|
||||
|
||||
[ "$2" -eq "0" ] || { logger -p daemon.err -t "$CONF" "$section Validation failed."; return 1; }
|
||||
[ "$enabled" -eq "1" ] || return 1
|
||||
|
||||
procd_open_instance "$section"
|
||||
procd_set_param command "$PROG"
|
||||
procd_append_param command -C
|
||||
|
||||
for addr in $listen; do
|
||||
procd_append_param command --listen "$addr"
|
||||
done
|
||||
|
||||
append_param_arg verbose
|
||||
append_param_bool noudpxy
|
||||
|
||||
append_param_arg upstream_interface
|
||||
append_param_arg upstream_interface_fcc
|
||||
append_param_arg upstream_interface_http
|
||||
append_param_arg upstream_interface_multicast
|
||||
append_param_arg upstream_interface_rtsp
|
||||
|
||||
append_param_arg fcc_listen_port_range
|
||||
append_param_arg http_proxy_user_agent
|
||||
append_param_arg mcast_rejoin_interval
|
||||
append_param_arg rtsp_stun_server
|
||||
append_param_arg rtsp_user_agent
|
||||
|
||||
append_param_arg maxclients
|
||||
append_param_arg workers
|
||||
append_param_arg buffer_pool_max_size
|
||||
append_param_arg udp_rcvbuf_size
|
||||
append_param_bool zerocopy_on_send
|
||||
|
||||
append_param_arg hostname
|
||||
append_param_arg r2h_token
|
||||
append_param_arg cors_allow_origin
|
||||
append_param_bool xff
|
||||
append_param_arg app_path_prefix
|
||||
append_param_arg player_page_path
|
||||
append_param_arg status_page_path
|
||||
append_param_arg external_m3u
|
||||
if [ -n "$external_m3u" ]; then
|
||||
append_param_arg external_m3u_update_interval
|
||||
append_param_bool use_relative_path_in_m3u
|
||||
fi
|
||||
|
||||
append_param_arg access_log
|
||||
append_param_arg log_format
|
||||
|
||||
append_param_arg ffmpeg_path
|
||||
append_param_arg ffmpeg_args
|
||||
append_param_bool video_snapshot
|
||||
|
||||
procd_set_param limits core="unlimited"
|
||||
procd_set_param limits nofile="1000000 1000000"
|
||||
procd_set_param respawn
|
||||
procd_set_param stdout 1
|
||||
procd_set_param stderr 1
|
||||
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
start_service() {
|
||||
config_load "$CONF"
|
||||
|
||||
config_foreach validate_rtp2httpd_section "instance" start_instance
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger "$CONF"
|
||||
}
|
||||
Reference in new issue
Block a user