]> git.sesse.net Git - vlc/blobdiff - src/audio_output/dec.c
* modules/gui/wxwidgets: small code cleanup.
[vlc] / src / audio_output / dec.c
index 377d2b9fd362b5756e36aca35ea37094f3173b37..c14a9a4f14de93c3cca0742c5bc6a6886b81b5c7 100644 (file)
@@ -1,8 +1,8 @@
 /*****************************************************************************
  * dec.c : audio output API towards decoders
  *****************************************************************************
- * Copyright (C) 2002 VideoLAN
- * $Id: dec.c,v 1.13 2003/11/16 21:07:31 gbazin Exp $
+ * Copyright (C) 2002-2004 the VideoLAN team
+ * $Id$
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -18,7 +18,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 /*****************************************************************************
@@ -134,12 +134,14 @@ static aout_input_t * DecNew( vlc_object_t * p_this, aout_instance_t * p_aout,
     {
         p_input->i_pts_delay = p_input_thread->i_pts_delay;
         p_input->i_pts_delay += p_input->i_desync;
+        p_input->p_input_thread = p_input_thread;
         vlc_object_release( p_input_thread );
     }
     else
     {
         p_input->i_pts_delay = DEFAULT_PTS_DELAY;
         p_input->i_pts_delay += p_input->i_desync;
+        p_input->p_input_thread = NULL;
     }
 
     return p_input;
@@ -164,7 +166,7 @@ aout_input_t * __aout_DecNew( vlc_object_t * p_this,
             {
                 return NULL;
             }
-            vlc_object_attach( *pp_aout, p_this->p_vlc );
+            vlc_object_attach( *pp_aout, p_this->p_libvlc );
         }
         else
         {
@@ -308,6 +310,14 @@ int aout_DecPlay( aout_instance_t * p_aout, aout_input_t * p_input,
     {
         msg_Warn( p_aout, "received buffer in the future ("I64Fd")",
                   p_buffer->start_date - mdate());
+        if( p_input->p_input_thread )
+        {
+            vlc_mutex_lock( &p_input->p_input_thread->counters.counters_lock);
+            stats_UpdateInteger( p_aout,
+                           p_input->p_input_thread->counters.p_lost_abuffers,
+                           1, NULL );
+            vlc_mutex_unlock( &p_input->p_input_thread->counters.counters_lock);
+        }
         aout_BufferFree( p_buffer );
         return -1;
     }
@@ -333,7 +343,7 @@ int aout_DecPlay( aout_instance_t * p_aout, aout_input_t * p_input,
                             / p_input->input.i_rate;
 
         aout_BufferAlloc( &p_input->input_alloc, duration, NULL, p_new_buffer );
-        p_aout->p_vlc->pf_memcpy( p_new_buffer->p_buffer, p_buffer->p_buffer,
+        p_aout->p_libvlc->pf_memcpy( p_new_buffer->p_buffer, p_buffer->p_buffer,
                                   p_buffer->i_nb_bytes );
         p_new_buffer->i_nb_samples = p_buffer->i_nb_samples;
         p_new_buffer->i_nb_bytes = p_buffer->i_nb_bytes;
@@ -358,6 +368,14 @@ int aout_DecPlay( aout_instance_t * p_aout, aout_input_t * p_input,
     /* Run the mixer if it is able to run. */
     vlc_mutex_lock( &p_aout->mixer_lock );
     aout_MixerRun( p_aout );
+    if( p_input->p_input_thread )
+    {
+        vlc_mutex_lock( &p_input->p_input_thread->counters.counters_lock);
+        stats_UpdateInteger( p_aout,
+                             p_input->p_input_thread->counters.p_played_abuffers,
+                             1, NULL );
+        vlc_mutex_unlock( &p_input->p_input_thread->counters.counters_lock);
+    }
     vlc_mutex_unlock( &p_aout->mixer_lock );
 
     return 0;