]> git.sesse.net Git - vlc/commitdiff
* ./plugins/dummy/input_dummy.c: dummy targets such as vlc:nop, vlc:loop
authorSam Hocevar <sam@videolan.org>
Fri, 7 Jun 2002 16:06:09 +0000 (16:06 +0000)
committerSam Hocevar <sam@videolan.org>
Fri, 7 Jun 2002 16:06:09 +0000 (16:06 +0000)
    and vlc:quit work again.
  * ./src/playlist/playlist.c: when a new target is added, for instance through     the "File" menu, it is automatically played.

ChangeLog
plugins/dummy/input_dummy.c
plugins/gtk/gtk_playlist.c
src/misc/objects.c
src/playlist/playlist.c

index 5b1d7d4f0a251384ae7b8ce18fbe7397193e5575..a497da3a57ac81027b764a9fc0be3882d29649f8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,10 @@
 0.5.0
 Not released yet
 
+  * ./plugins/dummy/input_dummy.c: dummy targets such as vlc:nop, vlc:loop
+    and vlc:quit work again.
+  * ./src/playlist/playlist.c: when a new target is added, for instance through
+    the "File" menu, it is automatically played.
   * ./include/vlc_objects.h: pointers are set to NULL after a call to
     vlc_object_destroy.
   * ./po/pl.po: updated polish translation, thanks to Arkadiusz Lipiec
index f0968cf39d8b8c1bd0ae95261f6a1ee5930d3a14..9202165685034c6186f50d0d20ce6e7f9b9a1202 100644 (file)
@@ -2,7 +2,7 @@
  * input_dummy.c: dummy input plugin, to manage "vlc:***" special options
  *****************************************************************************
  * Copyright (C) 2001, 2002 VideoLAN
- * $Id: input_dummy.c,v 1.18 2002/06/01 12:31:58 sam Exp $
+ * $Id: input_dummy.c,v 1.19 2002/06/07 16:06:09 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -94,7 +94,7 @@ static int DummyOpen( input_thread_t * p_input )
 
     /* Force dummy demux plug-in */
     p_input->psz_demux = "vlc";
-    return( 0 );
+    return 0;
 }
 
 /*****************************************************************************
@@ -120,7 +120,7 @@ static int DummyInit( input_thread_t *p_input )
     if( p_method == NULL )
     {
         msg_Err( p_input, "out of memory" );
-        return( -1 );
+        return -1;
     }
 
     p_input->p_demux_data = p_method;
@@ -131,7 +131,7 @@ static int DummyInit( input_thread_t *p_input )
     {
         msg_Info( p_input, "command `nop'" );
         p_method->i_command = COMMAND_NOP;
-        return( 0 );
+        return 0;
     }
 
     /* Check for a "vlc:quit" command */
@@ -139,7 +139,7 @@ static int DummyInit( input_thread_t *p_input )
     {
         msg_Info( p_input, "command `quit'" );
         p_method->i_command = COMMAND_QUIT;
-        return( 0 );
+        return 0;
     }
 
     /* Check for a "vlc:loop" command */
@@ -147,7 +147,7 @@ static int DummyInit( input_thread_t *p_input )
     {
         msg_Info( p_input, "command `loop'" );
         p_method->i_command = COMMAND_LOOP;
-        return( 0 );
+        return 0;
     }
 
     /* Check for a "vlc:pause:***" command */
@@ -157,14 +157,14 @@ static int DummyInit( input_thread_t *p_input )
         msg_Info( p_input, "command `pause %i'", i_arg );
         p_method->i_command = COMMAND_PAUSE;
         p_method->expiration = mdate() + (mtime_t)i_arg * (mtime_t)1000000;
-        return( 0 );
+        return 0;
     }
 
     msg_Err( p_input, "unknown command `%s'", psz_name );
     free( p_input->p_demux_data );
     p_input->b_error = 1;
 
-    return( -1 );
+    return -1;
 }
 
 /*****************************************************************************
@@ -181,17 +181,25 @@ static void DummyEnd( input_thread_t *p_input )
 static int DummyDemux( input_thread_t *p_input )
 {
     struct demux_sys_s * p_method = p_input->p_demux_data;
+    playlist_t *p_playlist;
+
+    p_playlist = vlc_object_find( p_input, VLC_OBJECT_PLAYLIST, FIND_PARENT );
+
+    if( p_playlist == NULL )
+    {
+        msg_Err( p_input, "we are not attached to a playlist" );
+        p_input->b_error = 1;
+        return 1;
+    }
 
     switch( p_method->i_command )
     {
         case COMMAND_QUIT:
             p_input->p_vlc->b_die = 1;
-            p_input->b_die = 1;
             break;
 
         case COMMAND_LOOP:
-            //playlist_Jumpto( p_input->p_vlc->p_playlist, -1 );
-            p_input->b_eof = 1;
+            playlist_Goto( p_playlist, 0 );
             break;
 
         case COMMAND_PAUSE:
@@ -211,6 +219,8 @@ static int DummyDemux( input_thread_t *p_input )
             break;
     }
 
+    vlc_object_release( p_playlist );
+
     return 1;
 }
 
index 694ddda17d35bf3113e47081e82622cf8bd82f9f..4f02b9144f77a6f9876f71a18e79507f2390f556 100644 (file)
@@ -2,7 +2,7 @@
  * gtk_playlist.c : Interface for the playlist dialog
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: gtk_playlist.c,v 1.33 2002/06/07 14:30:41 sam Exp $
+ * $Id: gtk_playlist.c,v 1.34 2002/06/07 16:06:09 sam Exp $
  *
  * Authors: Pierre Baillet <oct@zoy.org>
  *          Stéphane Borel <stef@via.ecp.fr>
@@ -64,10 +64,9 @@ static void UrlDecode( char *encoded_path );
 gboolean GtkPlaylistShow( GtkWidget       *widget,
                           gpointer         user_data )
 {
-    intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), (char*)user_data );
-    playlist_t *p_playlist;
-
-    p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+    intf_thread_t *  p_intf = GetIntf( GTK_WIDGET(widget), (char*)user_data );
+    playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
+                                                       FIND_ANYWHERE );
     if( p_playlist == NULL )
     {
         return FALSE;
@@ -110,17 +109,17 @@ void GtkPlaylistCancel( GtkButton * button, gpointer user_data )
 gboolean GtkPlaylistPrev( GtkWidget       *widget,
                           gpointer         user_data )
 {
-    intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), (char*)user_data );
-    playlist_t *p_playlist;
-
-    p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
-
-    if( p_playlist )
+    intf_thread_t *  p_intf = GetIntf( GTK_WIDGET(widget), (char*)user_data );
+    playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
+                                                       FIND_ANYWHERE );
+    if( p_playlist == NULL )
     {
-        playlist_Prev( p_playlist );
-        vlc_object_release( p_playlist );
+        return FALSE;
     }
 
+    playlist_Prev( p_playlist );
+    vlc_object_release( p_playlist );
+
     return TRUE;
 }
 
@@ -128,17 +127,17 @@ gboolean GtkPlaylistPrev( GtkWidget       *widget,
 gboolean GtkPlaylistNext( GtkWidget       *widget,
                           gpointer         user_data)
 {
-    intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), (char*)user_data );
-    playlist_t *p_playlist;
-
-    p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
-
-    if( p_playlist )
+    intf_thread_t *  p_intf = GetIntf( GTK_WIDGET(widget), (char*)user_data );
+    playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
+                                                       FIND_ANYWHERE );
+    if( p_playlist == NULL )
     {
-        playlist_Next( p_playlist );
-        vlc_object_release( p_playlist );
+        return FALSE;
     }
 
+    playlist_Next( p_playlist );
+    vlc_object_release( p_playlist );
+
     return TRUE;
 }
 
index d5a39757f0a2eb5ce2298b0e8dfe08bc5809b2f0..556e818206f475c5b52f27190b23287ff901a95c 100644 (file)
@@ -2,7 +2,7 @@
  * objects.c: vlc_object_t handling
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: objects.c,v 1.8 2002/06/07 14:30:41 sam Exp $
+ * $Id: objects.c,v 1.9 2002/06/07 16:06:09 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -181,7 +181,10 @@ void __vlc_object_destroy( vlc_object_t *p_this )
 
     while( p_this->i_refcount )
     {
-        if( i_delay == 0 )
+        i_delay++;
+
+        /* Don't warn immediately ... 100ms seems OK */
+        if( i_delay == 2 )
         {
             msg_Warn( p_this, "refcount is %i, delaying before deletion",
                               p_this->i_refcount );
@@ -197,7 +200,6 @@ void __vlc_object_destroy( vlc_object_t *p_this )
             return;
         }
 
-        i_delay++;
         msleep( 100000 );
     }
 
index 888f5195a89cac09e822ae772c1d878395a8889d..6aaca5801985db626977c43a9d3cf9e573547002 100644 (file)
@@ -2,7 +2,7 @@
  * playlist.c : Playlist management functions
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: playlist.c,v 1.6 2002/06/07 14:30:41 sam Exp $
+ * $Id: playlist.c,v 1.7 2002/06/07 16:06:09 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -179,7 +179,16 @@ int playlist_Add( playlist_t *p_playlist, const char * psz_target,
     }
 
     p_playlist->pp_items[i_pos] = p_item;
-    p_playlist->i_status = PLAYLIST_RUNNING;
+
+    if( i_mode & PLAYLIST_GO )
+    {
+        p_playlist->i_index = i_pos;
+        if( p_playlist->p_input )
+        {
+            input_StopThread( p_playlist->p_input );
+        }
+        p_playlist->i_status = PLAYLIST_RUNNING;
+    }
 
     vlc_mutex_unlock( &p_playlist->object_lock );