Changed FILE idle delay from setup option into channel parameters.

This commit is contained in:
Rolf Ahrenberg 2007-09-29 18:15:31 +00:00
parent e579aeb5bf
commit 1584a4c017
8 changed files with 24 additions and 33 deletions

4
README
View File

@ -40,14 +40,14 @@ Channels.conf examples:
TV1;IPTV:1:IPTV|UDP|127.0.0.1|1234:P:0:512:650:2321:0:1:0:0:0
^ ^ ^ ^ ^ ^
| | | | | Source type ("P")
| | | | IP Port Number
| | | | IP Port Number or File delay (ms)
| | | IP Address or File Location
| | Protocol ("UDP", "HTTP", "FILE")
| Plugin ID ("IPTV")
Unique enumeration
TV2;IPTV:2:IPTV|HTTP|127.0.0.1/TS/2|3000:P:0:513:660:2321:0:2:0:0:0
TV3;IPTV:3:IPTV|FILE|/media/video.ts|0:P:0:514:670:2321:0:3:0:0:0
TV3;IPTV:3:IPTV|FILE|/media/video.ts|5:P:0:514:670:2321:0:3:0:0:0
Example UDP multicast configuration for iptables firewall:

View File

@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
* $Id: config.c,v 1.9 2007/09/29 16:21:05 rahrenbe Exp $
* $Id: config.c,v 1.10 2007/09/29 18:15:31 rahrenbe Exp $
*/
#include "common.h"
@ -14,7 +14,6 @@ cIptvConfig IptvConfig;
cIptvConfig::cIptvConfig(void)
: readBufferTsCount(48),
tsBufferSize(2),
tsBufferPrefillRatio(25),
fileIdleTimeMs(5)
tsBufferPrefillRatio(0)
{
}

View File

@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
* $Id: config.h,v 1.7 2007/09/29 16:21:05 rahrenbe Exp $
* $Id: config.h,v 1.8 2007/09/29 18:15:31 rahrenbe Exp $
*/
#ifndef __IPTV_CONFIG_H
@ -18,17 +18,14 @@ protected:
unsigned int readBufferTsCount;
unsigned int tsBufferSize;
unsigned int tsBufferPrefillRatio;
unsigned int fileIdleTimeMs;
public:
cIptvConfig();
unsigned int GetReadBufferTsCount(void) { return readBufferTsCount; }
unsigned int GetTsBufferSize(void) { return tsBufferSize; }
unsigned int GetTsBufferPrefillRatio(void) { return tsBufferPrefillRatio; }
unsigned int GetFileIdleTimeMs(void) { return fileIdleTimeMs; }
void SetTsBufferSize(unsigned int Size) { tsBufferSize = Size; }
void SetTsBufferPrefillRatio(unsigned int Ratio) { tsBufferPrefillRatio = Ratio; }
void SetFileIdleTimeMs(unsigned int TimeMs) { fileIdleTimeMs = TimeMs; }
};
extern cIptvConfig IptvConfig;

4
iptv.c
View File

@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
* $Id: iptv.c,v 1.7 2007/09/29 16:21:05 rahrenbe Exp $
* $Id: iptv.c,v 1.8 2007/09/29 18:15:31 rahrenbe Exp $
*/
#include <getopt.h>
@ -158,8 +158,6 @@ bool cPluginIptv::SetupParse(const char *Name, const char *Value)
IptvConfig.SetTsBufferSize(atoi(Value));
else if (!strcasecmp(Name, "TsBufferPrefill"))
IptvConfig.SetTsBufferPrefillRatio(atoi(Value));
else if (!strcasecmp(Name, "FileIdleTimeMs"))
IptvConfig.SetFileIdleTimeMs(atoi(Value));
else
return false;
return true;

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: VDR 1.5.7\n"
"Report-Msgid-Bugs-To: Rolf Ahrenberg\n"
"POT-Creation-Date: 2007-09-29 19:09+0300\n"
"POT-Creation-Date: 2007-09-29 21:11+0300\n"
"PO-Revision-Date: 2007-08-12 23:22+0300\n"
"Last-Translator: Rolf Ahrenberg\n"
"Language-Team: <vdr@linuxtv.org>\n"
@ -35,15 +35,19 @@ msgstr "FILE"
msgid "Protocol"
msgstr "Protokolla"
#: setup.c:178
#: setup.c:174
msgid "Delay (ms)"
msgstr "Viive (ms)"
#: setup.c:179
msgid "Address"
msgstr "Osoite"
#: setup.c:179
#: setup.c:180
msgid "Port"
msgstr "Portti"
#: setup.c:297
#: setup.c:298
msgid "IPTV Channels"
msgstr "IPTV-kanavat"
@ -54,7 +58,3 @@ msgstr "TS-puskurin koko [MB]"
#: setup.c:442
msgid "TS buffer prefill ratio [%]"
msgstr "TS-puskurin esitäyttöaste [%]"
#: setup.c:443
msgid "FILE protocol idle time [ms]"
msgstr "FILE-prokollan joutoaika [ms]"

View File

@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
* $Id: protocolfile.c,v 1.8 2007/09/28 16:44:59 rahrenbe Exp $
* $Id: protocolfile.c,v 1.9 2007/09/29 18:15:31 rahrenbe Exp $
*/
#include <fcntl.h>
@ -79,7 +79,8 @@ int cIptvProtocolFile::Read(unsigned char* *BufferAddr)
rewind(fileStream);
// Sleep before reading the file stream to prevent aggressive busy looping
// and prevent transfer ringbuffer overflows
cCondWait::SleepMs(IptvConfig.GetFileIdleTimeMs());
if (streamPort)
cCondWait::SleepMs(streamPort);
// This check is to prevent a race condition where file may be switched off
// during the sleep and buffers are disposed. Check here that the plugin is
// still active before accessing the buffers

15
setup.c
View File

@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
* $Id: setup.c,v 1.13 2007/09/29 16:21:05 rahrenbe Exp $
* $Id: setup.c,v 1.14 2007/09/29 18:15:31 rahrenbe Exp $
*/
#include <string.h>
@ -144,7 +144,7 @@ void cIptvMenuEditChannel::SetChannelData(cChannel *Channel)
char dlangs[MAXDPIDS][MAXLANGCODE2] = { "" };
switch (data.protocol) {
case eProtocolFILE:
param = cString::sprintf("IPTV|FILE|%s|0", data.location);
param = cString::sprintf("IPTV|FILE|%s|%d", data.location, data.port);
break;
case eProtocolHTTP:
param = cString::sprintf("IPTV|HTTP|%s|%d", data.location, data.port);
@ -170,13 +170,14 @@ void cIptvMenuEditChannel::Setup(void)
Add(new cMenuEditStraItem(tr("Protocol"), &data.protocol, 3, protocols));
switch (data.protocol) {
case eProtocolFILE:
Add(new cMenuEditStrItem(trVDR("File"), data.location, sizeof(data.location), trVDR(FileNameChars)));
Add(new cMenuEditStrItem(trVDR("File"), data.location, sizeof(data.location), trVDR(FileNameChars)));
Add(new cMenuEditIntItem(tr("Delay (ms)"), &data.port, 0, 0xFFFF));
break;
case eProtocolHTTP:
case eProtocolUDP:
default:
Add(new cMenuEditStrItem(tr("Address"),data.location, sizeof(data.location), trVDR(FileNameChars)));
Add(new cMenuEditIntItem(tr("Port"), &data.port, 0, 0xFFFF));
Add(new cMenuEditStrItem(tr("Address"), data.location, sizeof(data.location), trVDR(FileNameChars)));
Add(new cMenuEditIntItem(tr("Port"), &data.port, 0, 0xFFFF));
break;
}
// Normal settings
@ -429,7 +430,6 @@ cIptvPluginSetup::cIptvPluginSetup()
{
tsBufferSize = IptvConfig.GetTsBufferSize();
tsBufferPrefill = IptvConfig.GetTsBufferPrefillRatio();
fileIdleTimeMs = IptvConfig.GetFileIdleTimeMs();
Setup();
SetHelp(trVDR("Channels"), NULL, NULL, NULL);
}
@ -440,7 +440,6 @@ void cIptvPluginSetup::Setup(void)
Clear();
Add(new cMenuEditIntItem(tr("TS buffer size [MB]"), &tsBufferSize, 2, 16));
Add(new cMenuEditIntItem(tr("TS buffer prefill ratio [%]"), &tsBufferPrefill, 0, 40));
Add(new cMenuEditIntItem(tr("FILE protocol idle time [ms]"), &fileIdleTimeMs, 1, 100));
SetCurrent(Get(current));
Display();
}
@ -469,10 +468,8 @@ void cIptvPluginSetup::Store(void)
// Store values into setup.conf
SetupStore("TsBufferSize", tsBufferSize);
SetupStore("TsBufferPrefill", tsBufferPrefill);
SetupStore("FileIdleTimeMs", fileIdleTimeMs);
// Update global config
IptvConfig.SetTsBufferSize(tsBufferSize);
IptvConfig.SetTsBufferPrefillRatio(tsBufferPrefill);
IptvConfig.SetFileIdleTimeMs(fileIdleTimeMs);
}

View File

@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
* $Id: setup.h,v 1.7 2007/09/29 16:21:05 rahrenbe Exp $
* $Id: setup.h,v 1.8 2007/09/29 18:15:31 rahrenbe Exp $
*/
#ifndef __IPTV_SETUP_H
@ -16,7 +16,6 @@ class cIptvPluginSetup : public cMenuSetupPage
private:
int tsBufferSize;
int tsBufferPrefill;
int fileIdleTimeMs;
eOSState EditChannel(void);
virtual void Setup(void);