]> git.sesse.net Git - vlc/blobdiff - src/audio_output/aout_internal.h
aout_BufferAlloc : returns the allocated buffer
[vlc] / src / audio_output / aout_internal.h
index ca2576e9d241c6a9c0aca9f019eba678625a43ad..f900b1a09ec50a21e68fc2d78c7be071dd4d5404 100644 (file)
 #ifndef __LIBVLC_AOUT_INTERNAL_H
 # define __LIBVLC_AOUT_INTERNAL_H 1
 
-#include <assert.h>
-
-#if defined( __APPLE__ ) || defined( SYS_BSD )
-#undef HAVE_ALLOCA
-#endif
-
-#ifdef HAVE_ALLOCA
-#   define ALLOCA_TEST( p_alloc, p_new_buffer )                             \
-        if ( (p_alloc)->i_alloc_type == AOUT_ALLOC_STACK )                  \
-        {                                                                   \
-            (p_new_buffer) = alloca( i_alloc_size + sizeof(aout_buffer_t) );\
-            i_alloc_type = AOUT_ALLOC_STACK;                                \
-        }                                                                   \
-        else
-#else
-#   define ALLOCA_TEST( p_alloc, p_new_buffer )
-#endif
-
-#define aout_BufferAlloc( p_alloc, i_nb_usec, p_previous_buffer,            \
-                          p_new_buffer )                                    \
-    if ( (p_alloc)->i_alloc_type == AOUT_ALLOC_NONE )                       \
-    {                                                                       \
-        (p_new_buffer) = p_previous_buffer;                                 \
-    }                                                                       \
-    else                                                                    \
-    {                                                                       \
-        int i_alloc_size, i_alloc_type;                                     \
-        i_alloc_size = (int)( (uint64_t)(p_alloc)->i_bytes_per_sec          \
-                                            * (i_nb_usec) / 1000000 + 1 );  \
-        ALLOCA_TEST( p_alloc, p_new_buffer )                                \
-        {                                                                   \
-            (p_new_buffer) = malloc( i_alloc_size + sizeof(aout_buffer_t) );\
-            i_alloc_type = AOUT_ALLOC_HEAP;                                 \
-        }                                                                   \
-        if ( p_new_buffer != NULL )                                         \
-        {                                                                   \
-            (p_new_buffer)->i_alloc_type = i_alloc_type;                    \
-            (p_new_buffer)->i_size = i_alloc_size;                          \
-            (p_new_buffer)->p_buffer = (uint8_t *)(p_new_buffer)            \
-                                         + sizeof(aout_buffer_t);           \
-            (p_new_buffer)->b_discontinuity = false;                        \
-            if ( (p_previous_buffer) != NULL )                              \
-            {                                                               \
-                (p_new_buffer)->start_date =                                \
-                           ((aout_buffer_t *)p_previous_buffer)->start_date;\
-                (p_new_buffer)->end_date =                                  \
-                           ((aout_buffer_t *)p_previous_buffer)->end_date;  \
-            }                                                               \
-        }                                                                   \
-        /* we'll keep that for a while --Meuuh */                           \
-        /* else printf("%s:%d\n", __FILE__, __LINE__); */                   \
-    }
+aout_buffer_t *aout_BufferAlloc(aout_alloc_t *allocation, mtime_t microseconds,
+        aout_buffer_t *old_buffer);
 
 struct aout_filter_owner_sys_t
 {
@@ -87,6 +37,59 @@ struct aout_filter_owner_sys_t
     aout_input_t    *p_input;
 };
 
+/** an input stream for the audio output */
+struct aout_input_t
+{
+    /* When this lock is taken, the pipeline cannot be changed by a
+     * third-party. */
+    vlc_mutex_t             lock;
+
+    audio_sample_format_t   input;
+    aout_alloc_t            input_alloc;
+
+    /* pre-filters */
+    aout_filter_t *         pp_filters[AOUT_MAX_FILTERS];
+    int                     i_nb_filters;
+
+    aout_filter_t *         p_playback_rate_filter;
+
+    /* resamplers */
+    aout_filter_t *         pp_resamplers[AOUT_MAX_FILTERS];
+    int                     i_nb_resamplers;
+    int                     i_resampling_type;
+    mtime_t                 i_resamp_start_date;
+    int                     i_resamp_start_drift;
+
+    /* Mixer information */
+    audio_replay_gain_t     replay_gain;
+
+    /* If b_restart == 1, the input pipeline will be re-created. */
+    bool              b_restart;
+
+    /* If b_error == 1, there is no input pipeline. */
+    bool              b_error;
+
+    /* Did we just change the output format? (expect buffer inconsistencies) */
+    bool              b_changed;
+
+    /* last rate from input */
+    int               i_last_input_rate;
+
+    /* */
+    int               i_buffer_lost;
+
+    /* */
+    bool              b_paused;
+    mtime_t           i_pause_date;
+
+    /* */
+    bool                b_recycle_vout;
+    aout_request_vout_t request_vout;
+
+    /* */
+    aout_mixer_input_t mixer;
+ };
+
 /****************************************************************************
  * Prototypes
  *****************************************************************************/