xbmc
PltMediaBrowser.h
Go to the documentation of this file.
1 /*****************************************************************
2 |
3 | Platinum - AV Media Browser (Media Server Control Point)
4 |
5 | Copyright (c) 2004-2010, Plutinosoft, LLC.
6 | All rights reserved.
7 | http://www.plutinosoft.com
8 |
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.
13 |
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
21 |
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.
26 |
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
32 |
33 ****************************************************************/
34 
39 #ifndef _PLT_MEDIA_BROWSER_H_
40 #define _PLT_MEDIA_BROWSER_H_
41 
42 /*----------------------------------------------------------------------
43 | includes
44 +---------------------------------------------------------------------*/
45 #include "PltCtrlPoint.h"
46 #include "PltMediaItem.h"
47 
48 /*----------------------------------------------------------------------
49 | PLT_BrowseInfo
50 +---------------------------------------------------------------------*/
55 typedef struct {
56  NPT_String object_id;
58  NPT_UInt32 si;
59  NPT_UInt32 nr;
60  NPT_UInt32 tm;
61  NPT_UInt32 uid;
63 
64 /*----------------------------------------------------------------------
65 | PLT_MediaBrowserDelegate
66 +---------------------------------------------------------------------*/
72 {
73 public:
74  virtual ~PLT_MediaBrowserDelegate() {}
75 
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*/) {}
81 
82  // ContentDirectory
83  virtual void OnBrowseResult(
84  NPT_Result /*res*/,
85  PLT_DeviceDataReference& /*device*/,
86  PLT_BrowseInfo* /*info*/,
87  void* /*userdata*/) {}
88 
89  virtual void OnSearchResult(
90  NPT_Result /*res*/,
91  PLT_DeviceDataReference& /*device*/,
92  PLT_BrowseInfo* /*info*/,
93  void* /*userdata*/) {}
94 
95  virtual void OnGetSearchCapabilitiesResult(
96  NPT_Result /*res*/,
97  PLT_DeviceDataReference& /*device*/,
98  NPT_String /*searchCapabilities*/,
99  void* /*userdata*/) {}
100 
101  virtual void OnGetSortCapabilitiesResult(
102  NPT_Result /*res*/,
103  PLT_DeviceDataReference& /*device*/,
104  NPT_String /*sortCapabilities*/,
105  void* /*userdata*/) {}
106 };
107 
108 /*----------------------------------------------------------------------
109 | PLT_MediaBrowser
110 +---------------------------------------------------------------------*/
115 {
116 public:
118  PLT_MediaBrowserDelegate* delegate = NULL);
119  ~PLT_MediaBrowser() override;
120 
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);
130 
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);
138 
139  virtual NPT_Result GetSearchCapabilities(PLT_DeviceDataReference& device,
140  void* userdata = NULL);
141 
142  virtual NPT_Result GetSortCapabilities(PLT_DeviceDataReference& device,
143  void* userdata = NULL);
144 
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; }
149 
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;
156 
157  // ContentDirectory service responses
158  virtual NPT_Result OnBrowseResponse(NPT_Result res,
159  PLT_DeviceDataReference& device,
160  PLT_ActionReference& action,
161  void* userdata);
162 
163  virtual NPT_Result OnSearchResponse(NPT_Result res,
164  PLT_DeviceDataReference& device,
165  PLT_ActionReference& action,
166  void* userdata);
167 
168  virtual NPT_Result OnGetSearchCapabilitiesResponse(NPT_Result res,
169  PLT_DeviceDataReference& device,
170  PLT_ActionReference& action,
171  void* userdata);
172 
173  virtual NPT_Result OnGetSortCapabilitiesResponse(NPT_Result res,
174  PLT_DeviceDataReference& device,
175  PLT_ActionReference& action,
176  void* userdata);
177 
178 protected:
179  PLT_CtrlPointReference m_CtrlPoint;
180  PLT_MediaBrowserDelegate* m_Delegate;
182 };
183 
184 #endif /* _PLT_MEDIA_BROWSER_H_ */
The PLT_MediaBrowser class implements a UPnP AV Media Server control point.
Definition: PltMediaBrowser.h:114
UPnP ControlPoint.
UPnP AV Media Object reprensentation.
UPnP Service.
Definition: PltService.h:67
The PLT_BrowseInfo struct is used to marshall Browse or Search action response results across differe...
Definition: PltMediaBrowser.h:55
The PLT_CtrlPointListener class is an interface used to receive notifications when devices are found ...
Definition: PltCtrlPoint.h:68
Definition: NptThreads.h:113
The PLT_MediaBrowserDelegate class is an interface for receiving PLT_MediaBrowser events or action re...
Definition: PltMediaBrowser.h:71
Definition: NptStrings.h:57
Definition: NptList.h:54