|
a/src/upmpdutils.hxx |
|
b/src/upmpdutils.hxx |
|
... |
|
... |
15 |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
15 |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
16 |
*/
|
16 |
*/
|
17 |
#ifndef _UPMPDUTILS_H_X_INCLUDED_
|
17 |
#ifndef _UPMPDUTILS_H_X_INCLUDED_
|
18 |
#define _UPMPDUTILS_H_X_INCLUDED_
|
18 |
#define _UPMPDUTILS_H_X_INCLUDED_
|
19 |
|
19 |
|
20 |
#include <sys/types.h> // for pid_t
|
20 |
#include <string>
|
|
|
21 |
#include <unordered_map>
|
|
|
22 |
#include <vector>
|
|
|
23 |
#include <unordered_set>
|
21 |
|
24 |
|
22 |
#include <string> // for string
|
25 |
#include "libupnpp/control/cdircontent.hxx"
|
23 |
#include <unordered_map> // for unordered_map
|
|
|
24 |
#include <vector> // for vector
|
|
|
25 |
|
26 |
|
26 |
class UpSong;
|
27 |
class UpSong;
|
27 |
|
28 |
|
28 |
// Convert between db value to percent values (Get/Set Volume and VolumeDb)
|
29 |
// Convert between db value to percent values (Get/Set Volume and VolumeDb)
|
29 |
extern int percentodbvalue(int value);
|
30 |
extern int percentodbvalue(int value);
|
|
... |
|
... |
40 |
// Format a didl fragment from MPD status data
|
41 |
// Format a didl fragment from MPD status data
|
41 |
extern std::string didlmake(const UpSong& song);
|
42 |
extern std::string didlmake(const UpSong& song);
|
42 |
|
43 |
|
43 |
// Convert UPnP metadata to UpSong for mpdcli to use
|
44 |
// Convert UPnP metadata to UpSong for mpdcli to use
|
44 |
extern bool uMetaToUpSong(const std::string&, UpSong *ups);
|
45 |
extern bool uMetaToUpSong(const std::string&, UpSong *ups);
|
|
|
46 |
// Convert UPnP content directory entry object to UpSong
|
|
|
47 |
bool dirObjToUpSong(const UPnPClient::UPnPDirObject& dobj, UpSong *ups);
|
|
|
48 |
|
|
|
49 |
// Extract the set of formats from protocolinfo data (comma separated
|
|
|
50 |
// list of 'proto:net:format:extradata' elements, e.g. http-get:*:audio/mpeg:*)
|
|
|
51 |
// All format strings are changed to lower case in the output set.
|
|
|
52 |
extern bool protocolInfoToFormats(const std::string& pinfo,
|
|
|
53 |
std::unordered_set<std::string>& formats);
|
|
|
54 |
|
|
|
55 |
// Extract content format from resource protocolinfo attribute. This
|
|
|
56 |
// should be made an UPnPResource method one day
|
|
|
57 |
std::string resourceContentFormat(const UPnPClient::UPnPResource& res);
|
|
|
58 |
|
45 |
|
59 |
|
46 |
// Replace the first occurrence of regexp. cxx11 regex does not work
|
60 |
// Replace the first occurrence of regexp. cxx11 regex does not work
|
47 |
// that well yet...
|
61 |
// that well yet...
|
48 |
extern std::string regsub1(const std::string& sexp, const std::string& input,
|
62 |
extern std::string regsub1(const std::string& sexp, const std::string& input,
|
49 |
const std::string& repl);
|
63 |
const std::string& repl);
|
50 |
|
64 |
|
51 |
// Return map with "newer" elements which differ from "old". Old may
|
65 |
// Return map with "newer" elements which differ from "old". Old may
|
52 |
// have fewer elts than "newer" (e.g. may be empty), we use the
|
66 |
// have fewer elts than "newer" (e.g. may be empty), we use the
|
53 |
// "newer" entries for diffing
|
67 |
// "newer" entries for diffing. This is used to compute state changes.
|
54 |
extern std::unordered_map<std::string, std::string>
|
68 |
extern std::unordered_map<std::string, std::string>
|
55 |
diffmaps(const std::unordered_map<std::string, std::string>& old,
|
69 |
diffmaps(const std::unordered_map<std::string, std::string>& old,
|
56 |
const std::unordered_map<std::string, std::string>& newer);
|
70 |
const std::unordered_map<std::string, std::string>& newer);
|
57 |
|
71 |
|
58 |
#endif /* _UPMPDUTILS_H_X_INCLUDED_ */
|
72 |
#endif /* _UPMPDUTILS_H_X_INCLUDED_ */
|