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)
......@@ -189,7 +190,7 @@ static __inline__ void vlc_thread_join( vlc_thread_t thread )
cthread_join( thread );
#elif defined(HAVE_KERNEL_SCHEDULER_H) && defined(HAVE_KERNEL_OS_H)
int32 exit_value;
int32 exit_value;
wait_for_thread( thread, &exit_value );
#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;
......
......@@ -34,17 +34,17 @@ static inline u16 max (s16 a, s16 b);
*/
static void ba_compute_psd (s16 start, s16 end, s16 exps[],
s16 psd[], s16 bndpsd[]);
s16 psd[], s16 bndpsd[]);
static void ba_compute_excitation (s16 start, s16 end, s16 fgain,
s16 fastleak, s16 slowleak, s16 is_lfe,
s16 bndpsd[], s16 excite[]);
s16 fastleak, s16 slowleak, s16 is_lfe,
s16 bndpsd[], s16 excite[]);
static void ba_compute_mask (s16 start, s16 end, u16 fscod,
u16 deltbae, u16 deltnseg, u16 deltoffst[],
u16 deltba[], u16 deltlen[], s16 excite[],
s16 mask[]);
u16 deltbae, u16 deltnseg, u16 deltoffst[],
u16 deltba[], u16 deltlen[], s16 excite[],
s16 mask[]);
static void ba_compute_bap (s16 start, s16 end, s16 snroffset,
s16 psd[], s16 mask[], s16 bap[]);
s16 psd[], s16 mask[], s16 bap[]);
/* Misc LUTs for bit allocation process */
......@@ -57,16 +57,16 @@ static u16 floortab[] = { 0x2f0, 0x2b0, 0x270, 0x230, 0x1f0, 0x170, 0x0f0, 0xf80
static s16 fastgain[] = { 0x080, 0x100, 0x180, 0x200, 0x280, 0x300, 0x380, 0x400 };
static s16 bndtab[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
20, 21, 22, 23, 24, 25, 26, 27, 28, 31,
34, 37, 40, 43, 46, 49, 55, 61, 67, 73,
79, 85, 97, 109, 121, 133, 157, 181, 205, 229 };
10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
20, 21, 22, 23, 24, 25, 26, 27, 28, 31,
34, 37, 40, 43, 46, 49, 55, 61, 67, 73,
79, 85, 97, 109, 121, 133, 157, 181, 205, 229 };
static s16 bndsz[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 3, 3,
3, 3, 3, 3, 3, 6, 6, 6, 6, 6,
6, 12, 12, 12, 12, 24, 24, 24, 24, 24 };
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 3, 3,
3, 3, 3, 3, 3, 6, 6, 6, 6, 6,
6, 12, 12, 12, 12, 24, 24, 24, 24, 24 };
static s16 masktab[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 28, 28, 29,
......@@ -212,10 +212,10 @@ void bit_allocate (ac3dec_t * p_ac3dec)
/* Only perform bit_allocation if the exponents have changed or we
* have new sideband information */
if (p_ac3dec->audblk.chexpstr[0] == 0 && p_ac3dec->audblk.chexpstr[1] == 0 &&
p_ac3dec->audblk.chexpstr[2] == 0 && p_ac3dec->audblk.chexpstr[3] == 0 &&
p_ac3dec->audblk.chexpstr[4] == 0 && p_ac3dec->audblk.cplexpstr == 0 &&
p_ac3dec->audblk.lfeexpstr == 0 && p_ac3dec->audblk.baie == 0 &&
p_ac3dec->audblk.snroffste == 0 && p_ac3dec->audblk.deltbaie == 0)
p_ac3dec->audblk.chexpstr[2] == 0 && p_ac3dec->audblk.chexpstr[3] == 0 &&
p_ac3dec->audblk.chexpstr[4] == 0 && p_ac3dec->audblk.cplexpstr == 0 &&
p_ac3dec->audblk.lfeexpstr == 0 && p_ac3dec->audblk.baie == 0 &&
p_ac3dec->audblk.snroffste == 0 && p_ac3dec->audblk.deltbaie == 0)
return;
/* Do some setup before we do the bit alloc */
......@@ -227,9 +227,9 @@ void bit_allocate (ac3dec_t * p_ac3dec)
/* if all the SNR offset constants are zero then the whole block is zero */
if (!p_ac3dec->audblk.csnroffst && !p_ac3dec->audblk.fsnroffst[0] &&
!p_ac3dec->audblk.fsnroffst[1] && !p_ac3dec->audblk.fsnroffst[2] &&
!p_ac3dec->audblk.fsnroffst[3] && !p_ac3dec->audblk.fsnroffst[4] &&
!p_ac3dec->audblk.cplfsnroffst && !p_ac3dec->audblk.lfefsnroffst) {
!p_ac3dec->audblk.fsnroffst[1] && !p_ac3dec->audblk.fsnroffst[2] &&
!p_ac3dec->audblk.fsnroffst[3] && !p_ac3dec->audblk.fsnroffst[4] &&
!p_ac3dec->audblk.cplfsnroffst && !p_ac3dec->audblk.lfefsnroffst) {
memset(p_ac3dec->audblk.fbw_bap,0,sizeof(u16) * 256 * 5);
memset(p_ac3dec->audblk.cpl_bap,0,sizeof(u16) * 256);
memset(p_ac3dec->audblk.lfe_bap,0,sizeof(u16) * 7);
......@@ -247,17 +247,17 @@ void bit_allocate (ac3dec_t * p_ac3dec)
ba_compute_psd (start, end, p_ac3dec->audblk.fbw_exp[i], psd, bndpsd);
ba_compute_excitation (start, end , fgain, fastleak, slowleak, 0,
bndpsd, excite);
bndpsd, excite);
ba_compute_mask (start, end, p_ac3dec->syncinfo.fscod,
p_ac3dec->audblk.deltbae[i],
p_ac3dec->audblk.deltnseg[i],
p_ac3dec->audblk.deltoffst[i],
p_ac3dec->audblk.deltba[i],
p_ac3dec->audblk.deltlen[i], excite, mask);
p_ac3dec->audblk.deltbae[i],
p_ac3dec->audblk.deltnseg[i],
p_ac3dec->audblk.deltoffst[i],
p_ac3dec->audblk.deltba[i],
p_ac3dec->audblk.deltlen[i], excite, mask);
ba_compute_bap (start, end, snroffset, psd, mask,
p_ac3dec->audblk.fbw_bap[i]);
p_ac3dec->audblk.fbw_bap[i]);
}
if (p_ac3dec->audblk.cplinu) {
......@@ -271,17 +271,17 @@ void bit_allocate (ac3dec_t * p_ac3dec)
ba_compute_psd (start, end, p_ac3dec->audblk.cpl_exp, psd, bndpsd);
ba_compute_excitation (start, end , fgain, fastleak, slowleak, 0,
bndpsd, excite);
bndpsd, excite);
ba_compute_mask (start, end, p_ac3dec->syncinfo.fscod,
p_ac3dec->audblk.cpldeltbae,
p_ac3dec->audblk.cpldeltnseg,
p_ac3dec->audblk.cpldeltoffst,
p_ac3dec->audblk.cpldeltba,
p_ac3dec->audblk.cpldeltlen, excite, mask);
p_ac3dec->audblk.cpldeltbae,
p_ac3dec->audblk.cpldeltnseg,
p_ac3dec->audblk.cpldeltoffst,
p_ac3dec->audblk.cpldeltba,
p_ac3dec->audblk.cpldeltlen, excite, mask);
ba_compute_bap (start, end, snroffset, psd, mask,
p_ac3dec->audblk.cpl_bap);
p_ac3dec->audblk.cpl_bap);
}
if (p_ac3dec->bsi.lfeon) {
......@@ -295,19 +295,19 @@ void bit_allocate (ac3dec_t * p_ac3dec)
ba_compute_psd (start, end, p_ac3dec->audblk.lfe_exp, psd, bndpsd);
ba_compute_excitation (start, end , fgain, fastleak, slowleak, 1,
bndpsd, excite);
bndpsd, excite);
ba_compute_mask (start, end, p_ac3dec->syncinfo.fscod, 2, 0, 0, 0, 0,
excite, mask);
excite, mask);
ba_compute_bap (start, end, snroffset, psd, mask,
p_ac3dec->audblk.lfe_bap);
p_ac3dec->audblk.lfe_bap);
}
}
static void ba_compute_psd (s16 start, s16 end, s16 exps[], s16 psd[],
s16 bndpsd[])
s16 bndpsd[])
{
int bin,i,j,k;
s16 lastbin = 0;
......@@ -336,8 +336,8 @@ static void ba_compute_psd (s16 start, s16 end, s16 exps[], s16 psd[],
}
static void ba_compute_excitation (s16 start, s16 end,s16 fgain, s16 fastleak,
s16 slowleak, s16 is_lfe, s16 bndpsd[],
s16 excite[])
s16 slowleak, s16 is_lfe, s16 bndpsd[],
s16 excite[])
{
int bin;
s16 bndstrt;
......@@ -360,9 +360,9 @@ static void ba_compute_excitation (s16 start, s16 end,s16 fgain, s16 fastleak,
for (bin = 2; bin < 7; bin++) {
if (!(is_lfe && (bin == 6)))
lowcomp = calc_lowcomp (lowcomp, bndpsd[bin], bndpsd[bin+1], bin);
fastleak = bndpsd[bin] - fgain;
slowleak = bndpsd[bin] - sgain;
excite[bin] = fastleak - lowcomp;
fastleak = bndpsd[bin] - fgain;
slowleak = bndpsd[bin] - sgain;
excite[bin] = fastleak - lowcomp;
if (!(is_lfe && (bin == 6))) {
if (bndpsd[bin] <= bndpsd[bin+1]) {
......@@ -375,11 +375,11 @@ static void ba_compute_excitation (s16 start, s16 end,s16 fgain, s16 fastleak,
for (bin = begin; bin < min(bndend, 22); bin++) {
if (!(is_lfe && (bin == 6)))
lowcomp = calc_lowcomp (lowcomp, bndpsd[bin], bndpsd[bin+1], bin);
fastleak -= fdecay ;
fastleak = max(fastleak, bndpsd[bin] - fgain);
slowleak -= sdecay ;
slowleak = max(slowleak, bndpsd[bin] - sgain);
excite[bin] = max(fastleak - lowcomp, slowleak);
fastleak -= fdecay ;
fastleak = max(fastleak, bndpsd[bin] - fgain);
slowleak -= sdecay ;
slowleak = max(slowleak, bndpsd[bin] - sgain);
excite[bin] = max(fastleak - lowcomp, slowleak);
}
begin = 22;
} else { /* For coupling channel */
......@@ -396,8 +396,8 @@ static void ba_compute_excitation (s16 start, s16 end,s16 fgain, s16 fastleak,
}
static void ba_compute_mask (s16 start, s16 end, u16 fscod, u16 deltbae,
u16 deltnseg, u16 deltoffst[], u16 deltba[],
u16 deltlen[], s16 excite[], s16 mask[])
u16 deltnseg, u16 deltoffst[], u16 deltba[],
u16 deltlen[], s16 excite[], s16 mask[])
{
int bin,k;
s16 bndstrt;
......@@ -428,15 +428,15 @@ static void ba_compute_mask (s16 start, s16 end, u16 fscod, u16 deltbae,
delta = (deltba[seg] - 4) << 7;
}
for (k = 0; k < deltlen[seg]; k++) {
mask[band] += delta;
band++;
mask[band] += delta;
band++;
}
}
}
}
static void ba_compute_bap (s16 start, s16 end, s16 snroffset, s16 psd[],
s16 mask[], s16 bap[])
s16 mask[], s16 bap[])
{
int i,j,k;
s16 lastbin = 0;
......
......@@ -39,21 +39,21 @@ int ac3_decode_frame (ac3dec_t * p_ac3dec, s16 * buffer)
int i;
if (parse_bsi (p_ac3dec))
return 1;
return 1;
for (i = 0; i < 6; i++) {
if (parse_audblk (p_ac3dec, i))
return 1;
if (exponent_unpack (p_ac3dec))
return 1;
bit_allocate (p_ac3dec);
mantissa_unpack (p_ac3dec);
if (p_ac3dec->bsi.acmod == 0x2)
rematrix (p_ac3dec);
imdct (p_ac3dec);
downmix (p_ac3dec, buffer);
buffer += 2*256;
if (parse_audblk (p_ac3dec, i))
return 1;
if (exponent_unpack (p_ac3dec))
return 1;
bit_allocate (p_ac3dec);
mantissa_unpack (p_ac3dec);
if (p_ac3dec->bsi.acmod == 0x2)
rematrix (p_ac3dec);
imdct (p_ac3dec);
downmix (p_ac3dec, buffer);
buffer += 2*256;
}
parse_auxdata (p_ac3dec);
......
......@@ -185,9 +185,9 @@ static int InitThread (adec_thread_t * p_adec)
p_adec->p_ts = DECODER_FIFO_START ( p_adec->fifo )->p_first_ts;
byte_stream = adec_byte_stream ( &p_adec->audio_decoder );
byte_stream->p_byte =
p_adec->p_ts->buffer + p_adec->p_ts->i_payload_start;
p_adec->p_ts->buffer + p_adec->p_ts->i_payload_start;
byte_stream->p_end =
p_adec->p_ts->buffer + p_adec->p_ts->i_payload_end;
p_adec->p_ts->buffer + p_adec->p_ts->i_payload_end;
byte_stream->info = p_adec;
vlc_mutex_unlock ( &p_adec->fifo.data_lock );
......@@ -235,7 +235,7 @@ static void RunThread (adec_thread_t * p_adec)
adec_sync_info_t sync_info;
if ( !sync )
{
{
/* have to find a synchro point */
adec_byte_stream_t * p_byte_stream;
......@@ -246,32 +246,36 @@ 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;
}
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) )
{
sync = 0;
goto bad_frame;
}
}
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) )
if( adec_decode_frame (&p_adec->audio_decoder, buffer) )
{
sync = 0;
goto bad_frame;
......@@ -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 );
}
......@@ -397,8 +403,10 @@ 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;
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);
......@@ -413,7 +421,7 @@ void adec_byte_stream_next ( adec_byte_stream_t * p_byte_stream )
/* We've found a TS packet which contains interesting data... */
p_byte_stream->p_byte =
p_adec->p_ts->buffer + p_adec->p_ts->i_payload_start;
p_adec->p_ts->buffer + p_adec->p_ts->i_payload_start;
p_byte_stream->p_end =
p_adec->p_ts->buffer + p_adec->p_ts->i_payload_end;
p_adec->p_ts->buffer + p_adec->p_ts->i_payload_end;
}
......@@ -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,10 +419,11 @@ 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",
p_channel->i_channel, p_channel->psz_description,
p_channel->i_input_method, p_channel->psz_input_source,
p_channel->i_input_port, p_channel->i_input_vlan );
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_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)
| GetBits( &p_spudec->bit_stream, 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)
| GetBits( &p_spudec->bit_stream, 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,16 +146,17 @@ 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",
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 );
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 );
/* Initialize idle screen */
p_vout->last_display_date = mdate();
......@@ -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