mirror of
https://github.com/rofafor/vdr-plugin-iptv.git
synced 2023-10-10 13:37:03 +02:00
Added new setup options.
This commit is contained in:
parent
026e730c81
commit
b6aabba854
9
config.c
9
config.c
@ -3,7 +3,7 @@
|
||||
*
|
||||
* See the README file for copyright information and how to reach the author.
|
||||
*
|
||||
* $Id: config.c,v 1.2 2007/09/15 21:27:00 rahrenbe Exp $
|
||||
* $Id: config.c,v 1.3 2007/09/16 13:38:20 rahrenbe Exp $
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
@ -12,7 +12,10 @@
|
||||
cIptvConfig IptvConfig;
|
||||
|
||||
cIptvConfig::cIptvConfig(void)
|
||||
: bufferSizeMB(8),
|
||||
bufferPrefillRatio(0)
|
||||
: tsBufferSize(8),
|
||||
tsBufferPrefillRatio(0),
|
||||
udpBufferSize(7),
|
||||
httpBufferSize(7),
|
||||
fileBufferSize(7)
|
||||
{
|
||||
}
|
||||
|
23
config.h
23
config.h
@ -3,7 +3,7 @@
|
||||
*
|
||||
* See the README file for copyright information and how to reach the author.
|
||||
*
|
||||
* $Id: config.h,v 1.2 2007/09/15 21:27:00 rahrenbe Exp $
|
||||
* $Id: config.h,v 1.3 2007/09/16 13:38:20 rahrenbe Exp $
|
||||
*/
|
||||
|
||||
#ifndef __IPTV_CONFIG_H
|
||||
@ -15,14 +15,23 @@
|
||||
class cIptvConfig
|
||||
{
|
||||
protected:
|
||||
unsigned int bufferSizeMB;
|
||||
unsigned int bufferPrefillRatio;
|
||||
unsigned int tsBufferSize;
|
||||
unsigned int tsBufferPrefillRatio;
|
||||
unsigned int udpBufferSize;
|
||||
unsigned int httpBufferSize;
|
||||
unsigned int fileBufferSize;
|
||||
public:
|
||||
cIptvConfig();
|
||||
unsigned int GetBufferSizeMB(void) { return bufferSizeMB; }
|
||||
unsigned int GetBufferPrefillRatio(void) { return bufferPrefillRatio; }
|
||||
void SetBufferSizeMB(unsigned int Size) { bufferSizeMB = Size; }
|
||||
void SetBufferPrefillRatio(unsigned int Ratio) { bufferPrefillRatio = Ratio; }
|
||||
unsigned int GetTsBufferSize(void) { return tsBufferSize; }
|
||||
unsigned int GetTsBufferPrefillRatio(void) { return tsBufferPrefillRatio; }
|
||||
unsigned int GetUdpBufferSize(void) { return udpBufferSize; }
|
||||
unsigned int GetHttpBufferSize(void) { return httpBufferSize; }
|
||||
unsigned int GetFileBufferSize(void) { return fileBufferSize; }
|
||||
void SetTsBufferSize(unsigned int Size) { tsBufferSize = Size; }
|
||||
void SetTsBufferPrefillRatio(unsigned int Ratio) { tsBufferPrefillRatio = Ratio; }
|
||||
void SetUdpBufferSize(unsigned int Size) { udpBufferSize = Size; }
|
||||
void SetHttpBufferSize(unsigned int Size) { httpBufferSize = Size; }
|
||||
void SetFileBufferSize(unsigned int Size) { fileBufferSize = Size; }
|
||||
};
|
||||
|
||||
extern cIptvConfig IptvConfig;
|
||||
|
33
device.c
33
device.c
@ -3,7 +3,7 @@
|
||||
*
|
||||
* See the README file for copyright information and how to reach the author.
|
||||
*
|
||||
* $Id: device.c,v 1.19 2007/09/16 13:11:19 rahrenbe Exp $
|
||||
* $Id: device.c,v 1.20 2007/09/16 13:38:20 rahrenbe Exp $
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
@ -23,18 +23,17 @@ cIptvDevice::cIptvDevice(unsigned int Index)
|
||||
mutex()
|
||||
{
|
||||
debug("cIptvDevice::cIptvDevice(%d)\n", deviceIndex);
|
||||
tsBuffer = new cRingBufferLinear(MEGABYTE(IptvConfig.GetBufferSizeMB()),
|
||||
tsBuffer = new cRingBufferLinear(MEGABYTE(IptvConfig.GetTsBufferSize()),
|
||||
(TS_SIZE * 2), false, "IPTV");
|
||||
tsBuffer->SetTimeouts(100, 100);
|
||||
// pad prefill to multiple of TS_SIZE
|
||||
tsBufferPrefill = MEGABYTE(IptvConfig.GetBufferSizeMB()) *
|
||||
IptvConfig.GetBufferPrefillRatio() / 100;
|
||||
tsBufferPrefill = MEGABYTE(IptvConfig.GetTsBufferSize()) *
|
||||
IptvConfig.GetTsBufferPrefillRatio() / 100;
|
||||
tsBufferPrefill -= (tsBufferPrefill % TS_SIZE);
|
||||
//debug("Buffer=%d Prefill=%d\n", MEGABYTE(IptvConfig.GetBufferSizeMB()), tsBufferPrefill);
|
||||
//debug("Buffer=%d Prefill=%d\n", MEGABYTE(IptvConfig.GetTsBufferSize()), tsBufferPrefill);
|
||||
pUdpProtocol = new cIptvProtocolUdp();
|
||||
pHttpProtocol = new cIptvProtocolHttp();
|
||||
pFileProtocol = new cIptvProtocolFile();
|
||||
//pRtspProtocol = new cIptvProtocolRtsp();
|
||||
pIptvStreamer = new cIptvStreamer(tsBuffer, &mutex);
|
||||
StartSectionHandler();
|
||||
}
|
||||
@ -92,18 +91,12 @@ cString cIptvDevice::GetChannelSettings(const char *Param, int *IpPort, cIptvPro
|
||||
*Protocol = pHttpProtocol;
|
||||
return addr;
|
||||
}
|
||||
//else if (sscanf(Param, "IPTV|FILE|%a[^|]|%u", &loc, IpPort) == 5) {
|
||||
// cString addr(loc, true);
|
||||
// free(loc);
|
||||
// *Protocol = pFileProtocol;
|
||||
// return addr;
|
||||
// }
|
||||
//else if (sscanf(Param, "IPTV|RTSP|%a[^|]|%u", &loc, IpPort) == 5) {
|
||||
// cString addr(loc, true);
|
||||
// free(loc);
|
||||
// *Protocol = pRtspProtocol;
|
||||
// return addr;
|
||||
// }
|
||||
else if (sscanf(Param, "IPTV|FILE|%a[^|]|%u", &loc, IpPort) == 5) {
|
||||
cString addr(loc, true);
|
||||
free(loc);
|
||||
*Protocol = pFileProtocol;
|
||||
return addr;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -151,8 +144,8 @@ bool cIptvDevice::SetChannelDevice(const cChannel *Channel, bool LiveView)
|
||||
return false;
|
||||
}
|
||||
// pad prefill to multiple of TS_SIZE
|
||||
tsBufferPrefill = MEGABYTE(IptvConfig.GetBufferSizeMB()) *
|
||||
IptvConfig.GetBufferPrefillRatio() / 100;
|
||||
tsBufferPrefill = MEGABYTE(IptvConfig.GetTsBufferSize()) *
|
||||
IptvConfig.GetTsBufferPrefillRatio() / 100;
|
||||
tsBufferPrefill -= (tsBufferPrefill % TS_SIZE);
|
||||
pIptvStreamer->Set(addr, port, protocol);
|
||||
return true;
|
||||
|
16
iptv.c
16
iptv.c
@ -3,7 +3,7 @@
|
||||
*
|
||||
* See the README file for copyright information and how to reach the author.
|
||||
*
|
||||
* $Id: iptv.c,v 1.4 2007/09/15 23:58:23 rahrenbe Exp $
|
||||
* $Id: iptv.c,v 1.5 2007/09/16 13:38:20 rahrenbe Exp $
|
||||
*/
|
||||
|
||||
#include <getopt.h>
|
||||
@ -154,10 +154,16 @@ bool cPluginIptv::SetupParse(const char *Name, const char *Value)
|
||||
{
|
||||
debug("cPluginIptv::SetupParse()\n");
|
||||
// Parse your own setup parameters and store their values.
|
||||
if (!strcasecmp(Name, "BufferSize"))
|
||||
IptvConfig.SetBufferSizeMB(atoi(Value));
|
||||
else if (!strcasecmp(Name, "BufferPrefill"))
|
||||
IptvConfig.SetBufferPrefillRatio(atoi(Value));
|
||||
if (!strcasecmp(Name, "TsBufferSize"))
|
||||
IptvConfig.SetTsBufferSize(atoi(Value));
|
||||
else if (!strcasecmp(Name, "TsBufferPrefill"))
|
||||
IptvConfig.SetTsBufferPrefillRatio(atoi(Value));
|
||||
else if (!strcasecmp(Name, "UdpBufferSize"))
|
||||
IptvConfig.SetUdpBufferSize(atoi(Value));
|
||||
else if (!strcasecmp(Name, "HttpBufferSize"))
|
||||
IptvConfig.SetHttpBufferSize(atoi(Value));
|
||||
else if (!strcasecmp(Name, "FileBufferSize"))
|
||||
IptvConfig.SetFileBufferSize(atoi(Value));
|
||||
else
|
||||
return false;
|
||||
return true;
|
||||
|
26
po/fi_FI.po
26
po/fi_FI.po
@ -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-15 23:45+0300\n"
|
||||
"POT-Creation-Date: 2007-09-16 16:35+0300\n"
|
||||
"PO-Revision-Date: 2007-08-12 23:22+0300\n"
|
||||
"Last-Translator: Rolf Ahrenberg\n"
|
||||
"Language-Team: <vdr@linuxtv.org>\n"
|
||||
@ -19,10 +19,22 @@ msgstr ""
|
||||
msgid "Experiment the IPTV"
|
||||
msgstr "Koe IPTV:n ihmeellinen maailma"
|
||||
|
||||
#: setup.c:24
|
||||
msgid "Buffer size [MB]"
|
||||
msgstr "Puskurin koko [MB]"
|
||||
#: setup.c:28
|
||||
msgid "TS buffer size [MB]"
|
||||
msgstr "TS-puskurin koko [MB]"
|
||||
|
||||
#: setup.c:25
|
||||
msgid "Buffer prefill ratio [%]"
|
||||
msgstr "Puskurin esitäyttöaste [%]"
|
||||
#: setup.c:29
|
||||
msgid "TS buffer prefill ratio [%]"
|
||||
msgstr "TS-puskurin esitäyttöaste [%]"
|
||||
|
||||
#: setup.c:30
|
||||
msgid "UDP buffer size [packets]"
|
||||
msgstr "UDP-puskurin koko [pakettia]"
|
||||
|
||||
#: setup.c:31
|
||||
msgid "HTTP buffer size [packets]"
|
||||
msgstr "HTTP-puskurin koko [pakettia]"
|
||||
|
||||
#: setup.c:32
|
||||
msgid "FILE buffer size [packets]"
|
||||
msgstr "FILE-puskurin koko [pakettia]"
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* See the README file for copyright information and how to reach the author.
|
||||
*
|
||||
* $Id: protocolfile.c,v 1.1 2007/09/16 12:18:15 ajhseppa Exp $
|
||||
* $Id: protocolfile.c,v 1.2 2007/09/16 13:38:20 rahrenbe Exp $
|
||||
*/
|
||||
|
||||
#include <fcntl.h>
|
||||
@ -12,14 +12,16 @@
|
||||
#include <vdr/device.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "config.h"
|
||||
#include "protocolfile.h"
|
||||
|
||||
cIptvProtocolFile::cIptvProtocolFile()
|
||||
: fileDesc(-1),
|
||||
readBufferLen(TS_SIZE * 7),
|
||||
readBufferLen(TS_SIZE * IptvConfig.GetFileBufferSize()),
|
||||
fileActive(false)
|
||||
{
|
||||
debug("cIptvProtocolFile::cIptvProtocolFile()\n");
|
||||
debug("cIptvProtocolFile::cIptvProtocolFile(): readBufferLen=%d (%d)\n",
|
||||
readBufferLen, (readBufferLen / TS_SIZE));
|
||||
streamAddr = strdup("");
|
||||
// Allocate receive buffer
|
||||
readBuffer = MALLOC(unsigned char, readBufferLen);
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* See the README file for copyright information and how to reach the author.
|
||||
*
|
||||
* $Id: protocolhttp.c,v 1.1 2007/09/16 09:38:01 ajhseppa Exp $
|
||||
* $Id: protocolhttp.c,v 1.2 2007/09/16 13:38:20 rahrenbe Exp $
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -15,15 +15,17 @@
|
||||
#include <vdr/device.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "config.h"
|
||||
#include "protocolhttp.h"
|
||||
|
||||
cIptvProtocolHttp::cIptvProtocolHttp()
|
||||
: streamPort(1234),
|
||||
socketDesc(-1),
|
||||
readBufferLen(TS_SIZE * 7),
|
||||
readBufferLen(TS_SIZE * IptvConfig.GetHttpBufferSize()),
|
||||
unicastActive(false)
|
||||
{
|
||||
debug("cIptvProtocolHttp::cIptvProtocolHttp()\n");
|
||||
debug("cIptvProtocolHttp::cIptvProtocolHttp(): readBufferLen=%d (%d)\n",
|
||||
readBufferLen, (readBufferLen / TS_SIZE));
|
||||
streamAddr = strdup("");
|
||||
// Allocate receive buffer
|
||||
readBuffer = MALLOC(unsigned char, readBufferLen);
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* See the README file for copyright information and how to reach the author.
|
||||
*
|
||||
* $Id: protocoludp.c,v 1.4 2007/09/15 23:58:23 rahrenbe Exp $
|
||||
* $Id: protocoludp.c,v 1.5 2007/09/16 13:38:20 rahrenbe Exp $
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -15,15 +15,17 @@
|
||||
#include <vdr/device.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "config.h"
|
||||
#include "protocoludp.h"
|
||||
|
||||
cIptvProtocolUdp::cIptvProtocolUdp()
|
||||
: streamPort(1234),
|
||||
socketDesc(-1),
|
||||
readBufferLen(TS_SIZE * 7),
|
||||
readBufferLen(TS_SIZE * IptvConfig.GetUdpBufferSize()),
|
||||
mcastActive(false)
|
||||
{
|
||||
debug("cIptvProtocolUdp::cIptvProtocolUdp()\n");
|
||||
debug("cIptvProtocolUdp::cIptvProtocolUdp(): readBufferLen=%d (%d)\n",
|
||||
readBufferLen, (readBufferLen / TS_SIZE));
|
||||
streamAddr = strdup("");
|
||||
// Allocate receive buffer
|
||||
readBuffer = MALLOC(unsigned char, readBufferLen);
|
||||
|
33
setup.c
33
setup.c
@ -3,7 +3,7 @@
|
||||
*
|
||||
* See the README file for copyright information and how to reach the author.
|
||||
*
|
||||
* $Id: setup.c,v 1.3 2007/09/15 23:58:23 rahrenbe Exp $
|
||||
* $Id: setup.c,v 1.4 2007/09/16 13:38:20 rahrenbe Exp $
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
@ -12,17 +12,24 @@
|
||||
|
||||
cIptvPluginSetup::cIptvPluginSetup(void)
|
||||
{
|
||||
bufferSize = IptvConfig.GetBufferSizeMB();
|
||||
bufferPrefill = IptvConfig.GetBufferPrefillRatio();
|
||||
tsBufferSize = IptvConfig.GetTsBufferSize();
|
||||
tsBufferPrefill = IptvConfig.GetTsBufferPrefillRatio();
|
||||
udpBufferSize = IptvConfig.GetUdpBufferSize();
|
||||
httpBufferSize = IptvConfig.GetHttpBufferSize();
|
||||
fileBufferSize = IptvConfig.GetFileBufferSize();
|
||||
Setup();
|
||||
SetHelp(trVDR("Channels"), NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
void cIptvPluginSetup::Setup(void)
|
||||
{
|
||||
int current = Current();
|
||||
Clear();
|
||||
Add(new cMenuEditIntItem(tr("Buffer size [MB]"), &bufferSize, 2, 16));
|
||||
Add(new cMenuEditIntItem(tr("Buffer prefill ratio [%]"), &bufferPrefill, 0, 40));
|
||||
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("UDP buffer size [packets]"), &udpBufferSize, 1, 14));
|
||||
Add(new cMenuEditIntItem(tr("HTTP buffer size [packets]"), &httpBufferSize, 1, 14));
|
||||
Add(new cMenuEditIntItem(tr("FILE buffer size [packets]"), &fileBufferSize, 1, 14));
|
||||
SetCurrent(Get(current));
|
||||
Display();
|
||||
}
|
||||
@ -35,8 +42,16 @@ eOSState cIptvPluginSetup::ProcessKey(eKeys Key)
|
||||
|
||||
void cIptvPluginSetup::Store(void)
|
||||
{
|
||||
SetupStore("BufferSize", bufferSize);
|
||||
SetupStore("BufferPrefill", bufferPrefill);
|
||||
IptvConfig.SetBufferSizeMB(bufferSize);
|
||||
IptvConfig.SetBufferPrefillRatio(bufferPrefill);
|
||||
// Store values into setup.conf
|
||||
SetupStore("TsBufferSize", tsBufferSize);
|
||||
SetupStore("TsBufferPrefill", tsBufferPrefill);
|
||||
SetupStore("UdpBufferSize", udpBufferSize);
|
||||
SetupStore("HttpBufferSize", httpBufferSize);
|
||||
SetupStore("FileBufferSize", fileBufferSize);
|
||||
// Update global config
|
||||
IptvConfig.SetTsBufferSize(tsBufferSize);
|
||||
IptvConfig.SetTsBufferPrefillRatio(tsBufferPrefill);
|
||||
IptvConfig.SetUdpBufferSize(udpBufferSize);
|
||||
IptvConfig.SetHttpBufferSize(httpBufferSize);
|
||||
IptvConfig.SetFileBufferSize(fileBufferSize);
|
||||
}
|
||||
|
9
setup.h
9
setup.h
@ -3,7 +3,7 @@
|
||||
*
|
||||
* See the README file for copyright information and how to reach the author.
|
||||
*
|
||||
* $Id: setup.h,v 1.2 2007/09/15 21:27:00 rahrenbe Exp $
|
||||
* $Id: setup.h,v 1.3 2007/09/16 13:38:20 rahrenbe Exp $
|
||||
*/
|
||||
|
||||
#ifndef __IPTV_SETUP_H
|
||||
@ -14,8 +14,11 @@
|
||||
class cIptvPluginSetup : public cMenuSetupPage
|
||||
{
|
||||
private:
|
||||
int bufferSize;
|
||||
int bufferPrefill;
|
||||
int tsBufferSize;
|
||||
int tsBufferPrefill;
|
||||
int udpBufferSize;
|
||||
int httpBufferSize;
|
||||
int fileBufferSize;
|
||||
virtual void Setup(void);
|
||||
|
||||
protected:
|
||||
|
Loading…
Reference in New Issue
Block a user