Commit c0138ec5 authored by Sam Hocevar's avatar Sam Hocevar

  * Fixed the continuous 'seeking position' bug in network mode.
  * rc interface plugin for vlc control through /dev/stdin courtesy
    of Peter Surda <shurdeek@panorama.sth.ac.at>.
  * Support for `ts://foo:42' style input source:
     vlc ts://vls.via.ecp.fr:1234
     vlc ts://vls.via.ecp.fr
     vlc ts:vls
     vlc ts:vls:4321
    As a side effect, the Gnome and Gtk "network input" buttons work.
parent f2975c71
......@@ -39,6 +39,10 @@ N: Nilmoni Deb
E: ndeb@ece.cmu.edu
D: Minor configure.in and Makefile.in fixes
N: Cyril Deguet
E: asmax@via.ecp.fr
D: PS input packet allocator
N: Colin Delacroix
E: colin@zoy.org
C: colin
......@@ -163,3 +167,7 @@ C: benny
D: MPEG system input
D: network input
N: Peter Surda
E: shurdeek@panorama.sth.ac.at
D: rc plugin for vlc control through /dev/stdin
......@@ -4,6 +4,10 @@
HEAD
* Fixed the continuous 'seeking position' bug in network mode.
* Support for `ts://foo:42' style input source.
* rc interface plugin for vlc control through /dev/stdin courtesy
of Peter Surda <shurdeek@panorama.sth.ac.at>.
* Misc XVideo fixes (aspect ratio, mouse pointer, blue areas).
* AC3 decoder enhancements.
* Fixed an alignment issue in the bitstream callback.
......
......@@ -28,7 +28,7 @@ PLUGINS_TARGETS := alsa/alsa beos/beos darwin/darwin dsp/dsp dummy/dummy \
macosx/macosx mga/mga \
motion/motion motion/motionmmx motion/motionmmxext \
mpeg/es mpeg/ps mpeg/ts null/null qt/qt sdl/sdl \
text/text x11/x11 x11/xvideo yuv/yuv yuv/yuvmmx
text/ncurses text/rc x11/x11 x11/xvideo yuv/yuv yuv/yuvmmx
#
# C Objects
......
......@@ -128,7 +128,7 @@ Urgency: Critical
Description: Multi-angle multi-language support
Some DVDs have several languages encoded in the same video stream, we
need to properly parse them.
Status: Todo
Status: Done 22 Apr 2001 (stef)
Task: 0x4f
Difficulty: Hard
......@@ -145,7 +145,7 @@ Urgency: Important
Description: Write stream zones support
For random access we need to know where stream descriptors are valid
and reside (essentially DVD plugin). -> Meuuh
Status: Todo
Status: Done (stef)
Task: 0x4d
Difficulty: Hard
......@@ -185,7 +185,7 @@ Urgency: Important
Description: Write a new buffer allocator
Avoid malloc()s by reusing the recently released packets. More
information -> Meuuh
Status: Todo
Status: Done 16 Apr 2001 (asmax)
Task: 0x48
Difficulty: Hard
......
This diff is collapsed.
......@@ -143,6 +143,14 @@ AC_ARG_ENABLE(null,
if test x$enable_null != xno; then
BUILTINS="${BUILTINS} null"; fi
dnl
dnl rc plugin
dnl
AC_ARG_ENABLE(rc,
[ --disable-rc rc module (default enabled)])
if test x$enable_rc != xno; then
BUILTINS="${BUILTINS} rc"; fi
dnl
dnl PentiumPro acceleration
dnl
......
......@@ -130,7 +130,7 @@ Print help and exit.
.B \-H, \-\-longhelp
Print long help and exit.
.TP
.B \-v, \-\-version
.B \-\-version
Output version information and exit.
.SH PARAMETERS
.B vlc
......
......@@ -52,12 +52,18 @@
/* Define if you have the vasprintf function. */
#undef HAVE_VASPRINTF
/* Define if you have the <CoreAudio/AudioHardware.h> header file. */
#undef HAVE_COREAUDIO_AUDIOHARDWARE_H
/* Define if you have the <Carbon/Carbon.h> header file. */
#undef HAVE_CARBON_CARBON_H
/* Define if you have the <SDL/SDL.h> header file. */
#undef HAVE_SDL_SDL_H
/* Define if you have the <X11/Xlib.h> header file. */
#undef HAVE_X11_XLIB_H
/* Define if you have the <X11/extensions/Xv.h> header file. */
#undef HAVE_X11_EXTENSIONS_XV_H
/* Define if you have the <arpa/inet.h> header file. */
#undef HAVE_ARPA_INET_H
......
......@@ -2,7 +2,7 @@
* alsa.c : alsa plugin for vlc
*****************************************************************************
* Copyright (C) 2000 VideoLAN
* $Id: alsa.c,v 1.8 2001/03/21 13:42:33 sam Exp $
* $Id: alsa.c,v 1.9 2001/04/27 16:08:26 sam Exp $
*
* Authors: Henri Fallon <henri@videolan.org>
*
......@@ -30,11 +30,6 @@
#include "defs.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/asoundlib.h> /* for alsa :) */
#include <linux/asound.h>
#include <fcntl.h>
#include <stdlib.h> /* malloc(), free() */
#include "config.h"
......@@ -42,10 +37,6 @@
#include "threads.h"
#include "mtime.h"
#include "interface.h"
#include "main.h"
#include "modules.h"
/*****************************************************************************
......
......@@ -2,7 +2,7 @@
* intf_gtk.c: Gtk+ interface
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: intf_gtk.c,v 1.13 2001/04/13 01:49:22 henri Exp $
* $Id: intf_gtk.c,v 1.14 2001/04/27 16:08:26 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Stphane Borel <stef@via.ecp.fr>
......@@ -409,7 +409,7 @@ static gint GtkManage( gpointer p_data )
}
/* Manage the slider */
if( p_intf->p_input != NULL )
if( p_intf->p_input != NULL && p_intf->p_input->stream.b_seekable )
{
float newvalue = p_intf->p_sys->p_adj->value;
......
......@@ -2,7 +2,7 @@
* input_ts.c: TS demux and netlist management
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: input_ts.c,v 1.14 2001/04/13 05:36:12 stef Exp $
* $Id: input_ts.c,v 1.15 2001/04/27 16:08:26 sam Exp $
*
* Authors: Henri Fallon <henri@videolan.org>
*
......@@ -66,10 +66,11 @@
* Local prototypes
*****************************************************************************/
static int TSProbe ( probedata_t * );
static int TSRead ( struct input_thread_s *,
data_packet_t * p_packets[INPUT_READ_ONCE] );
static void TSInit ( struct input_thread_s * );
static void TSFakeOpen ( struct input_thread_s * );
static void TSEnd ( struct input_thread_s * );
static int TSRead ( struct input_thread_s *,
data_packet_t * p_packets[INPUT_READ_ONCE] );
/*****************************************************************************
* Functions exported as capabilities. They are declared as static so that
......@@ -80,13 +81,8 @@ void _M( input_getfunctions )( function_list_t * p_function_list )
#define input p_function_list->functions.input
p_function_list->pf_probe = TSProbe;
input.pf_init = TSInit;
#if !defined( SYS_BEOS ) && !defined( SYS_NTO )
input.pf_open = input_NetworkOpen;
input.pf_close = input_NetworkClose;
#else
input.pf_open = input_FileOpen;
input.pf_close = input_FileClose;
#endif
input.pf_open = TSFakeOpen;
input.pf_close = NULL; /* Will be set by pf_open */
input.pf_end = TSEnd;
input.pf_set_area = NULL;
input.pf_read = TSRead;
......@@ -116,6 +112,12 @@ static int TSProbe( probedata_t * p_data )
return( 999 );
}
if( ( strlen(psz_name) > 3 ) && !strncasecmp( psz_name, "ts:", 3 ) )
{
/* If the user specified "ts:" then it's probably a network stream */
return( 999 );
}
if( ( strlen(psz_name) > 5 ) && !strncasecmp( psz_name, "file:", 5 ) )
{
/* If the user specified "file:" then it's probably a file */
......@@ -188,6 +190,30 @@ static void TSInit( input_thread_t * p_input )
}
/*****************************************************************************
* TSFakeOpen: open the stream and set pf_close
*****************************************************************************/
void TSFakeOpen( input_thread_t * p_input )
{
#if !defined( SYS_BEOS ) && !defined( SYS_NTO )
char *psz_name = p_input->p_source;
if( ( strlen(psz_name) > 3 ) && !strncasecmp( psz_name, "ts:", 3 ) )
{
/* If the user specified "ts:" he wants a network stream */
p_input->pf_open = input_NetworkOpen;
p_input->pf_close = input_NetworkClose;
}
else
#endif
{
p_input->pf_open = input_FileOpen;
p_input->pf_close = input_FileClose;
}
p_input->pf_open( p_input );
}
/*****************************************************************************
* TSEnd: frees unused data
*****************************************************************************/
......@@ -231,7 +257,7 @@ static int TSRead( input_thread_t * p_input,
s_wait.tv_usec = 0;
/* Reset pointer table */
memset( pp_packets, 0, INPUT_READ_ONCE*sizeof(data_packet_t *) );
memset( pp_packets, 0, INPUT_READ_ONCE * sizeof(data_packet_t *) );
/* Get iovecs */
p_iovec = input_NetlistGetiovec( p_input->p_method_data );
......@@ -247,7 +273,7 @@ static int TSRead( input_thread_t * p_input,
if( i_data == -1 )
{
intf_ErrMsg( "TS input : Error in select : %s", strerror(errno) );
intf_ErrMsg( "input error: TS select error (%s)", strerror(errno) );
return( -1 );
}
......@@ -257,7 +283,7 @@ static int TSRead( input_thread_t * p_input,
if( i_read == -1 )
{
intf_ErrMsg( "TS input : Could not readv" );
intf_ErrMsg( "input error: TS readv error" );
return( -1 );
}
......@@ -268,7 +294,9 @@ static int TSRead( input_thread_t * p_input,
for( i_loop=0; i_loop * TS_PACKET_SIZE < i_read; i_loop++ )
{
if( pp_packets[i_loop]->p_buffer[0] != 0x47 )
intf_ErrMsg( "TS input : Bad TS Packet (starcode != 0x47)." );
intf_ErrMsg( "input error: bad TS packet (starts with "
"0x%.2x, should be 0x47)",
pp_packets[i_loop]->p_buffer[0] );
}
}
return 0;
......
......@@ -2,7 +2,7 @@
* intf_qt.cpp: Qt interface
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: intf_qt.cpp,v 1.4 2001/04/16 07:40:11 sam Exp $
* $Id: intf_qt.cpp,v 1.5 2001/04/27 16:08:26 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -465,7 +465,7 @@ void IntfWindow::About( void )
void IntfWindow::Manage( void )
{
/* Manage the slider */
if( p_intf->p_input != NULL )
if( p_intf->p_input != NULL && p_intf->p_input->stream.b_seekable )
{
int i_value = p_slider->value();
......
......@@ -7,9 +7,13 @@
# Objects
#
PLUGIN_C = ncurses.o vout_ncurses.o
BUILTIN_C = $(PLUGIN_C:%.o=BUILTIN_%.o)
PLUGIN_NCURSES = ncurses.o intf_ncurses.o
PLUGIN_RC = rc.o intf_rc.o
BUILTIN_NCURSES = $(PLUGIN_NCURSES:%.o=BUILTIN_%.o)
BUILTIN_RC = $(PLUGIN_RC:%.o=BUILTIN_%.o)
PLUGIN_C = $(PLUGIN_NCURSES) $(PLUGIN_RC)
BUILTIN_C = $(BUILTIN_NCURSES) $(BUILTIN_RC)
ALL_OBJ = $(PLUGIN_C) $(BUILTIN_C)
#
......@@ -22,9 +26,15 @@ include ../../Makefile.modules
# Real targets
#
../../lib/ncurses.so: $(PLUGIN_C)
../../lib/ncurses.so: $(PLUGIN_NCURSES)
$(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS) $(LIB_NCURSES)
../../lib/ncurses.a: $(BUILTIN_C)
../../lib/ncurses.a: $(BUILTIN_NCURSES)
ar r $@ $^
../../lib/rc.so: $(PLUGIN_RC)
$(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS)
../../lib/rc.a: $(BUILTIN_RC)
ar r $@ $^
/*****************************************************************************
* intf_rc.cpp: rc interface
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: intf_rc.cpp,v 0.1 2001/04/27 shurdeek
*
* Authors: Peter Surda <shurdeek@panorama.sth.ac.at>
*
* 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 rc
#include "modules_inner.h"
/*****************************************************************************
* Preamble
*****************************************************************************/
#include "defs.h"
#include <errno.h> /* ENOMEM */
#include <stdlib.h> /* free() */
#include <string.h> /* strerror() */
#include <stdio.h>
#include <ctype.h>
#include <unistd.h>
#include <sys/time.h>
#include <sys/types.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 "intf_playlist.h"
#include "interface.h"
#include "video.h"
#include "video_output.h"
#include "main.h"
/*****************************************************************************
* intf_sys_t: description and status of rc interface
*****************************************************************************/
typedef struct intf_sys_s
{
vlc_mutex_t 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 _M( 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 rc 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, "rc" ) )
{
return( 999 );
}
return( 2 );
}
/*****************************************************************************
* intf_Open: initialize and create stuff
*****************************************************************************/
static int intf_Open( intf_thread_t *p_intf )
{
/* Non-buffered stdout */
setvbuf( stdout, (char *)NULL, _IOLBF, 0 );
/* Allocate instance and initialize some members */
p_intf->p_sys = (intf_sys_t *)malloc( sizeof( intf_sys_t ) );
if( p_intf->p_sys == NULL )
{
intf_ErrMsg( "intf error: %s", strerror(ENOMEM) );
return( 1 );
}
return( 0 );
}
/*****************************************************************************
* intf_Close: destroy interface stuff
*****************************************************************************/
static void intf_Close( intf_thread_t *p_intf )
{
/* Destroy structure */
free( p_intf->p_sys );
}
/*****************************************************************************
* intf_Run: rc thread
*****************************************************************************
* This part of the interface is in a separate thread so that we can call
* exec() from within it without annoying the rest of the program.
*****************************************************************************/
static void intf_Run( intf_thread_t *p_intf )
{
char p_cmd[ 32 ];
int i_cmd_pos;
boolean_t b_complete = 0;
int i_dummy;
off_t i_oldpos = 0;
off_t i_newpos;
fd_set fds; /* stdin changed? */
struct timeval tv; /* how long to wait */
double f_cpos;
double f_ratio = 1;
while( !p_intf->b_die )
{
if( p_intf->p_input != NULL )
{
/* Get position */
#define S p_intf->p_input->stream
if( S.i_mux_rate )
{
f_ratio = 1.0 / ( 50 * S.i_mux_rate );
i_newpos = S.p_selected_area->i_tell * f_ratio;
if( i_oldpos != i_newpos )
{
i_oldpos = i_newpos;
intf_Msg( "rc: pos: %li s / %li s", (long int)i_newpos,
(long int)( f_ratio *
S.p_selected_area->i_size ) );
}
}
#undef S
b_complete = 0;
i_cmd_pos = 0;
/* Check stdin */
tv.tv_sec = 0;
tv.tv_usec = 50000;
FD_ZERO( &fds );
FD_SET( STDIN_FILENO, &fds );
if( select( 32, &fds, NULL, NULL, &tv ) )
{
while( i_cmd_pos < 32
&& read( STDIN_FILENO, p_cmd + i_cmd_pos, 1 ) > 0
&& p_cmd[ i_cmd_pos ] != '\r'
&& p_cmd[ i_cmd_pos ] != '\n' )
{
i_cmd_pos++;
}
if( i_cmd_pos == 31 || p_cmd[ i_cmd_pos ] == '\r'
|| p_cmd[ i_cmd_pos ] == '\n' )
{
p_cmd[ i_cmd_pos ] = 0;
b_complete = 1;
}
}
/* Is there something to do? */
if( b_complete == 1 )
{
switch( p_cmd[ 0 ] )
{
case 'p':
case 'P':
input_SetStatus( p_intf->p_input, INPUT_STATUS_PAUSE );
break;
case 'f':
case 'F':
p_intf->p_input->p_default_vout->i_changes |=
VOUT_FULLSCREEN_CHANGE;
break;
case 'm':
case 'M':
#if 0
double picratio = p_intf->p_input->p_default_vout->i_width
/ p_intf->p_input->p_default_vout->i_height;
if (picratio
p_intf->p_input->p_default_vout->i_width=800
p_intf->p_input->p_default_vout->i_changes |=
VOUT_FULLSCREEN_CHANGE;
#endif
break;
case 's':
case 'S':
;
break;
case 'q':
case 'Q':
p_intf->b_die = 1;
break;
case 'r':
case 'R':
for( i_dummy = 1; i_dummy < 32 && p_cmd[ i_dummy ] >= '0'
&& p_cmd[ i_dummy ] <= '9'; ++i_dummy )
{
;
}
p_cmd[ i_dummy ] = 0;
f_cpos = atof( p_cmd + 1 );
input_Seek( p_intf->p_input, (off_t) (f_cpos / f_ratio) );
/* rcreseek(f_cpos); */
break;
default:
intf_Msg( "rc: unknown command: %s", p_cmd );
break;
}
}
}
p_intf->pf_manage( p_intf );
msleep( INTF_IDLE_SLEEP );
}
}
/*****************************************************************************
* rc.cpp : stdin/stdout plugin for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: rc.cpp,v 0.1 2001/04/27 shurdeek
*
* Authors: Peter Surda <shurdeek@panorama.sth.ac.at>
*
* 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 rc
#include "modules_inner.h"
/*****************************************************************************
* 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"
/*****************************************************************************
* Build configuration tree.
*****************************************************************************/
MODULE_CONFIG_START
ADD_WINDOW( "Configuration for rc module" )
ADD_COMMENT( "Ha, ha -- nothing to configure yet" )
MODULE_CONFIG_END
/*****************************************************************************
* Capabilities defined in the other files.
*****************************************************************************/
void _M( 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.
*****************************************************************************/
MODULE_INIT
{
p_module->psz_name = MODULE_STRING;
p_module->psz_longname = "rc 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().
*****************************************************************************/
MODULE_ACTIVATE
{
p_module->p_functions =
( module_functions_t * )malloc( sizeof( module_functions_t ) );
if( p_module->p_functions == NULL )
{
return( -1 );
}
_M( 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.
*****************************************************************************/
MODULE_DEACTIVATE
{
free( p_module->p_functions );
return( 0 );
}
......@@ -4,7 +4,7 @@
* decoders.
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: input.c,v 1.99 2001/04/22 00:08:26 stef Exp $
* $Id: input.c,v 1.100 2001/04/27 16:08:26 sam Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -508,7 +508,7 @@ void input_FileOpen( input_thread_t * p_input )
p_input->stream.p_selected_area->i_tell = 0;
vlc_mutex_unlock( &p_input->stream.stream_lock );
intf_Msg( "input: opening %s", p_input->p_source );
intf_Msg( "input: opening file `%s'", p_input->p_source );
if( (p_input->i_handle = open( psz_name,
/*O_NONBLOCK | O_LARGEFILE*/0 )) == (-1) )
{
......@@ -524,7 +524,7 @@ void input_FileOpen( input_thread_t * p_input )
*****************************************************************************/
void input_FileClose( input_thread_t * p_input )
{
intf_Msg( "input: closing %s", p_input->p_source );
intf_Msg( "input: closing file `%s'", p_input->p_source );
close( p_input->i_handle );
return;
......@@ -537,18 +537,68 @@ void input_FileClose( input_thread_t * p_input )
*****************************************************************************/
void input_NetworkOpen( input_thread_t * p_input )
{
int i_option_value, i_port;
struct sockaddr_in s_socket;
char *psz_server = NULL;