diff options
author | methodus <methodus@web.de> | 2012-09-26 00:45:33 +0200 |
---|---|---|
committer | methodus <methodus@web.de> | 2012-09-26 00:45:33 +0200 |
commit | 4cd5debf236f4d4315cce30c4cd11e392f00886a (patch) | |
tree | 5235f9cf3dceb44453ba31c1f1644aed5cd9b6d8 /media | |
parent | 4ff5f1b52b27d7b86d77ce956d79a1453810385b (diff) | |
download | vdr-plugin-upnp-4cd5debf236f4d4315cce30c4cd11e392f00886a.tar.gz vdr-plugin-upnp-4cd5debf236f4d4315cce30c4cd11e392f00886a.tar.bz2 |
Added streamer interface which connects the webserver with the resource provider.
Diffstat (limited to 'media')
-rw-r--r-- | media/mediaManager.cpp | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/media/mediaManager.cpp b/media/mediaManager.cpp index 38e623d..33fafbd 100644 --- a/media/mediaManager.cpp +++ b/media/mediaManager.cpp @@ -32,6 +32,67 @@ static const char* Details = "details"; } +cResourceStreamer::cResourceStreamer(cMediaManager* manager, cUPnPResourceProvider* provider, cMetadata::Resource* resource) +: provider(provider) +, resource(resource) +, manager(manager) +{ + if(resource) + tools::StringExplode(resource->protocolInfo,"*",protocolInfo); +} + +std::string cResourceStreamer::GetContentFeatures() const { + if(resource == NULL) return string(); + + return protocolInfo[3]; +} + +std::string cResourceStreamer::GetContentType() const { + if(resource == NULL) return string(); + + return protocolInfo[2]; +} + +size_t cResourceStreamer::GetContentLength() const { + if(resource == NULL) return 0; + + return resource->GetSize(); +} + +std::string cResourceStreamer::GetTransferMode(const string&) const { + std::string mime = GetContentType(); + + if(mime.empty()) return mime; + + if(mime.find("video",0) == 0 || mime.find("audio",0) == 0) return "Streaming"; + else return "Interactive"; +} + +std::string cResourceStreamer::GetRange() const { + return string(); +} + +std::string cResourceStreamer::GetAvailableSeekRange(const string& seekRequest) const { + return string(); +} + +bool cResourceStreamer::Open(string uri){ + return provider->Open(uri); +} + +size_t cResourceStreamer::Read(char* buf, size_t bufLen){ + return provider->Read(buf, bufLen); +} + +bool cResourceStreamer::Seek(size_t offset, int origin){ + return provider->Seek(offset, origin); +} + +void cResourceStreamer::Close(){ + provider->Close(); +} + + cMediaManager::cMediaManager() : mSystemUpdateID(0) , mDatabaseFile("metadata.db") |