-
-// Classes
-
-class MediaServer;
-class MediaServerList;
-class Item;
-class Container;
-
-// Cookie that is passed to the callback
-
-typedef struct
-{
- services_discovery_t* serviceDiscovery;
- UpnpClient_Handle clientHandle;
- MediaServerList* serverList;
-} Cookie;
-
-
-// Class definitions...
-
-class Lockable
-{
-public:
-
- Lockable( Cookie* c )
- {
- vlc_mutex_init( &_mutex );
- }
-
- ~Lockable()
- {
- vlc_mutex_destroy( &_mutex );
- }
-
- void lock() { vlc_mutex_lock( &_mutex ); }
- void unlock() { vlc_mutex_unlock( &_mutex ); }
-
-private:
-
- vlc_mutex_t _mutex;
-};
-
-
-class Locker
-{
-public:
- Locker( Lockable* l )
- {
- _lockable = l;
- _lockable->lock();
- }
-
- ~Locker()
- {
- _lockable->unlock();
- }
-
-private:
- Lockable* _lockable;
-};
-
-
-class MediaServer
-{
-public:
-
- static void parseDeviceDescription( IXML_Document* doc, const char* location, Cookie* cookie );
-
- MediaServer( const char* UDN, const char* friendlyName, Cookie* cookie );
- ~MediaServer();
-
- const char* getUDN() const;
- const char* getFriendlyName() const;
-
- void setContentDirectoryEventURL( const char* url );
- const char* getContentDirectoryEventURL() const;
-
- void setContentDirectoryControlURL( const char* url );
- const char* getContentDirectoryControlURL() const;
-
- void subscribeToContentDirectory();
- void fetchContents();
-
- void setPlaylistNode( playlist_item_t* node );
-
- bool compareSID( const char* sid );
-
-private:
-
- bool _fetchContents( Container* parent );
- void _buildPlaylist( Container* container );
- IXML_Document* _browseAction( const char*, const char*, const char*, const char*, const char*, const char* );
-
- Cookie* _cookie;
-
- Container* _contents;
- playlist_item_t* _playlistNode;
-
- std::string _UDN;
- std::string _friendlyName;
-
- std::string _contentDirectoryEventURL;
- std::string _contentDirectoryControlURL;
-
- int _subscriptionTimeOut;
- Upnp_SID _subscriptionID;
-};
-
-
-class MediaServerList
-{
-public:
-
- MediaServerList( Cookie* cookie );
- ~MediaServerList();
-
- bool addServer( MediaServer* s );
- void removeServer( const char* UDN );
-
- MediaServer* getServer( const char* UDN );
- MediaServer* getServerBySID( const char* );
-
-private:
-
- Cookie* _cookie;
-
- std::vector<MediaServer*> _list;
-};
-
-
-class Item
-{
-public:
-
- Item( Container* parent, const char* objectID, const char* title, const char* resource );
-
- const char* getObjectID() const;
- const char* getTitle() const;
- const char* getResource() const;
-
- void setPlaylistNode( playlist_item_t* node );
- playlist_item_t* getPlaylistNode() const ;
-
-private:
-
- playlist_item_t* _playlistNode;
-
- Container* _parent;
- std::string _objectID;
- std::string _title;
- std::string _resource;
-};
-
-
-class Container