1 /*****************************************************************************
2 * vlc_playlist.h : Playlist functions
3 *****************************************************************************
4 * Copyright (C) 1999, 2000, 2001, 2002 VideoLAN
5 * $Id: playlist.h,v 1.3 2002/06/01 12:31:58 sam Exp $
7 * Authors: Samuel Hocevar <sam@zoy.org>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
22 *****************************************************************************/
24 /*****************************************************************************
25 * playlist_item_t: playlist item
26 *****************************************************************************/
27 struct playlist_item_s
30 int i_type; /* unused yet */
31 int i_status; /* unused yet */
34 /*****************************************************************************
35 * playlist_t: playlist structure
36 *****************************************************************************
37 * The structure contains information about the size and browsing mode of
38 * the playlist, a change lock, a dynamic array of playlist items, and a
39 * current item which is an exact copy of one of the array members.
40 *****************************************************************************/
45 /* Thread properties and lock */
46 vlc_mutex_t change_lock;
48 int i_index; /* current index */
49 int i_size; /* total size */
50 playlist_item_t ** pp_items;
54 input_thread_t * p_input;
57 /* Used by playlist_Add */
58 #define PLAYLIST_START 0
59 #define PLAYLIST_END -1
61 /* Playlist parsing mode */
62 #define PLAYLIST_REPEAT_CURRENT 0 /* Keep playing current item */
63 #define PLAYLIST_FORWARD 1 /* Parse playlist until end */
64 #define PLAYLIST_BACKWARD -1 /* Parse backwards */
65 #define PLAYLIST_FORWARD_LOOP 2 /* Parse playlist and loop */
66 #define PLAYLIST_BACKWARD_LOOP -2 /* Parse backwards and loop */
67 #define PLAYLIST_RANDOM 3 /* Shuffle play */
68 #define PLAYLIST_REVERSE_RANDOM -3 /* Reverse shuffle play */
70 /* Playlist commands */
71 #define PLAYLIST_PLAY 1 /* Starts playing. No arg. */
72 #define PLAYLIST_PAUSE 2 /* Toggles playlist pause. No arg. */
73 #define PLAYLIST_STOP 3 /* Stops playing. No arg. */
74 #define PLAYLIST_SKIP 4 /* Skip X items and play. */
75 #define PLAYLIST_GOTO 5 /* Goto Xth item. */
76 #define PLAYLIST_MODE 6 /* Set playlist mode. ??? */
78 /*****************************************************************************
80 *****************************************************************************/
81 playlist_t * playlist_Create ( vlc_object_t * );
82 void playlist_Destroy ( playlist_t * );
84 VLC_EXPORT( void, playlist_Command, ( playlist_t *, int, int ) );
86 #define playlist_Play(p) playlist_Command(p,PLAYLIST_PLAY,0)
87 #define playlist_Pause(p) playlist_Command(p,PLAYLIST_PAUSE,0)
88 #define playlist_Stop(p) playlist_Command(p,PLAYLIST_STOP,0)
89 #define playlist_Next(p) playlist_Command(p,PLAYLIST_SKIP,1)
90 #define playlist_Prev(p) playlist_Command(p,PLAYLIST_SKIP,-1)
91 #define playlist_Skip(p,i) playlist_Command(p,PLAYLIST_SKIP,i)
92 #define playlist_Goto(p,i) playlist_Command(p,PLAYLIST_GOTO,i)
94 VLC_EXPORT( int, playlist_Add, ( vlc_object_t *, int, const char * ) );
95 VLC_EXPORT( int, playlist_Delete, ( playlist_t *, int ) );