Commit 9bc943b9 authored by Sam Hocevar's avatar Sam Hocevar

  * Unrolled two loops in dvd_netlist.c to prevent flooding.
  * DVD input stuttering fix by Jon Lech Johansen.
parent 05761f84
...@@ -4,6 +4,9 @@ ...@@ -4,6 +4,9 @@
HEAD HEAD
* Unrolled two loops in dvd_netlist.c to prevent message flooding.
* DVD input stuttering fix by Jon Lech Johansen.
* Removed a lock that caused late frames in DVDRead.
* Added gprof profiling support with --enable-profiling. * Added gprof profiling support with --enable-profiling.
* Fully working Windows DVD ioctl support by Jon Lech Johansen. * Fully working Windows DVD ioctl support by Jon Lech Johansen.
* DirectX enhancements by Gildas Bazin, such as software rendering. * DirectX enhancements by Gildas Bazin, such as software rendering.
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* will only be given back to netlist when refcount is zero. * will only be given back to netlist when refcount is zero.
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000, 2001 VideoLAN * Copyright (C) 1998, 1999, 2000, 2001 VideoLAN
* $Id: dvd_netlist.c,v 1.10 2001/06/13 00:03:08 stef Exp $ * $Id: dvd_netlist.c,v 1.11 2001/06/15 05:12:30 sam Exp $
* *
* Authors: Henri Fallon <henri@videolan.org> * Authors: Henri Fallon <henri@videolan.org>
* Stphane Borel <stef@videolan.org> * Stphane Borel <stef@videolan.org>
...@@ -250,21 +250,40 @@ struct iovec * DVDGetiovec( void * p_method_data ) ...@@ -250,21 +250,40 @@ struct iovec * DVDGetiovec( void * p_method_data )
p_netlist = (dvd_netlist_t *)p_method_data; p_netlist = (dvd_netlist_t *)p_method_data;
/* check that we have enough free iovec */ /* check that we have enough free iovec */
while( ( if( (
(p_netlist->i_iovec_end - p_netlist->i_iovec_start) (p_netlist->i_iovec_end - p_netlist->i_iovec_start)
& p_netlist->i_nb_iovec ) < p_netlist->i_read_once ) & p_netlist->i_nb_iovec ) < p_netlist->i_read_once )
{ {
intf_WarnMsg( 12, "input info: waiting for free iovec" ); intf_WarnMsg( 12, "input info: waiting for free iovec" );
msleep( INPUT_IDLE_SLEEP ); msleep( INPUT_IDLE_SLEEP );
while( (
(p_netlist->i_iovec_end - p_netlist->i_iovec_start)
& p_netlist->i_nb_iovec ) < p_netlist->i_read_once )
{
msleep( INPUT_IDLE_SLEEP );
}
intf_WarnMsg( 12, "input info: found free iovec" );
} }
while( ( if( (
(p_netlist->i_data_end - p_netlist->i_data_start) (p_netlist->i_data_end - p_netlist->i_data_start)
& p_netlist->i_nb_data ) < p_netlist->i_read_once ) & p_netlist->i_nb_data ) < p_netlist->i_read_once )
{ {
intf_WarnMsg( 12, "input info: waiting for free data packet" ); intf_WarnMsg( 12, "input info: waiting for free data packet" );
msleep( INPUT_IDLE_SLEEP ); msleep( INPUT_IDLE_SLEEP );
while( (
(p_netlist->i_data_end - p_netlist->i_data_start)
& p_netlist->i_nb_data ) < p_netlist->i_read_once )
{
msleep( INPUT_IDLE_SLEEP );
}
intf_WarnMsg( 12, "input info: found free data packet" );
} }
/* readv only takes contiguous buffers /* readv only takes contiguous buffers
* so, as a solution, we chose to have a FIFO a bit longer * so, as a solution, we chose to have a FIFO a bit longer
* than i_nb_data, and copy the begining of the FIFO to its end * than i_nb_data, and copy the begining of the FIFO to its end
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* -dvd_udf to find files * -dvd_udf to find files
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * Copyright (C) 1998-2001 VideoLAN
* $Id: input_dvd.c,v 1.75 2001/06/15 01:22:58 stef Exp $ * $Id: input_dvd.c,v 1.76 2001/06/15 05:12:30 sam Exp $
* *
* Author: Stphane Borel <stef@via.ecp.fr> * Author: Stphane Borel <stef@via.ecp.fr>
* *
...@@ -157,7 +157,6 @@ static int DVDProbe( probedata_t *p_data ) ...@@ -157,7 +157,6 @@ static int DVDProbe( probedata_t *p_data )
input_thread_t * p_input = (input_thread_t *)p_data; input_thread_t * p_input = (input_thread_t *)p_data;
char * psz_name = p_input->p_source; char * psz_name = p_input->p_source;
dvdcss_handle dvdhandle;
int i_score = 5; int i_score = 5;
if( TestMethod( INPUT_METHOD_VAR, "dvd" ) ) if( TestMethod( INPUT_METHOD_VAR, "dvd" ) )
...@@ -180,12 +179,6 @@ static int DVDProbe( probedata_t *p_data ) ...@@ -180,12 +179,6 @@ static int DVDProbe( probedata_t *p_data )
psz_name += 4; psz_name += 4;
} }
dvdhandle = dvdcss_open( psz_name, DVDCSS_INIT_QUIET );
if( dvdhandle == NULL )
{
return( 0 );
}
return( i_score ); return( i_score );
} }
...@@ -211,25 +204,7 @@ static void DVDInit( input_thread_t * p_input ) ...@@ -211,25 +204,7 @@ static void DVDInit( input_thread_t * p_input )
p_input->p_plugin_data = (void *)p_dvd; p_input->p_plugin_data = (void *)p_dvd;
p_input->p_method_data = NULL; p_input->p_method_data = NULL;
/* XXX: put this shit in an access plugin */ p_dvd->dvdhandle = (dvdcss_handle) p_input->i_handle;
if( strlen( p_input->p_source ) > 4
&& !strncasecmp( p_input->p_source, "dvd:", 4 ) )
{
p_dvd->dvdhandle = dvdcss_open( p_input->p_source + 4,
DVDCSS_INIT_QUIET );
}
else
{
p_dvd->dvdhandle = dvdcss_open( p_input->p_source,
DVDCSS_INIT_QUIET );
}
if( p_dvd->dvdhandle == NULL )
{
free( p_dvd );
p_input->b_error = 1;
return;
}
dvdcss_seek( p_dvd->dvdhandle, 0 ); dvdcss_seek( p_dvd->dvdhandle, 0 );
...@@ -335,6 +310,56 @@ static void DVDInit( input_thread_t * p_input ) ...@@ -335,6 +310,56 @@ static void DVDInit( input_thread_t * p_input )
return; return;
} }
/*****************************************************************************
* DVDOpen: open dvd
*****************************************************************************/
static void DVDOpen( struct input_thread_s *p_input )
{
dvdcss_handle dvdhandle;
vlc_mutex_lock( &p_input->stream.stream_lock );
/* If we are here we can control the pace... */
p_input->stream.b_pace_control = 1;
p_input->stream.b_seekable = 1;
p_input->stream.p_selected_area->i_size = 0;
p_input->stream.p_selected_area->i_tell = 0;
vlc_mutex_unlock( &p_input->stream.stream_lock );
/* XXX: put this shit in an access plugin */
if( strlen( p_input->p_source ) > 4
&& !strncasecmp( p_input->p_source, "dvd:", 4 ) )
{
dvdhandle = dvdcss_open( p_input->p_source + 4,
DVDCSS_INIT_QUIET );
}
else
{
dvdhandle = dvdcss_open( p_input->p_source,
DVDCSS_INIT_QUIET );
}
if( dvdhandle == NULL )
{
p_input->b_error = 1;
return;
}
p_input->i_handle = (int) dvdhandle;
}
/*****************************************************************************
* DVDClose: close dvd
*****************************************************************************/
static void DVDClose( struct input_thread_s *p_input )
{
/* Clean up libdvdcss */
dvdcss_close( (dvdcss_handle) p_input->i_handle );
}
/***************************************************************************** /*****************************************************************************
* DVDEnd: frees unused data * DVDEnd: frees unused data
*****************************************************************************/ *****************************************************************************/
...@@ -348,9 +373,6 @@ static void DVDEnd( input_thread_t * p_input ) ...@@ -348,9 +373,6 @@ static void DVDEnd( input_thread_t * p_input )
IfoDestroy( p_dvd->p_ifo ); IfoDestroy( p_dvd->p_ifo );
/* Clean up libdvdcss */
dvdcss_close( p_dvd->dvdhandle );
free( p_dvd ); free( p_dvd );
DVDNetlistEnd( p_netlist ); DVDNetlistEnd( p_netlist );
...@@ -1057,16 +1079,6 @@ static void DVDSeek( input_thread_t * p_input, off_t i_off ) ...@@ -1057,16 +1079,6 @@ static void DVDSeek( input_thread_t * p_input, off_t i_off )
return; return;
} }
static void DVDOpen ( struct input_thread_s *p_input )
{
return;
}
static void DVDClose ( struct input_thread_s *p_input )
{
return;
}
#define cell p_dvd->p_ifo->vts.cell_inf #define cell p_dvd->p_ifo->vts.cell_inf
/***************************************************************************** /*****************************************************************************
......
...@@ -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.122 2001/06/14 02:47:45 sam Exp $ * $Id: input.c,v 1.123 2001/06/15 05:12:30 sam Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -424,7 +424,6 @@ static int InitThread( input_thread_t * p_input ) ...@@ -424,7 +424,6 @@ static int InitThread( input_thread_t * p_input )
if( p_input->b_error ) if( p_input->b_error )
{ {
/* We barfed -- exit nicely */ /* We barfed -- exit nicely */
p_input->pf_close( p_input );
module_Unneed( p_input->p_input_module ); module_Unneed( p_input->p_input_module );
return( -1 ); return( -1 );
} }
......
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