| 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 ); |
|---|