forked from videolan/vlc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
notify.h
70 lines (58 loc) · 2.37 KB
/
notify.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*****************************************************************************
* playlist/notify.h
*****************************************************************************
* Copyright (C) 2018 VLC authors and VideoLAN
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef VLC_PLAYLIST_NOTIFY_H
#define VLC_PLAYLIST_NOTIFY_H
#include <vlc_common.h>
#include <vlc_list.h>
typedef struct vlc_playlist vlc_playlist_t;
struct vlc_playlist_listener_id
{
const struct vlc_playlist_callbacks *cbs;
void *userdata;
struct vlc_list node; /**< node of vlc_playlist.listeners */
};
struct vlc_playlist_state {
ssize_t current;
bool has_prev;
bool has_next;
};
#define vlc_playlist_listener_foreach(listener, playlist) \
vlc_list_foreach(listener, &(playlist)->listeners, node)
#define vlc_playlist_NotifyListener(playlist, listener, event, ...) \
do { \
if (listener->cbs->event) \
listener->cbs->event(playlist, ##__VA_ARGS__, listener->userdata); \
} while (0)
#define vlc_playlist_Notify(playlist, event, ...) \
do { \
vlc_playlist_AssertLocked(playlist); \
vlc_playlist_listener_id *listener; \
vlc_playlist_listener_foreach(listener, playlist) \
vlc_playlist_NotifyListener(playlist, listener, event, ##__VA_ARGS__); \
} while(0)
void
vlc_playlist_state_Save(vlc_playlist_t *playlist,
struct vlc_playlist_state *state);
void
vlc_playlist_state_NotifyChanges(vlc_playlist_t *playlist,
struct vlc_playlist_state *saved_state);
void
vlc_playlist_NotifyMediaUpdated(vlc_playlist_t *playlist, input_item_t *media);
#endif