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*/
vlc_mutex_lock( &p_playlist->object_lock );
o_current_name = [NSString stringWithUTF8String:
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];
free( psz_temp);
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*/
else if( [[o_tc identifier] isEqualToString:@"2"] )
{
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 )
o_value = @"";
......
......@@ -115,7 +115,7 @@
[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 );
if( psz_temp )
......
......@@ -613,7 +613,7 @@ void Playlist::UpdateItem( int i )
ListView_SetItemText( hListView, i, 0, _FROMMB(p_item->input.psz_name) );
ListView_SetItemText( hListView, i, 1,
_FROMMB( playlist_ItemGetInfo( p_item,
_FROMMB( vlc_input_item_GetInfo( &p_item->input,
_("General") , _("Author") ) ) );
char psz_duration[MSTRTIME_MAX_SIZE];
......
......@@ -64,7 +64,8 @@ int Export_M3U( vlc_object_t *p_this )
p_playlist->pp_items[i]->input.psz_uri ) )
{
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",
(int)(p_playlist->pp_items[i]->input.i_duration/1000000),
......
......@@ -454,11 +454,27 @@ static void OnHostsUpdate( services_discovery_t *p_sd )
{
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 );
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 );
/* FIXME: Handle the list better: remove old hosts, ... */
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 )
......@@ -585,6 +601,10 @@ static void ProcessHost( services_discovery_t *p_sd, host_t *p_host )
p_host->p_songs[i].id );
p_item = playlist_ItemNew( p_sd, psz_buff,
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,
p_host->p_node, PLAYLIST_APPEND, PLAYLIST_END );
......@@ -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 )
{
playlist_t *p_playlist;
if( p_host->p_host )
{
DAAP_ClientHost_Disconnect( 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 );
}
......@@ -358,7 +358,6 @@ static int OpenDemux( vlc_object_t *p_this )
return VLC_EGENERIC;
}
/* Probe for SDP */
if( p_demux->s )
{
......@@ -381,9 +380,8 @@ static int OpenDemux( vlc_object_t *p_this )
{
int i_read = stream_Read( p_demux->s,
&psz_sdp[i_sdp], i_max_sdp - i_sdp - 1 );
if( i_read < 0 )
{
msg_Err( p_demux, "failed to read SDP" );
goto error;
......@@ -400,27 +398,27 @@ static int OpenDemux( vlc_object_t *p_this )
i_max_sdp += 1000;
psz_sdp = (uint8_t*)realloc( psz_sdp, i_max_sdp );
}
p_sdp = ParseSDP( VLC_OBJECT(p_demux), psz_sdp );
if( !p_sdp )
{
msg_Warn( p_demux, "invalid SDP");
goto error;
}
if( p_sdp->i_media > 1 )
{
goto error;
}
if( ParseConnection( VLC_OBJECT( p_demux ), p_sdp ) )
{
p_sdp->psz_uri = NULL;
}
if( p_sdp->i_media_type != 33 && p_sdp->i_media_type != 32 && p_sdp->i_media_type != 14 )
goto error;
if( p_sdp->psz_uri == NULL ) goto error;
p_demux->p_sys = (demux_sys_t *)malloc( sizeof(demux_sys_t) );
......@@ -431,7 +429,7 @@ static int OpenDemux( vlc_object_t *p_this )
free( psz_sdp );
if( p_sdp ) FreeSDP( p_sdp );
return VLC_SUCCESS;
error:
free( psz_sdp );
if( p_sdp ) FreeSDP( p_sdp );
......
......@@ -338,7 +338,7 @@ int playlist_NodeEmpty( playlist_t *p_playlist, playlist_item_t *p_root,
if( p_root->pp_children[i]->i_children > -1 )
{
playlist_NodeDelete( p_playlist, p_root->pp_children[i],
b_delete_items );
b_delete_items );
}
else if( b_delete_items )
{
......
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