1 /*****************************************************************************
2 * Copyright (C) 2019 VLC authors and VideoLAN
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * ( at your option ) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
17 *****************************************************************************/
20 #include <vlc_media_library.h>
23 * Owned (and simplified) version of vlc_ml_event_t, which can be copied and
24 * moved to another thread.
36 vlc_ml_media_subtype_t i_subtype
;
51 } background_idle_changed
;
56 } media_thumbnail_generated
;
59 explicit MLEvent(const vlc_ml_event_t
*event
)
61 i_type
= event
->i_type
;
62 switch (event
->i_type
)
64 case VLC_ML_EVENT_MEDIA_ADDED
:
65 creation
.i_entity_id
= event
->creation
.p_media
->i_id
;
66 creation
.media
.i_subtype
= event
->creation
.p_media
->i_subtype
;
68 case VLC_ML_EVENT_ARTIST_ADDED
:
69 creation
.i_entity_id
= event
->creation
.p_artist
->i_id
;
71 case VLC_ML_EVENT_ALBUM_ADDED
:
72 creation
.i_entity_id
= event
->creation
.p_album
->i_id
;
74 case VLC_ML_EVENT_GROUP_ADDED
:
75 creation
.i_entity_id
= event
->creation
.p_group
->i_id
;
77 case VLC_ML_EVENT_PLAYLIST_ADDED
:
78 creation
.i_entity_id
= event
->creation
.p_playlist
->i_id
;
80 case VLC_ML_EVENT_GENRE_ADDED
:
81 creation
.i_entity_id
= event
->creation
.p_genre
->i_id
;
83 case VLC_ML_EVENT_BOOKMARKS_ADDED
:
84 creation
.i_entity_id
= event
->creation
.p_bookmark
->i_media_id
;
86 case VLC_ML_EVENT_MEDIA_UPDATED
:
87 case VLC_ML_EVENT_ARTIST_UPDATED
:
88 case VLC_ML_EVENT_ALBUM_UPDATED
:
89 case VLC_ML_EVENT_GROUP_UPDATED
:
90 case VLC_ML_EVENT_PLAYLIST_UPDATED
:
91 case VLC_ML_EVENT_GENRE_UPDATED
:
92 case VLC_ML_EVENT_BOOKMARKS_UPDATED
:
93 modification
.i_entity_id
= event
->modification
.i_entity_id
;
95 case VLC_ML_EVENT_MEDIA_DELETED
:
96 case VLC_ML_EVENT_ARTIST_DELETED
:
97 case VLC_ML_EVENT_ALBUM_DELETED
:
98 case VLC_ML_EVENT_GROUP_DELETED
:
99 case VLC_ML_EVENT_PLAYLIST_DELETED
:
100 case VLC_ML_EVENT_GENRE_DELETED
:
101 case VLC_ML_EVENT_BOOKMARKS_DELETED
:
102 deletion
.i_entity_id
= event
->deletion
.i_entity_id
;
104 case VLC_ML_EVENT_BACKGROUND_IDLE_CHANGED
:
105 background_idle_changed
.b_idle
= event
->background_idle_changed
.b_idle
;
107 case VLC_ML_EVENT_MEDIA_THUMBNAIL_GENERATED
:
108 media_thumbnail_generated
.i_media_id
= event
->media_thumbnail_generated
.p_media
->i_id
;
109 media_thumbnail_generated
.b_success
= event
->media_thumbnail_generated
.b_success
;