Merge pull request #25959 from neo1973/TagLib_deprecation_warnings
[xbmc.git] / lib / libUPnP / Platinum / Source / Devices / MediaServer / PltMediaBrowser.h
blob2484dcc2b75c138b7914ef0a5e80b82064570c65
1 /*****************************************************************
3 | Platinum - AV Media Browser (Media Server Control Point)
5 | Copyright (c) 2004-2010, Plutinosoft, LLC.
6 | All rights reserved.
7 | http://www.plutinosoft.com
9 | This program is free software; you can redistribute it and/or
10 | modify it under the terms of the GNU General Public License
11 | as published by the Free Software Foundation; either version 2
12 | of the License, or (at your option) any later version.
14 | OEMs, ISVs, VARs and other distributors that combine and
15 | distribute commercially licensed software with Platinum software
16 | and do not wish to distribute the source code for the commercially
17 | licensed software under version 2, or (at your option) any later
18 | version, of the GNU General Public License (the "GPL") must enter
19 | into a commercial license agreement with Plutinosoft, LLC.
20 | licensing@plutinosoft.com
22 | This program is distributed in the hope that it will be useful,
23 | but WITHOUT ANY WARRANTY; without even the implied warranty of
24 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 | GNU General Public License for more details.
27 | You should have received a copy of the GNU General Public License
28 | along with this program; see the file LICENSE.txt. If not, write to
29 | the Free Software Foundation, Inc.,
30 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
31 | http://www.gnu.org/licenses/gpl-2.0.html
33 ****************************************************************/
35 /** @file
36 UPnP AV Media Controller implementation.
39 #ifndef _PLT_MEDIA_BROWSER_H_
40 #define _PLT_MEDIA_BROWSER_H_
42 /*----------------------------------------------------------------------
43 | includes
44 +---------------------------------------------------------------------*/
45 #include "PltCtrlPoint.h"
46 #include "PltMediaItem.h"
48 /*----------------------------------------------------------------------
49 | PLT_BrowseInfo
50 +---------------------------------------------------------------------*/
51 /**
52 The PLT_BrowseInfo struct is used to marshall Browse or Search action
53 response results across different threads of execution.
55 typedef struct {
56 NPT_String object_id;
57 PLT_MediaObjectListReference items;
58 NPT_UInt32 si;
59 NPT_UInt32 nr;
60 NPT_UInt32 tm;
61 NPT_UInt32 uid;
62 } PLT_BrowseInfo;
64 /*----------------------------------------------------------------------
65 | PLT_MediaBrowserDelegate
66 +---------------------------------------------------------------------*/
67 /**
68 The PLT_MediaBrowserDelegate class is an interface for receiving PLT_MediaBrowser
69 events or action responses.
71 class PLT_MediaBrowserDelegate
73 public:
74 virtual ~PLT_MediaBrowserDelegate() {}
76 virtual bool OnMSAdded(PLT_DeviceDataReference& /* device */) { return true; }
77 virtual void OnMSRemoved(PLT_DeviceDataReference& /* device */) {}
78 virtual void OnMSStateVariablesChanged(
79 PLT_Service* /*service*/,
80 NPT_List<PLT_StateVariable*>* /*vars*/) {}
82 // ContentDirectory
83 virtual void OnBrowseResult(
84 NPT_Result /*res*/,
85 PLT_DeviceDataReference& /*device*/,
86 PLT_BrowseInfo* /*info*/,
87 void* /*userdata*/) {}
89 virtual void OnSearchResult(
90 NPT_Result /*res*/,
91 PLT_DeviceDataReference& /*device*/,
92 PLT_BrowseInfo* /*info*/,
93 void* /*userdata*/) {}
95 virtual void OnGetSearchCapabilitiesResult(
96 NPT_Result /*res*/,
97 PLT_DeviceDataReference& /*device*/,
98 NPT_String /*searchCapabilities*/,
99 void* /*userdata*/) {}
101 virtual void OnGetSortCapabilitiesResult(
102 NPT_Result /*res*/,
103 PLT_DeviceDataReference& /*device*/,
104 NPT_String /*sortCapabilities*/,
105 void* /*userdata*/) {}
108 /*----------------------------------------------------------------------
109 | PLT_MediaBrowser
110 +---------------------------------------------------------------------*/
112 The PLT_MediaBrowser class implements a UPnP AV Media Server control point.
114 class PLT_MediaBrowser : public PLT_CtrlPointListener
116 public:
117 PLT_MediaBrowser(PLT_CtrlPointReference& ctrl_point,
118 PLT_MediaBrowserDelegate* delegate = NULL);
119 ~PLT_MediaBrowser() override;
121 // ContentDirectory service
122 virtual NPT_Result Browse(PLT_DeviceDataReference& device,
123 const char* object_id,
124 NPT_UInt32 start_index,
125 NPT_UInt32 count = 30, // DLNA recommendations
126 bool browse_metadata = false,
127 const char* filter = "dc:date,upnp:genre,res,res@duration,res@size,upnp:albumArtURI,upnp:originalTrackNumber,upnp:album,upnp:artist,upnp:author", // explicitely specify res otherwise WMP won't return a URL!
128 const char* sort_criteria = "",
129 void* userdata = NULL);
131 virtual NPT_Result Search(PLT_DeviceDataReference& device,
132 const char* container_id,
133 const char* search_criteria,
134 NPT_UInt32 start_index,
135 NPT_UInt32 count = 30, // DLNA recommendations
136 const char* filter = "dc:date,upnp:genre,res,res@duration,res@size,upnp:albumArtURI,upnp:originalTrackNumber,upnp:album,upnp:artist,upnp:author", // explicitely specify res otherwise WMP won't return a URL!
137 void* userdata = NULL);
139 virtual NPT_Result GetSearchCapabilities(PLT_DeviceDataReference& device,
140 void* userdata = NULL);
142 virtual NPT_Result GetSortCapabilities(PLT_DeviceDataReference& device,
143 void* userdata = NULL);
145 // methods
146 virtual const NPT_Lock<PLT_DeviceDataReferenceList>& GetMediaServers() { return m_MediaServers; }
147 virtual NPT_Result FindServer(const char* uuid, PLT_DeviceDataReference& device);
148 virtual void SetDelegate(PLT_MediaBrowserDelegate* delegate) { m_Delegate = delegate; }
150 protected:
151 // PLT_CtrlPointListener methods
152 NPT_Result OnDeviceAdded(PLT_DeviceDataReference& device) override;
153 NPT_Result OnDeviceRemoved(PLT_DeviceDataReference& device) override;
154 NPT_Result OnActionResponse(NPT_Result res, PLT_ActionReference& action, void* userdata) override;
155 NPT_Result OnEventNotify(PLT_Service* service, NPT_List<PLT_StateVariable*>* vars) override;
157 // ContentDirectory service responses
158 virtual NPT_Result OnBrowseResponse(NPT_Result res,
159 PLT_DeviceDataReference& device,
160 PLT_ActionReference& action,
161 void* userdata);
163 virtual NPT_Result OnSearchResponse(NPT_Result res,
164 PLT_DeviceDataReference& device,
165 PLT_ActionReference& action,
166 void* userdata);
168 virtual NPT_Result OnGetSearchCapabilitiesResponse(NPT_Result res,
169 PLT_DeviceDataReference& device,
170 PLT_ActionReference& action,
171 void* userdata);
173 virtual NPT_Result OnGetSortCapabilitiesResponse(NPT_Result res,
174 PLT_DeviceDataReference& device,
175 PLT_ActionReference& action,
176 void* userdata);
178 protected:
179 PLT_CtrlPointReference m_CtrlPoint;
180 PLT_MediaBrowserDelegate* m_Delegate;
181 NPT_Lock<PLT_DeviceDataReferenceList> m_MediaServers;
184 #endif /* _PLT_MEDIA_BROWSER_H_ */