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

Bug and style fixes.

This commit is contained in:
Antti Seppälä 2008-01-04 23:36:37 +00:00
parent 28d1869a28
commit 4915630cfc
19 changed files with 88 additions and 76 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: common.c,v 1.8 2007/10/26 23:18:50 rahrenbe Exp $ * $Id: common.c,v 1.9 2008/01/04 23:36:37 ajhseppa Exp $
*/ */
#include <vdr/tools.h> #include <vdr/tools.h>
@ -23,7 +23,7 @@ uint8_t payload(const uint8_t *tsp)
if (tsp[4] > 183) // corrupted data? if (tsp[4] > 183) // corrupted data?
return 0; return 0;
else else
return 184 - 1 - tsp[4]; return (184 - 1) - tsp[4];
} }
return 184; return 184;

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: common.h,v 1.18 2007/10/28 16:22:44 rahrenbe Exp $ * $Id: common.h,v 1.19 2008/01/04 23:36:37 ajhseppa Exp $
*/ */
#ifndef __IPTV_COMMON_H #ifndef __IPTV_COMMON_H
@ -63,6 +63,8 @@
} \ } \
} while (0) } while (0)
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
uint16_t ts_pid(const uint8_t *buf); uint16_t ts_pid(const uint8_t *buf);
uint8_t payload(const uint8_t *tsp); uint8_t payload(const uint8_t *tsp);
const char *id_pid(const u_short Pid); const char *id_pid(const u_short Pid);

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.18 2007/10/20 17:26:46 rahrenbe Exp $ * $Id: config.c,v 1.19 2008/01/04 23:36:37 ajhseppa Exp $
*/ */
#include "config.h" #include "config.h"
@ -19,27 +19,27 @@ cIptvConfig::cIptvConfig(void)
sectionFiltering(1), sectionFiltering(1),
sidScanning(1) sidScanning(1)
{ {
for (unsigned int i = 0; i < sizeof(disabledFilters); ++i) for (unsigned int i = 0; i < ARRAY_SIZE(disabledFilters) - 1; ++i)
disabledFilters[i] = -1; disabledFilters[i] = -1;
memset(configDirectory, '\0', sizeof(configDirectory)); memset(configDirectory, '\0', sizeof(configDirectory));
} }
unsigned int cIptvConfig::GetDisabledFiltersCount(void) unsigned int cIptvConfig::GetDisabledFiltersCount(void) const
{ {
unsigned int n = 0; unsigned int n = 0;
while ((disabledFilters[n] != -1) && (n < sizeof(disabledFilters))) while ((disabledFilters[n] != -1) && (n < ARRAY_SIZE(disabledFilters) - 1))
n++; n++;
return n; return n;
} }
int cIptvConfig::GetDisabledFilters(unsigned int Index) int cIptvConfig::GetDisabledFilters(unsigned int Index) const
{ {
return (Index < sizeof(disabledFilters)) ? disabledFilters[Index] : -1; return (Index < ARRAY_SIZE(disabledFilters)) ? disabledFilters[Index] : -1;
} }
void cIptvConfig::SetDisabledFilters(unsigned int Index, int Number) void cIptvConfig::SetDisabledFilters(unsigned int Index, int Number)
{ {
if (Index < sizeof(disabledFilters)) if (Index < ARRAY_SIZE(disabledFilters))
disabledFilters[Index] = Number; disabledFilters[Index] = Number;
} }

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.17 2007/10/28 16:22:44 rahrenbe Exp $ * $Id: config.h,v 1.18 2008/01/04 23:36:37 ajhseppa Exp $
*/ */
#ifndef __IPTV_CONFIG_H #ifndef __IPTV_CONFIG_H
@ -27,16 +27,16 @@ private:
public: public:
cIptvConfig(); cIptvConfig();
unsigned int GetReadBufferTsCount(void) { return readBufferTsCount; } unsigned int GetReadBufferTsCount(void) const { return readBufferTsCount; }
unsigned int GetTsBufferSize(void) { return tsBufferSize; } unsigned int GetTsBufferSize(void) const { return tsBufferSize; }
unsigned int GetTsBufferPrefillRatio(void) { return tsBufferPrefillRatio; } unsigned int GetTsBufferPrefillRatio(void) const { return tsBufferPrefillRatio; }
unsigned int GetExtProtocolBasePort(void) { return extProtocolBasePort; } unsigned int GetExtProtocolBasePort(void) const { return extProtocolBasePort; }
unsigned int GetUseBytes(void) { return useBytes; } unsigned int GetUseBytes(void) const { return useBytes; }
unsigned int GetSectionFiltering(void) { return sectionFiltering; } unsigned int GetSectionFiltering(void) const { return sectionFiltering; }
unsigned int GetSidScanning(void) { return sidScanning; } unsigned int GetSidScanning(void) const { return sidScanning; }
const char *GetConfigDirectory(void) { return configDirectory; } const char *GetConfigDirectory(void) const { return configDirectory; }
unsigned int GetDisabledFiltersCount(void); unsigned int GetDisabledFiltersCount(void) const;
int GetDisabledFilters(unsigned int Index); int GetDisabledFilters(unsigned int Index) const;
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 SetExtProtocolBasePort(unsigned int PortNumber) { extProtocolBasePort = PortNumber; } void SetExtProtocolBasePort(unsigned int PortNumber) { extProtocolBasePort = PortNumber; }

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.76 2007/10/26 23:48:30 rahrenbe Exp $ * $Id: device.c,v 1.77 2008/01/04 23:36:37 ajhseppa Exp $
*/ */
#include "config.h" #include "config.h"
@ -33,7 +33,7 @@ cIptvDevice::cIptvDevice(unsigned int Index)
pExtProtocol = new cIptvProtocolExt(); pExtProtocol = new cIptvProtocolExt();
pIptvStreamer = new cIptvStreamer(tsBuffer, &mutex); pIptvStreamer = new cIptvStreamer(tsBuffer, &mutex);
// Initialize filter pointers // Initialize filter pointers
memset(&secfilters, '\0', sizeof(secfilters)); memset(secfilters, '\0', sizeof(secfilters));
// Start section handler for iptv device // Start section handler for iptv device
StartSectionHandler(); StartSectionHandler();
// Sid scanner must be created after the section handler // Sid scanner must be created after the section handler
@ -320,7 +320,8 @@ void cIptvDevice::CloseDvr(void)
debug("cIptvDevice::CloseDvr(%d)\n", deviceIndex); debug("cIptvDevice::CloseDvr(%d)\n", deviceIndex);
if (pSidScanner && IptvConfig.GetSectionFiltering() && IptvConfig.GetSidScanning()) if (pSidScanner && IptvConfig.GetSectionFiltering() && IptvConfig.GetSidScanning())
pSidScanner->SetStatus(false); pSidScanner->SetStatus(false);
pIptvStreamer->Close(); if (pIptvStreamer)
pIptvStreamer->Close();
isOpenDvr = false; isOpenDvr = false;
} }

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.h,v 1.34 2007/10/19 21:36:28 rahrenbe Exp $ * $Id: device.h,v 1.35 2008/01/04 23:36:37 ajhseppa Exp $
*/ */
#ifndef __IPTV_DEVICE_H #ifndef __IPTV_DEVICE_H
@ -53,8 +53,12 @@ public:
virtual ~cIptvDevice(); virtual ~cIptvDevice();
cString GetInformation(unsigned int Page = IPTV_DEVICE_INFO_ALL); cString GetInformation(unsigned int Page = IPTV_DEVICE_INFO_ALL);
// for statistics and general information // copy and assignment constructors
private: private:
cIptvDevice(const cIptvDevice&);
cIptvDevice& operator=(const cIptvDevice&);
// for statistics and general information
cString GetGeneralInformation(void); cString GetGeneralInformation(void);
cString GetPidsInformation(void); cString GetPidsInformation(void);
cString GetFiltersInformation(void); cString GetFiltersInformation(void);

7
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.29 2007/11/04 17:07:25 rahrenbe Exp $ * $Id: iptv.c,v 1.30 2008/01/04 23:36:37 ajhseppa Exp $
*/ */
#include <getopt.h> #include <getopt.h>
@ -193,7 +193,10 @@ bool cPluginIptv::SetupParse(const char *Name, const char *Value)
else if (!strcasecmp(Name, "SidScanning")) else if (!strcasecmp(Name, "SidScanning"))
IptvConfig.SetSidScanning(atoi(Value)); IptvConfig.SetSidScanning(atoi(Value));
else if (!strcasecmp(Name, "DisabledFilters")) { else if (!strcasecmp(Name, "DisabledFilters")) {
int DisabledFilters[SECTION_FILTER_TABLE_SIZE] = { -1 }; int DisabledFilters[SECTION_FILTER_TABLE_SIZE];
for (unsigned int i = 0; i < ARRAY_SIZE(DisabledFilters); ++i) {
DisabledFilters[i] = -1;
}
int DisabledFiltersCount = ParseFilters(Value, DisabledFilters); int DisabledFiltersCount = ParseFilters(Value, DisabledFilters);
for (int i = 0; i < DisabledFiltersCount; ++i) for (int i = 0; i < DisabledFiltersCount; ++i)
IptvConfig.SetDisabledFilters(i, DisabledFilters[i]); IptvConfig.SetDisabledFilters(i, DisabledFilters[i]);

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: protocolext.c,v 1.20 2007/10/21 19:32:14 ajhseppa Exp $ * $Id: protocolext.c,v 1.21 2008/01/04 23:36:37 ajhseppa Exp $
*/ */
#include <sys/wait.h> #include <sys/wait.h>
@ -33,7 +33,7 @@ cIptvProtocolExt::~cIptvProtocolExt()
{ {
debug("cIptvProtocolExt::~cIptvProtocolExt()\n"); debug("cIptvProtocolExt::~cIptvProtocolExt()\n");
// Drop the socket connection // Drop the socket connection
Close(); cIptvProtocolExt::Close();
// Free allocated memory // Free allocated memory
free(scriptFile); free(scriptFile);
free(listenAddr); free(listenAddr);

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: protocolext.h,v 1.8 2007/10/21 17:32:43 ajhseppa Exp $ * $Id: protocolext.h,v 1.9 2008/01/04 23:36:37 ajhseppa Exp $
*/ */
#ifndef __IPTV_PROTOCOLEXT_H #ifndef __IPTV_PROTOCOLEXT_H
@ -28,10 +28,10 @@ public:
cIptvProtocolExt(); cIptvProtocolExt();
virtual ~cIptvProtocolExt(); virtual ~cIptvProtocolExt();
int Read(unsigned char* *BufferAddr); int Read(unsigned char* *BufferAddr);
virtual bool Set(const char* Location, const int Parameter, const int Index); bool Set(const char* Location, const int Parameter, const int Index);
virtual bool Open(void); bool Open(void);
virtual bool Close(void); bool Close(void);
virtual cString GetInformation(void); cString GetInformation(void);
}; };
#endif // __IPTV_PROTOCOLEXT_H #endif // __IPTV_PROTOCOLEXT_H

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.14 2007/10/20 23:25:14 ajhseppa Exp $ * $Id: protocolfile.c,v 1.15 2008/01/04 23:36:37 ajhseppa Exp $
*/ */
#include <fcntl.h> #include <fcntl.h>
@ -32,7 +32,7 @@ cIptvProtocolFile::~cIptvProtocolFile()
{ {
debug("cIptvProtocolFile::~cIptvProtocolFile()\n"); debug("cIptvProtocolFile::~cIptvProtocolFile()\n");
// Drop open handles // Drop open handles
Close(); cIptvProtocolFile::Close();
// Free allocated memory // Free allocated memory
free(fileLocation); free(fileLocation);
free(readBuffer); free(readBuffer);

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.h,v 1.7 2007/10/19 22:18:55 rahrenbe Exp $ * $Id: protocolfile.h,v 1.8 2008/01/04 23:36:37 ajhseppa Exp $
*/ */
#ifndef __IPTV_PROTOCOLFILE_H #ifndef __IPTV_PROTOCOLFILE_H
@ -28,11 +28,11 @@ private:
public: public:
cIptvProtocolFile(); cIptvProtocolFile();
virtual ~cIptvProtocolFile(); virtual ~cIptvProtocolFile();
virtual int Read(unsigned char* *BufferAddr); int Read(unsigned char* *BufferAddr);
virtual bool Set(const char* Location, const int Parameter, const int Index); bool Set(const char* Location, const int Parameter, const int Index);
virtual bool Open(void); bool Open(void);
virtual bool Close(void); bool Close(void);
virtual cString GetInformation(void); cString GetInformation(void);
}; };
#endif // __IPTV_PROTOCOLFILE_H #endif // __IPTV_PROTOCOLFILE_H

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: protocolhttp.c,v 1.21 2007/10/21 19:46:03 rahrenbe Exp $ * $Id: protocolhttp.c,v 1.22 2008/01/04 23:36:37 ajhseppa Exp $
*/ */
#include <sys/types.h> #include <sys/types.h>
@ -30,7 +30,7 @@ cIptvProtocolHttp::~cIptvProtocolHttp()
{ {
debug("cIptvProtocolHttp::~cIptvProtocolHttp()\n"); debug("cIptvProtocolHttp::~cIptvProtocolHttp()\n");
// Close the socket // Close the socket
Close(); cIptvProtocolHttp::Close();
// Free allocated memory // Free allocated memory
free(streamPath); free(streamPath);
free(streamAddr); free(streamAddr);

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: protocolhttp.h,v 1.11 2007/10/21 17:32:43 ajhseppa Exp $ * $Id: protocolhttp.h,v 1.12 2008/01/04 23:36:37 ajhseppa Exp $
*/ */
#ifndef __IPTV_PROTOCOLHTTP_H #ifndef __IPTV_PROTOCOLHTTP_H
@ -29,10 +29,10 @@ public:
cIptvProtocolHttp(); cIptvProtocolHttp();
virtual ~cIptvProtocolHttp(); virtual ~cIptvProtocolHttp();
int Read(unsigned char* *BufferAddr); int Read(unsigned char* *BufferAddr);
virtual bool Set(const char* Location, const int Parameter, const int Index); bool Set(const char* Location, const int Parameter, const int Index);
virtual bool Open(void); bool Open(void);
virtual bool Close(void); bool Close(void);
virtual cString GetInformation(void); cString GetInformation(void);
}; };
#endif // __IPTV_PROTOCOLHTTP_H #endif // __IPTV_PROTOCOLHTTP_H

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: protocoludp.c,v 1.21 2007/10/21 19:32:15 ajhseppa Exp $ * $Id: protocoludp.c,v 1.22 2008/01/04 23:36:37 ajhseppa Exp $
*/ */
#include <sys/types.h> #include <sys/types.h>
@ -29,7 +29,7 @@ cIptvProtocolUdp::~cIptvProtocolUdp()
{ {
debug("cIptvProtocolUdp::~cIptvProtocolUdp()\n"); debug("cIptvProtocolUdp::~cIptvProtocolUdp()\n");
// Drop the multicast group and close the socket // Drop the multicast group and close the socket
Close(); cIptvProtocolUdp::Close();
// Free allocated memory // Free allocated memory
free(streamAddr); free(streamAddr);
} }

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: protocoludp.h,v 1.12 2007/10/21 17:32:43 ajhseppa Exp $ * $Id: protocoludp.h,v 1.13 2008/01/04 23:36:37 ajhseppa Exp $
*/ */
#ifndef __IPTV_PROTOCOLUDP_H #ifndef __IPTV_PROTOCOLUDP_H
@ -25,10 +25,10 @@ public:
cIptvProtocolUdp(); cIptvProtocolUdp();
virtual ~cIptvProtocolUdp(); virtual ~cIptvProtocolUdp();
int Read(unsigned char* *BufferAddr); int Read(unsigned char* *BufferAddr);
virtual bool Set(const char* Location, const int Parameter, const int Index); bool Set(const char* Location, const int Parameter, const int Index);
virtual bool Open(void); bool Open(void);
virtual bool Close(void); bool Close(void);
virtual cString GetInformation(void); cString GetInformation(void);
}; };
#endif // __IPTV_PROTOCOLUDP_H #endif // __IPTV_PROTOCOLUDP_H

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: sectionfilter.c,v 1.15 2007/10/20 23:25:14 ajhseppa Exp $ * $Id: sectionfilter.c,v 1.16 2008/01/04 23:36:37 ajhseppa Exp $
*/ */
#include "sectionfilter.h" #include "sectionfilter.h"
@ -283,7 +283,7 @@ void cIptvSectionFilter::ProcessData(const uint8_t* buf)
const uint8_t *before = &buf[p + 1]; const uint8_t *before = &buf[p + 1];
uint8_t before_len = buf[p]; uint8_t before_len = buf[p];
const uint8_t *after = &before[before_len]; const uint8_t *after = &before[before_len];
uint8_t after_len = count - 1 - before_len; uint8_t after_len = (count - 1) - before_len;
demux_swfilter_section_copy_dump(before, before_len); demux_swfilter_section_copy_dump(before, before_len);
/* before start of new section, set pusi_seen = 1 */ /* before start of new section, set pusi_seen = 1 */

20
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.44 2007/11/04 15:23:16 rahrenbe Exp $ * $Id: setup.c,v 1.45 2008/01/04 23:36:37 ajhseppa Exp $
*/ */
#include <string.h> #include <string.h>
@ -73,7 +73,7 @@ cString cIptvMenuEditChannel::GetIptvSettings(const char *Param, int *Parameter,
char *tag = NULL; char *tag = NULL;
char *proto = NULL; char *proto = NULL;
char *loc = NULL; char *loc = NULL;
if (sscanf(Param, "%a[^|]|%a[^|]|%a[^|]|%u", &tag, &proto, &loc, Parameter) == 4) { if (sscanf(Param, "%a[^|]|%a[^|]|%a[^|]|%d", &tag, &proto, &loc, Parameter) == 4) {
cString tagstr(tag, true); cString tagstr(tag, true);
cString protostr(proto, true); cString protostr(proto, true);
cString locstr(loc, true); cString locstr(loc, true);
@ -106,13 +106,13 @@ void cIptvMenuEditChannel::GetChannelData(cChannel *Channel)
data.vpid = Channel->Vpid(); data.vpid = Channel->Vpid();
data.ppid = Channel->Ppid(); data.ppid = Channel->Ppid();
data.tpid = Channel->Tpid(); data.tpid = Channel->Tpid();
for (unsigned int i = 0; i < sizeof(data.apid); ++i) for (unsigned int i = 0; i < ARRAY_SIZE(data.apid); ++i)
data.apid[i] = Channel->Apid(i); data.apid[i] = Channel->Apid(i);
for (unsigned int i = 0; i < sizeof(data.dpid); ++i) for (unsigned int i = 0; i < ARRAY_SIZE(data.dpid); ++i)
data.dpid[i] = Channel->Dpid(i); data.dpid[i] = Channel->Dpid(i);
for (unsigned int i = 0; i < sizeof(data.spid); ++i) for (unsigned int i = 0; i < ARRAY_SIZE(data.spid); ++i)
data.spid[i] = Channel->Spid(i); data.spid[i] = Channel->Spid(i);
for (unsigned int i = 0; i < sizeof(data.caids); ++i) for (unsigned int i = 0; i < ARRAY_SIZE(data.caids); ++i)
data.caids[i] = Channel->Ca(i); data.caids[i] = Channel->Ca(i);
data.sid = Channel->Sid(); data.sid = Channel->Sid();
data.nid = Channel->Nid(); data.nid = Channel->Nid();
@ -129,13 +129,13 @@ void cIptvMenuEditChannel::GetChannelData(cChannel *Channel)
data.vpid = 0; data.vpid = 0;
data.ppid = 0; data.ppid = 0;
data.tpid = 0; data.tpid = 0;
for (unsigned int i = 0; i < sizeof(data.apid); ++i) for (unsigned int i = 0; i < ARRAY_SIZE(data.apid); ++i)
data.apid[i] = 0; data.apid[i] = 0;
for (unsigned int i = 0; i < sizeof(data.dpid); ++i) for (unsigned int i = 0; i < ARRAY_SIZE(data.dpid); ++i)
data.dpid[i] = 0; data.dpid[i] = 0;
for (unsigned int i = 0; i < sizeof(data.spid); ++i) for (unsigned int i = 0; i < ARRAY_SIZE(data.spid); ++i)
data.spid[i] = 0; data.spid[i] = 0;
for (unsigned int i = 0; i < sizeof(data.caids); ++i) for (unsigned int i = 0; i < ARRAY_SIZE(data.caids); ++i)
data.caids[i] = 0; data.caids[i] = 0;
data.sid = 1; data.sid = 1;
data.nid = 0; data.nid = 0;

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: statistics.c,v 1.20 2007/10/11 23:06:49 rahrenbe Exp $ * $Id: statistics.c,v 1.21 2008/01/04 23:36:37 ajhseppa Exp $
*/ */
#include <limits.h> #include <limits.h>
@ -84,7 +84,7 @@ cString cIptvPidStatistics::GetStatistic()
IptvConfig.GetUseBytes() ? "B" : "bit"); IptvConfig.GetUseBytes() ? "B" : "bit");
} }
} }
memset(&mostActivePids, '\0', sizeof(mostActivePids)); memset(mostActivePids, '\0', sizeof(mostActivePids));
return info; return info;
} }
@ -110,7 +110,7 @@ void cIptvPidStatistics::AddStatistic(u_short Pid, long Payload)
if (mostActivePids[i].pid == Pid) { if (mostActivePids[i].pid == Pid) {
mostActivePids[i].DataAmount += Payload; mostActivePids[i].DataAmount += Payload;
// Now re-sort the array and quit // Now re-sort the array and quit
qsort(&mostActivePids, numberOfElements, sizeof(pidStruct), SortPids); qsort(mostActivePids, numberOfElements, sizeof(pidStruct), SortPids);
return; return;
} }
} }

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: streamer.c,v 1.27 2007/10/20 08:58:15 ajhseppa Exp $ * $Id: streamer.c,v 1.28 2008/01/04 23:36:37 ajhseppa Exp $
*/ */
#include <vdr/thread.h> #include <vdr/thread.h>
@ -76,11 +76,13 @@ bool cIptvStreamer::Close(void)
// Close the protocol. A mutex should be taken here to avoid a race condition // Close the protocol. A mutex should be taken here to avoid a race condition
// where thread Action() may be in the process of accessing the protocol. // where thread Action() may be in the process of accessing the protocol.
// Taking a mutex serializes the Close() and Action() -calls. // Taking a mutex serializes the Close() and Action() -calls.
if (protocol) { if (mutex)
mutex->Lock(); mutex->Lock();
if (protocol)
protocol->Close(); protocol->Close();
if (mutex)
mutex->Unlock(); mutex->Unlock();
}
return true; return true;
} }