Switch to unified view

a/src/mediaserver/cdplugins/cdplugin.hxx b/src/mediaserver/cdplugins/cdplugin.hxx
...
...
21
#include "upmpdutils.hxx"
21
#include "upmpdutils.hxx"
22
#include "libupnpp/device/vdir.hxx"
22
#include "libupnpp/device/vdir.hxx"
23
23
24
class CDPluginServices;
24
class CDPluginServices;
25
25
26
/// Interface to media server modules
26
/// Interface to Content Directory plugins
27
///
27
///
28
/// The main operations, Browse and Search, return content as UpSong
28
/// The main operations, Browse and Search, return content as UpSong
29
/// structures. At the very minimum, id, parentid, iscontainer and
29
/// structures. At the very minimum, id, parentid, iscontainer and
30
/// title should be properly set for each entry. Id is very important for
30
/// title should be properly set for each entry. Id is very important for
31
/// directories (containers), because this is the main parameter to
31
/// directories (containers), because this is the main parameter to
...
...
34
///
34
///
35
/// The rest of the UpSong fields are only meaningful for items
35
/// The rest of the UpSong fields are only meaningful for items
36
/// (tracks), and only one is mandatory: uri.
36
/// (tracks), and only one is mandatory: uri.
37
///
37
///
38
/// The item uri will be used by the renderer for fetching the data to
38
/// The item uri will be used by the renderer for fetching the data to
39
/// be played. Three types can be used:
39
/// be played. All current implementations set URIs which point either
40
/// - A direct URL, usable by the renderer for fetching the data from
40
/// to themselves (uprcl, the implementation for local files, uses a
41
///   wherever it is (for example a radio stream HTTP URL).
41
/// Python server to stream the files), or to a microhttpd instance
42
/// - A vdir URL: this should have a host/port part matching the media
42
/// running inside upmpdcli, with code responsible for either
43
///   server host/port (which can be obtained through the environment
43
/// redirecting the client or proxying the data.
44
///   interface). Data will be fetched by libupnp using the vdir
45
///   interface. This is simple but limited: the libupnp HTTP server
46
///   does not emit "accept-range" headers, meaning that most CPs will
47
///   not try range requests, and that seeking will not work. No
48
///   redirects are possible. The URL path part should begin with the
49
///   pathprefix, which is how the request will be routed to the
50
///   appropriate plugin.
51
/// - A libmicrohttpd URL. A plugin may start a microhttpd instance,
52
///   and receive the connections directly. The host/port will be
53
///   obtained from the configuration. The advantage is that redirects
54
///   and range requests are possible, but it is a bit more
55
///   complicated as some libmicrohttpd knowledge is required.
56
class CDPlugin {
44
class CDPlugin {
57
public:
45
public:
58
    CDPlugin(const std::string& name, CDPluginServices *services)
46
    CDPlugin(const std::string& name, CDPluginServices *services)
59
        : m_name(name), m_services(services) {
47
        : m_name(name), m_services(services) {
60
    }
48
    }
...
...
112
100
113
    std::string m_name;
101
    std::string m_name;
114
    CDPluginServices *m_services;
102
    CDPluginServices *m_services;
115
};
103
};
116
104
117
/// Service/Environment interface for media server modules
105
/// Service/Environment interface for media server modules. This is
106
/// implemented by the ContentDirectory class.
118
class CDPluginServices {
107
class CDPluginServices {
119
public:
108
public:
120
    /// Returns the plugin to which belongs the parameter path, based
109
    /// Returns the plugin to which belongs the parameter path, based
121
    /// on the path prefix above.
110
    /// on the path prefix above.
122
    virtual CDPlugin *getpluginforpath(const std::string& path) = 0;
111
    virtual CDPlugin *getpluginforpath(const std::string& path) = 0;
...
...
144
    /// libupnp HTTP server nor microhttpd, but an internal Python
133
    /// libupnp HTTP server nor microhttpd, but an internal Python
145
    /// server instance, on port 9090 by default (can be changed with
134
    /// server instance, on port 9090 by default (can be changed with
146
    /// the "uprclhostport" configuration variable).
135
    /// the "uprclhostport" configuration variable).
147
    virtual std::string getupnpaddr(CDPlugin *) = 0;
136
    virtual std::string getupnpaddr(CDPlugin *) = 0;
148
    virtual int getupnpport(CDPlugin *) = 0;
137
    virtual int getupnpport(CDPlugin *) = 0;
149
    /// Add a virtual directory and set file operation interface. path
150
    /// must be equal or begin with the pathprefix. Not used at all at present.
151
    virtual bool setfileops(CDPlugin *, const std::string& path,
152
                            UPnPProvider::VirtualDir::FileOps ops)= 0;
153
138
154
    /// Main configuration file access.
139
    /// Main configuration file access.
155
    static bool config_get(const std::string& nm, std::string& val);
140
    static bool config_get(const std::string& nm, std::string& val);
156
141
157
    /// Port to start the microhttp server on
142
    /// Port to start the microhttp server on