wxL2U( p_node->pp_children[i]->input.psz_name ), -1,-1,
new PlaylistItem( p_node->pp_children[i]) );
+ UpdateTreeItem( p_playlist, item );
+
treectrl->SetItemImage( item,
p_node->pp_children[i]->input.i_type );
}
wxTreeItemId item = FindItem( treectrl->GetRootItem(), p_item);
- UpdateTreeItem( p_playlist, item );
+ if( item.IsOk() )
+ {
+ UpdateTreeItem( p_playlist, item );
+ }
vlc_object_release(p_playlist);
-
}
void Playlist::UpdateTreeItem( playlist_t *p_playlist ,wxTreeItemId item )
{
- playlist_item_t *p_item;
-
- if( !item.IsOk() )
- {
- return;
- }
-
- p_item = ((PlaylistItem *)treectrl->GetItemData( item ))->p_item;
+ playlist_item_t *p_item =
+ ((PlaylistItem *)treectrl->GetItemData( item ))->p_item;
if( !p_item )
{
wxString msg;
char *psz_author = playlist_ItemGetInfo( p_item, _("Meta-information"),
- _("Artist"));
+ _("Artist"));
char psz_duration[MSTRTIME_MAX_SIZE];
mtime_t dur = p_item->input.i_duration;
+
if( dur != -1 )
secstotimestr( psz_duration, dur/1000000 );
else
memcpy( psz_duration, "-:--:--", sizeof("-:--:--") );
- if( !strcmp( psz_author, "" ) )
+ if( !strcmp( psz_author, "" ) || p_item->input.b_fixed_name == VLC_TRUE )
{
msg.Printf( wxString( wxL2U( p_item->input.psz_name ) ) + wxU( " ( ") +
wxString(wxL2U(psz_duration ) ) + wxU( ")") );
{
return;
}
-#if 0
- /* Update the colour of items */
- int i_playlist_index = p_playlist->i_index;
- if( p_intf->p_sys->i_playing != i_playlist_index )
- {
- wxListItem listitem;
- listitem.m_itemId = i_playlist_index;
- listitem.SetTextColour( *wxRED );
- listview->SetItem( listitem );
- if( p_intf->p_sys->i_playing != -1 )
- {
- listitem.m_itemId = p_intf->p_sys->i_playing;
- listitem.SetTextColour( *wxBLACK );
- listview->SetItem( listitem );
- }
- p_intf->p_sys->i_playing = i_playlist_index;
- }
-#endif
vlc_object_release( p_playlist );
}
/* Gather the complete sdp file */
for( ;; )
{
- fprintf(stderr,"read %i at %p\n",i_max_sdp - i_sdp - 1, &psz_sdp[i_sdp]);
int i_read = stream_Read( p_demux->s,
&psz_sdp[i_sdp], i_max_sdp - i_sdp - 1 );
p_sdp = ParseSDP( VLC_OBJECT(p_demux), psz_sdp );
- if( !p_sdp ) return -1;
+ if( !p_sdp )
+ {
+ msg_Warn( p_demux, "invalid SDP");
+ return -1;
+ }
if( p_sdp->i_media > 1 )
{
static sdp_t * ParseSDP( vlc_object_t *p_obj, char* psz_sdp )
{
sdp_t *p_sdp;
+ vlc_bool_t b_invalid = VLC_FALSE;
if( psz_sdp == NULL )
{
p_sdp->psz_sessionname = NULL;
p_sdp->psz_media = NULL;
p_sdp->psz_connection = NULL;
+ p_sdp->psz_uri = NULL;
+ p_sdp->psz_address = NULL;
+ p_sdp->psz_address_type= NULL;
p_sdp->i_media = 0;
p_sdp->i_attributes = 0;
break;
case ( 'o' ):
{
+ int i_field = 0;
/* o field is <username> <session id> <version>
* <network type> <address type> <address> */
-#define GET_FIELD( store ) \
+#define GET_FIELD( store ) \
psz_eof = strchr( psz_parse, ' ' ); \
- if( psz_eof ) { *psz_eof=0; store = strdup( psz_parse ); } \
- else { store = strdup( psz_parse );}; psz_parse = psz_eof + 1 ;
+ if( psz_eof ) \
+ { \
+ *psz_eof=0; store = strdup( psz_parse ); \
+ } \
+ else \
+ { \
+ if( i_field != 5 ) \
+ { \
+ b_invalid = VLC_TRUE; break; \
+ } \
+ }; \
+ psz_parse = psz_eof + 1; i_field++;
+
psz_parse = &psz_sdp[2];
GET_FIELD( p_sdp->psz_username );
break;
}
+ if( b_invalid )
+ {
+ FreeSDP( p_sdp );
+ return NULL;
+ }
+
psz_sdp = psz_eol;
}
FREE( p_sdp->psz_connection );
FREE( p_sdp->psz_media );
FREE( p_sdp->psz_uri );
+
+ FREE( p_sdp->psz_address );
+ FREE( p_sdp->psz_address_type );
+
for( i= p_sdp->i_attributes - 1; i >= 0 ; i-- )
{
struct attribute_t *p_attr = p_sdp->pp_attributes[i];