* ./NEWS: a few updates (translations, mozilla plugin).
[vlc.git] / include / vlc_playlist.h
blob631c1a47b5f3c7009de9940d1b6a6792db15a70b
1 /*****************************************************************************
2 * vlc_playlist.h : Playlist functions
3 *****************************************************************************
4 * Copyright (C) 1999, 2000, 2001, 2002 VideoLAN
5 * $Id: vlc_playlist.h,v 1.8 2003/01/29 11:34:11 jlj 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_t
29 char * psz_name;
30 char * psz_uri;
31 int i_type; /* unused yet */
32 int i_status; /* unused yet */
33 vlc_bool_t b_autodeletion;
36 /*****************************************************************************
37 * playlist_t: playlist structure
38 *****************************************************************************
39 * The structure contains information about the size and browsing mode of
40 * the playlist, a change lock, a dynamic array of playlist items, and a
41 * current item which is an exact copy of one of the array members.
42 *****************************************************************************/
43 struct playlist_t
45 VLC_COMMON_MEMBERS
47 int i_index; /* current index */
48 int i_status;
49 int i_size; /* total size */
51 playlist_item_t ** pp_items;
53 input_thread_t * p_input;
56 /*****************************************************************************
57 * Playlist status
58 *****************************************************************************/
59 #define PLAYLIST_STOPPED 0
60 #define PLAYLIST_RUNNING 1
61 #define PLAYLIST_PAUSED 2
63 /*****************************************************************************
64 * Prototypes
65 *****************************************************************************/
66 #define playlist_Create(a) __playlist_Create(VLC_OBJECT(a))
67 playlist_t * __playlist_Create ( vlc_object_t * );
68 void playlist_Destroy ( playlist_t * );
70 #define playlist_Play(p) playlist_Command(p,PLAYLIST_PLAY,0)
71 #define playlist_Pause(p) playlist_Command(p,PLAYLIST_PAUSE,0)
72 #define playlist_Stop(p) playlist_Command(p,PLAYLIST_STOP,0)
73 #define playlist_Next(p) playlist_Command(p,PLAYLIST_SKIP,1)
74 #define playlist_Prev(p) playlist_Command(p,PLAYLIST_SKIP,-1)
75 #define playlist_Skip(p,i) playlist_Command(p,PLAYLIST_SKIP,i)
76 #define playlist_Goto(p,i) playlist_Command(p,PLAYLIST_GOTO,i)
77 VLC_EXPORT( void, playlist_Command, ( playlist_t *, int, int ) );
79 VLC_EXPORT( int, playlist_Add, ( playlist_t *, const char *, int, int ) );
80 VLC_EXPORT( int, playlist_AddItem, ( playlist_t *, playlist_item_t *, int, int ) );
81 VLC_EXPORT( int, playlist_Delete, ( playlist_t *, int ) );
82 VLC_EXPORT( int, playlist_LoadFile, ( playlist_t *, const char * ) );
83 VLC_EXPORT( int, playlist_SaveFile, ( playlist_t *, const char * ) );
85 static inline vlc_bool_t playlist_IsPlaying( playlist_t * p_playlist )
87 vlc_bool_t b_playing;
89 vlc_mutex_lock( &p_playlist->object_lock );
90 b_playing = p_playlist->i_status == PLAYLIST_RUNNING;
91 vlc_mutex_unlock( &p_playlist->object_lock );
93 return( b_playing );
96 static inline vlc_bool_t playlist_IsEmpty( playlist_t * p_playlist )
98 vlc_bool_t b_empty;
100 vlc_mutex_lock( &p_playlist->object_lock );
101 b_empty = p_playlist->i_size == 0;
102 vlc_mutex_unlock( &p_playlist->object_lock );
104 return( b_empty );