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

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 TV1;IPTV:1:IPTV|UDP|127.0.0.1|1234:P:0:512:650:2321:0:1:0:0:0
^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
| | | | | Source type ("P") | | | | | Source type ("P")
| | | | IP Port Number | | | | IP Port Number or File delay (ms)
| | | IP Address or File Location | | | IP Address or File Location
| | Protocol ("UDP", "HTTP", "FILE") | | Protocol ("UDP", "HTTP", "FILE")
| Plugin ID ("IPTV") | Plugin ID ("IPTV")
Unique enumeration Unique enumeration
TV2;IPTV:2:IPTV|HTTP|127.0.0.1/TS/2|3000:P:0:513:660:2321:0:2:0:0:0 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: 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. * 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" #include "common.h"
@ -14,7 +14,6 @@ cIptvConfig IptvConfig;
cIptvConfig::cIptvConfig(void) cIptvConfig::cIptvConfig(void)
: readBufferTsCount(48), : readBufferTsCount(48),
tsBufferSize(2), tsBufferSize(2),
tsBufferPrefillRatio(25), tsBufferPrefillRatio(0)
fileIdleTimeMs(5)
{ {
} }

View File

@ -3,7 +3,7 @@
* *
* See the README file for copyright information and how to reach the author. * 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 #ifndef __IPTV_CONFIG_H
@ -18,17 +18,14 @@ protected:
unsigned int readBufferTsCount; unsigned int readBufferTsCount;
unsigned int tsBufferSize; unsigned int tsBufferSize;
unsigned int tsBufferPrefillRatio; unsigned int tsBufferPrefillRatio;
unsigned int fileIdleTimeMs;
public: public:
cIptvConfig(); cIptvConfig();
unsigned int GetReadBufferTsCount(void) { return readBufferTsCount; } unsigned int GetReadBufferTsCount(void) { return readBufferTsCount; }
unsigned int GetTsBufferSize(void) { return tsBufferSize; } unsigned int GetTsBufferSize(void) { return tsBufferSize; }
unsigned int GetTsBufferPrefillRatio(void) { return tsBufferPrefillRatio; } unsigned int GetTsBufferPrefillRatio(void) { return tsBufferPrefillRatio; }
unsigned int GetFileIdleTimeMs(void) { return fileIdleTimeMs; }
void SetTsBufferSize(unsigned int Size) { tsBufferSize = Size; } void SetTsBufferSize(unsigned int Size) { tsBufferSize = Size; }
void SetTsBufferPrefillRatio(unsigned int Ratio) { tsBufferPrefillRatio = Ratio; } void SetTsBufferPrefillRatio(unsigned int Ratio) { tsBufferPrefillRatio = Ratio; }
void SetFileIdleTimeMs(unsigned int TimeMs) { fileIdleTimeMs = TimeMs; }
}; };
extern cIptvConfig IptvConfig; 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. * 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> #include <getopt.h>
@ -158,8 +158,6 @@ bool cPluginIptv::SetupParse(const char *Name, const char *Value)
IptvConfig.SetTsBufferSize(atoi(Value)); IptvConfig.SetTsBufferSize(atoi(Value));
else if (!strcasecmp(Name, "TsBufferPrefill")) else if (!strcasecmp(Name, "TsBufferPrefill"))
IptvConfig.SetTsBufferPrefillRatio(atoi(Value)); IptvConfig.SetTsBufferPrefillRatio(atoi(Value));
else if (!strcasecmp(Name, "FileIdleTimeMs"))
IptvConfig.SetFileIdleTimeMs(atoi(Value));
else else
return false; return false;
return true; return true;

View File

@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: VDR 1.5.7\n" "Project-Id-Version: VDR 1.5.7\n"
"Report-Msgid-Bugs-To: Rolf Ahrenberg\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" "PO-Revision-Date: 2007-08-12 23:22+0300\n"
"Last-Translator: Rolf Ahrenberg\n" "Last-Translator: Rolf Ahrenberg\n"
"Language-Team: <vdr@linuxtv.org>\n" "Language-Team: <vdr@linuxtv.org>\n"
@ -35,15 +35,19 @@ msgstr "FILE"
msgid "Protocol" msgid "Protocol"
msgstr "Protokolla" msgstr "Protokolla"
#: setup.c:178 #: setup.c:174
msgid "Delay (ms)"
msgstr "Viive (ms)"
#: setup.c:179
msgid "Address" msgid "Address"
msgstr "Osoite" msgstr "Osoite"
#: setup.c:179 #: setup.c:180
msgid "Port" msgid "Port"
msgstr "Portti" msgstr "Portti"
#: setup.c:297 #: setup.c:298
msgid "IPTV Channels" msgid "IPTV Channels"
msgstr "IPTV-kanavat" msgstr "IPTV-kanavat"
@ -54,7 +58,3 @@ msgstr "TS-puskurin koko [MB]"
#: setup.c:442 #: setup.c:442
msgid "TS buffer prefill ratio [%]" msgid "TS buffer prefill ratio [%]"
msgstr "TS-puskurin esitäyttöaste [%]" 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. * 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> #include <fcntl.h>
@ -79,7 +79,8 @@ int cIptvProtocolFile::Read(unsigned char* *BufferAddr)
rewind(fileStream); rewind(fileStream);
// Sleep before reading the file stream to prevent aggressive busy looping // Sleep before reading the file stream to prevent aggressive busy looping
// and prevent transfer ringbuffer overflows // 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 // 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 // during the sleep and buffers are disposed. Check here that the plugin is
// still active before accessing the buffers // 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. * 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> #include <string.h>
@ -144,7 +144,7 @@ void cIptvMenuEditChannel::SetChannelData(cChannel *Channel)
char dlangs[MAXDPIDS][MAXLANGCODE2] = { "" }; char dlangs[MAXDPIDS][MAXLANGCODE2] = { "" };
switch (data.protocol) { switch (data.protocol) {
case eProtocolFILE: case eProtocolFILE:
param = cString::sprintf("IPTV|FILE|%s|0", data.location); param = cString::sprintf("IPTV|FILE|%s|%d", data.location, data.port);
break; break;
case eProtocolHTTP: case eProtocolHTTP:
param = cString::sprintf("IPTV|HTTP|%s|%d", data.location, data.port); 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)); Add(new cMenuEditStraItem(tr("Protocol"), &data.protocol, 3, protocols));
switch (data.protocol) { switch (data.protocol) {
case eProtocolFILE: 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; break;
case eProtocolHTTP: case eProtocolHTTP:
case eProtocolUDP: case eProtocolUDP:
default: default:
Add(new cMenuEditStrItem(tr("Address"),data.location, sizeof(data.location), trVDR(FileNameChars))); Add(new cMenuEditStrItem(tr("Address"), data.location, sizeof(data.location), trVDR(FileNameChars)));
Add(new cMenuEditIntItem(tr("Port"), &data.port, 0, 0xFFFF)); Add(new cMenuEditIntItem(tr("Port"), &data.port, 0, 0xFFFF));
break; break;
} }
// Normal settings // Normal settings
@ -429,7 +430,6 @@ cIptvPluginSetup::cIptvPluginSetup()
{ {
tsBufferSize = IptvConfig.GetTsBufferSize(); tsBufferSize = IptvConfig.GetTsBufferSize();
tsBufferPrefill = IptvConfig.GetTsBufferPrefillRatio(); tsBufferPrefill = IptvConfig.GetTsBufferPrefillRatio();
fileIdleTimeMs = IptvConfig.GetFileIdleTimeMs();
Setup(); Setup();
SetHelp(trVDR("Channels"), NULL, NULL, NULL); SetHelp(trVDR("Channels"), NULL, NULL, NULL);
} }
@ -440,7 +440,6 @@ void cIptvPluginSetup::Setup(void)
Clear(); Clear();
Add(new cMenuEditIntItem(tr("TS buffer size [MB]"), &tsBufferSize, 2, 16)); 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("TS buffer prefill ratio [%]"), &tsBufferPrefill, 0, 40));
Add(new cMenuEditIntItem(tr("FILE protocol idle time [ms]"), &fileIdleTimeMs, 1, 100));
SetCurrent(Get(current)); SetCurrent(Get(current));
Display(); Display();
} }
@ -469,10 +468,8 @@ void cIptvPluginSetup::Store(void)
// Store values into setup.conf // Store values into setup.conf
SetupStore("TsBufferSize", tsBufferSize); SetupStore("TsBufferSize", tsBufferSize);
SetupStore("TsBufferPrefill", tsBufferPrefill); SetupStore("TsBufferPrefill", tsBufferPrefill);
SetupStore("FileIdleTimeMs", fileIdleTimeMs);
// Update global config // Update global config
IptvConfig.SetTsBufferSize(tsBufferSize); IptvConfig.SetTsBufferSize(tsBufferSize);
IptvConfig.SetTsBufferPrefillRatio(tsBufferPrefill); 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. * 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 #ifndef __IPTV_SETUP_H
@ -16,7 +16,6 @@ class cIptvPluginSetup : public cMenuSetupPage
private: private:
int tsBufferSize; int tsBufferSize;
int tsBufferPrefill; int tsBufferPrefill;
int fileIdleTimeMs;
eOSState EditChannel(void); eOSState EditChannel(void);
virtual void Setup(void); virtual void Setup(void);