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{
32 void *userdata;
33 struct vlc_list node; /**< node of vlc_playlist.listeners */
34};
35
37 ssize_t current;
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, ...) \
46do { \
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, ...) \
52do { \
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
59void
62
63void
65 struct vlc_playlist_state *saved_state);
66
67void
69
70#endif
static thread_local struct @81 state
void vlc_playlist_state_Save(vlc_playlist_t *playlist, struct vlc_playlist_state *state)
Definition: notify.c:82
void vlc_playlist_state_NotifyChanges(vlc_playlist_t *playlist, struct vlc_playlist_state *saved_state)
Definition: notify.c:91
void vlc_playlist_NotifyMediaUpdated(vlc_playlist_t *playlist, input_item_t *media)
Definition: notify.c:113
Describes an input and is used to spawn input_thread_t objects.
Definition: vlc_input_item.h:89
Doubly-linked list node.
Definition: vlc_list.h:44
Playlist callbacks.
Definition: vlc_playlist.h:167
Definition: notify.h:30
void * userdata
Definition: notify.h:32
struct vlc_list node
node of vlc_playlist.listeners
Definition: notify.h:33
const struct vlc_playlist_callbacks * cbs
Definition: notify.h:31
Definition: notify.h:36
ssize_t current
Definition: notify.h:37
bool has_prev
Definition: notify.h:38
bool has_next
Definition: notify.h:39
Definition: playlist.h:49
This file is a collection of common definitions and types.
This provides convenience helpers for linked lists.