Platinum UPnP SDK  1.0.5.13
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;
57  PLT_MediaObjectListReference items;
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 
96 /*----------------------------------------------------------------------
97 | PLT_MediaBrowser
98 +---------------------------------------------------------------------*/
103 {
104 public:
105  PLT_MediaBrowser(PLT_CtrlPointReference& ctrl_point,
106  PLT_MediaBrowserDelegate* delegate = NULL);
107  virtual ~PLT_MediaBrowser();
108 
109  // ContentDirectory service
110  virtual NPT_Result Browse(PLT_DeviceDataReference& device,
111  const char* object_id,
112  NPT_UInt32 start_index,
113  NPT_UInt32 count = 30, // DLNA recommendations
114  bool browse_metadata = false,
115  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!
116  const char* sort_criteria = "",
117  void* userdata = NULL);
118 
119  virtual NPT_Result Search(PLT_DeviceDataReference& device,
120  const char* container_id,
121  const char* search_criteria,
122  NPT_UInt32 start_index,
123  NPT_UInt32 count = 30, // DLNA recommendations
124  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!
125  void* userdata = NULL);
126 
127  // methods
128  virtual const NPT_Lock<PLT_DeviceDataReferenceList>& GetMediaServers() { return m_MediaServers; }
129  virtual NPT_Result FindServer(const char* uuid, PLT_DeviceDataReference& device);
130  virtual void SetDelegate(PLT_MediaBrowserDelegate* delegate) { m_Delegate = delegate; }
131 
132 protected:
133  // PLT_CtrlPointListener methods
134  virtual NPT_Result OnDeviceAdded(PLT_DeviceDataReference& device);
135  virtual NPT_Result OnDeviceRemoved(PLT_DeviceDataReference& device);
136  virtual NPT_Result OnActionResponse(NPT_Result res, PLT_ActionReference& action, void* userdata);
137  virtual NPT_Result OnEventNotify(PLT_Service* service, NPT_List<PLT_StateVariable*>* vars);
138 
139  // ContentDirectory service responses
140  virtual NPT_Result OnBrowseResponse(NPT_Result res,
141  PLT_DeviceDataReference& device,
142  PLT_ActionReference& action,
143  void* userdata);
144 
145  virtual NPT_Result OnSearchResponse(NPT_Result res,
146  PLT_DeviceDataReference& device,
147  PLT_ActionReference& action,
148  void* userdata);
149 
150 protected:
151  PLT_CtrlPointReference m_CtrlPoint;
152  PLT_MediaBrowserDelegate* m_Delegate;
153  NPT_Lock<PLT_DeviceDataReferenceList> m_MediaServers;
154 };
155 
156 #endif /* _PLT_MEDIA_BROWSER_H_ */
The PLT_MediaBrowser class implements a UPnP AV Media Server control point.
Definition: PltMediaBrowser.h:102
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
The PLT_MediaBrowserDelegate class is an interface for receiving PLT_MediaBrowser events or action re...
Definition: PltMediaBrowser.h:71