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