VLC  4.0.0-dev
playlist.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * playlist/playlist.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_NEW_INTERNAL_H
22 #define VLC_PLAYLIST_NEW_INTERNAL_H
23 
24 #include <vlc_common.h>
25 #include <vlc_playlist.h>
26 #include <vlc_vector.h>
27 #include "../player/player.h"
28 #include "randomizer.h"
29 
30 typedef struct input_item_t input_item_t;
31 
32 #ifdef TEST_PLAYLIST
33 /* mock the player in tests */
34 # define vlc_player_New(a,b,c,d) (VLC_UNUSED(a), VLC_UNUSED(b), VLC_UNUSED(c), \
35  malloc(1))
36 # define vlc_player_Delete(p) free(p)
37 # define vlc_player_Lock(p) VLC_UNUSED(p)
38 # define vlc_player_Unlock(p) VLC_UNUSED(p)
39 # define vlc_player_AddListener(a,b,c) (VLC_UNUSED(b), malloc(1))
40 # define vlc_player_RemoveListener(a,b) free(b)
41 # define vlc_player_SetCurrentMedia(a,b) (VLC_UNUSED(b), VLC_SUCCESS)
42 # define vlc_player_InvalidateNextMedia(p) VLC_UNUSED(p)
43 # define vlc_player_osd_Message(p, fmt...) VLC_UNUSED(p)
44 #endif /* TEST_PLAYLIST */
45 
47 
49 {
53  /* all remaining fields are protected by the lock of the player */
57  ssize_t current;
58  bool has_prev;
59  bool has_next;
60  struct vlc_list listeners; /**< list of vlc_playlist_listener_id.node */
63  uint64_t idgen;
64 };
65 
66 /* Also disable vlc_assert_locked in tests since the symbol is not exported */
67 #if !defined(NDEBUG) && !defined(TEST_PLAYLIST)
68 static inline void
70 {
72 }
73 #else
74 #define vlc_playlist_AssertLocked(x) ((void) (0))
75 #endif
76 
77 #endif
vlc_player_t
Definition: player.h:227
vlc_playlist::player
vlc_player_t * player
Definition: playlist.h:50
VLC_VECTOR
#define VLC_VECTOR(type)
Vector struct body.
Definition: vlc_vector.h:65
vlc_playlist
Definition: playlist.h:48
content.h
var_InheritBool
static bool var_InheritBool(vlc_object_t *obj, const char *name)
Definition: vlc_variables.h:675
vlc_playlist::listeners
struct vlc_list listeners
list of vlc_playlist_listener_id.node
Definition: playlist.h:60
libvlc_int_t
Definition: vlc_objects.h:114
unlikely
#define unlikely(p)
Predicted false condition.
Definition: vlc_common.h:227
vlc_player_listener_id
Definition: player.h:128
vlc_common.h
vlc_playlist::player_listener
struct vlc_player_listener_id * player_listener
Definition: playlist.h:54
randomizer_Destroy
void randomizer_Destroy(struct randomizer *r)
Destroy a randomizer.
Definition: randomizer.c:275
input_item_t
Describes an input and is used to spawn input_thread_t objects.
Definition: vlc_input_item.h:77
vlc_player_assert_locked
static void vlc_player_assert_locked(vlc_player_t *player)
Definition: player.h:291
item.h
vlc_list_init
static void vlc_list_init(struct vlc_list *restrict head)
Initializes an empty list head.
Definition: vlc_list.h:57
randomizer.h
vlc_playlist_Lock
void vlc_playlist_Lock(vlc_playlist_t *playlist)
Lock the playlist/player.
Definition: playlist.c:80
randomizer_Init
void randomizer_Init(struct randomizer *r)
Initialize an empty randomizer.
Definition: randomizer.c:260
vlc_vector_init
#define vlc_vector_init(pv)
Initialize an empty vector.
Definition: vlc_vector.h:80
vlc_playlist_item
Definition: item.h:29
vlc_list
Doubly-linked list node.
Definition: vlc_list.h:43
vlc_playlist::has_prev
bool has_prev
Definition: playlist.h:58
vlc_player_Unlock
void vlc_player_Unlock(vlc_player_t *player)
Unlock the player.
Definition: player.c:957
vlc_playlist_PlayerDestroy
void vlc_playlist_PlayerDestroy(vlc_playlist_t *playlist)
Definition: player.c:158
vlc_playlist_ClearItems
void vlc_playlist_ClearItems(vlc_playlist_t *playlist)
Definition: content.c:34
vlc_playlist::current
ssize_t current
Definition: playlist.h:57
randomizer
Playlist helper to manage random playback.
Definition: randomizer.h:39
vlc_list_is_empty
static bool vlc_list_is_empty(const struct vlc_list *head)
Checks if a list is empty.
Definition: vlc_list.h:167
vlc_player_Lock
void vlc_player_Lock(vlc_player_t *player)
Lock the player.
Definition: player.c:941
vlc_playlist_playback_order
vlc_playlist_playback_order
Definition: vlc_playlist.h:123
VLC_PLAYLIST_PLAYBACK_REPEAT_NONE
@ VLC_PLAYLIST_PLAYBACK_REPEAT_NONE
Definition: vlc_playlist.h:118
vlc_playlist::order
enum vlc_playlist_playback_order order
Definition: playlist.h:62
vlc_playlist_AssertLocked
static void vlc_playlist_AssertLocked(vlc_playlist_t *playlist)
Definition: playlist.h:69
vlc_playlist_Unlock
void vlc_playlist_Unlock(vlc_playlist_t *playlist)
Unlock the playlist/player.
Definition: playlist.c:86
vlc_vector.h
vlc_object_t
VLC object common members.
Definition: vlc_objects.h:43
vlc_playlist::auto_preparse
bool auto_preparse
Definition: playlist.h:52
vlc_playlist::has_next
bool has_next
Definition: playlist.h:59
vlc_playlist_PlayerInit
bool vlc_playlist_PlayerInit(vlc_playlist_t *playlist, vlc_object_t *parent)
Definition: player.c:135
VLC_PLAYLIST_PLAYBACK_ORDER_NORMAL
@ VLC_PLAYLIST_PLAYBACK_ORDER_NORMAL
Definition: vlc_playlist.h:125
vlc_playlist::libvlc
libvlc_int_t * libvlc
Definition: playlist.h:51
vlc_playlist::idgen
uint64_t idgen
Definition: playlist.h:63
vlc_playlist::randomizer
struct randomizer randomizer
Definition: playlist.h:56
vlc_playlist.h
playlist_item_vector_t
Definition: playlist.h:46
vlc_playlist_playback_repeat
vlc_playlist_playback_repeat
Definition: vlc_playlist.h:116
playlist.h
vlc_playlist::items
playlist_item_vector_t items
Definition: playlist.h:55
vlc_playlist::repeat
enum vlc_playlist_playback_repeat repeat
Definition: playlist.h:61
vlc_object_instance
#define vlc_object_instance(o)
Definition: vlc_objects.h:195
vlc_playlist_New
vlc_playlist_t * vlc_playlist_New(vlc_object_t *parent)
Create a new playlist.
Definition: playlist.c:34
vlc_playlist_Delete
void vlc_playlist_Delete(vlc_playlist_t *playlist)
Delete a playlist.
Definition: playlist.c:69
player.h