]> git.sesse.net Git - vlc/commitdiff
(new in MAIN)
authorSam Hocevar <sam@videolan.org>
Sun, 2 Jun 2002 11:59:46 +0000 (11:59 +0000)
committerSam Hocevar <sam@videolan.org>
Sun, 2 Jun 2002 11:59:46 +0000 (11:59 +0000)
  * ./src/playlist/playlist.c, src/input/input.c: added safety checks to
    prevent crashes on next file.
(ported from 0_4_1_branch)
  * ./plugins/gtk/gtk_display.c, ./plugins/win32/mainframe.cpp: we deactivate
    popup menus when no stream is being played, even in network mode.
  * ./src/input/mpeg_system.c: removed unnecessarily verbose message.

ChangeLog
include/input_ext-intf.h
plugins/gtk/gtk_display.c
plugins/win32/mainframe.cpp
src/input/input.c
src/input/mpeg_system.c
src/playlist/playlist.c

index 143032bcb1b2c460e9c69ed886c226b71068e734..59dd2bd36bba8231c521ebcc6d915714c817514d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,8 @@
 
 HEAD
 
+  * ./src/playlist/playlist.c, src/input/input.c: added safety checks to
+    prevent crashes on next file.
   * ./src/misc/objects.c: commented all functions.
   * ./src/misc/objects.c: implemented vlc_object_find( , , FIND_ANYWHERE).
   * ./src/misc/objects.c: renamed vlc_object_unlink to vlc_object_detach.
@@ -30,7 +32,11 @@ HEAD
   * ALL: the first libvlc commit.
 
 0.4.1
+Not released yet
 
+  * ./plugins/gtk/gtk_display.c, ./plugins/win32/mainframe.cpp: we deactivate
+    popup menus when no stream is being played, even in network mode.
+  * ./src/input/mpeg_system.c: removed unnecessarily verbose message.
   * ./src/video_output/video_output.c: fixed the "picture has invalid status"
     bug which might have been the cause of crashes.
   * ./plugins/filter/crop.c: attempt at an automatic border cropping filter,
index e2df5ef1a263b8bd84c3a301b3f3a471f6687062..34ce943e733fe23ada2859d1d92a8561e1d98012 100644 (file)
@@ -4,7 +4,7 @@
  * control the pace of reading. 
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: input_ext-intf.h,v 1.68 2002/06/01 18:04:48 sam Exp $
+ * $Id: input_ext-intf.h,v 1.69 2002/06/02 11:59:46 sam Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -247,9 +247,8 @@ struct input_thread_s
 {
     VLC_COMMON_MEMBERS
 
-    /* Thread properties and locks */
+    /* Thread properties */
     vlc_bool_t              b_eof;
-    int                     i_status;                         /* status flag */
 
     /* Access module */
     module_t *       p_access_module;
@@ -328,7 +327,7 @@ struct input_thread_s
 #define input_CreateThread(a,b,c) __input_CreateThread(CAST_TO_VLC_OBJECT(a),b,c)
 input_thread_t * __input_CreateThread ( vlc_object_t *,
                                         playlist_item_t *, int * );
-void   input_StopThread     ( input_thread_t *, int *pi_status );
+void   input_StopThread     ( input_thread_t * );
 void   input_DestroyThread  ( input_thread_t * );
 
 #define input_SetStatus(a,b) __input_SetStatus(CAST_TO_VLC_OBJECT(a),b)
index 6820ccf26cb31edbff83a885d38d55aa4bb8dd18..45049ac190ade5cd829e191bf33830d2a74d9c66 100644 (file)
@@ -2,7 +2,7 @@
  * gtk_display.c: Gtk+ tools for main interface
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: gtk_display.c,v 1.24 2002/06/02 09:03:54 sam Exp $
+ * $Id: gtk_display.c,v 1.25 2002/06/02 11:59:46 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *          Stéphane Borel <stef@via.ecp.fr>
@@ -201,22 +201,22 @@ gint GtkModeManage( intf_thread_t * p_intf )
                     GTK_OBJECT( p_intf->p_sys->p_window ), "label_status" );
             gtk_label_set_text( GTK_LABEL( p_label ), "" );
             gtk_widget_show( GTK_WIDGET( p_file_box ) );
-
-            /* unsensitize menus */
-            gtk_widget_set_sensitive( GETWIDGET(p_window,"menubar_program"),
-                    FALSE );
-            gtk_widget_set_sensitive( GETWIDGET(p_window,"menubar_title"), FALSE );
-            gtk_widget_set_sensitive( GETWIDGET(p_window,"menubar_chapter"),
-                                      FALSE );
-            gtk_widget_set_sensitive( GETWIDGET(p_window,"menubar_audio"), FALSE );
-            gtk_widget_set_sensitive( GETWIDGET(p_window,"menubar_subpictures"),
-                                      FALSE );
-            gtk_widget_set_sensitive( GETWIDGET(p_popup,"popup_navigation"),
-                                      FALSE );
-            gtk_widget_set_sensitive( GETWIDGET(p_popup,"popup_audio"), FALSE );
-            gtk_widget_set_sensitive( GETWIDGET(p_popup,"popup_subpictures"),
-                                      FALSE );
         }
+
+        /* unsensitize menus */
+        gtk_widget_set_sensitive( GETWIDGET(p_window,"menubar_program"),
+                                  FALSE );
+        gtk_widget_set_sensitive( GETWIDGET(p_window,"menubar_title"), FALSE );
+        gtk_widget_set_sensitive( GETWIDGET(p_window,"menubar_chapter"),
+                                  FALSE );
+        gtk_widget_set_sensitive( GETWIDGET(p_window,"menubar_audio"), FALSE );
+        gtk_widget_set_sensitive( GETWIDGET(p_window,"menubar_subpictures"),
+                                  FALSE );
+        gtk_widget_set_sensitive( GETWIDGET(p_popup,"popup_navigation"),
+                                  FALSE );
+        gtk_widget_set_sensitive( GETWIDGET(p_popup,"popup_audio"), FALSE );
+        gtk_widget_set_sensitive( GETWIDGET(p_popup,"popup_subpictures"),
+                                  FALSE );
     }
 
     /* set control items */
index 93641bff8daf3bb08f5ba64655b1b7fd6fee71c7..468787be118bb7a21c5e44d9f54193e1f2a55326 100644 (file)
@@ -667,17 +667,17 @@ void __fastcall TMainFrameDlg::ModeManage()
             /* add space between tolbar and statusbar when\r
              * nothing is displayed; isn't it nicer ? :) */ \r
             i_Height += 17;\r
-\r
-            /* unsensitize menus */\r
-            MenuProgram->Enabled = false;\r
-            MenuTitle->Enabled = false;\r
-            MenuChapter->Enabled = false;\r
-            MenuAudio->Enabled = false;\r
-            MenuSubtitles->Enabled = false;\r
-            PopupNavigation->Enabled = false;\r
-            PopupAudio->Enabled = false;\r
-            PopupSubtitles->Enabled = false;\r
         }\r
+\r
+        /* unsensitize menus */\r
+        MenuProgram->Enabled = false;\r
+        MenuTitle->Enabled = false;\r
+        MenuChapter->Enabled = false;\r
+        MenuAudio->Enabled = false;\r
+        MenuSubtitles->Enabled = false;\r
+        PopupNavigation->Enabled = false;\r
+        PopupAudio->Enabled = false;\r
+        PopupSubtitles->Enabled = false;\r
     }\r
 \r
     /* resize main window */\r
index 41b87ad847a0b9bb1303860efb5a4dbab0610ff9..139a91839bc0ac6afcf50381c2172e38ed34a4c1 100644 (file)
@@ -4,7 +4,7 @@
  * decoders.
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: input.c,v 1.199 2002/06/01 18:04:49 sam Exp $
+ * $Id: input.c,v 1.200 2002/06/02 11:59:46 sam Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -57,7 +57,6 @@ static  int RunThread       ( input_thread_t *p_input );
 static  int InitThread      ( input_thread_t *p_input );
 static void ErrorThread     ( input_thread_t *p_input );
 static void CloseThread     ( input_thread_t *p_input );
-static void DestroyThread   ( input_thread_t *p_input );
 static void EndThread       ( input_thread_t *p_input );
 
 /*****************************************************************************
@@ -87,9 +86,6 @@ input_thread_t *__input_CreateThread( vlc_object_t *p_parent,
     /* Set target */
     p_input->psz_source = strdup( p_item->psz_name );
 
-    /* Set status */
-    p_input->i_status   = THREAD_CREATE;
-
     /* Demux */
     p_input->p_demux_module = NULL;
     p_input->pf_init    = NULL;
@@ -156,7 +152,7 @@ input_thread_t *__input_CreateThread( vlc_object_t *p_parent,
 
     vlc_object_attach( p_input, p_parent );
 
-    /* Create thread. */
+    /* Create thread and wait for its readiness. */
     if( vlc_thread_create( p_input, "input", RunThread, 1 ) )
     {
         msg_Err( p_input, "cannot create input thread (%s)", strerror(errno) );
@@ -164,18 +160,6 @@ input_thread_t *__input_CreateThread( vlc_object_t *p_parent,
         return NULL;
     }
 
-#if 0
-    /* If status is NULL, wait until the thread is created */
-    if( pi_status == NULL )
-    {
-        do
-        {
-            msleep( THREAD_SLEEP );
-        } while( (i_status != THREAD_READY) && (i_status != THREAD_ERROR)
-                && (i_status != THREAD_FATAL) );
-    }
-#endif
-
     return p_input;
 }
 
@@ -184,7 +168,7 @@ input_thread_t *__input_CreateThread( vlc_object_t *p_parent,
  *****************************************************************************
  * This function should not return until the thread is effectively cancelled.
  *****************************************************************************/
-void input_StopThread( input_thread_t *p_input, int *pi_status )
+void input_StopThread( input_thread_t *p_input )
 {
     /* Make the thread exit from a possible vlc_cond_wait() */
     vlc_mutex_lock( &p_input->stream.stream_lock );
@@ -193,18 +177,6 @@ void input_StopThread( input_thread_t *p_input, int *pi_status )
 
     vlc_cond_signal( &p_input->stream.stream_wait );
     vlc_mutex_unlock( &p_input->stream.stream_lock );
-
-    /* If status is NULL, wait until thread has been destroyed */
-#if 0
-    if( pi_status == NULL )
-    {
-        do
-        {
-            msleep( THREAD_SLEEP );
-        } while ( (i_status != THREAD_OVER) && (i_status != THREAD_ERROR)
-                  && (i_status != THREAD_FATAL) );
-    }
-#endif
 }
 
 /*****************************************************************************
@@ -221,9 +193,6 @@ void input_DestroyThread( input_thread_t *p_input )
     vlc_mutex_destroy( &p_input->stream.control.control_lock );
     vlc_cond_destroy( &p_input->stream.stream_wait );
     vlc_mutex_destroy( &p_input->stream.stream_lock );
-    
-    /* Free input structure */
-    free( p_input );
 }
 
 /*****************************************************************************
@@ -236,18 +205,14 @@ static int RunThread( input_thread_t *p_input )
     if( InitThread( p_input ) )
     {
         /* If we failed, wait before we are killed, and exit */
-        p_input->i_status = THREAD_ERROR;
         p_input->b_error = 1;
         vlc_thread_ready( p_input );
         ErrorThread( p_input );
-        DestroyThread( p_input );
         return 0;
     }
 
     vlc_thread_ready( p_input );
 
-    p_input->i_status = THREAD_READY;
-
     /* initialization is complete */
     vlc_mutex_lock( &p_input->stream.stream_lock );
     p_input->stream.b_changed = 1;
@@ -393,8 +358,6 @@ static int RunThread( input_thread_t *p_input )
 
     EndThread( p_input );
 
-    DestroyThread( p_input );
-
     return 0;
 }
 
@@ -583,8 +546,8 @@ static void EndThread( input_thread_t * p_input )
 
     input_DumpStream( p_input );
 
-    /* Store status */
-    p_input->i_status = THREAD_END;
+    /* Tell we're dead */
+    p_input->b_dead = 1;
 
     /* Free all ES and destroy all decoder threads */
     input_EndStream( p_input );
@@ -610,12 +573,3 @@ static void CloseThread( input_thread_t * p_input )
     free( p_input->psz_source );
 }
 
-/*****************************************************************************
- * DestroyThread: destroy the input thread
- *****************************************************************************/
-static void DestroyThread( input_thread_t * p_input )
-{
-    /* Update status */
-    p_input->i_status = THREAD_OVER;
-}
-
index a088d5f5c79c3c84f26b7e292d33469974b1d4bf..40ac5ab66e69c271c0b80bb5c424a0aba1c7d75b 100644 (file)
@@ -2,7 +2,7 @@
  * mpeg_system.c: TS, PS and PES management
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: mpeg_system.c,v 1.98 2002/06/01 12:32:01 sam Exp $
+ * $Id: mpeg_system.c,v 1.99 2002/06/02 11:59:46 sam Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *          Michel Lespinasse <walken@via.ecp.fr>
@@ -1226,8 +1226,6 @@ void input_DemuxTS( input_thread_t * p_input, data_packet_t * p_data,
                  * draft. As there is nothing interesting in this packet
                  * (except PCR that have already been handled), we can trash
                  * the packet. */
-                msg_Warn( p_input,
-                          "packet without payload received by TS demux" );
                 b_trash = 1;
             }
             else if( i_dummy <= 0 )
index 29efc9a89766150dcbd223ad0cf137e71cccd23a..ee2938933d2e8889f8900287b5b6775c6396b04a 100644 (file)
@@ -2,7 +2,7 @@
  * playlist.c : Playlist management functions
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: playlist.c,v 1.3 2002/06/02 09:03:54 sam Exp $
+ * $Id: playlist.c,v 1.4 2002/06/02 11:59:46 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -158,7 +158,7 @@ int playlist_Delete( playlist_t * p_playlist, int i_pos )
 /*****************************************************************************
  * playlist_Command: do a playlist action
  *****************************************************************************
- * Delete the item in the playlist with position i_pos.
+ * 
  *****************************************************************************/
 void playlist_Command( playlist_t * p_playlist, int i_command, int i_arg )
 {   
@@ -199,7 +199,7 @@ static void RunThread ( playlist_t *p_playlist )
         /* If there is an input, check that it doesn't need to die. */
         if( p_playlist->p_input )
         {
-            if( p_playlist->p_input->i_status == THREAD_OVER )
+            if( p_playlist->p_input->b_dead )
             {
                 input_thread_t *p_input;
 
@@ -213,13 +213,12 @@ static void RunThread ( playlist_t *p_playlist )
                 vlc_object_detach_all( p_input );
                 vlc_object_release( p_input );
                 input_DestroyThread( p_input );
+                vlc_object_destroy( p_input );
             }
-            else if(    ( p_playlist->p_input->i_status == THREAD_READY
-                           || p_playlist->p_input->i_status == THREAD_ERROR )
-                     && ( p_playlist->p_input->b_error
-                           || p_playlist->p_input->b_eof ) )
+            else if( p_playlist->p_input->b_error
+                      || p_playlist->p_input->b_eof )
             {
-                input_StopThread( p_playlist->p_input, NULL );
+                input_StopThread( p_playlist->p_input );
             }
         }
         else if( p_playlist->i_status != PLAYLIST_STOPPED )
@@ -257,7 +256,7 @@ static void RunThread ( playlist_t *p_playlist )
     /* If there is an input, kill it */
     while( p_playlist->p_input )
     {
-        if( p_playlist->p_input->i_status == THREAD_OVER )
+        if( p_playlist->p_input->b_dead )
         {
             input_thread_t *p_input;
 
@@ -271,13 +270,11 @@ static void RunThread ( playlist_t *p_playlist )
             vlc_object_detach_all( p_input );
             vlc_object_release( p_input );
             input_DestroyThread( p_input );
+            vlc_object_destroy( p_input );
         }
-        else if(    ( p_playlist->p_input->i_status == THREAD_READY
-                       || p_playlist->p_input->i_status == THREAD_ERROR )
-                 && ( p_playlist->p_input->b_error
-                       || p_playlist->p_input->b_eof ) )
+        else if( p_playlist->p_input->b_error || p_playlist->p_input->b_eof )
         {
-            input_StopThread( p_playlist->p_input, NULL );
+            input_StopThread( p_playlist->p_input );
         }
         else
         {