Commit 0e8b68b5 authored by Sam Hocevar's avatar Sam Hocevar

  * ./src/input/input.c: fixed a few segfaults caused by the dummy plugin.
  * ./plugins/mpeg_adec/mpeg_adec.c: fixed a segfault due to misuse of
    DecoderError.
  * ./plugins/x11/xcommon.c: replaced XFlush with XSync. This must be the
    fourth time someone has to commit this, so I added a reminder :-)
parent 5467d33a
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* input_dummy.c: dummy input plugin, to manage "vlc:***" special options * input_dummy.c: dummy input plugin, to manage "vlc:***" special options
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: input_dummy.c,v 1.13 2002/01/09 02:01:14 sam Exp $ * $Id: input_dummy.c,v 1.14 2002/01/10 04:11:25 sam Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -47,8 +47,29 @@ ...@@ -47,8 +47,29 @@
* Local prototypes * Local prototypes
*****************************************************************************/ *****************************************************************************/
static int DummyProbe ( probedata_t * ); static int DummyProbe ( probedata_t * );
static void DummyInit ( struct input_thread_s * );
static void DummyOpen ( struct input_thread_s * ); static void DummyOpen ( struct input_thread_s * );
static void DummyClose ( struct input_thread_s * ); static void DummyClose ( struct input_thread_s * );
static void DummyEnd ( struct input_thread_s * );
static int DummyRead ( struct input_thread_s *, data_packet_t ** );
/*****************************************************************************
* dummy_data_t: private input data
*****************************************************************************/
typedef struct dummy_data_s
{
/* The real command */
int i_command;
/* Used for the pause command */
mtime_t expiration;
} dummy_data_t;
#define COMMAND_NOP 0
#define COMMAND_QUIT 1
#define COMMAND_LOOP 2
#define COMMAND_PAUSE 3
/***************************************************************************** /*****************************************************************************
* Functions exported as capabilities. They are declared as static so that * Functions exported as capabilities. They are declared as static so that
...@@ -58,12 +79,12 @@ void _M( input_getfunctions )( function_list_t * p_function_list ) ...@@ -58,12 +79,12 @@ void _M( input_getfunctions )( function_list_t * p_function_list )
{ {
#define input p_function_list->functions.input #define input p_function_list->functions.input
p_function_list->pf_probe = DummyProbe; p_function_list->pf_probe = DummyProbe;
input.pf_init = NULL; /* Not needed, open is called first */ input.pf_init = DummyInit;
input.pf_open = DummyOpen; input.pf_open = DummyOpen;
input.pf_close = DummyClose; input.pf_close = DummyClose;
input.pf_end = NULL; input.pf_end = DummyEnd;
input.pf_set_area = NULL; input.pf_set_area = NULL;
input.pf_read = NULL; input.pf_read = DummyRead;
input.pf_demux = NULL; input.pf_demux = NULL;
input.pf_new_packet = NULL; input.pf_new_packet = NULL;
input.pf_new_pes = NULL; input.pf_new_pes = NULL;
...@@ -74,10 +95,6 @@ void _M( input_getfunctions )( function_list_t * p_function_list ) ...@@ -74,10 +95,6 @@ void _M( input_getfunctions )( function_list_t * p_function_list )
#undef input #undef input
} }
/*
* Data reading functions
*/
/***************************************************************************** /*****************************************************************************
* DummyProbe: verifies that the input is a vlc command * DummyProbe: verifies that the input is a vlc command
*****************************************************************************/ *****************************************************************************/
...@@ -96,21 +113,37 @@ static int DummyProbe( probedata_t *p_data ) ...@@ -96,21 +113,37 @@ static int DummyProbe( probedata_t *p_data )
} }
/***************************************************************************** /*****************************************************************************
* DummyOpen: open the target, ie. do what the command says * DummyOpen: open the target, ie. do nothing
*****************************************************************************/ *****************************************************************************/
static void DummyOpen( input_thread_t * p_input ) static void DummyOpen( input_thread_t * p_input )
{ {
p_input->stream.i_method = INPUT_METHOD_NONE;
}
/*****************************************************************************
* DummyClose: close the target, ie. do nothing
*****************************************************************************/
static void DummyClose( input_thread_t * p_input )
{
;
}
/*****************************************************************************
* DummyOpen: initialize the target, ie. parse the command
*****************************************************************************/
static void DummyInit( struct input_thread_s *p_input )
{
dummy_data_t* p_method;
char *psz_name = p_input->p_source; char *psz_name = p_input->p_source;
int i_len = strlen( psz_name ); int i_len = strlen( psz_name );
int i_arg; int i_arg;
/* XXX: Tell the input layer to quit immediately, there must p_input->stream.b_seekable = 0;
* be a nicer way to do this. */
p_input->b_error = 1;
if( ( i_len <= 4 ) || strncasecmp( psz_name, "vlc:", 4 ) ) if( ( i_len <= 4 ) || strncasecmp( psz_name, "vlc:", 4 ) )
{ {
/* If the command doesn't start with "vlc:" then it's not for us */ /* If the command doesn't start with "vlc:" then it's not for us */
p_input->b_error = 1;
return; return;
} }
...@@ -118,10 +151,22 @@ static void DummyOpen( input_thread_t * p_input ) ...@@ -118,10 +151,22 @@ static void DummyOpen( input_thread_t * p_input )
psz_name += 4; psz_name += 4;
i_len -= 4; i_len -= 4;
p_method = malloc( sizeof( dummy_data_t ) );
if( p_method == NULL )
{
intf_ErrMsg( "input: out of memory" );
p_input->b_error = 1;
return;
}
p_input->p_plugin_data = (void *)p_method;
p_input->stream.p_demux_data = NULL;
/* Check for a "vlc:nop" command */ /* Check for a "vlc:nop" command */
if( i_len == 3 && !strncasecmp( psz_name, "nop", 3 ) ) if( i_len == 3 && !strncasecmp( psz_name, "nop", 3 ) )
{ {
intf_WarnMsg( 2, "input: command `nop'" ); intf_WarnMsg( 2, "input: command `nop'" );
p_method->i_command = COMMAND_NOP;
return; return;
} }
...@@ -129,7 +174,7 @@ static void DummyOpen( input_thread_t * p_input ) ...@@ -129,7 +174,7 @@ static void DummyOpen( input_thread_t * p_input )
if( i_len == 4 && !strncasecmp( psz_name, "quit", 4 ) ) if( i_len == 4 && !strncasecmp( psz_name, "quit", 4 ) )
{ {
intf_WarnMsg( 2, "input: command `quit'" ); intf_WarnMsg( 2, "input: command `quit'" );
p_main->p_intf->b_die = 1; p_method->i_command = COMMAND_QUIT;
return; return;
} }
...@@ -137,7 +182,7 @@ static void DummyOpen( input_thread_t * p_input ) ...@@ -137,7 +182,7 @@ static void DummyOpen( input_thread_t * p_input )
if( i_len == 4 && !strncasecmp( psz_name, "loop", 4 ) ) if( i_len == 4 && !strncasecmp( psz_name, "loop", 4 ) )
{ {
intf_WarnMsg( 2, "input: command `loop'" ); intf_WarnMsg( 2, "input: command `loop'" );
intf_PlaylistJumpto( p_main->p_playlist, -1 ); p_method->i_command = COMMAND_LOOP;
return; return;
} }
...@@ -145,21 +190,64 @@ static void DummyOpen( input_thread_t * p_input ) ...@@ -145,21 +190,64 @@ static void DummyOpen( input_thread_t * p_input )
if( i_len > 6 && !strncasecmp( psz_name, "pause:", 6 ) ) if( i_len > 6 && !strncasecmp( psz_name, "pause:", 6 ) )
{ {
i_arg = atoi( psz_name + 6 ); i_arg = atoi( psz_name + 6 );
intf_WarnMsg( 2, "input: command `pause %i'", i_arg );
intf_WarnMsgImm( 2, "input: command `pause %i'", i_arg ); p_method->i_command = COMMAND_PAUSE;
p_method->expiration = mdate() + (mtime_t)i_arg * (mtime_t)1000000;
msleep( i_arg * 1000000 );
return; return;
} }
intf_ErrMsg( "input error: unknown command `%s'", psz_name ); intf_ErrMsg( "input error: unknown command `%s'", psz_name );
free( p_input->p_plugin_data );
p_input->b_error = 1;
return;
} }
/***************************************************************************** /*****************************************************************************
* DummyClose: close the target, ie. do nothing * DummyEnd: end the target, ie. do nothing
*****************************************************************************/ *****************************************************************************/
static void DummyClose( input_thread_t * p_input ) static void DummyEnd( struct input_thread_s *p_input )
{ {
return; free( p_input->p_plugin_data );
}
/*****************************************************************************
* DummyRead: do what the command says
*****************************************************************************/
static int DummyRead( struct input_thread_s *p_input, data_packet_t **pp_data )
{
dummy_data_t* p_method = (dummy_data_t *)p_input->p_plugin_data;
switch( p_method->i_command )
{
case COMMAND_QUIT:
p_input->b_die = 1;
break;
case COMMAND_LOOP:
intf_PlaylistJumpto( p_main->p_playlist, -1 );
p_input->b_eof = 1;
break;
case COMMAND_PAUSE:
if( mdate() < p_method->expiration )
{
msleep( 10000 );
}
else
{
p_input->b_eof = 1;
}
break;
case COMMAND_NOP:
default:
p_input->b_eof = 1;
break;
}
*pp_data = NULL;
return 0;
} }
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* -dvd_udf to find files * -dvd_udf to find files
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * Copyright (C) 1998-2001 VideoLAN
* $Id: input_dvd.c,v 1.117 2001/12/31 01:13:12 massiot Exp $ * $Id: input_dvd.c,v 1.118 2002/01/10 04:11:25 sam Exp $
* *
* Author: Stphane Borel <stef@via.ecp.fr> * Author: Stphane Borel <stef@via.ecp.fr>
* *
...@@ -304,6 +304,8 @@ static void DVDOpen( struct input_thread_s *p_input ) ...@@ -304,6 +304,8 @@ static void DVDOpen( struct input_thread_s *p_input )
vlc_mutex_lock( &p_input->stream.stream_lock ); vlc_mutex_lock( &p_input->stream.stream_lock );
p_input->stream.i_method = INPUT_METHOD_DVD;
/* If we are here we can control the pace... */ /* If we are here we can control the pace... */
p_input->stream.b_pace_control = 1; p_input->stream.b_pace_control = 1;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* It depends on: libdvdread for ifo files and block reading. * It depends on: libdvdread for ifo files and block reading.
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: input_dvdread.c,v 1.17 2002/01/08 23:34:06 stef Exp $ * $Id: input_dvdread.c,v 1.18 2002/01/10 04:11:25 sam Exp $
* *
* Author: Stphane Borel <stef@via.ecp.fr> * Author: Stphane Borel <stef@via.ecp.fr>
* *
...@@ -281,6 +281,8 @@ static void DvdReadOpen( struct input_thread_s *p_input ) ...@@ -281,6 +281,8 @@ static void DvdReadOpen( struct input_thread_s *p_input )
vlc_mutex_lock( &p_input->stream.stream_lock ); vlc_mutex_lock( &p_input->stream.stream_lock );
p_input->stream.i_method = INPUT_METHOD_DVD;
/* If we are here we can control the pace... */ /* If we are here we can control the pace... */
p_input->stream.b_pace_control = 1; p_input->stream.b_pace_control = 1;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* gtk_display.c: Gtk+ tools for main interface * gtk_display.c: Gtk+ tools for main interface
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: gtk_display.c,v 1.12 2002/01/09 02:01:14 sam Exp $ * $Id: gtk_display.c,v 1.13 2002/01/10 04:11:25 sam Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* Stphane Borel <stef@via.ecp.fr> * Stphane Borel <stef@via.ecp.fr>
...@@ -159,7 +159,13 @@ gint GtkModeManage( intf_thread_t * p_intf ) ...@@ -159,7 +159,13 @@ gint GtkModeManage( intf_thread_t * p_intf )
break; break;
default: default:
intf_ErrMsg( "intf error: can't determine input method" ); intf_WarnMsg( 3, "intf: can't determine input method" );
gtk_widget_show( GTK_WIDGET( p_file_box ) );
p_label = gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_window ),
"label_status" );
gtk_label_set_text( GTK_LABEL( p_label ),
p_input_bank->pp_input[0]->p_source );
break; break;
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* xmga.c : X11 MGA plugin for vlc * xmga.c : X11 MGA plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * Copyright (C) 1998-2001 VideoLAN
* $Id: xmga.c,v 1.1 2002/01/09 02:01:14 sam Exp $ * $Id: xmga.c,v 1.2 2002/01/10 04:11:25 sam Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -971,118 +971,118 @@ static void FreePicture( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -971,118 +971,118 @@ static void FreePicture( vout_thread_t *p_vout, picture_t *p_pic )
*****************************************************************************/ *****************************************************************************/
static void ToggleFullScreen ( vout_thread_t *p_vout ) static void ToggleFullScreen ( vout_thread_t *p_vout )
{ {
Atom prop; Atom prop;
mwmhints_t mwmhints; mwmhints_t mwmhints;
int i_xpos, i_ypos, i_width, i_height; int i_xpos, i_ypos, i_width, i_height;
p_vout->b_fullscreen = !p_vout->b_fullscreen; p_vout->b_fullscreen = !p_vout->b_fullscreen;
if( p_vout->b_fullscreen ) if( p_vout->b_fullscreen )
{ {
Window next_parent, parent, *p_dummy, dummy1; Window next_parent, parent, *p_dummy, dummy1;
unsigned int dummy2, dummy3; unsigned int dummy2, dummy3;
intf_WarnMsg( 3, "vout: entering fullscreen mode" ); intf_WarnMsg( 3, "vout: entering fullscreen mode" );
/* Save current window coordinates so they can be restored when /* Save current window coordinates so they can be restored when
* we exit from fullscreen mode */ * we exit from fullscreen mode */
/* find the real parent, which means the which is a direct child of /* find the real parent, which means the which is a direct child of
* the root window */ * the root window */
next_parent = parent = p_vout->p_sys->window; next_parent = parent = p_vout->p_sys->window;
while( next_parent != DefaultRootWindow( p_vout->p_sys->p_display ) ) while( next_parent != DefaultRootWindow( p_vout->p_sys->p_display ) )
{ {
parent = next_parent; parent = next_parent;
XQueryTree( p_vout->p_sys->p_display, XQueryTree( p_vout->p_sys->p_display,
parent, parent,
&dummy1,
&next_parent,
&p_dummy,
&dummy2 );
XFree((void *)p_dummy);
}
XGetGeometry( p_vout->p_sys->p_display,
p_vout->p_sys->window,
&dummy1, &dummy1,
&next_parent, &dummy2,
&p_dummy, &dummy3,
&dummy2 ); &p_vout->p_sys->i_width_backup,
XFree((void *)p_dummy); &p_vout->p_sys->i_height_backup,
} &dummy2, &dummy3 );
XGetGeometry( p_vout->p_sys->p_display, XTranslateCoordinates( p_vout->p_sys->p_display,
p_vout->p_sys->window, parent,
&dummy1, DefaultRootWindow( p_vout->p_sys->p_display ),
&dummy2, 0,
&dummy3, 0,
&p_vout->p_sys->i_width_backup, &p_vout->p_sys->i_xpos_backup,
&p_vout->p_sys->i_height_backup, &p_vout->p_sys->i_ypos_backup,
&dummy2, &dummy3 ); &dummy1 );
XTranslateCoordinates( p_vout->p_sys->p_display, mwmhints.flags = MWM_HINTS_DECORATIONS;
parent, mwmhints.decorations = 0;
DefaultRootWindow( p_vout->p_sys->p_display ),
0, i_xpos = 0;
0, i_ypos = 0;
&p_vout->p_sys->i_xpos_backup, i_width = DisplayWidth( p_vout->p_sys->p_display,
&p_vout->p_sys->i_ypos_backup,
&dummy1 );
mwmhints.flags = MWM_HINTS_DECORATIONS;
mwmhints.decorations = 0;
i_xpos = 0;
i_ypos = 0;
i_width = DisplayWidth( p_vout->p_sys->p_display,
p_vout->p_sys->i_screen );
i_height = DisplayHeight( p_vout->p_sys->p_display,
p_vout->p_sys->i_screen ); p_vout->p_sys->i_screen );
i_height = DisplayHeight( p_vout->p_sys->p_display,
p_vout->p_sys->i_screen );
#if 0 #if 0
/* Being a transient window allows us to really be fullscreen (display /* Being a transient window allows us to really be fullscreen (display
* over the taskbar for instance) but then we end-up with the same * over the taskbar for instance) but then we end-up with the same
* result as with the brute force method */ * result as with the brute force method */
XSetTransientForHint( p_vout->p_sys->p_display, XSetTransientForHint( p_vout->p_sys->p_display,
p_vout->p_sys->window, None ); p_vout->p_sys->window, None );
#endif #endif
} }
else else
{ {
intf_WarnMsg( 3, "vout: leaving fullscreen mode" ); intf_WarnMsg( 3, "vout: leaving fullscreen mode" );
mwmhints.flags = MWM_HINTS_DECORATIONS; mwmhints.flags = MWM_HINTS_DECORATIONS;
mwmhints.decorations = 1; mwmhints.decorations = 1;
i_xpos = p_vout->p_sys->i_xpos_backup; i_xpos = p_vout->p_sys->i_xpos_backup;
i_ypos = p_vout->p_sys->i_ypos_backup; i_ypos = p_vout->p_sys->i_ypos_backup;
i_width = p_vout->p_sys->i_width_backup; i_width = p_vout->p_sys->i_width_backup;
i_height = p_vout->p_sys->i_height_backup; i_height = p_vout->p_sys->i_height_backup;
} }
/* To my knowledge there are two ways to create a borderless window. /* To my knowledge there are two ways to create a borderless window.
* There's the generic way which is to tell x to bypass the window manager, * There's the generic way which is to tell x to bypass the window manager,
* but this creates problems with the focus of other applications. * but this creates problems with the focus of other applications.
* The other way is to use the motif property "_MOTIF_WM_HINTS" which * The other way is to use the motif property "_MOTIF_WM_HINTS" which
* luckily seems to be supported by most window managers. * luckily seems to be supported by most window managers.
*/ */
prop = XInternAtom( p_vout->p_sys->p_display, "_MOTIF_WM_HINTS", prop = XInternAtom( p_vout->p_sys->p_display, "_MOTIF_WM_HINTS",
False ); False );
XChangeProperty( p_vout->p_sys->p_display, p_vout->p_sys->window, XChangeProperty( p_vout->p_sys->p_display, p_vout->p_sys->window,
prop, prop, 32, PropModeReplace, prop, prop, 32, PropModeReplace,
(unsigned char *)&mwmhints, (unsigned char *)&mwmhints,
PROP_MWM_HINTS_ELEMENTS ); PROP_MWM_HINTS_ELEMENTS );
#if 0 /* brute force way to remove decorations */ #if 0 /* brute force way to remove decorations */
XSetWindowAttributes attributes; XSetWindowAttributes attributes;
attributes.override_redirect = True; attributes.override_redirect = True;
XChangeWindowAttributes( p_vout->p_sys->p_display, XChangeWindowAttributes( p_vout->p_sys->p_display,
p_vout->p_sys->window, p_vout->p_sys->window,
CWOverrideRedirect, CWOverrideRedirect,
&attributes); &attributes);
#endif #endif
/* We need to unmap and remap the window if we want the window /* We need to unmap and remap the window if we want the window
* manager to take our changes into effect */ * manager to take our changes into effect */
XUnmapWindow( p_vout->p_sys->p_display, p_vout->p_sys->window); XUnmapWindow( p_vout->p_sys->p_display, p_vout->p_sys->window);
XMapRaised( p_vout->p_sys->p_display, p_vout->p_sys->window); XMapRaised( p_vout->p_sys->p_display, p_vout->p_sys->window);
XMoveResizeWindow( p_vout->p_sys->p_display, XMoveResizeWindow( p_vout->p_sys->p_display,
p_vout->p_sys->window, p_vout->p_sys->window,
i_xpos, i_xpos,
i_ypos, i_ypos,
i_width, i_width,
i_height ); i_height );
XFlush( p_vout->p_sys->p_display ); XSync( p_vout->p_sys->p_display, False );
} }
/***************************************************************************** /*****************************************************************************
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* mpeg_adec.c: MPEG audio decoder thread * mpeg_adec.c: MPEG audio decoder thread
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * Copyright (C) 1999-2001 VideoLAN
* $Id: mpeg_adec.c,v 1.11 2002/01/09 00:33:37 asmax Exp $ * $Id: mpeg_adec.c,v 1.12 2002/01/10 04:11:25 sam Exp $
* *
* Authors: Michel Kaempf <maxx@via.ecp.fr> * Authors: Michel Kaempf <maxx@via.ecp.fr>
* Michel Lespinasse <walken@via.ecp.fr> * Michel Lespinasse <walken@via.ecp.fr>
...@@ -191,7 +191,8 @@ static void DecodeThread( adec_thread_t * p_adec ) ...@@ -191,7 +191,8 @@ static void DecodeThread( adec_thread_t * p_adec )
{ {
intf_ErrMsg( "adec error: failed to create Audio Output " intf_ErrMsg( "adec error: failed to create Audio Output "
"Fifo." ); "Fifo." );
DecoderError( p_adec->p_fifo ); p_adec->p_fifo->b_error = 1;
return;
} }
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* xcommon.c: Functions common to the X11 and XVideo plugins * xcommon.c: Functions common to the X11 and XVideo plugins
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * Copyright (C) 1998-2001 VideoLAN
* $Id: xcommon.c,v 1.9 2002/01/07 02:12:29 sam Exp $ * $Id: xcommon.c,v 1.10 2002/01/10 04:11:25 sam Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -580,8 +580,8 @@ static void vout_Display( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -580,8 +580,8 @@ static void vout_Display( vout_thread_t *p_vout, picture_t *p_pic )
#endif #endif
} }
/* Make sure the command is sent now */ /* Make sure the command is sent now - do NOT use XFlush !*/
XFlush( p_vout->p_sys->p_display ); XSync( p_vout->p_sys->p_display, False );
} }
/***************************************************************************** /*****************************************************************************
...@@ -1132,6 +1132,7 @@ static int CreateWindow( vout_thread_t *p_vout ) ...@@ -1132,6 +1132,7 @@ static int CreateWindow( vout_thread_t *p_vout )
ToggleCursor( p_vout ); ToggleCursor( p_vout );
} }
/* Do NOT use XFlush here ! */
XSync( p_vout->p_sys->p_display, False ); XSync( p_vout->p_sys->p_display, False );
/* At this stage, the window is open, displayed, and ready to /* At this stage, the window is open, displayed, and ready to
...@@ -1147,6 +1148,7 @@ static int CreateWindow( vout_thread_t *p_vout ) ...@@ -1147,6 +1148,7 @@ static int CreateWindow( vout_thread_t *p_vout )
*****************************************************************************/ *****************************************************************************/
static void DestroyWindow( vout_thread_t *p_vout ) static void DestroyWindow( vout_thread_t *p_vout )
{ {
/* Do NOT use XFlush here ! */
XSync( p_vout->p_sys->p_display, False ); XSync( p_vout->p_sys->p_display, False );
#ifdef MODULE_NAME_IS_xvideo #ifdef MODULE_NAME_IS_xvideo
...@@ -1395,6 +1397,7 @@ static void FreePicture( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -1395,6 +1397,7 @@ static void FreePicture( vout_thread_t *p_vout, picture_t *p_pic )
IMAGE_FREE( p_pic->p_sys->p_image ); IMAGE_FREE( p_pic->p_sys->p_image );
} }
/* Do NOT use XFlush here ! */
XSync( p_vout->p_sys->p_display, False ); XSync( p_vout->p_sys->p_display, False );
free( p_pic->p_sys ); free( p_pic->p_sys );
...@@ -1408,118 +1411,120 @@ static void FreePicture( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -1408,118 +1411,120 @@ static void FreePicture( vout_thread_t *p_vout, picture_t *p_pic )
*****************************************************************************/ *****************************************************************************/
static void ToggleFullScreen ( vout_thread_t *p_vout ) static void ToggleFullScreen ( vout_thread_t *p_vout )
{ {
Atom prop; Atom prop;
mwmhints_t mwmhints; mwmhints_t mwmhints;
int i_xpos, i_ypos, i_width, i_height; int i_xpos, i_ypos, i_width, i_height;
p_vout->b_fullscreen = !p_vout->b_fullscreen; p_vout->b_fullscreen = !p_vout->b_fullscreen;
if( p_vout->b_fullscreen ) if( p_vout->b_fullscreen )
{ {
Window next_parent, parent, *p_dummy, dummy1; Window next_parent, parent, *p_dummy, dummy1;
unsigned int dummy2, dummy3; unsigned int dummy2, dummy3;
intf_WarnMsg( 3, "vout: entering fullscreen mode" ); intf_WarnMsg( 3, "vout: entering fullscreen mode" );
/* Save current window coordinates so they can be restored when /* Save current window coordinates so they can be restored when
* we exit from fullscreen mode */ * we exit from fullscreen mode */
/* find the real parent, which means the which is a direct child of /* find the real parent, which means the which is a direct child of
* the root window */ * the root window */
next_parent = parent = p_vout->p_sys->window; next_parent = parent = p_vout->p_sys->window;
while( next_parent != DefaultRootWindow( p_vout->p_sys->p_display ) ) while( next_parent != DefaultRootWindow( p_vout->p_sys->p_display ) )
{ {
parent = next_parent; parent = next_parent;
XQueryTree( p_vout->p_sys->p_display, XQueryTree( p_vout->p_sys->p_display,
parent, parent,
&dummy1,
&next_parent,
&p_dummy,
&dummy2 );
XFree((void *)p_dummy);
}
XGetGeometry( p_vout->p_sys->p_display,
p_vout->p_sys->window,
&dummy1, &dummy1,
&next_parent, &dummy2,
&p_dummy, &dummy3,
&dummy2 ); &p_vout->p_sys->i_width_backup,
XFree((void *)p_dummy); &p_vout->p_sys->i_height_backup,
} &dummy2, &dummy3 );
XGetGeometry( p_vout->p_sys->p_display, XTranslateCoordinates( p_vout->p_sys->p_display,
p_vout->p_sys->window, parent,
&dummy1, DefaultRootWindow( p_vout->p_sys->p_display ),
&dummy2, 0,
&dummy3, 0,
&p_vout->p_sys->i_width_backup, &p_vout->p_sys->i_xpos_backup,
&p_vout->p_sys->i_height_backup, &p_vout->p_sys->i_ypos_backup,
&dummy2, &dummy3 ); &dummy1 );
XTranslateCoordinates( p_vout->p_sys->p_display, mwmhints.flags = MWM_HINTS_DECORATIONS;
parent, mwmhints.decorations = 0;
DefaultRootWindow( p_vout->p_sys->p_display ),
0, i_xpos = 0;
0, i_ypos = 0;
&p_vout->p_sys->i_xpos_backup, i_width = DisplayWidth( p_vout->p_sys->p_display,
&p_vout->p_sys->i_ypos_backup,
&dummy1 );
mwmhints.flags = MWM_HINTS_DECORATIONS;
mwmhints.decorations = 0;
i_xpos = 0;
i_ypos = 0;
i_width = DisplayWidth( p_vout->p_sys->p_display,
p_vout->p_sys->i_screen );
i_height = DisplayHeight( p_vout->p_sys->p_display,
p_vout->p_sys->i_screen ); p_vout->p_sys->i_screen );
i_height = DisplayHeight( p_vout->p_sys->p_display,
p_vout->p_sys->i_screen );
#if 0 #if 0
/* Being a transient window allows us to really be fullscreen (display /* Being a transient window allows us to really be fullscreen (display
* over the taskbar for instance) but then we end-up with the same * over the taskbar for instance) but then we end-up with the same
* result as with the brute force method */ * result as with the brute force method */
XSetTransientForHint( p_vout->p_sys->p_display, XSetTransientForHint( p_vout->p_sys->p_display,
p_vout->p_sys->window, None ); p_vout->p_sys->window, None );
#endif #endif
} }
else else
{ {
intf_WarnMsg( 3, "vout: leaving fullscreen mode" ); intf_WarnMsg( 3, "vout: leaving fullscreen mode" );
mwmhints.flags = MWM_HINTS_DECORATIONS; mwmhints.flags = MWM_HINTS_DECORATIONS;
mwmhints.decorations = 1; mwmhints.decorations = 1;
i_xpos = p_vout->p_sys->i_xpos_backup; i_xpos = p_vout->p_sys->i_xpos_backup;
i_ypos = p_vout->p_sys->i_ypos_backup; i_ypos = p_vout->p_sys->i_ypos_backup;
i_width = p_vout->p_sys->i_width_backup; i_width = p_vout->p_sys->i_width_backup;
i_height = p_vout->p_sys->i_height_backup; i_height = p_vout->p_sys->i_height_backup;
} }
/* To my knowledge there are two ways to create a borderless window. /* To my knowledge there are two ways to create a borderless window.
* There's the generic way which is to tell x to bypass the window manager, * There's the generic way which is to tell x to bypass the window manager,
* but this creates problems with the focus of other applications. * but this creates problems with the focus of other applications.
* The other way is to use the motif property "_MOTIF_WM_HINTS" which * The other way is to use the motif property "_MOTIF_WM_HINTS" which
* luckily seems to be supported by most window managers. * luckily seems to be supported by most window managers.
*/ */
prop = XInternAtom( p_vout->p_sys->p_display, "_MOTIF_WM_HINTS", prop = XInternAtom( p_vout->p_sys->p_display, "_MOTIF_WM_HINTS",
False ); False );
XChangeProperty( p_vout->p_sys->p_display, p_vout->p_sys->window, XChangeProperty( p_vout->p_sys->p_display, p_vout->p_sys->window,
prop, prop, 32, PropModeReplace, prop, prop, 32, PropModeReplace,
(unsigned char *)&mwmhints, (unsigned char *)&mwmhints,
PROP_MWM_HINTS_ELEMENTS ); PROP_MWM_HINTS_ELEMENTS );
#if 0 /* brute force way to remove decorations */ #if 0 /* brute force way to remove decorations */
XSetWindowAttributes attributes; XSetWindowAttributes attributes;
attributes.override_redirect = True; attributes.override_redirect = True;
XChangeWindowAttributes( p_vout->p_sys->p_display, XChangeWindowAttributes( p_vout->p_sys->p_display,
p_vout->p_sys->window, p_vout->p_sys->window,
CWOverrideRedirect, CWOverrideRedirect,
&attributes); &attributes);
#endif #endif
/* We need to unmap and remap the window if we want the window /* We need to unmap and remap the window if we want the window
* manager to take our changes into effect */ * manager to take our changes into effect */
XUnmapWindow( p_vout->p_sys->p_display, p_vout->p_sys->window); XUnmapWindow( p_vout->p_sys->p_display, p_vout->p_sys->window);
XMapRaised( p_vout->p_sys->p_display, p_vout->p_sys->window); XMapRaised( p_vout->p_sys->p_display, p_vout->p_sys->window);
XMoveResizeWindow( p_vout->p_sys->p_display, XMoveResizeWindow( p_vout->p_sys->p_display,
p_vout->p_sys->window, p_vout->p_sys->window,
i_xpos, i_xpos,
i_ypos, i_ypos,
i_width, i_width,
i_height ); i_height );
XFlush( p_vout->p_sys->p_display );
/* Do NOT use XFlush here ! */
XSync( p_vout->p_sys->p_display, False );
} }
/***************************************************************************** /*****************************************************************************
...@@ -2020,7 +2025,8 @@ static IMAGE_TYPE * CreateShmImage( Display* p_display, EXTRA_ARGS_SHM, ...@@ -2020,7 +2025,8 @@ static IMAGE_TYPE * CreateShmImage( Display* p_display, EXTRA_ARGS_SHM,
} }
/* Send image to X server. This instruction is required, since having /* Send image to X server. This instruction is required, since having
* built a Shm XImage and not using it causes an error on XCloseDisplay */ * built a Shm XImage and not using it causes an error on XCloseDisplay,
* and remember NOT to use XFlush ! */
XSync( p_display, False ); XSync( p_display, False );
#if 0 #if 0
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* decoders. * decoders.
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * Copyright (C) 1998-2001 VideoLAN
* $Id: input.c,v 1.169 2002/01/09 02:01:14 sam Exp $ * $Id: input.c,v 1.170 2002/01/10 04:11:25 sam Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -167,12 +167,18 @@ input_thread_t *input_CreateThread ( playlist_item_t *p_item, int *pi_status ) ...@@ -167,12 +167,18 @@ input_thread_t *input_CreateThread ( playlist_item_t *p_item, int *pi_status )
p_input->stream.b_new_mute = MUTE_NO_CHANGE; p_input->stream.b_new_mute = MUTE_NO_CHANGE;
p_input->stream.i_mux_rate = 0; p_input->stream.i_mux_rate = 0;
/* no stream, no area */ /* no stream, no program, no area, no es */
p_input->stream.p_new_program = NULL;
p_input->stream.i_area_nb = 0; p_input->stream.i_area_nb = 0;
p_input->stream.pp_areas = NULL; p_input->stream.pp_areas = NULL;
p_input->stream.p_selected_area = NULL; p_input->stream.p_selected_area = NULL;
p_input->stream.p_new_area = NULL; p_input->stream.p_new_area = NULL;
p_input->stream.pp_selected_es = NULL;
p_input->stream.p_removed_es = NULL;
p_input->stream.p_newly_selected_es = NULL;
/* By default there is one area in a stream */ /* By default there is one area in a stream */
input_AddArea( p_input ); input_AddArea( p_input );
p_input->stream.p_selected_area = p_input->stream.pp_areas[0]; p_input->stream.p_selected_area = p_input->stream.pp_areas[0];
...@@ -473,7 +479,6 @@ static int InitThread( input_thread_t * p_input ) ...@@ -473,7 +479,6 @@ static int InitThread( input_thread_t * p_input )
if( f.pf_open != NULL ) if( f.pf_open != NULL )
{ {
f.pf_open( p_input ); f.pf_open( p_input );
p_input->stream.i_method = INPUT_METHOD_DVD;
} }
#if !defined( SYS_BEOS ) && !defined( SYS_NTO ) #if !defined( SYS_BEOS ) && !defined( SYS_NTO )
/* FIXME : this is waaaay too kludgy */ /* FIXME : this is waaaay too kludgy */
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* input_ext-intf.c: services to the interface * input_ext-intf.c: services to the interface
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * Copyright (C) 1998-2001 VideoLAN
* $Id: input_ext-intf.c,v 1.32 2001/12/30 07:09:56 sam Exp $ * $Id: input_ext-intf.c,v 1.33 2002/01/10 04:11:25 sam Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -46,19 +46,19 @@ void input_SetStatus( input_thread_t * p_input, int i_mode ) ...@@ -46,19 +46,19 @@ void input_SetStatus( input_thread_t * p_input, int i_mode )
case INPUT_STATUS_END: case INPUT_STATUS_END:
p_input->stream.i_new_status = PLAYING_S; p_input->stream.i_new_status = PLAYING_S;
p_input->b_eof = 1; p_input->b_eof = 1;
intf_Msg( "input: end of stream" ); intf_WarnMsg( 1, "input: end of stream" );
break; break;
case INPUT_STATUS_PLAY: case INPUT_STATUS_PLAY:
p_input->stream.i_new_status = PLAYING_S; p_input->stream.i_new_status = PLAYING_S;
intf_Msg( "input: playing at normal rate" ); intf_WarnMsg( 1, "input: playing at normal rate" );
break; break;
case INPUT_STATUS_PAUSE: case INPUT_STATUS_PAUSE:
/* XXX: we don't need to check i_status, because input_clock.c /* XXX: we don't need to check i_status, because input_clock.c
* does it for us */ * does it for us */
p_input->stream.i_new_status = PAUSE_S; p_input->stream.i_new_status = PAUSE_S;
intf_Msg( "input: toggling pause" ); intf_WarnMsg( 1, "input: toggling pause" );
break; break;
case INPUT_STATUS_FASTER: case INPUT_STATUS_FASTER:
...@@ -66,7 +66,7 @@ void input_SetStatus( input_thread_t * p_input, int i_mode ) ...@@ -66,7 +66,7 @@ void input_SetStatus( input_thread_t * p_input, int i_mode )
if( p_input->stream.control.i_rate * 8 <= DEFAULT_RATE ) if( p_input->stream.control.i_rate * 8 <= DEFAULT_RATE )
{ {
p_input->stream.i_new_status = PLAYING_S; p_input->stream.i_new_status = PLAYING_S;
intf_Msg( "input: playing at normal rate" ); intf_WarnMsg( 1, "input: playing at normal rate" );
} }
else else
{ {
...@@ -82,8 +82,8 @@ void input_SetStatus( input_thread_t * p_input, int i_mode ) ...@@ -82,8 +82,8 @@ void input_SetStatus( input_thread_t * p_input, int i_mode )
{ {
p_input->stream.i_new_rate = DEFAULT_RATE / 2; p_input->stream.i_new_rate = DEFAULT_RATE / 2;
} }
intf_Msg( "input: playing at %i:1 fast forward", intf_WarnMsg( 1, "input: playing at %i:1 fast forward",
DEFAULT_RATE / p_input->stream.i_new_rate ); DEFAULT_RATE / p_input->stream.i_new_rate );
} }
break; break;
...@@ -92,7 +92,7 @@ void input_SetStatus( input_thread_t * p_input, int i_mode ) ...@@ -92,7 +92,7 @@ void input_SetStatus( input_thread_t * p_input, int i_mode )
if( p_input->stream.control.i_rate >= 8 * DEFAULT_RATE ) if( p_input->stream.control.i_rate >= 8 * DEFAULT_RATE )
{ {
p_input->stream.i_new_status = PLAYING_S; p_input->stream.i_new_status = PLAYING_S;
intf_Msg( "input: playing at normal rate" ); intf_WarnMsg( 1, "input: playing at normal rate" );
} }
else else
{ {
...@@ -108,8 +108,8 @@ void input_SetStatus( input_thread_t * p_input, int i_mode ) ...@@ -108,8 +108,8 @@ void input_SetStatus( input_thread_t * p_input, int i_mode )
{ {
p_input->stream.i_new_rate = DEFAULT_RATE * 2; p_input->stream.i_new_rate = DEFAULT_RATE * 2;
} }
intf_Msg( "input: playing at 1:%i slow motion", intf_WarnMsg( 1, "input: playing at 1:%i slow motion",
p_input->stream.i_new_rate / DEFAULT_RATE ); p_input->stream.i_new_rate / DEFAULT_RATE );
} }
break; break;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* intf_playlist.c : Playlist management functions * intf_playlist.c : Playlist management functions
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * Copyright (C) 1999-2001 VideoLAN
* $Id: intf_playlist.c,v 1.12 2001/12/30 07:09:56 sam Exp $ * $Id: intf_playlist.c,v 1.13 2002/01/10 04:11:25 sam Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -245,21 +245,24 @@ void intf_PlaylistJumpto( playlist_t * p_playlist , int i_pos) ...@@ -245,21 +245,24 @@ void intf_PlaylistJumpto( playlist_t * p_playlist , int i_pos)
{ {
vlc_mutex_lock( &p_playlist->change_lock ); vlc_mutex_lock( &p_playlist->change_lock );
p_playlist->i_index = i_pos; if( i_pos < -1 )
{
i_pos = -1;
}
if( p_playlist->i_index != -1 ) if( i_pos != -1 )
{ {
if( p_playlist->current.psz_name != NULL ) if( p_playlist->current.psz_name != NULL )
{ {
free( p_playlist->current.psz_name ); free( p_playlist->current.psz_name );
} }
p_playlist->current = p_playlist->p_item[ p_playlist->i_index ]; p_playlist->current = p_playlist->p_item[ i_pos ];
p_playlist->current.psz_name p_playlist->current.psz_name = strdup( p_playlist->current.psz_name );
= strdup( p_playlist->current.psz_name );
} }
p_main->p_playlist->b_stopped = 0;
p_playlist->i_index = i_pos;
p_playlist->b_stopped = 0;
vlc_mutex_unlock( &p_playlist->change_lock ); vlc_mutex_unlock( &p_playlist->change_lock );
} }
......
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