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 \
plugins/motion/vdec_motion_common.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_PS = plugins/mpeg/ps.o \
......@@ -385,6 +388,7 @@ STD_PLUGIN_OBJ = \
$(PLUGIN_MOTION) \
$(PLUGIN_MOTIONMMX) \
$(PLUGIN_MOTIONMMXEXT) \
$(PLUGIN_NCURSES) \
$(PLUGIN_NULL) \
$(PLUGIN_PS) \
$(PLUGIN_SDL) \
......@@ -612,6 +616,9 @@ lib/ggi.so: $(PLUGIN_GGI)
lib/sdl.so: $(PLUGIN_SDL)
$(CC) $(PCFLAGS) -shared -o $@ $^ $(LIB_SDL)
lib/ncurses.so: $(PLUGIN_NCURSES)
$(CC) $(PCFLAGS) -shared -o $@ $^ -lcurses
ifeq ($(SYS),beos)
lib/null.so: $(PLUGIN_NULL)
$(CC) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
......
This diff is collapsed.
......@@ -184,6 +184,9 @@ AC_ARG_WITH(glide,
else
LIB_GLIDE="-lglide2x"
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,
[ --disable-gnome Gnome support (default enabled)])
if test x$enable_gnome != xno; then PLUGINS=${PLUGINS}"gnome "; ALIASES=${ALIASES}"gvlc "; fi
......
......@@ -149,13 +149,6 @@
/* Maximum number of channels */
#define INTF_MAX_CHANNELS 10
/*
* X11 settings
*/
/* Title of the X11 window */
#define VOUT_TITLE "VideoLAN Client"
/*****************************************************************************
* Input thread configuration
*****************************************************************************/
......@@ -381,7 +374,8 @@
* FB_NOYPAN
*/
// #define FB_NOYPAN
#define VOUT_TITLE "VideoLAN Client @VLC_VERSION@"
/*****************************************************************************
* Video parser configuration
......
......@@ -4,7 +4,7 @@
* control the pace of reading.
*****************************************************************************
* 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>
*
......@@ -294,11 +294,12 @@ typedef struct input_config_s
#define INPUT_METHOD_BCAST 22 /* UDP broadcast */
#define INPUT_METHOD_VLAN_BCAST 32 /* UDP broadcast with VLANs */
/* Rate changing methods */
#define INPUT_RATE_PLAY 0
#define INPUT_RATE_PAUSE 1
#define INPUT_RATE_FASTER 2
#define INPUT_RATE_SLOWER 3
/* Status changing methods */
#define INPUT_STATUS_END 0
#define INPUT_STATUS_PLAY 1
#define INPUT_STATUS_PAUSE 2
#define INPUT_STATUS_FASTER 3
#define INPUT_STATUS_SLOWER 4
/*****************************************************************************
* Prototypes
......@@ -307,6 +308,7 @@ 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_SetRate( struct input_thread_s *, int );
void input_Seek ( struct input_thread_s *, off_t );
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 );
......@@ -37,6 +37,7 @@
#include "interface.h"
#include "intf_plst.h"
#include "intf_msg.h"
#include "gnome_sys.h"
#include "gnome_callbacks.h"
......@@ -171,7 +172,7 @@ on_toolbar_play_clicked (GtkButton *button,
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,
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,
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,
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,
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,
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,
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,
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,
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,
void
on_menubar_modules_activate (GtkMenuItem *menuitem,
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)
GtkWidget *toolbar_next;
GtkWidget *vbox2;
GtkWidget *label6;
GtkWidget *label7;
GtkWidget *entry1;
GtkWidget *hscale;
GtkWidget *label13;
GtkWidget *appbar;
intf_window = gnome_app_new ("VideoLAN Client", _("VideoLAN Client"));
......@@ -298,7 +299,7 @@ create_intf_window (void)
gtk_widget_show (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_object_set_data_full (GTK_OBJECT (intf_window), "label6", label6,
(GtkDestroyNotify) gtk_widget_unref);
......@@ -308,16 +309,13 @@ create_intf_window (void)
gtk_misc_set_alignment (GTK_MISC (label6), 0, 0.5);
gtk_misc_set_padding (GTK_MISC (label6), 5, 0);
label7 = gtk_label_new (_("File type: awesome movie"));
gtk_widget_ref (label7);
gtk_object_set_data_full (GTK_OBJECT (intf_window), "label7", label7,
entry1 = gtk_entry_new ();
gtk_widget_ref (entry1);
gtk_object_set_data_full (GTK_OBJECT (intf_window), "entry1", entry1,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label7);
gtk_box_pack_start (GTK_BOX (vbox2), label7, FALSE, FALSE, 0);
gtk_label_set_justify (GTK_LABEL (label7), GTK_JUSTIFY_LEFT);
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);
gtk_widget_show (entry1);
gtk_box_pack_start (GTK_BOX (vbox2), entry1, FALSE, FALSE, 0);
gtk_entry_set_text (GTK_ENTRY (entry1), _("Tired of boring stub messages ? Write your own exciting message here !!"));
hscale = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, 100, 1, 5, 1)));
gtk_widget_ref (hscale);
......@@ -328,6 +326,14 @@ create_intf_window (void)
gtk_scale_set_value_pos (GTK_SCALE (hscale), GTK_POS_BOTTOM);
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);
gtk_widget_ref (appbar);
gtk_object_set_data_full (GTK_OBJECT (intf_window), "appbar", appbar,
......@@ -338,6 +344,9 @@ create_intf_window (void)
gtk_signal_connect (GTK_OBJECT (intf_window), "destroy",
GTK_SIGNAL_FUNC (on_intf_window_destroy),
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);
gtk_signal_connect (GTK_OBJECT (toolbar_open), "clicked",
GTK_SIGNAL_FUNC (on_toolbar_open_clicked),
......
......@@ -2,9 +2,9 @@
* gnome_sys.h: private Gnome interface description
*****************************************************************************
* 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
* it under the terms of the GNU General Public License as published by
......@@ -21,6 +21,12 @@
* 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
*****************************************************************************/
......
......@@ -2,7 +2,7 @@
* intf_gnome.c: Gnome interface
*****************************************************************************
* 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:
*
......@@ -111,7 +111,7 @@ static int intf_Probe( probedata_t *p_data )
return( 999 );
}
return( 40 );
return( 100 );
}
/*****************************************************************************
......@@ -163,13 +163,25 @@ static void intf_Run( intf_thread_t *p_intf )
* give it an empty one */
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 */
gnome_init( p_main->psz_arg0, VERSION, 1, p_args );
/* 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( );
/* 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 */
p_intf->p_sys->p_about = NULL;
p_intf->p_sys->p_playlist = NULL;
......@@ -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,
GnomeManage, p_intf );
/* enter gnome mode */
gtk_main();
......
......@@ -28,6 +28,11 @@
<handler>on_intf_window_destroy</handler>
<last_modification_time>Sun, 11 Feb 2001 17:41:57 GMT</last_modification_time>
</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>
<type>GTK_WINDOW_TOPLEVEL</type>
<position>GTK_WIN_POS_NONE</position>
......@@ -376,7 +381,7 @@
<widget>
<class>GtkLabel</class>
<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>
<wrap>False</wrap>
<xalign>0</xalign>
......@@ -391,15 +396,13 @@
</widget>
<widget>
<class>GtkLabel</class>
<name>label7</name>
<label>File type: awesome movie</label>
<justify>GTK_JUSTIFY_LEFT</justify>
<wrap>True</wrap>
<xalign>0</xalign>
<yalign>0.5</yalign>
<xpad>5</xpad>
<ypad>0</ypad>
<class>GtkEntry</class>
<name>entry1</name>
<can_focus>True</can_focus>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text>Tired of boring stub messages ? Write your own exciting message here !!</text>
<child>
<padding>0</padding>
<expand>False</expand>
......@@ -437,6 +440,23 @@
<fill>False</fill>
</child>
</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>
......
......@@ -560,7 +560,8 @@ static int SDLOpenDisplay( vout_thread_t *p_vout )
else
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_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"