]> git.sesse.net Git - vlc/blobdiff - modules/codec/dmo/dmo.c
dts: Initialize i_frame_size to a default value.
[vlc] / modules / codec / dmo / dmo.c
index f958c3f1c4d287b6139314a6d39f1c371965bb51..4be0bf315a4b67e0f8ef3e3e7da42a271ce0afa0 100644 (file)
@@ -32,7 +32,6 @@
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_codec.h>
-#include <vlc_vout.h>
 #include <vlc_aout.h>
 
 #ifndef WIN32
@@ -141,7 +140,9 @@ struct decoder_sys_t
     vlc_cond_t   wait_input, wait_output;
     bool         b_ready, b_works;
     block_t    **pp_input;
-    void        *p_output;
+
+    int          i_output;
+    void       **pp_output;
 };
 
 const GUID IID_IWMCodecPrivateData = {0x73f0be8e, 0x57f7, 0x4f01, {0xaa, 0x66, 0x9f, 0x57, 0x34, 0xc, 0xfe, 0xe}};
@@ -201,6 +202,8 @@ static const codec_dll decoders_table[] =
 
     /* WMA 3 */
     { VLC_CODEC_WMAP,   "wma9dmod.dll", &guid_wma9 },
+    { VLC_CODEC_WMAL,   "wma9dmod.dll", &guid_wma9 },
+
     /* WMA 2 */
     { VLC_CODEC_WMA2,   "wma9dmod.dll", &guid_wma9 },
 
@@ -279,7 +282,7 @@ found:
     p_sys->b_works =
     p_sys->b_ready = false;
     p_sys->pp_input = NULL;
-    p_sys->p_output = NULL;
+    TAB_INIT( p_sys->i_output, p_sys->pp_output );
 
     if( vlc_clone( &p_sys->thread, DecoderThread, p_dec,
                    VLC_THREAD_PRIORITY_INPUT ) )
@@ -316,6 +319,7 @@ static void DecoderClose( vlc_object_t *p_this )
     vlc_mutex_unlock( &p_sys->lock );
 
     vlc_join( p_sys->thread, NULL );
+    TAB_CLEAN( p_sys->i_output, p_sys->pp_output );
     vlc_cond_destroy( &p_sys->wait_input );
     vlc_cond_destroy( &p_sys->wait_output );
     vlc_mutex_destroy( &p_sys->lock );
@@ -328,12 +332,22 @@ static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
     void *p_ret;
 
     vlc_mutex_lock( &p_sys->lock );
-    p_sys->pp_input = pp_block;
-    vlc_cond_signal( &p_sys->wait_input );
+    if( p_sys->i_output <= 0 )
+    {
+        p_sys->pp_input = pp_block;
+        vlc_cond_signal( &p_sys->wait_input );
+
+        while( p_sys->pp_input )
+            vlc_cond_wait( &p_sys->wait_output, &p_sys->lock );
+    }
+
+    p_ret = NULL;
+    if( p_sys->i_output > 0 )
+    {
+        p_ret = p_sys->pp_output[0];
+        TAB_REMOVE( p_sys->i_output, p_sys->pp_output, p_ret );
+    }
 
-    while( p_sys->pp_input )
-        vlc_cond_wait( &p_sys->wait_output, &p_sys->lock );
-    p_ret = p_sys->p_output;
     vlc_mutex_unlock( &p_sys->lock );
 
     return p_ret;
@@ -888,7 +902,9 @@ static void *DecBlock( decoder_t *p_dec, block_t **pp_block )
         }
         else
         {
-            //msg_Dbg( p_dec, "ProcessInput(): successful" );
+#ifdef DMO_DEBUG
+            msg_Dbg( p_dec, "ProcessInput(): successful" );
+#endif
             *pp_block = NULL;
         }
     }
@@ -1021,7 +1037,13 @@ static void *DecoderThread( void *data )
         if( !p_sys->b_ready )
             break;
 
-        p_sys->p_output = DecBlock( p_dec, p_sys->pp_input );
+        for( ;; )
+        {
+            void *p_output = DecBlock( p_dec, p_sys->pp_input );
+            if( !p_output )
+                break;
+            TAB_APPEND( p_sys->i_output, p_sys->pp_output, p_output );
+        }
         p_sys->pp_input = NULL;
         vlc_cond_signal( &p_sys->wait_output );
     }