1 /*****************************************************************************
2 * Upnp_intel.cpp : UPnP discovery module (Intel SDK)
3 *****************************************************************************
4 * Copyright (C) 2004-2008 the VideoLAN team
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>
11 * UPnP Plugin using the Intel SDK (libupnp) instead of CyberLink
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.
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.
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 *****************************************************************************/
29 \TODO: Debug messages: "__FILE__, __LINE__" ok ???, Wrn/Err ???
30 \TODO: Change names to VLC standard ???
37 #include "upnp_intel.hpp"
39 #include <vlc_plugin.h>
40 #include <vlc_services_discovery.h>
44 const char* MEDIA_SERVER_DEVICE_TYPE = "urn:schemas-upnp-org:device:MediaServer:1";
45 const char* CONTENT_DIRECTORY_SERVICE_TYPE = "urn:schemas-upnp-org:service:ContentDirectory:1";
48 struct services_discovery_sys_t
50 UpnpClient_Handle client_handle;
51 MediaServerList* p_server_list;
52 vlc_mutex_t callback_lock;
55 // VLC callback prototypes
56 static int Open( vlc_object_t* );
57 static void Close( vlc_object_t* );
58 VLC_SD_PROBE_HELPER("upnp_intel", "Universal Plug'n'Play", SD_CAT_LAN)
63 set_shortname( "UPnP" );
64 set_description( N_( "Universal Plug'n'Play" ) );
65 set_category( CAT_PLAYLIST );
66 set_subcategory( SUBCAT_PLAYLIST_SD );
67 set_capability( "services_discovery", 0 );
68 set_callbacks( Open, Close );
70 VLC_SD_PROBE_SUBMODULE
76 static int Callback( Upnp_EventType event_type, void* p_event, void* p_user_data );
78 const char* xml_getChildElementValue( IXML_Element* p_parent,
79 const char* psz_tag_name );
81 IXML_Document* parseBrowseResult( IXML_Document* p_doc );
86 static int Open( vlc_object_t *p_this )
89 services_discovery_t *p_sd = ( services_discovery_t* )p_this;
90 services_discovery_sys_t *p_sys = ( services_discovery_sys_t * )
91 calloc( 1, sizeof( services_discovery_sys_t ) );
93 if(!(p_sd->p_sys = p_sys))
96 i_res = UpnpInit( 0, 0 );
97 if( i_res != UPNP_E_SUCCESS )
99 msg_Err( p_sd, "%s", UpnpGetErrorMessage( i_res ) );
104 p_sys->p_server_list = new MediaServerList( p_sd );
105 vlc_mutex_init( &p_sys->callback_lock );
107 i_res = UpnpRegisterClient( Callback, p_sd, &p_sys->client_handle );
108 if( i_res != UPNP_E_SUCCESS )
110 msg_Err( p_sd, "%s", UpnpGetErrorMessage( i_res ) );
111 Close( (vlc_object_t*) p_sd );
115 i_res = UpnpSearchAsync( p_sys->client_handle, 5,
116 MEDIA_SERVER_DEVICE_TYPE, p_sd );
118 if( i_res != UPNP_E_SUCCESS )
120 msg_Err( p_sd, "%s", UpnpGetErrorMessage( i_res ) );
121 Close( (vlc_object_t*) p_sd );
125 i_res = UpnpSetMaxContentLength( 262144 );
126 if( i_res != UPNP_E_SUCCESS )
128 msg_Err( p_sd, "%s", UpnpGetErrorMessage( i_res ) );
129 Close( (vlc_object_t*) p_sd );
136 static void Close( vlc_object_t *p_this )
138 services_discovery_t *p_sd = ( services_discovery_t* )p_this;
141 delete p_sd->p_sys->p_server_list;
142 vlc_mutex_destroy( &p_sd->p_sys->callback_lock );
147 // XML utility functions:
149 // Returns the value of a child element, or 0 on error
150 const char* xml_getChildElementValue( IXML_Element* p_parent,
151 const char* _psz_tag_name )
153 if ( !p_parent ) return 0;
154 if ( !_psz_tag_name ) return 0;
156 char* psz_tag_name = strdup( _psz_tag_name );
157 IXML_NodeList* p_node_list = ixmlElement_getElementsByTagName( p_parent, psz_tag_name );
158 free( psz_tag_name );
159 if ( !p_node_list ) return 0;
161 IXML_Node* p_element = ixmlNodeList_item( p_node_list, 0 );
162 ixmlNodeList_free( p_node_list );
163 if ( !p_element ) return 0;
165 IXML_Node* p_text_node = ixmlNode_getFirstChild( p_element );
166 if ( !p_text_node ) return 0;
168 return ixmlNode_getNodeValue( p_text_node );
171 // Extracts the result document from a SOAP response
172 IXML_Document* parseBrowseResult( IXML_Document* p_doc )
176 if ( !p_doc ) return 0;
178 IXML_NodeList* p_result_list = ixmlDocument_getElementsByTagName( p_doc,
181 if ( !p_result_list ) return 0;
183 IXML_Node* p_result_node = ixmlNodeList_item( p_result_list, 0 );
185 ixmlNodeList_free( p_result_list );
187 if ( !p_result_node ) return 0;
189 IXML_Node* p_text_node = ixmlNode_getFirstChild( p_result_node );
190 if ( !p_text_node ) return 0;
192 const char* psz_result_string = ixmlNode_getNodeValue( p_text_node );
193 char* psz_result_xml = strdup( psz_result_string );
195 IXML_Document* p_browse_doc = ixmlParseBuffer( psz_result_xml );
197 free( psz_result_xml );
203 // Handles all UPnP events
204 static int Callback( Upnp_EventType event_type, void* p_event, void* p_user_data )
206 services_discovery_t* p_sd = ( services_discovery_t* ) p_user_data;
207 services_discovery_sys_t* p_sys = p_sd->p_sys;
208 vlc_mutex_locker locker( &p_sys->callback_lock );
212 case UPNP_DISCOVERY_ADVERTISEMENT_ALIVE:
213 case UPNP_DISCOVERY_SEARCH_RESULT:
215 struct Upnp_Discovery* p_discovery = ( struct Upnp_Discovery* )p_event;
217 IXML_Document *p_description_doc = 0;
220 i_res = UpnpDownloadXmlDoc( p_discovery->Location, &p_description_doc );
221 if ( i_res != UPNP_E_SUCCESS )
224 "%s:%d: Could not download device description!",
225 __FILE__, __LINE__ );
229 MediaServer::parseDeviceDescription( p_description_doc,
230 p_discovery->Location, p_sd );
232 ixmlDocument_free( p_description_doc );
236 case UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE:
238 struct Upnp_Discovery* p_discovery = ( struct Upnp_Discovery* )p_event;
240 p_sys->p_server_list->removeServer( p_discovery->DeviceId );
244 case UPNP_EVENT_RECEIVED:
246 Upnp_Event* p_e = ( Upnp_Event* )p_event;
248 MediaServer* p_server = p_sys->p_server_list->getServerBySID( p_e->Sid );
249 if ( p_server ) p_server->fetchContents();
253 case UPNP_EVENT_AUTORENEWAL_FAILED:
254 case UPNP_EVENT_SUBSCRIPTION_EXPIRED:
258 Upnp_Event_Subscribe* p_s = ( Upnp_Event_Subscribe* )p_event;
260 MediaServer* p_server = p_sys->p_server_list->getServerBySID( p_s->Sid );
261 if ( p_server ) p_server->subscribeToContentDirectory();
265 case UPNP_EVENT_SUBSCRIBE_COMPLETE:
266 msg_Warn( p_sd, "subscription complete" );
269 case UPNP_DISCOVERY_SEARCH_TIMEOUT:
270 msg_Warn( p_sd, "search timeout" );
275 "%s:%d: DEBUG: UNHANDLED EVENT ( TYPE=%d )",
276 __FILE__, __LINE__, event_type );
280 return UPNP_E_SUCCESS;
284 // Class implementations...
288 void MediaServer::parseDeviceDescription( IXML_Document* p_doc,
289 const char* p_location,
290 services_discovery_t* p_sd )
294 msg_Dbg( p_sd, "%s:%d: NULL", __FILE__, __LINE__ );
300 msg_Dbg( p_sd, "%s:%d: NULL", __FILE__, __LINE__ );
304 const char* psz_base_url = p_location;
306 // Try to extract baseURL
308 IXML_NodeList* p_url_list = ixmlDocument_getElementsByTagName( p_doc, "baseURL" );
312 if ( IXML_Node* p_url_node = ixmlNodeList_item( p_url_list, 0 ) )
314 IXML_Node* p_text_node = ixmlNode_getFirstChild( p_url_node );
315 if ( p_text_node ) psz_base_url = ixmlNode_getNodeValue( p_text_node );
318 ixmlNodeList_free( p_url_list );
323 IXML_NodeList* p_device_list =
324 ixmlDocument_getElementsByTagName( p_doc, "device" );
328 for ( unsigned int i = 0; i < ixmlNodeList_length( p_device_list ); i++ )
330 IXML_Element* p_device_element =
331 ( IXML_Element* ) ixmlNodeList_item( p_device_list, i );
333 const char* psz_device_type = xml_getChildElementValue( p_device_element,
335 if ( !psz_device_type )
338 "%s:%d: no deviceType!",
339 __FILE__, __LINE__ );
343 if ( strcmp( MEDIA_SERVER_DEVICE_TYPE, psz_device_type ) != 0 )
346 const char* psz_udn = xml_getChildElementValue( p_device_element, "UDN" );
349 msg_Dbg( p_sd, "%s:%d: no UDN!",
350 __FILE__, __LINE__ );
354 if ( p_sd->p_sys->p_server_list->getServer( psz_udn ) != 0 )
357 const char* psz_friendly_name =
358 xml_getChildElementValue( p_device_element,
361 if ( !psz_friendly_name )
363 msg_Dbg( p_sd, "%s:%d: no friendlyName!", __FILE__, __LINE__ );
367 MediaServer* p_server = new MediaServer( psz_udn, psz_friendly_name, p_sd );
369 if ( !p_sd->p_sys->p_server_list->addServer( p_server ) )
377 // Check for ContentDirectory service...
378 IXML_NodeList* p_service_list =
379 ixmlElement_getElementsByTagName( p_device_element,
381 if ( p_service_list )
383 for ( unsigned int j = 0;
384 j < ixmlNodeList_length( p_service_list ); j++ )
386 IXML_Element* p_service_element =
387 ( IXML_Element* ) ixmlNodeList_item( p_service_list, j );
389 const char* psz_service_type =
390 xml_getChildElementValue( p_service_element,
392 if ( !psz_service_type )
395 if ( strcmp( CONTENT_DIRECTORY_SERVICE_TYPE,
396 psz_service_type ) != 0 )
399 const char* psz_event_sub_url =
400 xml_getChildElementValue( p_service_element,
402 if ( !psz_event_sub_url )
405 const char* psz_control_url =
406 xml_getChildElementValue( p_service_element,
408 if ( !psz_control_url )
411 // Try to subscribe to ContentDirectory service
413 char* psz_url = ( char* ) malloc( strlen( psz_base_url ) +
414 strlen( psz_event_sub_url ) + 1 );
417 char* psz_s1 = strdup( psz_base_url );
418 char* psz_s2 = strdup( psz_event_sub_url );
420 if ( UpnpResolveURL( psz_s1, psz_s2, psz_url ) ==
423 p_server->setContentDirectoryEventURL( psz_url );
424 p_server->subscribeToContentDirectory();
432 // Try to browse content directory...
434 psz_url = ( char* ) malloc( strlen( psz_base_url ) +
435 strlen( psz_control_url ) + 1 );
438 char* psz_s1 = strdup( psz_base_url );
439 char* psz_s2 = strdup( psz_control_url );
441 if ( UpnpResolveURL( psz_s1, psz_s2, psz_url ) ==
444 p_server->setContentDirectoryControlURL( psz_url );
445 p_server->fetchContents();
453 ixmlNodeList_free( p_service_list );
456 ixmlNodeList_free( p_device_list );
460 MediaServer::MediaServer( const char* psz_udn,
461 const char* psz_friendly_name,
462 services_discovery_t* p_sd )
467 _friendlyName = psz_friendly_name;
473 MediaServer::~MediaServer()
478 const char* MediaServer::getUDN() const
480 const char* s = _UDN.c_str();
484 const char* MediaServer::getFriendlyName() const
486 const char* s = _friendlyName.c_str();
490 void MediaServer::setContentDirectoryEventURL( const char* psz_url )
492 _contentDirectoryEventURL = psz_url;
495 const char* MediaServer::getContentDirectoryEventURL() const
497 const char* s = _contentDirectoryEventURL.c_str();
501 void MediaServer::setContentDirectoryControlURL( const char* psz_url )
503 _contentDirectoryControlURL = psz_url;
506 const char* MediaServer::getContentDirectoryControlURL() const
508 return _contentDirectoryControlURL.c_str();
511 void MediaServer::subscribeToContentDirectory()
513 const char* psz_url = getContentDirectoryEventURL();
514 if ( !psz_url || strcmp( psz_url, "" ) == 0 )
516 msg_Dbg( _p_sd, "No subscription url set!" );
520 int i_timeout = 1810;
523 int i_res = UpnpSubscribe( _p_sd->p_sys->client_handle, psz_url, &i_timeout, sid );
525 if ( i_res == UPNP_E_SUCCESS )
527 _subscriptionTimeOut = i_timeout;
528 memcpy( _subscriptionID, sid, sizeof( Upnp_SID ) );
533 "%s:%d: WARNING: '%s': %s", __FILE__, __LINE__,
534 getFriendlyName(), UpnpGetErrorMessage( i_res ) );
538 IXML_Document* MediaServer::_browseAction( const char* pObjectID,
539 const char* pBrowseFlag,
541 const char* pStartingIndex,
542 const char* pRequestedCount,
543 const char* pSortCriteria )
545 IXML_Document* p_action = 0;
546 IXML_Document* p_response = 0;
547 const char* psz_url = getContentDirectoryControlURL();
549 if ( !psz_url || strcmp( psz_url, "" ) == 0 )
551 msg_Dbg( _p_sd, "No subscription url set!" );
555 char* psz_object_id = strdup( pObjectID );
556 char* psz_browse_flag = strdup( pBrowseFlag );
557 char* psz_filter = strdup( pFilter );
558 char* psz_starting_index = strdup( pStartingIndex );
559 char* psz_requested_count = strdup( pRequestedCount );
560 char* psz_sort_criteria = strdup( pSortCriteria );
561 char* psz_service_type = strdup( CONTENT_DIRECTORY_SERVICE_TYPE );
565 i_res = UpnpAddToAction( &p_action, "Browse",
566 psz_service_type, "ObjectID", psz_object_id );
568 if ( i_res != UPNP_E_SUCCESS )
571 "%s:%d: ERROR: %s", __FILE__, __LINE__,
572 UpnpGetErrorMessage( i_res ) );
573 goto browseActionCleanup;
576 i_res = UpnpAddToAction( &p_action, "Browse",
577 psz_service_type, "BrowseFlag", psz_browse_flag );
579 if ( i_res != UPNP_E_SUCCESS )
582 "%s:%d: ERROR: %s", __FILE__, __LINE__,
583 UpnpGetErrorMessage( i_res ) );
584 goto browseActionCleanup;
587 i_res = UpnpAddToAction( &p_action, "Browse",
588 psz_service_type, "Filter", psz_filter );
590 if ( i_res != UPNP_E_SUCCESS )
593 "%s:%d: ERROR: %s", __FILE__, __LINE__,
594 UpnpGetErrorMessage( i_res ) );
595 goto browseActionCleanup;
598 i_res = UpnpAddToAction( &p_action, "Browse",
599 psz_service_type, "StartingIndex", psz_starting_index );
601 if ( i_res != UPNP_E_SUCCESS )
604 "%s:%d: ERROR: %s", __FILE__, __LINE__,
605 UpnpGetErrorMessage( i_res ) );
606 goto browseActionCleanup;
609 i_res = UpnpAddToAction( &p_action, "Browse",
610 psz_service_type, "RequestedCount", psz_requested_count );
612 if ( i_res != UPNP_E_SUCCESS )
615 "%s:%d: ERROR: %s", __FILE__, __LINE__,
616 UpnpGetErrorMessage( i_res ) ); goto browseActionCleanup; }
618 i_res = UpnpAddToAction( &p_action, "Browse",
619 psz_service_type, "SortCriteria", psz_sort_criteria );
621 if ( i_res != UPNP_E_SUCCESS )
624 "%s:%d: ERROR: %s", __FILE__, __LINE__,
625 UpnpGetErrorMessage( i_res ) );
626 goto browseActionCleanup;
629 i_res = UpnpSendAction( _p_sd->p_sys->client_handle,
631 CONTENT_DIRECTORY_SERVICE_TYPE,
636 if ( i_res != UPNP_E_SUCCESS )
639 "%s:%d: ERROR: %s when trying the send() action with URL: %s",
641 UpnpGetErrorMessage( i_res ), psz_url );
643 ixmlDocument_free( p_response );
649 free( psz_object_id );
650 free( psz_browse_flag );
652 free( psz_starting_index );
653 free( psz_requested_count );
654 free( psz_sort_criteria );
656 free( psz_service_type );
658 ixmlDocument_free( p_action );
662 void MediaServer::fetchContents()
664 Container* root = new Container( 0, "0", getFriendlyName() );
665 _fetchContents( root );
668 _contents->setInputItem( _inputItem );
670 _buildPlaylist( _contents, NULL );
673 bool MediaServer::_fetchContents( Container* p_parent )
678 "%s:%d: parent==NULL", __FILE__, __LINE__ );
682 IXML_Document* p_response = _browseAction( p_parent->getObjectID(),
683 "BrowseDirectChildren",
688 "%s:%d: ERROR! No response from browse() action",
689 __FILE__, __LINE__ );
693 IXML_Document* result = parseBrowseResult( p_response );
694 ixmlDocument_free( p_response );
699 "%s:%d: ERROR! browse() response parsing failed",
700 __FILE__, __LINE__ );
704 IXML_NodeList* containerNodeList =
705 ixmlDocument_getElementsByTagName( result, "container" );
707 if ( containerNodeList )
709 for ( unsigned int i = 0;
710 i < ixmlNodeList_length( containerNodeList ); i++ )
712 IXML_Element* containerElement =
713 ( IXML_Element* )ixmlNodeList_item( containerNodeList, i );
715 const char* objectID = ixmlElement_getAttribute( containerElement,
720 const char* childCountStr =
721 ixmlElement_getAttribute( containerElement, "childCount" );
723 if ( !childCountStr )
726 int childCount = atoi( childCountStr );
727 const char* title = xml_getChildElementValue( containerElement,
733 const char* resource = xml_getChildElementValue( containerElement,
736 if ( resource && childCount < 1 )
738 Item* item = new Item( p_parent, objectID, title, resource );
739 p_parent->addItem( item );
744 Container* container = new Container( p_parent, objectID, title );
745 p_parent->addContainer( container );
747 if ( childCount > 0 )
748 _fetchContents( container );
751 ixmlNodeList_free( containerNodeList );
754 IXML_NodeList* itemNodeList = ixmlDocument_getElementsByTagName( result,
758 for ( unsigned int i = 0; i < ixmlNodeList_length( itemNodeList ); i++ )
760 IXML_Element* itemElement =
761 ( IXML_Element* )ixmlNodeList_item( itemNodeList, i );
763 const char* objectID =
764 ixmlElement_getAttribute( itemElement, "id" );
770 xml_getChildElementValue( itemElement, "dc:title" );
775 const char* resource =
776 xml_getChildElementValue( itemElement, "res" );
781 Item* item = new Item( p_parent, objectID, title, resource );
782 p_parent->addItem( item );
784 ixmlNodeList_free( itemNodeList );
787 ixmlDocument_free( result );
791 void MediaServer::_buildPlaylist( Container* p_parent, input_item_node_t *p_input_node )
793 bool send = p_input_node == NULL;
795 p_input_node = input_item_node_Create( p_parent->getInputItem() );
797 for ( unsigned int i = 0; i < p_parent->getNumContainers(); i++ )
799 Container* container = p_parent->getContainer( i );
801 input_item_t* p_input_item = input_item_New( _p_sd, "vlc://nop", container->getTitle() );
802 input_item_node_t *p_new_node =
803 input_item_node_AppendItem( p_input_node, p_input_item );
805 container->setInputItem( p_input_item );
806 _buildPlaylist( container, p_new_node );
809 for ( unsigned int i = 0; i < p_parent->getNumItems(); i++ )
811 Item* item = p_parent->getItem( i );
813 input_item_t* p_input_item = input_item_New( _p_sd,
816 assert( p_input_item );
817 input_item_node_AppendItem( p_input_node, p_input_item );
818 item->setInputItem( p_input_item );
822 input_item_node_PostAndDelete( p_input_node );
825 void MediaServer::setInputItem( input_item_t* p_input_item )
827 if(_inputItem == p_input_item)
831 vlc_gc_decref( _inputItem );
833 vlc_gc_incref( p_input_item );
834 _inputItem = p_input_item;
837 bool MediaServer::compareSID( const char* sid )
839 return ( strncmp( _subscriptionID, sid, sizeof( Upnp_SID ) ) == 0 );
843 // MediaServerList...
845 MediaServerList::MediaServerList( services_discovery_t* p_sd )
850 MediaServerList::~MediaServerList()
852 for ( unsigned int i = 0; i < _list.size(); i++ )
858 bool MediaServerList::addServer( MediaServer* s )
860 input_item_t* p_input_item = NULL;
861 if ( getServer( s->getUDN() ) != 0 ) return false;
863 msg_Dbg( _p_sd, "Adding server '%s'",
864 s->getFriendlyName() );
866 services_discovery_t* p_sd = _p_sd;
868 p_input_item = input_item_New( p_sd, "vlc://nop", s->getFriendlyName() );
869 s->setInputItem( p_input_item );
871 services_discovery_AddItem( p_sd, p_input_item, NULL );
873 _list.push_back( s );
878 MediaServer* MediaServerList::getServer( const char* psz_udn )
880 MediaServer* result = 0;
882 for ( unsigned int i = 0; i < _list.size(); i++ )
884 if( strcmp( psz_udn, _list[i]->getUDN() ) == 0 )
894 MediaServer* MediaServerList::getServerBySID( const char* sid )
896 MediaServer* p_server = 0;
898 for ( unsigned int i = 0; i < _list.size(); i++ )
900 if ( _list[i]->compareSID( sid ) )
910 void MediaServerList::removeServer( const char* psz_udn )
912 MediaServer* p_server = getServer( psz_udn );
913 if ( !p_server ) return;
916 "Removing server '%s'", p_server->getFriendlyName() );
918 std::vector<MediaServer*>::iterator it;
919 for ( it = _list.begin(); it != _list.end(); it++ )
921 if ( *it == p_server )
933 Item::Item( Container* p_parent, const char* objectID, const char* title, const char* resource )
937 _objectID = objectID;
939 _resource = resource;
947 vlc_gc_decref( _inputItem );
950 const char* Item::getObjectID() const
952 return _objectID.c_str();
955 const char* Item::getTitle() const
957 return _title.c_str();
960 const char* Item::getResource() const
962 return _resource.c_str();
965 void Item::setInputItem( input_item_t* p_input_item )
967 if(_inputItem == p_input_item)
971 vlc_gc_decref( _inputItem );
973 vlc_gc_incref( p_input_item );
974 _inputItem = p_input_item;
977 input_item_t* Item::getInputItem() const
985 Container::Container( Container* p_parent,
986 const char* objectID,
991 _objectID = objectID;
997 Container::~Container()
999 for ( unsigned int i = 0; i < _containers.size(); i++ )
1001 delete _containers[i];
1004 for ( unsigned int i = 0; i < _items.size(); i++ )
1010 vlc_gc_decref( _inputItem );
1013 void Container::addItem( Item* item )
1015 _items.push_back( item );
1018 void Container::addContainer( Container* container )
1020 _containers.push_back( container );
1023 const char* Container::getObjectID() const
1025 return _objectID.c_str();
1028 const char* Container::getTitle() const
1030 return _title.c_str();
1033 unsigned int Container::getNumItems() const
1035 return _items.size();
1038 unsigned int Container::getNumContainers() const
1040 return _containers.size();
1043 Item* Container::getItem( unsigned int i ) const
1045 if ( i < _items.size() ) return _items[i];
1049 Container* Container::getContainer( unsigned int i ) const
1051 if ( i < _containers.size() ) return _containers[i];
1055 Container* Container::getParent()
1060 void Container::setInputItem( input_item_t* p_input_item )
1062 if(_inputItem == p_input_item)
1066 vlc_gc_decref( _inputItem );
1068 vlc_gc_incref( p_input_item );
1069 _inputItem = p_input_item;
1072 input_item_t* Container::getInputItem() const