Commit 982c016f authored by Clément Stenac's avatar Clément Stenac

- src/misc/win32_specific: compilation fix for win32 (can someone please

check that command line parsing still works for items and options? )

- src/libvlc.c
  include/vlc/vlc.h : New libvlc functions to get playlist status and
                      clear the playlist
     Patch by Tong Ka Man

- src/playlist/* : Update copyrights

- src/playlist/playlist.c:
  -When a user explicitely asks for an item, do play it, even if random mode
  -Do not stop playlist upon deletion of an autodelete item
  -playlist_Clear (Patch by Tong Ka Man)
parent 12dc6ed7
......@@ -2,7 +2,7 @@
* vlc.h: global header for vlc
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: vlc.h,v 1.28 2003/12/02 12:57:35 gbazin Exp $
* $Id: vlc.h,v 1.29 2004/01/06 08:50:20 zorglub Exp $
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -139,6 +139,8 @@ int VLC_Play ( int );
int VLC_Pause ( int );
int VLC_Stop ( int );
int VLC_FullScreen ( int );
int VLC_ClearPlaylist( int );
vlc_bool_t VLC_IsPlaying ( int );
# ifdef __cplusplus
}
......
......@@ -2,7 +2,7 @@
* vlc_playlist.h : Playlist functions
*****************************************************************************
* Copyright (C) 1999, 2000, 2001, 2002 VideoLAN
* $Id: vlc_playlist.h,v 1.20 2004/01/06 04:57:34 rocky Exp $
* $Id: vlc_playlist.h,v 1.21 2004/01/06 08:50:20 zorglub Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -157,6 +157,7 @@ VLC_EXPORT( int, playlist_Add, ( playlist_t *, const char *, const char *, i
VLC_EXPORT( int, playlist_AddWDuration, ( playlist_t *, const char *, const char *, int, int, mtime_t ) );
/* For internal use. Do not use this one anymore */
VLC_EXPORT( int, playlist_AddItem, ( playlist_t *, playlist_item_t *, int, int ) );
VLC_EXPORT( int, playlist_Clear, ( playlist_t * ) );
VLC_EXPORT( int, playlist_Delete, ( playlist_t *, int ) );
VLC_EXPORT( int, playlist_Disable, ( playlist_t *, int ) );
VLC_EXPORT( int, playlist_Enable, ( playlist_t *, int ) );
......
......@@ -2,7 +2,7 @@
* libvlc.c: main libvlc source
*****************************************************************************
* Copyright (C) 1998-2002 VideoLAN
* $Id: libvlc.c,v 1.107 2004/01/05 12:59:43 zorglub Exp $
* $Id: libvlc.c,v 1.108 2004/01/06 08:50:20 zorglub Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -911,6 +911,77 @@ int VLC_Get( int i_object, char const *psz_var, vlc_value_t *p_value )
/* FIXME: temporary hacks */
/*****************************************************************************
* VLC_IsPlaying: Query for Playlist Status
*****************************************************************************/
vlc_bool_t VLC_IsPlaying( int i_object )
{
playlist_t * p_playlist;
vlc_bool_t playing;
vlc_t *p_vlc = vlc_current_object( i_object );
/* Check that the handle is valid */
if( !p_vlc )
{
return VLC_ENOOBJ;
}
p_playlist = vlc_object_find( p_vlc, VLC_OBJECT_PLAYLIST, FIND_CHILD );
if( !p_playlist )
{
if( i_object ) vlc_object_release( p_vlc );
return VLC_ENOOBJ;
}
playing = playlist_IsPlaying( p_playlist );
vlc_object_release( p_playlist );
if( i_object ) vlc_object_release( p_vlc );
return playing;
}
/*****************************************************************************
* VLC_ClearPlaylist: Query for Playlist Status
*
* return: 0
*****************************************************************************/
int VLC_ClearPlaylist( int i_object )
{
playlist_t * p_playlist;
vlc_t *p_vlc = vlc_current_object( i_object );
/* Check that the handle is valid */
if( !p_vlc )
{
return VLC_ENOOBJ;
}
p_playlist = vlc_object_find( p_vlc, VLC_OBJECT_PLAYLIST, FIND_CHILD );
if( !p_playlist )
{
if( i_object ) vlc_object_release( p_vlc );
return VLC_ENOOBJ;
}
playlist_Clear(p_playlist);
vlc_object_release( p_playlist );
if( i_object ) vlc_object_release( p_vlc );
return 0;
}
/*****************************************************************************
* VLC_Play: play
*****************************************************************************/
......
......@@ -2,7 +2,7 @@
* win32_specific.c: Win32 specific features
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: win32_specific.c,v 1.28 2003/12/09 19:18:48 gbazin Exp $
* $Id: win32_specific.c,v 1.29 2004/01/06 08:50:20 zorglub Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Gildas Bazin <gbazin@netcourrier.com>
......@@ -297,7 +297,7 @@ LRESULT CALLBACK WMCOPYWNDPROC( HWND hwnd, UINT uMsg, WPARAM wParam,
if( pwm_data->lpData )
{
int i_argc, i_data, i_opt, i_options;
int i_argc, i_data, i_opt, i_options,i_id,i_pos,j;
char **ppsz_argv;
char *p_data = (char *)pwm_data->lpData;
......@@ -321,12 +321,16 @@ LRESULT CALLBACK WMCOPYWNDPROC( HWND hwnd, UINT uMsg, WPARAM wParam,
{
i_options++;
}
playlist_Add( p_playlist, ppsz_argv[ i_opt ],
(char const **)( i_options ? &ppsz_argv[i_opt+1] : NULL ),
i_options, PLAYLIST_APPEND | (i_opt? 0 : PLAYLIST_GO),
PLAYLIST_END );
i_id = playlist_Add( p_playlist, ppsz_argv[ i_opt ],
ppsz_argv[ i_opt ],
PLAYLIST_APPEND | (i_opt? 0 : PLAYLIST_GO),
PLAYLIST_END );
i_pos = playlist_GetPositionById( p_playlist, i_id );
for( j = 0 ; j < i_options ; j++ )
{
playlist_AddOption( p_playlist, i_pos ,
&ppsz_argv[i_opt+1+j] );
}
i_opt += i_options;
}
......
/*****************************************************************************
* playlist.c : Playlist groups management functions
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: group.c,v 1.5 2004/01/05 12:59:43 zorglub Exp $
* Copyright (C) 1999-2004 VideoLAN
* $Id: group.c,v 1.6 2004/01/06 08:50:20 zorglub Exp $
*
* Authors: Clment Stenac <zorglub@videolan.org>
*
......
/*****************************************************************************
* info.c : Playlist info management
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: info.c,v 1.1 2004/01/05 12:59:43 zorglub Exp $
* Copyright (C) 1999-2004 VideoLAN
* $Id: info.c,v 1.2 2004/01/06 08:50:20 zorglub Exp $
*
* Authors: Clment Stenac <zorglub@videolan.org>
*
......@@ -105,8 +105,6 @@ item_info_category_t *
playlist_GetCategory( playlist_t *p_playlist, int i_item,
const char * psz_cat )
{
int i;
/* Check the existence of the playlist */
if( p_playlist == NULL)
{
......
/*****************************************************************************
* item-ext.c : Exported playlist item functions
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: item-ext.c,v 1.3 2004/01/06 04:57:34 rocky Exp $
* Copyright (C) 1999-2004 VideoLAN
* $Id: item-ext.c,v 1.4 2004/01/06 08:50:20 zorglub Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Clment Stenac <zorglub@videolan.org>
......@@ -45,8 +45,8 @@
* \return the position of the new item
*/
int playlist_AddWDuration( playlist_t *p_playlist, const char * psz_uri,
const char *psz_name, int i_mode, int i_pos,
mtime_t i_duration )
const char *psz_name, int i_mode, int i_pos,
mtime_t i_duration )
{
playlist_item_t * p_item;
......@@ -98,8 +98,8 @@ int playlist_AddWDuration( playlist_t *p_playlist, const char * psz_uri,
int playlist_Add( playlist_t *p_playlist, const char * psz_uri,
const char *psz_name, int i_mode, int i_pos )
{
return playlist_AddWDuration ( p_playlist, psz_uri, psz_name, i_mode, i_pos,
-1 );
return playlist_AddWDuration ( p_playlist, psz_uri, psz_name, i_mode, i_pos,
-1 );
}
/**
......@@ -151,7 +151,7 @@ playlist_item_t * playlist_GetItemById( playlist_t * p_playlist , int i_id )
* Set the group of a playlist item
*
* \param p_playlist the playlist
* \param i_item the item of which we change the group
* \param i_item the item of which we change the group (position)
* \param i_group the new group
* \return 0 on success, -1 on failure
*/
......@@ -364,6 +364,29 @@ int playlist_Delete( playlist_t * p_playlist, int i_pos )
return 0;
}
/**
* Clear all playlist items
*
* \param p_playlist the playlist to be cleared.
* \return returns 0
*/
int playlist_Clear( playlist_t * p_playlist ) {
while( p_playlist->i_groups > 0 )
{
playlist_DeleteGroup( p_playlist, p_playlist->pp_groups[0]->i_id );
}
while( p_playlist->i_size > 0 )
{
playlist_Delete( p_playlist, 0 );
}
return 0;
}
/**
* Disables a playlist item
*
......
/*****************************************************************************
* item.c : Playlist item functions
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: item.c,v 1.10 2004/01/05 12:59:43 zorglub Exp $
* Copyright (C) 1999-2004 VideoLAN
* $Id: item.c,v 1.11 2004/01/06 08:50:20 zorglub Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......
/*****************************************************************************
* loadsave.c : Playlist loading / saving functions
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: loadsave.c,v 1.2 2004/01/05 12:59:43 zorglub Exp $
* Copyright (C) 1999-2004 VideoLAN
* $Id: loadsave.c,v 1.3 2004/01/06 08:50:20 zorglub Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......
/*****************************************************************************
* playlist.c : Playlist management functions
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: playlist.c,v 1.71 2004/01/05 12:59:43 zorglub Exp $
* Copyright (C) 1999-2004 VideoLAN
* $Id: playlist.c,v 1.72 2004/01/06 08:50:20 zorglub Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -82,6 +82,11 @@ playlist_t * __playlist_Create ( vlc_object_t *p_parent )
val.b_bool = VLC_TRUE;
var_Set( p_playlist, "intf-show", val );
var_Create( p_playlist, "prevent-skip", VLC_VAR_BOOL );
val.b_bool = VLC_FALSE;
var_Set( p_playlist, "prevent-skip", val );
var_Create( p_playlist, "random", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Create( p_playlist, "repeat", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Create( p_playlist, "loop", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
......@@ -127,6 +132,13 @@ void playlist_Destroy( playlist_t * p_playlist )
var_Destroy( p_playlist, "intf-change" );
var_Destroy( p_playlist, "item-change" );
var_Destroy( p_playlist, "playlist-current" );
var_Destroy( p_playlist, "intf-popmenu" );
var_Destroy( p_playlist, "intf-show" );
var_Destroy( p_playlist, "prevent-skip" );
var_Destroy( p_playlist, "random" );
var_Destroy( p_playlist, "repeat" );
var_Destroy( p_playlist, "loop" );
while( p_playlist->i_groups > 0 )
{
......@@ -229,6 +241,8 @@ void playlist_Destroy( playlist_t * p_playlist )
{
input_StopThread( p_playlist->p_input );
}
val.b_bool = VLC_TRUE;
var_Set( p_playlist, "prevent-skip", val );
p_playlist->i_status = PLAYLIST_RUNNING;
}
break;
......@@ -352,6 +366,8 @@ static void RunThread ( playlist_t *p_playlist )
{
vlc_mutex_unlock( &p_playlist->object_lock );
playlist_Delete( p_playlist, p_playlist->i_index );
p_playlist->i_index++;
p_playlist->i_status = PLAYLIST_RUNNING;
}
else
{
......@@ -381,7 +397,13 @@ static void RunThread ( playlist_t *p_playlist )
}
else if( p_playlist->i_status != PLAYLIST_STOPPED )
{
SkipItem( p_playlist, 0 );
var_Get( p_playlist, "prevent-skip", &val);
if( val.b_bool == VLC_FALSE)
{
SkipItem( p_playlist, 0 );
}
val.b_bool = VLC_TRUE;
var_Set( p_playlist, "prevent-skip", val);
PlayItem( p_playlist );
}
else if( p_playlist->i_status == PLAYLIST_STOPPED )
......@@ -537,7 +559,7 @@ static void SkipItem( playlist_t *p_playlist, int i_arg )
/* Check that the item is enabled */
if( p_playlist->pp_items[p_playlist->i_index]->b_enabled == VLC_FALSE &&
p_playlist->i_enabled != 0)
{
{
SkipItem( p_playlist , 1 );
}
}
......
/*****************************************************************************
* sort.c : Playlist sorting functions
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: sort.c,v 1.4 2004/01/05 12:59:43 zorglub Exp $
* Copyright (C) 1999-2004 VideoLAN
* $Id: sort.c,v 1.5 2004/01/06 08:50:20 zorglub Exp $
*
* Authors: Clment Stenac <zorglub@videolan.org>
*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment