kodi
PltMediaConnect.h
1 /*****************************************************************
2 |
3 | Platinum - AV Media Connect Device
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 | licensing@plutinosoft.com
22 |
23 | This program is distributed in the hope that it will be useful,
24 | but WITHOUT ANY WARRANTY; without even the implied warranty of
25 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 | GNU General Public License for more details.
27 |
28 | You should have received a copy of the GNU General Public License
29 | along with this program; see the file LICENSE.txt. If not, write to
30 | the Free Software Foundation, Inc.,
31 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
32 | http://www.gnu.org/licenses/gpl-2.0.html
33 |
34 ****************************************************************/
35 
36 #ifndef _PLT_MEDIA_CONNECT_H_
37 #define _PLT_MEDIA_CONNECT_H_
38 
39 /*----------------------------------------------------------------------
40 | includes
41 +---------------------------------------------------------------------*/
42 #include "Neptune.h"
43 #include "PltFileMediaServer.h"
44 
45 /*----------------------------------------------------------------------
46 | PLT_MediaConnect
47 +---------------------------------------------------------------------*/
49 {
50 public:
51  // class methods
52  static NPT_Result GetMappedObjectId(const char* object_id,
53  NPT_String& mapped_object_id);
54 
55  // constructor
56  PLT_MediaConnect(const char* friendly_name,
57  bool add_hostname = true,
58  const char* udn = NULL,
59  NPT_UInt16 port = 0,
60  bool port_rebind = false);
61 
62 protected:
63  ~PLT_MediaConnect() override;
64 
65  // PLT_DeviceHost methods
66  NPT_Result SetupServices() override;
67  NPT_Result OnAction(PLT_ActionReference& action,
68  const PLT_HttpRequestContext& context) override;
69  NPT_Result ProcessGetDescription(NPT_HttpRequest& request,
70  const NPT_HttpRequestContext& context,
71  NPT_HttpResponse& response) override;
72  NPT_Result ProcessGetSCPD(PLT_Service* service,
73  NPT_HttpRequest& request,
74  const NPT_HttpRequestContext& context,
75  NPT_HttpResponse& response) override;
76 
77  // X_MS_MediaReceiverRegistrar
78  virtual NPT_Result OnIsAuthorized(PLT_ActionReference& action);
79  virtual NPT_Result OnRegisterDevice(PLT_ActionReference& action);
80  virtual NPT_Result OnIsValidated(PLT_ActionReference& action);
81 
82 protected:
83  NPT_Mutex m_Lock;
84  bool m_AddHostname;
85 };
86 
87 /*----------------------------------------------------------------------
88  | PLT_FileMediaConnectDelegate class
89  +---------------------------------------------------------------------*/
91 {
92 public:
93  // constructor & destructor
94  PLT_FileMediaConnectDelegate(const char* url_root, const char* file_root) :
95  PLT_FileMediaServerDelegate(url_root, file_root) {}
96  ~PLT_FileMediaConnectDelegate() override {}
97 
98  // PLT_FileMediaServerDelegate methods
99  NPT_Result GetFilePath(const char* object_id, NPT_String& filepath) override;
100  NPT_Result OnSearchContainer(PLT_ActionReference& action,
101  const char* object_id,
102  const char* search_criteria,
103  const char* filter,
104  NPT_UInt32 starting_index,
105  NPT_UInt32 requested_count,
106  const char* sort_criteria,
107  const PLT_HttpRequestContext& context) override;
108 };
109 
110 #endif /* _PLT_MEDIA_CONNECT_H_ */
NPT_Result SetupServices() override
Required method for setting up UPnP services of device host (and any embedded).
Definition: PltMediaConnect.cpp:74
Definition: NptHttp.h:566
Definition: NptHttp.h:315
Definition: NptHttp.h:282
File Media Server Delegate.
Definition: PltFileMediaServer.h:57
The PLT_MediaServer class implements the base class for a UPnP AV Media Server device.
Definition: PltMediaServer.h:108
UPnP AV Filesystem based Media Server sample implementation.
Definition: PltMediaConnect.h:90
UPnP Service.
Definition: PltService.h:67
Definition: NptThreads.h:76
NPT_Result OnAction(PLT_ActionReference &action, const PLT_HttpRequestContext &context) override
This mehod is called when an action performed by a control point has been received and needs to be an...
Definition: PltMediaConnect.cpp:203
The PLT_HttpRequestContext class holds information about the request sent, the local & remote ip addr...
Definition: PltHttp.h:111
Definition: PltMediaConnect.h:48
Definition: NptStrings.h:57
NPT_Result ProcessGetDescription(NPT_HttpRequest &request, const NPT_HttpRequestContext &context, NPT_HttpResponse &response) override
This method is called when a control point is requesting the device description.
Definition: PltMediaConnect.cpp:98
NPT_Result ProcessGetSCPD(PLT_Service *service, NPT_HttpRequest &request, const NPT_HttpRequestContext &context, NPT_HttpResponse &response) override
This method is called when a control point is requesting a service SCPD.
Definition: PltMediaConnect.cpp:176