Commit c7b1c474 authored by Sam Hocevar's avatar Sam Hocevar

  * ./include/modules_inner.h: replaced _X with __VLC_SYMBOL because _X was
    already a system macro under MacOS X.
  * ./plugins/dummy/dummy.c: fixed vlc:loop, vlc:quit, etc. entries.
  * ./plugins/glide/glide.c: activated double buffering.
  * ./plugins/mga/xmga.c: started writing an xmga plugin; doesn't work yet.
  * ./src/input/input.c: fixed the input memory leak, and the insane thread
    spawning we got with vlc:loop.
  * ./src/misc/intf_eject.c: disc ejection routine courtesy of Julien Blache,
    currently Linux-only.
parent 1ae5bed4
......@@ -38,6 +38,10 @@ E: jobi@via.ecp.fr
C: jobi
D: VCD input
N: Julien Blache
E: jb@technologeek.org
D: Disc ejection code
N: Emmanuel Blindauer
E: manu@agat.net
D: aRts audio output
......
List of known vlc bugs
$Id: BUGS,v 1.3 2002/01/05 16:09:49 sam Exp $
$Id: BUGS,v 1.4 2002/01/09 02:01:14 sam Exp $
Please try to keep this file up to date. Also, grep for FIXME in the
source files for more and more bugs to fix.
......@@ -17,10 +17,7 @@ Core:
Input:
* There is a memory leak in the input because the input thread is
never joined for termination.
* vlc:foo targets don't work anymore.
-
Audio output:
......@@ -37,8 +34,6 @@ Video output:
* The DirectX video output plugin is broken because of vout4.
* The GGI video output plugin is broken because of vout4.
* The BeOS video output plugin is broken because of vout4.
* The QNX video output plugin is broken because of vout4.
......@@ -69,3 +64,8 @@ Gtk interface:
* Saving preferences does not work at all.
Misc:
* The Jin-Roh DVD seems to segfault.
......@@ -100,6 +100,7 @@ PLUGINS_TARGETS := ac3_adec/ac3_adec \
memcpy/memcpymmxext \
memcpy/memcpy3dn \
mga/mga \
mga/xmga \
motion/motion \
motion/motionmmx \
motion/motionmmxext \
......@@ -122,7 +123,7 @@ PLUGINS_TARGETS := ac3_adec/ac3_adec \
#
# C Objects
#
INTERFACE := main interface intf_msg intf_playlist
INTERFACE := main interface intf_msg intf_playlist intf_eject
INPUT := input input_ext-dec input_ext-intf input_dec input_programs input_clock mpeg_system
VIDEO_OUTPUT := video_output video_text vout_pictures vout_subpictures
AUDIO_OUTPUT := audio_output aout_ext-dec aout_u8 aout_s8 aout_u16 aout_s16 aout_spdif
......
......@@ -6439,7 +6439,7 @@ if test "${enable_mga+set}" = set; then
enableval="$enable_mga"
if test x$enable_mga = xyes
then
PLUGINS="${PLUGINS} mga"
PLUGINS="${PLUGINS} mga xmga"
fi
fi
......
......@@ -948,7 +948,7 @@ AC_ARG_ENABLE(mga,
[ --enable-mga Linux kernel Matrox support (default disabled)],
[ if test x$enable_mga = xyes
then
PLUGINS="${PLUGINS} mga"
PLUGINS="${PLUGINS} mga xmga"
fi ])
dnl
......
......@@ -3,7 +3,7 @@
* Collection of useful common types and macros definitions
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: common.h,v 1.66 2002/01/07 02:12:29 sam Exp $
* $Id: common.h,v 1.67 2002/01/09 02:01:14 sam Exp $
*
* Authors: Samuel Hocevar <sam@via.ecp.fr>
* Vincent Seguin <seguin@via.ecp.fr>
......@@ -468,6 +468,7 @@ typedef struct module_symbols_s
void ( * intf_PlaylistDestroy ) ( struct playlist_s * );
void ( * intf_PlaylistJumpto ) ( struct playlist_s *, int );
void ( * intf_UrlDecode ) ( char * );
int ( * intf_Eject ) ( const char * );
void ( * msleep ) ( mtime_t );
mtime_t ( * mdate ) ( void );
......@@ -576,6 +577,7 @@ typedef struct module_symbols_s
struct module_s * ( * module_Need ) ( int, char *, struct probedata_s * );
void ( * module_Unneed ) ( struct module_s * );
} module_symbols_t;
#ifdef PLUGIN
......
......@@ -4,7 +4,7 @@
* control the pace of reading.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: input_ext-intf.h,v 1.56 2002/01/07 02:12:29 sam Exp $
* $Id: input_ext-intf.h,v 1.57 2002/01/09 02:01:14 sam Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -259,7 +259,7 @@ typedef struct input_thread_s
boolean_t b_error;
boolean_t b_eof;
vlc_thread_t thread_id; /* id for thread functions */
int * pi_status; /* temporary status flag */
int i_status; /* status flag */
/* Input module */
struct module_s * p_input_module;
......@@ -343,7 +343,8 @@ void input_EndBank ( void );
struct input_thread_s * input_CreateThread ( struct playlist_item_s *,
int *pi_status );
void input_DestroyThread ( struct input_thread_s *, int *pi_status );
void input_StopThread ( struct input_thread_s *, int *pi_status );
void input_DestroyThread ( struct input_thread_s * );
void input_SetStatus ( struct input_thread_s *, int );
void input_Seek ( struct input_thread_s *, off_t );
......
/*****************************************************************************
* intf_eject.h: CD/DVD-ROM ejection handling functions
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: intf_eject.h,v 1.1 2002/01/09 02:01:14 sam Exp $
*
* Author: Julien Blache <jb@technologeek.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef PLUGIN
int intf_Eject( const char * );
#else
# define intf_Eject p_symbols->intf_Eject
#endif
......@@ -2,7 +2,7 @@
* modules_inner.h : Macros used from within a module.
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: modules_inner.h,v 1.10 2001/12/30 07:09:54 sam Exp $
* $Id: modules_inner.h,v 1.11 2002/01/09 02:01:14 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -56,15 +56,15 @@
/* If the module is built-in, then we need to define foo_InitModule instead
* of InitModule. Same for Activate- and DeactivateModule. */
#ifdef BUILTIN
# define _M( function ) CONCATENATE( function, MODULE_NAME )
# define _X( function ) CONCATENATE( function, MODULE_NAME )
# define DECLARE_SYMBOLS ;
# define STORE_SYMBOLS ;
# define _M( function ) CONCATENATE( function, MODULE_NAME )
# define __VLC_SYMBOL( symbol ) CONCATENATE( symbol, MODULE_NAME )
# define DECLARE_SYMBOLS ;
# define STORE_SYMBOLS ;
#else
# define _M( function ) function
# define _X( function ) CONCATENATE( function, MODULE_SYMBOL )
# define DECLARE_SYMBOLS module_symbols_t* p_symbols;
# define STORE_SYMBOLS p_symbols = p_module->p_symbols;
# define _M( function ) function
# define __VLC_SYMBOL( symbol ) CONCATENATE( symbol, MODULE_SYMBOL )
# define DECLARE_SYMBOLS module_symbols_t* p_symbols;
# define STORE_SYMBOLS p_symbols = p_module->p_symbols;
#endif
#define MODULE_STRING STRINGIFY( MODULE_NAME )
......@@ -75,7 +75,7 @@
* instance the module name, its shortcuts, its capabilities...
*/
#define MODULE_INIT_START \
int _X( InitModule ) ( module_t *p_module ) \
int __VLC_SYMBOL( InitModule ) ( module_t *p_module ) \
{ \
int i_shortcut = 0; \
p_module->psz_name = MODULE_STRING; \
......@@ -115,7 +115,7 @@
#define MODULE_ACTIVATE_START \
DECLARE_SYMBOLS; \
\
int _X( ActivateModule ) ( module_t *p_module ) \
int __VLC_SYMBOL( ActivateModule ) ( module_t *p_module ) \
{ \
p_module->p_functions = \
( module_functions_t * )malloc( sizeof( module_functions_t ) ); \
......@@ -136,7 +136,7 @@
* here.
*/
#define MODULE_DEACTIVATE_START \
int _X( DeactivateModule )( module_t *p_module ) \
int __VLC_SYMBOL( DeactivateModule )( module_t *p_module ) \
{ \
free( p_module->p_functions );
......
......@@ -2,7 +2,7 @@
* dummy.c : dummy plugin for vlc
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: dummy.c,v 1.13 2001/12/30 07:09:55 sam Exp $
* $Id: dummy.c,v 1.14 2002/01/09 02:01:14 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -50,10 +50,11 @@ MODULE_INIT_START
SET_DESCRIPTION( "dummy functions module" )
/* Capability score set to 0 because we don't want to be spawned
* unless explicitly requested to */
ADD_CAPABILITY( INPUT, 0 )
ADD_CAPABILITY( AOUT, 0 )
ADD_CAPABILITY( VOUT, 0 )
ADD_CAPABILITY( INTF, 0 )
/* This one is ok. */
ADD_CAPABILITY( INPUT, 100 )
ADD_SHORTCUT( "dummy" )
MODULE_INIT_STOP
......
......@@ -2,7 +2,7 @@
* input_dummy.c: dummy input plugin, to manage "vlc:***" special options
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: input_dummy.c,v 1.12 2002/01/04 14:01:34 sam Exp $
* $Id: input_dummy.c,v 1.13 2002/01/09 02:01:14 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -89,10 +89,10 @@ static int DummyProbe( probedata_t *p_data )
if( ( strlen(psz_name) > 4 ) && !strncasecmp( psz_name, "vlc:", 4 ) )
{
/* If the user specified "vlc:" then it's probably a file */
return( 100 );
return( 1 );
}
return( 1 );
return( 0 );
}
/*****************************************************************************
......@@ -153,7 +153,6 @@ static void DummyOpen( input_thread_t * p_input )
}
intf_ErrMsg( "input error: unknown command `%s'", psz_name );
}
/*****************************************************************************
......
......@@ -2,7 +2,7 @@
* wall.c : Wall video plugin for vlc
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: wall.c,v 1.9 2002/01/07 17:02:07 sam Exp $
* $Id: wall.c,v 1.10 2002/01/09 02:01:14 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -134,8 +134,8 @@ static int vout_Create( vout_thread_t *p_vout )
return( 1 );
}
p_vout->p_sys->i_col = 3;
p_vout->p_sys->i_row = 3;
p_vout->p_sys->i_col = 6;
p_vout->p_sys->i_row = 6;
p_vout->p_sys->pp_vout = malloc( p_vout->p_sys->i_row *
p_vout->p_sys->i_col *
......
......@@ -2,7 +2,7 @@
* glide.c : 3dfx Glide plugin for vlc
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: glide.c,v 1.10 2002/01/07 02:12:29 sam Exp $
* $Id: glide.c,v 1.11 2002/01/09 02:01:14 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -60,7 +60,6 @@ static int vout_Manage ( vout_thread_t * );
static void vout_Render ( vout_thread_t *, picture_t * );
static void vout_Display ( vout_thread_t *, picture_t * );
static int NewPicture ( vout_thread_t *, picture_t * );
static int OpenDisplay ( vout_thread_t * );
static void CloseDisplay ( vout_thread_t * );
......@@ -94,9 +93,8 @@ typedef struct vout_sys_s
{
GrLfbInfo_t p_buffer_info; /* back buffer info */
/* Dummy video memory */
byte_t * p_video; /* base adress */
size_t i_page_size; /* page size */
u8* pp_buffer[2];
int i_index;
} vout_sys_t;
......@@ -167,36 +165,49 @@ int vout_Init( vout_thread_t *p_vout )
I_OUTPUTPICTURES = 0;
/* Try to initialize up to 1 direct buffers */
while( I_OUTPUTPICTURES < 1 )
{
p_pic = NULL;
/* Find an empty picture slot */
for( i_index = 0 ; i_index < VOUT_MAX_PICTURES ; i_index++ )
{
if( p_vout->p_picture[ i_index ].i_status == FREE_PICTURE )
{
p_pic = p_vout->p_picture + i_index;
break;
}
}
p_pic = NULL;
/* Allocate the picture */
if( p_pic == NULL || NewPicture( p_vout, p_pic ) )
/* Find an empty picture slot */
for( i_index = 0 ; i_index < VOUT_MAX_PICTURES ; i_index++ )
{
if( p_vout->p_picture[ i_index ].i_status == FREE_PICTURE )
{
p_pic = p_vout->p_picture + i_index;
break;
}
}
p_pic->i_status = DESTROYED_PICTURE;
p_pic->i_type = DIRECT_PICTURE;
if( p_pic == NULL )
{
return -1;
}
PP_OUTPUTPICTURE[ I_OUTPUTPICTURES ] = p_pic;
/* We know the chroma, allocate a buffer which will be used
* directly by the decoder */
p_pic->i_planes = 1;
I_OUTPUTPICTURES++;
}
p_pic->p->p_pixels = p_vout->p_sys->pp_buffer[p_vout->p_sys->i_index];
p_pic->p->i_pixel_bytes = GLIDE_BYTES_PER_PIXEL;
p_pic->p->i_lines = GLIDE_HEIGHT;
return( 0 );
p_pic->p->b_margin = 1;
p_pic->p->b_hidden = 1;
p_pic->p->i_visible_bytes = GLIDE_WIDTH * GLIDE_BYTES_PER_PIXEL;
p_pic->p->i_pitch = p_vout->p_sys->p_buffer_info.strideInBytes;
/*1024 * GLIDE_BYTES_PER_PIXEL*/
p_pic->p->i_red_mask = 0xf800;
p_pic->p->i_green_mask = 0x07e0;
p_pic->p->i_blue_mask = 0x001f;
p_pic->i_status = DESTROYED_PICTURE;
p_pic->i_type = DIRECT_PICTURE;
PP_OUTPUTPICTURE[ 0 ] = p_pic;
I_OUTPUTPICTURES = 1;
return 0;
}
/*****************************************************************************
......@@ -286,18 +297,6 @@ static int OpenDisplay( vout_thread_t *p_vout )
GrScreenResolution_t resolution = GR_RESOLUTION_800x600;
GrLfbInfo_t p_front_buffer_info; /* front buffer info */
p_vout->p_sys->i_page_size = GLIDE_WIDTH * GLIDE_HEIGHT
* GLIDE_BYTES_PER_PIXEL;
/* Map two framebuffers a the very beginning of the fb */
p_vout->p_sys->p_video = malloc( p_vout->p_sys->i_page_size * 2 );
if( (int)p_vout->p_sys->p_video == -1 )
{
intf_ErrMsg( "vout error: can't map video memory (%s)",
strerror(errno) );
return( 1 );
}
grGlideGetVersion( version );
grGlideInit();
......@@ -308,8 +307,8 @@ static int OpenDisplay( vout_thread_t *p_vout )
}
grSstSelect( 0 );
if( !grSstWinOpen(0, resolution, GR_REFRESH_60Hz,
GR_COLORFORMAT_ABGR, GR_ORIGIN_UPPER_LEFT, 2, 1) )
if( !grSstWinOpen( 0, resolution, GR_REFRESH_60Hz,
GR_COLORFORMAT_ABGR, GR_ORIGIN_UPPER_LEFT, 2, 1 ) )
{
intf_ErrMsg( "vout error: can't open 3dfx screen" );
return( 1 );
......@@ -347,10 +346,14 @@ static int OpenDisplay( vout_thread_t *p_vout )
grGlideShutdown();
return( 1 );
}
grLfbUnlock(GR_LFB_WRITE_ONLY, GR_BUFFER_BACKBUFFER );
grLfbUnlock( GR_LFB_WRITE_ONLY, GR_BUFFER_BACKBUFFER );
grBufferClear( 0, 0, 0 );
p_vout->p_sys->pp_buffer[0] = p_vout->p_sys->p_buffer_info.lfbPtr;
p_vout->p_sys->pp_buffer[1] = p_front_buffer_info.lfbPtr;
p_vout->p_sys->i_index = 0;
return( 0 );
}
......@@ -367,34 +370,5 @@ static void CloseDisplay( vout_thread_t *p_vout )
/* shutdown Glide */
grGlideShutdown();
free( p_vout->p_sys->p_video );
}
/*****************************************************************************
* NewPicture: allocate a picture
*****************************************************************************
* Returns 0 on success, -1 otherwise
*****************************************************************************/
static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic )
{
/* We know the chroma, allocate a buffer which will be used
* directly by the decoder */
p_pic->p->p_pixels = p_vout->p_sys->p_video;
p_pic->p->i_pixel_bytes = GLIDE_BYTES_PER_PIXEL;
p_pic->p->i_lines = GLIDE_HEIGHT;
p_pic->p->b_margin = 1;
p_pic->p->b_hidden = 1;
p_pic->p->i_visible_bytes = GLIDE_WIDTH * GLIDE_BYTES_PER_PIXEL;
p_pic->p->i_pitch = p_vout->p_sys->p_buffer_info.strideInBytes;
/*1024 * GLIDE_BYTES_PER_PIXEL*/
p_pic->p->i_red_mask = 0xf800;
p_pic->p->i_green_mask = 0x07e0;
p_pic->p->i_blue_mask = 0x001f;
p_pic->i_planes = 1;
return 0;
}
......@@ -2,7 +2,7 @@
* gnome.c : Gnome plugin for vlc
*****************************************************************************
* Copyright (C) 2000 VideoLAN
* $Id: gnome.c,v 1.6 2002/01/07 02:12:29 sam Exp $
* $Id: gnome.c,v 1.7 2002/01/09 02:01:14 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -329,53 +329,56 @@ static gint GnomeManage( gpointer p_data )
{
vlc_mutex_lock( &p_input_bank->pp_input[0]->stream.stream_lock );
/* New input or stream map change */
if( p_input_bank->pp_input[0]->stream.b_changed )
if( !p_input_bank->pp_input[0]->b_die )
{
GtkModeManage( p_intf );
GtkSetupMenus( p_intf );
p_intf->p_sys->b_playing = 1;
}
/* Manage the slider */
if( p_input_bank->pp_input[0]->stream.b_seekable )
{
float newvalue;
newvalue = p_intf->p_sys->p_adj->value;
#define p_area p_input_bank->pp_input[0]->stream.p_selected_area
/* If the user hasn't touched the slider since the last time,
* then the input can safely change it */
if( newvalue == p_intf->p_sys->f_adj_oldvalue )
/* New input or stream map change */
if( p_input_bank->pp_input[0]->stream.b_changed )
{
/* Update the value */
p_intf->p_sys->p_adj->value = p_intf->p_sys->f_adj_oldvalue =
( 100. * p_area->i_tell ) / p_area->i_size;
gtk_signal_emit_by_name( GTK_OBJECT( p_intf->p_sys->p_adj ),
"value_changed" );
GtkModeManage( p_intf );
GtkSetupMenus( p_intf );
p_intf->p_sys->b_playing = 1;
}
/* Otherwise, send message to the input if the user has
* finished dragging the slider */
else if( p_intf->p_sys->b_slider_free )
/* Manage the slider */
if( p_input_bank->pp_input[0]->stream.b_seekable )
{
off_t i_seek = ( newvalue * p_area->i_size ) / 100;
float newvalue;
newvalue = p_intf->p_sys->p_adj->value;
vlc_mutex_unlock( &p_input_bank->pp_input[0]->stream.stream_lock );
input_Seek( p_input_bank->pp_input[0], i_seek );
vlc_mutex_lock( &p_input_bank->pp_input[0]->stream.stream_lock );
#define p_area p_input_bank->pp_input[0]->stream.p_selected_area
/* If the user hasn't touched the slider since the last time,
* then the input can safely change it */
if( newvalue == p_intf->p_sys->f_adj_oldvalue )
{
/* Update the value */
p_intf->p_sys->p_adj->value = p_intf->p_sys->f_adj_oldvalue =
( 100. * p_area->i_tell ) / p_area->i_size;
/* Update the old value */
p_intf->p_sys->f_adj_oldvalue = newvalue;
}
gtk_signal_emit_by_name( GTK_OBJECT( p_intf->p_sys->p_adj ),
"value_changed" );
}
/* Otherwise, send message to the input if the user has
* finished dragging the slider */
else if( p_intf->p_sys->b_slider_free )
{
off_t i_seek = ( newvalue * p_area->i_size ) / 100;
vlc_mutex_unlock( &p_input_bank->pp_input[0]->stream.stream_lock );
input_Seek( p_input_bank->pp_input[0], i_seek );
vlc_mutex_lock( &p_input_bank->pp_input[0]->stream.stream_lock );
/* Update the old value */
p_intf->p_sys->f_adj_oldvalue = newvalue;
}
#undef p_area
}
}
if( p_intf->p_sys->i_part !=
p_input_bank->pp_input[0]->stream.p_selected_area->i_part )
{
p_intf->p_sys->b_chapter_update = 1;
GtkSetupMenus( p_intf );
if( p_intf->p_sys->i_part !=
p_input_bank->pp_input[0]->stream.p_selected_area->i_part )
{
p_intf->p_sys->b_chapter_update = 1;
GtkSetupMenus( p_intf );
}
}
vlc_mutex_unlock( &p_input_bank->pp_input[0]->stream.stream_lock );
......
......@@ -93,7 +93,6 @@
<signal>
<name>activate</name>
<handler>GnomeMenubarFileOpenActivate</handler>
<data>&quot;intf_window&quot;</data>
<last_modification_time>Sat, 19 May 2001 16:27:02 GMT</last_modification_time>
</signal>
<label>_Open File...</label>
......@@ -108,7 +107,6 @@
<signal>
<name>activate</name>
<handler>GnomeMenubarDiscOpenActivate</handler>
<data>&quot;intf_window&quot;</data>
<last_modification_time>Sat, 19 May 2001 16:27:10 GMT</last_modification_time>
</signal>
<label>Open _Disc...</label>
......@@ -122,9 +120,8 @@
<tooltip>Select a Network Stream</tooltip>
<signal>
<name>activate</name>
<handler>GnomeMenbarNetworkOpenActivate</handler>
<data>&quot;intf_window&quot;</data>
<last_modification_time>Sat, 19 May 2001 16:27:39 GMT</last_modification_time>
<handler>GnomeMenubarNetworkOpenActivate</handler>
<last_modification_time>Fri, 21 Dec 2001 13:11:28 GMT</last_modification_time>
</signal>
<label>_Network Stream...</label>
<right_justify>False</right_justify>
......@@ -137,13 +134,32 @@
<right_justify>False</right_justify>
</widget>
<widget>
<class>GtkPixmapMenuItem</class>
<name>menubar_eject</name>
<tooltip>Eject disc</tooltip>
<signal>
<name>activate</name>
<handler>GnomeMenubarDiscEjectActivate</handler>
<last_modification_time>Fri, 21 Dec 2001 13:11:28 GMT</last_modification_time>
</signal>
<label>_Eject Disc</label>
<right_justify>False</right_justify>
<stock_icon>GNOME_STOCK_MENU_TOP</stock_icon>
</widget>
<widget>
<class>GtkMenuItem</class>
<name>separator15</name>
<right_justify>False</right_justify>
</widget>
<widget>
<class>GtkPixmapMenuItem</class>
<name>menubar_exit</name>
<signal>
<name>activate</name>
<handler>GnomeMenubarExitActivate</handler>
<data>&quot;intf_window&quot;</data>
<last_modification_time>Sat, 19 May 2001 16:27:52 GMT</last_modification_time>
</signal>
<stock_item>GNOMEUIINFO_MENU_EXIT_ITEM</stock_item>
......@@ -166,7 +182,6 @@
<signal>
<name>activate</name>
<handler>GnomeMenubarWindowToggleActivate</handler>
<data>&quot;intf_window&quot;</data>
<last_modification_time>Sat, 19 May 2001 16:28:06 GMT</last_modification_time>
</signal>
<label>_Hide interface</label>
......@@ -179,7 +194,6 @@
<signal>
<name>activate</name>
<handler>GnomeMenubarFullscreenActivate</handler>
<data>&quot;intf_window&quot;</data>
<last_modification_time>Sat, 19 May 2001 16:28:15 GMT</last_modification_time>
</signal>
<label>_Fullscreen</label>
......@@ -232,7 +246,6 @@
<signal>
<name>activate</name>
<handler>GnomeMenubarPlaylistActivate</handler>
<data>&quot;intf_window&quot;</data>
<last_modification_time>Sat, 19 May 2001 16:28:41 GMT</last_modification_time>
</signal>
<label>_Playlist...</label>
......@@ -248,7 +261,6 @@
<signal>
<name>activate</name>
<handler>GnomeMenubarModulesActivate</handler>
<data>&quot;intf_window&quot;</data>
<last_modification_time>Sat, 19 May 2001 16:28:53 GMT</last_modification_time>
</signal>
<label>_Modules...</label>
......@@ -297,7 +309,6 @@
<signal>
<name>activate</name>
<handler>GnomeMenubarPreferencesActivate</handler>
<data>&quot;intf_window&quot;</data>
<last_modification_time>Sat, 19 May 2001 16:29:03 GMT</last_modification_time>
</signal>
<stock_item>GNOMEUIINFO_MENU_PREFERENCES_ITEM</stock_item>
......@@ -320,7 +331,6 @@
<signal>
<name>activate</name>
<handler>GnomeMenubarAboutActivate</handler>
<data>&quot;intf_window&quot;</data>
<last_modification_time>Sat, 19 May 2001 16:29:19 GMT</last_modification_time>
</signal>
<stock_item>GNOMEUIINFO_MENU_ABOUT_ITEM</stock_item>
......@@ -434,6 +444,21 @@
<stock_pixmap>GNOME_STOCK_PIXMAP_STOP</stock_pixmap>
</widget>
<widget>
<class>GtkButton</class>
<child_name>Toolbar:button</child_name>
<name>toolbar_eject</name>
<tooltip>Eject disc</tooltip>
<signal>
<name>button_press_event</name>
<handler>GtkDiscEject</handler>
<data>&quot;intf_window&quot;</data>
<last_modification_time>Fri, 21 Dec 2001 15:24:18 GMT</last_modification_time>
</signal>
<label>Eject</label>
<stock_pixmap>GNOME_STOCK_PIXMAP_TOP</stock_pixmap>
</widget>
<widget>
<class>GtkButton</class>
<child_name>Toolbar:button</child_name>
......
......@@ -30,12 +30,18 @@ GnomeMenubarDiscOpenActivate (GtkMenuItem *menuitem,
void
GnomeMenbarNetworkOpenActivate (GtkMenuItem *menuitem,
GnomeMenubarNetworkOpenActivate (GtkMenuItem *menuitem,
gpointer user_data)
{
GtkNetworkOpenShow( GTK_WIDGET( menuitem ), NULL, "intf_window" );
}
void
GnomeMenubarDiscEjectActivate (GtkMenuItem *menuitem,
gpointer user_data)
{
GtkDiscEject( GTK_WIDGET( menuitem ), NULL, "intf_window" );
}
void
GnomeMenubarExitActivate (GtkMenuItem *menuitem,
......@@ -259,6 +265,3 @@ GnomePopupJumpActivate (GtkMenuItem *menuitem,
{
GtkJumpShow( GTK_WIDGET( menuitem ), NULL, "intf_popup" );
}
......@@ -11,7 +11,11 @@ GnomeMenubarDiscOpenActivate (GtkMenuItem *menuitem,
gpointer user_data);
void
GnomeMenbarNetworkOpenActivate (GtkMenuItem *menuitem,
GnomeMenubarNetworkOpenActivate (GtkMenuItem *menuitem,
gpointer user_data);
void
GnomeMenubarDiscEjectActivate (GtkMenuItem *menuitem,
gpointer user_data);
void
......@@ -141,3 +145,4 @@ GtkNetworkOpenBroadcast (GtkToggleButton *togglebutton,
void
GtkNetworkOpenChannel (GtkToggleButton *togglebutton,
gpointer user_data);
......@@ -32,11 +32,19 @@ static GnomeUIInfo menubar_file_menu_uiinfo[] =
{
GNOME_APP_UI_ITEM, N_("_Network Stream..."),
N_("Select a Network Stream"),
(gpointer) GnomeMenbarNetworkOpenActivate, NULL, NULL,
(gpointer) GnomeMenubarNetworkOpenActivate, NULL, NULL,
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_REFRESH,
0, (GdkModifierType) 0, NULL
},
GNOMEUIINFO_SEPARATOR,
{
GNOME_APP_UI_ITEM, N_("_Eject Disc"),
N_("Eject disc"),
(gpointer) GnomeMenubarDiscEjectActivate, NULL, NULL,
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_TOP,
0, (GdkModifierType) 0, NULL
},
GNOMEUIINFO_SEPARATOR,
GNOMEUIINFO_MENU_EXIT_ITEM (GnomeMenubarExitActivate, NULL),
GNOMEUIINFO_END
};
......@@ -145,6 +153,7 @@ create_intf_window (void)
GtkWidget *toolbar_network;
GtkWidget *toolbar_back;
GtkWidget *toolbar_stop;
GtkWidget *toolbar_eject;
GtkWidget *toolbar_play;
GtkWidget *toolbar_pause;
GtkWidget *toolbar_slow;
......@@ -220,10 +229,20 @@ create_intf_window (void)
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_ref (menubar_file_menu_uiinfo[4].widget);
gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_exit",
gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_eject",
menubar_file_menu_uiinfo[4].widget,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_ref (menubar_file_menu_uiinfo[5].widget);
gtk_object_set_data_full (GTK_OBJECT (intf_window), "separator15",
menubar_file_menu_uiinfo[5].widget,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_ref (menubar_file_menu_uiinfo[6].widget);
gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_exit",
menubar_file_menu_uiinfo[6].widget,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_ref (menubar_uiinfo[1].widget);
gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_view",
menubar_uiinfo[1].widget,
......@@ -390,6 +409,18 @@ create_intf_window (void)
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (toolbar_stop);
tmp_toolbar_icon = gnome_stock_pixmap_widget (intf_window, GNOME_STOCK_PIXMAP_TOP);
toolbar_eject = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar),
GTK_TOOLBAR_CHILD_BUTTON,
NULL,
_("Eject"),
_("Eject disc"), NULL,
tmp_toolbar_icon, NULL, NULL);
gtk_widget_ref (toolbar_eject);
gtk_object_set_data_full (GTK_OBJECT (intf_window), "toolbar_eject", toolbar_eject,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (toolbar_eject);
tmp_toolbar_icon = gnome_stock_pixmap_widget (intf_window, GNOME_STOCK_PIXMAP_FORWARD);
toolbar_play = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar),
GTK_TOOLBAR_CHILD_BUTTON,
......@@ -682,6 +713,9 @@ create_intf_window (void)
gtk_signal_connect (GTK_OBJECT (toolbar_stop), "button_press_event",
GTK_SIGNAL_FUNC (GtkControlStop),
"intf_window");
gtk_signal_connect (GTK_OBJECT (toolbar_eject), "button_press_event",
GTK_SIGNAL_FUNC (GtkDiscEject),
"intf_window");
gtk_signal_connect (GTK_OBJECT (toolbar_play), "button_press_event",
GTK_SIGNAL_FUNC (GtkControlPlay),
"intf_window");
......
......@@ -2,7 +2,7 @@
* gtk.c : Gtk+ plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: gtk.c,v 1.8 2002/01/07 02:12:29 sam Exp $
* $Id: gtk.c,v 1.9 2002/01/09 02:01:14 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -328,61 +328,63 @@ static gint GtkManage( gpointer p_data )
/* update the playlist */
GtkPlayListManage( p_data );
if( p_input_bank->pp_input[0] != NULL && !p_intf->b_die )
if( p_input_bank->pp_input[0] != NULL )
{
vlc_mutex_lock( &p_input_bank->pp_input[0]->stream.stream_lock );
/* New input or stream map change */
if( p_input_bank->pp_input[0]->stream.b_changed )
if( !p_input_bank->pp_input[0]->b_die )
{
GtkModeManage( p_intf );
GtkSetupMenus( p_intf );
p_intf->p_sys->b_playing = 1;
}
/* New input or stream map change */
if( p_input_bank->pp_input[0]->stream.b_changed )
{
GtkModeManage( p_intf );
GtkSetupMenus( p_intf );
p_intf->p_sys->b_playing = 1;
}
/* Manage the slider */
if( p_input_bank->pp_input[0]->stream.b_seekable )
{
float newvalue = p_intf->p_sys->p_adj->value;
/* Manage the slider */
if( p_input_bank->pp_input[0]->stream.b_seekable )
{
float newvalue = p_intf->p_sys->p_adj->value;
#define p_area p_input_bank->pp_input[0]->stream.p_selected_area
/* If the user hasn't touched the slider since the last time,
* then the input can safely change it */
if( newvalue == p_intf->p_sys->f_adj_oldvalue )
{
/* Update the value */
p_intf->p_sys->p_adj->value = p_intf->p_sys->f_adj_oldvalue =
( 100. * p_area->i_tell ) / p_area->i_size;
/* If the user hasn't touched the slider since the last time,
* then the input can safely change it */
if( newvalue == p_intf->p_sys->f_adj_oldvalue )
{
/* Update the value */
p_intf->p_sys->p_adj->value = p_intf->p_sys->f_adj_oldvalue =
( 100. * p_area->i_tell ) / p_area->i_size;
gtk_signal_emit_by_name( GTK_OBJECT( p_intf->p_sys->p_adj ),
"value_changed" );
}
/* Otherwise, send message to the input if the user has
* finished dragging the slider */
else if( p_intf->p_sys->b_slider_free )
{
off_t i_seek = ( newvalue * p_area->i_size ) / 100;
gtk_signal_emit_by_name( GTK_OBJECT( p_intf->p_sys->p_adj ),
"value_changed" );
/* release the lock to be able to seek */
vlc_mutex_unlock( &p_input_bank->pp_input[0]->stream.stream_lock );
input_Seek( p_input_bank->pp_input[0], i_seek );
vlc_mutex_lock( &p_input_bank->pp_input[0]->stream.stream_lock );
/* Update the old value */
p_intf->p_sys->f_adj_oldvalue = newvalue;
}
# undef p_area
}
/* Otherwise, send message to the input if the user has
* finished dragging the slider */
else if( p_intf->p_sys->b_slider_free )
{
off_t i_seek = ( newvalue * p_area->i_size ) / 100;
/* release the lock to be able to seek */
vlc_mutex_unlock( &p_input_bank->pp_input[0]->stream.stream_lock );
input_Seek( p_input_bank->pp_input[0], i_seek );
vlc_mutex_lock( &p_input_bank->pp_input[0]->stream.stream_lock );
/* Update the old value */
p_intf->p_sys->f_adj_oldvalue = newvalue;
if( p_intf->p_sys->i_part !=
p_input_bank->pp_input[0]->stream.p_selected_area->i_part )
{
p_intf->p_sys->b_chapter_update = 1;
GtkSetupMenus( p_intf );
}
#undef p_area
}
if( p_intf->p_sys->i_part !=
p_input_bank->pp_input[0]->stream.p_selected_area->i_part )
{
p_intf->p_sys->b_chapter_update = 1;
GtkSetupMenus( p_intf );
}
vlc_mutex_unlock( &p_input_bank->pp_input[0]->stream.stream_lock );
}
else if( p_intf->p_sys->b_playing && !p_intf->b_die )
{
......
......@@ -140,6 +140,26 @@
<right_justify>False</right_justify>
</widget>
<widget>
<class>GtkMenuItem</class>
<name>menubar_eject</name>
<tooltip>Eject disc</tooltip>
<signal>
<name>activate</name>
<handler>GtkEjectDiscActivate</handler>
<data>&quot;intf_window&quot;</data>
<last_modification_time>Fri, 21 Dec 2001 12:51:34 GMT</last_modification_time>
</signal>
<label>_Eject Disc</label>
<right_justify>False</right_justify>
</widget>
<widget>
<class>GtkMenuItem</class>
<name>separator14</name>
<right_justify>False</right_justify>
</widget>
<widget>
<class>GtkMenuItem</class>
<name>menubar_exit</name>
......@@ -441,6 +461,19 @@
<label>Stop</label>
</widget>
<widget>
<class>GtkButton</class>
<child_name>Toolbar:button</child_name>
<name>toolbar_eject</name>
<signal>
<name>button_press_event</name>
<handler>GtkDiscEject</handler>
<data>&quot;intf_window&quot;</data>
<last_modification_time>Fri, 21 Dec 2001 15:33:26 GMT</last_modification_time>
</signal>
<label>Eject</label>
</widget>
<widget>
<class>GtkButton</class>
<child_name>Toolbar:button</child_name>
......
......@@ -2,10 +2,11 @@
* gtk_callbacks.c : Callbacks for the Gtk+ plugin.
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: gtk_callbacks.c,v 1.30 2002/01/07 02:12:29 sam Exp $
* $Id: gtk_callbacks.c,v 1.31 2002/01/09 02:01:14 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Stphane Borel <stef@via.ecp.fr>
* Julien BLACHE <jb@technologeek.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -30,6 +31,8 @@
#include <videolan/vlc.h>
#include <unistd.h>
#include <gtk/gtk.h>
#include <string.h>
......@@ -39,6 +42,7 @@
#include "interface.h"
#include "intf_playlist.h"
#include "intf_eject.h"
#include "video.h"
#include "video_output.h"
......@@ -463,3 +467,55 @@ void GtkJumpActivate( GtkMenuItem * menuitem, gpointer user_data )
GtkJumpShow( GTK_WIDGET( menuitem ), NULL, user_data );
}
/****************************************************************************
* Callbacks for disc ejection
****************************************************************************/
gboolean GtkDiscEject ( GtkWidget *widget, GdkEventButton *event,
gpointer user_data )
{
char *psz_device = NULL;
/*
* Get the active input
* Determine whether we can eject a media, ie it's a VCD or DVD
* If it's neither a VCD nor a DVD, then return
*/
/*
* Don't really know if I must lock the stuff here, we're using it read-only
*/
if (p_main->p_playlist->current.psz_name != NULL)
{
if (strncmp(p_main->p_playlist->current.psz_name, "dvd", 3)
|| strncmp(p_main->p_playlist->current.psz_name, "vcd", 3))
{
/* Determine the device name by omitting the first 4 characters */
psz_device = strdup((p_main->p_playlist->current.psz_name + 4));
}
}
if( psz_device == NULL )
{
return TRUE;
}
/* If there's a stream playing, we aren't allowed to eject ! */
if( p_input_bank->pp_input[0] == NULL )
{
intf_WarnMsg( 4, "intf: ejecting %s", psz_device );
intf_Eject( psz_device );
}
free(psz_device);
return TRUE;
}
void GtkEjectDiscActivate ( GtkMenuItem *menuitem, gpointer user_data )
{
fprintf(stderr, "DEBUG: EJECT called from MENU !\n");
GtkDiscEject( GTK_WIDGET( menuitem ), NULL, user_data );
}
......@@ -2,7 +2,7 @@
* gtk_callbacks.h : Callbacks for the gtk plugin.
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: gtk_callbacks.h,v 1.15 2001/05/30 23:02:03 stef Exp $
* $Id: gtk_callbacks.h,v 1.16 2002/01/09 02:01:14 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Stphane Borel <stef@via.ecp.fr>
......@@ -70,3 +70,12 @@ void GtkNetworkJoin ( GtkEditable *, gpointer );
void GtkChannelGo ( GtkButton *, gpointer );
void GtkNetworkOpenChannel ( GtkToggleButton *, gpointer );
void
GtkEjectDiscActivate (GtkMenuItem *menuitem,
gpointer user_data);
gboolean
GtkDiscEject (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data);
......@@ -2,7 +2,7 @@
* gtk_display.c: Gtk+ tools for main interface
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: gtk_display.c,v 1.11 2002/01/07 02:12:29 sam Exp $
* $Id: gtk_display.c,v 1.12 2002/01/09 02:01:14 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Stphane Borel <stef@via.ecp.fr>
......@@ -225,6 +225,7 @@ gint GtkModeManage( intf_thread_t * p_intf )
/* set control items */
gtk_widget_set_sensitive( GETWIDGET(p_window, "toolbar_back"), FALSE );
gtk_widget_set_sensitive( GETWIDGET(p_window, "toolbar_eject"), !b_control);
gtk_widget_set_sensitive( GETWIDGET(p_window, "toolbar_pause"), b_control );
gtk_widget_set_sensitive( GETWIDGET(p_window, "toolbar_slow"), b_control );
gtk_widget_set_sensitive( GETWIDGET(p_window, "toolbar_fast"), b_control );
......
......@@ -29,6 +29,8 @@ create_intf_window (void)
GtkWidget *menubar_disc;
GtkWidget *menubar_network;
GtkWidget *separator4;
GtkWidget *menubar_eject;
GtkWidget *separator14;
GtkWidget *menubar_exit;
GtkWidget *menubar_view;
GtkWidget *menubar_view_menu;
......@@ -60,6 +62,7 @@ create_intf_window (void)
GtkWidget *toolbar_network;
GtkWidget *toolbar_back;
GtkWidget *toolbar_stop;
GtkWidget *toolbar_eject;
GtkWidget *toolbar_play;
GtkWidget *toolbar_pause;
GtkWidget *toolbar_slow;
......@@ -196,6 +199,26 @@ create_intf_window (void)
gtk_container_add (GTK_CONTAINER (menubar_file_menu), separator4);
gtk_widget_set_sensitive (separator4, FALSE);
menubar_eject = gtk_menu_item_new_with_label ("");
tmp_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (menubar_eject)->child),
_("_Eject Disc"));
gtk_widget_add_accelerator (menubar_eject, "activate_item", menubar_file_menu_accels,
tmp_key, 0, 0);
gtk_widget_ref (menubar_eject);
gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_eject", menubar_eject,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (menubar_eject);
gtk_container_add (GTK_CONTAINER (menubar_file_menu), menubar_eject);
gtk_tooltips_set_tip (tooltips, menubar_eject, _("Eject disc"), NULL);
separator14 = gtk_menu_item_new ();
gtk_widget_ref (separator14);
gtk_object_set_data_full (GTK_OBJECT (intf_window), "separator14", separator14,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (separator14);
gtk_container_add (GTK_CONTAINER (menubar_file_menu), separator14);
gtk_widget_set_sensitive (separator14, FALSE);
menubar_exit = gtk_menu_item_new_with_label ("");
tmp_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (menubar_exit)->child),
_("E_xit"));
......@@ -500,6 +523,17 @@ create_intf_window (void)
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (toolbar_stop);
toolbar_eject = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar),
GTK_TOOLBAR_CHILD_BUTTON,
NULL,
_("Eject"),
NULL, NULL,
NULL, NULL, NULL);
gtk_widget_ref (toolbar_eject);
gtk_object_set_data_full (GTK_OBJECT (intf_window), "toolbar_eject", toolbar_eject,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (toolbar_eject);
toolbar_play = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar),
GTK_TOOLBAR_CHILD_BUTTON,
NULL,
......@@ -776,6 +810,9 @@ create_intf_window (void)
gtk_signal_connect (GTK_OBJECT (menubar_network), "activate",
GTK_SIGNAL_FUNC (GtkNetworkOpenActivate),
"intf_window");
gtk_signal_connect (GTK_OBJECT (menubar_eject), "activate",
GTK_SIGNAL_FUNC (GtkEjectDiscActivate),
"intf_window");
gtk_signal_connect (GTK_OBJECT (menubar_exit), "activate",
GTK_SIGNAL_FUNC (GtkExitActivate),
"intf_window");
......@@ -812,6 +849,9 @@ create_intf_window (void)
gtk_signal_connect (GTK_OBJECT (toolbar_stop), "button_press_event",
GTK_SIGNAL_FUNC (GtkControlStop),
"intf_window");
gtk_signal_connect (GTK_OBJECT (toolbar_eject), "button_press_event",
GTK_SIGNAL_FUNC (GtkDiscEject),
"intf_window");
gtk_signal_connect (GTK_OBJECT (toolbar_play), "button_press_event",
GTK_SIGNAL_FUNC (GtkControlPlay),
"intf_window");
......
mga_SOURCES = mga.c
xmga_SOURCES = xmga.c
This diff is collapsed.
......@@ -4,7 +4,7 @@
* decoders.
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: input.c,v 1.168 2002/01/07 02:12:29 sam Exp $
* $Id: input.c,v 1.169 2002/01/09 02:01:14 sam Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -113,11 +113,15 @@ void input_InitBank ( void )
*****************************************************************************/
void input_EndBank ( void )
{
int i_input;
/* Ask all remaining video outputs to die */
while( p_input_bank->i_count )
for( i_input = 0; i_input < p_input_bank->i_count; i_input++ )
{
input_StopThread(
p_input_bank->pp_input[ i_input ], NULL );
input_DestroyThread(
p_input_bank->pp_input[ --p_input_bank->i_count ], NULL );
p_input_bank->pp_input[ i_input ] );
}
vlc_mutex_destroy( &p_input_bank->lock );
......@@ -134,7 +138,6 @@ void input_EndBank ( void )
input_thread_t *input_CreateThread ( playlist_item_t *p_item, int *pi_status )
{
input_thread_t * p_input; /* thread descriptor */
int i_status; /* thread status */
/* Allocate descriptor */
p_input = (input_thread_t *)malloc( sizeof(input_thread_t) );
......@@ -146,16 +149,15 @@ input_thread_t *input_CreateThread ( playlist_item_t *p_item, int *pi_status )
}
/* Initialize thread properties */
p_input->b_die = 0;
p_input->b_error = 0;
p_input->b_eof = 0;
p_input->b_die = 0;
p_input->b_error = 0;
p_input->b_eof = 0;
/* Set target */
p_input->p_source = p_item->psz_name;
p_input->p_source = p_item->psz_name;
/* I have never understood that stuff --Meuuh */
p_input->pi_status = (pi_status != NULL) ? pi_status : &i_status;
*p_input->pi_status = THREAD_CREATE;
/* Set status */
p_input->i_status = THREAD_CREATE;
/* Initialize stream description */
p_input->stream.i_es_number = 0;
......@@ -196,6 +198,7 @@ input_thread_t *input_CreateThread ( playlist_item_t *p_item, int *pi_status )
return( NULL );
}
#if 0
/* If status is NULL, wait until the thread is created */
if( pi_status == NULL )
{
......@@ -204,36 +207,30 @@ input_thread_t *input_CreateThread ( playlist_item_t *p_item, int *pi_status )
msleep( THREAD_SLEEP );
} while( (i_status != THREAD_READY) && (i_status != THREAD_ERROR)
&& (i_status != THREAD_FATAL) );
if( i_status != THREAD_READY )
{
return( NULL );
}
}
#endif
return( p_input );
}
/*****************************************************************************
* input_DestroyThread: mark an input thread as zombie
* input_StopThread: mark an input thread as zombie
*****************************************************************************
* This function should not return until the thread is effectively cancelled.
*****************************************************************************/
void input_DestroyThread( input_thread_t *p_input, int *pi_status )
void input_StopThread( input_thread_t *p_input, int *pi_status )
{
int i_status; /* thread status */
/* Set status */
p_input->pi_status = (pi_status != NULL) ? pi_status : &i_status;
*p_input->pi_status = THREAD_DESTROY;
/* Make the thread exit from a possible vlc_cond_wait() */
vlc_mutex_lock( &p_input->stream.stream_lock );
/* Request thread destruction */
p_input->b_die = 1;
/* Make the thread exit from a possible vlc_cond_wait() */
vlc_mutex_lock( &p_input->stream.stream_lock );
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
......@@ -242,6 +239,25 @@ void input_DestroyThread( input_thread_t *p_input, int *pi_status )
} while ( (i_status != THREAD_OVER) && (i_status != THREAD_ERROR)
&& (i_status != THREAD_FATAL) );
}
#endif
}
/*****************************************************************************
* input_DestroyThread: mark an input thread as zombie
*****************************************************************************
* This function should not return until the thread is effectively cancelled.
*****************************************************************************/
void input_DestroyThread( input_thread_t *p_input )
{
/* Join the thread */
vlc_thread_join( p_input->thread_id );
/* Destroy Mutex locks */
vlc_mutex_destroy( &p_input->stream.control.control_lock );
vlc_mutex_destroy( &p_input->stream.stream_lock );
/* Free input structure */
free( p_input );
}
/*****************************************************************************
......@@ -254,13 +270,15 @@ static void RunThread( input_thread_t *p_input )
if( InitThread( p_input ) )
{
/* If we failed, wait before we are killed, and exit */
*p_input->pi_status = THREAD_ERROR;
p_input->i_status = THREAD_ERROR;
p_input->b_error = 1;
ErrorThread( p_input );
DestroyThread( p_input );
return;
}
p_input->i_status = THREAD_READY;
/* initialization is complete */
vlc_mutex_lock( &p_input->stream.stream_lock );
p_input->stream.b_changed = 1;
......@@ -507,8 +525,6 @@ static int InitThread( input_thread_t * p_input )
return( -1 );
}
*p_input->pi_status = THREAD_READY;
return( 0 );
}
......@@ -531,11 +547,8 @@ static void ErrorThread( input_thread_t *p_input )
*****************************************************************************/
static void EndThread( input_thread_t * p_input )
{
int * pi_status; /* thread status */
/* Store status */
pi_status = p_input->pi_status;
*pi_status = THREAD_END;
p_input->i_status = THREAD_END;
if( p_main->b_stats )
{
......@@ -605,20 +618,8 @@ static void CloseThread( input_thread_t * p_input )
*****************************************************************************/
static void DestroyThread( input_thread_t * p_input )
{
int * pi_status; /* thread status */
/* Store status */
pi_status = p_input->pi_status;
/* Destroy Mutex locks */
vlc_mutex_destroy( &p_input->stream.control.control_lock );
vlc_mutex_destroy( &p_input->stream.stream_lock );
/* Free input structure */
free( p_input );
/* Update status */
*pi_status = THREAD_OVER;
p_input->i_status = THREAD_OVER;
}
/*****************************************************************************
......
......@@ -4,7 +4,7 @@
* interface, such as command line.
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: interface.c,v 1.86 2002/01/07 02:12:30 sam Exp $
* $Id: interface.c,v 1.87 2002/01/09 02:01:14 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
......@@ -128,18 +128,33 @@ static void intf_Manage( intf_thread_t *p_intf )
vlc_mutex_lock( &p_input_bank->lock );
if( p_input_bank->i_count
&& ( p_input_bank->pp_input[0]->b_error
|| p_input_bank->pp_input[0]->b_eof ) )
if( p_input_bank->i_count )
{
intf_WarnMsg( 3, "intf: input thread destroyed" );
input_DestroyThread( p_input_bank->pp_input[0], NULL );
p_input_bank->pp_input[0] = NULL;
p_input_bank->i_count--;
}
int i_input;
input_thread_t *p_input;
for( i_input = 0; i_input < p_input_bank->i_count; i_input++ )
{
p_input = p_input_bank->pp_input[i_input];
if( p_input->i_status == THREAD_OVER )
{
/* XXX: completely stupid ! */
input_DestroyThread( p_input );
p_input_bank->pp_input[i_input] = NULL;
p_input_bank->i_count--;
}
else if( ( p_input->i_status == THREAD_READY
|| p_input->i_status == THREAD_ERROR )
&& ( p_input->b_error || p_input->b_eof ) )
{
input_StopThread( p_input, NULL );
}
}
}
/* If no stream is being played, try to find one */
if( !p_input_bank->i_count && !p_intf->b_die )
else
{
// vlc_mutex_lock( &p_main->p_playlist->change_lock );
......@@ -155,14 +170,20 @@ static void intf_Manage( intf_thread_t *p_intf )
}
else
{
input_thread_t *p_input;
p_main->p_playlist->b_stopped = 0;
p_main->p_playlist->i_mode = PLAYLIST_FORWARD +
main_GetIntVariable( PLAYLIST_LOOP_VAR,
PLAYLIST_LOOP_DEFAULT );
intf_WarnMsg( 3, "intf: creating new input thread" );
p_input_bank->pp_input[0] =
input_CreateThread( &p_main->p_playlist->current, NULL );
p_input_bank->i_count++;
p_input = input_CreateThread( &p_main->p_playlist->current,
NULL );
if( p_input != NULL )
{
p_input_bank->pp_input[ p_input_bank->i_count ] = p_input;
p_input_bank->i_count++;
}
}
}
else
......
/*****************************************************************************
* intf_eject.c: CD/DVD-ROM ejection handling functions
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: intf_eject.c,v 1.1 2002/01/09 02:01:14 sam Exp $
*
* Author: Julien Blache <jb@technologeek.org> for the Linux part
* with code taken from the Linux "eject" command
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <videolan/vlc.h>
#ifdef SYS_LINUX
/* This code could be extended to support CD/DVD-ROM chargers */
# include <linux/version.h>
/* handy macro found in 2.1 kernels, but not in older ones */
# ifndef KERNEL_VERSION
# define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
# endif
# include <sys/types.h>
# include <sys/stat.h>
# include <sys/ioctl.h>
# include <fcntl.h>
# include <sys/ioctl.h>
# include <linux/cdrom.h>
# if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,0)
# include <linux/ucdrom.h>
# endif
# include <sys/mount.h>
# include <scsi/scsi.h>
# include <scsi/sg.h>
# include <scsi/scsi_ioctl.h>
#endif
static int EjectCdrom( int i_fd );
static int EjectScsi ( int i_fd );
/*
* Eject using CDROMEJECT ioctl. Return 0 if successful
*/
static int EjectCdrom( int i_fd )
{
int i_status;
i_status = ioctl( i_fd, CDROMEJECT );
return i_status;
}
/*
* Eject using SCSI commands. Return 0 if successful
*/
static int EjectScsi( int i_fd )
{
int i_status;
struct sdata
{
int inlen;
int outlen;
char cmd[256];
} scsi_cmd;
scsi_cmd.inlen = 0;
scsi_cmd.outlen = 0;
scsi_cmd.cmd[0] = ALLOW_MEDIUM_REMOVAL;
scsi_cmd.cmd[1] = 0;
scsi_cmd.cmd[2] = 0;
scsi_cmd.cmd[3] = 0;
scsi_cmd.cmd[4] = 0;
scsi_cmd.cmd[5] = 0;
i_status = ioctl( i_fd, SCSI_IOCTL_SEND_COMMAND, (void *)&scsi_cmd );
if( i_status != 0 )
{
return 1;
}
scsi_cmd.inlen = 0;
scsi_cmd.outlen = 0;
scsi_cmd.cmd[0] = START_STOP;
scsi_cmd.cmd[1] = 0;
scsi_cmd.cmd[2] = 0;
scsi_cmd.cmd[3] = 0;
scsi_cmd.cmd[4] = 1;
scsi_cmd.cmd[5] = 0;
i_status = ioctl( i_fd, SCSI_IOCTL_SEND_COMMAND, (void *)&scsi_cmd );
if( i_status != 0 )
{
return 1;
}
scsi_cmd.inlen = 0;
scsi_cmd.outlen = 0;
scsi_cmd.cmd[0] = START_STOP;
scsi_cmd.cmd[1] = 0;
scsi_cmd.cmd[2] = 0;
scsi_cmd.cmd[3] = 0;
scsi_cmd.cmd[4] = 2;
scsi_cmd.cmd[5] = 0;
i_status = ioctl( i_fd, SCSI_IOCTL_SEND_COMMAND, (void *)&scsi_cmd );
if( i_status != 0 )
{
return 1;
}
/* Force kernel to reread partition table when new disc inserted */
i_status = ioctl( i_fd, BLKRRPART );
return i_status;
}
/*
* returns 0 on success
* returns 1 on failure
* returns -1 if not implemented
*
* Modify eject_disc() prototype as needed for portability
*/
int intf_Eject( const char *psz_device )
{
int i_ret;
#ifdef SYS_LINUX
int i_fd = 0;
i_fd = open( psz_device, O_RDONLY | O_NONBLOCK );
if( i_fd == -1 )
{
intf_ErrMsg( "intf error: couldn't open device %s", psz_device );
return 1;
}
if( EjectCdrom(i_fd) == 0 )
{
i_ret = 0;
}
else if( EjectScsi(i_fd) == 0 )
{
i_ret = 0;
}
else
{
intf_ErrMsg( "intf error: couldn't eject %s", psz_device );
i_ret = 1;
}
close( i_fd );
#else
i_ret = -1;
#endif
return i_ret;
}
......@@ -2,7 +2,7 @@
* modules.c : Built-in and plugin modules management functions
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: modules.c,v 1.46 2001/12/30 07:09:56 sam Exp $
* $Id: modules.c,v 1.47 2002/01/09 02:01:14 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Ethan C. Baldridge <BaldridgeE@cadmus.com>
......@@ -54,6 +54,7 @@
#include "interface.h"
#include "intf_playlist.h"
#include "intf_eject.h"
#include "stream_control.h"
#include "input_ext-intf.h"
......
......@@ -2,7 +2,7 @@
* modules_plugin.h : Plugin management functions used by the core application.
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: modules_plugin.h,v 1.3 2002/01/07 02:12:30 sam Exp $
* $Id: modules_plugin.h,v 1.4 2002/01/09 02:01:14 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -174,6 +174,7 @@ module_error( void )
(p_symbols)->intf_PlaylistDestroy = intf_PlaylistDestroy; \
(p_symbols)->intf_PlaylistJumpto = intf_PlaylistJumpto; \
(p_symbols)->intf_UrlDecode = intf_UrlDecode; \
(p_symbols)->intf_Eject = intf_Eject; \
(p_symbols)->msleep = msleep; \
(p_symbols)->mdate = mdate; \
(p_symbols)->network_ChannelCreate = network_ChannelCreate; \
......
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