* input_ts.c: TS demux and netlist management
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
- * $Id: input_ts.c,v 1.39 2001/11/28 15:08:05 massiot Exp $
+ * $Id: input_ts.c,v 1.40 2001/12/03 17:34:08 stef Exp $
*
* Authors: Henri Fallon <henri@videolan.org>
*
if( p_pat_es != NULL )
input_DelES( p_input, p_pat_es );
+
free(p_input->p_plugin_data);
+ input_NetlistEnd( p_input );
}
/*****************************************************************************
if( (i_read == -1) && ( (errno == EAGAIN) || (errno = EWOULDBLOCK) ) )
{
/* just ignore that error */
+ intf_ErrMsg( "input error: 0 bytes read" );
i_read = 0;
}
#endif
intf_ErrMsg( "input error: TS readv error" );
return( -1 );
}
-
+
+ /* EOF */
+ if( i_read == 0 && p_input->stream.b_seekable )
+ {
+ return( 1 );
+ }
+
input_NetlistMviovec( p_input->p_method_data,
- (int)(i_read/TS_PACKET_SIZE) , pp_packets );
+ (int)(((i_read-1)/TS_PACKET_SIZE)+1) , pp_packets );
/* check correct TS header */
for( i_loop=0; i_loop * TS_PACKET_SIZE < i_read; i_loop++ )
"0x%.2x, should be 0x47)",
pp_packets[i_loop]->p_buffer[0] );
}
+ for( ; i_loop < INPUT_READ_ONCE ; i_loop++ )
+ {
+ pp_packets[i_loop] = NULL;
+ }
p_input->stream.p_selected_area->i_tell += i_read;
}
* will only be given back to netlist when refcount is zero.
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
- * $Id: input_netlist.c,v 1.46 2001/12/02 17:32:19 stef Exp $
+ * $Id: input_netlist.c,v 1.47 2001/12/03 17:34:08 stef Exp $
*
* Authors: Henri Fallon <henri@videolan.org>
* Stéphane Borel <stef@videolan.org>
(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" );
+ intf_WarnMsg( 4, "input info: waiting for free iovec" );
msleep( INPUT_IDLE_SLEEP );
while( (
msleep( INPUT_IDLE_SLEEP );
}
- intf_WarnMsg( 12, "input info: found free iovec" );
+ intf_WarnMsg( 4, "input info: found free iovec" );
}
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" );
+ intf_WarnMsg( 4, "input info: waiting for free data packet" );
msleep( INPUT_IDLE_SLEEP );
while( (
msleep( INPUT_IDLE_SLEEP );
}
- intf_WarnMsg( 12, "input info: found free data packet" );
+ intf_WarnMsg( 4, "input info: found free data packet" );
}
/* readv only takes contiguous buffers
pp_data[i_loop]->pi_refcount = p_netlist->pi_refcount +
p_netlist->i_iovec_start;
- //(*pp_data[i_loop]->pi_refcount)++;
+ if( (*pp_data[i_loop]->pi_refcount) != 0)
+ {
+ intf_ErrMsg( "netlist error: refcount should be 0 (%d)",
+ (*pp_data[i_loop]->pi_refcount) );
+ }
(*pp_data[i_loop]->pi_refcount) = 1;
p_netlist->i_iovec_start ++;
p_packet->b_discard_payload = 0;
p_packet->pi_refcount = p_netlist->pi_refcount + p_netlist->i_iovec_start;
- //(*p_packet->pi_refcount)++;
+ if( (*p_packet->pi_refcount) != 0)
+ {
+ intf_ErrMsg( "netlist error: refcount should be 0 (%d)",
+ (*p_packet->pi_refcount) );
+ }
(*p_packet->pi_refcount) = 1;
p_netlist->i_iovec_start ++;
/* Update reference counter */
(*p_data->pi_refcount)--;
- if( (*p_data->pi_refcount) <= 0 )
+ if( (*p_data->pi_refcount) == 0 )
{
(*p_data->pi_refcount) = 0;
p_netlist->i_iovec_end++;
p_netlist->p_free_iovec[p_netlist->i_iovec_end].iov_base =
p_data->p_buffer;
}
+ else if( (*p_data->pi_refcount) < 0 )
+ {
+ intf_ErrMsg( "netlist error: refcount can't be negative (%d)",
+ (*p_data->pi_refcount) );
+ }
/* unlock */
vlc_mutex_unlock (&p_netlist->lock);
/* Update reference counter */
(*p_current_packet->pi_refcount)--;
- if( (*p_current_packet->pi_refcount) <= 0 )
+ if( (*p_current_packet->pi_refcount) == 0 )
{
(*p_current_packet->pi_refcount) = 0;
p_netlist->i_iovec_end++;
p_netlist->p_free_iovec[p_netlist->i_iovec_end].iov_base =
p_current_packet->p_buffer;
}
+ else if( (*p_current_packet->pi_refcount) < 0 )
+ {
+ intf_ErrMsg( "netlist error: refcount can't be negative (%d)",
+ (*p_current_packet->pi_refcount) );
+ }
p_next_packet = p_current_packet->p_next;
p_current_packet->p_next = NULL;