- changed location of streamdevhosts.conf to VDRCONFDIR/plugins/streamdev

- changed externremux.sh's default location to VDRCONFDIR/plugins/streamdev
- added sample externremux.sh from http://www.vdr-wiki.de/
- stop providing channels after client has been disabled at runtime
- added logging of the client device's card index
- changed default suspend mode to "Always suspended"
- added "Hide Mainmenu Entry" setup option on client
This commit is contained in:
schmirl 2008-04-07 14:50:32 +00:00
parent 89735cbd95
commit 9c60fb4e42
14 changed files with 887 additions and 550 deletions

View File

@ -24,6 +24,7 @@ Rolf Ahrenberg
for suggesting a fix of the Makefile's default target
for a TS PAT repacker based on Petri Laine's VDR TS recording patch
for making it possible to pass parameters to externremux.sh
for removing pre VDR 1.4 legacy code
Rantanen Teemu
for providing vdr-incompletesections.diff
@ -70,3 +71,6 @@ Olli Lammi
Joerg Pulz
for his FreeBSD compatibility patch
tobi
for pointing to unused files in the libdvbmpeg directory

16
HISTORY
View File

@ -1,6 +1,22 @@
VDR Plugin 'streamdev' Revision History
---------------------------------------
2008-04-07: Branched v0_4
- changed location of streamdevhosts.conf to VDRCONFDIR/plugins/streamdev
- changed externremux.sh's default location to VDRCONFDIR/plugins/streamdev
- added sample externremux.sh from http://www.vdr-wiki.de/
- stop providing channels after client has been disabled at runtime
- added logging of the client device's card index
- changed default suspend mode to "Always suspended"
- added "Hide Mainmenu Entry" setup option on client
- resurrected clients "Suspend Server" menu item as its mainmenu entry
- dropped unused code for remote timers/recordings on client side
- dropped unused files client/{assembler,menu,remote}.[hc]
- dropped unused files in libdvbmpeg (reported by tobi)
- dropped patches for pre VDR 1.4
- removed legacy code for pre VDR 1.4 (thanks to Rolf Ahrenberg)
2008-03-31: Version 0.3.4
- added possibility to pass parameter to externremux.sh (thanks to Rolf

View File

@ -1,7 +1,7 @@
#
# Makefile for a Video Disk Recorder plugin
#
# $Id: Makefile,v 1.14 2008/04/07 14:40:39 schmirl Exp $
# $Id: Makefile,v 1.15 2008/04/07 14:50:32 schmirl Exp $
# The official name of this plugin.
# This name will be used in the '-P...' option of VDR to load the plugin.
@ -41,7 +41,7 @@ PACKAGE = vdr-$(ARCHIVE)
INCLUDES += -I$(VDRDIR)/include -I.
DEFINES += -D_GNU_SOURCE
DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"'
### The object files (add further files here):

98
README
View File

@ -15,13 +15,17 @@ Contents:
1. Description
2. Installation
2.1 VDR 1.2.X
2.2 VDR 1.3.X and above
2.1 VDR 1.3.X and older
2.2 VDR 1.4.X and above
2.3 Updating from streamdev 0.3.x
3. Usage
3.1 Usage HTTP server
3.2 Usage VDR-to-VDR server
3.3 Usage VDR-to-VDR client
4. Other useful Plugins
4.1 Plugins for VDR-to-VDR clients
4.2 Plugins for Server
4.3 Alternatives
5. Known Problems
@ -57,7 +61,7 @@ the PROTOCOL file.
2. Installation:
----------------
Let's say streamdev's version is 0.3.1 and vdr's version is 1.X.X. If you
Let's say streamdev's version is 0.4.0 and vdr's version is 1.X.X. If you
use anything else please exchange the version numbers appropriately (this
way I don't have to update this section all the times;) ).
@ -68,48 +72,62 @@ command line.
What's important is that the client requests a channel using its Unique Channel
ID. So, in order to find the channel at the server, it must have the same ID
that is used on the client. You can achieve this by putting the server's
channels.conf on the client, preferably after scanning (in case you use 1.2.X
with AutoPID or 1.3.X).
channels.conf on the client, preferably after scanning.
If you want to drive additional Input-Devices (with different sources) on the
client, you can merge the channels.conf files. VDR will detect if the local
device or the network device can receive the channels.
Last, but not least you have to put the provided streamdevhosts.conf.example
into the "plugins" subfolder of your config-directory (which is equal to your
video-directory if not specified otherwise), rename it to streamdevhosts.conf
and adjust it to your needs. The syntax is the same as for svdrphosts.conf, so
please consult VDR's documentation on how to fill that file, if you can't do
it on-the-fly. For example, if you didn't specify a separate config-directory,
and specified your video directory as "/video0", the file has to be put to
/video0/plugins/streamdevhosts.conf.
Last, but not least you have to copy the streamdev folder into the
"plugins/streamdev" subfolder of VDR's config-directory (which is equal to your
video-directory if not specified otherwise). For example, if you didn't specify
a separate config-directory, and specified your video directory as "/video0",
the directory has to be copied to /video0/plugins/streamdev.
The directory contains a file named streamdevhosts.conf which you must adjust
to your needs. The syntax is the same as for svdrphosts.conf, so please consult
VDR's documentation on how to fill that file, if you can't do it on-the-fly.
There's also a sample externremux.sh script in this directory. It is used by
streamdev's external remux feature. The sample script uses mencoder. Please
check the script for further information. You can specify a different script
location with the -r parameter. The VDR commandline would then include a
"-P 'streamdev-server -r /usr/local/bin/remux.sh'". Note the additional quotes,
as otherwise -r will be passed to VDR and not to streamdev.
2.1 VDR 1.2.X:
--------------
2.1 VDR 1.3.X and older:
------------------------
It is recommended that you apply a patch to VDR that improves thread
cancellation. You can work without it, but you _might_ have delays in switching
(especially when using VDR-to-VDR streaming) that are around three seconds.
This version is not compatible to VDR releases older than 1.4.0. You will
probably need one of the streamdev-0.3.x releases.
cd vdr-1.X.X/PLUGINS/src
tar xvfz vdr-streamdev-0.3.1.tgz
ln -s streamdev-0.3.1 streamdev
cd ../..
patch -p1 <PLUGINS/src/streamdev/patches/thread.c.diff
make [options, if necessary] vdr
make [options, if necessary] plugins
2.2 VDR 1.3.X and above:
2.2 VDR 1.4.X and above:
------------------------
cd vdr-1.X.X/PLUGINS/src
tar xvfz vdr-streamdev-0.3.1.tgz
ln -s streamdev-0.3.1 streamdev
tar xvfz vdr-streamdev-0.4.0.tgz
ln -s streamdev-0.4.0 streamdev
cp -r streamdev/streamdev VDRCONFDIR/plugins/
cd ../..
make [options, if necessary] vdr
make [options, if necessary] plugins
2.3 Updating from streamdev 0.3.x
----------------------------------
Starting with streamdev 0.4.0, all additional files are kept in a directory
called "streamdev" inside VDR's plugin config directory. This affects in
particular the file "streamdevhosts.conf". You will have to move it to its
new location:
mv VDRCONFDIR/plugins/streamdevhosts.conf VDRCONFDIR/plugins/streamdev/
(Directory VDRCONFDIR/plugins/streamdev already exists, as you copied the
whole folder from the sources directory as suggested above, right?)
The new default location for externremux.sh is also in this directory.
3. Usage:
---------
@ -120,12 +138,12 @@ can run in one VDR instance, if necessary.
The parameter "Suspend behaviour" allows you to specify how the server should
react in case the client requests a channel that would require switching the
primary device (i.e. disrupt live-tv). If set to "Offer suspend mode" (the
default), you will have a new entry in the main menu. Activating that will put
the server into "Suspend Mode" (a picture is displayed on TV). Then, a client
may switch the primary card to wherever it likes to. While watching TV (Suspend
deactivated), the client may not switch the transponder on the primary device.
If you set the behaviour to "Always suspended", there will be normal live-tv
primary device (i.e. disrupt live-tv). If set to "Offer suspend mode", you will
have a new entry in the main menu. Activating that will put the server into
"Suspend Mode" (a picture is displayed on TV). Then, a client may switch the
primary card to wherever it likes to. While watching TV (Suspend deactivated),
the client may not switch the transponder on the primary device. If you set
the behaviour to "Always suspended" (the default), there will be normal live-tv
on the server, but whenever a client decides to switch the transponder, the
server will lose it's live-tv. Set to "Never suspended", the server always
prevents the client from switching transponders. If you set "Client may
@ -198,6 +216,11 @@ no need to restart VDR.
3.3 Usage VDR-to-VDR client:
----------------------------
Streamdev-client adds a "Suspend Server" item to VDR's mainmenu. With the
setup parameter "Hide Mainmenu Entry" you can hide this menu item if you don't
need it. "Suspend Server" is only useful if the server runs in "Offer suspend
mode" with "Client may suspend" enabled.
The parameter "Remote IP" uses an IP-Adress-Editor, where you can just enter
the IP number with the number keys on your remote. After three digits (or if
the next digit would result in an invalid IP adress, or if the first digit is
@ -214,8 +237,9 @@ setting "Start Client" to yes. It is disabled by default, because it wouldn't
make much sense to start the client without specifying a server anyway. The
client is activated after you push the OK button, so there's no need to restart
VDR. Deactivation on-the-fly is not possible, so in order to deactivate the
client, you will have to restart VDR. All other settings can be changed without
restarting VDR.
client, you will have to restart VDR. However requests to switch channels will
be refused by streamdev-client once it has been deactivated. All other settings
can be changed without restarting VDR.
The client will try to connect to the server (in case it isn't yet) whenever
a remote channel is requested. Just activate the client and switch to a

View File

@ -1,5 +1,5 @@
/*
* $Id: device.c,v 1.17 2008/04/07 14:40:39 schmirl Exp $
* $Id: device.c,v 1.18 2008/04/07 14:50:32 schmirl Exp $
*/
#include "client/device.h"
@ -28,6 +28,7 @@ cStreamdevDevice::cStreamdevDevice(void) {
m_Filters = new cStreamdevFilters;
StartSectionHandler();
isyslog("streamdev-client: got device number %d", CardIndex() + 1);
m_Device = this;
m_Pids = 0;
@ -78,6 +79,10 @@ bool cStreamdevDevice::ProvidesChannel(const cChannel *Channel, int Priority,
bool res = false;
bool prio = Priority < 0 || Priority > this->Priority();
bool ndr = false;
if (!StreamdevClientSetup.StartClient)
return false;
Dprintf("ProvidesChannel, Channel=%s, Prio=%d\n", Channel->Name(), Priority);
if (ClientSocket.DataSocket(siLive) != NULL

View File

@ -1,5 +1,5 @@
/*
* $Id: setup.c,v 1.4 2008/04/07 14:40:40 schmirl Exp $
* $Id: setup.c,v 1.5 2008/04/07 14:50:32 schmirl Exp $
*/
#include <vdr/menuitems.h>
@ -15,6 +15,7 @@ cStreamdevClientSetup::cStreamdevClientSetup(void) {
RemotePort = 2004;
StreamFilters = false;
SyncEPG = false;
HideMenuEntry = false;
strcpy(RemoteIp, "");
}
@ -29,6 +30,7 @@ bool cStreamdevClientSetup::SetupParse(const char *Name, const char *Value) {
else if (strcmp(Name, "RemotePort") == 0) RemotePort = atoi(Value);
else if (strcmp(Name, "StreamFilters") == 0) StreamFilters = atoi(Value);
else if (strcmp(Name, "SyncEPG") == 0) SyncEPG = atoi(Value);
else if (strcmp(Name, "HideMenuEntry") == 0) HideMenuEntry = atoi(Value);
else return false;
return true;
}
@ -36,6 +38,7 @@ bool cStreamdevClientSetup::SetupParse(const char *Name, const char *Value) {
cStreamdevClientMenuSetupPage::cStreamdevClientMenuSetupPage(void) {
m_NewSetup = StreamdevClientSetup;
AddBoolEdit (tr("Hide Mainmenu Entry"),m_NewSetup.HideMenuEntry);
AddBoolEdit (tr("Start Client"), m_NewSetup.StartClient);
AddIpEdit (tr("Remote IP"), m_NewSetup.RemoteIp);
AddShortEdit(tr("Remote Port"), m_NewSetup.RemotePort);
@ -51,8 +54,6 @@ void cStreamdevClientMenuSetupPage::Store(void) {
if (m_NewSetup.StartClient != StreamdevClientSetup.StartClient) {
if (m_NewSetup.StartClient)
cStreamdevDevice::Init();
else
Skins.Message(mtInfo, tr("Please restart VDR to activate changes"));
}
SetupStore("StartClient", m_NewSetup.StartClient);
@ -63,6 +64,7 @@ void cStreamdevClientMenuSetupPage::Store(void) {
SetupStore("RemotePort", m_NewSetup.RemotePort);
SetupStore("StreamFilters", m_NewSetup.StreamFilters);
SetupStore("SyncEPG", m_NewSetup.SyncEPG);
SetupStore("HideMenuEntry", m_NewSetup.HideMenuEntry);
StreamdevClientSetup = m_NewSetup;

View File

@ -1,5 +1,5 @@
/*
* $Id: setup.h,v 1.3 2008/04/07 14:27:28 schmirl Exp $
* $Id: setup.h,v 1.4 2008/04/07 14:50:32 schmirl Exp $
*/
#ifndef VDR_STREAMDEV_SETUPCLIENT_H
@ -17,6 +17,7 @@ struct cStreamdevClientSetup {
int RemotePort;
int StreamFilters;
int SyncEPG;
int HideMenuEntry;
};
extern cStreamdevClientSetup StreamdevClientSetup;

1233
i18n.c

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,5 @@
#include "remux/extern.h"
#include "server/server.h"
#include "server/streamer.h"
#include <vdr/tools.h>
#include <sys/types.h>
@ -6,7 +7,7 @@
#include <signal.h>
#include <unistd.h>
const char *g_ExternRemux = "/root/externremux.sh";
const char *g_ExternRemux = EXTERNREMUXPATH;
class cTSExt: public cThread {
private:

View File

@ -1,5 +1,5 @@
/*
* $Id: server.h,v 1.2 2005/05/09 20:22:29 lordjaxom Exp $
* $Id: server.h,v 1.3 2008/04/07 14:50:33 schmirl Exp $
*/
#ifndef VDR_STREAMDEV_SERVER_H
@ -10,7 +10,8 @@
#include "server/component.h"
#include "server/connection.h"
#define STREAMDEVHOSTSPATH (*AddDirectory(cPlugin::ConfigDirectory(), "streamdevhosts.conf"))
#define EXTERNREMUXPATH (*AddDirectory(cPlugin::ConfigDirectory(PLUGIN_NAME_I18N), "externremux.sh"))
#define STREAMDEVHOSTSPATH (*AddDirectory(cPlugin::ConfigDirectory(PLUGIN_NAME_I18N), "streamdevhosts.conf"))
class cStreamdevServer: public cThread {
private:

View File

@ -1,5 +1,5 @@
/*
* $Id: setup.c,v 1.2 2005/05/09 20:22:29 lordjaxom Exp $
* $Id: setup.c,v 1.3 2008/04/07 14:50:33 schmirl Exp $
*/
#include <vdr/menuitems.h>
@ -17,7 +17,7 @@ cStreamdevServerSetup::cStreamdevServerSetup(void) {
StartHTTPServer = true;
HTTPServerPort = 3000;
HTTPStreamType = stPES;
SuspendMode = smOffer;
SuspendMode = smAlways;
AllowSuspend = false;
strcpy(VTPBindIP, "0.0.0.0");
strcpy(HTTPBindIP, "0.0.0.0");

View File

@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
* $Id: streamdev-client.c,v 1.4 2008/04/07 14:40:39 schmirl Exp $
* $Id: streamdev-client.c,v 1.5 2008/04/07 14:50:32 schmirl Exp $
*/
#include "streamdev-client.h"
@ -42,7 +42,7 @@ void cPluginStreamdevClient::Housekeeping(void) {
}
const char *cPluginStreamdevClient::MainMenuEntry(void) {
return StreamdevClientSetup.StartClient ? tr("Suspend Server") : NULL;
return StreamdevClientSetup.StartClient && !StreamdevClientSetup.HideMenuEntry ? tr("Suspend Server") : NULL;
}
cOsdObject *cPluginStreamdevClient::MainMenuAction(void) {

48
streamdev/externremux.sh Executable file
View File

@ -0,0 +1,48 @@
#!/bin/sh
#
# externremux.sh - sample remux script using mencoder for remuxing.
#
# Install this script as VDRCONFDIR/plugins/streamdev/externremux.sh
#
# The parameter STREAMQUALITY selects the default remux parameters. Adjust
# to your needs and point your web browser to http://servername:3000/extern/
# To select different remux parameters on the fly, insert a semicolon and
# the name of the requested quality: http://servername:3000/extern;WLAN11/
# CONFIG START
STREAMQUALITY="DSL6000" # DSL{1,2,3,6}000, LAN10, WLAN{11,54}, IPAQ
TMP=/tmp/externremux-${RANDOM:-$$}
MENCODER=mencoder
# CONFIG END
mkdir -p $TMP
mkfifo $TMP/out.avi
(trap "rm -rf $TMP" EXIT HUP INT TERM ABRT; cat $TMP/out.avi) &
case ${1:-$STREAMQUALITY} in
DSL1000) exec $MENCODER -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=100 \
-oac mp3lame -lameopts preset=15:mode=3 -vf scale=160:104 \
-o $TMP/out.avi -- - &>$TMP/out.log ;;
DSL2000) exec $MENCODER -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=128 \
-oac mp3lame -lameopts preset=15:mode=3 -vf scale=160:104 \
-o $TMP/out.avi -- - &>$TMP/out.log ;;
DSL3000) exec $MENCODER -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=250 \
-oac mp3lame -lameopts preset=15:mode=3 -vf scale=320:208 \
-o $TMP/out.avi -- - &>$TMP/out.log ;;
DSL6000) exec $MENCODER -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=350 \
-oac mp3lame -lameopts preset=15:mode=3 -vf scale=320:208 \
-o $TMP/out.avi -- - &>$TMP/out.log ;;
LAN10) exec $MENCODER -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=4096 \
-oac mp3lame -lameopts preset=standard \
-o $TMP/out.avi -- - &>$TMP/out.log ;;
WLAN11) exec $MENCODER -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=768 \
-oac mp3lame -lameopts preset=standard -vf scale=640:408 \
-o $TMP/out.avi -- - &>$TMP/out.log ;;
WLAN54) exec $MENCODER -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=2048 \
-oac mp3lame -lameopts preset=standard \
-o $TMP/out.avi -- - &>$TMP/out.log ;;
IPAQ) exec $MENCODER -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=350 \
-oac mp3lame -lameopts preset=15:mode=3 -vf scale=320:208 \
-o $TMP/out.avi -- - &>$TMP/out.log ;;
*) touch $TMP/out.avi ;;
esac