kodi
MediaServer.h
1 /*****************************************************************
2 |
3 | Platinum - Managed MediaServer
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 |
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 #pragma once
34 
35 /*----------------------------------------------------------------------
36 | includes
37 +---------------------------------------------------------------------*/
38 #include "DeviceHost.h"
39 #include "Http.h"
40 
41 class PLT_MediaServer;
42 
43 namespace Platinum
44 {
45 
46 ref class DeviceHost;
47 ref class Action;
48 class MediaServerEventBridge;
49 
50 /*----------------------------------------------------------------------
51 | MediaServer
52 +---------------------------------------------------------------------*/
53 public ref class MediaServer : public DeviceHost
54 {
55 public:
56 
57  delegate Int32 BrowseMetadataDelegate(Action^ action, String^ object_id, String^ filter, Int32 starting_index, Int32 requested_count, String^ sort_criteria, HttpRequestContext^ context);
58  delegate Int32 BrowseDirectChildrenDelegate(Action^ action, String^ object_id, String^ filter, Int32 starting_index, Int32 requested_count, String^ sort_criteria, HttpRequestContext^ context);
59  delegate Int32 SearchContainerDelegate(Action^ action, String^ object_id, String^ searchCriteria, String^ filter, Int32 starting_index, Int32 requested_count, String^ sort_criteria, HttpRequestContext^ context);
60  delegate Int32 ProcessFileRequestDelegate(HttpRequestContext^ context, HttpResponse^ response);
61 
62 private:
63 
64  MediaServerEventBridge* m_pBridge;
65 
66 public:
67 
68  // properties
69 
70 private:
71 
72  void RegisterEvents();
73 
74 public:
75 
76  event BrowseMetadataDelegate^ BrowseMetadata;
77  event BrowseDirectChildrenDelegate^ BrowseDirectChildren;
78  event SearchContainerDelegate^ SearchContainer;
79  event ProcessFileRequestDelegate^ ProcessFileRequest;
80 
81 
82 internal:
83 
84  Int32 OnBrowseMetadataDelegate(Action^ action, String^ object_id, String^ filter, Int32 starting_index, Int32 requested_count, String^ sort_criteria, HttpRequestContext^ context)
85  {
86  // handle events
87  return this->BrowseMetadata(action, object_id, filter, starting_index, requested_count, sort_criteria, context);
88  }
89 
90  Int32 OnBrowseDirectChildrenDelegate(Action^ action, String^ object_id, String^ filter, Int32 starting_index, Int32 requested_count, String^ sort_criteria, HttpRequestContext^ context)
91  {
92  // handle events
93  return this->BrowseDirectChildren(action, object_id, filter, starting_index, requested_count, sort_criteria, context);
94  }
95 
96  Int32 OnSearchContainerDelegate(Action^ action, String^ object_id, String^ searchCriteria, String^ filter, Int32 starting_index, Int32 requested_count, String^ sort_criteria, HttpRequestContext^ context)
97  {
98  // handle events
99  return this->SearchContainer(action, object_id, searchCriteria, filter, starting_index, requested_count, sort_criteria, context);
100  }
101 
102  Int32 OnProcessFileRequestDelegate(HttpRequestContext^ context, HttpResponse^ response)
103  {
104  return this->ProcessFileRequest(context, response);
105  }
106 
107 public:
108 
109  MediaServer(String^ friendlyName);
110  MediaServer(String^ friendlyName, String^ uuid);
111  MediaServer(PLT_MediaServer* server);
112 
113  void UpdateSystemUpdateID(Int32 update);
114  void UpdateContainerUpdateID(String^ id, Int32 update);
115 
116  ~MediaServer()
117  {
118  // clean-up managed
119 
120  // clean-up unmanaged
121  this->!MediaServer();
122  }
123 
124  !MediaServer();
125 
126 
127  static Int32 SetResponseFilePath(HttpRequestContext^ context, HttpResponse^ response, String^ filepath);
128  static Int32 SetResponseData(HttpRequestContext^ context, HttpResponse^ response, array<Byte>^ data);
129 };
130 
131 }
Definition: Http.h:121
The PLT_MediaServer class implements the base class for a UPnP AV Media Server device.
Definition: PltMediaServer.h:108
Definition: Http.h:197
Definition: MediaServer.h:53
Definition: Action.h:45
Definition: MediaServerEventBridge.h:49
Definition: DeviceHost.h:43