]> git.sesse.net Git - vlc/commitdiff
9 avril:
authorSam Hocevar <sam@videolan.org>
Fri, 14 Apr 2000 04:19:51 +0000 (04:19 +0000)
committerSam Hocevar <sam@videolan.org>
Fri, 14 Apr 2000 04:19:51 +0000 (04:19 +0000)
 - 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

17 files changed:
Makefile.in
include/audio_output.h
include/config.h.in
include/interface.h
include/threads.h
include/video.h
src/ac3_decoder/ac3_bit_allocate.c
src/ac3_decoder/ac3_decoder.c
src/audio_decoder/audio_decoder_thread.c
src/audio_output/audio_output.c
src/interface/interface.c
src/interface/intf_cmd.c
src/misc/plugins.c
src/spu_decoder/spu_decoder.c
src/video_output/video_output.c
src/video_output/video_spu.c
src/video_output/video_spu.h

index 3b9a0444112644e9aedb72e408c9188829999c86..d1320bf5a19a1d2bc95c0b10146efa02c97ff1ba 100644 (file)
@@ -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:
 
 #
index 3bc7fbaccd2d8aba021c5905fad895bb3a8c7fbd..561d6efdd88404834dd60ecaff23cb4e106e5ea8 100644 (file)
@@ -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 ];
index 16ff948cb2939a29cac42607f857131e743f059e..26e594a8a41f51c9a91b5ef25625ef2d4aed2c90 100644 (file)
@@ -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
  *****************************************************************************/
 #define INTF_GAMMA_STEP                 .1
 #define INTF_GAMMA_LIMIT                3
 
+/* Maximum number of channels */
+#define INTF_MAX_CHANNELS               10
+
 /*
  * X11 settings
  */
index d9c7b7ae4656377b838cf154dea1cd407afb8274..070843e8cb54ef104730291dea0390fdd7b3f81e 100644 (file)
@@ -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 */
 
index 7dcfa5a73b1f427a6ea5d894536debf830c8313b..0a295e0506f016c1189bf042d5f654658718e6c7 100644 (file)
@@ -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)
index 496baa35a843d43816117375a1c5d8810418e177..8df2610dfe0ba444c555318ed5cb26353618cf55 100644 (file)
@@ -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;
 
index 9b99abbc1c2311bd5b38450703d00c5dd2b43b33..6d1b5e38c3cadcaba249a0b76e1817607933a945 100644 (file)
@@ -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;
index c63478527a1c89870400443272764e576688015e..585496b1517db681de2bd625647d6603055d394d 100644 (file)
@@ -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);
index 275451636a5b133d888201c9a8782827943fbf51..5f07505d7e01ba32d26a7cb5ab1e4fecdbd60ee8 100644 (file)
@@ -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;
 }
index d77c1022e7ce751fc016c2220527fc0a2e82b592..68884dbe7103288bf13d49fd3a0696430f95634e 100644 (file)
@@ -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 );
index d82ffc6226faecc52570d6a305c0c716e124839d..10dad7863af58ca969914abcf294bd3a15ac3a34 100644 (file)
@@ -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++;
             }
         }
index ba242e4b906e085564ee7b446b58a306bd3be7a7..6fba19886fdd87871a98737160bdade22ba23f2f 100644 (file)
 /*
  * Local prototypes
  */
-static int  ParseCommandArguments   ( char *psz_argv[INTF_MAX_ARGS], char *psz_cmd );
-static int  CheckCommandArguments   ( intf_arg_t argv[INTF_MAX_ARGS], int i_argc,
-                                      char *psz_argv[INTF_MAX_ARGS], char *psz_format );
-static void ParseFormatString       ( intf_arg_t format[INTF_MAX_ARGS], char *psz_format );
-static int  ConvertArgument         ( intf_arg_t *p_arg, int i_flags, char *psz_str );
+static int  ParseCommandArguments   ( char *psz_argv[INTF_MAX_ARGS],
+                                      char *psz_cmd );
+static int  CheckCommandArguments   ( intf_arg_t argv[INTF_MAX_ARGS],
+                                      int i_argc,
+                                      char *psz_argv[INTF_MAX_ARGS],
+                                      char *psz_format );
+static void ParseFormatString       ( intf_arg_t format[INTF_MAX_ARGS],
+                                      char *psz_format );
+static int  ConvertArgument         ( intf_arg_t *p_arg, int i_flags,
+                                      char *psz_str );
 
 /*****************************************************************************
  * intf_ExecCommand: parse and execute a command
@@ -99,10 +104,12 @@ int intf_ExecCommand( char *psz_cmd )
     }
 
     /* Check arguments validity */
-    if( CheckCommandArguments( argv, i_argc, psz_argv, control_command[i_index].psz_format ) )
+    if( CheckCommandArguments( argv, i_argc, psz_argv,
+                               control_command[i_index].psz_format ) )
     {
-        /* The given arguments does not match the format string. An error message has
-         * already been displayed, so only the usage string is printed */
+        /* The given arguments does not match the format string. An error
+         * message has already been displayed, so only the usage string
+         * is printed */
         intf_IntfMsg( "usage: %s", control_command[i_index].psz_usage );
         return( INTF_USAGE_ERROR );
     }
@@ -121,9 +128,10 @@ int intf_ExecCommand( char *psz_cmd )
 
     case INTF_CRITICAL_ERROR:                              /* critical error */
         /* Print message, flush messages queue and exit. Note that this
-         * error should be very rare since it does not even try to cancel other
-         * threads... */
-        intf_ErrMsg("critical error in command `%s'. Please report this error !\n", psz_argv[0] );
+         * error should be very rare since it does not even try to cancel
+         * other threads... */
+        intf_ErrMsg( "critical error in command `%s', "
+                     "please report this error !\n", psz_argv[0] );
         intf_FlushMsg();
         exit( INTF_CRITICAL_ERROR );
         break;
@@ -170,7 +178,9 @@ int intf_ExecScript( char *psz_filename )
         if( psz_line[0] != '#' )
         {
             /* The final '\n' needs to be removed before execution */
-            for( psz_index = psz_line; *psz_index && (*psz_index != '\n'); psz_index++ )
+            for( psz_index = psz_line;
+                 *psz_index && (*psz_index != '\n');
+                 psz_index++ )
             {
                 ;
             }
@@ -215,7 +225,9 @@ static int ParseCommandArguments( char *psz_argv[INTF_MAX_ARGS], char *psz_cmd )
 
     /* Go through command until end has been reached or maximal number of
      * arguments has been reached */
-    for( psz_index = psz_cmd; *psz_index && (i_argc < INTF_MAX_ARGS); psz_index++ )
+    for( psz_index = psz_cmd;
+         *psz_index && (i_argc < INTF_MAX_ARGS);
+         psz_index++ )
     {
         /* Inside a block, end of blocks are marked by spaces */
         if( b_block )
@@ -254,7 +266,8 @@ static int ParseCommandArguments( char *psz_argv[INTF_MAX_ARGS], char *psz_cmd )
  * can be modified.
  *****************************************************************************/
 static int CheckCommandArguments( intf_arg_t argv[INTF_MAX_ARGS], int i_argc,
-                                  char *psz_argv[INTF_MAX_ARGS], char *psz_format )
+                                  char *psz_argv[INTF_MAX_ARGS],
+                                  char *psz_format )
 {
     intf_arg_t  format[INTF_MAX_ARGS];           /* parsed format indicators */
     int         i_arg;                                     /* argument index */
@@ -283,7 +296,9 @@ static int CheckCommandArguments( intf_arg_t argv[INTF_MAX_ARGS], int i_argc,
 
         /* Test if argument can be taken as a named argument: try to find a
          * '=' in the string */
-        for( psz_index = psz_argv[i_arg]; *psz_index && ( *psz_index != '=' ); psz_index++ )
+        for( psz_index = psz_argv[i_arg];
+             *psz_index && ( *psz_index != '=' );
+             psz_index++ )
         {
             ;
         }
@@ -298,8 +313,10 @@ static int CheckCommandArguments( intf_arg_t argv[INTF_MAX_ARGS], int i_argc,
                 /* Current format string is named... compare start of two
                  * names. A local inline ntation of a strcmp is used since
                  * string isn't ended by '\0' but by '=' */
-                for( psz_index = psz_argv[i_arg], psz_cmp_index = format[i_index].ps_name;
-                     (*psz_index == *psz_cmp_index) && (*psz_index != '=') && (*psz_cmp_index != '=');
+                for( psz_index = psz_argv[i_arg],
+                         psz_cmp_index = format[i_index].ps_name;
+                     (*psz_index == *psz_cmp_index) && (*psz_index != '=')
+                         && (*psz_cmp_index != '=');
                      psz_index++, psz_cmp_index++ )
                 {
                     ;
@@ -307,17 +324,18 @@ static int CheckCommandArguments( intf_arg_t argv[INTF_MAX_ARGS], int i_argc,
                 if( *psz_index == *psz_cmp_index )        /* the names match */
                 {
                     /* The argument is a named argument which name match the
-                     * named argument i_index. To be valid, the argument should
-                     * not have been already encountered and the type must
-                     * match. Before going further, the '=' is replaced by
-                     * a '\0'. */
+                     * named argument i_index. To be valid, the argument
+                     * should not have been already encountered and the type
+                     * must match. Before going further, the '=' is replaced
+                     * by a '\0'. */
                     *psz_index = '\0';
 
-                    /* Check unicity. If the argument has already been encountered,
-                     * print an error message and return. */
-                    if( format[i_index].i_flags & INTF_PRESENT_ARG )/* present */
+                    /* Check unicity. If the argument has already been
+                     * encountered, print an error message and return. */
+                    if( format[i_index].i_flags & INTF_PRESENT_ARG )
                     {
-                        intf_IntfMsg("error: `%s' has already been encountered", psz_argv[i_arg] );
+                        intf_IntfMsg( "error: `%s' has already been "
+                                      "encountered", psz_argv[i_arg] );
                         return( 1 );
                     }
 
@@ -330,10 +348,12 @@ static int CheckCommandArguments( intf_arg_t argv[INTF_MAX_ARGS], int i_argc,
 
                     /* Check type and store value */
                     psz_index++;
-                    if( ConvertArgument( &argv[i_arg], format[i_index].i_flags, psz_index ) )
+                    if( ConvertArgument( &argv[i_arg],
+                                         format[i_index].i_flags, psz_index ) )
                     {
                         /* An error occured during conversion */
-                        intf_IntfMsg( "error: invalid type for `%s'", psz_index );
+                        intf_IntfMsg( "error: invalid type for `%s'",
+                                      psz_index );
                     }
                 }
             }
@@ -351,17 +371,20 @@ static int CheckCommandArguments( intf_arg_t argv[INTF_MAX_ARGS], int i_argc,
              * be browsed starting from last position until the argument is
              * found, an error occurs or the last format argument is
              * reached */
-            while( !b_found && (i_format < INTF_MAX_ARGS) && format[i_format].i_flags )
+            while( !b_found && (i_format < INTF_MAX_ARGS)
+                       && format[i_format].i_flags )
             {
                 /* Try to convert argument */
-                if( !ConvertArgument( &argv[i_arg], format[i_format].i_flags, psz_argv[i_arg] ) )
+                if( !ConvertArgument( &argv[i_arg], format[i_format].i_flags,
+                                      psz_argv[i_arg] ) )
                 {
                     /* Matching format has been found */
                     b_found = 1;
                     format[i_format].i_flags |= INTF_PRESENT_ARG;
                     argv[i_arg].i_index = i_format;
 
-                    /* If argument is repeatable, dot not increase format counter */
+                    /* If argument is repeatable, dot not increase format
+                     * counter */
                     if( !(format[i_format].i_flags & INTF_REP_ARG) )
                     {
                         i_format++;
@@ -369,8 +392,8 @@ static int CheckCommandArguments( intf_arg_t argv[INTF_MAX_ARGS], int i_argc,
                 }
                 else
                 {
-                    /* Argument does not match format. This can be an error, or
-                     * just a missing optionnal parameter, or the end of a
+                    /* Argument does not match format. This can be an error,
+                     * or just a missing optionnal parameter, or the end of a
                      * repeated argument */
                     if( (format[i_format].i_flags & INTF_OPT_ARG)
                         || (format[i_format].i_flags & INTF_PRESENT_ARG) )
@@ -382,7 +405,8 @@ static int CheckCommandArguments( intf_arg_t argv[INTF_MAX_ARGS], int i_argc,
                     {
                         /* The present format argument is mandatory and does
                          * not match the argument */
-                        intf_IntfMsg("error: missing argument before `%s'", psz_argv[i_arg] );
+                        intf_IntfMsg( "error: missing argument before `%s'",
+                                      psz_argv[i_arg] );
                         return( 1 );
                     }
                 }
@@ -394,17 +418,18 @@ static int CheckCommandArguments( intf_arg_t argv[INTF_MAX_ARGS], int i_argc,
          * return */
         if( !b_found )
         {
-            intf_IntfMsg("error: `%s' does not match any argument", psz_argv[i_arg] );
+            intf_IntfMsg( "error: `%s' does not match any argument",
+                          psz_argv[i_arg] );
             return( 1 );
         }
 
-        intf_DbgMsg("argument flags=0x%x (index=%d) name=%s str=%s int=%d float=%f\n",
-                    argv[i_arg].i_flags,
-                    argv[i_arg].i_index,
-                    (argv[i_arg].i_flags & INTF_NAMED_ARG) ? argv[i_arg].ps_name : "NA",
-                    (argv[i_arg].i_flags & INTF_STR_ARG) ? argv[i_arg].psz_str : "NA",
-                    (argv[i_arg].i_flags & INTF_INT_ARG) ? argv[i_arg].i_num : 0,
-                    (argv[i_arg].i_flags & INTF_FLOAT_ARG) ? argv[i_arg].f_num : 0);
+        intf_DbgMsg(
+            "argument flags=0x%x (index=%d) name=%s str=%s int=%d float=%f\n",
+            argv[i_arg].i_flags, argv[i_arg].i_index,
+            (argv[i_arg].i_flags & INTF_NAMED_ARG) ? argv[i_arg].ps_name : "NA",
+            (argv[i_arg].i_flags & INTF_STR_ARG) ? argv[i_arg].psz_str : "NA",
+            (argv[i_arg].i_flags & INTF_INT_ARG) ? argv[i_arg].i_num : 0,
+            (argv[i_arg].i_flags & INTF_FLOAT_ARG) ? argv[i_arg].f_num : 0 );
     }
 
     /* Parse all remaining format specifier to verify they are all optionnal */
@@ -476,16 +501,16 @@ static int ConvertArgument( intf_arg_t *p_arg, int i_flags, char *psz_str )
 }
 
 /*****************************************************************************
- * ParseFormatString: parse a format string                              (ok ?)
+ * ParseFormatString: parse a format string                             (ok ?)
  *****************************************************************************
  * This function read a format string, as specified in the control_command
  * array, and fill a format array, to allow easier argument identification.
  * Note that no memory is allocated by this function, but that, in a named
  * argument, the name field does not end with a '\0' but with an '='.
  * See command.h for format string specifications.
- * Note that this function is designed to be efficient, not to check everything
- * in a format string, which should be entered by a developper and therefore
- * should be correct (TRUST !).
+ * Note that this function is designed to be efficient, not to check
+ * everything in a format string, which should be entered by a developper
+ * and therefore should be correct (TRUST !).
  *****************************************************************************/
 static void ParseFormatString( intf_arg_t format[INTF_MAX_ARGS], char *psz_format )
 {
index efaabf6be3a5da7c3247e6740b75a5a7e5b7ef61..7a4d9fba7ba6044b64fb0506bbeab39f81f8d33c 100644 (file)
@@ -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 );
index fbae6103fc43ee9d51bb350b5da01b175b6a53fa..03530d3da1c5765d7fad40ecdf51c72bcebad7ed 100644 (file)
@@ -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);
 }
+
index a4f2a769e8a0d71d911f66503afc18fa929ddd45..6a6aab89c5d418b44343e887400fc1859eefecb5 100644 (file)
@@ -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 );
index 1a98576a10786784da427adc37eab985e40e1f51..d38b6710b8d7fbb8a71b4ab631caada38f6299a3 100644 (file)
 
 #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 );
 
 }
 
index d434ab2f4fcb08605ad677143bc7f6dc72b8f92e..5ea24cc212102f1507cda51bbc2a100e7d676845 100644 (file)
@@ -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 );