X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=blobdiff_plain;f=lib%2Fservice%2Fservice.cpp;h=77bfda99517d31eeddba4e35d43216ff30b5d3c8;hp=7721fed7adaaeffb4282d40699918db8064aa412;hb=418bb7f62c7a102f16dfd6a509680b6921486a6c;hpb=47367fb1c159557cb3676f67172b9839531c8dc9 diff --git a/lib/service/service.cpp b/lib/service/service.cpp old mode 100644 new mode 100755 index 7721fed..77bfda9 --- a/lib/service/service.cpp +++ b/lib/service/service.cpp @@ -41,8 +41,8 @@ static std::string decode(const std::string s) i += 2; if (i >= len) break; - char s[3] = {s[i - 1], s[i], 0}; - unsigned char r = strtoul(s, 0, 0x10); + char t[3] = {s[i - 1], s[i], 0}; + unsigned char r = strtoul(t, 0, 0x10); if (r) res += r; } @@ -65,17 +65,37 @@ eServiceReference::eServiceReference(const std::string &string) if ( sscanf(c, "%d:%d:%x:%x:%x:%x:%n", &type, &flags, &data[0], &data[1], &data[2], &data[3], &pathl) < 2 ) type = idInvalid; } - if (pathl) { const char *pathstr = c+pathl; - const char *namestr = strchr(pathstr, ':'); + const char *namestr = NULL; + int found = strlen(pathstr)-1; + for(;found >= 0;found--) + { + if(pathstr[found] == ':') + break; + } + if (found != -1) + namestr = pathstr + found; if (namestr) { - if (pathstr != namestr) - path.assign(pathstr, namestr-pathstr); - if (*(namestr+1)) - name=namestr+1; + if (!strncmp(namestr, "://", 3)) // The path is a url (e.g. "http://...") + { + namestr = strchr(namestr, ' '); + if (namestr) + { + path.assign(pathstr, namestr - pathstr); + if (*(namestr + 1)) + name = namestr + 1; + } + } + else + { + if (pathstr != namestr) + path.assign(pathstr, namestr-pathstr); + if (*(namestr+1)) + name=namestr+1; + } } else path=pathstr; @@ -201,6 +221,25 @@ RESULT eServiceCenter::removeServiceFactory(int id) return 0; } +RESULT eServiceCenter::addFactoryExtension(int id, const char *extension) +{ + std::map >::iterator it = extensions.find(id); + if (it == extensions.end()) + return -1; + it->second.push_back(extension); + return 0; +} + +RESULT eServiceCenter::removeFactoryExtension(int id, const char *extension) +{ + std::map >::iterator it = extensions.find(id); + if (it == extensions.end()) + return -1; + it->second.remove(extension); + return 0; +} + + int eServiceCenter::getServiceTypeForExtension(const char *str) { for (std::map >::iterator sit(extensions.begin()); sit != extensions.end(); ++sit) @@ -239,7 +278,7 @@ int iStaticServiceInformation::getLength(const eServiceReference &ref) return -1; } -int iStaticServiceInformation::isPlayable(const eServiceReference &ref, const eServiceReference &ignore) +int iStaticServiceInformation::isPlayable(const eServiceReference &ref, const eServiceReference &ignore, bool simulate) { return 0; }