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 *****************************************************************************/
27 #include <vlc_common.h>
34 vlc_playlist_New(vlc_object_t
*parent
)
36 vlc_playlist_t
*playlist
= malloc(sizeof(*playlist
));
37 if (unlikely(!playlist
))
40 bool ok
= vlc_playlist_PlayerInit(playlist
, parent
);
47 vlc_vector_init(&playlist
->items
);
48 randomizer_Init(&playlist
->randomizer
);
49 playlist
->current
= -1;
50 playlist
->has_prev
= false;
51 playlist
->has_next
= false;
52 vlc_list_init(&playlist
->listeners
);
53 playlist
->repeat
= VLC_PLAYLIST_PLAYBACK_REPEAT_NONE
;
54 playlist
->order
= VLC_PLAYLIST_PLAYBACK_ORDER_NORMAL
;
57 playlist
->libvlc
= NULL
;
58 playlist
->auto_preparse
= false;
61 playlist
->libvlc
= vlc_object_instance(parent
);
62 playlist
->auto_preparse
= var_InheritBool(parent
, "auto-preparse");
69 vlc_playlist_Delete(vlc_playlist_t
*playlist
)
71 assert(vlc_list_is_empty(&playlist
->listeners
));
73 vlc_playlist_PlayerDestroy(playlist
);
74 randomizer_Destroy(&playlist
->randomizer
);
75 vlc_playlist_ClearItems(playlist
);
80 vlc_playlist_Lock(vlc_playlist_t
*playlist
)
82 vlc_player_Lock(playlist
->player
);
86 vlc_playlist_Unlock(vlc_playlist_t
*playlist
)
88 vlc_player_Unlock(playlist
->player
);