diff --git a/ChangeLog b/ChangeLog index bf8fced02b34064ebeb90715250e58b1dc94f74e..8e2ec003365543cf106c6a02aa479906530bf41e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,9 @@ 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. * Fully working Windows DVD ioctl support by Jon Lech Johansen. * DirectX enhancements by Gildas Bazin, such as software rendering. diff --git a/plugins/dvd/dvd_netlist.c b/plugins/dvd/dvd_netlist.c index 92ad6fa80de0cb378a1dfede9ae84a86ffae4d27..2e4a0d0a09bc4ec898e76f140683691aa590aef1 100644 --- a/plugins/dvd/dvd_netlist.c +++ b/plugins/dvd/dvd_netlist.c @@ -7,7 +7,7 @@ * will only be given back to netlist when refcount is zero. ***************************************************************************** * 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> * St�phane Borel <stef@videolan.org> @@ -250,21 +250,40 @@ struct iovec * DVDGetiovec( void * p_method_data ) p_netlist = (dvd_netlist_t *)p_method_data; /* check that we have enough free iovec */ - while( ( + if( ( (p_netlist->i_iovec_end - p_netlist->i_iovec_start) & p_netlist->i_nb_iovec ) < p_netlist->i_read_once ) { intf_WarnMsg( 12, "input info: waiting for free iovec" ); 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_nb_data ) < p_netlist->i_read_once ) { intf_WarnMsg( 12, "input info: waiting for free data packet" ); 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 * 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 diff --git a/plugins/dvd/input_dvd.c b/plugins/dvd/input_dvd.c index 1a815f74cb1a83ce32cfa3d180b985189207786f..4abf7ddea8366ef58edf660bab642e5280d14caa 100644 --- a/plugins/dvd/input_dvd.c +++ b/plugins/dvd/input_dvd.c @@ -10,7 +10,7 @@ * -dvd_udf to find files ***************************************************************************** * 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: St�phane Borel <stef@via.ecp.fr> * @@ -157,7 +157,6 @@ static int DVDProbe( probedata_t *p_data ) input_thread_t * p_input = (input_thread_t *)p_data; char * psz_name = p_input->p_source; - dvdcss_handle dvdhandle; int i_score = 5; if( TestMethod( INPUT_METHOD_VAR, "dvd" ) ) @@ -180,12 +179,6 @@ static int DVDProbe( probedata_t *p_data ) psz_name += 4; } - dvdhandle = dvdcss_open( psz_name, DVDCSS_INIT_QUIET ); - if( dvdhandle == NULL ) - { - return( 0 ); - } - return( i_score ); } @@ -211,25 +204,7 @@ static void DVDInit( input_thread_t * p_input ) p_input->p_plugin_data = (void *)p_dvd; p_input->p_method_data = NULL; - /* XXX: put this shit in an access plugin */ - 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; - } + p_dvd->dvdhandle = (dvdcss_handle) p_input->i_handle; dvdcss_seek( p_dvd->dvdhandle, 0 ); @@ -335,6 +310,56 @@ static void DVDInit( input_thread_t * p_input ) 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 *****************************************************************************/ @@ -348,9 +373,6 @@ static void DVDEnd( input_thread_t * p_input ) IfoDestroy( p_dvd->p_ifo ); - /* Clean up libdvdcss */ - dvdcss_close( p_dvd->dvdhandle ); - free( p_dvd ); DVDNetlistEnd( p_netlist ); @@ -1057,16 +1079,6 @@ static void DVDSeek( input_thread_t * p_input, off_t i_off ) 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 /***************************************************************************** diff --git a/src/input/input.c b/src/input/input.c index c2a85c60971685fd3a3f033390e1ba1f75ba462f..c811f0a9b6d9de10031d1ce935c33edbf59b707a 100644 --- a/src/input/input.c +++ b/src/input/input.c @@ -4,7 +4,7 @@ * decoders. ***************************************************************************** * 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> * @@ -424,7 +424,6 @@ static int InitThread( input_thread_t * p_input ) if( p_input->b_error ) { /* We barfed -- exit nicely */ - p_input->pf_close( p_input ); module_Unneed( p_input->p_input_module ); return( -1 ); }