comparison deps/Platinum/Source/Devices/MediaServer/PltMediaBrowser.h @ 0:3425707ddbf6

Initial import (hopefully this mercurial stuff works...)
author fraserofthenight
date Mon, 06 Jul 2009 08:06:28 -0700
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:3425707ddbf6
1 /*****************************************************************
2 |
3 | Platinum - AV Media Browser (Media Server Control Point)
4 |
5 | Copyright (c) 2004-2008, 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 |
21 | This program is distributed in the hope that it will be useful,
22 | but WITHOUT ANY WARRANTY; without even the implied warranty of
23 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 | GNU General Public License for more details.
25 |
26 | You should have received a copy of the GNU General Public License
27 | along with this program; see the file LICENSE.txt. If not, write to
28 | the Free Software Foundation, Inc.,
29 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
30 | http://www.gnu.org/licenses/gpl-2.0.html
31 |
32 ****************************************************************/
33
34 #ifndef _PLT_MEDIA_BROWSER_H_
35 #define _PLT_MEDIA_BROWSER_H_
36
37 /*----------------------------------------------------------------------
38 | includes
39 +---------------------------------------------------------------------*/
40 #include "PltCtrlPoint.h"
41 #include "PltMediaItem.h"
42
43 /*----------------------------------------------------------------------
44 | PLT_BrowseInfo
45 +---------------------------------------------------------------------*/
46 struct PLT_BrowseInfo {
47 NPT_String object_id;
48 PLT_MediaObjectListReference items;
49 NPT_UInt32 nr;
50 NPT_UInt32 tm;
51 NPT_UInt32 uid;
52 };
53
54 /*----------------------------------------------------------------------
55 | PLT_MediaBrowserDelegate class
56 +---------------------------------------------------------------------*/
57 class PLT_MediaBrowserDelegate
58 {
59 public:
60 virtual ~PLT_MediaBrowserDelegate() {}
61
62 virtual bool OnMSAdded(PLT_DeviceDataReference& /* device */) { return true; }
63 virtual void OnMSRemoved(PLT_DeviceDataReference& /* device */) {}
64 virtual void OnMSStateVariablesChanged(
65 PLT_Service* /*service*/,
66 NPT_List<PLT_StateVariable*>* /*vars*/) {}
67
68 // ContentDirectory
69 virtual void OnBrowseResult(
70 NPT_Result /*res*/,
71 PLT_DeviceDataReference& /*device*/,
72 PLT_BrowseInfo* /*info*/,
73 void* /*userdata*/) {}
74 };
75
76 /*----------------------------------------------------------------------
77 | PLT_MediaBrowser class
78 +---------------------------------------------------------------------*/
79 class PLT_MediaBrowser : public PLT_CtrlPointListener
80 {
81 public:
82 PLT_MediaBrowser(PLT_CtrlPointReference& ctrl_point,
83 PLT_MediaBrowserDelegate* delegate = NULL);
84 virtual ~PLT_MediaBrowser();
85
86 // ContentDirectory service
87 virtual NPT_Result Browse(PLT_DeviceDataReference& device,
88 const char* object_id,
89 NPT_UInt32 start_index,
90 NPT_UInt32 count,
91 bool browse_metadata = false,
92 const char* filter = "*",
93 const char* sort_criteria = "",
94 void* userdata = NULL);
95
96 // accessor methods
97 virtual const NPT_Lock<PLT_DeviceDataReferenceList>& GetMediaServers() {
98 return m_MediaServers;
99 }
100 virtual void SetDelegate(PLT_MediaBrowserDelegate* delegate) {
101 m_Delegate = delegate;
102 }
103
104 protected:
105 // PLT_CtrlPointListener methods
106 virtual NPT_Result OnDeviceAdded(PLT_DeviceDataReference& device);
107 virtual NPT_Result OnDeviceRemoved(PLT_DeviceDataReference& device);
108 virtual NPT_Result OnActionResponse(NPT_Result res, PLT_ActionReference& action, void* userdata);
109 virtual NPT_Result OnEventNotify(PLT_Service* service, NPT_List<PLT_StateVariable*>* vars);
110
111 // ContentDirectory service responses
112 virtual NPT_Result OnBrowseResponse(NPT_Result res,
113 PLT_DeviceDataReference& device,
114 PLT_ActionReference& action,
115 void* userdata);
116
117 protected:
118 PLT_CtrlPointReference m_CtrlPoint;
119 PLT_MediaBrowserDelegate* m_Delegate;
120 NPT_Lock<PLT_DeviceDataReferenceList> m_MediaServers;
121 };
122
123 #endif /* _PLT_MEDIA_BROWSER_H_ */