Commit 195e8427 authored by Clément Stenac's avatar Clément Stenac

* DAAP: add meta-information, delete hosts when they leave

* SAP : coding style fixes
* Some fogotten playlist_*Info
parent 6c0ceeb3
...@@ -670,7 +670,8 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/ ...@@ -670,7 +670,8 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
vlc_mutex_lock( &p_playlist->object_lock ); vlc_mutex_lock( &p_playlist->object_lock );
o_current_name = [NSString stringWithUTF8String: o_current_name = [NSString stringWithUTF8String:
p_item->pp_children[i_current]->input.psz_name]; p_item->pp_children[i_current]->input.psz_name];
psz_temp = playlist_ItemGetInfo(p_item ,_("Meta-information"),_("Author") ); psz_temp = vlc_input_item_GetInfo(&p_item->input ,
_("Meta-information"),_("Author") );
o_current_author = [NSString stringWithUTF8String: psz_temp]; o_current_author = [NSString stringWithUTF8String: psz_temp];
free( psz_temp); free( psz_temp);
vlc_mutex_unlock( &p_playlist->object_lock ); vlc_mutex_unlock( &p_playlist->object_lock );
...@@ -1003,7 +1004,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/ ...@@ -1003,7 +1004,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
else if( [[o_tc identifier] isEqualToString:@"2"] ) else if( [[o_tc identifier] isEqualToString:@"2"] )
{ {
char *psz_temp; char *psz_temp;
psz_temp = playlist_ItemGetInfo( p_item ,_("Meta-information"),_("Artist") ); psz_temp = vlc_input_item_GetInfo( &p_item->input ,_("Meta-information"),_("Artist") );
if( psz_temp == NULL ) if( psz_temp == NULL )
o_value = @""; o_value = @"";
......
...@@ -115,7 +115,7 @@ ...@@ -115,7 +115,7 @@
[NSString stringWithUTF8String:p_item->input.psz_name]]; [NSString stringWithUTF8String:p_item->input.psz_name]];
} }
psz_temp = playlist_ItemGetInfo( p_item, _("General"), _("Author") ); psz_temp = vlc_input_item_GetInfo( &p_item->input, _("General"), _("Author") );
vlc_mutex_unlock( &p_item->input.lock ); vlc_mutex_unlock( &p_item->input.lock );
if( psz_temp ) if( psz_temp )
......
...@@ -613,7 +613,7 @@ void Playlist::UpdateItem( int i ) ...@@ -613,7 +613,7 @@ void Playlist::UpdateItem( int i )
ListView_SetItemText( hListView, i, 0, _FROMMB(p_item->input.psz_name) ); ListView_SetItemText( hListView, i, 0, _FROMMB(p_item->input.psz_name) );
ListView_SetItemText( hListView, i, 1, ListView_SetItemText( hListView, i, 1,
_FROMMB( playlist_ItemGetInfo( p_item, _FROMMB( vlc_input_item_GetInfo( &p_item->input,
_("General") , _("Author") ) ) ); _("General") , _("Author") ) ) );
char psz_duration[MSTRTIME_MAX_SIZE]; char psz_duration[MSTRTIME_MAX_SIZE];
......
...@@ -64,7 +64,8 @@ int Export_M3U( vlc_object_t *p_this ) ...@@ -64,7 +64,8 @@ int Export_M3U( vlc_object_t *p_this )
p_playlist->pp_items[i]->input.psz_uri ) ) p_playlist->pp_items[i]->input.psz_uri ) )
{ {
char *psz_author = char *psz_author =
playlist_GetInfo( p_playlist, i, _("General"), _("Author") ); vlc_input_item_GetInfo( &p_playlist->pp_items[i]->input,
_("General"), _("Author") );
fprintf( p_export->p_file, "#EXTINF:%i,%s,%s\n", fprintf( p_export->p_file, "#EXTINF:%i,%s,%s\n",
(int)(p_playlist->pp_items[i]->input.i_duration/1000000), (int)(p_playlist->pp_items[i]->input.i_duration/1000000),
......
...@@ -454,11 +454,27 @@ static void OnHostsUpdate( services_discovery_t *p_sd ) ...@@ -454,11 +454,27 @@ static void OnHostsUpdate( services_discovery_t *p_sd )
{ {
int i; int i;
for( i = 0 ; i< p_sd->p_sys->p_db->i_hosts ; i ++ )
{
p_sd->p_sys->p_db->pp_hosts[i]->b_updated = VLC_FALSE;
p_sd->p_sys->p_db->pp_hosts[i]->b_new = VLC_FALSE;
}
vlc_mutex_lock( &p_sd->p_sys->p_db->search_lock ); vlc_mutex_lock( &p_sd->p_sys->p_db->search_lock );
DAAP_Client_EnumerateHosts( p_sd->p_sys->p_client, EnumerateCallback, p_sd); DAAP_Client_EnumerateHosts( p_sd->p_sys->p_client, EnumerateCallback, p_sd);
for( i = 0 ; i< p_sd->p_sys->p_db->i_hosts ; i ++ )
{
if( p_sd->p_sys->p_db->pp_hosts[i]->b_updated == VLC_FALSE )
{
host_t *p_host = p_sd->p_sys->p_db->pp_hosts[i];
FreeHost( p_sd, p_host );
REMOVE_ELEM( p_sd->p_sys->p_db->pp_hosts,
p_sd->p_sys->p_db->i_hosts, i );
}
}
vlc_mutex_unlock( &p_sd->p_sys->p_db->search_lock ); vlc_mutex_unlock( &p_sd->p_sys->p_db->search_lock );
/* FIXME: Handle the list better: remove old hosts, ... */
for( i = 0 ; i< p_sd->p_sys->p_db->i_hosts ; i ++ ) for( i = 0 ; i< p_sd->p_sys->p_db->i_hosts ; i ++ )
{ {
if( p_sd->p_sys->p_db->pp_hosts[i]->b_new ) if( p_sd->p_sys->p_db->pp_hosts[i]->b_new )
...@@ -585,6 +601,10 @@ static void ProcessHost( services_discovery_t *p_sd, host_t *p_host ) ...@@ -585,6 +601,10 @@ static void ProcessHost( services_discovery_t *p_sd, host_t *p_host )
p_host->p_songs[i].id ); p_host->p_songs[i].id );
p_item = playlist_ItemNew( p_sd, psz_buff, p_item = playlist_ItemNew( p_sd, psz_buff,
p_host->p_songs[i].itemname ); p_host->p_songs[i].itemname );
vlc_input_item_AddInfo( &p_item->input, _("Meta-Information"),
_("Artist"), p_host->p_songs[i].songartist );
vlc_input_item_AddInfo( &p_item->input, _("Meta-Information"),
_("Album"), p_host->p_songs[i].songalbum );
playlist_NodeAddItem( p_playlist, p_item, VIEW_CATEGORY, playlist_NodeAddItem( p_playlist, p_item, VIEW_CATEGORY,
p_host->p_node, PLAYLIST_APPEND, PLAYLIST_END ); p_host->p_node, PLAYLIST_APPEND, PLAYLIST_END );
...@@ -598,11 +618,21 @@ static void ProcessHost( services_discovery_t *p_sd, host_t *p_host ) ...@@ -598,11 +618,21 @@ static void ProcessHost( services_discovery_t *p_sd, host_t *p_host )
static void FreeHost( services_discovery_t *p_sd, host_t *p_host ) static void FreeHost( services_discovery_t *p_sd, host_t *p_host )
{ {
playlist_t *p_playlist;
if( p_host->p_host ) if( p_host->p_host )
{ {
DAAP_ClientHost_Disconnect( p_host->p_host ); DAAP_ClientHost_Disconnect( p_host->p_host );
DAAP_ClientHost_Release( p_host->p_host ); DAAP_ClientHost_Release( p_host->p_host );
} }
p_playlist = (playlist_t *) vlc_object_find( p_sd, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
if( p_playlist )
{
playlist_NodeDelete( p_playlist, p_host->p_node, VLC_TRUE );
vlc_object_release( p_playlist );
}
if( p_host->p_songs ) free( p_host->p_songs ); if( p_host->p_songs ) free( p_host->p_songs );
} }
...@@ -358,7 +358,6 @@ static int OpenDemux( vlc_object_t *p_this ) ...@@ -358,7 +358,6 @@ static int OpenDemux( vlc_object_t *p_this )
return VLC_EGENERIC; return VLC_EGENERIC;
} }
/* Probe for SDP */ /* Probe for SDP */
if( p_demux->s ) if( p_demux->s )
{ {
...@@ -383,7 +382,6 @@ static int OpenDemux( vlc_object_t *p_this ) ...@@ -383,7 +382,6 @@ static int OpenDemux( vlc_object_t *p_this )
&psz_sdp[i_sdp], i_max_sdp - i_sdp - 1 ); &psz_sdp[i_sdp], i_max_sdp - i_sdp - 1 );
if( i_read < 0 ) if( i_read < 0 )
{ {
msg_Err( p_demux, "failed to read SDP" ); msg_Err( p_demux, "failed to read SDP" );
goto error; goto error;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment