annotate Plugins/Input/cdaudio/cdaudio.h @ 61:fa848bd484d8 trunk

[svn] Move plugins to Plugins/
author nenolod
date Fri, 28 Oct 2005 22:58:11 -0700
parents
children 86c4cd37b812
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
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
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>
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
57 #endif
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
58
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
59 #if defined(CDROMREADAUDIO) || defined(CDIOCREADAUDIO) || defined(CDROMCDDA)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
60 # define CDDA_HAS_READAUDIO
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
61 #endif
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
62
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
63 #ifndef CD_FRAMESIZE_RAW
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
64 # define CD_FRAMESIZE_RAW 2352
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
65 #endif
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
66
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
67 /* Number of frames that are read at once in dae mode */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
68 #define CDDA_DAE_FRAMES 8
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
69
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
70 #ifndef CDDA_HAS_READAUDIO
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
71 #warning "Digital audio extraction has not been ported to this platform"
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
72 #define read_audio_data(fd, pos, num, buf) -1
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
73 #else
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
74 int read_audio_data(int fd, int pos, int num, void *buf);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
75 #endif
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
76
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
77
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
78 #ifdef __FreeBSD__
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
79 /*
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
80 * FreeBSD won't be able to detect media changes if using O_NONBLOCK
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
81 */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
82 #define CDOPENFLAGS O_RDONLY
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
83 #else
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
84 #define CDOPENFLAGS (O_RDONLY | O_NONBLOCK)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
85 #endif
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
86
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
87
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
88 #define CDDB_DEFAULT_SERVER "freedb.freedb.org"
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
89
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
90 struct driveinfo {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
91 gchar *device, *directory;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
92 gint mixer, oss_mixer;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
93 gboolean valid;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
94 gint dae;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
95 };
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
96
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
97 typedef struct {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
98 GList *drives;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
99
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
100 gchar *cddb_server;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
101 gint cddb_protocol_level;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
102 gboolean use_cddb;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
103
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
104 gchar *cdin_server;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
105 gboolean use_cdin;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
106
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
107 gboolean title_override;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
108 char *name_format;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
109 } CDDAConfig;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
110
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
111 struct cdda_msf {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
112 guint8 minute;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
113 guint8 second;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
114 guint8 frame;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
115 struct {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
116 guint data_track:1;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
117 } flags;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
118 };
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 * Note: This macro will convert to a LBA representation of the MSF
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
122 * address, not to a true LBA address, as we don't subtract the offset
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
123 */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
124 #define LBA(msf) ((msf.minute * 60 + msf.second) * 75 + msf.frame)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
125
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
126 #define CDDA_MSF_OFFSET 150
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
127
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
128 typedef struct {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
129 guint8 first_track, last_track;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
130 struct cdda_msf leadout;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
131 struct cdda_msf track[100];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
132 } cdda_disc_toc_t;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
133
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
134 extern CDDAConfig cdda_cfg;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
135
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
136 enum {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
137 CDDA_MIXER_NONE,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
138 CDDA_MIXER_DRIVE,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
139 CDDA_MIXER_OSS,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
140 };
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
141
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
142 enum {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
143 CDDA_READ_ANALOG,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
144 CDDA_READ_DAE,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
145 };
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
146
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
147 void cdda_configure(void);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
148 gboolean cdda_get_toc(cdda_disc_toc_t * info, const gchar *device);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
149 guint32 cdda_cddb_compute_discid(cdda_disc_toc_t * info);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
150 void cdda_cddb_get_info(cdda_disc_toc_t * toc, cdinfo_t * info);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
151 void cdda_cdindex_get_idx(cdda_disc_toc_t * toc, cdinfo_t * cdinfo);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
152 struct driveinfo *cdda_find_drive(gchar *filename);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
153
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
154 void cdda_cddb_show_server_dialog(GtkWidget * w, gpointer data);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
155 void cdda_cddb_set_server(const gchar *new_server);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
156 void cddb_quit(void);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
157
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
158 #endif