From c507f373ff7a8d24ac4e0c47be20de679f9647d9 Mon Sep 17 00:00:00 2001 From: Rolf Ahrenberg Date: Wed, 2 Apr 2008 22:55:04 +0000 Subject: [PATCH] Fixed channels.conf format used in vlc2iptv. Disabled retuning feature and added some minor corrections. --- HISTORY | 1 + device.c | 6 +++--- iptv/vlc2iptv | 2 +- pidscanner.c | 20 ++++++++++---------- protocolhttp.c | 5 ++--- streamer.c | 17 ++++++++++++----- 6 files changed, 29 insertions(+), 22 deletions(-) diff --git a/HISTORY b/HISTORY index dbb393b..b335320 100644 --- a/HISTORY +++ b/HISTORY @@ -61,3 +61,4 @@ VDR Plugin 'iptv' Revision History - Updated Italian translation (Thanks to Diego Pierotto). - Removed compatibility mode for old channels.conf format. - EXT protocol is re-tuned only if iptv parameters differ. +- Updated vlc2iptv script for new channels.conf format. diff --git a/device.c b/device.c index f507298..4d40932 100644 --- a/device.c +++ b/device.c @@ -3,7 +3,7 @@ * * See the README file for copyright information and how to reach the author. * - * $Id: device.c,v 1.86 2008/04/02 20:22:48 rahrenbe Exp $ + * $Id: device.c,v 1.87 2008/04/02 22:55:04 rahrenbe Exp $ */ #include "config.h" @@ -371,7 +371,7 @@ bool cIptvDevice::OpenDvr(void) void cIptvDevice::CloseDvr(void) { debug("cIptvDevice::CloseDvr(%d)\n", deviceIndex); - if (pidScanEnabled && pSidScanner && IptvConfig.GetSectionFiltering()) + if (sidScanEnabled && pSidScanner && IptvConfig.GetSectionFiltering()) pSidScanner->SetStatus(false); if (pIptvStreamer) pIptvStreamer->Close(); @@ -436,7 +436,7 @@ bool cIptvDevice::GetTSPacket(uchar *&Data) write(dvrFd, p, TS_SIZE); // Analyze incomplete streams with built-in pid analyzer if (pidScanEnabled && pPidScanner) - pPidScanner->Process(p); + pPidScanner->Process(p); // Run the data through all filters for (unsigned int i = 0; i < eMaxSecFilterCount; ++i) { if (secfilters[i]) diff --git a/iptv/vlc2iptv b/iptv/vlc2iptv index ee69895..f168947 100755 --- a/iptv/vlc2iptv +++ b/iptv/vlc2iptv @@ -52,7 +52,7 @@ lookup_channel_and_pids() [ ! -e "$CHANNELS_CONF" ] && \ exit_with_error "channels.conf not found ($CHANNELS_CONF)" - local CHANNEL_RECORD=`grep ":IPTV|EXT|vlc2iptv|$PARAMETER:" $CHANNELS_CONF` + local CHANNEL_RECORD=`grep "[:]IPTV[|][SP][10][SP][10][|]EXT[|]vlc2iptv[|]$PARAMETER[:]" $CHANNELS_CONF` [ -z "$CHANNEL_RECORD" ] && \ exit_with_error "no iptv channel with parameter $PARAMETER found" diff --git a/pidscanner.c b/pidscanner.c index ff09653..a56265b 100644 --- a/pidscanner.c +++ b/pidscanner.c @@ -3,14 +3,14 @@ * * See the README file for copyright information and how to reach the author. * - * $Id: pidscanner.c,v 1.6 2008/02/02 21:06:14 rahrenbe Exp $ + * $Id: pidscanner.c,v 1.7 2008/04/02 22:55:04 rahrenbe Exp $ */ #include "common.h" #include "pidscanner.h" #define PIDSCANNER_TIMEOUT_IN_MS 15000 /* 15s timeout for detection */ -#define PIDSCANNER_APID_COUNT 5 /* minimum count of audio pid samples for pid detection */ +#define PIDSCANNER_APID_COUNT 10 /* minimum count of audio pid samples for pid detection */ #define PIDSCANNER_VPID_COUNT 10 /* minimum count of video pid samples for pid detection */ #define PIDSCANNER_PID_DELTA_COUNT 50 /* minimum count of pid samples for audio/video only pid detection */ @@ -92,29 +92,29 @@ void cPidScanner::Process(const uint8_t* buf) // Stream ID if ((sid >= 0xC0) && (sid <= 0xDF)) { if (pid < Apid) { - debug("Found lower Apid: 0x%X instead of 0x%X\n", pid, Apid); + debug("cPidScanner::Process: Found lower Apid: 0x%X instead of 0x%X\n", pid, Apid); Apid = pid; numApids = 1; } else if (pid == Apid) { ++numApids; - debug("Incrementing Apids, now at %d\n", numApids); + debug("cPidScanner::Process: Incrementing Apids, now at %d\n", numApids); } } else if ((sid >= 0xE0) && (sid <= 0xEF)) { if (pid < Vpid) { - debug("Found lower Vpid: 0x%X instead of 0x%X\n", pid, Vpid); + debug("cPidScanner::Process: Found lower Vpid: 0x%X instead of 0x%X\n", pid, Vpid); Vpid = pid; numVpids = 1; } else if (pid == Vpid) { ++numVpids; - debug("Incrementing Vpids, now at %d\n", numVpids); + debug("cPidScanner::Process: Incrementing Vpids, now at %d\n", numVpids); } } } - if (((numVpids > PIDSCANNER_VPID_COUNT) && (numApids > PIDSCANNER_APID_COUNT)) || - (abs(numApids - numVpids) > PIDSCANNER_PID_DELTA_COUNT)) { + if (((numVpids >= PIDSCANNER_VPID_COUNT) && (numApids >= PIDSCANNER_APID_COUNT)) || + (abs(numApids - numVpids) >= PIDSCANNER_PID_DELTA_COUNT)) { // Lock channels for pid updates if (!Channels.Lock(true, 10)) { timeout.Set(PIDSCANNER_TIMEOUT_IN_MS); @@ -130,9 +130,9 @@ void cPidScanner::Process(const uint8_t* buf) int Ppid = IptvChannel->Ppid(); int Tpid = IptvChannel->Tpid(); bool foundApid = false; - if (numVpids <= PIDSCANNER_VPID_COUNT) + if (numVpids < PIDSCANNER_VPID_COUNT) Vpid = 0; // No detected video pid - else if (numApids <= PIDSCANNER_APID_COUNT) + else if (numApids < PIDSCANNER_APID_COUNT) Apid = 0; // No detected audio pid for (unsigned int i = 1; i < MAXAPIDS; ++i) { Apids[i] = IptvChannel->Apid(i); diff --git a/protocolhttp.c b/protocolhttp.c index 2218908..3a756bd 100644 --- a/protocolhttp.c +++ b/protocolhttp.c @@ -3,7 +3,7 @@ * * See the README file for copyright information and how to reach the author. * - * $Id: protocolhttp.c,v 1.24 2008/02/17 19:18:47 rahrenbe Exp $ + * $Id: protocolhttp.c,v 1.25 2008/04/02 22:55:04 rahrenbe Exp $ */ #include @@ -34,7 +34,6 @@ cIptvProtocolHttp::~cIptvProtocolHttp() // Free allocated memory free(streamPath); free(streamAddr); - } bool cIptvProtocolHttp::Connect(void) @@ -237,7 +236,7 @@ bool cIptvProtocolHttp::Set(const char* Location, const int Parameter, const int else streamPath = strcpyrealloc(streamPath, "/"); socketPort = Parameter; - debug("http://%s:%d%s\n", streamAddr, socketPort, streamPath); + //debug("http://%s:%d%s\n", streamAddr, socketPort, streamPath); // Re-connect the socket Connect(); } diff --git a/streamer.c b/streamer.c index d6976af..ef7b034 100644 --- a/streamer.c +++ b/streamer.c @@ -3,7 +3,7 @@ * * See the README file for copyright information and how to reach the author. * - * $Id: streamer.c,v 1.31 2008/04/02 20:22:48 rahrenbe Exp $ + * $Id: streamer.c,v 1.32 2008/04/02 22:55:04 rahrenbe Exp $ */ #include @@ -17,7 +17,7 @@ cIptvStreamer::cIptvStreamer(cRingBufferLinear* RingBuffer, cMutex* Mutex) ringBuffer(RingBuffer), mutex(Mutex), protocol(NULL), - location(NULL), + location(""), parameter(-1), index(-1) { @@ -84,6 +84,11 @@ bool cIptvStreamer::Close(void) protocol->Close(); if (mutex) mutex->Unlock(); + // reset stream variables + protocol = NULL; + location = cString(""); + parameter = -1; + index = -1; return true; } @@ -92,9 +97,11 @@ bool cIptvStreamer::Set(const char* Location, const int Parameter, const int Ind { debug("cIptvStreamer::Set(): %s:%d\n", Location, Parameter); if (!isempty(Location)) { - // - if (!strcmp(*location, Location) && (parameter == Parameter) && (index == Index) && (protocol == Protocol)) - return false; + // Check if (re)tune is needed + //if ((strcmp(*location, Location) == 0) && (parameter == Parameter) && (index == Index) && (protocol == Protocol)) { + // debug("cIptvStreamer::Set(): (Re)tune skipped\n"); + // return false; + // } // Update protocol; Close the existing one if changed if (protocol != Protocol) { if (protocol)