]> git.sesse.net Git - vlc/blobdiff - modules/audio_output/hd1000a.cpp
playlist: Make sure we don't pl_Release(p_playlist).
[vlc] / modules / audio_output / hd1000a.cpp
index c28aa5ebfd6ae38bb292ac8d32223f3c8a0ff679..57c5bc2a1f0e27e2acb4583e89bea10330e2f439 100644 (file)
  *****************************************************************************/
 extern "C"
 {
-#include <string.h>
-#include <stdlib.h>
 #include <errno.h>
 
-#include <vlc/vlc.h>
-#include <vlc/aout.h>
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <vlc_common.h>
+#include <vlc_plugin.h>
+#include <vlc_aout.h>
 
 #include "aout_internal.h"
 }
@@ -73,7 +76,7 @@ static void    InterleaveS16( int16_t *, int16_t * );
  *****************************************************************************/
 vlc_module_begin();
     set_shortname( "Roku HD1000" );
-    set_description( _("Roku HD1000 audio output") );
+    set_description( N_("Roku HD1000 audio output") );
     set_capability( "audio output", 100 );
     set_category( CAT_AUDIO );
     set_subcategory( SUBCAT_AUDIO_AOUT );
@@ -94,18 +97,14 @@ static int Open( vlc_object_t * p_this )
     p_aout->output.p_sys = p_sys =
         (aout_sys_t *)malloc( sizeof( aout_sys_t ) );
     if( p_aout->output.p_sys == NULL )
-    {
-        msg_Err( p_aout, "out of memory" );
-        return VLC_EGENERIC;
-    }
+        return VLC_ENOMEM;
 
     /* New PCMAudioPlayer */
     p_sys->pPlayer = pPlayer = new PCMAudioPlayer();
     if( p_sys->pPlayer == NULL )
     {
-        msg_Err( p_aout, "out of memory" );
         free( p_sys );
-        return VLC_EGENERIC;
+        return VLC_ENOMEM;
     }
 
     /* Get Buffer Requirements */
@@ -117,17 +116,16 @@ static int Open( vlc_object_t * p_this )
         delete pPlayer;
         free( p_sys );
         return VLC_EGENERIC;
-    } 
+    }
 
     p_sys->nBuffers = __MIN( p_sys->nBuffers, 4 );
 
     p_sys->ppBuffers = (void **)malloc( p_sys->nBuffers * sizeof( void * ) );
     if( p_sys->ppBuffers == NULL )
     {
-        msg_Err( p_aout, "out of memory" );
         delete pPlayer;
         free( p_sys );
-        return VLC_EGENERIC;
+        return VLC_ENOMEM;
     }
 
     /* Open PCMAudioPlayer */
@@ -170,9 +168,9 @@ static int Open( vlc_object_t * p_this )
 
     /* Create thread and wait for its readiness. */
     if( vlc_thread_create( p_aout, "aout", Thread,
-                           VLC_THREAD_PRIORITY_OUTPUT, VLC_FALSE ) )
+                           VLC_THREAD_PRIORITY_OUTPUT, false ) )
     {
-        msg_Err( p_aout, "cannot create OSS thread (%s)", strerror(errno) );
+        msg_Err( p_aout, "cannot create OSS thread (%m)" );
         pPlayer->Close();
         delete pPlayer;
         free( p_sys->ppBuffers );
@@ -192,9 +190,9 @@ static void Close( vlc_object_t * p_this )
     aout_instance_t * p_aout = (aout_instance_t *)p_this;
     struct aout_sys_t * p_sys = p_aout->output.p_sys;
 
-    p_aout->b_die = VLC_TRUE;
+    vlc_object_kill( p_aout );
     vlc_thread_join( p_aout );
-    p_aout->b_die = VLC_FALSE;
+    p_aout->b_die = false;
 
     do
     {
@@ -224,7 +222,7 @@ static int Thread( aout_instance_t * p_aout )
     struct aout_sys_t * p_sys = p_aout->output.p_sys;
     PCMAudioPlayer * pPlayer = p_sys->pPlayer;
 
-    while( !p_aout->b_die )
+    while( vlc_object_alive (p_aout) )
     {
         pPlayer->WaitForBuffer();
 
@@ -235,8 +233,8 @@ static int Thread( aout_instance_t * p_aout )
 #define i p_sys->nNextBufferIndex
         if( p_buffer == NULL )
         {
-            p_aout->p_libvlc->pf_memset( p_sys->ppBuffers[ i ], 0,
-                                      p_sys->nBufferSize ); 
+            vlc_memset( p_aout, p_sys->ppBuffers[ i ], 0,
+                                      p_sys->nBufferSize );
         }
         else
         {
@@ -249,7 +247,7 @@ static int Thread( aout_instance_t * p_aout )
                                    p_sys->nBufferSize / 2 ) )
         {
             msg_Err( p_aout, "QueueBuffer failed" );
-        } 
+        }
 
         i = (i + 1) % p_sys->nBuffers;
 #undef i