1
0
mirror of https://github.com/rofafor/vdr-plugin-iptv.git synced 2023-10-10 13:37:03 +02:00

Add vlc2iptv example script from Tobias Grimm.

This commit is contained in:
Antti Seppälä 2007-11-24 16:34:20 +00:00
parent 8f552bd19f
commit c3d38f2345
2 changed files with 101 additions and 0 deletions

View File

@ -29,3 +29,4 @@ VDR Plugin 'iptv' Revision History
- Added French translation (Thanks to Bruno Roussel).
- Improve iptvstream.sh compatibility under non-bash shells.
- Add more sophisticated example script (Thanks to Tobias Grimm).

100
iptv/vlc2iptv Executable file
View File

@ -0,0 +1,100 @@
#!/bin/sh
#
# vlc2iptv is used by the VDR iptv plug-in to transcode external sources
#
# (C) 2007 Rolf Ahrenberg, Antti Seppälä
# (C) 2007 Tobias Grimm
#
# vlc2iptv 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 of the License, or
# (at your option) any later version.
#
# This package 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 this package; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
# MA 02110-1301, USA.
#
#
# <Global Settings>
#
CHANNELS_CONF=/var/lib/vdr/channels.conf
CHANNEL_SETTINGS_DIR=/etc/vdr/plugins/iptv/vlcinput/
VIDEO_BITRATE=2400
AUDIO_BITRATE=320
#
# </Global Settings>
#
exit_with_error()
{
logger "vlc2iptv: error: $*"
exit 1;
}
read_arguments()
{
[ $# -ne 2 ] && exit_with_error "Invalid parameter count '$#' $*"
PARAMETER=$1
PORT=$2
}
lookup_channel_and_pids()
{
[ ! -e "$CHANNELS_CONF" ] && \
exit_with_error "channels.conf not found ($CHANNELS_CONF)"
local CHANNEL_RECORD=`grep ":IPTV|EXT|vlc2iptv|$PARAMETER:" $CHANNELS_CONF`
[ -z "$CHANNEL_RECORD" ] && \
exit_with_error "no iptv channel with parameter $PARAMETER found"
CHANNEL_NAME=`echo $CHANNEL_RECORD | awk "-F[;,:]" '{print $1}'`
VPID=`echo $CHANNEL_RECORD | awk -F: '{print $6}'`
APID=`echo $CHANNEL_RECORD | awk -F: '{print $7}'`
SPID=0
}
load_channel_configuration()
{
local CHANNEL_SETTINGS_FILE="$CHANNEL_SETTINGS_DIR/$CHANNEL_NAME.conf"
[ ! -e $CHANNEL_SETTINGS_FILE ] && \
exit_with_error "No vlc input configuration for channel '$CHANNEL_NAME'"
. $CHANNEL_SETTINGS_FILE
[ -z "$URL" ] && \
exit_with_error "No URL specified for channel '$CHANNEL_NAME'"
}
read_arguments $*
lookup_channel_and_pids
load_channel_configuration
#
# Start VLC
#
if [ -n "$WIDTH" -a -n "$HEIGHT" ] ; then
RESIZE_OPTIONS=",width=${WIDTH},height=${HEIGHT}"
else
RESIZE_OPTIONS=""
fi
vlc "${URL}" \
--sout "#transcode{vcodec=mp2v$RESIZE_OPTIONS,acodec=mpga,vb=${VIDEO_BITRATE},ab=${AUDIO_BITRATE}}:standard{access=udp,mux=ts{pid-video=${VPID},pid-audio=${APID},pid-spu=${SPID}},dst=127.0.0.1:${PORT}}" \
--intf dummy &
PID=${!}
trap 'kill -INT ${PID} 2> /dev/null' INT EXIT QUIT TERM
# Waiting for the given PID to terminate
wait ${PID}