Commit b2f56af9 authored by Sam Hocevar's avatar Sam Hocevar

 * Fixed a segfault in the input thread creation, as well as a possible
   deadlock. This happened mostly when opening non-existing files.
 * Created input_SetStatus to do input_SetRate's job. input_SetRate will
   be used to set an arbitrary rate, for people who want to read DVDs at
   1/2.71828 times the actual speed.
 * Stubs for the ncurses control interface. No working code yet, but the
   holes just need to be filled.
 * Improved X11 support. Still not as functional as before.
 * The output window now states the method name, so that people know whether
   they are using X11 or SDL.
 * The Gnome interface is now drag'n'drop aware, you can drop a file
   on it just like Xine does (or so I guess).
parent 16247a75
...@@ -345,6 +345,9 @@ PLUGIN_MOTIONMMXEXT = plugins/motion/motionmmxext.o \ ...@@ -345,6 +345,9 @@ PLUGIN_MOTIONMMXEXT = plugins/motion/motionmmxext.o \
plugins/motion/vdec_motion_common.o \ plugins/motion/vdec_motion_common.o \
plugins/motion/vdec_motion_inner_mmxext.o plugins/motion/vdec_motion_inner_mmxext.o
PLUGIN_NCURSES = plugins/text/ncurses.o \
plugins/text/intf_ncurses.o
PLUGIN_NULL = plugins/null/null.o PLUGIN_NULL = plugins/null/null.o
PLUGIN_PS = plugins/mpeg/ps.o \ PLUGIN_PS = plugins/mpeg/ps.o \
...@@ -385,6 +388,7 @@ STD_PLUGIN_OBJ = \ ...@@ -385,6 +388,7 @@ STD_PLUGIN_OBJ = \
$(PLUGIN_MOTION) \ $(PLUGIN_MOTION) \
$(PLUGIN_MOTIONMMX) \ $(PLUGIN_MOTIONMMX) \
$(PLUGIN_MOTIONMMXEXT) \ $(PLUGIN_MOTIONMMXEXT) \
$(PLUGIN_NCURSES) \
$(PLUGIN_NULL) \ $(PLUGIN_NULL) \
$(PLUGIN_PS) \ $(PLUGIN_PS) \
$(PLUGIN_SDL) \ $(PLUGIN_SDL) \
...@@ -612,6 +616,9 @@ lib/ggi.so: $(PLUGIN_GGI) ...@@ -612,6 +616,9 @@ lib/ggi.so: $(PLUGIN_GGI)
lib/sdl.so: $(PLUGIN_SDL) lib/sdl.so: $(PLUGIN_SDL)
$(CC) $(PCFLAGS) -shared -o $@ $^ $(LIB_SDL) $(CC) $(PCFLAGS) -shared -o $@ $^ $(LIB_SDL)
lib/ncurses.so: $(PLUGIN_NCURSES)
$(CC) $(PCFLAGS) -shared -o $@ $^ -lcurses
ifeq ($(SYS),beos) ifeq ($(SYS),beos)
lib/null.so: $(PLUGIN_NULL) lib/null.so: $(PLUGIN_NULL)
$(CC) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_ $(CC) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
......
This diff is collapsed.
...@@ -184,6 +184,9 @@ AC_ARG_WITH(glide, ...@@ -184,6 +184,9 @@ AC_ARG_WITH(glide,
else else
LIB_GLIDE="-lglide2x" LIB_GLIDE="-lglide2x"
fi ]) fi ])
AC_ARG_ENABLE(ncurses,
[ --enable-ncurses ncurses interface support (default disabled)],
[if test x$enable_ncurses = xyes; then PLUGINS=${PLUGINS}"ncurses "; fi])
AC_ARG_ENABLE(gnome, AC_ARG_ENABLE(gnome,
[ --disable-gnome Gnome support (default enabled)]) [ --disable-gnome Gnome support (default enabled)])
if test x$enable_gnome != xno; then PLUGINS=${PLUGINS}"gnome "; ALIASES=${ALIASES}"gvlc "; fi if test x$enable_gnome != xno; then PLUGINS=${PLUGINS}"gnome "; ALIASES=${ALIASES}"gvlc "; fi
......
...@@ -149,13 +149,6 @@ ...@@ -149,13 +149,6 @@
/* Maximum number of channels */ /* Maximum number of channels */
#define INTF_MAX_CHANNELS 10 #define INTF_MAX_CHANNELS 10
/*
* X11 settings
*/
/* Title of the X11 window */
#define VOUT_TITLE "VideoLAN Client"
/***************************************************************************** /*****************************************************************************
* Input thread configuration * Input thread configuration
*****************************************************************************/ *****************************************************************************/
...@@ -382,6 +375,7 @@ ...@@ -382,6 +375,7 @@
*/ */
// #define FB_NOYPAN // #define FB_NOYPAN
#define VOUT_TITLE "VideoLAN Client @VLC_VERSION@"
/***************************************************************************** /*****************************************************************************
* Video parser configuration * Video parser configuration
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* control the pace of reading. * control the pace of reading.
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: input_ext-intf.h,v 1.19 2001/02/12 09:39:15 sam Exp $ * $Id: input_ext-intf.h,v 1.20 2001/02/16 06:37:09 sam Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -294,11 +294,12 @@ typedef struct input_config_s ...@@ -294,11 +294,12 @@ typedef struct input_config_s
#define INPUT_METHOD_BCAST 22 /* UDP broadcast */ #define INPUT_METHOD_BCAST 22 /* UDP broadcast */
#define INPUT_METHOD_VLAN_BCAST 32 /* UDP broadcast with VLANs */ #define INPUT_METHOD_VLAN_BCAST 32 /* UDP broadcast with VLANs */
/* Rate changing methods */ /* Status changing methods */
#define INPUT_RATE_PLAY 0 #define INPUT_STATUS_END 0
#define INPUT_RATE_PAUSE 1 #define INPUT_STATUS_PLAY 1
#define INPUT_RATE_FASTER 2 #define INPUT_STATUS_PAUSE 2
#define INPUT_RATE_SLOWER 3 #define INPUT_STATUS_FASTER 3
#define INPUT_STATUS_SLOWER 4
/***************************************************************************** /*****************************************************************************
* Prototypes * Prototypes
...@@ -307,6 +308,7 @@ struct input_thread_s * input_CreateThread ( struct playlist_item_s *, ...@@ -307,6 +308,7 @@ struct input_thread_s * input_CreateThread ( struct playlist_item_s *,
int *pi_status ); int *pi_status );
void input_DestroyThread( struct input_thread_s *, int *pi_status ); void input_DestroyThread( struct input_thread_s *, int *pi_status );
void input_SetRate( struct input_thread_s *, int ); void input_SetStatus( struct input_thread_s *, int );
void input_SetRate ( struct input_thread_s *, int );
void input_Seek ( struct input_thread_s *, off_t ); void input_Seek ( struct input_thread_s *, off_t );
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include "interface.h" #include "interface.h"
#include "intf_plst.h" #include "intf_plst.h"
#include "intf_msg.h"
#include "gnome_sys.h" #include "gnome_sys.h"
#include "gnome_callbacks.h" #include "gnome_callbacks.h"
...@@ -171,7 +172,7 @@ on_toolbar_play_clicked (GtkButton *button, ...@@ -171,7 +172,7 @@ on_toolbar_play_clicked (GtkButton *button,
if( p_intf->p_input != NULL ) if( p_intf->p_input != NULL )
{ {
input_SetRate( p_intf->p_input, INPUT_RATE_PLAY ); input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
} }
} }
...@@ -184,7 +185,7 @@ on_toolbar_pause_clicked (GtkButton *button, ...@@ -184,7 +185,7 @@ on_toolbar_pause_clicked (GtkButton *button,
if( p_intf->p_input != NULL ) if( p_intf->p_input != NULL )
{ {
input_SetRate( p_intf->p_input, INPUT_RATE_PAUSE ); input_SetStatus( p_intf->p_input, INPUT_STATUS_PAUSE );
} }
} }
...@@ -244,7 +245,7 @@ on_popup_play_activate (GtkMenuItem *menuitem, ...@@ -244,7 +245,7 @@ on_popup_play_activate (GtkMenuItem *menuitem,
if( p_intf->p_input != NULL ) if( p_intf->p_input != NULL )
{ {
input_SetRate( p_intf->p_input, INPUT_RATE_PLAY ); input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
} }
} }
...@@ -257,7 +258,7 @@ on_popup_pause_activate (GtkMenuItem *menuitem, ...@@ -257,7 +258,7 @@ on_popup_pause_activate (GtkMenuItem *menuitem,
if( p_intf->p_input != NULL ) if( p_intf->p_input != NULL )
{ {
input_SetRate( p_intf->p_input, INPUT_RATE_PAUSE ); input_SetStatus( p_intf->p_input, INPUT_STATUS_PAUSE );
} }
} }
...@@ -379,7 +380,7 @@ on_popup_slow_activate (GtkMenuItem *menuitem, ...@@ -379,7 +380,7 @@ on_popup_slow_activate (GtkMenuItem *menuitem,
if( p_intf->p_input != NULL ) if( p_intf->p_input != NULL )
{ {
input_SetRate( p_intf->p_input, INPUT_RATE_SLOWER ); input_SetStatus( p_intf->p_input, INPUT_STATUS_SLOWER );
} }
} }
...@@ -392,7 +393,7 @@ on_popup_fast_activate (GtkMenuItem *menuitem, ...@@ -392,7 +393,7 @@ on_popup_fast_activate (GtkMenuItem *menuitem,
if( p_intf->p_input != NULL ) if( p_intf->p_input != NULL )
{ {
input_SetRate( p_intf->p_input, INPUT_RATE_FASTER ); input_SetStatus( p_intf->p_input, INPUT_STATUS_FASTER );
} }
} }
...@@ -405,7 +406,7 @@ on_toolbar_slow_clicked (GtkButton *button, ...@@ -405,7 +406,7 @@ on_toolbar_slow_clicked (GtkButton *button,
if( p_intf->p_input != NULL ) if( p_intf->p_input != NULL )
{ {
input_SetRate( p_intf->p_input, INPUT_RATE_SLOWER ); input_SetStatus( p_intf->p_input, INPUT_STATUS_SLOWER );
} }
} }
...@@ -418,7 +419,7 @@ on_toolbar_fast_clicked (GtkButton *button, ...@@ -418,7 +419,7 @@ on_toolbar_fast_clicked (GtkButton *button,
if( p_intf->p_input != NULL ) if( p_intf->p_input != NULL )
{ {
input_SetRate( p_intf->p_input, INPUT_RATE_FASTER ); input_SetStatus( p_intf->p_input, INPUT_STATUS_FASTER );
} }
} }
...@@ -526,3 +527,55 @@ on_menubar_modules_activate (GtkMenuItem *menuitem, ...@@ -526,3 +527,55 @@ on_menubar_modules_activate (GtkMenuItem *menuitem,
gdk_window_raise( p_intf->p_sys->p_modules->window ); gdk_window_raise( p_intf->p_sys->p_modules->window );
} }
void
on_intf_window_drag_data_received (GtkWidget *widget,
GdkDragContext *drag_context,
gint x,
gint y,
GtkSelectionData *data,
guint info,
guint time,
gpointer user_data)
{
char *psz_text = data->data;
int i_len = strlen( psz_text );
switch( info )
{
case DROP_ACCEPT_TEXT_PLAIN: /* FIXME: handle multiple files */
if( i_len < 1 )
{
return;
}
/* get rid of ' ' at the end */
*( psz_text + i_len - 1 ) = 0;
intf_WarnMsg( 1, "intf: dropped text/uri-list data `%s'", psz_text );
intf_PlstAdd( p_main->p_playlist, PLAYLIST_END, psz_text );
break;
case DROP_ACCEPT_TEXT_URI_LIST: /* FIXME: handle multiple files */
if( i_len < 2 )
{
return;
}
/* get rid of \r\n at the end */
*( psz_text + i_len - 2 ) = 0;
intf_WarnMsg( 1, "intf: dropped text/uri-list data `%s'", psz_text );
intf_PlstAdd( p_main->p_playlist, PLAYLIST_END, psz_text );
break;
default:
intf_ErrMsg( "intf error: unknown dropped type");
break;
}
}
...@@ -187,3 +187,13 @@ on_playlist_ok_clicked (GtkButton *button, ...@@ -187,3 +187,13 @@ on_playlist_ok_clicked (GtkButton *button,
void void
on_menubar_modules_activate (GtkMenuItem *menuitem, on_menubar_modules_activate (GtkMenuItem *menuitem,
gpointer user_data); gpointer user_data);
void
on_intf_window_drag_data_received (GtkWidget *widget,
GdkDragContext *drag_context,
gint x,
gint y,
GtkSelectionData *data,
guint info,
guint time,
gpointer user_data);
...@@ -84,8 +84,9 @@ create_intf_window (void) ...@@ -84,8 +84,9 @@ create_intf_window (void)
GtkWidget *toolbar_next; GtkWidget *toolbar_next;
GtkWidget *vbox2; GtkWidget *vbox2;
GtkWidget *label6; GtkWidget *label6;
GtkWidget *label7; GtkWidget *entry1;
GtkWidget *hscale; GtkWidget *hscale;
GtkWidget *label13;
GtkWidget *appbar; GtkWidget *appbar;
intf_window = gnome_app_new ("VideoLAN Client", _("VideoLAN Client")); intf_window = gnome_app_new ("VideoLAN Client", _("VideoLAN Client"));
...@@ -298,7 +299,7 @@ create_intf_window (void) ...@@ -298,7 +299,7 @@ create_intf_window (void)
gtk_widget_show (vbox2); gtk_widget_show (vbox2);
gnome_app_set_contents (GNOME_APP (intf_window), vbox2); gnome_app_set_contents (GNOME_APP (intf_window), vbox2);
label6 = gtk_label_new (_("File name: wazaa.mpeg")); label6 = gtk_label_new (_("File name: this part of the interface doesn't work yet.mpeg"));
gtk_widget_ref (label6); gtk_widget_ref (label6);
gtk_object_set_data_full (GTK_OBJECT (intf_window), "label6", label6, gtk_object_set_data_full (GTK_OBJECT (intf_window), "label6", label6,
(GtkDestroyNotify) gtk_widget_unref); (GtkDestroyNotify) gtk_widget_unref);
...@@ -308,16 +309,13 @@ create_intf_window (void) ...@@ -308,16 +309,13 @@ create_intf_window (void)
gtk_misc_set_alignment (GTK_MISC (label6), 0, 0.5); gtk_misc_set_alignment (GTK_MISC (label6), 0, 0.5);
gtk_misc_set_padding (GTK_MISC (label6), 5, 0); gtk_misc_set_padding (GTK_MISC (label6), 5, 0);
label7 = gtk_label_new (_("File type: awesome movie")); entry1 = gtk_entry_new ();
gtk_widget_ref (label7); gtk_widget_ref (entry1);
gtk_object_set_data_full (GTK_OBJECT (intf_window), "label7", label7, gtk_object_set_data_full (GTK_OBJECT (intf_window), "entry1", entry1,
(GtkDestroyNotify) gtk_widget_unref); (GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label7); gtk_widget_show (entry1);
gtk_box_pack_start (GTK_BOX (vbox2), label7, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox2), entry1, FALSE, FALSE, 0);
gtk_label_set_justify (GTK_LABEL (label7), GTK_JUSTIFY_LEFT); gtk_entry_set_text (GTK_ENTRY (entry1), _("Tired of boring stub messages ? Write your own exciting message here !!"));
gtk_label_set_line_wrap (GTK_LABEL (label7), TRUE);
gtk_misc_set_alignment (GTK_MISC (label7), 0, 0.5);
gtk_misc_set_padding (GTK_MISC (label7), 5, 0);
hscale = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, 100, 1, 5, 1))); hscale = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, 100, 1, 5, 1)));
gtk_widget_ref (hscale); gtk_widget_ref (hscale);
...@@ -328,6 +326,14 @@ create_intf_window (void) ...@@ -328,6 +326,14 @@ create_intf_window (void)
gtk_scale_set_value_pos (GTK_SCALE (hscale), GTK_POS_BOTTOM); gtk_scale_set_value_pos (GTK_SCALE (hscale), GTK_POS_BOTTOM);
gtk_range_set_update_policy (GTK_RANGE (hscale), GTK_UPDATE_DELAYED); gtk_range_set_update_policy (GTK_RANGE (hscale), GTK_UPDATE_DELAYED);
label13 = gtk_label_new (_("HEY ! YOU CAN DROP A FILE ON VLC TOO :-)"));
gtk_widget_ref (label13);
gtk_object_set_data_full (GTK_OBJECT (intf_window), "label13", label13,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label13);
gtk_box_pack_start (GTK_BOX (vbox2), label13, FALSE, FALSE, 0);
gtk_misc_set_padding (GTK_MISC (label13), 0, 5);
appbar = gnome_appbar_new (TRUE, TRUE, GNOME_PREFERENCES_NEVER); appbar = gnome_appbar_new (TRUE, TRUE, GNOME_PREFERENCES_NEVER);
gtk_widget_ref (appbar); gtk_widget_ref (appbar);
gtk_object_set_data_full (GTK_OBJECT (intf_window), "appbar", appbar, gtk_object_set_data_full (GTK_OBJECT (intf_window), "appbar", appbar,
...@@ -338,6 +344,9 @@ create_intf_window (void) ...@@ -338,6 +344,9 @@ create_intf_window (void)
gtk_signal_connect (GTK_OBJECT (intf_window), "destroy", gtk_signal_connect (GTK_OBJECT (intf_window), "destroy",
GTK_SIGNAL_FUNC (on_intf_window_destroy), GTK_SIGNAL_FUNC (on_intf_window_destroy),
NULL); NULL);
gtk_signal_connect (GTK_OBJECT (intf_window), "drag_data_received",
GTK_SIGNAL_FUNC (on_intf_window_drag_data_received),
NULL);
gnome_app_install_menu_hints (GNOME_APP (intf_window), menubar_uiinfo); gnome_app_install_menu_hints (GNOME_APP (intf_window), menubar_uiinfo);
gtk_signal_connect (GTK_OBJECT (toolbar_open), "clicked", gtk_signal_connect (GTK_OBJECT (toolbar_open), "clicked",
GTK_SIGNAL_FUNC (on_toolbar_open_clicked), GTK_SIGNAL_FUNC (on_toolbar_open_clicked),
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* gnome_sys.h: private Gnome interface description * gnome_sys.h: private Gnome interface description
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: gnome_sys.h,v 1.4 2001/02/14 07:48:18 sam Exp $ * $Id: gnome_sys.h,v 1.5 2001/02/16 06:37:09 sam Exp $
* *
* Authors: * Authors: Samuel Hocevar <sam@zoy.org>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
...@@ -21,6 +21,12 @@ ...@@ -21,6 +21,12 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/ *****************************************************************************/
/*****************************************************************************
* drag'n'drop stuff
*****************************************************************************/
#define DROP_ACCEPT_TEXT_URI_LIST 0
#define DROP_ACCEPT_TEXT_PLAIN 1
/***************************************************************************** /*****************************************************************************
* intf_sys_t: description and status of Gnome interface * intf_sys_t: description and status of Gnome interface
*****************************************************************************/ *****************************************************************************/
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* intf_gnome.c: Gnome interface * intf_gnome.c: Gnome interface
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: intf_gnome.c,v 1.12 2001/02/15 07:59:38 sam Exp $ * $Id: intf_gnome.c,v 1.13 2001/02/16 06:37:09 sam Exp $
* *
* Authors: * Authors:
* *
...@@ -111,7 +111,7 @@ static int intf_Probe( probedata_t *p_data ) ...@@ -111,7 +111,7 @@ static int intf_Probe( probedata_t *p_data )
return( 999 ); return( 999 );
} }
return( 40 ); return( 100 );
} }
/***************************************************************************** /*****************************************************************************
...@@ -163,13 +163,25 @@ static void intf_Run( intf_thread_t *p_intf ) ...@@ -163,13 +163,25 @@ static void intf_Run( intf_thread_t *p_intf )
* give it an empty one */ * give it an empty one */
char *p_args[] = { }; char *p_args[] = { };
/* The data types we are allowed to receive */
static GtkTargetEntry target_table[] =
{
{ "text/uri-list", 0, DROP_ACCEPT_TEXT_URI_LIST },
{ "text/plain", 0, DROP_ACCEPT_TEXT_PLAIN }
};
/* Initialize Gnome */ /* Initialize Gnome */
gnome_init( p_main->psz_arg0, VERSION, 1, p_args ); gnome_init( p_main->psz_arg0, VERSION, 1, p_args );
/* create some useful widgets that will certainly be used */ /* create some useful widgets that will certainly be used */
p_intf->p_sys->p_window = create_intf_window(); p_intf->p_sys->p_window = create_intf_window( );
p_intf->p_sys->p_popup = create_intf_popup( ); p_intf->p_sys->p_popup = create_intf_popup( );
/* accept file drops on the main window */
gtk_drag_dest_set( GTK_WIDGET( p_intf->p_sys->p_window ),
GTK_DEST_DEFAULT_ALL, target_table,
1, GDK_ACTION_COPY );
/* we don't create these ones yet because we perhaps won't need them */ /* we don't create these ones yet because we perhaps won't need them */
p_intf->p_sys->p_about = NULL; p_intf->p_sys->p_about = NULL;
p_intf->p_sys->p_playlist = NULL; p_intf->p_sys->p_playlist = NULL;
...@@ -191,6 +203,7 @@ static void intf_Run( intf_thread_t *p_intf ) ...@@ -191,6 +203,7 @@ static void intf_Run( intf_thread_t *p_intf )
p_intf->p_sys->i_timeout = gtk_timeout_add( INTF_IDLE_SLEEP / 1000, p_intf->p_sys->i_timeout = gtk_timeout_add( INTF_IDLE_SLEEP / 1000,
GnomeManage, p_intf ); GnomeManage, p_intf );
/* enter gnome mode */ /* enter gnome mode */
gtk_main(); gtk_main();
......
...@@ -28,6 +28,11 @@ ...@@ -28,6 +28,11 @@
<handler>on_intf_window_destroy</handler> <handler>on_intf_window_destroy</handler>
<last_modification_time>Sun, 11 Feb 2001 17:41:57 GMT</last_modification_time> <last_modification_time>Sun, 11 Feb 2001 17:41:57 GMT</last_modification_time>
</signal> </signal>
<signal>
<name>drag_data_received</name>
<handler>on_intf_window_drag_data_received</handler>
<last_modification_time>Fri, 16 Feb 2001 01:59:35 GMT</last_modification_time>
</signal>
<title>VideoLAN Client</title> <title>VideoLAN Client</title>
<type>GTK_WINDOW_TOPLEVEL</type> <type>GTK_WINDOW_TOPLEVEL</type>
<position>GTK_WIN_POS_NONE</position> <position>GTK_WIN_POS_NONE</position>
...@@ -376,7 +381,7 @@ ...@@ -376,7 +381,7 @@
<widget> <widget>
<class>GtkLabel</class> <class>GtkLabel</class>
<name>label6</name> <name>label6</name>
<label>File name: wazaa.mpeg</label> <label>File name: this part of the interface doesn't work yet.mpeg</label>
<justify>GTK_JUSTIFY_LEFT</justify> <justify>GTK_JUSTIFY_LEFT</justify>
<wrap>False</wrap> <wrap>False</wrap>
<xalign>0</xalign> <xalign>0</xalign>
...@@ -391,15 +396,13 @@ ...@@ -391,15 +396,13 @@
</widget> </widget>
<widget> <widget>
<class>GtkLabel</class> <class>GtkEntry</class>
<name>label7</name> <name>entry1</name>
<label>File type: awesome movie</label> <can_focus>True</can_focus>
<justify>GTK_JUSTIFY_LEFT</justify> <editable>True</editable>
<wrap>True</wrap> <text_visible>True</text_visible>
<xalign>0</xalign> <text_max_length>0</text_max_length>
<yalign>0.5</yalign> <text>Tired of boring stub messages ? Write your own exciting message here !!</text>
<xpad>5</xpad>
<ypad>0</ypad>
<child> <child>
<padding>0</padding> <padding>0</padding>
<expand>False</expand> <expand>False</expand>
...@@ -437,6 +440,23 @@ ...@@ -437,6 +440,23 @@
<fill>False</fill> <fill>False</fill>
</child> </child>
</widget> </widget>
<widget>
<class>GtkLabel</class>
<name>label13</name>
<label>HEY ! YOU CAN DROP A FILE ON VLC TOO :-)</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>5</ypad>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
</widget> </widget>
</widget> </widget>
......
...@@ -560,7 +560,8 @@ static int SDLOpenDisplay( vout_thread_t *p_vout ) ...@@ -560,7 +560,8 @@ static int SDLOpenDisplay( vout_thread_t *p_vout )
else else
SDL_ShowCursor( 1 ); SDL_ShowCursor( 1 );
SDL_WM_SetCaption( VOUT_TITLE , VOUT_TITLE ); SDL_WM_SetCaption( VOUT_TITLE " (SDL output)",
VOUT_TITLE " (SDL output)" );
SDL_EventState(SDL_KEYUP , SDL_IGNORE); /* ignore keys up */ SDL_EventState(SDL_KEYUP , SDL_IGNORE); /* ignore keys up */
SDL_EventState(SDL_MOUSEBUTTONUP, SDL_IGNORE); SDL_EventState(SDL_MOUSEBUTTONUP, SDL_IGNORE);
......
/*****************************************************************************
* intf_ncurses.c: ncurses interface
*****************************************************************************
* Copyright (C) 2001 VideoLAN
*
* Authors: Samuel Hocevar <sam@zoy.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.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include "defs.h"
#include <errno.h> /* ENOMEM */
#include <stdlib.h> /* free() */
#include <string.h> /* strerror() */
#include <stdio.h>
#include <curses.h>
#include "config.h"
#include "common.h"
#include "threads.h"
#include "mtime.h"
#include "tests.h"
#include "modules.h"
#include "stream_control.h"
#include "input_ext-intf.h"
#include "intf_msg.h"
#include "interface.h"
#include "main.h"
/*****************************************************************************
* intf_sys_t: description and status of ncurses interface
*****************************************************************************/
typedef struct intf_sys_s
{
/* special actions */
vlc_mutex_t change_lock; /* the change lock */
} intf_sys_t;
/*****************************************************************************
* Local prototypes.
*****************************************************************************/
static int intf_Probe ( probedata_t *p_data );
static int intf_Open ( intf_thread_t *p_intf );
static void intf_Close ( intf_thread_t *p_intf );
static void intf_Run ( intf_thread_t *p_intf );
/*****************************************************************************
* Functions exported as capabilities. They are declared as static so that
* we don't pollute the namespace too much.
*****************************************************************************/
void intf_getfunctions( function_list_t * p_function_list )
{
p_function_list->pf_probe = intf_Probe;
p_function_list->functions.intf.pf_open = intf_Open;
p_function_list->functions.intf.pf_close = intf_Close;
p_function_list->functions.intf.pf_run = intf_Run;
}
/*****************************************************************************
* intf_Probe: probe the interface and return a score
*****************************************************************************
* This function tries to initialize ncurses and returns a score to the
* plugin manager so that it can select the best plugin.
*****************************************************************************/
static int intf_Probe( probedata_t *p_data )
{
if( TestMethod( INTF_METHOD_VAR, "ncurses" ) )
{
return( 999 );
}
return( 40 );
}
/*****************************************************************************
* intf_Open: initialize and create window
*****************************************************************************/
static int intf_Open( intf_thread_t *p_intf )
{
/* Allocate instance and initialize some members */
p_intf->p_sys = malloc( sizeof( intf_sys_t ) );
if( p_intf->p_sys == NULL )
{
intf_ErrMsg("error: %s", strerror(ENOMEM));
return( 1 );
}
/* Initialize the curses library */
initscr();
/* Don't do NL -> CR/NL */
nonl();
/* Take input chars one at a time */
cbreak();
/* Don't echo */
noecho();
return( 0 );
}
/*****************************************************************************
* intf_Close: destroy interface window
*****************************************************************************/
static void intf_Close( intf_thread_t *p_intf )
{
/* Close the ncurses interface */
endwin();
/* Destroy structure */
free( p_intf->p_sys );
}
/*****************************************************************************
* intf_Run: ncurses thread
*****************************************************************************/
static void intf_Run( intf_thread_t *p_intf )
{
while( !p_intf->b_die )
{
p_intf->pf_manage( p_intf );
msleep( INTF_IDLE_SLEEP );
}
}
/* following functions are local */
/*****************************************************************************
* ncurses.c : NCurses plugin for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
*
* Authors: Samuel Hocevar <sam@zoy.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.
*****************************************************************************/
#define MODULE_NAME ncurses
/*****************************************************************************
* Preamble
*****************************************************************************/
#include "defs.h"
#include <stdlib.h> /* malloc(), free() */
#include "config.h"
#include "common.h" /* boolean_t, byte_t */
#include "threads.h"
#include "mtime.h"
#include "modules.h"
#include "modules_inner.h"
/*****************************************************************************
* Building configuration tree
*****************************************************************************/
MODULE_CONFIG_START
ADD_WINDOW( "Configuration for NCurses module" )
ADD_COMMENT( "For now, the NCurses module cannot be configured" )
MODULE_CONFIG_END
/*****************************************************************************
* Capabilities defined in the other files.
******************************************************************************/
extern void intf_getfunctions( function_list_t * p_function_list );
/*****************************************************************************
* InitModule: get the module structure and configuration.
*****************************************************************************
* We have to fill psz_name, psz_longname and psz_version. These variables
* will be strdup()ed later by the main application because the module can
* be unloaded later to save memory, and we want to be able to access this
* data even after the module has been unloaded.
*****************************************************************************/
int InitModule( module_t * p_module )
{
p_module->psz_name = MODULE_STRING;
p_module->psz_longname = "ncurses interface module";
p_module->psz_version = VERSION;
p_module->i_capabilities = MODULE_CAPABILITY_NULL
| MODULE_CAPABILITY_INTF;
return( 0 );
}
/*****************************************************************************
* ActivateModule: set the module to an usable state.
*****************************************************************************
* This function fills the capability functions and the configuration
* structure. Once ActivateModule() has been called, the i_usage can
* be set to 0 and calls to NeedModule() be made to increment it. To unload
* the module, one has to wait until i_usage == 0 and call DeactivateModule().
*****************************************************************************/
int ActivateModule( module_t * p_module )
{
p_module->p_functions = malloc( sizeof( module_functions_t ) );
if( p_module->p_functions == NULL )
{
return( -1 );
}
intf_getfunctions( &p_module->p_functions->intf );
p_module->p_config = p_config;
return( 0 );
}
/*****************************************************************************
* DeactivateModule: make sure the module can be unloaded.
*****************************************************************************
* This function must only be called when i_usage == 0. If it successfully
* returns, i_usage can be set to -1 and the module unloaded. Be careful to
* lock usage_lock during the whole process.
*****************************************************************************/
int DeactivateModule( module_t * p_module )
{
free( p_module->p_functions );
return( 0 );
}
This diff is collapsed.
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* decoders. * decoders.
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN * Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: input.c,v 1.80 2001/02/12 13:20:14 massiot Exp $ * $Id: input.c,v 1.81 2001/02/16 06:37:09 sam Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -62,8 +62,9 @@ ...@@ -62,8 +62,9 @@
* Local prototypes * Local prototypes
*****************************************************************************/ *****************************************************************************/
static void RunThread ( input_thread_t *p_input ); static void RunThread ( input_thread_t *p_input );
static void InitThread ( input_thread_t *p_input ); static int InitThread ( input_thread_t *p_input );
static void ErrorThread ( input_thread_t *p_input ); static void ErrorThread ( input_thread_t *p_input );
static void DestroyThread ( input_thread_t *p_input );
static void EndThread ( input_thread_t *p_input ); static void EndThread ( input_thread_t *p_input );
/***************************************************************************** /*****************************************************************************
...@@ -188,7 +189,16 @@ static void RunThread( input_thread_t *p_input ) ...@@ -188,7 +189,16 @@ static void RunThread( input_thread_t *p_input )
data_packet_t * pp_packets[INPUT_READ_ONCE]; data_packet_t * pp_packets[INPUT_READ_ONCE];
int i_error, i; int i_error, i;
InitThread( p_input ); if( InitThread( p_input ) )
{
/* If we failed, wait before we are killed, and exit */
*p_input->pi_status = THREAD_ERROR;
p_input->b_error = 1;
ErrorThread( p_input );
DestroyThread( p_input );
return;
}
while( !p_input->b_die && !p_input->b_error && !p_input->b_eof ) while( !p_input->b_die && !p_input->b_error && !p_input->b_eof )
{ {
...@@ -250,13 +260,16 @@ static void RunThread( input_thread_t *p_input ) ...@@ -250,13 +260,16 @@ static void RunThread( input_thread_t *p_input )
} }
EndThread( p_input ); EndThread( p_input );
DestroyThread( p_input );
intf_DbgMsg("Thread end"); intf_DbgMsg("Thread end");
} }
/***************************************************************************** /*****************************************************************************
* InitThread: init the input Thread * InitThread: init the input Thread
*****************************************************************************/ *****************************************************************************/
static void InitThread( input_thread_t * p_input ) static int InitThread( input_thread_t * p_input )
{ {
#ifdef STATS #ifdef STATS
...@@ -274,8 +287,8 @@ static void InitThread( input_thread_t * p_input ) ...@@ -274,8 +287,8 @@ static void InitThread( input_thread_t * p_input )
if( p_input->p_input_module == NULL ) if( p_input->p_input_module == NULL )
{ {
intf_ErrMsg( "input error: no suitable input module" ); intf_ErrMsg( "input error: no suitable input module" );
p_input->b_error = 1; module_Unneed( p_main->p_bank, p_input->p_input_module );
return; return( -1 );
} }
#define f p_input->p_input_module->p_functions->input.functions.input #define f p_input->p_input_module->p_functions->input.functions.input
...@@ -297,14 +310,17 @@ static void InitThread( input_thread_t * p_input ) ...@@ -297,14 +310,17 @@ static void InitThread( input_thread_t * p_input )
if( p_input->b_error ) if( p_input->b_error )
{ {
/* We barfed -- exit nicely */
p_input->pf_close( p_input );
module_Unneed( p_main->p_bank, p_input->p_input_module ); module_Unneed( p_main->p_bank, p_input->p_input_module );
return( -1 );
} }
else
{
p_input->pf_init( p_input ); p_input->pf_init( p_input );
}
*p_input->pi_status = THREAD_READY; *p_input->pi_status = THREAD_READY;
return( 0 );
} }
/***************************************************************************** /*****************************************************************************
...@@ -345,14 +361,25 @@ static void EndThread( input_thread_t * p_input ) ...@@ -345,14 +361,25 @@ static void EndThread( input_thread_t * p_input )
/* Free all ES and destroy all decoder threads */ /* Free all ES and destroy all decoder threads */
input_EndStream( p_input ); input_EndStream( p_input );
/* Close stream */
p_input->pf_close( p_input );
/* Free demultiplexer's data */ /* Free demultiplexer's data */
p_input->pf_end( p_input ); p_input->pf_end( p_input );
/* Close stream */
p_input->pf_close( p_input );
/* Release modules */ /* Release modules */
module_Unneed( p_main->p_bank, p_input->p_input_module ); module_Unneed( p_main->p_bank, p_input->p_input_module );
}
/*****************************************************************************
* DestroyThread: destroy the input thread
*****************************************************************************/
static void DestroyThread( input_thread_t * p_input )
{
int * pi_status; /* thread status */
/* Store status */
pi_status = p_input->pi_status;
/* Destroy Mutex locks */ /* Destroy Mutex locks */
vlc_mutex_destroy( &p_input->stream.control.control_lock ); vlc_mutex_destroy( &p_input->stream.control.control_lock );
......
...@@ -39,27 +39,33 @@ ...@@ -39,27 +39,33 @@
#include "input.h" #include "input.h"
/***************************************************************************** /*****************************************************************************
* input_SetRate: change the reading pace * input_SetStatus: change the reading status
*****************************************************************************/ *****************************************************************************/
void input_SetRate( input_thread_t * p_input, int i_mode ) void input_SetStatus( input_thread_t * p_input, int i_mode )
{ {
vlc_mutex_lock( &p_input->stream.stream_lock ); vlc_mutex_lock( &p_input->stream.stream_lock );
switch( i_mode ) switch( i_mode )
{ {
case INPUT_RATE_PLAY: case INPUT_STATUS_END:
p_input->stream.i_new_status = PLAYING_S;
p_input->b_eof = 1;
intf_Msg( "input: end of stream" );
break;
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_Msg( "input: playing at normal rate" );
break; break;
case INPUT_RATE_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_Msg( "input: toggling pause" );
break; break;
case INPUT_RATE_FASTER: case INPUT_STATUS_FASTER:
/* If we are already going too fast, go back to default rate */ /* If we are already going too fast, go back to default rate */
if( p_input->stream.control.i_rate * 8 <= DEFAULT_RATE ) if( p_input->stream.control.i_rate * 8 <= DEFAULT_RATE )
{ {
...@@ -85,7 +91,7 @@ void input_SetRate( input_thread_t * p_input, int i_mode ) ...@@ -85,7 +91,7 @@ void input_SetRate( input_thread_t * p_input, int i_mode )
} }
break; break;
case INPUT_RATE_SLOWER: case INPUT_STATUS_SLOWER:
/* If we are already going too slow, go back to default rate */ /* If we are already going too slow, go back to default rate */
if( p_input->stream.control.i_rate >= 8 * DEFAULT_RATE ) if( p_input->stream.control.i_rate >= 8 * DEFAULT_RATE )
{ {
...@@ -118,6 +124,14 @@ void input_SetRate( input_thread_t * p_input, int i_mode ) ...@@ -118,6 +124,14 @@ void input_SetRate( input_thread_t * p_input, int i_mode )
vlc_mutex_unlock( &p_input->stream.stream_lock ); vlc_mutex_unlock( &p_input->stream.stream_lock );
} }
/*****************************************************************************
* input_SetRate: change the reading rate
*****************************************************************************/
void input_SetRate( input_thread_t * p_input, int i_mode )
{
; /* FIXME: stub */
}
/***************************************************************************** /*****************************************************************************
* input_Seek: changes the stream postion * input_Seek: changes the stream postion
*****************************************************************************/ *****************************************************************************/
......
...@@ -349,19 +349,17 @@ int intf_ProcessKey( intf_thread_t *p_intf, int g_key ) ...@@ -349,19 +349,17 @@ int intf_ProcessKey( intf_thread_t *p_intf, int g_key )
case INTF_KEY_DEC_GAMMA: /* gamma - */ case INTF_KEY_DEC_GAMMA: /* gamma - */
if( (p_main->p_vout != NULL) && (p_main->p_vout->f_gamma > -INTF_GAMMA_LIMIT) ) if( (p_main->p_vout != NULL) && (p_main->p_vout->f_gamma > -INTF_GAMMA_LIMIT) )
{ {
vlc_mutex_lock( &p_main->p_vout->change_lock ); /* FIXME: we should lock if called from the interface */
p_main->p_vout->f_gamma -= INTF_GAMMA_STEP; p_main->p_vout->f_gamma -= INTF_GAMMA_STEP;
p_main->p_vout->i_changes |= VOUT_GAMMA_CHANGE; p_main->p_vout->i_changes |= VOUT_GAMMA_CHANGE;
vlc_mutex_unlock( &p_main->p_vout->change_lock );
} }
break; break;
case INTF_KEY_INC_GAMMA: /* gamma + */ case INTF_KEY_INC_GAMMA: /* gamma + */
if( (p_main->p_vout != NULL) && (p_main->p_vout->f_gamma < INTF_GAMMA_LIMIT) ) if( (p_main->p_vout != NULL) && (p_main->p_vout->f_gamma < INTF_GAMMA_LIMIT) )
{ {
vlc_mutex_lock( &p_main->p_vout->change_lock ); /* FIXME: we should lock if called from the interface */
p_main->p_vout->f_gamma += INTF_GAMMA_STEP; p_main->p_vout->f_gamma += INTF_GAMMA_STEP;
p_main->p_vout->i_changes |= VOUT_GAMMA_CHANGE; p_main->p_vout->i_changes |= VOUT_GAMMA_CHANGE;
vlc_mutex_unlock( &p_main->p_vout->change_lock );
} }
break; break;
default: /* unknown key */ default: /* unknown key */
......
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