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

Added configurable buffer size.

This commit is contained in:
Rolf Ahrenberg 2007-09-15 15:38:38 +00:00
parent 7f4bcb76e2
commit 8d6f72ca5d
8 changed files with 130 additions and 9 deletions

View File

@ -1,7 +1,7 @@
#
# Makefile for a Video Disk Recorder plugin
#
# $Id: Makefile,v 1.2 2007/09/14 15:44:25 rahrenbe Exp $
# $Id: Makefile,v 1.3 2007/09/15 15:38:38 rahrenbe Exp $
# Debugging on/off
IPTV_DEBUG = 1
@ -57,7 +57,7 @@ endif
### The object files (add further files here):
OBJS = $(PLUGIN).o device.o streamer.o protocoludp.o
OBJS = $(PLUGIN).o config.o setup.o device.o streamer.o protocoludp.o
### The main target:

17
config.c Normal file
View File

@ -0,0 +1,17 @@
/*
* config.c: IPTV plugin for the Video Disk Recorder
*
* See the README file for copyright information and how to reach the author.
*
* $Id: config.c,v 1.1 2007/09/15 15:38:38 rahrenbe Exp $
*/
#include "common.h"
#include "config.h"
cIptvConfig IptvConfig;
cIptvConfig::cIptvConfig(void)
: bufferSizeMB(8)
{
}

27
config.h Normal file
View File

@ -0,0 +1,27 @@
/*
* config.h: IPTV plugin for the Video Disk Recorder
*
* See the README file for copyright information and how to reach the author.
*
* $Id: config.h,v 1.1 2007/09/15 15:38:38 rahrenbe Exp $
*/
#ifndef __IPTV_CONFIG_H
#define __IPTV_CONFIG_H
#include <vdr/menuitems.h>
#include "config.h"
class cIptvConfig
{
protected:
unsigned int bufferSizeMB;
public:
cIptvConfig();
unsigned int GetBufferSizeMB(void) { return bufferSizeMB; }
void SetBufferSizeMB(unsigned int Size) { bufferSizeMB = Size; }
};
extern cIptvConfig IptvConfig;
#endif // __IPTV_CONFIG_H

View File

@ -3,10 +3,11 @@
*
* See the README file for copyright information and how to reach the author.
*
* $Id: device.c,v 1.12 2007/09/15 15:02:33 rahrenbe Exp $
* $Id: device.c,v 1.13 2007/09/15 15:38:38 rahrenbe Exp $
*/
#include "common.h"
#include "config.h"
#include "device.h"
#define IPTV_MAX_DEVICES 8
@ -22,7 +23,7 @@ cIptvDevice::cIptvDevice(unsigned int Index)
mutex()
{
debug("cIptvDevice::cIptvDevice(%d)\n", deviceIndex);
tsBuffer = new cRingBufferLinear(MEGABYTE(8), TS_SIZE * 2, false, "IPTV");
tsBuffer = new cRingBufferLinear(MEGABYTE(IptvConfig.GetBufferSizeMB()), TS_SIZE * 2, false, "IPTV");
//tsBuffer->SetTimeouts(100, 100);
pUdpProtocol = new cIptvProtocolUdp();
//pRtspProtocol = new cIptvProtocolRtsp();

12
iptv.c
View File

@ -3,12 +3,14 @@
*
* See the README file for copyright information and how to reach the author.
*
* $Id: iptv.c,v 1.2 2007/09/15 15:02:33 rahrenbe Exp $
* $Id: iptv.c,v 1.3 2007/09/15 15:38:38 rahrenbe Exp $
*/
#include <getopt.h>
#include <vdr/plugin.h>
#include "common.h"
#include "config.h"
#include "setup.h"
#include "device.h"
static const char *VERSION = "0.0.1";
@ -145,14 +147,18 @@ cMenuSetupPage *cPluginIptv::SetupMenu(void)
{
debug("cPluginIptv::SetupMenu()\n");
// Return a setup menu in case the plugin supports one.
return NULL;
return new cIptvPluginSetup();
}
bool cPluginIptv::SetupParse(const char *Name, const char *Value)
{
debug("cPluginIptv::SetupParse()\n");
// Parse your own setup parameters and store their values.
return false;
if (!strcasecmp(Name, "BufferSize"))
IptvConfig.SetBufferSizeMB(atoi(Value));
else
return false;
return true;
}
bool cPluginIptv::Service(const char *Id, void *Data)

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-08-12 23:22+0300\n"
"POT-Creation-Date: 2007-09-15 18:35+0300\n"
"PO-Revision-Date: 2007-08-12 23:22+0300\n"
"Last-Translator: Rolf Ahrenberg\n"
"Language-Team: <vdr@linuxtv.org>\n"
@ -15,6 +15,10 @@ msgstr ""
"Content-Type: text/plain; charset=ISO-8859-15\n"
"Content-Transfer-Encoding: 8bit\n"
#: iptv.c:15
#: iptv.c:17
msgid "Experiment the IPTV"
msgstr "Koe IPTV:n ihmeellinen maailma"
#: setup.c:23
msgid "Buffer size [MB]"
msgstr "Puskurin koko [MB]"

38
setup.c Normal file
View File

@ -0,0 +1,38 @@
/*
* setup.c: IPTV plugin for the Video Disk Recorder
*
* See the README file for copyright information and how to reach the author.
*
* $Id: setup.c,v 1.1 2007/09/15 15:38:38 rahrenbe Exp $
*/
#include "common.h"
#include "config.h"
#include "setup.h"
cIptvPluginSetup::cIptvPluginSetup(void)
{
bufferSize = IptvConfig.GetBufferSizeMB();
Setup();
}
void cIptvPluginSetup::Setup(void)
{
int current = Current();
Clear();
Add(new cMenuEditIntItem(tr("Buffer size [MB]"), &bufferSize, 0, 16));
SetCurrent(Get(current));
Display();
}
eOSState cIptvPluginSetup::ProcessKey(eKeys Key)
{
eOSState state = cMenuSetupPage::ProcessKey(Key);
return state;
}
void cIptvPluginSetup::Store(void)
{
SetupStore("BufferSize", bufferSize);
IptvConfig.SetBufferSizeMB(bufferSize);
}

28
setup.h Normal file
View File

@ -0,0 +1,28 @@
/*
* setup.h: IPTV plugin for the Video Disk Recorder
*
* See the README file for copyright information and how to reach the author.
*
* $Id: setup.h,v 1.1 2007/09/15 15:38:38 rahrenbe Exp $
*/
#ifndef __IPTV_SETUP_H
#define __IPTV_SETUP_H
#include <vdr/menuitems.h>
class cIptvPluginSetup : public cMenuSetupPage
{
private:
int bufferSize;
virtual void Setup(void);
protected:
virtual eOSState ProcessKey(eKeys Key);
virtual void Store(void);
public:
cIptvPluginSetup();
};
#endif // __IPTV_SETUP_H