diff options
author | Max Kellermann <max@duempel.org> | 2014-01-16 09:06:01 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-01-16 09:30:24 +0100 |
commit | a35c7bc81aec11e9720462d8258a0d3c41e2fac7 (patch) | |
tree | f9601aa14c2c12fcfa183d8da248c04f8f55a915 /src/db/upnp/ContentDirectoryService.cxx | |
parent | 02769929b31479bffa3e42c101a9bb192c07976f (diff) | |
download | mpd-a35c7bc81aec11e9720462d8258a0d3c41e2fac7.tar.gz mpd-a35c7bc81aec11e9720462d8258a0d3c41e2fac7.tar.xz mpd-a35c7bc81aec11e9720462d8258a0d3c41e2fac7.zip |
db/upnp: move the LibUPnP instance to class UpnpDatabase
Delete the object when closing the database.
Diffstat (limited to 'src/db/upnp/ContentDirectoryService.cxx')
-rw-r--r-- | src/db/upnp/ContentDirectoryService.cxx | 43 |
1 files changed, 11 insertions, 32 deletions
diff --git a/src/db/upnp/ContentDirectoryService.cxx b/src/db/upnp/ContentDirectoryService.cxx index b40f55c54..cb35f7a79 100644 --- a/src/db/upnp/ContentDirectoryService.cxx +++ b/src/db/upnp/ContentDirectoryService.cxx @@ -24,12 +24,10 @@ #include "ixmlwrap.hxx" #include "Directory.hxx" #include "Util.hxx" -#include "upnpplib.hxx" #include "util/Error.hxx" #include <stdio.h> -#include <upnp/upnp.h> #include <upnp/upnptools.h> ContentDirectoryService::ContentDirectoryService(const UPnPDevice &device, @@ -64,17 +62,12 @@ public: }; bool -ContentDirectoryService::readDirSlice(const char *objectId, int offset, +ContentDirectoryService::readDirSlice(UpnpClient_Handle hdl, + const char *objectId, int offset, int count, UPnPDirContent &dirbuf, int *didreadp, int *totalp, Error &error) { - LibUPnP *lib = LibUPnP::getLibUPnP(error); - if (lib == nullptr) - return false; - - UpnpClient_Handle hdl = lib->getclh(); - IXML_Document *request(0); IXML_Document *response(0); DirBResFree cleaner(&request, &response); @@ -132,7 +125,8 @@ ContentDirectoryService::readDirSlice(const char *objectId, int offset, } bool -ContentDirectoryService::readDir(const char *objectId, +ContentDirectoryService::readDir(UpnpClient_Handle handle, + const char *objectId, UPnPDirContent &dirbuf, Error &error) { @@ -141,7 +135,7 @@ ContentDirectoryService::readDir(const char *objectId, while (offset < total) { int count; - if (!readDirSlice(objectId, offset, m_rdreqcnt, dirbuf, + if (!readDirSlice(handle, objectId, offset, m_rdreqcnt, dirbuf, &count, &total, error)) return false; @@ -152,17 +146,12 @@ ContentDirectoryService::readDir(const char *objectId, } bool -ContentDirectoryService::search(const char *objectId, +ContentDirectoryService::search(UpnpClient_Handle hdl, + const char *objectId, const char *ss, UPnPDirContent &dirbuf, Error &error) { - LibUPnP *lib = LibUPnP::getLibUPnP(error); - if (lib == nullptr) - return false; - - UpnpClient_Handle hdl = lib->getclh(); - IXML_Document *request(0); IXML_Document *response(0); @@ -226,15 +215,10 @@ ContentDirectoryService::search(const char *objectId, } bool -ContentDirectoryService::getSearchCapabilities(std::set<std::string> &result, +ContentDirectoryService::getSearchCapabilities(UpnpClient_Handle hdl, + std::set<std::string> &result, Error &error) { - LibUPnP *lib = LibUPnP::getLibUPnP(error); - if (lib == nullptr) - return false; - - UpnpClient_Handle hdl = lib->getclh(); - IXML_Document *request(0); IXML_Document *response(0); @@ -272,16 +256,11 @@ ContentDirectoryService::getSearchCapabilities(std::set<std::string> &result, } bool -ContentDirectoryService::getMetadata(const char *objectId, +ContentDirectoryService::getMetadata(UpnpClient_Handle hdl, + const char *objectId, UPnPDirContent &dirbuf, Error &error) { - LibUPnP *lib = LibUPnP::getLibUPnP(error); - if (lib == nullptr) - return false; - - UpnpClient_Handle hdl = lib->getclh(); - IXML_Document *response(0); // Create request |