VLC  4.0.0-dev
notify.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * playlist/notify.h
3  *****************************************************************************
4  * Copyright (C) 2018 VLC authors and VideoLAN
5  *
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.
10  *
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.
15  *
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  *****************************************************************************/
20 
21 #ifndef VLC_PLAYLIST_NOTIFY_H
22 #define VLC_PLAYLIST_NOTIFY_H
23 
24 #include <vlc_common.h>
25 #include <vlc_list.h>
26 
28 
30 {
31  const struct vlc_playlist_callbacks *cbs;
32  void *userdata;
33  struct vlc_list node; /**< node of vlc_playlist.listeners */
34 };
35 
37  ssize_t current;
38  bool has_prev;
39  bool has_next;
40 };
41 
42 #define vlc_playlist_listener_foreach(listener, playlist) \
43  vlc_list_foreach(listener, &(playlist)->listeners, node)
44 
45 #define vlc_playlist_NotifyListener(playlist, listener, event, ...) \
46 do { \
47  if (listener->cbs->event) \
48  listener->cbs->event(playlist, ##__VA_ARGS__, listener->userdata); \
49 } while (0)
50 
51 #define vlc_playlist_Notify(playlist, event, ...) \
52 do { \
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__); \
57 } while(0)
58 
59 void
61  struct vlc_playlist_state *state);
62 
63 void
65  struct vlc_playlist_state *saved_state);
66 
67 void
69 
70 #endif
Definition: playlist.h:48
void * userdata
Definition: notify.h:32
Describes an input and is used to spawn input_thread_t objects.
Definition: vlc_input_item.h:77
static thread_local struct @77 state
This file is a collection of common definitions and types.
void vlc_playlist_NotifyMediaUpdated(vlc_playlist_t *playlist, input_item_t *media)
Definition: notify.c:113
bool has_prev
Definition: notify.h:38
bool has_next
Definition: notify.h:39
void vlc_playlist_state_Save(vlc_playlist_t *playlist, struct vlc_playlist_state *state)
Definition: notify.c:82
This provides convenience helpers for linked lists.
Definition: notify.h:36
Definition: notify.h:29
void vlc_playlist_state_NotifyChanges(vlc_playlist_t *playlist, struct vlc_playlist_state *saved_state)
Definition: notify.c:91
Doubly-linked list node.
Definition: vlc_list.h:43
const struct vlc_playlist_callbacks * cbs
Definition: notify.h:31
ssize_t current
Definition: notify.h:37
Playlist callbacks.
Definition: vlc_playlist.h:164