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

9 avril:

 - r�indentation de quelques bouts de code
 - les plugins vont �tre cherch�s en priorit� dans . puis ./plugins
  puis dans le r�pertoire habituel
 - d�but de communication entre le thread gnome et l'input
 - l'interface gnome ne segfaulte plus en sortant
 - le menu "Exit" fonctionne

10 avril:
 - fen�tre Gnome au lieu de fen�tre Gtk
  *** ATTENTION *** l'interface Gnome n'est vraiment qu'un d�but, soyez
   gentils de ne pas faire de bug report si un bouton ne fonctionne pas.
 - popup "About"

11 avril:
 - fen�tre playlist (rien dedans encore)
 - masquage du pointeur souris
 - popup menu dans la fen�tre vout
 - hide/show des fen�tres playlist
 - les boutons "Exit" fonctionnent quel que soit le menu

12 avril:
 - d�but du cassage des channels
 - d�but des menus g�n�r�s en runtime

13 avril:
 - ajout du target "snapshot" dans le makefile

14 avril:
 - d�codage de tous les sous-titres connus
 - spu_decoder.c ne segfaulte plus quand on quitte
 - rajout du flag b_active dans la structure audio_decoder
 - le bouton pause fonctionne
parent 3efee782
......@@ -356,6 +356,21 @@ show:
@echo "Command line for assembler objects:"
@echo $(CC) $(CFLAGS) -c -o "<dest.o>" "<src.S>"
# ugliest of all, but I have no time to do it -- sam
snapshot:
rm -rf /tmp/${SNAPSHOTDIR}
mkdir /tmp/${SNAPSHOTDIR}
cp -a * /tmp/${SNAPSHOTDIR}
(cd /tmp/${SNAPSHOTDIR} ; \
make distclean ; \
find . -type d -name CVS | xargs rm -rf ; \
find . -type f -name '.*.swp' | xargs rm -f ; \
cd .. ; \
tar czvf ${SNAPSHOTDIR}.tar.gz ${SNAPSHOTDIR} )
rm -rf /tmp/${SNAPSHOTDIR}
mv /tmp/${SNAPSHOTDIR}.tar.gz ..
@echo "Sources are in ../${SNAPSHOTDIR}.tar.gz"
FORCE:
#
......
......@@ -179,6 +179,7 @@ typedef struct aout_thread_s
{
vlc_thread_t thread_id;
boolean_t b_die;
boolean_t b_active;
vlc_mutex_t fifos_lock;
aout_fifo_t fifo[ AOUT_MAX_FIFOS ];
......
......@@ -47,6 +47,8 @@
#define COPYRIGHT_MESSAGE "VideoLAN Client - version @VLC_VERSION@" \
" @VLC_CODENAME@ - (c)1996-2000 VideoLAN"
#define VERSION "@VLC_VERSION@"
/*****************************************************************************
* General compilation options
*****************************************************************************/
......@@ -132,6 +134,9 @@
#define INTF_GAMMA_STEP .1
#define INTF_GAMMA_LIMIT 3
/* Maximum number of channels */
#define INTF_MAX_CHANNELS 10
/*
* X11 settings
*/
......
......@@ -63,6 +63,8 @@ typedef struct intf_thread_s
intf_sys_manage_t * p_sys_manage; /* main loop */
intf_sys_destroy_t * p_sys_destroy; /* destroy interface */
/* XXX: Channels array - new API */
//p_intf_channel_t * p_channel[INTF_MAX_CHANNELS];/* channel descriptions */
/* Channels array - NULL if not used */
p_intf_channel_t p_channel; /* description of channels */
......
......@@ -150,10 +150,11 @@ static __inline__ int vlc_thread_create( vlc_thread_t *p_thread,
{
#if defined(HAVE_CTHREADS_H)
*p_thread = cthread_fork( (cthread_fn_t)func, (any_t)p_data );
return( 0 );
return 0;
#elif defined(HAVE_KERNEL_SCHEDULER_H) && defined(HAVE_KERNEL_OS_H)
*p_thread = spawn_thread( (thread_func)func, psz_name, B_NORMAL_PRIORITY, p_data );
*p_thread = spawn_thread( (thread_func)func, psz_name,
B_NORMAL_PRIORITY, p_data );
return resume_thread( *p_thread );
#elif defined(HAVE_PTHREAD_H)
......@@ -209,7 +210,10 @@ static __inline__ void lazy_init_mutex(vlc_mutex_t* p_mutex)
}
else /* we're not the first, so wait until the init is finished */
{
while( p_mutex->init != 9999 ) snooze( 10000 );
while( p_mutex->init != 9999 )
{
snooze( 10000 );
}
}
}
#endif
......@@ -221,12 +225,15 @@ static __inline__ int vlc_mutex_init( vlc_mutex_t *p_mutex )
{
#if defined(HAVE_CTHREADS_H)
mutex_init( p_mutex );
return( 0 );
return 0;
#elif defined(HAVE_KERNEL_SCHEDULER_H) && defined(HAVE_KERNEL_OS_H)
// check the arguments and whether it's already been initialized
if( !p_mutex ) return B_BAD_VALUE;
if( p_mutex->init == 9999 ) return EALREADY;
if( !p_mutex )
return B_BAD_VALUE;
if( p_mutex->init == 9999 )
return EALREADY;
p_mutex->lock = create_sem( 1, "BeMutex" );
p_mutex->owner = -1;
......@@ -246,17 +253,23 @@ static __inline__ int vlc_mutex_lock( vlc_mutex_t *p_mutex )
{
#if defined(HAVE_CTHREADS_H)
mutex_lock( p_mutex );
return( 0 );
return 0;
#elif defined(HAVE_KERNEL_SCHEDULER_H) && defined(HAVE_KERNEL_OS_H)
status_t err;
if( !p_mutex ) return B_BAD_VALUE;
if( p_mutex->init < 2000 ) return B_NO_INIT;
if( !p_mutex )
return B_BAD_VALUE;
if( p_mutex->init < 2000 )
return B_NO_INIT;
lazy_init_mutex( p_mutex );
err = acquire_sem( p_mutex->lock );
if( !err ) p_mutex->owner = find_thread( NULL );
if( !err )
p_mutex->owner = find_thread( NULL );
return err;
#elif defined(HAVE_PTHREAD_H)
......@@ -272,14 +285,20 @@ static __inline__ int vlc_mutex_unlock( vlc_mutex_t *p_mutex )
{
#if defined(HAVE_CTHREADS_H)
mutex_unlock( p_mutex );
return( 0 );
return 0;
#elif defined(HAVE_KERNEL_SCHEDULER_H) && defined(HAVE_KERNEL_OS_H)
if(! p_mutex) return B_BAD_VALUE;
if( p_mutex->init < 2000 ) return B_NO_INIT;
if(! p_mutex)
return B_BAD_VALUE;
if( p_mutex->init < 2000 )
return B_NO_INIT;
lazy_init_mutex( p_mutex );
if( p_mutex->owner != find_thread(NULL) ) return ENOLCK;
if( p_mutex->owner != find_thread(NULL) )
return ENOLCK;
p_mutex->owner = -1;
release_sem( p_mutex->lock );
return B_OK;
......@@ -301,7 +320,10 @@ static __inline__ void lazy_init_cond( vlc_cond_t* p_condvar )
}
else /* we're not the first, so wait until the init is finished */
{
while( p_condvar->init != 9999 ) snooze( 10000 );
while( p_condvar->init != 9999 )
{
snooze( 10000 );
}
}
}
#endif
......@@ -318,11 +340,14 @@ static __inline__ int vlc_cond_init( vlc_cond_t *p_condvar )
p_condvar->name = 0;
p_condvar->implications = 0;
return( 0 );
return 0;
#elif defined(HAVE_KERNEL_SCHEDULER_H) && defined(HAVE_KERNEL_OS_H)
if( !p_condvar ) return B_BAD_VALUE;
if( p_condvar->init == 9999 ) return EALREADY;
if( !p_condvar )
return B_BAD_VALUE;
if( p_condvar->init == 9999 )
return EALREADY;
p_condvar->sem = create_sem( 0, "CVSem" );
p_condvar->handshakeSem = create_sem( 0, "CVHandshake" );
......@@ -348,24 +373,32 @@ static __inline__ int vlc_cond_signal( vlc_cond_t *p_condvar )
{
cond_signal( (condition_t)p_condvar );
}
return( 0 );
return 0;
#elif defined(HAVE_KERNEL_SCHEDULER_H) && defined(HAVE_KERNEL_OS_H)
status_t err = B_OK;
if( !p_condvar ) return B_BAD_VALUE;
if( p_condvar->init < 2000 ) return B_NO_INIT;
if( !p_condvar )
return B_BAD_VALUE;
if( p_condvar->init < 2000 )
return B_NO_INIT;
lazy_init_cond( p_condvar );
if( acquire_sem(p_condvar->signalSem) == B_INTERRUPTED) return B_INTERRUPTED;
if( acquire_sem(p_condvar->signalSem) == B_INTERRUPTED)
return B_INTERRUPTED;
if( p_condvar->nw > p_condvar->ns )
{
p_condvar->ns += 1;
release_sem( p_condvar->sem );
release_sem( p_condvar->signalSem );
while( acquire_sem(p_condvar->handshakeSem) == B_INTERRUPTED )
{ err = B_INTERRUPTED; }
{
err = B_INTERRUPTED;
}
}
else
{
......@@ -386,17 +419,25 @@ static __inline__ int vlc_cond_wait( vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex
{
#if defined(HAVE_CTHREADS_H)
condition_wait( (condition_t)p_condvar, (mutex_t)p_mutex );
return( 0 );
return 0;
#elif defined(HAVE_KERNEL_SCHEDULER_H) && defined(HAVE_KERNEL_OS_H)
status_t err;
if( !p_condvar ) return B_BAD_VALUE;
if( !p_mutex ) return B_BAD_VALUE;
if( p_condvar->init < 2000 ) return B_NO_INIT;
if( !p_condvar )
return B_BAD_VALUE;
if( !p_mutex )
return B_BAD_VALUE;
if( p_condvar->init < 2000 )
return B_NO_INIT;
lazy_init_cond( p_condvar );
if( acquire_sem(p_condvar->signalSem) == B_INTERRUPTED ) return B_INTERRUPTED;
if( acquire_sem(p_condvar->signalSem) == B_INTERRUPTED )
return B_INTERRUPTED;
p_condvar->nw += 1;
release_sem( p_condvar->signalSem );
......@@ -404,7 +445,10 @@ static __inline__ int vlc_cond_wait( vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex
err = acquire_sem( p_condvar->sem );
while( acquire_sem(p_condvar->signalSem) == B_INTERRUPTED)
{ err = B_INTERRUPTED; }
{
err = B_INTERRUPTED;
}
if( p_condvar->ns > 0 )
{
release_sem( p_condvar->handshakeSem );
......@@ -414,7 +458,9 @@ static __inline__ int vlc_cond_wait( vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex
release_sem( p_condvar->signalSem );
while( vlc_mutex_lock(p_mutex) == B_INTERRUPTED)
{ err = B_INTERRUPTED; }
{
err = B_INTERRUPTED;
}
return err;
#elif defined(HAVE_PTHREAD_H)
......
......@@ -152,8 +152,6 @@ typedef struct subpicture_s
struct
{
int i_offset[2]; /* byte offsets to data */
int i_x1, i_x2; /* X coordinates */
int i_y1, i_y2; /* Y coordinates */
} spu;
} type;
......
......@@ -246,19 +246,22 @@ static void RunThread (adec_thread_t * p_adec)
do
{
adec_byte_stream_next ( p_byte_stream );
} while ( (!p_adec->align) && (!p_adec->b_die) && (!p_adec->b_error) );
} while ( 0 && (!p_adec->align) && (!p_adec->b_die)
&& (!p_adec->b_error) );
sync = 1;
}
if( DECODER_FIFO_START( p_adec->fifo)->b_has_pts )
{
p_adec->p_aout_fifo->date[p_adec->p_aout_fifo->l_end_frame] = DECODER_FIFO_START( p_adec->fifo )->i_pts;
p_adec->p_aout_fifo->date[p_adec->p_aout_fifo->l_end_frame] =
DECODER_FIFO_START( p_adec->fifo )->i_pts;
DECODER_FIFO_START(p_adec->fifo)->b_has_pts = 0;
}
else
{
p_adec->p_aout_fifo->date[p_adec->p_aout_fifo->l_end_frame] = LAST_MDATE;
p_adec->p_aout_fifo->date[p_adec->p_aout_fifo->l_end_frame] =
LAST_MDATE;
}
if( adec_sync_frame (&p_adec->audio_decoder, &sync_info) )
......@@ -269,7 +272,8 @@ static void RunThread (adec_thread_t * p_adec)
p_adec->p_aout_fifo->l_rate = sync_info.sample_rate;
buffer = ((s16 *)p_adec->p_aout_fifo->buffer) + (p_adec->p_aout_fifo->l_end_frame * ADEC_FRAME_SIZE);
buffer = ((s16 *)p_adec->p_aout_fifo->buffer)
+ (p_adec->p_aout_fifo->l_end_frame * ADEC_FRAME_SIZE);
if( adec_decode_frame (&p_adec->audio_decoder, buffer) )
{
......@@ -279,7 +283,8 @@ static void RunThread (adec_thread_t * p_adec)
vlc_mutex_lock (&p_adec->p_aout_fifo->data_lock);
p_adec->p_aout_fifo->l_end_frame = (p_adec->p_aout_fifo->l_end_frame + 1) & AOUT_FIFO_SIZE;
p_adec->p_aout_fifo->l_end_frame =
(p_adec->p_aout_fifo->l_end_frame + 1) & AOUT_FIFO_SIZE;
vlc_cond_signal (&p_adec->p_aout_fifo->data_wait);
vlc_mutex_unlock (&p_adec->p_aout_fifo->data_lock);
......@@ -315,7 +320,8 @@ static void ErrorThread ( adec_thread_t *p_adec )
/* Trash all received PES packets */
while ( !DECODER_FIFO_ISEMPTY(p_adec->fifo) )
{
input_NetlistFreePES ( p_adec->p_input, DECODER_FIFO_START(p_adec->fifo) );
input_NetlistFreePES ( p_adec->p_input,
DECODER_FIFO_START(p_adec->fifo) );
DECODER_FIFO_INCSTART ( p_adec->fifo );
}
......@@ -398,7 +404,9 @@ void adec_byte_stream_next ( adec_byte_stream_t * p_byte_stream )
/* The next byte could be found in the next PES packet */
p_adec->p_ts = DECODER_FIFO_START (p_adec->fifo)->p_first_ts;
if (DECODER_FIFO_START (p_adec->fifo)->b_data_alignment)
{
p_adec->align = 1;
}
/* We can release the fifo's data lock */
vlc_mutex_unlock (&p_adec->fifo.data_lock);
......
......@@ -182,6 +182,7 @@ static int aout_SpawnThread( aout_thread_t * p_aout )
/* We want the audio output thread to live */
p_aout->b_die = 0;
p_aout->b_active = 1;
/* Initialize the fifos lock */
vlc_mutex_init( &p_aout->fifos_lock );
......
......@@ -419,9 +419,10 @@ static int LoadChannels( intf_thread_t *p_intf, char *psz_filename )
{
if( !ParseChannel( p_channel, psz_line ) )
{
intf_DbgMsg("channel [%d] %s : method %d (%s:%d vlan %d)\n",
intf_DbgMsg( "channel [%d] %s : method %d (%s:%d vlan %d)\n",
p_channel->i_channel, p_channel->psz_description,
p_channel->i_input_method, p_channel->psz_input_source,
p_channel->i_input_method,
p_channel->psz_input_source,
p_channel->i_input_port, p_channel->i_input_vlan );
p_channel++;
}
......
This diff is collapsed.
......@@ -45,8 +45,9 @@ int RequestPlugin ( plugin_id_t * p_plugin, char * psz_mask, char * psz_name )
char * psz_plugin;
char * psz_plugin_path[ PLUGIN_PATH_COUNT ] =
{
".", PLUGIN_PATH,
"plugins/aout", "plugins/vout", "plugins/intf" /* these ones should disappear */
".",
"plugins/aout", "plugins/vout", "plugins/intf", /* these ones should disappear */
PLUGIN_PATH
};
i_length = strlen( psz_mask ) + strlen( psz_name );
......
......@@ -214,7 +214,7 @@ static void RunThread( spudec_thread_t *p_spudec )
while( !DECODER_FIFO_ISEMPTY(p_spudec->fifo) )
{
/* wait for the next SPU ID.
* FIXME: We trash 0xff bytes since they come from
* XXX: We trash 0xff bytes since they come from
* an incomplete previous packet */
do
{
......@@ -222,6 +222,9 @@ static void RunThread( spudec_thread_t *p_spudec )
}
while( i_packet_size == 0xff );
if( p_spudec->b_die )
break;
/* the total size - should equal the sum of the
* PES packet size that form the SPU packet */
i_packet_size = ( i_packet_size << 8 )
......@@ -284,14 +287,22 @@ static void RunThread( spudec_thread_t *p_spudec )
case 0x00:
/* 00 (force displaying) */
break;
/* FIXME: here we have to calculate dates. It's
* around i_date * 1000000 / 83 but I don't know
* how much exactly. Here are my findings :
*
* - 80 is too small ( Lain Deus, VTS_01_2.VOB )
* -> 82 seems to be the minimum, 83 is fine.
*
*/
case 0x01:
/* 01 (start displaying) */
p_spu->begin_date += (i_date * 1000000 / 80);
break; /* FIXME: 80 is absolutely empiric */
p_spu->begin_date += ( i_date * 1000000 / 83 );
break;
case 0x02:
/* 02 (stop displaying) */
p_spu->end_date += (i_date * 1000000 / 80);
break; /* FIXME: 80 is absolutely empiric */
p_spu->end_date += ( i_date * 1000000 / 83 );
break;
case 0x03:
/* 03xxxx (palette) */
GetWord( i_word );
......@@ -303,20 +314,20 @@ static void RunThread( spudec_thread_t *p_spudec )
case 0x05:
/* 05xxxyyyxxxyyy (coordinates) */
i_word = GetByte( &p_spudec->bit_stream );
p_spu->type.spu.i_x1 = (i_word << 4)
p_spu->i_x = (i_word << 4)
| GetBits( &p_spudec->bit_stream, 4 );
i_word = GetBits( &p_spudec->bit_stream, 4 );
p_spu->type.spu.i_x2 = (i_word << 8)
| GetByte( &p_spudec->bit_stream );
p_spu->i_width = p_spu->i_x - ( (i_word << 8)
| GetByte( &p_spudec->bit_stream ) ) + 1;
i_word = GetByte( &p_spudec->bit_stream );
p_spu->type.spu.i_y1 = (i_word << 4)
p_spu->i_y = (i_word << 4)
| GetBits( &p_spudec->bit_stream, 4 );
i_word = GetBits( &p_spudec->bit_stream, 4 );
p_spu->type.spu.i_y2 = (i_word << 8)
| GetByte( &p_spudec->bit_stream );
p_spu->i_height = p_spu->i_y - ( (i_word << 8)
| GetByte( &p_spudec->bit_stream ) ) + 1;
i_index += 6;
break;
......@@ -345,6 +356,7 @@ static void RunThread( spudec_thread_t *p_spudec )
else
{
/* Unexpected PES packet - trash it */
intf_ErrMsg( "spudec: trying to recover from bad packet\n" );
vlc_mutex_lock( &p_spudec->fifo.data_lock );
input_NetlistFreePES( p_spudec->bit_stream.p_input,
DECODER_FIFO_START(p_spudec->fifo) );
......@@ -353,10 +365,6 @@ static void RunThread( spudec_thread_t *p_spudec )
}
}
/* Waiting for the input thread to put new PES packets in the fifo */
vlc_cond_wait( &p_spudec->fifo.data_wait, &p_spudec->fifo.data_lock );
if( p_spu ) vout_DestroySubPicture( p_spudec->p_vout, p_spu );
}
/*
......@@ -416,3 +424,4 @@ static void EndThread( spudec_thread_t *p_spudec )
free( p_spudec );
intf_DbgMsg( "spudec debug: spu decoder thread %p destroyed\n", p_spudec);
}
......@@ -115,12 +115,18 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_window,
}
/* Get plugins */
p_vout->p_sys_create = GetPluginFunction( p_vout->vout_plugin, "vout_SysCreate" );
p_vout->p_sys_init = GetPluginFunction( p_vout->vout_plugin, "vout_SysInit" );
p_vout->p_sys_end = GetPluginFunction( p_vout->vout_plugin, "vout_SysEnd" );
p_vout->p_sys_destroy = GetPluginFunction( p_vout->vout_plugin, "vout_SysDestroy" );
p_vout->p_sys_manage = GetPluginFunction( p_vout->vout_plugin, "vout_SysManage" );
p_vout->p_sys_display = GetPluginFunction( p_vout->vout_plugin, "vout_SysDisplay" );
p_vout->p_sys_create =
GetPluginFunction( p_vout->vout_plugin, "vout_SysCreate" );
p_vout->p_sys_init =
GetPluginFunction( p_vout->vout_plugin, "vout_SysInit" );
p_vout->p_sys_end =
GetPluginFunction( p_vout->vout_plugin, "vout_SysEnd" );
p_vout->p_sys_destroy =
GetPluginFunction( p_vout->vout_plugin, "vout_SysDestroy" );
p_vout->p_sys_manage =
GetPluginFunction( p_vout->vout_plugin, "vout_SysManage" );
p_vout->p_sys_display =
GetPluginFunction( p_vout->vout_plugin, "vout_SysDisplay" );
/* Initialize thread properties - thread id and locks will be initialized
* later */
......@@ -140,14 +146,15 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_window,
p_vout->i_bytes_per_pixel = 2;
p_vout->f_gamma = VOUT_GAMMA;
p_vout->b_grayscale = main_GetIntVariable( VOUT_GRAYSCALE_VAR, VOUT_GRAYSCALE_DEFAULT );
p_vout->b_grayscale = main_GetIntVariable( VOUT_GRAYSCALE_VAR,
VOUT_GRAYSCALE_DEFAULT );
p_vout->b_info = 0;
p_vout->b_interface = 0;
p_vout->b_scale = 0;
p_vout->p_set_palette = SetPalette;
intf_DbgMsg("wished configuration: %dx%d, %d/%d bpp (%d Bpl)\n",
intf_DbgMsg( "wished configuration: %dx%d, %d/%d bpp (%d Bpl)\n",
p_vout->i_width, p_vout->i_height, p_vout->i_screen_depth,
p_vout->i_bytes_per_pixel * 8, p_vout->i_bytes_per_line );
......@@ -1852,7 +1859,7 @@ static void RenderSubPicture( vout_thread_t *p_vout, subpicture_t *p_subpic )
break;
}
vout_RenderSPU( p_subpic->p_data, p_subpic->type.spu.i_offset,
p_subpic->type.spu.i_x1, p_subpic->type.spu.i_y1,
p_subpic,
p_vout->p_buffer[ p_vout->i_buffer_index ].p_data,
p_vout->i_bytes_per_pixel,
p_vout->i_bytes_per_line );
......
......@@ -30,11 +30,14 @@
#include "config.h"
#include "common.h"
#include "threads.h"
#include "mtime.h"
#include "video.h"
#include "video_spu.h"
#include "intf_msg.h"
typedef struct spu_s
typedef struct vout_spu_s
{
int i_id;
byte_t *p_data;
......@@ -44,9 +47,9 @@ typedef struct spu_s
int width;
int height;
} spu_t;
} vout_spu_t;
static int NewLine ( spu_t *p_spu, int *i_id );
static int NewLine ( vout_spu_t *p_vspu, int *i_id );
/* i = get_nibble(); */
#define GET_NIBBLE( i ) \
......@@ -88,27 +91,29 @@ static int NewLine ( spu_t *p_spu, int *i_id );
*
*****************************************************************************/
void vout_RenderSPU( byte_t *p_data, int p_offset[2],
int i_x, int i_y, byte_t *p_pic,
subpicture_t *p_subpic, byte_t *p_pic,
int i_bytes_per_pixel, int i_bytes_per_line )
{
int i_code = 0x00;
int i_next = 0;
int i_id = 0;
int i_color;
/* fake palette - the real one has to be sought in the .IFO */
static int p_palette[4] = { 0x0000, 0xffff, 0x5555, 0x0000 };
boolean_t b_aligned = 1;
byte_t *p_from[2];
spu_t spu;
vout_spu_t vspu;
p_from[1] = p_data + p_offset[1];
p_from[0] = p_data + p_offset[0];
spu.x = 0;
spu.y = 0;
spu.width = 720;
spu.height = 576;
spu.p_data = p_pic + i_x * i_bytes_per_pixel + i_y * i_bytes_per_line;
vspu.x = 0;
vspu.y = 0;
vspu.width = 720;
vspu.height = 576;
vspu.p_data = p_pic + p_subpic->i_x * i_bytes_per_pixel + p_subpic->i_y * i_bytes_per_line;
while( p_from[0] < p_data + p_offset[1] )
{
......@@ -118,78 +123,78 @@ void vout_RenderSPU( byte_t *p_data, int p_offset[2],
{
found_code:
if( ((i_code >> 2) + spu.x + spu.y * spu.width)
> spu.height * spu.width )
if( ((i_code >> 2) + vspu.x + vspu.y * vspu.width)
> vspu.height * vspu.width )
{
intf_DbgMsg ( "video_spu: invalid draw request ! %d %d\n",
i_code >> 2, spu.height * spu.width
- ( (i_code >> 2) + spu.x
+ spu.y * spu.width ) );
i_code >> 2, vspu.height * vspu.width
- ( (i_code >> 2) + vspu.x
+ vspu.y * vspu.width ) );
return;
}
else
{
if( (i_color = i_code & 0x3) )
{
u8 *p_target = &spu.p_data[ 2 *
( spu.x + spu.y * spu.width ) ];
u8 *p_target = &vspu.p_data[ 2 *
( vspu.x + vspu.y * vspu.width ) ];
memset( p_target, p_palette[i_color], 2 * (i_code >> 2) );
}
spu.x += i_code >> 2;
vspu.x += i_code >> 2;
}
if( spu.x >= spu.width )
if( vspu.x >= vspu.width )
{
/* byte-align the stream */
b_aligned = 1;
/* finish the line */
NewLine( &spu, &i_id );
NewLine( &vspu, &i_id );
}
continue;
}
ADD_NIBBLE( i_code, (i_code << 4) );
if( i_code >= 0x10 ) /* 1x .. 3x */
goto found_code;
if( i_code >= 0x10 ) /* 00 11 xx cc */
goto found_code; /* 00 01 xx cc */
ADD_NIBBLE( i_code, (i_code << 4) );
if( i_code >= 0x40 ) /* 04x .. 0fx */
goto found_code;
if( i_code >= 0x040 ) /* 00 00 11 xx xx cc */
goto found_code; /* 00 00 01 xx xx cc */
ADD_NIBBLE( i_code, (i_code << 4) );
if( i_code >= 0x100 ) /* 01xx .. 03xx */
goto found_code;
if( i_code >= 0x0100 ) /* 00 00 00 11 xx xx xx cc */
goto found_code; /* 00 00 00 01 xx xx xx cc */
/* 00xx - should only happen for 00 00 */
if( !b_aligned )
/* if the 14 first bits are 0, then it's a newline */
if( i_code <= 0x0003 )
{
ADD_NIBBLE( i_code, (i_code << 4) );
}
if( NewLine( &vspu, &i_id ) < 0 )
return;
if( i_code )
if( !b_aligned )
b_aligned = 1;
}
else
{
/* we have a boo boo ! */
intf_DbgMsg( "video_spu: unknown code 0x%x "
"(dest %x side %x, x=%d, y=%d)\n",
i_code, p_from[i_id], i_id, spu.x, spu.y );
if( NewLine( &spu, &i_id ) < 0 )
i_code, p_from[i_id], i_id, vspu.x, vspu.y );
if( NewLine( &vspu, &i_id ) < 0 )
return;
continue;
}
/* aligned 00 00 */
if( NewLine( &spu, &i_id ) < 0 )
return;
}
}
static int NewLine( spu_t *p_spu, int *i_id )
static int NewLine( vout_spu_t *p_vspu, int *i_id )
{
*i_id = 1 - *i_id;
p_spu->x = 0;
p_spu->y++;
p_vspu->x = 0;
p_vspu->y++;
return( p_spu->width - p_spu->y );
return( p_vspu->width - p_vspu->y );
}
......@@ -25,5 +25,5 @@
* Prototypes
*****************************************************************************/
void vout_RenderSPU ( byte_t *p_data, int p_offset[2],
int i_x, int i_y, byte_t *p_pic,
subpicture_t *p_subpic, byte_t *p_pic,
int i_bytes_per_pixel, int i_bytes_per_line );
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