Added ringbuffer tweaks and some debug outputs.

This commit is contained in:
Rolf Ahrenberg 2007-09-15 15:02:33 +00:00
parent 84f9c59d67
commit 543f9974be
2 changed files with 22 additions and 6 deletions

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: device.c,v 1.11 2007/09/14 21:36:05 rahrenbe Exp $ * $Id: device.c,v 1.12 2007/09/15 15:02:33 rahrenbe Exp $
*/ */
#include "common.h" #include "common.h"
@ -22,8 +22,8 @@ cIptvDevice::cIptvDevice(unsigned int Index)
mutex() mutex()
{ {
debug("cIptvDevice::cIptvDevice(%d)\n", deviceIndex); debug("cIptvDevice::cIptvDevice(%d)\n", deviceIndex);
tsBuffer = new cRingBufferLinear(MEGABYTE(8), TS_SIZE, false, "IPTV"); tsBuffer = new cRingBufferLinear(MEGABYTE(8), TS_SIZE * 2, false, "IPTV");
tsBuffer->SetTimeouts(100, 100); //tsBuffer->SetTimeouts(100, 100);
pUdpProtocol = new cIptvProtocolUdp(); pUdpProtocol = new cIptvProtocolUdp();
//pRtspProtocol = new cIptvProtocolRtsp(); //pRtspProtocol = new cIptvProtocolRtsp();
//pHttpProtocol = new cIptvProtocolHttp(); //pHttpProtocol = new cIptvProtocolHttp();
@ -128,7 +128,7 @@ bool cIptvDevice::SetChannelDevice(const cChannel *Channel, bool LiveView)
debug("cIptvDevice::SetChannelDevice(%d)\n", deviceIndex); debug("cIptvDevice::SetChannelDevice(%d)\n", deviceIndex);
addr = GetChannelSettings(Channel->Param(), &port, &protocol); addr = GetChannelSettings(Channel->Param(), &port, &protocol);
if (isempty(addr)) { if (isempty(addr)) {
error("ERROR: Unrecognized IPTV channel settings: %d", Channel->Param()); error("ERROR: Unrecognized IPTV channel settings: %s", Channel->Param());
return false; return false;
} }
pIptvStreamer->Set(addr, port, protocol); pIptvStreamer->Set(addr, port, protocol);

20
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.1 2007/09/12 17:28:59 rahrenbe Exp $ * $Id: iptv.c,v 1.2 2007/09/15 15:02:33 rahrenbe Exp $
*/ */
#include <getopt.h> #include <getopt.h>
@ -44,6 +44,7 @@ public:
cPluginIptv::cPluginIptv(void) cPluginIptv::cPluginIptv(void)
: deviceCount(1) : deviceCount(1)
{ {
//debug("cPluginIptv::cPluginIptv()\n");
// Initialize any member variables here. // Initialize any member variables here.
// DON'T DO ANYTHING ELSE THAT MAY HAVE SIDE EFFECTS, REQUIRE GLOBAL // DON'T DO ANYTHING ELSE THAT MAY HAVE SIDE EFFECTS, REQUIRE GLOBAL
// VDR OBJECTS TO EXIST OR PRODUCE ANY OUTPUT! // VDR OBJECTS TO EXIST OR PRODUCE ANY OUTPUT!
@ -51,11 +52,13 @@ cPluginIptv::cPluginIptv(void)
cPluginIptv::~cPluginIptv() cPluginIptv::~cPluginIptv()
{ {
//debug("cPluginIptv::~cPluginIptv()\n");
// Clean up after yourself! // Clean up after yourself!
} }
const char *cPluginIptv::CommandLineHelp(void) const char *cPluginIptv::CommandLineHelp(void)
{ {
debug("cPluginIptv::CommandLineHelp()\n");
// Return a string that describes all known command line options. // Return a string that describes all known command line options.
return cString::sprintf( return cString::sprintf(
" -d <number> --devices=<number> number of devices to be created (default: %d)\n", " -d <number> --devices=<number> number of devices to be created (default: %d)\n",
@ -64,6 +67,7 @@ const char *cPluginIptv::CommandLineHelp(void)
bool cPluginIptv::ProcessArgs(int argc, char *argv[]) bool cPluginIptv::ProcessArgs(int argc, char *argv[])
{ {
debug("cPluginIptv::ProcessArgs()\n");
// Implement command line argument processing here if applicable. // Implement command line argument processing here if applicable.
static const struct option long_options[] = { static const struct option long_options[] = {
{ "devices", required_argument, NULL, 'd' }, { "devices", required_argument, NULL, 'd' },
@ -85,79 +89,91 @@ bool cPluginIptv::ProcessArgs(int argc, char *argv[])
bool cPluginIptv::Initialize(void) bool cPluginIptv::Initialize(void)
{ {
debug("cPluginIptv::Initialize()\n");
// Initialize any background activities the plugin shall perform. // Initialize any background activities the plugin shall perform.
return cIptvDevice::Initialize(deviceCount); return cIptvDevice::Initialize(deviceCount);
} }
bool cPluginIptv::Start(void) bool cPluginIptv::Start(void)
{ {
debug("cPluginIptv::Start()\n");
// Start any background activities the plugin shall perform. // Start any background activities the plugin shall perform.
return true; return true;
} }
void cPluginIptv::Stop(void) void cPluginIptv::Stop(void)
{ {
debug("cPluginIptv::Stop()\n");
// Stop any background activities the plugin is performing. // Stop any background activities the plugin is performing.
} }
void cPluginIptv::Housekeeping(void) void cPluginIptv::Housekeeping(void)
{ {
//debug("cPluginIptv::Housekeeping()\n");
// Perform any cleanup or other regular tasks. // Perform any cleanup or other regular tasks.
} }
void cPluginIptv::MainThreadHook(void) void cPluginIptv::MainThreadHook(void)
{ {
//debug("cPluginIptv::MainThreadHook()\n");
// Perform actions in the context of the main program thread. // Perform actions in the context of the main program thread.
// WARNING: Use with great care - see PLUGINS.html! // WARNING: Use with great care - see PLUGINS.html!
} }
cString cPluginIptv::Active(void) cString cPluginIptv::Active(void)
{ {
//debug("cPluginIptv::Active()\n");
// Return a message string if shutdown should be postponed // Return a message string if shutdown should be postponed
return NULL; return NULL;
} }
time_t cPluginIptv::WakeupTime(void) time_t cPluginIptv::WakeupTime(void)
{ {
//debug("cPluginIptv::WakeupTime()\n");
// Return custom wakeup time for shutdown script // Return custom wakeup time for shutdown script
return 0; return 0;
} }
cOsdObject *cPluginIptv::MainMenuAction(void) cOsdObject *cPluginIptv::MainMenuAction(void)
{ {
//debug("cPluginIptv::MainMenuAction()\n");
// Perform the action when selected from the main VDR menu. // Perform the action when selected from the main VDR menu.
return NULL; return NULL;
} }
cMenuSetupPage *cPluginIptv::SetupMenu(void) cMenuSetupPage *cPluginIptv::SetupMenu(void)
{ {
debug("cPluginIptv::SetupMenu()\n");
// Return a setup menu in case the plugin supports one. // Return a setup menu in case the plugin supports one.
return NULL; return NULL;
} }
bool cPluginIptv::SetupParse(const char *Name, const char *Value) bool cPluginIptv::SetupParse(const char *Name, const char *Value)
{ {
debug("cPluginIptv::SetupParse()\n");
// Parse your own setup parameters and store their values. // Parse your own setup parameters and store their values.
return false; return false;
} }
bool cPluginIptv::Service(const char *Id, void *Data) bool cPluginIptv::Service(const char *Id, void *Data)
{ {
//debug("cPluginIptv::Service()\n");
// Handle custom service requests from other plugins // Handle custom service requests from other plugins
return false; return false;
} }
const char **cPluginIptv::SVDRPHelpPages(void) const char **cPluginIptv::SVDRPHelpPages(void)
{ {
//debug("cPluginIptv::SVDRPHelpPages()\n");
// Return help text for SVDRP commands this plugin implements // Return help text for SVDRP commands this plugin implements
return NULL; return NULL;
} }
cString cPluginIptv::SVDRPCommand(const char *Command, const char *Option, int &ReplyCode) cString cPluginIptv::SVDRPCommand(const char *Command, const char *Option, int &ReplyCode)
{ {
//debug("cPluginIptv::SVDRPCommand()\n");
// Process SVDRP commands this plugin implements // Process SVDRP commands this plugin implements
return NULL; return NULL;
} }
VDRPLUGINCREATOR(cPluginIptv); // Don't touch this! VDRPLUGINCREATOR(cPluginIptv); // Don't touch this!