summaryrefslogtreecommitdiff
path: root/src/xine-engine/audio_out.h
blob: 7836d357870f0661089f3fad0573993988f6f92e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
/* 
 * Copyright (C) 2000-2001 the xine project
 * 
 * This file is part of xine, a unix video player.
 * 
 * xine is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * xine is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * 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-1307, USA
 *
 * $Id: audio_out.h,v 1.4 2001/05/07 03:40:35 f1rmb Exp $
 */
#ifndef HAVE_AUDIO_OUT_H
#define HAVE_AUDIO_OUT_H

#include <inttypes.h>

#if defined(XINE_COMPILE)
#include "metronom.h"
#include "configfile.h"
#endif


#define AUDIO_OUT_IFACE_VERSION  1

/*
 * ao_functions_s contains the functions every audio output
 * driver plugin has to implement.
 */

typedef struct ao_functions_s ao_functions_t;

struct ao_functions_s {

  /* 
   *
   * find out what output modes + capatilities are supported by 
   * this plugin (constants for the bit vector to return see above)
   *
   * See AO_CAP_* bellow.
   */
  uint32_t (*get_capabilities) (ao_functions_t *this);

  /*
   * connect this driver to the xine engine
   */
  void (*connect) (ao_functions_t *this, metronom_t *metronom);

  /*
   * open the driver and make it ready to receive audio data 
   * buffers may be flushed(!)
   *
   * return value: <=0 : failure, 1 : ok
   */

  int (*open)(ao_functions_t *this, uint32_t bits, uint32_t rate, int mode);

  /*
   * write audio data to output buffer - may block
   * audio driver must sync sample playback with metronom
   */

  void (*write_audio_data)(ao_functions_t *this,
			   int16_t* audio_data, uint32_t num_samples, 
			   uint32_t pts);

  /*
   * this is called when the decoder no longer uses the audio
   * output driver - the driver should get ready to get opened() again
   */

  void (*close)(ao_functions_t *this);

  /*
   * shut down this audio output driver plugin and
   * free all resources allocated
   */

  void (*exit) (ao_functions_t *this);

  /*
   * Get, Set a property of audio driver.
   *
   * get_property() return 1 in success, 0 on failure.
   * set_property() return value on success, ~value on failure.
   *
   * See AC_PROP_* bellow for available properties.
   */
  int (*get_property) (ao_functions_t *this, int property);

  int (*set_property) (ao_functions_t *this,  int property, int value);

};


/*
 * to build a dynamic audio output plugin,
 * you have to implement these functions:
 *
 *
 * ao_functions_t *init_audio_out_plugin (config_values_t *config)
 *
 * init this plugin, check if device is available
 *
 * ao_info_t *get_audio_out_plugin_info ()
 *
 * peek at some (static) information about the plugin without initializing it
 *
 */

/*
 * audio output modes + capabilities
 */

#define AO_CAP_NOCAP            0x00000000 /* Driver have no capabilities  */
#define AO_CAP_MODE_AC3         0x00000001 /* Driver support AC3 output    */
#define AO_CAP_MODE_AC5         0x00000002 /* Driver support AC5 output    */
/* 1 sample ==  2 bytes */
#define AO_CAP_MODE_MONO        0x00000004 /* Driver support mono output   */
 /* 1 sample ==  4 bytes */
#define AO_CAP_MODE_STEREO      0x00000008 /* Driver support stereo output */
 /* 1 sample ==  8 bytes */
#define AO_CAP_MODE_4CHANNEL    0x00000010 /* Driver support 4 channels    */
/* 1 sample == 10 bytes */
#define AO_CAP_MODE_5CHANNEL    0x00000020 /* Driver support 5 channels    */
#define AO_CAP_MIXER_VOL        0x00000040 /* Driver support mixer control */
#define AO_CAP_PCM_VOL          0x00000080 /* Driver support pcm control   */
#define AO_CAP_MUTE_VOL         0x00000100 /* Driver can mute volume       */

/* properties supported by get/set_property() */
#define AO_PROP_MIXER_VOL       0
#define AO_PROP_PCM_VOL         1
#define AO_PROP_MUTE_VOL        2

typedef struct ao_info_s {

  int     interface_version;
  char   *id;
  char   *description;
  int     priority;
} ao_info_t ;

#endif