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 ...@@ -39,6 +39,10 @@ N: Nilmoni Deb
E: ndeb@ece.cmu.edu E: ndeb@ece.cmu.edu
D: Minor configure.in and Makefile.in fixes D: Minor configure.in and Makefile.in fixes
N: Cyril Deguet
E: asmax@via.ecp.fr
D: PS input packet allocator
N: Colin Delacroix N: Colin Delacroix
E: colin@zoy.org E: colin@zoy.org
C: colin C: colin
...@@ -163,3 +167,7 @@ C: benny ...@@ -163,3 +167,7 @@ C: benny
D: MPEG system input D: MPEG system input
D: network 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 @@ ...@@ -4,6 +4,10 @@
HEAD 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). * Misc XVideo fixes (aspect ratio, mouse pointer, blue areas).
* AC3 decoder enhancements. * AC3 decoder enhancements.
* Fixed an alignment issue in the bitstream callback. * Fixed an alignment issue in the bitstream callback.
......
...@@ -28,7 +28,7 @@ PLUGINS_TARGETS := alsa/alsa beos/beos darwin/darwin dsp/dsp dummy/dummy \ ...@@ -28,7 +28,7 @@ PLUGINS_TARGETS := alsa/alsa beos/beos darwin/darwin dsp/dsp dummy/dummy \
macosx/macosx mga/mga \ macosx/macosx mga/mga \
motion/motion motion/motionmmx motion/motionmmxext \ motion/motion motion/motionmmx motion/motionmmxext \
mpeg/es mpeg/ps mpeg/ts null/null qt/qt sdl/sdl \ 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 # C Objects
......
...@@ -128,7 +128,7 @@ Urgency: Critical ...@@ -128,7 +128,7 @@ Urgency: Critical
Description: Multi-angle multi-language support Description: Multi-angle multi-language support
Some DVDs have several languages encoded in the same video stream, we Some DVDs have several languages encoded in the same video stream, we
need to properly parse them. need to properly parse them.
Status: Todo Status: Done 22 Apr 2001 (stef)
Task: 0x4f Task: 0x4f
Difficulty: Hard Difficulty: Hard
...@@ -145,7 +145,7 @@ Urgency: Important ...@@ -145,7 +145,7 @@ Urgency: Important
Description: Write stream zones support Description: Write stream zones support
For random access we need to know where stream descriptors are valid For random access we need to know where stream descriptors are valid
and reside (essentially DVD plugin). -> Meuuh and reside (essentially DVD plugin). -> Meuuh
Status: Todo Status: Done (stef)
Task: 0x4d Task: 0x4d
Difficulty: Hard Difficulty: Hard
...@@ -185,7 +185,7 @@ Urgency: Important ...@@ -185,7 +185,7 @@ Urgency: Important
Description: Write a new buffer allocator Description: Write a new buffer allocator
Avoid malloc()s by reusing the recently released packets. More Avoid malloc()s by reusing the recently released packets. More
information -> Meuuh information -> Meuuh
Status: Todo Status: Done 16 Apr 2001 (asmax)
Task: 0x48 Task: 0x48
Difficulty: Hard Difficulty: Hard
......
This diff is collapsed.
...@@ -143,6 +143,14 @@ AC_ARG_ENABLE(null, ...@@ -143,6 +143,14 @@ AC_ARG_ENABLE(null,
if test x$enable_null != xno; then if test x$enable_null != xno; then
BUILTINS="${BUILTINS} null"; fi 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
dnl PentiumPro acceleration dnl PentiumPro acceleration
dnl dnl
......
...@@ -130,7 +130,7 @@ Print help and exit. ...@@ -130,7 +130,7 @@ Print help and exit.
.B \-H, \-\-longhelp .B \-H, \-\-longhelp
Print long help and exit. Print long help and exit.
.TP .TP
.B \-v, \-\-version .B \-\-version
Output version information and exit. Output version information and exit.
.SH PARAMETERS .SH PARAMETERS
.B vlc .B vlc
......
...@@ -52,12 +52,18 @@ ...@@ -52,12 +52,18 @@
/* Define if you have the vasprintf function. */ /* Define if you have the vasprintf function. */
#undef HAVE_VASPRINTF #undef HAVE_VASPRINTF
/* Define if you have the <CoreAudio/AudioHardware.h> header file. */ /* Define if you have the <Carbon/Carbon.h> header file. */
#undef HAVE_COREAUDIO_AUDIOHARDWARE_H #undef HAVE_CARBON_CARBON_H
/* Define if you have the <SDL/SDL.h> header file. */ /* Define if you have the <SDL/SDL.h> header file. */
#undef HAVE_SDL_SDL_H #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. */ /* Define if you have the <arpa/inet.h> header file. */
#undef HAVE_ARPA_INET_H #undef HAVE_ARPA_INET_H
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* alsa.c : alsa plugin for vlc * alsa.c : alsa plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000 VideoLAN * 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> * Authors: Henri Fallon <henri@videolan.org>
* *
...@@ -30,11 +30,6 @@ ...@@ -30,11 +30,6 @@
#include "defs.h" #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 <stdlib.h> /* malloc(), free() */
#include "config.h" #include "config.h"
...@@ -42,10 +37,6 @@ ...@@ -42,10 +37,6 @@
#include "threads.h" #include "threads.h"
#include "mtime.h" #include "mtime.h"
#include "interface.h"
#include "main.h"
#include "modules.h" #include "modules.h"
/***************************************************************************** /*****************************************************************************
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* intf_gtk.c: Gtk+ interface * intf_gtk.c: Gtk+ interface
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * 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> * Authors: Samuel Hocevar <sam@zoy.org>
* Stphane Borel <stef@via.ecp.fr> * Stphane Borel <stef@via.ecp.fr>
...@@ -409,7 +409,7 @@ static gint GtkManage( gpointer p_data ) ...@@ -409,7 +409,7 @@ static gint GtkManage( gpointer p_data )
} }
/* Manage the slider */ /* 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; float newvalue = p_intf->p_sys->p_adj->value;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* input_ts.c: TS demux and netlist management * input_ts.c: TS demux and netlist management
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN * 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> * Authors: Henri Fallon <henri@videolan.org>
* *
...@@ -66,10 +66,11 @@ ...@@ -66,10 +66,11 @@
* Local prototypes * Local prototypes
*****************************************************************************/ *****************************************************************************/
static int TSProbe ( probedata_t * ); 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 TSInit ( struct input_thread_s * );
static void TSFakeOpen ( struct input_thread_s * );
static void TSEnd ( 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 * 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 ) ...@@ -80,13 +81,8 @@ void _M( input_getfunctions )( function_list_t * p_function_list )
#define input p_function_list->functions.input #define input p_function_list->functions.input
p_function_list->pf_probe = TSProbe; p_function_list->pf_probe = TSProbe;
input.pf_init = TSInit; input.pf_init = TSInit;
#if !defined( SYS_BEOS ) && !defined( SYS_NTO ) input.pf_open = TSFakeOpen;
input.pf_open = input_NetworkOpen; input.pf_close = NULL; /* Will be set by pf_open */
input.pf_close = input_NetworkClose;
#else
input.pf_open = input_FileOpen;
input.pf_close = input_FileClose;
#endif
input.pf_end = TSEnd; input.pf_end = TSEnd;
input.pf_set_area = NULL; input.pf_set_area = NULL;
input.pf_read = TSRead; input.pf_read = TSRead;
...@@ -116,6 +112,12 @@ static int TSProbe( probedata_t * p_data ) ...@@ -116,6 +112,12 @@ static int TSProbe( probedata_t * p_data )
return( 999 ); 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( ( strlen(psz_name) > 5 ) && !strncasecmp( psz_name, "file:", 5 ) )
{ {
/* If the user specified "file:" then it's probably a file */ /* If the user specified "file:" then it's probably a file */
...@@ -188,6 +190,30 @@ static void TSInit( input_thread_t * p_input ) ...@@ -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 * TSEnd: frees unused data
*****************************************************************************/ *****************************************************************************/
...@@ -231,7 +257,7 @@ static int TSRead( input_thread_t * p_input, ...@@ -231,7 +257,7 @@ static int TSRead( input_thread_t * p_input,
s_wait.tv_usec = 0; s_wait.tv_usec = 0;
/* Reset pointer table */ /* 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 */ /* Get iovecs */
p_iovec = input_NetlistGetiovec( p_input->p_method_data ); p_iovec = input_NetlistGetiovec( p_input->p_method_data );
...@@ -247,7 +273,7 @@ static int TSRead( input_thread_t * p_input, ...@@ -247,7 +273,7 @@ static int TSRead( input_thread_t * p_input,
if( i_data == -1 ) 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 ); return( -1 );
} }
...@@ -257,7 +283,7 @@ static int TSRead( input_thread_t * p_input, ...@@ -257,7 +283,7 @@ static int TSRead( input_thread_t * p_input,
if( i_read == -1 ) if( i_read == -1 )
{ {
intf_ErrMsg( "TS input : Could not readv" ); intf_ErrMsg( "input error: TS readv error" );
return( -1 ); return( -1 );
} }
...@@ -268,7 +294,9 @@ static int TSRead( input_thread_t * p_input, ...@@ -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++ ) for( i_loop=0; i_loop * TS_PACKET_SIZE < i_read; i_loop++ )
{ {
if( pp_packets[i_loop]->p_buffer[0] != 0x47 ) 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; return 0;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* intf_qt.cpp: Qt interface * intf_qt.cpp: Qt interface
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * 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> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -465,7 +465,7 @@ void IntfWindow::About( void ) ...@@ -465,7 +465,7 @@ void IntfWindow::About( void )
void IntfWindow::Manage( void ) void IntfWindow::Manage( void )
{ {
/* Manage the slider */ /* 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(); int i_value = p_slider->value();
......
...@@ -7,9 +7,13 @@ ...@@ -7,9 +7,13 @@
# Objects # Objects
# #
PLUGIN_C = ncurses.o vout_ncurses.o PLUGIN_NCURSES = ncurses.o intf_ncurses.o
BUILTIN_C = $(PLUGIN_C:%.o=BUILTIN_%.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) ALL_OBJ = $(PLUGIN_C) $(BUILTIN_C)
# #
...@@ -22,9 +26,15 @@ include ../../Makefile.modules ...@@ -22,9 +26,15 @@ include ../../Makefile.modules
# Real targets # Real targets
# #
../../lib/ncurses.so: $(PLUGIN_C) ../../lib/ncurses.so: $(PLUGIN_NCURSES)
$(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS) $(LIB_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 $@ $^ 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 @@ ...@@ -4,7 +4,7 @@
* decoders. * decoders.
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN * 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> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -508,7 +508,7 @@ void input_FileOpen( input_thread_t * p_input ) ...@@ -508,7 +508,7 @@ void input_FileOpen( input_thread_t * p_input )
p_input->stream.p_selected_area->i_tell = 0; p_input->stream.p_selected_area->i_tell = 0;
vlc_mutex_unlock( &p_input->stream.stream_lock ); 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, if( (p_input->i_handle = open( psz_name,
/*O_NONBLOCK | O_LARGEFILE*/0 )) == (-1) ) /*O_NONBLOCK | O_LARGEFILE*/0 )) == (-1) )
{ {
...@@ -524,7 +524,7 @@ void input_FileOpen( input_thread_t * p_input ) ...@@ -524,7 +524,7 @@ void input_FileOpen( input_thread_t * p_input )
*****************************************************************************/ *****************************************************************************/
void input_FileClose( 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 ); close( p_input->i_handle );
return; return;
...@@ -537,18 +537,68 @@ void input_FileClose( input_thread_t * p_input ) ...@@ -537,18 +537,68 @@ void input_FileClose( input_thread_t * p_input )
*****************************************************************************/ *****************************************************************************/
void input_NetworkOpen( input_thread_t * p_input ) void input_NetworkOpen( input_thread_t * p_input )
{ {
char *psz_server = NULL;
int i_option_value, i_port; int i_port = 0;
struct sockaddr_in s_socket;
int i_opt;
struct sockaddr_in sock;
boolean_t b_broadcast; boolean_t b_broadcast;
/* FIXME : we don't handle channels for the moment */
/* Get the remote server */ /* Get the remote server */
if( p_input->p_source == NULL ) if( p_input->p_source != NULL )
{
psz_server = p_input->p_source;
/* Skip the protocol name */
while( *psz_server && *psz_server != ':' )
{
psz_server++;
}
/* Skip the "://" part */
while( *psz_server && (*psz_server == ':' || *psz_server == '/') )
{
psz_server++;
}
/* Found a server name */
if( *psz_server )
{
char *psz_port = psz_server;
/* Skip the hostname part */
while( *psz_port && *psz_port != ':' )
{
psz_port++;
}
/* Found a port name */
if( *psz_port )
{
/* Replace ':' with '\0' */
*psz_port = '\0';
psz_port++;
i_port = atoi( psz_port );
}
}
else
{
psz_server = NULL;
}
}
/* Check that we got a valid server */
if( psz_server == NULL )
{
psz_server = main_GetPszVariable( INPUT_SERVER_VAR,
INPUT_SERVER_DEFAULT );
}
/* Check that we got a valid port */
if( i_port == 0 )
{ {
p_input->p_source = main_GetPszVariable( INPUT_SERVER_VAR, i_port = main_GetIntVariable( INPUT_PORT_VAR, INPUT_PORT_DEFAULT );
INPUT_SERVER_DEFAULT );
} }
/* Open a SOCK_DGRAM (UDP) socket, in the AF_INET domain, automatic (0) /* Open a SOCK_DGRAM (UDP) socket, in the AF_INET domain, automatic (0)
...@@ -556,17 +606,17 @@ void input_NetworkOpen( input_thread_t * p_input ) ...@@ -556,17 +606,17 @@ void input_NetworkOpen( input_thread_t * p_input )
p_input->i_handle = socket( AF_INET, SOCK_DGRAM, 0 ); p_input->i_handle = socket( AF_INET, SOCK_DGRAM, 0 );
if( p_input->i_handle == -1 ) if( p_input->i_handle == -1 )
{ {
intf_ErrMsg("NetworkOpen : can't create socket : %s", strerror(errno)); intf_ErrMsg("input error: can't create socket : %s", strerror(errno));
p_input->b_error = 1; p_input->b_error = 1;
return; return;
} }
/* We may want to reuse an already used socket */ /* We may want to reuse an already used socket */
i_option_value = 1; i_opt = 1;
if( setsockopt( p_input->i_handle, SOL_SOCKET, SO_REUSEADDR, if( setsockopt( p_input->i_handle, SOL_SOCKET, SO_REUSEADDR,
&i_option_value,sizeof( i_option_value ) ) == -1 ) &i_opt, sizeof( i_opt ) ) == -1 )
{ {
intf_ErrMsg("NetworkOpen : can't configure socket (SO_REUSEADDR: %s)", intf_ErrMsg("input error: can't configure socket (SO_REUSEADDR: %s)",
strerror(errno)); strerror(errno));
close( p_input->i_handle ); close( p_input->i_handle );
p_input->b_error = 1; p_input->b_error = 1;
...@@ -575,11 +625,11 @@ void input_NetworkOpen( input_thread_t * p_input ) ...@@ -575,11 +625,11 @@ void input_NetworkOpen( input_thread_t * p_input )
/* Increase the receive buffer size to 1/2MB (8Mb/s during 1/2s) to avoid /* Increase the receive buffer size to 1/2MB (8Mb/s during 1/2s) to avoid
* packet loss caused by scheduling problems */ * packet loss caused by scheduling problems */
i_option_value = 524288; i_opt = 0x80000;
if( setsockopt( p_input->i_handle, SOL_SOCKET, SO_RCVBUF, &i_option_value, if( setsockopt( p_input->i_handle, SOL_SOCKET, SO_RCVBUF,
sizeof( i_option_value ) ) == -1 ) &i_opt, sizeof( i_opt ) ) == -1 )
{ {
intf_ErrMsg("NetworkOpen : can't configure socket (SO_RCVBUF: %s)", intf_ErrMsg("input error: can't configure socket (SO_RCVBUF: %s)",
strerror(errno)); strerror(errno));
close( p_input->i_handle ); close( p_input->i_handle );
p_input->b_error = 1; p_input->b_error = 1;
...@@ -588,13 +638,11 @@ void input_NetworkOpen( input_thread_t * p_input ) ...@@ -588,13 +638,11 @@ void input_NetworkOpen( input_thread_t * p_input )
/* Get details about what we are supposed to do */ /* Get details about what we are supposed to do */
b_broadcast = (boolean_t)main_GetIntVariable( INPUT_BROADCAST_VAR, 0 ); b_broadcast = (boolean_t)main_GetIntVariable( INPUT_BROADCAST_VAR, 0 );
i_port = main_GetIntVariable( INPUT_PORT_VAR, INPUT_PORT_DEFAULT );
/* TODO : here deal with channel stufs */ /* TODO : here deal with channel stuff */
/* Build the local socket */ /* Build the local socket */
if ( network_BuildLocalAddr( &s_socket, i_port, b_broadcast ) if ( network_BuildLocalAddr( &sock, i_port, b_broadcast ) == -1 )
== -1 )
{ {
close( p_input->i_handle ); close( p_input->i_handle );
p_input->b_error = 1; p_input->b_error = 1;
...@@ -602,18 +650,17 @@ void input_NetworkOpen( input_thread_t * p_input ) ...@@ -602,18 +650,17 @@ void input_NetworkOpen( input_thread_t * p_input )
} }
/* Bind it */ /* Bind it */
if( bind( p_input->i_handle, (struct sockaddr *)&s_socket, if( bind( p_input->i_handle, (struct sockaddr *)&sock,
sizeof( s_socket ) ) < 0 ) sizeof( sock ) ) < 0 )
{ {
intf_ErrMsg("NetworkOpen: can't bind socket (%s)", strerror(errno)); intf_ErrMsg("input error: can't bind socket (%s)", strerror(errno));
close( p_input->i_handle ); close( p_input->i_handle );
p_input->b_error = 1; p_input->b_error = 1;
return; return;
} }
/* Build socket for remote connection */ /* Build socket for remote connection */
if ( network_BuildRemoteAddr( &s_socket, p_input->p_source ) if ( network_BuildRemoteAddr( &sock, psz_server ) == -1 )
== -1 )
{ {
close( p_input->i_handle ); close( p_input->i_handle );
p_input->b_error = 1; p_input->b_error = 1;
...@@ -621,10 +668,10 @@ void input_NetworkOpen( input_thread_t * p_input ) ...@@ -621,10 +668,10 @@ void input_NetworkOpen( input_thread_t * p_input )
} }
/* And connect it ... should we really connect ? */ /* And connect it ... should we really connect ? */
if( connect( p_input->i_handle, (struct sockaddr *) &s_socket, if( connect( p_input->i_handle, (struct sockaddr *) &sock,
sizeof( s_socket ) ) == (-1) ) sizeof( sock ) ) == (-1) )
{ {
intf_ErrMsg("NetworkOpen: can't connect socket" ); intf_ErrMsg("input error: can't connect socket" );
close( p_input->i_handle ); close( p_input->i_handle );
p_input->b_error = 1; p_input->b_error = 1;
return; return;
...@@ -633,6 +680,7 @@ void input_NetworkOpen( input_thread_t * p_input ) ...@@ -633,6 +680,7 @@ void input_NetworkOpen( input_thread_t * p_input )
/* We can't pace control, but FIXME : bug in meuuh's code to sync PCR /* We can't pace control, but FIXME : bug in meuuh's code to sync PCR
* with the server. */ * with the server. */
p_input->stream.b_pace_control = 1; p_input->stream.b_pace_control = 1;
p_input->stream.b_seekable = 0;
return; return;
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* input_ext-intf.c: services to the interface * input_ext-intf.c: services to the interface
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN * Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: input_ext-intf.c,v 1.20 2001/04/08 07:24:47 stef Exp $ * $Id: input_ext-intf.c,v 1.21 2001/04/27 16:08:26 sam Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -147,11 +147,11 @@ void input_Seek( input_thread_t * p_input, off_t i_position ) ...@@ -147,11 +147,11 @@ void input_Seek( input_thread_t * p_input, off_t i_position )
vlc_mutex_lock( &p_input->stream.stream_lock ); vlc_mutex_lock( &p_input->stream.stream_lock );
p_input->stream.p_selected_area->i_seek = i_position; p_input->stream.p_selected_area->i_seek = i_position;
intf_Msg( "input: seeking position %lld/%lld (%s/%s)", i_position, intf_WarnMsg( 1, "input: seeking position %lld/%lld (%s/%s)", i_position,
p_input->stream.p_selected_area->i_size, p_input->stream.p_selected_area->i_size,
input_OffsetToTime( p_input, psz_time1, i_position ), input_OffsetToTime( p_input, psz_time1, i_position ),
input_OffsetToTime( p_input, psz_time2, input_OffsetToTime( p_input, psz_time2,
p_input->stream.p_selected_area->i_size ) ); p_input->stream.p_selected_area->i_size ) );
vlc_cond_signal( &p_input->stream.stream_wait ); vlc_cond_signal( &p_input->stream.stream_wait );
vlc_mutex_unlock( &p_input->stream.stream_lock ); vlc_mutex_unlock( &p_input->stream.stream_lock );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* netutils.c: various network functions * netutils.c: various network functions
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN * Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: netutils.c,v 1.25 2001/04/17 20:43:41 marcari Exp $ * $Id: netutils.c,v 1.26 2001/04/27 16:08:26 sam Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* Benoit Steiner <benny@via.ecp.fr> * Benoit Steiner <benny@via.ecp.fr>
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
#include <sys/ioctl.h> /* ioctl() */ #include <sys/ioctl.h> /* ioctl() */
#endif #endif
#if defined (HAVE_NET_IF_H) #ifdef HAVE_NET_IF_H
#include <net/if.h> /* interface (arch-dependent) */ #include <net/if.h> /* interface (arch-dependent) */
#endif #endif
...@@ -180,12 +180,12 @@ int network_ChannelCreate( void ) ...@@ -180,12 +180,12 @@ int network_ChannelCreate( void )
{ {
/* Even when BSD are supported, BeOS is not likely to be supported, so /* Even when BSD are supported, BeOS is not likely to be supported, so
* I prefer to put it apart */ * I prefer to put it apart */
#ifdef SYS_BEOS #if defined( SYS_BEOS )
intf_ErrMsg( "error: channel changing is not yet supported under BeOS" ); intf_ErrMsg( "error: channel changing is not yet supported under BeOS" );
return( 1 ); return( 1 );
#else
#elif defined( SYS_LINUX )
/* FIXME : channels handling only work for linux */ /* FIXME : channels handling only work for linux */
#ifdef SYS_LINUX
/* Allocate structure */ /* Allocate structure */
p_main->p_channel = malloc( sizeof( input_channel_t ) ); p_main->p_channel = malloc( sizeof( input_channel_t ) );
if( p_main->p_channel == NULL ) if( p_main->p_channel == NULL )
...@@ -200,11 +200,12 @@ int network_ChannelCreate( void ) ...@@ -200,11 +200,12 @@ int network_ChannelCreate( void )
intf_Msg("Channels initialized\n"); intf_Msg("Channels initialized\n");
return( 0 ); return( 0 );
#else #else
intf_ErrMsg( "error : channel changing only works with linux yest" ); intf_ErrMsg( "error : channel changing only works with linux yest" );
return( 1 ); return( 1 );
#endif /* SYS_LINUX */
#endif /* SYS_BEOS */ #endif
} }
/***************************************************************************** /*****************************************************************************
...@@ -221,11 +222,11 @@ int network_ChannelCreate( void ) ...@@ -221,11 +222,11 @@ int network_ChannelCreate( void )
int network_ChannelJoin( int i_channel_id ) int network_ChannelJoin( int i_channel_id )
{ {
/* I still prefer to put BeOS a bit apart */ /* I still prefer to put BeOS a bit apart */
#ifdef SYS_BEOS #if defined( SYS_BEOS )
intf_ErrMsg( "Channels are not yet supported under BeOS" ); intf_ErrMsg( "Channels are not yet supported under BeOS" );
return( -1 ); return( -1 );
#else
#ifdef SYS_LINUX #elif defined( SYS_LINUX )
int i_socket_cl; int i_socket_cl;
int i_fromlen; int i_fromlen;
struct ifreq s_interface; struct ifreq s_interface;
...@@ -392,9 +393,11 @@ int network_ChannelJoin( int i_channel_id ) ...@@ -392,9 +393,11 @@ int network_ChannelJoin( int i_channel_id )
close( i_socket_cl ); close( i_socket_cl );
return( 0 ); return( 0 );
#else /* SYS_LINUX */
intf_ErrMsg( "Channel only work under linux yet" );
#endif /* SYS_LINUX */
#endif /* SYS_BEOS */ #else
intf_ErrMsg( "Channels only work under linux yet" );
return( -1 );
#endif
} }
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