]> git.sesse.net Git - vlc/blobdiff - include/aout_internal.h
Re-enable random.
[vlc] / include / aout_internal.h
index 9cbc3feb77a57e7e7e4f64ebf14494a41ead0a62..a7f7c4b285bf795116f8441d48288c1ac2d9c368 100644 (file)
@@ -1,8 +1,8 @@
 /*****************************************************************************
  * aout_internal.h : internal defines for audio output
  *****************************************************************************
- * Copyright (C) 2002 VideoLAN
- * $Id: aout_internal.h,v 1.39 2003/03/04 03:27:40 gbazin Exp $
+ * Copyright (C) 2002 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.
  *****************************************************************************/
 
 /*****************************************************************************
@@ -34,11 +34,16 @@ typedef struct aout_alloc_t
 #define AOUT_ALLOC_STACK    1
 #define AOUT_ALLOC_HEAP     2
 
+#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
@@ -53,16 +58,17 @@ typedef struct aout_alloc_t
     }                                                                       \
     else                                                                    \
     {                                                                       \
-        int i_alloc_size;                                                   \
+        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 = (p_alloc)->i_alloc_type;         \
+            (p_new_buffer)->i_alloc_type = i_alloc_type;                    \
             (p_new_buffer)->i_size = i_alloc_size;                          \
             (p_new_buffer)->p_buffer = (byte_t *)(p_new_buffer)             \
                                          + sizeof(aout_buffer_t);           \
@@ -79,10 +85,11 @@ typedef struct aout_alloc_t
     }
 
 #define aout_BufferFree( p_buffer )                                         \
-    if ( (p_buffer)->i_alloc_type == AOUT_ALLOC_HEAP )                      \
+    if( p_buffer != NULL && (p_buffer)->i_alloc_type == AOUT_ALLOC_HEAP )   \
     {                                                                       \
         free( p_buffer );                                                   \
-    }
+    }                                                                       \
+    p_buffer = NULL;
 
 /*****************************************************************************
  * aout_fifo_t : audio output buffer FIFO
@@ -97,7 +104,7 @@ struct aout_fifo_t
 /*****************************************************************************
  * aout_filter_t : audio output filter
  *****************************************************************************/
-typedef struct aout_filter_t
+struct aout_filter_t
 {
     VLC_COMMON_MEMBERS
 
@@ -113,7 +120,7 @@ typedef struct aout_filter_t
                                          struct aout_buffer_t * );
     vlc_bool_t              b_in_place;
     vlc_bool_t              b_continuity;
-} aout_filter_t;
+};
 
 /*****************************************************************************
  * aout_mixer_t : audio output mixer
@@ -148,6 +155,9 @@ struct aout_input_t
      * third-party. */
     vlc_mutex_t             lock;
 
+    /* The input thread that spawned this input */
+    input_thread_t         *p_input_thread;
+
     audio_sample_format_t   input;
     aout_alloc_t            input_alloc;
 
@@ -167,10 +177,20 @@ struct aout_input_t
     /* Mixer information */
     byte_t *                p_first_byte_to_mix;
 
+    /* If b_restart == 1, the input pipeline will be re-created. */
+    vlc_bool_t              b_restart;
+
     /* If b_error == 1, there is no input pipeline. */
     vlc_bool_t              b_error;
-    /* Did we just change the output format ? (expect buffer inconsistencies) */
+
+    /* Did we just change the output format? (expect buffer inconsistencies) */
     vlc_bool_t              b_changed;
+
+    /* internal caching delay from input */
+    int                     i_pts_delay;
+    /* desynchronisation delay request by the user */
+    int                     i_desync;
+
 };
 
 /*****************************************************************************
@@ -248,20 +268,10 @@ int aout_InputPlay( aout_instance_t * p_aout, aout_input_t * p_input,
                     aout_buffer_t * p_buffer );
 
 /* From filters.c : */
-int aout_FiltersCreatePipeline( aout_instance_t * p_aout,
-                                aout_filter_t ** pp_filters,
-                                int * pi_nb_filters,
-                                const audio_sample_format_t * p_input_format,
-                                const audio_sample_format_t * p_output_format );
-void aout_FiltersDestroyPipeline( aout_instance_t * p_aout,
-                                  aout_filter_t ** pp_filters,
-                                  int i_nb_filters );
-void aout_FiltersHintBuffers( aout_instance_t * p_aout,
-                              aout_filter_t ** pp_filters,
-                              int i_nb_filters, aout_alloc_t * p_first_alloc );
-void aout_FiltersPlay( aout_instance_t * p_aout,
-                       aout_filter_t ** pp_filters,
-                       int i_nb_filters, aout_buffer_t ** pp_input_buffer );
+VLC_EXPORT( int, aout_FiltersCreatePipeline, ( aout_instance_t * p_aout, aout_filter_t ** pp_filters, int * pi_nb_filters, const audio_sample_format_t * p_input_format, const audio_sample_format_t * p_output_format ) );
+VLC_EXPORT( void, aout_FiltersDestroyPipeline, ( aout_instance_t * p_aout, aout_filter_t ** pp_filters, int i_nb_filters ) );
+VLC_EXPORT( void, aout_FiltersPlay, ( aout_instance_t * p_aout, aout_filter_t ** pp_filters, int i_nb_filters, aout_buffer_t ** pp_input_buffer ) );
+void aout_FiltersHintBuffers( aout_instance_t * p_aout, aout_filter_t ** pp_filters, int i_nb_filters, aout_alloc_t * p_first_alloc );
 
 /* From mixer.c : */
 int aout_MixerNew( aout_instance_t * p_aout );