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. - Updated for vdr-1.7.13.
- Fixed argument corruption. - 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!" #error "VDR-1.7.13 API version or greater is required!"
#endif #endif
static const char VERSION[] = "0.4.0"; static const char VERSION[] = "0.4.1";
static const char DESCRIPTION[] = trNOOP("Experience the IPTV"); static const char DESCRIPTION[] = trNOOP("Experience the IPTV");
class cPluginIptv : public cPlugin { class cPluginIptv : public cPlugin {

View File

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