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:
parent
1a825f5636
commit
d8585ba0fc
4
HISTORY
4
HISTORY
@ -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
2
iptv.c
@ -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 {
|
||||
|
116
source.c
116
source.c
@ -49,63 +49,77 @@ cString cIptvTransponderParameters::ToString(char Type) const
|
||||
bool cIptvTransponderParameters::Parse(const char *s)
|
||||
{
|
||||
debug("cIptvTransponderParameters::Parse(): s=%s\n", s);
|
||||
bool result = false;
|
||||
|
||||
const char *delim = "|";
|
||||
char *str = (char *)s;
|
||||
char *saveptr = NULL;
|
||||
char *token = NULL;
|
||||
bool found_s = false;
|
||||
bool found_p = false;
|
||||
bool found_f = true;
|
||||
bool found_u = false;
|
||||
bool found_a = false;
|
||||
if (s && *s) {
|
||||
const char *delim = "|";
|
||||
char *str = strdup(s);
|
||||
char *saveptr = NULL;
|
||||
char *token = NULL;
|
||||
bool found_s = false;
|
||||
bool found_p = false;
|
||||
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;
|
||||
|
||||
if (data && (*data == '=')) {
|
||||
while ((token = strtok_r(str, delim, &saveptr)) != NULL) {
|
||||
char *data = token;
|
||||
++data;
|
||||
switch (*token) {
|
||||
case 'S':
|
||||
sidscan = (int)strtol(data, (char **)NULL, 10);
|
||||
found_s = true;
|
||||
break;
|
||||
case 'P':
|
||||
pidscan = (int)strtol(data, (char **)NULL, 10);
|
||||
found_p = true;
|
||||
break;
|
||||
case 'F':
|
||||
if (strstr(data, "UDP"))
|
||||
protocol = eProtocolUDP;
|
||||
else if (strstr(data, "HTTP"))
|
||||
protocol = eProtocolHTTP;
|
||||
else if (strstr(data, "FILE"))
|
||||
protocol = eProtocolFILE;
|
||||
else if (strstr(data, "EXT"))
|
||||
protocol = eProtocolEXT;
|
||||
else
|
||||
found_u = false;
|
||||
break;
|
||||
case 'U':
|
||||
strn0cpy(address, data, sizeof(address));
|
||||
found_u = true;
|
||||
break;
|
||||
case 'A':
|
||||
parameter = (int)strtol(data, (char **)NULL, 10);
|
||||
found_a = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (data && (*data == '=')) {
|
||||
++data;
|
||||
switch (*token) {
|
||||
case 'S':
|
||||
sidscan = (int)strtol(data, (char **)NULL, 10);
|
||||
found_s = true;
|
||||
break;
|
||||
case 'P':
|
||||
pidscan = (int)strtol(data, (char **)NULL, 10);
|
||||
found_p = true;
|
||||
break;
|
||||
case 'F':
|
||||
if (strstr(data, "UDP")) {
|
||||
protocol = eProtocolUDP;
|
||||
found_f = true;
|
||||
}
|
||||
else if (strstr(data, "HTTP")) {
|
||||
protocol = eProtocolHTTP;
|
||||
found_f = true;
|
||||
}
|
||||
else if (strstr(data, "FILE")) {
|
||||
protocol = eProtocolFILE;
|
||||
found_f = true;
|
||||
}
|
||||
else if (strstr(data, "EXT")) {
|
||||
protocol = eProtocolEXT;
|
||||
found_f = true;
|
||||
}
|
||||
break;
|
||||
case 'U':
|
||||
strn0cpy(address, data, sizeof(address));
|
||||
found_u = true;
|
||||
break;
|
||||
case 'A':
|
||||
parameter = (int)strtol(data, (char **)NULL, 10);
|
||||
found_a = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
str = NULL;
|
||||
}
|
||||
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 ------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user