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

Fixed channel parameter corruption.

This commit is contained in:
Rolf Ahrenberg 2010-03-08 21:12:06 +02:00
parent 1a825f5636
commit d8585ba0fc
3 changed files with 70 additions and 52 deletions

View File

@ -132,3 +132,7 @@ VDR Plugin 'iptv' Revision History
- Updated for vdr-1.7.13.
- Fixed argument corruption.
2010-03-08: Version 0.4.1
- Fixed channel parameter corruption.

2
iptv.c
View File

@ -16,7 +16,7 @@
#error "VDR-1.7.13 API version or greater is required!"
#endif
static const char VERSION[] = "0.4.0";
static const char VERSION[] = "0.4.1";
static const char DESCRIPTION[] = trNOOP("Experience the IPTV");
class cPluginIptv : public cPlugin {

View File

@ -49,20 +49,22 @@ cString cIptvTransponderParameters::ToString(char Type) const
bool cIptvTransponderParameters::Parse(const char *s)
{
debug("cIptvTransponderParameters::Parse(): s=%s\n", s);
bool result = false;
if (s && *s) {
const char *delim = "|";
char *str = (char *)s;
char *str = strdup(s);
char *saveptr = NULL;
char *token = NULL;
bool found_s = false;
bool found_p = false;
bool found_f = true;
bool found_f = false;
bool found_u = false;
bool found_a = false;
while ((token = (char *)strtok_r(str, delim, &saveptr)) != NULL) {
char *data = token + 1;
while ((token = strtok_r(str, delim, &saveptr)) != NULL) {
char *data = token;
++data;
if (data && (*data == '=')) {
++data;
switch (*token) {
@ -75,16 +77,22 @@ bool cIptvTransponderParameters::Parse(const char *s)
found_p = true;
break;
case 'F':
if (strstr(data, "UDP"))
if (strstr(data, "UDP")) {
protocol = eProtocolUDP;
else if (strstr(data, "HTTP"))
found_f = true;
}
else if (strstr(data, "HTTP")) {
protocol = eProtocolHTTP;
else if (strstr(data, "FILE"))
found_f = true;
}
else if (strstr(data, "FILE")) {
protocol = eProtocolFILE;
else if (strstr(data, "EXT"))
found_f = true;
}
else if (strstr(data, "EXT")) {
protocol = eProtocolEXT;
else
found_u = false;
found_f = true;
}
break;
case 'U':
strn0cpy(address, data, sizeof(address));
@ -101,11 +109,17 @@ bool cIptvTransponderParameters::Parse(const char *s)
str = NULL;
}
if (found_s && found_p && found_f && found_u && found_a)
return (true);
free(str);
error("Invalid channel parameters: %s\n", s);
return (false);
if (found_s && found_p && found_f && found_u && found_a)
result = true;
else
error("Invalid channel parameters: %s\n", str);
}
else
error("No channel parameters\n");
return (result);
}
// --- cIptvSourceParam ------------------------------------------------------