]> git.sesse.net Git - vlc/blob - modules/services_discovery/upnp_intel.hpp
Use var_InheritString for --decklink-video-connection.
[vlc] / modules / services_discovery / upnp_intel.hpp
1 /*****************************************************************************
2  * Upnp_intel.hpp :  UPnP discovery module (Intel SDK) header
3  *****************************************************************************
4  * Copyright (C) 2004-2008 the VideoLAN team
5  * $Id$
6  *
7  * Authors: RĂ©mi Denis-Courmont <rem # videolan.org> (original plugin)
8  *          Christian Henz <henz # c-lab.de>
9  *          Mirsal Ennaime <mirsal dot ennaime at gmail dot com>
10  *
11  * UPnP Plugin using the Intel SDK (libupnp) instead of CyberLink
12  *
13  * This program is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation; either version 2 of the License, or
16  * (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software
25  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
26  *****************************************************************************/
27
28 #include <vector>
29 #include <string>
30
31 #include <upnp/upnp.h>
32 #include <upnp/upnptools.h>
33
34 #include <vlc_common.h>
35
36 // Classes
37 class Container;
38
39 class MediaServer
40 {
41 public:
42
43     static void parseDeviceDescription( IXML_Document* doc,
44                                         const char*    location,
45                                         services_discovery_t* p_sd );
46
47     MediaServer( const char* UDN,
48                  const char* friendlyName,
49                  services_discovery_t* p_sd );
50
51     ~MediaServer();
52
53     const char* getUDN() const;
54     const char* getFriendlyName() const;
55
56     void setContentDirectoryEventURL( const char* url );
57     const char* getContentDirectoryEventURL() const;
58
59     void setContentDirectoryControlURL( const char* url );
60     const char* getContentDirectoryControlURL() const;
61
62     void subscribeToContentDirectory();
63     void fetchContents();
64
65     void setInputItem( input_item_t* p_input_item );
66
67     bool compareSID( const char* sid );
68
69 private:
70
71     bool _fetchContents( Container* parent );
72     void _buildPlaylist( Container* container, input_item_node_t * );
73
74     IXML_Document* _browseAction( const char*, const char*,
75             const char*, const char*, const char*, const char* );
76
77     services_discovery_t* _p_sd;
78
79     Container* _contents;
80     input_item_t* _inputItem;
81
82     std::string _UDN;
83     std::string _friendlyName;
84
85     std::string _contentDirectoryEventURL;
86     std::string _contentDirectoryControlURL;
87
88     int _subscriptionTimeOut;
89     Upnp_SID _subscriptionID;
90 };
91
92
93 class MediaServerList
94 {
95 public:
96
97     MediaServerList( services_discovery_t* p_sd );
98     ~MediaServerList();
99
100     bool addServer( MediaServer* s );
101     void removeServer( const char* UDN );
102
103     MediaServer* getServer( const char* UDN );
104     MediaServer* getServerBySID( const char* );
105
106 private:
107
108     services_discovery_t* _p_sd;
109
110     std::vector<MediaServer*> _list;
111 };
112
113
114 class Item
115 {
116 public:
117
118     Item( Container*  parent,
119           const char* objectID,
120           const char* title,
121           const char* resource );
122     ~Item();
123
124     const char* getObjectID() const;
125     const char* getTitle() const;
126     const char* getResource() const;
127
128     void setInputItem( input_item_t* p_input_item );
129     input_item_t* getInputItem() const ;
130
131 private:
132
133     input_item_t* _inputItem;
134
135     Container* _parent;
136     std::string _objectID;
137     std::string _title;
138     std::string _resource;
139 };
140
141
142 class Container
143 {
144 public:
145
146     Container( Container* parent, const char* objectID, const char* title );
147     ~Container();
148
149     void addItem( Item* item );
150     void addContainer( Container* container );
151
152     const char* getObjectID() const;
153     const char* getTitle() const;
154
155     unsigned int getNumItems() const;
156     unsigned int getNumContainers() const;
157
158     Item* getItem( unsigned int i ) const;
159     Container* getContainer( unsigned int i ) const;
160     Container* getParent();
161
162     void setInputItem( input_item_t* p_input_item );
163     input_item_t* getInputItem() const;
164
165 private:
166
167     input_item_t* _inputItem;
168
169     Container* _parent;
170
171     std::string _objectID;
172     std::string _title;
173     std::vector<Item*> _items;
174     std::vector<Container*> _containers;
175 };
176