1 /*****************************************************************************
3 *****************************************************************************
4 * Copyright (C) 2018 VLC authors and VideoLAN
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation; either version 2.1 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
19 *****************************************************************************/
21 #ifndef VLC_PLAYLIST_NOTIFY_H
22 #define VLC_PLAYLIST_NOTIFY_H
24 #include <vlc_common.h>
27 typedef struct vlc_playlist vlc_playlist_t
;
29 struct vlc_playlist_listener_id
31 const struct vlc_playlist_callbacks
*cbs
;
33 struct vlc_list node
; /**< node of vlc_playlist.listeners */
36 struct vlc_playlist_state
{
42 #define vlc_playlist_listener_foreach(listener, playlist) \
43 vlc_list_foreach(listener, &(playlist)->listeners, node)
45 #define vlc_playlist_NotifyListener(playlist, listener, event, ...) \
47 if (listener->cbs->event) \
48 listener->cbs->event(playlist, ##__VA_ARGS__, listener->userdata); \
51 #define vlc_playlist_Notify(playlist, event, ...) \
53 vlc_playlist_AssertLocked(playlist); \
54 vlc_playlist_listener_id *listener; \
55 vlc_playlist_listener_foreach(listener, playlist) \
56 vlc_playlist_NotifyListener(playlist, listener, event, ##__VA_ARGS__); \
60 vlc_playlist_state_Save(vlc_playlist_t
*playlist
,
61 struct vlc_playlist_state
*state
);
64 vlc_playlist_state_NotifyChanges(vlc_playlist_t
*playlist
,
65 struct vlc_playlist_state
*saved_state
);
68 vlc_playlist_NotifyMediaUpdated(vlc_playlist_t
*playlist
, input_item_t
*media
);