upnp_intel.hpp

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * Upnp_intel.hpp :  UPnP discovery module (Intel SDK) header
00003  *****************************************************************************
00004  * Copyright (C) 2004-2008 the VideoLAN team
00005  * $Id: c571e8d97e8d1e76f7653ae05337e5b376756f2d $
00006  *
00007  * Authors: Rémi Denis-Courmont <rem # videolan.org> (original plugin)
00008  *          Christian Henz <henz # c-lab.de>
00009  *          Mirsal Ennaime <mirsal dot ennaime at gmail dot com>
00010  *
00011  * UPnP Plugin using the Intel SDK (libupnp) instead of CyberLink
00012  *
00013  * This program is free software; you can redistribute it and/or modify
00014  * it under the terms of the GNU General Public License as published by
00015  * the Free Software Foundation; either version 2 of the License, or
00016  * (at your option) any later version.
00017  *
00018  * This program is distributed in the hope that it will be useful,
00019  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021  * GNU General Public License for more details.
00022  *
00023  * You should have received a copy of the GNU General Public License
00024  * along with this program; if not, write to the Free Software
00025  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
00026  *****************************************************************************/
00027 
00028 #include <vector>
00029 #include <string>
00030 
00031 #include <upnp/upnp.h>
00032 #include <upnp/upnptools.h>
00033 
00034 #include <vlc_common.h>
00035 
00036 // Classes
00037 class Container;
00038 
00039 class MediaServer
00040 {
00041 public:
00042 
00043     static void parseDeviceDescription( IXML_Document* doc,
00044                                         const char*    location,
00045                                         services_discovery_t* p_sd );
00046 
00047     MediaServer( const char* UDN,
00048                  const char* friendlyName,
00049                  services_discovery_t* p_sd );
00050 
00051     ~MediaServer();
00052 
00053     const char* getUDN() const;
00054     const char* getFriendlyName() const;
00055 
00056     void setContentDirectoryEventURL( const char* url );
00057     const char* getContentDirectoryEventURL() const;
00058 
00059     void setContentDirectoryControlURL( const char* url );
00060     const char* getContentDirectoryControlURL() const;
00061 
00062     void subscribeToContentDirectory();
00063     void fetchContents();
00064 
00065     void setInputItem( input_item_t* p_input_item );
00066 
00067     bool compareSID( const char* sid );
00068 
00069 private:
00070 
00071     bool _fetchContents( Container* parent );
00072     void _buildPlaylist( Container* container, input_item_node_t * );
00073 
00074     IXML_Document* _browseAction( const char*, const char*,
00075             const char*, const char*, const char*, const char* );
00076 
00077     services_discovery_t* _p_sd;
00078 
00079     Container* _contents;
00080     input_item_t* _inputItem;
00081 
00082     std::string _UDN;
00083     std::string _friendlyName;
00084 
00085     std::string _contentDirectoryEventURL;
00086     std::string _contentDirectoryControlURL;
00087 
00088     int _subscriptionTimeOut;
00089     Upnp_SID _subscriptionID;
00090 };
00091 
00092 
00093 class MediaServerList
00094 {
00095 public:
00096 
00097     MediaServerList( services_discovery_t* p_sd );
00098     ~MediaServerList();
00099 
00100     bool addServer( MediaServer* s );
00101     void removeServer( const char* UDN );
00102 
00103     MediaServer* getServer( const char* UDN );
00104     MediaServer* getServerBySID( const char* );
00105 
00106 private:
00107 
00108     services_discovery_t* _p_sd;
00109 
00110     std::vector<MediaServer*> _list;
00111 };
00112 
00113 
00114 class Item
00115 {
00116 public:
00117 
00118     Item( Container*  parent,
00119           const char* objectID,
00120           const char* title,
00121           const char* resource );
00122     ~Item();
00123 
00124     const char* getObjectID() const;
00125     const char* getTitle() const;
00126     const char* getResource() const;
00127 
00128     void setInputItem( input_item_t* p_input_item );
00129     input_item_t* getInputItem() const ;
00130 
00131 private:
00132 
00133     input_item_t* _inputItem;
00134 
00135     Container* _parent;
00136     std::string _objectID;
00137     std::string _title;
00138     std::string _resource;
00139 };
00140 
00141 
00142 class Container
00143 {
00144 public:
00145 
00146     Container( Container* parent, const char* objectID, const char* title );
00147     ~Container();
00148 
00149     void addItem( Item* item );
00150     void addContainer( Container* container );
00151 
00152     const char* getObjectID() const;
00153     const char* getTitle() const;
00154 
00155     unsigned int getNumItems() const;
00156     unsigned int getNumContainers() const;
00157 
00158     Item* getItem( unsigned int i ) const;
00159     Container* getContainer( unsigned int i ) const;
00160     Container* getParent();
00161 
00162     void setInputItem( input_item_t* p_input_item );
00163     input_item_t* getInputItem() const;
00164 
00165 private:
00166 
00167     input_item_t* _inputItem;
00168 
00169     Container* _parent;
00170 
00171     std::string _objectID;
00172     std::string _title;
00173     std::vector<Item*> _items;
00174     std::vector<Container*> _containers;
00175 };
00176 

Generated on Tue May 25 08:04:59 2010 for VLC by  doxygen 1.5.6