Changeset 6d9dc5e30f426ff5603ef472723b8d78922235ae

Show
Ignore:
Timestamp:
28/08/07 03:51:58 (1 year ago)
Author:
Pierre d'Herbemont <pdherbemont@videolan.org>
git-committer:
Pierre d'Herbemont <pdherbemont@videolan.org> 1188265918 +0000
git-parent:

[59604e796e58b2f4a658f0ddea865bba359ed10a]

git-author:
Pierre d'Herbemont <pdherbemont@videolan.org> 1188265918 +0000
Message:

control/media_list.c: Don't send MediaListItemChanged?. Listen to the MediaDescriptor?* events if you need the equivalent.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • include/vlc/libvlc_structures.h

    r489efb1 r6d9dc5e  
    309309    libvlc_MediaListItemAdded, 
    310310    libvlc_MediaListItemDeleted, 
    311     libvlc_MediaListItemChanged, 
    312311 
    313312    libvlc_MediaListPlayerPlayed, 
     
    361360            int index; 
    362361        } media_list_item_deleted; 
    363         struct 
    364         { 
    365             libvlc_media_descriptor_t * item; 
    366             int index; 
    367         } media_list_item_changed; 
    368362 
    369363        /* Tree */ 
  • src/control/media_list.c

    r58c603a r6d9dc5e  
    7373    /* Send the event */ 
    7474    libvlc_event_send( p_mlist->p_event_manager, &event ); 
    75 } 
    76  
    77 /************************************************************************** 
    78  *       media_descriptor_changed (private) (libvlc Event Callback ) 
    79  * 
    80  * An item has changed. 
    81  **************************************************************************/ 
    82 static void 
    83 media_descriptor_changed( const libvlc_event_t * p_event, void * user_data ) 
    84 { 
    85     libvlc_media_list_t * p_mlist = user_data; 
    86     libvlc_media_descriptor_t * p_md = p_event->p_obj; 
    87     libvlc_event_t event; 
    88      
    89     /* Construct the new media list event */ 
    90     event.type = libvlc_MediaListItemChanged; 
    91     event.u.media_list_item_changed.item = p_md; 
    92  
    93     /* XXX: this is not good, but there is a solution in the pipeline */ 
    94     event.u.media_list_item_changed.index = 
    95         libvlc_media_list_index_of_item( p_mlist, p_md, NULL ); 
    96  
    97     /* Send the event */ 
    98     libvlc_event_send( p_mlist->p_event_manager, &event ); 
    99 } 
    100  
    101 /************************************************************************** 
    102  *       media_descriptor_subitem_added (private) (libvlc Event Callback ) 
    103  * 
    104  * An item (which is a playlist) has gained sub child. 
    105  **************************************************************************/ 
    106 static void 
    107 media_descriptor_subitem_added( const libvlc_event_t * p_event, void * user_data ) 
    108 { 
    109     /* Todo: Just forward that event to our event_manager */ 
    110 } 
    111  
    112 /************************************************************************** 
    113  *       install_media_descriptor_observer (private) 
    114  * 
    115  * Do the appropriate action when an item is deleted. 
    116  **************************************************************************/ 
    117 static void 
    118 install_media_descriptor_observer( libvlc_media_list_t * p_mlist, 
    119                                    libvlc_media_descriptor_t * p_md ) 
    120 { 
    121     libvlc_event_attach( p_md->p_event_manager, 
    122                          libvlc_MediaDescriptorMetaChanged, 
    123                          media_descriptor_changed, 
    124                          p_mlist, NULL ); 
    125     libvlc_event_attach( p_md->p_event_manager, 
    126                          libvlc_MediaDescriptorSubItemAdded, 
    127                          media_descriptor_subitem_added, 
    128                          p_mlist, NULL ); 
    129 } 
    130  
    131 /************************************************************************** 
    132  *       uninstall_media_descriptor_observer (private) 
    133  * 
    134  * Do the appropriate action when an item is deleted. 
    135  **************************************************************************/ 
    136 static void 
    137 uninstall_media_descriptor_observer( libvlc_media_list_t * p_mlist, 
    138                                      libvlc_media_descriptor_t * p_md ) 
    139 { 
    140     libvlc_event_detach( p_md->p_event_manager, 
    141                          libvlc_MediaDescriptorMetaChanged, 
    142                          media_descriptor_changed, 
    143                          p_mlist, NULL ); 
    144     libvlc_event_detach( p_md->p_event_manager, 
    145                          libvlc_MediaDescriptorSubItemAdded, 
    146                          media_descriptor_subitem_added, 
    147                          p_mlist, NULL ); 
    14875} 
    14976 
     
    223150 
    224151    FOREACH_ARRAY( p_md, p_mlist->items ) 
    225         uninstall_media_descriptor_observer( p_mlist, p_md ); 
    226152        libvlc_media_descriptor_release( p_md ); 
    227153    FOREACH_END() 
     
    339265    ARRAY_INSERT( p_mlist->items, p_md, p_mlist->items.i_size ); 
    340266    notify_item_addition( p_mlist, p_md, p_mlist->items.i_size-1 ); 
    341     install_media_descriptor_observer( p_mlist, p_md ); 
    342267} 
    343268 
     
    358283    ARRAY_INSERT( p_mlist->items, p_md, index); 
    359284    notify_item_addition( p_mlist, p_md, index ); 
    360     install_media_descriptor_observer( p_mlist, p_md ); 
    361285} 
    362286 
     
    373297 
    374298    p_md = ARRAY_VAL( p_mlist->items, index ); 
    375  
    376     uninstall_media_descriptor_observer( p_mlist, p_md ); 
    377299 
    378300    ARRAY_REMOVE( p_mlist->items, index )