1<programlisting>
2/*
3 * audio.h
4 *
5 * Copyright (C) 2000 Ralph  Metzler &lt;ralph@convergence.de&gt;
6 *                  &amp; Marcus Metzler &lt;marcus@convergence.de&gt;
7 *                    for convergence integrated media GmbH
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Lesser Public License
11 * as published by the Free Software Foundation; either version 2.1
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22 *
23 */
24
25#ifndef _DVBAUDIO_H_
26#define _DVBAUDIO_H_
27
28#include &lt;linux/types.h&gt;
29
30typedef enum {
31        AUDIO_SOURCE_DEMUX, /* Select the demux as the main source */
32        AUDIO_SOURCE_MEMORY /* Select internal memory as the main source */
33} <link linkend="audio-stream-source-t">audio_stream_source_t</link>;
34
35
36typedef enum {
37        AUDIO_STOPPED,      /* Device is stopped */
38        AUDIO_PLAYING,      /* Device is currently playing */
39        AUDIO_PAUSED        /* Device is paused */
40} <link linkend="audio-play-state-t">audio_play_state_t</link>;
41
42
43typedef enum {
44        AUDIO_STEREO,
45        AUDIO_MONO_LEFT,
46        AUDIO_MONO_RIGHT,
47        AUDIO_MONO,
48        AUDIO_STEREO_SWAPPED
49} <link linkend="audio-channel-select-t">audio_channel_select_t</link>;
50
51
52typedef struct <link linkend="audio-mixer">audio_mixer</link> {
53        unsigned int volume_left;
54        unsigned int volume_right;
55  // what else do we need? bass, pass-through, ...
56} <link linkend="audio-mixer">audio_mixer_t</link>;
57
58
59typedef struct <link linkend="audio-status">audio_status</link> {
60        int                    AV_sync_state;  /* sync audio and video? */
61        int                    mute_state;     /* audio is muted */
62        audio_play_state_t     play_state;     /* current playback state */
63        audio_stream_source_t  stream_source;  /* current stream source */
64        audio_channel_select_t channel_select; /* currently selected channel */
65        int                    bypass_mode;    /* pass on audio data to */
66        audio_mixer_t          mixer_state;    /* current mixer state */
67} <link linkend="audio-status">audio_status_t</link>;                              /* separate decoder hardware */
68
69
70typedef
71struct <link linkend="audio-karaoke">audio_karaoke</link> {  /* if Vocal1 or Vocal2 are non-zero, they get mixed  */
72        int vocal1;    /* into left and right t at 70% each */
73        int vocal2;    /* if both, Vocal1 and Vocal2 are non-zero, Vocal1 gets*/
74        int melody;    /* mixed into the left channel and */
75                       /* Vocal2 into the right channel at 100% each. */
76                       /* if Melody is non-zero, the melody channel gets mixed*/
77} <link linkend="audio-karaoke">audio_karaoke_t</link>;     /* into left and right  */
78
79
80typedef __u16 audio_attributes_t;
81/*   bits: descr. */
82/*   15-13 audio coding mode (0=ac3, 2=mpeg1, 3=mpeg2ext, 4=LPCM, 6=DTS, */
83/*   12    multichannel extension */
84/*   11-10 audio type (0=not spec, 1=language included) */
85/*    9- 8 audio application mode (0=not spec, 1=karaoke, 2=surround) */
86/*    7- 6 Quantization / DRC (mpeg audio: 1=DRC exists)(lpcm: 0=16bit,  */
87/*    5- 4 Sample frequency fs (0=48kHz, 1=96kHz) */
88/*    2- 0 number of audio channels (n+1 channels) */
89
90
91/* for GET_CAPABILITIES and SET_FORMAT, the latter should only set one bit */
92#define AUDIO_CAP_DTS    1
93#define AUDIO_CAP_LPCM   2
94#define AUDIO_CAP_MP1    4
95#define AUDIO_CAP_MP2    8
96#define AUDIO_CAP_MP3   16
97#define AUDIO_CAP_AAC   32
98#define AUDIO_CAP_OGG   64
99#define AUDIO_CAP_SDDS 128
100#define AUDIO_CAP_AC3  256
101
102#define <link linkend="AUDIO_STOP">AUDIO_STOP</link>                 _IO('o', 1)
103#define <link linkend="AUDIO_PLAY">AUDIO_PLAY</link>                 _IO('o', 2)
104#define <link linkend="AUDIO_PAUSE">AUDIO_PAUSE</link>                _IO('o', 3)
105#define <link linkend="AUDIO_CONTINUE">AUDIO_CONTINUE</link>             _IO('o', 4)
106#define <link linkend="AUDIO_SELECT_SOURCE">AUDIO_SELECT_SOURCE</link>        _IO('o', 5)
107#define <link linkend="AUDIO_SET_MUTE">AUDIO_SET_MUTE</link>             _IO('o', 6)
108#define <link linkend="AUDIO_SET_AV_SYNC">AUDIO_SET_AV_SYNC</link>          _IO('o', 7)
109#define <link linkend="AUDIO_SET_BYPASS_MODE">AUDIO_SET_BYPASS_MODE</link>      _IO('o', 8)
110#define <link linkend="AUDIO_CHANNEL_SELECT">AUDIO_CHANNEL_SELECT</link>       _IO('o', 9)
111#define <link linkend="AUDIO_GET_STATUS">AUDIO_GET_STATUS</link>           _IOR('o', 10, audio_status_t)
112
113#define <link linkend="AUDIO_GET_CAPABILITIES">AUDIO_GET_CAPABILITIES</link>     _IOR('o', 11, unsigned int)
114#define <link linkend="AUDIO_CLEAR_BUFFER">AUDIO_CLEAR_BUFFER</link>         _IO('o',  12)
115#define <link linkend="AUDIO_SET_ID">AUDIO_SET_ID</link>               _IO('o', 13)
116#define <link linkend="AUDIO_SET_MIXER">AUDIO_SET_MIXER</link>            _IOW('o', 14, audio_mixer_t)
117#define <link linkend="AUDIO_SET_STREAMTYPE">AUDIO_SET_STREAMTYPE</link>       _IO('o', 15)
118#define <link linkend="AUDIO_SET_EXT_ID">AUDIO_SET_EXT_ID</link>           _IO('o', 16)
119#define <link linkend="AUDIO_SET_ATTRIBUTES">AUDIO_SET_ATTRIBUTES</link>       _IOW('o', 17, audio_attributes_t)
120#define <link linkend="AUDIO_SET_KARAOKE">AUDIO_SET_KARAOKE</link>          _IOW('o', 18, audio_karaoke_t)
121
122/**
123 * AUDIO_GET_PTS
124 *
125 * Read the 33 bit presentation time stamp as defined
126 * in ITU T-REC-H.222.0 / ISO/IEC 13818-1.
127 *
128 * The PTS should belong to the currently played
129 * frame if possible, but may also be a value close to it
130 * like the PTS of the last decoded frame or the last PTS
131 * extracted by the PES parser.
132 */
133#define <link linkend="AUDIO_GET_PTS">AUDIO_GET_PTS</link>              _IOR('o', 19, __u64)
134#define <link linkend="AUDIO_BILINGUAL_CHANNEL_SELECT">AUDIO_BILINGUAL_CHANNEL_SELECT</link> _IO('o', 20)
135
136#endif /* _DVBAUDIO_H_ */
137</programlisting>
138