annotate Plugins/Input/cdaudio/cdaudio.h @ 1625:79891e2fd8a5 trunk

[svn] - use $(SHARED_SUFFIX) - use $(PICFLAGS) - use $(PICLDFLAGS)
author nenolod
date Wed, 06 Sep 2006 13:21:40 -0700
parents 705d4c089fce
children cc5952675fca
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1 /* XMMS - Cross-platform multimedia player
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
2 * Copyright (C) 1998-2002 Peter Alm, Mikael Alm, Olle Hallnas,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
3 * Thomas Nilsson and 4Front Technologies
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
4 * Copyright (C) 1999-2002 Haavard Kvaalen
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
5 *
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
6 * This program is free software; you can redistribute it and/or modify
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
9 * (at your option) any later version.
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
10 *
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
11 * This program is distributed in the hope that it will be useful,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
14 * GNU General Public License for more details.
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
15 *
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
17 * along with this program; if not, write to the Free Software
1459
705d4c089fce [svn] Fix postal code.
chainsaw
parents: 1458
diff changeset
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
19 */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
20 #ifndef CDAUDIO_H
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
21 #define CDAUDIO_H
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
22
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
23 #ifdef HAVE_CONFIG_H
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
24 # include "config.h"
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
25 #endif
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
26
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
27 #include <glib.h>
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
28 #include <gtk/gtk.h>
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
29 #include "audacious/plugin.h"
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
30
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
31 #include "cdinfo.h"
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
32
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
33 #ifdef HAVE_OSS
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
34 #include <Output/OSS/soundcard.h>
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
35 #endif
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
36
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
37 #ifdef HAVE_MNTENT_H
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
38 #include <mntent.h>
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
39 #endif
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
40
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
41 #ifdef HAVE_GETMNTINFO
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
42 #include <sys/param.h>
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
43 #include <sys/ucred.h>
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
44 #include <sys/mount.h>
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
45 #endif
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
46
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
47 #ifndef CD_FRAMES
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
48 #define CD_FRAMES 75
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
49 #endif
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
50
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
51 #include <sys/types.h>
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
52
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
53 #ifdef HAVE_LINUX_CDROM_H
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
54 #include <linux/cdrom.h>
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
55 #elif defined HAVE_SYS_CDIO_H
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
56 #include <sys/cdio.h>
419
2291caab50ca [svn] FreeBSD 6.x/7.x newata cdrio fixes. (I now have an ia32 box to work with ;))
nenolod
parents: 392
diff changeset
57 #include <sys/cdrio.h>
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
58 #endif
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
59
392
86c4cd37b812 [svn] Support for FreeBSD 6.x CD Audio DAE.
nenolod
parents: 61
diff changeset
60 #if defined(CDROMREADAUDIO) || defined(CDIOCREADAUDIO) || defined(CDROMCDDA) || defined(CDRIOCSETBLOCKSIZE)
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
61 # define CDDA_HAS_READAUDIO
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
62 #endif
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
63
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
64 #ifndef CD_FRAMESIZE_RAW
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
65 # define CD_FRAMESIZE_RAW 2352
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
66 #endif
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
67
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
68 /* Number of frames that are read at once in dae mode */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
69 #define CDDA_DAE_FRAMES 8
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
70
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
71 #ifndef CDDA_HAS_READAUDIO
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
72 #warning "Digital audio extraction has not been ported to this platform"
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
73 #define read_audio_data(fd, pos, num, buf) -1
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
74 #else
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
75 int read_audio_data(int fd, int pos, int num, void *buf);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
76 #endif
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
77
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
78
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
79 #ifdef __FreeBSD__
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
80 /*
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
81 * FreeBSD won't be able to detect media changes if using O_NONBLOCK
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
82 */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
83 #define CDOPENFLAGS O_RDONLY
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
84 #else
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
85 #define CDOPENFLAGS (O_RDONLY | O_NONBLOCK)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
86 #endif
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
87
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
88
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
89 #define CDDB_DEFAULT_SERVER "freedb.freedb.org"
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
90
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
91 struct driveinfo {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
92 gchar *device, *directory;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
93 gint mixer, oss_mixer;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
94 gboolean valid;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
95 gint dae;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
96 };
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
97
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
98 typedef struct {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
99 GList *drives;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
100
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
101 gchar *cddb_server;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
102 gint cddb_protocol_level;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
103 gboolean use_cddb;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
104
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
105 gchar *cdin_server;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
106 gboolean use_cdin;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
107
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
108 gboolean title_override;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
109 char *name_format;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
110 } CDDAConfig;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
111
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
112 struct cdda_msf {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
113 guint8 minute;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
114 guint8 second;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
115 guint8 frame;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
116 struct {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
117 guint data_track:1;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
118 } flags;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
119 };
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
120
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
121 /*
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
122 * Note: This macro will convert to a LBA representation of the MSF
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
123 * address, not to a true LBA address, as we don't subtract the offset
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
124 */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
125 #define LBA(msf) ((msf.minute * 60 + msf.second) * 75 + msf.frame)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
126
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
127 #define CDDA_MSF_OFFSET 150
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
128
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
129 typedef struct {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
130 guint8 first_track, last_track;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
131 struct cdda_msf leadout;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
132 struct cdda_msf track[100];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
133 } cdda_disc_toc_t;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
134
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
135 extern CDDAConfig cdda_cfg;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
136
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
137 enum {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
138 CDDA_MIXER_NONE,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
139 CDDA_MIXER_DRIVE,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
140 CDDA_MIXER_OSS,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
141 };
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
142
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
143 enum {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
144 CDDA_READ_ANALOG,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
145 CDDA_READ_DAE,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
146 };
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
147
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
148 void cdda_configure(void);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
149 gboolean cdda_get_toc(cdda_disc_toc_t * info, const gchar *device);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
150 guint32 cdda_cddb_compute_discid(cdda_disc_toc_t * info);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
151 void cdda_cddb_get_info(cdda_disc_toc_t * toc, cdinfo_t * info);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
152 void cdda_cdindex_get_idx(cdda_disc_toc_t * toc, cdinfo_t * cdinfo);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
153 struct driveinfo *cdda_find_drive(gchar *filename);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
154
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
155 void cdda_cddb_show_server_dialog(GtkWidget * w, gpointer data);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
156 void cdda_cddb_set_server(const gchar *new_server);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
157 void cddb_quit(void);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
158
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
159 #endif