[vlc-devel] [PATCH] play-and-exit feature for playlists

Georgi Chorbadzhiyski gf at unixsol.org
Sat Sep 2 22:13:13 CEST 2006


Hello vlc-devel,
the following patch adds --play-and-exit parameter for playlists. When this parameter
is set and there are no more items in the playlist VLC exists instead of just reporting
"nothing to play".

I think this feature is useful, please apply.

Signed-off-by: Georgi Chorbadzhiyski <gf at unixsol.org>


diff -urp vlc-0.8.5/src/libvlc.h vlc-0.8.5-patched/src/libvlc.h
--- vlc-0.8.5/src/libvlc.h	2006-05-06 18:52:13.000000000 +0300
+++ vlc-0.8.5-patched/src/libvlc.h	2006-09-02 22:06:18.000000000 +0300
@@ -910,6 +910,10 @@ static char *ppsz_clock_descriptions[] =
 #define PAS_LONGTEXT N_( \
     "Stop the playlist after each played playlist item." )

+#define PAE_TEXT N_("Play and exit")
+#define PAE_LONGTEXT N_( \
+    "Exit if there are no more items in the playlist." )
+
 /*****************************************************************************
  * Hotkeys
  ****************************************************************************/
@@ -1500,6 +1504,7 @@ vlc_module_begin();
         change_short('L');
     add_bool( "repeat", 0, NULL, REPEAT_TEXT, REPEAT_LONGTEXT, VLC_FALSE );
         change_short('R');
+    add_bool( "play-and-exit", 0, NULL, PAE_TEXT, PAE_LONGTEXT, VLC_FALSE );
     add_bool( "play-and-stop", 0, NULL, PAS_TEXT, PAS_LONGTEXT, VLC_FALSE );

     add_string( "open", "", NULL, OPEN_TEXT, OPEN_LONGTEXT, VLC_FALSE );
diff -urp vlc-0.8.5/src/playlist/playlist.c vlc-0.8.5-patched/src/playlist/playlist.c
--- vlc-0.8.5/src/playlist/playlist.c	2006-05-06 18:52:13.000000000 +0300
+++ vlc-0.8.5-patched/src/playlist/playlist.c	2006-09-02 22:07:30.000000000 +0300
@@ -131,6 +131,7 @@ playlist_t * __playlist_Create ( vlc_obj


     /* Variables to control playback */
+    var_CreateGetBool( p_playlist, "play-and-exit" );
     var_CreateGetBool( p_playlist, "play-and-stop" );
     var_CreateGetBool( p_playlist, "random" );
     var_CreateGetBool( p_playlist, "repeat" );
@@ -254,6 +255,7 @@ int playlist_Destroy( playlist_t * p_pla
     var_Destroy( p_playlist, "playlist-current" );
     var_Destroy( p_playlist, "intf-popmenu" );
     var_Destroy( p_playlist, "intf-show" );
+    var_Destroy( p_playlist, "play-and-exit" );
     var_Destroy( p_playlist, "play-and-stop" );
     var_Destroy( p_playlist, "random" );
     var_Destroy( p_playlist, "repeat" );
@@ -920,6 +922,7 @@ static playlist_item_t * NextItem( playl
     vlc_bool_t b_loop = var_GetBool( p_playlist, "loop" );
     vlc_bool_t b_random = var_GetBool( p_playlist, "random" );
     vlc_bool_t b_repeat = var_GetBool( p_playlist, "repeat" );
+    vlc_bool_t b_playexit = var_GetBool( p_playlist, "play-and-exit" );
     vlc_bool_t b_playstop = var_GetBool( p_playlist, "play-and-stop" );

 #ifdef PLAYLIST_PROFILE
@@ -1197,7 +1200,12 @@ static playlist_item_t * NextItem( playl

     if( p_new == NULL )
     {
-        msg_Info( p_playlist, "nothing to play" );
+        if( b_playexit == VLC_TRUE ) {
+            msg_Info( p_playlist, "nothing to play, exiting" );
+            VLC_Die( 0 );
+        } else {
+            msg_Info( p_playlist, "nothing to play" );
+        }
     }

     return p_new;

-- 
Georgi Chorbadzhiyski
http://georgi.unixsol.org/

-- 
This is the vlc-devel mailing-list, see http://www.videolan.org/vlc/
To unsubscribe, please read http://developers.videolan.org/lists.html



More information about the vlc-devel mailing list