annotate src/sndfile/plugin.c @ 2551:92300fe06f15

Cosmetic cleanups / indentation.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 08 May 2008 21:56:41 +0300
parents 6fdb69f0f169
children 7d7f7d9ae98e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2303
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
1 /* Audacious - Cross-platform multimedia player
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
2 * Copyright (C) 2005 Audacious development team.
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
3 *
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
4 * Based on the xmms_sndfile input plugin:
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
5 * Copyright (C) 2000, 2002 Erik de Castro Lopo
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
6 *
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
7 * This program is free software; you can redistribute it and/or modify
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
8 * it under the terms of the GNU General Public License as published by
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
10 * (at your option) any later version.
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
11 *
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful,
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
15 * GNU General Public License for more details.
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
16 *
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
18 * along with this program; if not, write to the Free Software
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
20 */
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
21
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
22 /*
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
23 * Rewritten 17-Feb-2007 (nenolod):
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
24 * - now uses conditional variables to ensure that sndfile mutex is
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
25 * entirely protected.
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
26 * - pausing works now
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
27 * - fixed some potential race conditions when dealing with NFS.
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
28 * - TITLE_LEN removed
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
29 */
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
30
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
31 #include "config.h"
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
32
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
33 #include <glib.h>
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
34 #include <string.h>
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
35 #include <math.h>
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
36
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
37 #include <audacious/plugin.h>
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
38 #include <audacious/util.h>
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
39 #include <audacious/i18n.h>
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
40 #include <audacious/output.h>
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
41 #include "plugin.h"
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
42
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
43 #include <sndfile.h>
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
44
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
45 static SNDFILE *sndfile = NULL;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
46 static SF_INFO sfinfo;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
47
2550
6fdb69f0f169 Use Glib types.
Matti Hamalainen <ccr@tnsp.org>
parents: 2549
diff changeset
48 static gint song_length;
6fdb69f0f169 Use Glib types.
Matti Hamalainen <ccr@tnsp.org>
parents: 2549
diff changeset
49 static gint bit_rate = 0;
2303
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
50 static glong seek_time = -1;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
51
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
52 static GThread *decode_thread;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
53 static GMutex *decode_mutex;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
54 static GCond *decode_cond;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
55
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
56
2551
92300fe06f15 Cosmetic cleanups / indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 2550
diff changeset
57 static sf_count_t
92300fe06f15 Cosmetic cleanups / indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 2550
diff changeset
58 sf_get_filelen (void *user_data)
2303
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
59 {
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
60 return aud_vfs_fsize (user_data);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
61 }
2551
92300fe06f15 Cosmetic cleanups / indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 2550
diff changeset
62
92300fe06f15 Cosmetic cleanups / indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 2550
diff changeset
63 static sf_count_t
92300fe06f15 Cosmetic cleanups / indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 2550
diff changeset
64 sf_vseek (sf_count_t offset, int whence, void *user_data)
2303
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
65 {
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
66 return aud_vfs_fseek(user_data, offset, whence);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
67 }
2551
92300fe06f15 Cosmetic cleanups / indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 2550
diff changeset
68
92300fe06f15 Cosmetic cleanups / indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 2550
diff changeset
69 static sf_count_t
92300fe06f15 Cosmetic cleanups / indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 2550
diff changeset
70 sf_vread (void *ptr, sf_count_t count, void *user_data)
2303
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
71 {
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
72 return aud_vfs_fread(ptr, 1, count, user_data);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
73 }
2551
92300fe06f15 Cosmetic cleanups / indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 2550
diff changeset
74
92300fe06f15 Cosmetic cleanups / indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 2550
diff changeset
75 static sf_count_t
92300fe06f15 Cosmetic cleanups / indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 2550
diff changeset
76 sf_vwrite (const void *ptr, sf_count_t count, void *user_data)
2303
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
77 {
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
78 return aud_vfs_fwrite(ptr, 1, count, user_data);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
79 }
2551
92300fe06f15 Cosmetic cleanups / indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 2550
diff changeset
80
92300fe06f15 Cosmetic cleanups / indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 2550
diff changeset
81 static sf_count_t
92300fe06f15 Cosmetic cleanups / indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 2550
diff changeset
82 sf_tell (void *user_data)
2303
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
83 {
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
84 return aud_vfs_ftell(user_data);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
85 }
2551
92300fe06f15 Cosmetic cleanups / indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 2550
diff changeset
86
2303
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
87 static SF_VIRTUAL_IO sf_virtual_io =
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
88 {
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
89 sf_get_filelen,
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
90 sf_vseek,
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
91 sf_vread,
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
92 sf_vwrite,
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
93 sf_tell
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
94 };
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
95
2551
92300fe06f15 Cosmetic cleanups / indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 2550
diff changeset
96
2303
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
97 static SNDFILE *
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
98 open_sndfile_from_uri(gchar *filename, VFSFile *vfsfile, SF_INFO *tmp_sfinfo)
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
99 {
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
100 SNDFILE *snd_file = NULL;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
101 vfsfile = aud_vfs_fopen(filename, "rb");
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
102
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
103 if (vfsfile == NULL)
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
104 return NULL;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
105
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
106 snd_file = sf_open_virtual (&sf_virtual_io, SFM_READ, tmp_sfinfo, vfsfile);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
107 if (snd_file == NULL)
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
108 aud_vfs_fclose(vfsfile);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
109
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
110 return snd_file;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
111 }
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
112
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
113 static void
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
114 close_sndfile(SNDFILE *snd_file, VFSFile *vfsfile)
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
115 {
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
116 sf_close(snd_file);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
117 aud_vfs_fclose(vfsfile);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
118 }
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
119
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
120
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
121 static void
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
122 plugin_init (void)
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
123 {
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
124 seek_time = -1;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
125
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
126 decode_mutex = g_mutex_new();
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
127 decode_cond = g_cond_new();
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
128 }
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
129
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
130 static void
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
131 plugin_cleanup (void)
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
132 {
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
133 g_cond_free(decode_cond);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
134 g_mutex_free(decode_mutex);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
135 }
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
136
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
137 static void
2550
6fdb69f0f169 Use Glib types.
Matti Hamalainen <ccr@tnsp.org>
parents: 2549
diff changeset
138 fill_song_tuple (gchar *filename, Tuple *ti)
2303
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
139 {
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
140 VFSFile *vfsfile = NULL;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
141 SNDFILE *tmp_sndfile;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
142 SF_INFO tmp_sfinfo;
2550
6fdb69f0f169 Use Glib types.
Matti Hamalainen <ccr@tnsp.org>
parents: 2549
diff changeset
143 guint lossy = 0;
2303
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
144 gchar *codec = NULL, *format, *subformat = NULL;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
145 GString *codec_gs = NULL;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
146
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
147 tmp_sndfile = open_sndfile_from_uri(filename, vfsfile, &tmp_sfinfo);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
148 if ( sf_get_string(tmp_sndfile, SF_STR_TITLE) == NULL)
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
149 aud_tuple_associate_string(ti, FIELD_TITLE, NULL, g_path_get_basename(filename));
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
150 else
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
151 aud_tuple_associate_string(ti, FIELD_TITLE, NULL, sf_get_string(tmp_sndfile, SF_STR_TITLE));
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
152
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
153 aud_tuple_associate_string(ti, FIELD_ARTIST, NULL, sf_get_string(tmp_sndfile, SF_STR_ARTIST));
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
154 aud_tuple_associate_string(ti, FIELD_COMMENT, NULL, sf_get_string(tmp_sndfile, SF_STR_COMMENT));
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
155 aud_tuple_associate_string(ti, FIELD_DATE, NULL, sf_get_string(tmp_sndfile, SF_STR_DATE));
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
156 aud_tuple_associate_string(ti, -1, "software", sf_get_string(tmp_sndfile, SF_STR_SOFTWARE));
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
157
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
158 if (!tmp_sndfile)
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
159 return;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
160
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
161 close_sndfile (tmp_sndfile, vfsfile);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
162 tmp_sndfile = NULL;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
163
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
164 if (tmp_sfinfo.samplerate > 0)
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
165 aud_tuple_associate_int(ti, FIELD_LENGTH, NULL, (int) ceil (1000.0 * tmp_sfinfo.frames / tmp_sfinfo.samplerate));
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
166
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
167 switch (tmp_sfinfo.format & SF_FORMAT_TYPEMASK)
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
168 {
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
169 case SF_FORMAT_WAV:
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
170 case SF_FORMAT_WAVEX:
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
171 format = "Microsoft WAV";
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
172 break;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
173 case SF_FORMAT_AIFF:
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
174 format = "Apple/SGI AIFF";
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
175 break;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
176 case SF_FORMAT_AU:
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
177 format = "Sun/NeXT AU";
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
178 break;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
179 case SF_FORMAT_RAW:
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
180 format = "Raw PCM data";
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
181 break;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
182 case SF_FORMAT_PAF:
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
183 format = "Ensoniq PARIS";
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
184 break;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
185 case SF_FORMAT_SVX:
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
186 format = "Amiga IFF / SVX8 / SV16";
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
187 break;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
188 case SF_FORMAT_NIST:
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
189 format = "Sphere NIST";
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
190 break;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
191 case SF_FORMAT_VOC:
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
192 format = "Creative VOC";
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
193 break;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
194 case SF_FORMAT_IRCAM:
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
195 format = "Berkeley/IRCAM/CARL";
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
196 break;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
197 case SF_FORMAT_W64:
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
198 format = "Sonic Foundry's 64 bit RIFF/WAV";
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
199 break;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
200 case SF_FORMAT_MAT4:
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
201 format = "Matlab (tm) V4.2 / GNU Octave 2.0";
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
202 break;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
203 case SF_FORMAT_MAT5:
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
204 format = "Matlab (tm) V5.0 / GNU Octave 2.1";
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
205 break;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
206 case SF_FORMAT_PVF:
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
207 format = "Portable Voice Format";
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
208 break;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
209 case SF_FORMAT_XI:
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
210 format = "Fasttracker 2 Extended Instrument";
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
211 break;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
212 case SF_FORMAT_HTK:
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
213 format = "HMM Tool Kit";
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
214 break;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
215 case SF_FORMAT_SDS:
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
216 format = "Midi Sample Dump Standard";
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
217 break;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
218 case SF_FORMAT_AVR:
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
219 format = "Audio Visual Research";
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
220 break;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
221 case SF_FORMAT_SD2:
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
222 format = "Sound Designer 2";
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
223 break;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
224 case SF_FORMAT_FLAC:
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
225 format = "Free Lossless Audio Codec";
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
226 break;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
227 case SF_FORMAT_CAF:
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
228 format = "Core Audio File";
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
229 break;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
230 default:
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
231 format = "unknown sndfile";
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
232 }
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
233 switch (tmp_sfinfo.format & SF_FORMAT_SUBMASK)
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
234 {
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
235 case SF_FORMAT_PCM_S8:
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
236 subformat = "signed 8 bit";
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
237 break;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
238 case SF_FORMAT_PCM_16:
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
239 subformat = "signed 16 bit";
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
240 break;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
241 case SF_FORMAT_PCM_24:
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
242 subformat = "signed 24 bit";
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
243 break;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
244 case SF_FORMAT_PCM_32:
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
245 subformat = "signed 32 bit";
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
246 break;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
247 case SF_FORMAT_PCM_U8:
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
248 subformat = "unsigned 8 bit";
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
249 break;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
250 case SF_FORMAT_FLOAT:
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
251 subformat = "32 bit float";
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
252 break;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
253 case SF_FORMAT_DOUBLE:
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
254 subformat = "64 bit float";
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
255 break;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
256 case SF_FORMAT_ULAW:
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
257 subformat = "U-Law";
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
258 lossy = 1;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
259 break;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
260 case SF_FORMAT_ALAW:
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
261 subformat = "A-Law";
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
262 lossy = 1;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
263 break;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
264 case SF_FORMAT_IMA_ADPCM:
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
265 subformat = "IMA ADPCM";
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
266 lossy = 1;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
267 break;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
268 case SF_FORMAT_MS_ADPCM:
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
269 subformat = "MS ADPCM";
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
270 lossy = 1;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
271 break;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
272 case SF_FORMAT_GSM610:
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
273 subformat = "GSM 6.10";
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
274 lossy = 1;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
275 break;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
276 case SF_FORMAT_VOX_ADPCM:
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
277 subformat = "Oki Dialogic ADPCM";
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
278 lossy = 1;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
279 break;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
280 case SF_FORMAT_G721_32:
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
281 subformat = "32kbs G721 ADPCM";
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
282 lossy = 1;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
283 break;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
284 case SF_FORMAT_G723_24:
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
285 subformat = "24kbs G723 ADPCM";
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
286 lossy = 1;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
287 break;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
288 case SF_FORMAT_G723_40:
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
289 subformat = "40kbs G723 ADPCM";
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
290 lossy = 1;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
291 break;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
292 case SF_FORMAT_DWVW_12:
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
293 subformat = "12 bit Delta Width Variable Word";
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
294 lossy = 1;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
295 break;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
296 case SF_FORMAT_DWVW_16:
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
297 subformat = "16 bit Delta Width Variable Word";
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
298 lossy = 1;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
299 break;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
300 case SF_FORMAT_DWVW_24:
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
301 subformat = "24 bit Delta Width Variable Word";
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
302 lossy = 1;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
303 break;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
304 case SF_FORMAT_DWVW_N:
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
305 subformat = "N bit Delta Width Variable Word";
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
306 lossy = 1;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
307 break;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
308 case SF_FORMAT_DPCM_8:
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
309 subformat = "8 bit differential PCM";
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
310 break;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
311 case SF_FORMAT_DPCM_16:
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
312 subformat = "16 bit differential PCM";
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
313 }
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
314
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
315 codec_gs = g_string_new("");
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
316 if (subformat != NULL)
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
317 g_string_append_printf(codec_gs, "%s (%s)", format, subformat);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
318 else
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
319 g_string_append_printf(codec_gs, "%s", format);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
320 codec = g_strdup(codec_gs->str);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
321 g_string_free(codec_gs, TRUE);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
322 aud_tuple_associate_string(ti, FIELD_CODEC, NULL, codec);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
323
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
324 if (lossy != 0)
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
325 aud_tuple_associate_string(ti, FIELD_QUALITY, NULL, "lossy");
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
326 else
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
327 aud_tuple_associate_string(ti, FIELD_QUALITY, NULL, "lossless");
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
328 }
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
329
2551
92300fe06f15 Cosmetic cleanups / indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 2550
diff changeset
330 static gchar *
92300fe06f15 Cosmetic cleanups / indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 2550
diff changeset
331 get_title(gchar *filename)
2303
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
332 {
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
333 Tuple *tuple;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
334 gchar *title;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
335
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
336 tuple = aud_tuple_new_from_filename(filename);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
337 fill_song_tuple(filename, tuple);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
338 title = aud_tuple_formatter_make_title_string(tuple, aud_get_gentitle_format());
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
339 if (*title == '\0')
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
340 {
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
341 g_free(title);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
342 title = g_strdup(aud_tuple_get_string(tuple, FIELD_FILE_NAME, NULL));
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
343 }
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
344
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
345 aud_tuple_free(tuple);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
346 return title;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
347 }
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
348
2550
6fdb69f0f169 Use Glib types.
Matti Hamalainen <ccr@tnsp.org>
parents: 2549
diff changeset
349 static gint
6fdb69f0f169 Use Glib types.
Matti Hamalainen <ccr@tnsp.org>
parents: 2549
diff changeset
350 is_our_file (gchar *filename)
2303
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
351 {
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
352 VFSFile *vfsfile = NULL;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
353 SNDFILE *tmp_sndfile;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
354 SF_INFO tmp_sfinfo;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
355
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
356 /* Have to open the file to see if libsndfile can handle it. */
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
357 tmp_sndfile = open_sndfile_from_uri(filename, vfsfile, &tmp_sfinfo);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
358
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
359 if (!tmp_sndfile) {
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
360 return FALSE;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
361 }
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
362
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
363 /* It can so close file and return TRUE. */
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
364 close_sndfile (tmp_sndfile, vfsfile);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
365 tmp_sndfile = NULL;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
366
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
367 return TRUE;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
368 }
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
369
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
370 static gpointer
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
371 play_loop (gpointer arg)
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
372 {
2550
6fdb69f0f169 Use Glib types.
Matti Hamalainen <ccr@tnsp.org>
parents: 2549
diff changeset
373 static gshort buffer[BUFFER_SIZE];
6fdb69f0f169 Use Glib types.
Matti Hamalainen <ccr@tnsp.org>
parents: 2549
diff changeset
374 gint samples;
2303
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
375 InputPlayback *playback = arg;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
376
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
377 for (;;)
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
378 {
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
379 GTimeVal sleeptime;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
380
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
381 /* sf_read_short will return 0 for all reads at EOF. */
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
382 samples = sf_read_short (sndfile, buffer, BUFFER_SIZE);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
383
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
384 if (samples > 0 && playback->playing == TRUE) {
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
385 while ((playback->output->buffer_free () < samples) &&
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
386 playback->playing == TRUE) {
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
387 g_get_current_time(&sleeptime);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
388 g_time_val_add(&sleeptime, 500000);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
389 g_mutex_lock(decode_mutex);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
390 g_cond_timed_wait(decode_cond, decode_mutex, &sleeptime);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
391 g_mutex_unlock(decode_mutex);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
392
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
393 if (playback->playing == FALSE)
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
394 break;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
395 }
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
396
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
397 playback->pass_audio(playback, FMT_S16_NE, sfinfo.channels,
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
398 samples * sizeof (short), buffer, &playback->playing);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
399 }
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
400 else {
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
401 while(playback->output->buffer_playing()) {
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
402 g_get_current_time(&sleeptime);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
403 g_time_val_add(&sleeptime, 500000);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
404 g_mutex_lock(decode_mutex);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
405 g_cond_timed_wait(decode_cond, decode_mutex, &sleeptime);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
406 g_mutex_unlock(decode_mutex);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
407
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
408 if(playback->playing == FALSE)
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
409 break;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
410 }
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
411
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
412 playback->eof = TRUE;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
413 playback->playing = FALSE;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
414
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
415 g_mutex_unlock(decode_mutex);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
416 break;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
417 }
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
418
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
419 /* Do seek if seek_time is valid. */
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
420 if (seek_time >= 0) {
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
421 sf_seek (sndfile, (sf_count_t)((gint64)seek_time * (gint64)sfinfo.samplerate / 1000L),
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
422 SEEK_SET);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
423 playback->output->flush (seek_time);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
424 seek_time = -1;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
425 }
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
426
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
427 if (playback->playing == FALSE)
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
428 break;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
429 }
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
430
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
431 sf_close (sndfile);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
432 sndfile = NULL;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
433 seek_time = -1;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
434
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
435 playback->output->close_audio();
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
436
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
437 return NULL;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
438 }
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
439
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
440 static void
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
441 play_start (InputPlayback *playback)
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
442 {
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
443 VFSFile *vfsfile = NULL;
2550
6fdb69f0f169 Use Glib types.
Matti Hamalainen <ccr@tnsp.org>
parents: 2549
diff changeset
444 gint pcmbitwidth;
2303
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
445 gchar *song_title;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
446
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
447 if (sndfile) /* already opened */
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
448 return;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
449
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
450 pcmbitwidth = 32;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
451 song_title = get_title(playback->filename);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
452
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
453 sndfile = open_sndfile_from_uri(playback->filename, vfsfile, &sfinfo);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
454
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
455 if (!sndfile)
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
456 return;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
457
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
458 bit_rate = sfinfo.samplerate * pcmbitwidth;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
459
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
460 if (sfinfo.samplerate > 0)
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
461 song_length = (int) ceil (1000.0 * sfinfo.frames / sfinfo.samplerate);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
462 else
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
463 song_length = 0;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
464
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
465 if (! playback->output->open_audio (FMT_S16_NE, sfinfo.samplerate, sfinfo.channels))
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
466 {
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
467 close_sndfile (sndfile, vfsfile);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
468 sndfile = NULL;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
469 return;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
470 }
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
471
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
472 playback->set_params(playback, song_title, song_length, bit_rate, sfinfo.samplerate, sfinfo.channels);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
473 g_free (song_title);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
474
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
475 playback->playing = TRUE;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
476
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
477 decode_thread = g_thread_self();
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
478 playback->set_pb_ready(playback);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
479 play_loop(playback);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
480 }
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
481
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
482 static void
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
483 play_pause (InputPlayback *playback, gshort p)
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
484 {
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
485 playback->output->pause(p);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
486 }
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
487
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
488 static void
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
489 play_stop (InputPlayback *playback)
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
490 {
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
491 if (decode_thread == NULL)
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
492 return;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
493
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
494 g_mutex_lock(decode_mutex);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
495 playback->playing = FALSE;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
496 g_mutex_unlock(decode_mutex);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
497 g_cond_signal(decode_cond);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
498
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
499 g_thread_join (decode_thread);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
500
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
501 sndfile = NULL;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
502 decode_thread = NULL;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
503 seek_time = -1;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
504 }
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
505
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
506 static void
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
507 file_mseek (InputPlayback *playback, gulong millisecond)
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
508 {
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
509 if (! sfinfo.seekable)
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
510 return;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
511
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
512 seek_time = (glong)millisecond;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
513
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
514 while (seek_time != -1)
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
515 g_usleep (80000);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
516 }
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
517
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
518 static void
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
519 file_seek (InputPlayback *playback, gint time)
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
520 {
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
521 gulong millisecond = time * 1000;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
522 file_mseek(playback, millisecond);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
523 }
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
524
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
525 static Tuple*
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
526 get_song_tuple (gchar *filename)
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
527 {
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
528 Tuple *ti = aud_tuple_new_from_filename(filename);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
529 fill_song_tuple(filename, ti);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
530 return ti;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
531 }
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
532
2551
92300fe06f15 Cosmetic cleanups / indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 2550
diff changeset
533 static gint
92300fe06f15 Cosmetic cleanups / indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 2550
diff changeset
534 is_our_file_from_vfs(gchar *filename, VFSFile *fin)
2303
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
535 {
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
536 SNDFILE *tmp_sndfile;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
537 SF_INFO tmp_sfinfo;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
538
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
539 /* Have to open the file to see if libsndfile can handle it. */
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
540 tmp_sndfile = sf_open_virtual (&sf_virtual_io, SFM_READ, &tmp_sfinfo, fin);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
541
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
542 if (!tmp_sndfile)
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
543 return FALSE;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
544
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
545 /* It can so close file and return TRUE. */
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
546 sf_close (tmp_sndfile);
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
547 tmp_sndfile = NULL;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
548
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
549 return TRUE;
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
550 }
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
551
2549
f6efe94f2793 Fix uninitialied GtkWidget variable in about box creation.
Matti Hamalainen <ccr@tnsp.org>
parents: 2500
diff changeset
552 static GtkWidget *sndfile_about_box = NULL;
f6efe94f2793 Fix uninitialied GtkWidget variable in about box creation.
Matti Hamalainen <ccr@tnsp.org>
parents: 2500
diff changeset
553
2303
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
554 static void plugin_about(void)
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
555 {
2549
f6efe94f2793 Fix uninitialied GtkWidget variable in about box creation.
Matti Hamalainen <ccr@tnsp.org>
parents: 2500
diff changeset
556 if (!sndfile_about_box)
2303
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
557 {
2551
92300fe06f15 Cosmetic cleanups / indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 2550
diff changeset
558 sndfile_about_box = audacious_info_dialog(
92300fe06f15 Cosmetic cleanups / indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 2550
diff changeset
559 _("About sndfile plugin"),
92300fe06f15 Cosmetic cleanups / indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 2550
diff changeset
560 _("Adapted for Audacious usage by Tony Vroon <chainsaw@gentoo.org>\n"
92300fe06f15 Cosmetic cleanups / indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 2550
diff changeset
561 "from the xmms_sndfile plugin which is:\n"
92300fe06f15 Cosmetic cleanups / indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 2550
diff changeset
562 "Copyright (C) 2000, 2002 Erik de Castro Lopo\n\n"
92300fe06f15 Cosmetic cleanups / indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 2550
diff changeset
563 "This program is free software ; you can redistribute it and/or modify \n"
92300fe06f15 Cosmetic cleanups / indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 2550
diff changeset
564 "it under the terms of the GNU General Public License as published by \n"
92300fe06f15 Cosmetic cleanups / indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 2550
diff changeset
565 "the Free Software Foundation ; either version 2 of the License, or \n"
92300fe06f15 Cosmetic cleanups / indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 2550
diff changeset
566 "(at your option) any later version. \n \n"
92300fe06f15 Cosmetic cleanups / indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 2550
diff changeset
567 "This program is distributed in the hope that it will be useful, \n"
92300fe06f15 Cosmetic cleanups / indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 2550
diff changeset
568 "but WITHOUT ANY WARRANTY ; without even the implied warranty of \n"
92300fe06f15 Cosmetic cleanups / indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 2550
diff changeset
569 "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. \n"
92300fe06f15 Cosmetic cleanups / indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 2550
diff changeset
570 "See the GNU General Public License for more details. \n\n"
92300fe06f15 Cosmetic cleanups / indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 2550
diff changeset
571 "You should have received a copy of the GNU General Public \n"
92300fe06f15 Cosmetic cleanups / indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 2550
diff changeset
572 "License along with this program ; if not, write to \n"
92300fe06f15 Cosmetic cleanups / indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 2550
diff changeset
573 "the Free Software Foundation, Inc., \n"
92300fe06f15 Cosmetic cleanups / indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 2550
diff changeset
574 "51 Franklin Street, Fifth Floor, \n"
92300fe06f15 Cosmetic cleanups / indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 2550
diff changeset
575 "Boston, MA 02110-1301 USA"),
92300fe06f15 Cosmetic cleanups / indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 2550
diff changeset
576 _("Ok"), FALSE, NULL, NULL);
2549
f6efe94f2793 Fix uninitialied GtkWidget variable in about box creation.
Matti Hamalainen <ccr@tnsp.org>
parents: 2500
diff changeset
577 g_signal_connect(G_OBJECT(sndfile_about_box), "destroy",
f6efe94f2793 Fix uninitialied GtkWidget variable in about box creation.
Matti Hamalainen <ccr@tnsp.org>
parents: 2500
diff changeset
578 (GCallback)gtk_widget_destroyed, &sndfile_about_box);
2303
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
579 }
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
580 }
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
581
2551
92300fe06f15 Cosmetic cleanups / indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 2550
diff changeset
582
2303
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
583 static gchar *fmts[] = { "aiff", "au", "raw", "wav", NULL };
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
584
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
585 InputPlugin sndfile_ip = {
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
586 .description = "sndfile plugin",
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
587 .init = plugin_init,
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
588 .about = plugin_about,
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
589 .is_our_file = is_our_file,
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
590 .play_file = play_start,
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
591 .stop = play_stop,
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
592 .pause = play_pause,
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
593 .seek = file_seek,
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
594 .cleanup = plugin_cleanup,
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
595 .get_song_tuple = get_song_tuple,
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
596 .is_our_file_from_vfs = is_our_file_from_vfs,
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
597 .vfs_extensions = fmts,
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
598 .mseek = file_mseek,
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
599 };
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
600
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
601 InputPlugin *sndfile_iplist[] = { &sndfile_ip, NULL };
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
602
5561e63e9133 threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff changeset
603 SIMPLE_INPUT_PLUGIN(sndfile, sndfile_iplist)