Commit b73f6722 authored by Sam Hocevar's avatar Sam Hocevar

(new in MAIN)

  * ./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.
parent 1de74b87
......@@ -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,
......
......@@ -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)
......
......@@ -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>
* Stphane 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 */
......
......@@ -667,17 +667,17 @@ void __fastcall TMainFrameDlg::ModeManage()
/* add space between tolbar and statusbar when
* nothing is displayed; isn't it nicer ? :) */
i_Height += 17;
/* unsensitize menus */
MenuProgram->Enabled = false;
MenuTitle->Enabled = false;
MenuChapter->Enabled = false;
MenuAudio->Enabled = false;
MenuSubtitles->Enabled = false;
PopupNavigation->Enabled = false;
PopupAudio->Enabled = false;
PopupSubtitles->Enabled = false;
}
/* unsensitize menus */
MenuProgram->Enabled = false;
MenuTitle->Enabled = false;
MenuChapter->Enabled = false;
MenuAudio->Enabled = false;
MenuSubtitles->Enabled = false;
PopupNavigation->Enabled = false;
PopupAudio->Enabled = false;
PopupSubtitles->Enabled = false;
}
/* resize main window */
......
......@@ -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;
}
......@@ -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 )
......
......@@ -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
{
......
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