release v0.20.12

-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCAAuFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAloZt0YQHG1heEBtdXNp
 Y3BkLm9yZwAKCRAjbopYxttFElF7D/9DIkK8ArcrqtGvLQFseOucf0FPmAD7csoq
 oDN4TL8UGUSYxcSt3wQqt6rp5JyWAFTuXPpneytqkZ0tW04y4kkvmIrRkYzuBLgt
 yupg1G5fRmidwcqdnb6LqgSdW66pY3U6keaED7LVnMrJbd5MM8R7FejiZFoWmD4C
 c9pUU79MbeRk0w2F9Ws0bkd+yU7lUiolcqOg2VK25MZnObI7qf+/fIKOVK0Q9Q2W
 AdHLHNliySYPBT/po5YN+VAWPcxSFHXkfN552x0N/U1D/klPLmP1q724frFT+DRQ
 vXC5ojDDmSc+uUGr8D5IESfzMOPFj5ag0SqPSNe7Cp5amcy/chNqmo/XKEGqtB+X
 BI/DfRHEPGz5wtz6x+AcxFdE6LBAjMpQ2H3ybxGDK1396dNsngAA/g8eyvnzie/2
 USQO10O9Ymhezt7lMqhMLxJC/5Q0JLsKRIgqCxABQfTh14JF+c5bkT3zetabA87r
 CSyHGr3+tN4KtSJwefGjaGTCy5lN1SB8bRgWVLVVpPYAvtsNS1LwwTyeI3AtYmxr
 fylkATAHawSXzdgxgzFA8GmscxaxO/gLud+9ekb33ZIq9bnXiOXpY5u98bxCPWkn
 JgzeC4E6xnI3Ft+Ss7Bu0zOgSl2jUiOV7zAy7z8Lo9Qv6QYuIvSi9m+Snxstkul0
 9QwG6bA+YA==
 =BUsZ
 -----END PGP SIGNATURE-----

Merge tag 'v0.20.12'

release v0.20.12
This commit is contained in:
Max Kellermann 2017-11-25 19:46:07 +01:00
commit 2b3c1d640e
7 changed files with 103 additions and 20 deletions

View File

@ -245,6 +245,7 @@ CURL_SOURCES = \
src/lib/curl/Slist.hxx src/lib/curl/Slist.hxx
UPNP_SOURCES = \ UPNP_SOURCES = \
src/lib/upnp/Compat.hxx \
src/lib/upnp/Init.cxx src/lib/upnp/Init.hxx \ src/lib/upnp/Init.cxx src/lib/upnp/Init.hxx \
src/lib/upnp/ClientInit.cxx src/lib/upnp/ClientInit.hxx \ src/lib/upnp/ClientInit.cxx src/lib/upnp/ClientInit.hxx \
src/lib/upnp/Device.cxx src/lib/upnp/Device.hxx \ src/lib/upnp/Device.cxx src/lib/upnp/Device.hxx \

4
NEWS
View File

@ -15,7 +15,9 @@ ver 0.21 (not yet released)
* mixer * mixer
- sndio: new mixer plugin - sndio: new mixer plugin
ver 0.20.12 (not yet released) ver 0.20.12 (2017/11/25)
* database
- upnp: adapt to libupnp 1.8 API changes
* input * input
- cdio_paranoia, ffmpeg, file, smbclient: reduce lock contention, - cdio_paranoia, ffmpeg, file, smbclient: reduce lock contention,
fixing lots of xrun problems fixing lots of xrun problems

View File

@ -40,7 +40,7 @@ public:
return *(UpnpCallback *)cookie; return *(UpnpCallback *)cookie;
} }
virtual int Invoke(Upnp_EventType et, void *evp) noexcept = 0; virtual int Invoke(Upnp_EventType et, const void *evp) noexcept = 0;
}; };
#endif #endif

View File

@ -33,7 +33,12 @@ static unsigned upnp_client_ref;
static UpnpClient_Handle upnp_client_handle; static UpnpClient_Handle upnp_client_handle;
static int static int
UpnpClientCallback(Upnp_EventType et, void *evp, void *cookie) noexcept UpnpClientCallback(Upnp_EventType et,
#if UPNP_VERSION >= 10800
const
#endif
void *evp,
void *cookie) noexcept
{ {
if (cookie == nullptr) if (cookie == nullptr)
/* this is the cookie passed to UpnpRegisterClient(); /* this is the cookie passed to UpnpRegisterClient();

69
src/lib/upnp/Compat.hxx Normal file
View File

@ -0,0 +1,69 @@
/*
* Copyright 2003-2017 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPD_UPNP_COMPAT_HXX
#define MPD_UPNP_COMPAT_HXX
#include <upnp/upnp.h>
#if UPNP_VERSION < 10800
#include "Compiler.h"
/* emulate the libupnp 1.8 API with older versions */
using UpnpDiscovery = Upnp_Discovery;
gcc_pure
static inline int
UpnpDiscovery_get_Expires(const UpnpDiscovery *disco) noexcept
{
return disco->Expires;
}
gcc_pure
static inline const char *
UpnpDiscovery_get_DeviceID_cstr(const UpnpDiscovery *disco) noexcept
{
return disco->DeviceId;
}
gcc_pure
static inline const char *
UpnpDiscovery_get_DeviceType_cstr(const UpnpDiscovery *disco) noexcept
{
return disco->DeviceType;
}
gcc_pure
static inline const char *
UpnpDiscovery_get_ServiceType_cstr(const UpnpDiscovery *disco) noexcept
{
return disco->ServiceType;
}
gcc_pure
static inline const char *
UpnpDiscovery_get_Location_cstr(const UpnpDiscovery *disco) noexcept
{
return disco->Location;
}
#endif
#endif

View File

@ -33,12 +33,13 @@
#include <string.h> #include <string.h>
UPnPDeviceDirectory::Downloader::Downloader(UPnPDeviceDirectory &_parent, UPnPDeviceDirectory::Downloader::Downloader(UPnPDeviceDirectory &_parent,
const Upnp_Discovery &disco) const UpnpDiscovery &disco)
:defer_start_event(_parent.GetEventLoop(), :defer_start_event(_parent.GetEventLoop(),
BIND_THIS_METHOD(OnDeferredStart)), BIND_THIS_METHOD(OnDeferredStart)),
parent(_parent), parent(_parent),
id(disco.DeviceId), url(disco.Location), id(UpnpDiscovery_get_DeviceID_cstr(&disco)),
expires(std::chrono::seconds(disco.Expires)), url(UpnpDiscovery_get_Location_cstr(&disco)),
expires(std::chrono::seconds(UpnpDiscovery_get_Expires(&disco))),
request(*parent.curl, url.c_str(), *this) request(*parent.curl, url.c_str(), *this)
{ {
parent.downloaders.push_back(*this); parent.downloaders.push_back(*this);
@ -170,10 +171,10 @@ UPnPDeviceDirectory::LockRemove(const std::string &id)
} }
inline int inline int
UPnPDeviceDirectory::OnAlive(Upnp_Discovery *disco) noexcept UPnPDeviceDirectory::OnAlive(const UpnpDiscovery *disco) noexcept
{ {
if (isMSDevice(disco->DeviceType) || if (isMSDevice(UpnpDiscovery_get_DeviceType_cstr(disco)) ||
isCDService(disco->ServiceType)) { isCDService(UpnpDiscovery_get_ServiceType_cstr(disco))) {
try { try {
auto *downloader = new Downloader(*this, *disco); auto *downloader = new Downloader(*this, *disco);
@ -196,12 +197,12 @@ UPnPDeviceDirectory::OnAlive(Upnp_Discovery *disco) noexcept
} }
inline int inline int
UPnPDeviceDirectory::OnByeBye(Upnp_Discovery *disco) noexcept UPnPDeviceDirectory::OnByeBye(const UpnpDiscovery *disco) noexcept
{ {
if (isMSDevice(disco->DeviceType) || if (isMSDevice(UpnpDiscovery_get_DeviceType_cstr(disco)) ||
isCDService(disco->ServiceType)) { isCDService(UpnpDiscovery_get_ServiceType_cstr(disco))) {
// Device signals it is going off. // Device signals it is going off.
LockRemove(disco->DeviceId); LockRemove(UpnpDiscovery_get_DeviceID_cstr(disco));
} }
return UPNP_E_SUCCESS; return UPNP_E_SUCCESS;
@ -212,19 +213,19 @@ UPnPDeviceDirectory::OnByeBye(Upnp_Discovery *disco) noexcept
// Example: ContentDirectories appearing and disappearing from the network // Example: ContentDirectories appearing and disappearing from the network
// We queue a task for our worker thread(s) // We queue a task for our worker thread(s)
int int
UPnPDeviceDirectory::Invoke(Upnp_EventType et, void *evp) noexcept UPnPDeviceDirectory::Invoke(Upnp_EventType et, const void *evp) noexcept
{ {
switch (et) { switch (et) {
case UPNP_DISCOVERY_SEARCH_RESULT: case UPNP_DISCOVERY_SEARCH_RESULT:
case UPNP_DISCOVERY_ADVERTISEMENT_ALIVE: case UPNP_DISCOVERY_ADVERTISEMENT_ALIVE:
{ {
Upnp_Discovery *disco = (Upnp_Discovery *)evp; auto *disco = (const UpnpDiscovery *)evp;
return OnAlive(disco); return OnAlive(disco);
} }
case UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE: case UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE:
{ {
Upnp_Discovery *disco = (Upnp_Discovery *)evp; auto *disco = (const UpnpDiscovery *)evp;
return OnByeBye(disco); return OnByeBye(disco);
} }

View File

@ -20,6 +20,7 @@
#ifndef _UPNPPDISC_H_X_INCLUDED_ #ifndef _UPNPPDISC_H_X_INCLUDED_
#define _UPNPPDISC_H_X_INCLUDED_ #define _UPNPPDISC_H_X_INCLUDED_
#include "Compat.hxx"
#include "Callback.hxx" #include "Callback.hxx"
#include "Device.hxx" #include "Device.hxx"
#include "lib/curl/Init.hxx" #include "lib/curl/Init.hxx"
@ -39,6 +40,10 @@
#include <memory> #include <memory>
#include <chrono> #include <chrono>
#if UPNP_VERSION < 10800
#define UpnpDiscovery Upnp_Discovery
#endif
class ContentDirectoryService; class ContentDirectoryService;
class UPnPDiscoveryListener { class UPnPDiscoveryListener {
@ -100,7 +105,7 @@ class UPnPDeviceDirectory final : UpnpCallback {
public: public:
Downloader(UPnPDeviceDirectory &_parent, Downloader(UPnPDeviceDirectory &_parent,
const Upnp_Discovery &disco); const UpnpDiscovery &disco);
void Start() noexcept { void Start() noexcept {
defer_start_event.Schedule(); defer_start_event.Schedule();
@ -184,11 +189,11 @@ private:
void LockAdd(ContentDirectoryDescriptor &&d); void LockAdd(ContentDirectoryDescriptor &&d);
void LockRemove(const std::string &id); void LockRemove(const std::string &id);
int OnAlive(Upnp_Discovery *disco) noexcept; int OnAlive(const UpnpDiscovery *disco) noexcept;
int OnByeBye(Upnp_Discovery *disco) noexcept; int OnByeBye(const UpnpDiscovery *disco) noexcept;
/* virtual methods from class UpnpCallback */ /* virtual methods from class UpnpCallback */
int Invoke(Upnp_EventType et, void *evp) noexcept override; int Invoke(Upnp_EventType et, const void *evp) noexcept override;
}; };