[vlc-commits] commit: Restore liba52 and libdca functionality ( Rémi Denis-Courmont )

git at videolan.org git at videolan.org
Fri Apr 16 16:59:39 CEST 2010


vlc/vlc-1.0 | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Apr 16 17:48:36 2010 +0300| [52b25dafa1951d3db163d1d2056ae82926fe0800] | committer: Rémi Denis-Courmont 

Restore liba52 and libdca functionality

> http://git.videolan.org/gitweb.cgi/vlc/vlc-1.0.git/?a=commit;h=52b25dafa1951d3db163d1d2056ae82926fe0800
---

 modules/codec/a52.c |   36 ++++++++++++++++++++++++------------
 modules/codec/dts.c |   35 +++++++++++++++++++++++------------
 2 files changed, 47 insertions(+), 24 deletions(-)

diff --git a/modules/codec/a52.c b/modules/codec/a52.c
index fe808fc..62f427d 100644
--- a/modules/codec/a52.c
+++ b/modules/codec/a52.c
@@ -99,7 +99,7 @@ enum {
  ****************************************************************************/
 static void *DecodeBlock  ( decoder_t *, block_t ** );
 
-static uint8_t       *GetOutBuffer ( decoder_t *, block_t ** );
+static uint8_t       *GetOutBuffer ( decoder_t *, void **, size_t * );
 static aout_buffer_t *GetAoutBuffer( decoder_t * );
 static block_t       *GetSoutBuffer( decoder_t * );
 
@@ -159,12 +159,7 @@ static int OpenCommon( vlc_object_t *p_this, bool b_packetizer )
 
 static int OpenDecoder( vlc_object_t *p_this )
 {
-#if 0
     return OpenCommon( p_this, false );
-#else
-    msg_Dbg( p_this, "skipping broken module" );
-    return VLC_EGENERIC;
-#endif
 }
 
 static int OpenPacketizer( vlc_object_t *p_this )
@@ -182,7 +177,7 @@ static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
     decoder_sys_t *p_sys = p_dec->p_sys;
     uint8_t p_header[VLC_A52_HEADER_SIZE];
     uint8_t *p_buf;
-    block_t *p_out_buffer;
+    void *p_out_buffer;
 
     if( !pp_block || !*pp_block ) return NULL;
 
@@ -304,7 +299,10 @@ static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
             p_sys->i_state = STATE_SEND_DATA;
 
         case STATE_SEND_DATA:
-            if( !(p_buf = GetOutBuffer( p_dec, &p_out_buffer )) )
+        {
+            size_t i_len;
+
+            if( !(p_buf = GetOutBuffer( p_dec, &p_out_buffer, &i_len )) )
             {
                 //p_dec->b_error = true;
                 return NULL;
@@ -313,7 +311,7 @@ static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
             /* Copy the whole frame into the buffer. When we reach this point
              * we already know we have enough data available. */
             block_GetBytes( &p_sys->bytestream,
-                            p_buf, __MIN( p_sys->frame.i_size, p_out_buffer->i_buffer ) );
+                            p_buf, __MIN( p_sys->frame.i_size, i_len ) );
 
             /* Make sure we don't reuse the same pts twice */
             if( p_sys->i_pts == p_sys->bytestream.p_block->i_pts )
@@ -326,6 +324,7 @@ static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
 
             return p_out_buffer;
         }
+        }
     }
 
     return NULL;
@@ -347,7 +346,8 @@ static void CloseCommon( vlc_object_t *p_this )
 /*****************************************************************************
  * GetOutBuffer:
  *****************************************************************************/
-static uint8_t *GetOutBuffer( decoder_t *p_dec, block_t **pp_out_buffer )
+static uint8_t *GetOutBuffer( decoder_t *p_dec, void **pp_out_buffer,
+                              size_t *p_len )
 {
     decoder_sys_t *p_sys = p_dec->p_sys;
     uint8_t *p_buf;
@@ -376,13 +376,25 @@ static uint8_t *GetOutBuffer( decoder_t *p_dec, block_t **pp_out_buffer )
     if( p_sys->b_packetizer )
     {
         block_t *p_sout_buffer = GetSoutBuffer( p_dec );
-        p_buf = p_sout_buffer ? p_sout_buffer->p_buffer : NULL;
+        if( p_sout_buffer )
+        {
+            p_buf = p_sout_buffer->p_buffer;
+            *p_len = p_sout_buffer->i_buffer;
+        }
+        else
+            p_buf = NULL;
         *pp_out_buffer = p_sout_buffer;
     }
     else
     {
         aout_buffer_t *p_aout_buffer = GetAoutBuffer( p_dec );
-        p_buf = p_aout_buffer ? p_aout_buffer->p_buffer : NULL;
+        if( p_aout_buffer )
+        {
+            p_buf = p_aout_buffer->p_buffer;
+            *p_len = p_aout_buffer->i_size;
+        }
+        else
+            p_buf = NULL;
         *pp_out_buffer = p_aout_buffer;
     }
 
diff --git a/modules/codec/dts.c b/modules/codec/dts.c
index f8f64eb..d6e06ba 100644
--- a/modules/codec/dts.c
+++ b/modules/codec/dts.c
@@ -108,7 +108,7 @@ static inline int SyncCode( const uint8_t * );
 static int  SyncInfo( const uint8_t *, bool *, unsigned int *, unsigned int *,
                       unsigned int *, unsigned int *, unsigned int * );
 
-static uint8_t       *GetOutBuffer ( decoder_t *, block_t ** );
+static uint8_t       *GetOutBuffer ( decoder_t *, void **, size_t * );
 static aout_buffer_t *GetAoutBuffer( decoder_t * );
 static block_t       *GetSoutBuffer( decoder_t * );
 
@@ -117,16 +117,11 @@ static block_t       *GetSoutBuffer( decoder_t * );
  *****************************************************************************/
 static int OpenDecoder( vlc_object_t *p_this )
 {
-#if 0
     /* HACK: Don't use this codec if we don't have an dts audio filter */
     if( !module_exists( "dtstofloat32" ) )
         return VLC_EGENERIC;
 
     return OpenCommon( p_this, false );
-#else
-    msg_Dbg( p_this, "skipping broken module" );
-    return VLC_EGENERIC;
-#endif
 }
 
 /*****************************************************************************
@@ -185,7 +180,7 @@ static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
     decoder_sys_t *p_sys = p_dec->p_sys;
     uint8_t p_header[DTS_HEADER_SIZE];
     uint8_t *p_buf;
-    block_t *p_out_buffer;
+    void *p_out_buffer;
 
     if( !pp_block || !*pp_block )
         return NULL;
@@ -309,6 +304,8 @@ static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
             p_sys->i_state = STATE_SEND_DATA;
 
         case STATE_SEND_DATA:
+        {
+            size_t i_len;
             if( p_sys->b_dts_hd  )
             {
                 /* Ignore DTS-HD */
@@ -317,7 +314,7 @@ static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
                 break;
             }
 
-            if( !(p_buf = GetOutBuffer( p_dec, &p_out_buffer )) )
+            if( !(p_buf = GetOutBuffer( p_dec, &p_out_buffer, &i_len )) )
             {
                 //p_dec->b_error = true;
                 return NULL;
@@ -326,7 +323,7 @@ static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
             /* Copy the whole frame into the buffer. When we reach this point
              * we already know we have enough data available. */
             block_GetBytes( &p_sys->bytestream,
-                            p_buf, __MIN( p_sys->i_frame_size, p_out_buffer->i_buffer ) );
+                            p_buf, __MIN( p_sys->i_frame_size, i_len ) );
 
             /* Make sure we don't reuse the same pts twice */
             if( p_sys->i_pts == p_sys->bytestream.p_block->i_pts )
@@ -339,6 +336,7 @@ static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
 
             return p_out_buffer;
         }
+        }
     }
 
     return NULL;
@@ -360,7 +358,8 @@ static void CloseCommon( vlc_object_t *p_this )
 /*****************************************************************************
  * GetOutBuffer:
  *****************************************************************************/
-static uint8_t *GetOutBuffer( decoder_t *p_dec, block_t **pp_out_buffer )
+static uint8_t *GetOutBuffer( decoder_t *p_dec, void **pp_out_buffer,
+                              size_t *pi_len )
 {
     decoder_sys_t *p_sys = p_dec->p_sys;
     uint8_t *p_buf;
@@ -390,13 +389,25 @@ static uint8_t *GetOutBuffer( decoder_t *p_dec, block_t **pp_out_buffer )
     if( p_sys->b_packetizer )
     {
         block_t *p_sout_buffer = GetSoutBuffer( p_dec );
-        p_buf = p_sout_buffer ? p_sout_buffer->p_buffer : NULL;
+        if( p_sout_buffer )
+        {
+            p_buf = p_sout_buffer->p_buffer;
+            *pi_len = p_sout_buffer->i_buffer;
+        }
+        else
+            p_buf = NULL;
         *pp_out_buffer = p_sout_buffer;
     }
     else
     {
         aout_buffer_t *p_aout_buffer = GetAoutBuffer( p_dec );
-        p_buf = p_aout_buffer ? p_aout_buffer->p_buffer : NULL;
+        if( p_aout_buffer )
+        {
+            p_buf = p_aout_buffer->p_buffer;
+            *pi_len = p_aout_buffer->i_size;
+        }
+        else
+            p_buf = NULL;
         *pp_out_buffer = p_aout_buffer;
     }
 



More information about the vlc-commits mailing list