]> git.sesse.net Git - vlc/blobdiff - include/audio_output.h
* ALL: More hooks for audio volume management.
[vlc] / include / audio_output.h
index addf857056a2b3d04d5b81a4e61562ecb695b3d9..bb1df6a2f9da8a93d548c375b5317286f24a4fbe 100644 (file)
@@ -2,7 +2,7 @@
  * audio_output.h : audio output interface
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: audio_output.h,v 1.58 2002/08/14 00:23:59 massiot Exp $
+ * $Id: audio_output.h,v 1.64 2002/09/18 21:21:23 massiot Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -32,7 +32,12 @@ struct audio_sample_format_t
     int                 i_rate;
     int                 i_channels;
     /* Optional - for A52, SPDIF and DTS types */
-    int                 i_bytes_per_sec;
+    int                 i_bytes_per_frame;
+    int                 i_frame_length;
+    /* Please note that it may be completely arbitrary - buffers are not
+     * obliged to contain a integral number of so-called "frames". It's
+     * just here for the division :
+     * i_nb_samples * i_bytes_per_frame / i_frame_length */
 };
 
 #define AOUT_FMT_MU_LAW     0x00000001
@@ -56,6 +61,12 @@ struct audio_sample_format_t
       && ((p_first)->i_channels == (p_second)->i_channels                   \
            || (p_first)->i_channels == -1 || (p_second)->i_channels == -1) )
 
+/* Check if i_rate == i_rate and i_channels == i_channels */
+#define AOUT_FMTS_SIMILAR( p_first, p_second ) (                            \
+    ((p_first)->i_rate == (p_second)->i_rate)                               \
+      && ((p_first)->i_channels == (p_second)->i_channels                   \
+           || (p_first)->i_channels == -1 || (p_second)->i_channels == -1) )
+
 #ifdef WORDS_BIGENDIAN
 #   define AOUT_FMT_S16_NE AOUT_FMT_S16_BE
 #   define AOUT_FMT_U16_NE AOUT_FMT_U16_BE
@@ -96,6 +107,35 @@ typedef s32 vlc_fixed_t;
 #define FIXED32_ONE ((vlc_fixed_t) 0x10000000)
 
 
+/* Dual mono. Two independant mono channels */
+#define AOUT_CHAN_CHANNEL   0x0000000B
+#define AOUT_CHAN_MONO      0x00000001
+#define AOUT_CHAN_STEREO    0x00000002
+/* 3 front channels (left, center, right) */
+#define AOUT_CHAN_3F        0x00000003
+/* 2 front, 1 rear surround channels (L, R, S) */
+#define AOUT_CHAN_2F1R      0x00000004
+/* 3 front, 1 rear surround channels (L, C, R, S) */
+#define AOUT_CHAN_3F1R      0x00000005
+/* 2 front, 2 rear surround channels (L, R, LS, RS) */
+#define AOUT_CHAN_2F2R      0x00000006
+/* 3 front, 2 rear surround channels (L, C, R, LS, RS) */
+#define AOUT_CHAN_3F2R      0x00000007
+/* First of two mono channels */
+#define AOUT_CHAN_CHANNEL1  0x00000008
+/* Second of two mono channels */
+#define AOUT_CHAN_CHANNEL2  0x00000009
+/* Dolby surround compatible stereo */
+#define AOUT_CHAN_DOLBY     0x0000000A
+
+#define AOUT_CHAN_MASK      0x0000000F
+
+/* Low frequency effects channel. Normally used to connect a subwoofer.
+ * Can be combined with any of the above channels. For example :
+ * AOUT_CHAN_3F2R | AOUT_CHAN_LFE -> 3 front, 2 rear, 1 LFE (5.1) */
+#define AOUT_CHAN_LFE       0x00000010
+
+
 /*****************************************************************************
  * aout_buffer_t : audio output buffer
  *****************************************************************************/
@@ -103,7 +143,7 @@ struct aout_buffer_t
 {
     byte_t *                p_buffer;
     int                     i_alloc_type;
-    /* i_size is the real size of the buffer (normally unused), i_nb_bytes
+    /* i_size is the real size of the buffer (used for debug ONLY), i_nb_bytes
      * is the number of significative bytes in it. */
     size_t                  i_size, i_nb_bytes;
     int                     i_nb_samples;
@@ -115,6 +155,16 @@ struct aout_buffer_t
 /* Size of a frame for S/PDIF output. */
 #define AOUT_SPDIF_SIZE 6144
 
+/*****************************************************************************
+ * audio_date_t : date incrementation without long-term rounding errors
+ *****************************************************************************/
+struct audio_date_t
+{
+    mtime_t date;
+    u32     i_divider;
+    u32     i_remainder;
+};
+
 /*****************************************************************************
  * Prototypes
  *****************************************************************************/
@@ -125,13 +175,21 @@ VLC_EXPORT( void,              aout_DeleteInstance, ( aout_instance_t * ) );
 VLC_EXPORT( aout_buffer_t *, aout_BufferNew, ( aout_instance_t *, aout_input_t *, size_t ) );
 VLC_EXPORT( void, aout_BufferDelete, ( aout_instance_t *, aout_input_t *, aout_buffer_t * ) );
 VLC_EXPORT( void, aout_BufferPlay, ( aout_instance_t *, aout_input_t *, aout_buffer_t * ) );
-VLC_EXPORT( int, aout_FormatToByterate, ( audio_sample_format_t * p_format ) );
+VLC_EXPORT( void, aout_DateInit, ( audio_date_t *, u32 ) );
+VLC_EXPORT( void, aout_DateSet, ( audio_date_t *, mtime_t ) );
+VLC_EXPORT( void, aout_DateMove, ( audio_date_t *, mtime_t ) );
+VLC_EXPORT( mtime_t, aout_DateGet, ( const audio_date_t * ) );
+VLC_EXPORT( mtime_t, aout_DateIncrement, ( audio_date_t *, u32 ) );
 
 /* From input.c : */
 #define aout_InputNew(a,b,c) __aout_InputNew(VLC_OBJECT(a),b,c)
 VLC_EXPORT( aout_input_t *, __aout_InputNew, ( vlc_object_t *, aout_instance_t **, audio_sample_format_t * ) );
 VLC_EXPORT( void, aout_InputDelete, ( aout_instance_t *, aout_input_t * ) );
 
-/* From output.c : */
-VLC_EXPORT( aout_buffer_t *, aout_OutputNextBuffer, ( aout_instance_t *, mtime_t ) );
+/* From intf.c : */
+VLC_EXPORT( int, aout_VolumeGet, ( aout_instance_t *, audio_volume_t * ) );
+VLC_EXPORT( int, aout_VolumeSet, ( aout_instance_t *, audio_volume_t ) );
+VLC_EXPORT( int, aout_VolumeInfos, ( aout_instance_t *, audio_volume_t *, audio_volume_t * ) );
+VLC_EXPORT( int, aout_VolumeUp, ( aout_instance_t *, int, audio_volume_t * ) );
+VLC_EXPORT( int, aout_VolumeDown, ( aout_instance_t *, int, audio_volume_t * ) );