upnp/discovery: use a plain UpnpClient_Handle instead of class LibUPnP
This commit is contained in:
parent
bcc1f93370
commit
e57e89b9d5
@ -182,7 +182,7 @@ UpnpDatabase::Open(Error &error)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
discovery = new UPnPDeviceDirectory(lib);
|
discovery = new UPnPDeviceDirectory(lib->getclh());
|
||||||
if (!discovery->Start(error)) {
|
if (!discovery->Start(error)) {
|
||||||
delete discovery;
|
delete discovery;
|
||||||
delete lib;
|
delete lib;
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
#include "Discovery.hxx"
|
#include "Discovery.hxx"
|
||||||
#include "Domain.hxx"
|
#include "Domain.hxx"
|
||||||
#include "ContentDirectoryService.hxx"
|
#include "ContentDirectoryService.hxx"
|
||||||
#include "upnpplib.hxx"
|
|
||||||
#include "system/Clock.hxx"
|
#include "system/Clock.hxx"
|
||||||
#include "Log.hxx"
|
#include "Log.hxx"
|
||||||
|
|
||||||
@ -232,9 +231,9 @@ UPnPDeviceDirectory::expireDevices(Error &error)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
UPnPDeviceDirectory::UPnPDeviceDirectory(LibUPnP *_lib,
|
UPnPDeviceDirectory::UPnPDeviceDirectory(UpnpClient_Handle _handle,
|
||||||
UPnPDiscoveryListener *_listener)
|
UPnPDiscoveryListener *_listener)
|
||||||
:lib(_lib),
|
:handle(_handle),
|
||||||
listener(_listener),
|
listener(_listener),
|
||||||
discoveredQueue("DiscoveredQueue"),
|
discoveredQueue("DiscoveredQueue"),
|
||||||
m_searchTimeout(2), m_lastSearch(0)
|
m_searchTimeout(2), m_lastSearch(0)
|
||||||
@ -266,7 +265,7 @@ UPnPDeviceDirectory::search(Error &error)
|
|||||||
m_lastSearch = now;
|
m_lastSearch = now;
|
||||||
|
|
||||||
// We search both for device and service just in case.
|
// We search both for device and service just in case.
|
||||||
int code = UpnpSearchAsync(lib->getclh(), m_searchTimeout,
|
int code = UpnpSearchAsync(handle, m_searchTimeout,
|
||||||
ContentDirectorySType, GetUpnpCookie());
|
ContentDirectorySType, GetUpnpCookie());
|
||||||
if (code != UPNP_E_SUCCESS) {
|
if (code != UPNP_E_SUCCESS) {
|
||||||
error.Format(upnp_domain, code,
|
error.Format(upnp_domain, code,
|
||||||
@ -275,7 +274,7 @@ UPnPDeviceDirectory::search(Error &error)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
code = UpnpSearchAsync(lib->getclh(), m_searchTimeout,
|
code = UpnpSearchAsync(handle, m_searchTimeout,
|
||||||
MediaServerDType, GetUpnpCookie());
|
MediaServerDType, GetUpnpCookie());
|
||||||
if (code != UPNP_E_SUCCESS) {
|
if (code != UPNP_E_SUCCESS) {
|
||||||
error.Format(upnp_domain, code,
|
error.Format(upnp_domain, code,
|
||||||
|
@ -32,7 +32,6 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
class LibUPnP;
|
|
||||||
class ContentDirectoryService;
|
class ContentDirectoryService;
|
||||||
|
|
||||||
class UPnPDiscoveryListener {
|
class UPnPDiscoveryListener {
|
||||||
@ -92,7 +91,7 @@ class UPnPDeviceDirectory final : UpnpCallback {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
LibUPnP *const lib;
|
const UpnpClient_Handle handle;
|
||||||
UPnPDiscoveryListener *const listener;
|
UPnPDiscoveryListener *const listener;
|
||||||
|
|
||||||
Mutex mutex;
|
Mutex mutex;
|
||||||
@ -112,7 +111,7 @@ class UPnPDeviceDirectory final : UpnpCallback {
|
|||||||
unsigned m_lastSearch;
|
unsigned m_lastSearch;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
UPnPDeviceDirectory(LibUPnP *_lib,
|
UPnPDeviceDirectory(UpnpClient_Handle _handle,
|
||||||
UPnPDiscoveryListener *_listener=nullptr);
|
UPnPDiscoveryListener *_listener=nullptr);
|
||||||
~UPnPDeviceDirectory();
|
~UPnPDeviceDirectory();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user