* -dvd_udf to find files
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
- * $Id: input_dvd.c,v 1.65 2001/05/31 03:57:54 sam Exp $
+ * $Id: input_dvd.c,v 1.66 2001/05/31 16:10:05 stef Exp $
*
* Author: Stéphane Borel <stef@via.ecp.fr>
*
#include "modules.h"
+/* how many blocks DVDRead will read in each loop */
+#define DVD_BLOCK_READ_ONCE 32
+#define DVD_DATA_READ_ONCE 4*DVD_BLOCK_READ_ONCE
+
+/* Size of netlist */
+#define DVD_NETLIST_SIZE 2048
+
/*****************************************************************************
* Local prototypes
*****************************************************************************/
p_dvd->i_fd = p_input->i_handle;
- /* reading several block once seems to cause lock-up
- * when using input_ToggleES
- * who wrote thez damn buggy piece of shit ??? --stef */
- p_dvd->i_block_once = 32;
- p_input->i_read_once = 128;
+ /* We read DVD_BLOCK_READ_ONCE in each loop, so the input will receive
+ * DVD_DATA_READ_ONCE at most */
+ p_dvd->i_block_once = DVD_BLOCK_READ_ONCE;
+ /* this value mustn't be modifed */
+ p_input->i_read_once = DVD_DATA_READ_ONCE;
i = CSSTest( p_input->i_handle );
/* Reading structures initialisation */
p_input->p_method_data =
- DVDNetlistInit( 2048, 4096, 2048, DVD_LB_SIZE, p_dvd->i_block_once );
+ DVDNetlistInit( DVD_NETLIST_SIZE, 2*DVD_NETLIST_SIZE,
+ DVD_NETLIST_SIZE, DVD_LB_SIZE, p_dvd->i_block_once );
intf_WarnMsg( 2, "dvd info: netlist initialized" );
/* Ifo allocation & initialisation */
thread_dvd_data_t * p_dvd;
dvd_netlist_t * p_netlist;
struct iovec * p_vec;
- struct data_packet_s ** pp_data;
+ struct data_packet_s * pp_data[DVD_DATA_READ_ONCE];
u8 * pi_cur;
int i_block_once;
int i_packet_size;
boolean_t b_eof;
boolean_t b_eot;
- pp_data = (struct data_packet_s **) malloc( p_input->i_read_once *
- sizeof( struct data_packet_s * ) );
- if( pp_data == NULL )
- {
- intf_ErrMsg( "dvd error: out of memory" );
- return -1;
- }
-
- pp_data = (struct data_packet_s **) malloc( p_input->i_read_once *
- sizeof( struct data_packet_s * ) );
- if( pp_data == NULL )
- {
- intf_ErrMsg( "dvd error: out of memory" );
- return -1;
- }
-
p_dvd = (thread_dvd_data_t *)p_input->p_plugin_data;
p_netlist = (dvd_netlist_t *)p_input->p_method_data;
if( ( p_vec = DVDGetiovec( p_netlist ) ) == NULL )
{
intf_ErrMsg( "dvd error: can't get iovec" );
- free( pp_data );
return -1;
}
{
pp_packets[0] = NULL;
intf_ErrMsg( "dvd error: can't find next cell" );
- free( pp_data );
return 1;
}
else
{
intf_ErrMsg( "Unable to determine stream type" );
- free( pp_data );
return( -1 );
}
vlc_mutex_unlock( &p_input->stream.stream_lock );
- free( pp_data );
-
- free( pp_data );
-
if( b_eof )
{
return 1;