Commit abe5a7d0 authored by Sam Hocevar's avatar Sam Hocevar

  * Speed optimization in the handling of the unusual ephemer DVD subtitles.
  * Little optimization to bozo's UnalignedShowBits fix.
  * Race fix in the packet cache by Jon Lech Johansen <jon-vl@nanocrew.net>.
parent 37ee07f3
...@@ -112,6 +112,10 @@ E: bbp@via.ecp.fr ...@@ -112,6 +112,10 @@ E: bbp@via.ecp.fr
C: bbp C: bbp
D: Bug fixes D: Bug fixes
N: Jon Lech Johansen
E: jon-vl@nanocrew.net
D: PS input fixes
N: Michel Kaempf N: Michel Kaempf
E: maxx@via.ecp.fr E: maxx@via.ecp.fr
C: maxx C: maxx
......
...@@ -3,6 +3,24 @@ ...@@ -3,6 +3,24 @@
#===================# #===================#
HEAD HEAD
* Speed optimization in the handling of the unusual ephemer DVD subtitles.
* Little optimization to bozo's UnalignedShowBits fix.
* Race fix in the packet cache by Jon Lech Johansen <jon-vl@nanocrew.net>.
* Fixed a bug in UnalignedShowBits that makes some unaligned streams
not wotk correctly (for instance VLS' generated TS streams)
* Added support for some terribly braindead DVD subtitles in Kenshin
which do not have a "stop display" command. Anime fans rejoice!
* Fixed the BeOS interface to use p_aout_bank instead of p_main->p_aout.
* Coding-style butchery (mostly tabs).
* Changed the level arg in intf_WarnMsg so that it makes more sense.
* Beginning of the backport of Gnome to Gtk.
* Improved ac3 spdif output ( and made it work again :)).
* Added p_input->stream.p_selected_area->i_tell in input TS so that the
slider work with Transport Stream files.
* Moved b_fullscreen from p_vout->p_sys to p_vout and unified way of
toggling fullscreen.
* Tuned the Gnome interface appearance, added a Preferences window and
a Jump window, added Oct's playlist.
* Fixed a few warnings with gcc 3.0. * Fixed a few warnings with gcc 3.0.
* aout and vout are now allocated in banks, making it possible to have * aout and vout are now allocated in banks, making it possible to have
several of them at the same time. several of them at the same time.
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* input_ps.c: PS demux and packet management * input_ps.c: PS demux and packet management
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN * Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: input_ps.c,v 1.22 2001/05/07 04:42:42 sam Exp $ * $Id: input_ps.c,v 1.23 2001/05/08 00:43:57 sam Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* Cyril Deguet <asmax@via.ecp.fr> * Cyril Deguet <asmax@via.ecp.fr>
...@@ -166,6 +166,9 @@ static void PSInit( input_thread_t * p_input ) ...@@ -166,6 +166,9 @@ static void PSInit( input_thread_t * p_input )
return; return;
} }
p_input->p_method_data = (void *)p_packet_cache; p_input->p_method_data = (void *)p_packet_cache;
/* Initialize packet cache mutex */
vlc_mutex_init( &p_packet_cache->lock );
/* allocates the data cache */ /* allocates the data cache */
p_packet_cache->data.p_stack = malloc( DATA_CACHE_SIZE * p_packet_cache->data.p_stack = malloc( DATA_CACHE_SIZE *
...@@ -362,6 +365,7 @@ static void PSInit( input_thread_t * p_input ) ...@@ -362,6 +365,7 @@ static void PSInit( input_thread_t * p_input )
*****************************************************************************/ *****************************************************************************/
static void PSEnd( input_thread_t * p_input ) static void PSEnd( input_thread_t * p_input )
{ {
vlc_mutex_destroy( &((packet_cache_t *)p_input->p_plugin_data)->lock );
free( p_input->p_plugin_data ); free( p_input->p_plugin_data );
} }
...@@ -571,6 +575,8 @@ static struct data_packet_s * NewPacket( void * p_packet_cache, ...@@ -571,6 +575,8 @@ static struct data_packet_s * NewPacket( void * p_packet_cache,
return NULL; return NULL;
} }
vlc_mutex_lock( &p_cache->lock );
/* Checks whether the data cache is empty */ /* Checks whether the data cache is empty */
if( p_cache->data.l_index == 0 ) if( p_cache->data.l_index == 0 )
{ {
...@@ -578,6 +584,7 @@ static struct data_packet_s * NewPacket( void * p_packet_cache, ...@@ -578,6 +584,7 @@ static struct data_packet_s * NewPacket( void * p_packet_cache,
if ( (p_data = malloc( sizeof(data_packet_t) )) == NULL ) if ( (p_data = malloc( sizeof(data_packet_t) )) == NULL )
{ {
intf_ErrMsg( "Out of memory" ); intf_ErrMsg( "Out of memory" );
vlc_mutex_unlock( &p_cache->lock );
return NULL; return NULL;
} }
#ifdef TRACE_INPUT #ifdef TRACE_INPUT
...@@ -591,6 +598,7 @@ static struct data_packet_s * NewPacket( void * p_packet_cache, ...@@ -591,6 +598,7 @@ static struct data_packet_s * NewPacket( void * p_packet_cache,
== NULL ) == NULL )
{ {
intf_ErrMsg( "NULL packet in the data cache" ); intf_ErrMsg( "NULL packet in the data cache" );
vlc_mutex_unlock( &p_cache->lock );
return NULL; return NULL;
} }
} }
...@@ -607,6 +615,7 @@ static struct data_packet_s * NewPacket( void * p_packet_cache, ...@@ -607,6 +615,7 @@ static struct data_packet_s * NewPacket( void * p_packet_cache,
{ {
intf_DbgMsg( "Out of memory" ); intf_DbgMsg( "Out of memory" );
free( p_data ); free( p_data );
vlc_mutex_unlock( &p_cache->lock );
return NULL; return NULL;
} }
#ifdef TRACE_INPUT #ifdef TRACE_INPUT
...@@ -623,6 +632,7 @@ static struct data_packet_s * NewPacket( void * p_packet_cache, ...@@ -623,6 +632,7 @@ static struct data_packet_s * NewPacket( void * p_packet_cache,
{ {
intf_ErrMsg( "NULL packet in the small buffer cache" ); intf_ErrMsg( "NULL packet in the small buffer cache" );
free( p_data ); free( p_data );
vlc_mutex_unlock( &p_cache->lock );
return NULL; return NULL;
} }
/* Reallocates the packet if it is too small or too large */ /* Reallocates the packet if it is too small or too large */
...@@ -650,6 +660,7 @@ static struct data_packet_s * NewPacket( void * p_packet_cache, ...@@ -650,6 +660,7 @@ static struct data_packet_s * NewPacket( void * p_packet_cache,
{ {
intf_ErrMsg( "Out of memory" ); intf_ErrMsg( "Out of memory" );
free( p_data ); free( p_data );
vlc_mutex_unlock( &p_cache->lock );
return NULL; return NULL;
} }
#ifdef TRACE_INPUT #ifdef TRACE_INPUT
...@@ -666,6 +677,7 @@ static struct data_packet_s * NewPacket( void * p_packet_cache, ...@@ -666,6 +677,7 @@ static struct data_packet_s * NewPacket( void * p_packet_cache,
{ {
intf_ErrMsg( "NULL packet in the small buffer cache" ); intf_ErrMsg( "NULL packet in the small buffer cache" );
free( p_data ); free( p_data );
vlc_mutex_unlock( &p_cache->lock );
return NULL; return NULL;
} }
/* Reallocates the packet if it is too small or too large */ /* Reallocates the packet if it is too small or too large */
...@@ -682,6 +694,8 @@ static struct data_packet_s * NewPacket( void * p_packet_cache, ...@@ -682,6 +694,8 @@ static struct data_packet_s * NewPacket( void * p_packet_cache,
} }
} }
vlc_mutex_unlock( &p_cache->lock );
/* Initialize data */ /* Initialize data */
p_data->p_next = NULL; p_data->p_next = NULL;
p_data->b_discard_payload = 0; p_data->b_discard_payload = 0;
...@@ -711,6 +725,8 @@ static pes_packet_t * NewPES( void * p_packet_cache ) ...@@ -711,6 +725,8 @@ static pes_packet_t * NewPES( void * p_packet_cache )
} }
#endif #endif
vlc_mutex_lock( &p_cache->lock );
/* Checks whether the PES cache is empty */ /* Checks whether the PES cache is empty */
if( p_cache->pes.l_index == 0 ) if( p_cache->pes.l_index == 0 )
{ {
...@@ -718,6 +734,7 @@ static pes_packet_t * NewPES( void * p_packet_cache ) ...@@ -718,6 +734,7 @@ static pes_packet_t * NewPES( void * p_packet_cache )
if ( (p_pes = malloc( sizeof(pes_packet_t) )) == NULL ) if ( (p_pes = malloc( sizeof(pes_packet_t) )) == NULL )
{ {
intf_DbgMsg( "Out of memory" ); intf_DbgMsg( "Out of memory" );
vlc_mutex_unlock( &p_cache->lock );
return NULL; return NULL;
} }
#ifdef TRACE_INPUT #ifdef TRACE_INPUT
...@@ -731,10 +748,13 @@ static pes_packet_t * NewPES( void * p_packet_cache ) ...@@ -731,10 +748,13 @@ static pes_packet_t * NewPES( void * p_packet_cache )
== NULL ) == NULL )
{ {
intf_ErrMsg( "NULL packet in the data cache" ); intf_ErrMsg( "NULL packet in the data cache" );
vlc_mutex_unlock( &p_cache->lock );
return NULL; return NULL;
} }
} }
vlc_mutex_unlock( &p_cache->lock );
p_pes->b_data_alignment = p_pes->b_discontinuity = p_pes->b_data_alignment = p_pes->b_discontinuity =
p_pes->i_pts = p_pes->i_dts = 0; p_pes->i_pts = p_pes->i_dts = 0;
p_pes->i_pes_size = 0; p_pes->i_pes_size = 0;
...@@ -764,6 +784,8 @@ static void DeletePacket( void * p_packet_cache, ...@@ -764,6 +784,8 @@ static void DeletePacket( void * p_packet_cache,
ASSERT( p_data ); ASSERT( p_data );
vlc_mutex_lock( &p_cache->lock );
/* Checks whether the data cache is full */ /* Checks whether the data cache is full */
if ( p_cache->data.l_index < DATA_CACHE_SIZE ) if ( p_cache->data.l_index < DATA_CACHE_SIZE )
{ {
...@@ -819,6 +841,7 @@ static void DeletePacket( void * p_packet_cache, ...@@ -819,6 +841,7 @@ static void DeletePacket( void * p_packet_cache,
#endif #endif
} }
vlc_mutex_unlock( &p_cache->lock );
} }
/***************************************************************************** /*****************************************************************************
...@@ -851,6 +874,8 @@ static void DeletePES( void * p_packet_cache, pes_packet_t * p_pes ) ...@@ -851,6 +874,8 @@ static void DeletePES( void * p_packet_cache, pes_packet_t * p_pes )
p_data = p_next; p_data = p_next;
} }
vlc_mutex_lock( &p_cache->lock );
/* Checks whether the PES cache is full */ /* Checks whether the PES cache is full */
if ( p_cache->pes.l_index < PES_CACHE_SIZE ) if ( p_cache->pes.l_index < PES_CACHE_SIZE )
{ {
...@@ -865,5 +890,7 @@ static void DeletePES( void * p_packet_cache, pes_packet_t * p_pes ) ...@@ -865,5 +890,7 @@ static void DeletePES( void * p_packet_cache, pes_packet_t * p_pes )
intf_DbgMsg( "PS input: PES packet freed" ); intf_DbgMsg( "PS input: PES packet freed" );
#endif #endif
} }
vlc_mutex_unlock( &p_cache->lock );
} }
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* input_ps.h: thread structure of the PS plugin * input_ps.h: thread structure of the PS plugin
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: input_ps.h,v 1.5 2001/04/16 12:34:28 asmax Exp $ * $Id: input_ps.h,v 1.6 2001/05/08 00:43:57 sam Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* Cyril Deguet <asmax@via.ecp.fr> * Cyril Deguet <asmax@via.ecp.fr>
...@@ -75,6 +75,7 @@ typedef struct ...@@ -75,6 +75,7 @@ typedef struct
typedef struct typedef struct
{ {
vlc_mutex_t lock;
data_packet_cache_t data; data_packet_cache_t data;
pes_packet_cache_t pes; pes_packet_cache_t pes;
small_buffer_cache_t small; small_buffer_cache_t small;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* input_ext-dec.c: services to the decoders * input_ext-dec.c: services to the decoders
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN * Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: input_ext-dec.c,v 1.15 2001/05/07 13:52:39 bozo Exp $ * $Id: input_ext-dec.c,v 1.16 2001/05/08 00:43:57 sam Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -181,20 +181,19 @@ u32 UnalignedShowBits( bit_stream_t * p_bit_stream, unsigned int i_bits ) ...@@ -181,20 +181,19 @@ u32 UnalignedShowBits( bit_stream_t * p_bit_stream, unsigned int i_bits )
* of the packet in a temporary buffer, and we'll see * of the packet in a temporary buffer, and we'll see
* later. */ * later. */
int i; int i;
/* number of bytes to trash from the last payload */
/* sizeof(WORD_TYPE) - number of bytes to trash
* from the last payload */
int j; int j;
p_bit_stream->i_showbits_buffer = 0; p_bit_stream->i_showbits_buffer = 0;
/* is this initialization really usefull ? -- bozo */ for( j = i = 0 ; i < sizeof(WORD_TYPE) ; i++ )
j = sizeof(WORD_TYPE);
for( i = 0; i < sizeof(WORD_TYPE) ; i++ )
{ {
if( p_bit_stream->p_byte >= p_bit_stream->p_end ) if( p_bit_stream->p_byte >= p_bit_stream->p_end )
{ {
j = i;
p_bit_stream->pf_next_data_packet( p_bit_stream ); p_bit_stream->pf_next_data_packet( p_bit_stream );
j = sizeof(WORD_TYPE) - i;
} }
((byte_t *)&p_bit_stream->i_showbits_buffer)[i] = ((byte_t *)&p_bit_stream->i_showbits_buffer)[i] =
* p_bit_stream->p_byte; * p_bit_stream->p_byte;
...@@ -202,7 +201,8 @@ u32 UnalignedShowBits( bit_stream_t * p_bit_stream, unsigned int i_bits ) ...@@ -202,7 +201,8 @@ u32 UnalignedShowBits( bit_stream_t * p_bit_stream, unsigned int i_bits )
} }
/* This is kind of kludgy. */ /* This is kind of kludgy. */
p_bit_stream->p_data->p_payload_start += j; p_bit_stream->p_data->p_payload_start +=
sizeof(WORD_TYPE) - j;
p_bit_stream->p_byte = p_bit_stream->p_byte =
(byte_t *)&p_bit_stream->i_showbits_buffer; (byte_t *)&p_bit_stream->i_showbits_buffer;
p_bit_stream->p_end = p_bit_stream->p_end =
......
This diff is collapsed.
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