Mercurial > audlegacy-plugins
annotate src/vorbis/vorbis.c @ 2486:f5ef50fa3e57
Automated merge with ssh://hg.atheme.org//hg/audacious-plugins
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 31 Mar 2008 09:21:36 +0300 |
parents | 9056897525e1 |
children | 42a5c9d5830b |
rev | line source |
---|---|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
2 * Copyright (C) Tony Arcieri <bascule@inferno.tusculum.edu> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
3 * Copyright (C) 2001-2002 Haavard Kvaalen <havardk@xmms.org> |
545
f9dc3d58207a
[svn] - display the stream title if it's available, like in mp3 streams
nenolod
parents:
544
diff
changeset
|
4 * Copyright (C) 2007 William Pitcock <nenolod@sacredspiral.co.uk> |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
5 * Copyright (C) 2008 Cristi Măgherușan <majeru@gentoo.ro> |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
6 * Copyright (C) 2008 Eugene Zagidullin <e.asphyx@gmail.com> |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
7 * |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
8 * ReplayGain processing Copyright (C) 2002 Gian-Carlo Pascutto <gcp@sjeng.org> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
9 * |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
10 * This program is free software; you can redistribute it and/or |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
11 * modify it under the terms of the GNU General Public License |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
12 * as published by the Free Software Foundation; either version 2 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
13 * of the License, or (at your option) any later version. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
14 * |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
15 * This program is distributed in the hope that it will be useful, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
18 * GNU General Public License for more details. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
19 * |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
20 * You should have received a copy of the GNU General Public License |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
21 * along with this program; if not, write to the Free Software |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
23 * 02110-1301, USA. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
24 * |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
25 */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
26 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
27 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
28 * 2002-01-11 ReplayGain processing added by Gian-Carlo Pascutto <gcp@sjeng.org> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
29 */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
30 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
31 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
32 * Note that this uses vorbisfile, which is not (currently) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
33 * thread-safe. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
34 */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
35 |
1777 | 36 #include "config.h" |
2377
9056897525e1
pretend to be stopped when buffer is free. needed for correct waiting for free buffer
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2375
diff
changeset
|
37 /*#define AUD_DEBUG |
9056897525e1
pretend to be stopped when buffer is free. needed for correct waiting for free buffer
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2375
diff
changeset
|
38 #define DEBUG*/ |
537
e55f789573e3
[svn] - treat all failures the same. this is XIPH. we're not going to ever be
nenolod
parents:
536
diff
changeset
|
39 |
615
1fb44c12a812
[svn] - avoid NULL dereference. closes mandriva #28603.
nenolod
parents:
608
diff
changeset
|
40 #define REMOVE_NONEXISTANT_TAG(x) if (x != NULL && !*x) { x = NULL; } |
608 | 41 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
42 #include <glib.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
43 #include <gtk/gtk.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
44 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
45 #include <stdlib.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
46 #include <math.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
47 #include <string.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
48 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
49 #include <fcntl.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
50 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
51 #include <ogg/ogg.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
52 #include <vorbis/codec.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
53 #include <vorbis/vorbisfile.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
54 |
1950
2ebeb7816c5e
Change from "" to <>-style includes. With thanks to ccr for the correct sed voodoo.
chainsaw@localhost
parents:
1777
diff
changeset
|
55 #include <audacious/plugin.h> |
2ebeb7816c5e
Change from "" to <>-style includes. With thanks to ccr for the correct sed voodoo.
chainsaw@localhost
parents:
1777
diff
changeset
|
56 #include <audacious/output.h> |
2ebeb7816c5e
Change from "" to <>-style includes. With thanks to ccr for the correct sed voodoo.
chainsaw@localhost
parents:
1777
diff
changeset
|
57 #include <audacious/util.h> |
2ebeb7816c5e
Change from "" to <>-style includes. With thanks to ccr for the correct sed voodoo.
chainsaw@localhost
parents:
1777
diff
changeset
|
58 #include <audacious/configdb.h> |
2ebeb7816c5e
Change from "" to <>-style includes. With thanks to ccr for the correct sed voodoo.
chainsaw@localhost
parents:
1777
diff
changeset
|
59 #include <audacious/main.h> |
527
d124034ebea3
[svn] - glib/gi18n.h -> audacious/i18n.h for automatic dgettext support
nenolod
parents:
484
diff
changeset
|
60 #include <audacious/i18n.h> |
772 | 61 #include <audacious/strings.h> |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
62 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
63 #include "vorbis.h" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
64 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
65 extern vorbis_config_t vorbis_cfg; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
66 |
1433
d557d987e42d
vorbis: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1417
diff
changeset
|
67 static Tuple *get_song_tuple(gchar *filename); |
475 | 68 static int vorbis_check_fd(char *filename, VFSFile *stream); |
559 | 69 static void vorbis_play(InputPlayback *data); |
70 static void vorbis_stop(InputPlayback *data); | |
71 static void vorbis_pause(InputPlayback *data, short p); | |
72 static void vorbis_seek(InputPlayback *data, int time); | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
73 static gchar *vorbis_generate_title(OggVorbis_File * vorbisfile, gchar * fn); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
74 static void vorbis_aboutbox(void); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
75 static void vorbis_init(void); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
76 static void vorbis_cleanup(void); |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
77 static long vorbis_interleave_buffer(float **pcm, int samples, int ch, |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
78 float *pcmout); |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
79 static gboolean vorbis_update_replaygain(ReplayGainInfo *rg_info); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
80 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
81 static size_t ovcb_read(void *ptr, size_t size, size_t nmemb, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
82 void *datasource); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
83 static int ovcb_seek(void *datasource, int64_t offset, int whence); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
84 static int ovcb_close(void *datasource); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
85 static long ovcb_tell(void *datasource); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
86 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
87 ov_callbacks vorbis_callbacks = { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
88 ovcb_read, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
89 ovcb_seek, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
90 ovcb_close, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
91 ovcb_tell |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
92 }; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
93 |
2131
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
94 ov_callbacks vorbis_callbacks_stream = { |
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
95 ovcb_read, |
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
96 NULL, |
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
97 ovcb_close, |
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
98 NULL |
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
99 }; |
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
100 |
375 | 101 gchar *vorbis_fmts[] = { "ogg", "ogm", NULL }; |
102 | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
103 InputPlugin vorbis_ip = { |
1618
177aec41b238
vorbis: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1489
diff
changeset
|
104 .description = "Ogg Vorbis Audio Plugin", /* description */ |
177aec41b238
vorbis: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1489
diff
changeset
|
105 .init = vorbis_init, /* init */ |
177aec41b238
vorbis: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1489
diff
changeset
|
106 .about = vorbis_aboutbox, /* aboutbox */ |
177aec41b238
vorbis: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1489
diff
changeset
|
107 .configure = vorbis_configure, /* configure */ |
177aec41b238
vorbis: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1489
diff
changeset
|
108 .play_file = vorbis_play, |
177aec41b238
vorbis: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1489
diff
changeset
|
109 .stop = vorbis_stop, |
177aec41b238
vorbis: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1489
diff
changeset
|
110 .pause = vorbis_pause, |
177aec41b238
vorbis: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1489
diff
changeset
|
111 .seek = vorbis_seek, |
177aec41b238
vorbis: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1489
diff
changeset
|
112 .cleanup = vorbis_cleanup, |
177aec41b238
vorbis: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1489
diff
changeset
|
113 .get_song_tuple = get_song_tuple, |
177aec41b238
vorbis: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1489
diff
changeset
|
114 .is_our_file_from_vfs = vorbis_check_fd, |
1979
839804c3b3a4
aud_vfs_extensions -> vfs_extensions, some vtable fixes
William Pitcock <nenolod@atheme.org>
parents:
1978
diff
changeset
|
115 .vfs_extensions = vorbis_fmts, |
2208
201a47338baf
vorbis: removed fileinfo dialog, switched to mowgli_dictionary, some fixes
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2191
diff
changeset
|
116 .update_song_tuple = vorbis_update_song_tuple, |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
117 }; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
118 |
1078 | 119 InputPlugin *vorbis_iplist[] = { &vorbis_ip, NULL }; |
120 | |
1395
761e17b23e0c
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
1373
diff
changeset
|
121 DECLARE_PLUGIN(vorbis, NULL, NULL, vorbis_iplist, NULL, NULL, NULL, NULL, NULL); |
1078 | 122 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
123 static OggVorbis_File vf; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
124 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
125 static GThread *thread; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
126 static volatile int seekneeded = -1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
127 static int samplerate, channels; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
128 GMutex *vf_mutex; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
129 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
130 gchar **vorbis_tag_encoding_list = NULL; |
2191
329267b09658
get rid of talking with GDK directly
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2134
diff
changeset
|
131 static GtkWidget *about_window; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
132 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
133 static int |
475 | 134 vorbis_check_fd(char *filename, VFSFile *stream) |
135 { | |
136 OggVorbis_File vfile; /* avoid thread interaction */ | |
137 gint result; | |
478 | 138 VFSVorbisFile *fd; |
139 | |
140 fd = g_new0(VFSVorbisFile, 1); | |
141 fd->fd = stream; | |
142 fd->probe = TRUE; | |
475 | 143 |
144 /* | |
145 * The open function performs full stream detection and machine | |
146 * initialization. If it returns zero, the stream *is* Vorbis and | |
147 * we're fully ready to decode. | |
148 */ | |
149 | |
150 /* libvorbisfile isn't thread safe... */ | |
151 memset(&vfile, 0, sizeof(vfile)); | |
152 g_mutex_lock(vf_mutex); | |
153 | |
2131
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
154 result = ov_test_callbacks(fd, &vfile, NULL, 0, aud_vfs_is_streaming(stream) ? vorbis_callbacks_stream : vorbis_callbacks); |
475 | 155 |
156 switch (result) { | |
157 case OV_EREAD: | |
158 #ifdef DEBUG | |
159 g_message("** vorbis.c: Media read error: %s", filename); | |
160 #endif | |
161 g_mutex_unlock(vf_mutex); | |
162 return FALSE; | |
163 break; | |
164 case OV_ENOTVORBIS: | |
165 #ifdef DEBUG | |
166 g_message("** vorbis.c: Not Vorbis data: %s", filename); | |
167 #endif | |
168 g_mutex_unlock(vf_mutex); | |
169 return FALSE; | |
170 break; | |
171 case OV_EVERSION: | |
172 #ifdef DEBUG | |
173 g_message("** vorbis.c: Version mismatch: %s", filename); | |
174 #endif | |
175 g_mutex_unlock(vf_mutex); | |
176 return FALSE; | |
177 break; | |
178 case OV_EBADHEADER: | |
179 #ifdef DEBUG | |
180 g_message("** vorbis.c: Invalid Vorbis bistream header: %s", | |
181 filename); | |
182 #endif | |
183 g_mutex_unlock(vf_mutex); | |
184 return FALSE; | |
185 break; | |
186 case OV_EFAULT: | |
187 #ifdef DEBUG | |
188 g_message("** vorbis.c: Internal logic fault while reading %s", | |
189 filename); | |
190 #endif | |
191 g_mutex_unlock(vf_mutex); | |
192 return FALSE; | |
193 break; | |
194 case 0: | |
195 break; | |
196 default: | |
197 break; | |
198 } | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
199 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
200 ov_clear(&vfile); /* once the ov_open succeeds, the stream belongs to |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
201 vorbisfile.a. ov_clear will fclose it */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
202 g_mutex_unlock(vf_mutex); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
203 return TRUE; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
204 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
205 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
206 static void |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
207 vorbis_jump_to_time(InputPlayback *playback, long time) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
208 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
209 g_mutex_lock(vf_mutex); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
210 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
211 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
212 * We need to guard against seeking to the end, or things |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
213 * don't work right. Instead, just seek to one second prior |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
214 * to this |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
215 */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
216 if (time == ov_time_total(&vf, -1)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
217 time--; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
218 |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
219 playback->output->flush(time * 1000); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
220 ov_time_seek(&vf, time); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
221 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
222 g_mutex_unlock(vf_mutex); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
223 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
224 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
225 static void |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
226 do_seek(InputPlayback *playback) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
227 { |
2131
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
228 if (seekneeded != -1) { |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
229 vorbis_jump_to_time(playback, seekneeded); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
230 seekneeded = -1; |
564
6b959c9914a7
[svn] Fix a dumb mistake, and also use generic flags and get_time.
iabervon
parents:
561
diff
changeset
|
231 playback->eof = FALSE; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
232 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
233 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
234 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
235 #define PCM_FRAMES 1024 |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
236 #define PCM_BUFSIZE PCM_FRAMES*2 |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
237 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
238 static gpointer |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
239 vorbis_play_loop(gpointer arg) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
240 { |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
241 InputPlayback *playback = arg; |
564
6b959c9914a7
[svn] Fix a dumb mistake, and also use generic flags and get_time.
iabervon
parents:
561
diff
changeset
|
242 char *filename = playback->filename; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
243 gchar *title = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
244 double time; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
245 long timercount = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
246 vorbis_info *vi; |
1372
495825028a70
Division by 1000 is not necessary.
William Pitcock <nenolod@atheme-project.org>
parents:
1370
diff
changeset
|
247 gint br; |
478 | 248 VFSVorbisFile *fd = NULL; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
249 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
250 int last_section = -1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
251 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
252 VFSFile *stream = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
253 void *datasource = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
254 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
255 /*gboolean use_rg; |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
256 /float rg_scale = 1.0;*/ |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
257 |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
258 ReplayGainInfo rg_info; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
259 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
260 memset(&vf, 0, sizeof(vf)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
261 |
1978 | 262 if ((stream = aud_vfs_fopen(filename, "r")) == NULL) { |
564
6b959c9914a7
[svn] Fix a dumb mistake, and also use generic flags and get_time.
iabervon
parents:
561
diff
changeset
|
263 playback->eof = TRUE; |
478 | 264 goto play_cleanup; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
265 } |
478 | 266 |
267 fd = g_new0(VFSVorbisFile, 1); | |
268 fd->fd = stream; | |
269 datasource = (void *) fd; | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
270 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
271 /*char pcmout[4096];*/ |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
272 float pcmout[PCM_BUFSIZE*sizeof(float)]; |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
273 int bytes; |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
274 float **pcm; |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
275 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
276 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
277 * The open function performs full stream detection and |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
278 * machine initialization. None of the rest of ov_xx() works |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
279 * without it |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
280 * |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
281 * A vorbis physical bitstream may consist of many logical |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
282 * sections (information for each of which may be fetched from |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
283 * the vf structure). This value is filled in by ov_read to |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
284 * alert us what section we're currently decoding in case we |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
285 * need to change playback settings at a section boundary |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
286 */ |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
287 |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
288 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
289 g_mutex_lock(vf_mutex); |
2131
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
290 if (ov_open_callbacks(datasource, &vf, NULL, 0, aud_vfs_is_streaming(fd->fd) ? vorbis_callbacks_stream : vorbis_callbacks) < 0) { |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
291 vorbis_callbacks.close_func(datasource); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
292 g_mutex_unlock(vf_mutex); |
564
6b959c9914a7
[svn] Fix a dumb mistake, and also use generic flags and get_time.
iabervon
parents:
561
diff
changeset
|
293 playback->eof = TRUE; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
294 goto play_cleanup; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
295 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
296 vi = ov_info(&vf, -1); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
297 |
2131
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
298 if (aud_vfs_is_streaming(fd->fd)) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
299 time = -1; |
2134
fd0d5615f674
Fix seeking for non-streamed files.
William Pitcock <nenolod@atheme.org>
parents:
2133
diff
changeset
|
300 else |
fd0d5615f674
Fix seeking for non-streamed files.
William Pitcock <nenolod@atheme.org>
parents:
2133
diff
changeset
|
301 time = ov_time_total(&vf, -1) * 1000; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
302 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
303 if (vi->channels > 2) { |
564
6b959c9914a7
[svn] Fix a dumb mistake, and also use generic flags and get_time.
iabervon
parents:
561
diff
changeset
|
304 playback->eof = TRUE; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
305 g_mutex_unlock(vf_mutex); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
306 goto play_cleanup; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
307 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
308 |
1372
495825028a70
Division by 1000 is not necessary.
William Pitcock <nenolod@atheme-project.org>
parents:
1370
diff
changeset
|
309 title = vorbis_generate_title(&vf, filename); |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
310 vorbis_update_replaygain(&rg_info); |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
311 playback->set_replaygain_info(playback, &rg_info); |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
312 |
1372
495825028a70
Division by 1000 is not necessary.
William Pitcock <nenolod@atheme-project.org>
parents:
1370
diff
changeset
|
313 vi = ov_info(&vf, -1); |
495825028a70
Division by 1000 is not necessary.
William Pitcock <nenolod@atheme-project.org>
parents:
1370
diff
changeset
|
314 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
315 samplerate = vi->rate; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
316 channels = vi->channels; |
1372
495825028a70
Division by 1000 is not necessary.
William Pitcock <nenolod@atheme-project.org>
parents:
1370
diff
changeset
|
317 br = vi->bitrate_nominal; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
318 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
319 g_mutex_unlock(vf_mutex); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
320 |
1987 | 321 playback->set_params(playback, title, time, br, samplerate, channels); |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
322 if (!playback->output->open_audio(FMT_FLOAT, vi->rate, vi->channels)) { |
564
6b959c9914a7
[svn] Fix a dumb mistake, and also use generic flags and get_time.
iabervon
parents:
561
diff
changeset
|
323 playback->error = TRUE; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
324 goto play_cleanup; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
325 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
326 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
327 seekneeded = -1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
328 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
329 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
330 * Note that chaining changes things here; A vorbis file may |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
331 * be a mix of different channels, bitrates and sample rates. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
332 * You can fetch the information for any section of the file |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
333 * using the ov_ interface. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
334 */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
335 |
564
6b959c9914a7
[svn] Fix a dumb mistake, and also use generic flags and get_time.
iabervon
parents:
561
diff
changeset
|
336 while (playback->playing) { |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
337 |
564
6b959c9914a7
[svn] Fix a dumb mistake, and also use generic flags and get_time.
iabervon
parents:
561
diff
changeset
|
338 if (playback->eof) { |
1676
aee4ebea943a
xmms_usleep() was removed, use g_usleep()
Matti Hamalainen <ccr@tnsp.org>
parents:
1618
diff
changeset
|
339 g_usleep(20000); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
340 continue; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
341 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
342 |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
343 if (seekneeded != -1) |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
344 do_seek(playback); |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
345 |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
346 |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
347 int current_section = last_section; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
348 |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
349 g_mutex_lock(vf_mutex); |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
350 |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
351 bytes = ov_read_float(&vf, &pcm, PCM_FRAMES, ¤t_section); |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
352 |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
353 if (bytes > 0) |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
354 bytes = vorbis_interleave_buffer(pcm, bytes, channels, pcmout); |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
355 |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
356 /* |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
357 * We got some sort of error. Bail. |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
358 */ |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
359 if (bytes <= 0 && bytes != OV_HOLE) { |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
360 /* |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
361 * EOF |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
362 */ |
2375
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
363 AUDDBG("EOF\n"); |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
364 playback->playing = 0; |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
365 playback->eof = TRUE; |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
366 current_section = last_section; |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
367 } |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
368 |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
369 if (current_section <= last_section) { |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
370 /* |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
371 * The info struct is different in each section. vf |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
372 * holds them all for the given bitstream. This |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
373 * requests the current one |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
374 */ |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
375 vorbis_info *vi = ov_info(&vf, -1); |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
376 |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
377 if (vi->channels > 2) { |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
378 playback->eof = TRUE; |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
379 g_mutex_unlock(vf_mutex); |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
380 goto stop_processing; |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
381 } |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
382 |
533
2fa253251598
[svn] - fix uninitialized value conditional jump, maybe it will help
nenolod
parents:
527
diff
changeset
|
383 |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
384 if (vi->rate != samplerate || vi->channels != channels) { |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
385 samplerate = vi->rate; |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
386 channels = vi->channels; |
2375
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
387 while(playback->output->buffer_playing()) g_usleep(50000); |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
388 playback->output->close_audio(); |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
389 if (!playback->output-> |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
390 open_audio(FMT_FLOAT, vi->rate, vi->channels)) { |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
391 playback->error = TRUE; |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
392 playback->eof = TRUE; |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
393 g_mutex_unlock(vf_mutex); |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
394 goto stop_processing; |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
395 } |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
396 playback->output->flush(ov_time_tell(&vf) * 1000); |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
397 vorbis_update_replaygain(&rg_info); |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
398 playback->set_replaygain_info(playback, &rg_info); /* audio reopened */ |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
399 } |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
400 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
401 |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
402 g_mutex_unlock(vf_mutex); |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
403 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
404 playback->pass_audio(playback, FMT_FLOAT, channels, bytes, pcmout, &playback->playing); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
405 |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
406 if (!playback->playing) |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
407 goto stop_processing; |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
408 |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
409 if (seekneeded != -1) |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
410 do_seek(playback); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
411 |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
412 stop_processing: |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
413 |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
414 if (current_section <= last_section) { |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
415 /* |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
416 * set total play time, bitrate, rate, and channels of |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
417 * current section |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
418 */ |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
419 if (title) |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
420 g_free(title); |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
421 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
422 g_mutex_lock(vf_mutex); |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
423 title = vorbis_generate_title(&vf, filename); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
424 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
425 if (time != -1) |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
426 time = ov_time_total(&vf, -1) * 1000; |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
427 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
428 g_mutex_unlock(vf_mutex); |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
429 |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
430 playback->set_params(playback, title, time, br, samplerate, channels); |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
431 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
432 timercount = playback->output->output_time(); |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
433 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
434 last_section = current_section; |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
435 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
436 } |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
437 } /* main loop */ |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
438 |
2375
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
439 if (!playback->error) { |
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
440 /*this loop makes it not skip the last ~4 seconds, but the playback |
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
441 * timer isn't updated in this period, so it still needs a bit of work |
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
442 * |
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
443 * majeru |
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
444 */ |
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
445 if(playback->eof) /* do it only on EOF --asphyx */ |
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
446 while(playback->output->buffer_playing()) { |
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
447 AUDDBG("waiting for empty output buffer\n"); |
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
448 g_usleep(50000); |
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
449 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
450 |
2375
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
451 playback->output->close_audio(); |
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
452 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
453 |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
454 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
455 play_cleanup: |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
456 g_free(title); |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
457 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
458 /* |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
459 * ov_clear closes the stream if its open. Safe to call on an |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
460 * uninitialized structure as long as we've zeroed it |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
461 */ |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
462 g_mutex_lock(vf_mutex); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
463 ov_clear(&vf); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
464 g_mutex_unlock(vf_mutex); |
1373
85ffec632924
Use InputPlayback.playing properly.
William Pitcock <nenolod@atheme-project.org>
parents:
1372
diff
changeset
|
465 playback->playing = 0; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
466 return NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
467 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
468 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
469 static void |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
470 vorbis_play(InputPlayback *playback) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
471 { |
564
6b959c9914a7
[svn] Fix a dumb mistake, and also use generic flags and get_time.
iabervon
parents:
561
diff
changeset
|
472 playback->playing = 1; |
6b959c9914a7
[svn] Fix a dumb mistake, and also use generic flags and get_time.
iabervon
parents:
561
diff
changeset
|
473 playback->eof = 0; |
6b959c9914a7
[svn] Fix a dumb mistake, and also use generic flags and get_time.
iabervon
parents:
561
diff
changeset
|
474 playback->error = FALSE; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
475 |
1352
ab66f3ee7a11
vorbis: new threading model
William Pitcock <nenolod@atheme-project.org>
parents:
1279
diff
changeset
|
476 thread = g_thread_self(); |
1447
195b5657303e
updated input plugins to use set_pb_ready to signal to the core that they're ready for playback
Giacomo Lozito <james@develia.org>
parents:
1433
diff
changeset
|
477 playback->set_pb_ready(playback); |
1352
ab66f3ee7a11
vorbis: new threading model
William Pitcock <nenolod@atheme-project.org>
parents:
1279
diff
changeset
|
478 vorbis_play_loop(playback); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
479 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
480 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
481 static void |
564
6b959c9914a7
[svn] Fix a dumb mistake, and also use generic flags and get_time.
iabervon
parents:
561
diff
changeset
|
482 vorbis_stop(InputPlayback *playback) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
483 { |
564
6b959c9914a7
[svn] Fix a dumb mistake, and also use generic flags and get_time.
iabervon
parents:
561
diff
changeset
|
484 if (playback->playing) { |
6b959c9914a7
[svn] Fix a dumb mistake, and also use generic flags and get_time.
iabervon
parents:
561
diff
changeset
|
485 playback->playing = 0; |
2375
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
486 AUDDBG("waiting for playback thread finished\n"); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
487 g_thread_join(thread); |
2375
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
488 AUDDBG("playback finished\n"); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
489 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
490 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
491 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
492 static void |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
493 vorbis_pause(InputPlayback *playback, short p) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
494 { |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
495 playback->output->pause(p); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
496 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
497 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
498 static void |
559 | 499 vorbis_seek(InputPlayback *data, int time) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
500 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
501 seekneeded = time; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
502 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
503 while (seekneeded != -1) |
1676
aee4ebea943a
xmms_usleep() was removed, use g_usleep()
Matti Hamalainen <ccr@tnsp.org>
parents:
1618
diff
changeset
|
504 g_usleep(20000); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
505 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
506 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
507 /* Make sure you've locked vf_mutex */ |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
508 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
509 static gboolean |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
510 vorbis_update_replaygain(ReplayGainInfo *rg_info) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
511 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
512 vorbis_comment *comment; |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
513 char *rg_gain = NULL, *rg_peak = NULL; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
514 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
515 if (rg_info == NULL || (comment = ov_comment(&vf, -1)) == NULL) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
516 return FALSE; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
517 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
518 rg_gain = vorbis_comment_query(comment, "replaygain_album_gain", 0); |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
519 if (!rg_gain) rg_gain = vorbis_comment_query(comment, "rg_audiophile", 0); /* Old */ |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
520 rg_info->album_gain = rg_gain != NULL ? atof(rg_gain) : 0.0; |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
521 |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
522 rg_gain = vorbis_comment_query(comment, "replaygain_track_gain", 0); |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
523 if (!rg_gain) rg_gain = vorbis_comment_query(comment, "rg_radio", 0); /* Old */ |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
524 rg_info->track_gain = rg_gain != NULL ? atof(rg_gain) : 0.0; |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
525 |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
526 rg_peak = vorbis_comment_query(comment, "replaygain_album_peak", 0); |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
527 rg_info->album_peak = rg_peak != NULL ? atof(rg_peak) : 0.0; |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
528 |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
529 rg_peak = vorbis_comment_query(comment, "replaygain_track_peak", 0); |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
530 if (!rg_peak) rg_peak = vorbis_comment_query(comment, "rg_peak", 0); /* Old */ |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
531 rg_info->track_peak = rg_peak != NULL ? atof(rg_peak) : 0.0; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
532 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
533 return TRUE; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
534 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
535 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
536 static long |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
537 vorbis_interleave_buffer(float **pcm, int samples, int ch, float *pcmout) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
538 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
539 int i, j; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
540 for (i = 0; i < samples; i++) |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
541 for (j = 0; j < ch; j++) |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
542 *pcmout++ = pcm[j][i]; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
543 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
544 return ch * samples * sizeof(float); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
545 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
546 |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1973
diff
changeset
|
547 static void _aud_tuple_associate_string(Tuple *tuple, const gint nfield, const gchar *field, const gchar *string) |
1433
d557d987e42d
vorbis: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1417
diff
changeset
|
548 { |
1687
d158ce84fda7
Modified for Tuplez/plugin API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1489
diff
changeset
|
549 if (string) { |
2050
2ffc6a69fcd1
string API calls -> vtable
William Pitcock <nenolod@atheme.org>
parents:
2033
diff
changeset
|
550 gchar *str = aud_str_to_utf8(string); |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1973
diff
changeset
|
551 aud_tuple_associate_string(tuple, nfield, field, str); |
1687
d158ce84fda7
Modified for Tuplez/plugin API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1489
diff
changeset
|
552 g_free(str); |
d158ce84fda7
Modified for Tuplez/plugin API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1489
diff
changeset
|
553 } |
1433
d557d987e42d
vorbis: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1417
diff
changeset
|
554 } |
d557d987e42d
vorbis: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1417
diff
changeset
|
555 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
556 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
557 * Ok, nhjm449! Are you *happy* now?! -nenolod |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
558 */ |
1433
d557d987e42d
vorbis: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1417
diff
changeset
|
559 static Tuple * |
2131
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
560 get_aud_tuple_for_vorbisfile(OggVorbis_File * vorbisfile, gchar *filename) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
561 { |
2131
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
562 VFSVorbisFile *vfd = (VFSVorbisFile *) vorbisfile->datasource; |
1433
d557d987e42d
vorbis: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1417
diff
changeset
|
563 Tuple *tuple = NULL; |
2134
fd0d5615f674
Fix seeking for non-streamed files.
William Pitcock <nenolod@atheme.org>
parents:
2133
diff
changeset
|
564 gint length; |
2212
a13b8f308dce
vorbis: mimetype field added. also little fix
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2211
diff
changeset
|
565 vorbis_comment *comment = NULL; |
2131
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
566 |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1973
diff
changeset
|
567 tuple = aud_tuple_new_from_filename(filename); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
568 |
2134
fd0d5615f674
Fix seeking for non-streamed files.
William Pitcock <nenolod@atheme.org>
parents:
2133
diff
changeset
|
569 if (aud_vfs_is_streaming(vfd->fd)) |
fd0d5615f674
Fix seeking for non-streamed files.
William Pitcock <nenolod@atheme.org>
parents:
2133
diff
changeset
|
570 length = -1; |
fd0d5615f674
Fix seeking for non-streamed files.
William Pitcock <nenolod@atheme.org>
parents:
2133
diff
changeset
|
571 else |
fd0d5615f674
Fix seeking for non-streamed files.
William Pitcock <nenolod@atheme.org>
parents:
2133
diff
changeset
|
572 length = ov_time_total(vorbisfile, -1) * 1000; |
fd0d5615f674
Fix seeking for non-streamed files.
William Pitcock <nenolod@atheme.org>
parents:
2133
diff
changeset
|
573 |
fd0d5615f674
Fix seeking for non-streamed files.
William Pitcock <nenolod@atheme.org>
parents:
2133
diff
changeset
|
574 /* associate with tuple */ |
fd0d5615f674
Fix seeking for non-streamed files.
William Pitcock <nenolod@atheme.org>
parents:
2133
diff
changeset
|
575 aud_tuple_associate_int(tuple, FIELD_LENGTH, NULL, length); |
2211
2a13a038987c
vorbis: bitrate field added
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2210
diff
changeset
|
576 /* maybe, it would be better to display nominal bitrate (like in main win), not average? --eugene */ |
2a13a038987c
vorbis: bitrate field added
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2210
diff
changeset
|
577 aud_tuple_associate_int(tuple, FIELD_BITRATE, NULL, ov_bitrate(vorbisfile, -1)/1000); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
578 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
579 if ((comment = ov_comment(vorbisfile, -1))) { |
1687
d158ce84fda7
Modified for Tuplez/plugin API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1489
diff
changeset
|
580 gchar *tmps; |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1973
diff
changeset
|
581 _aud_tuple_associate_string(tuple, FIELD_TITLE, NULL, vorbis_comment_query(comment, "title", 0)); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1973
diff
changeset
|
582 _aud_tuple_associate_string(tuple, FIELD_ARTIST, NULL, vorbis_comment_query(comment, "artist", 0)); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1973
diff
changeset
|
583 _aud_tuple_associate_string(tuple, FIELD_ALBUM, NULL, vorbis_comment_query(comment, "album", 0)); |
2106 | 584 _aud_tuple_associate_string(tuple, FIELD_DATE, NULL, vorbis_comment_query(comment, "date", 0)); |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1973
diff
changeset
|
585 _aud_tuple_associate_string(tuple, FIELD_GENRE, NULL, vorbis_comment_query(comment, "genre", 0)); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1973
diff
changeset
|
586 _aud_tuple_associate_string(tuple, FIELD_COMMENT, NULL, vorbis_comment_query(comment, "comment", 0)); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
587 |
1687
d158ce84fda7
Modified for Tuplez/plugin API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1489
diff
changeset
|
588 if ((tmps = vorbis_comment_query(comment, "tracknumber", 0)) != NULL) |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1973
diff
changeset
|
589 aud_tuple_associate_int(tuple, FIELD_TRACK_NUMBER, NULL, atoi(tmps)); |
2212
a13b8f308dce
vorbis: mimetype field added. also little fix
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2211
diff
changeset
|
590 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
591 |
2212
a13b8f308dce
vorbis: mimetype field added. also little fix
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2211
diff
changeset
|
592 aud_tuple_associate_string(tuple, FIELD_QUALITY, NULL, "lossy"); |
1687
d158ce84fda7
Modified for Tuplez/plugin API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1489
diff
changeset
|
593 |
2212
a13b8f308dce
vorbis: mimetype field added. also little fix
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2211
diff
changeset
|
594 if (comment && comment->vendor) |
a13b8f308dce
vorbis: mimetype field added. also little fix
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2211
diff
changeset
|
595 { |
a13b8f308dce
vorbis: mimetype field added. also little fix
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2211
diff
changeset
|
596 gchar *codec = g_strdup_printf("Ogg Vorbis [%s]", comment->vendor); |
a13b8f308dce
vorbis: mimetype field added. also little fix
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2211
diff
changeset
|
597 aud_tuple_associate_string(tuple, FIELD_CODEC, NULL, codec); |
a13b8f308dce
vorbis: mimetype field added. also little fix
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2211
diff
changeset
|
598 g_free(codec); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
599 } |
2212
a13b8f308dce
vorbis: mimetype field added. also little fix
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2211
diff
changeset
|
600 else |
a13b8f308dce
vorbis: mimetype field added. also little fix
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2211
diff
changeset
|
601 aud_tuple_associate_string(tuple, FIELD_CODEC, NULL, "Ogg Vorbis"); |
a13b8f308dce
vorbis: mimetype field added. also little fix
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2211
diff
changeset
|
602 |
a13b8f308dce
vorbis: mimetype field added. also little fix
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2211
diff
changeset
|
603 aud_tuple_associate_string(tuple, FIELD_MIMETYPE, NULL, "application/ogg"); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
604 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
605 return tuple; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
606 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
607 |
1433
d557d987e42d
vorbis: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1417
diff
changeset
|
608 static Tuple * |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
609 get_song_tuple(gchar *filename) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
610 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
611 VFSFile *stream = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
612 OggVorbis_File vfile; /* avoid thread interaction */ |
1433
d557d987e42d
vorbis: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1417
diff
changeset
|
613 Tuple *tuple = NULL; |
481 | 614 VFSVorbisFile *fd = NULL; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
615 |
1978 | 616 if ((stream = aud_vfs_fopen(filename, "r")) == NULL) |
481 | 617 return NULL; |
618 | |
619 fd = g_new0(VFSVorbisFile, 1); | |
620 fd->fd = stream; | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
621 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
622 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
623 * The open function performs full stream detection and |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
624 * machine initialization. If it returns zero, the stream |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
625 * *is* Vorbis and we're fully ready to decode. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
626 */ |
2131
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
627 if (ov_open_callbacks(fd, &vfile, NULL, 0, aud_vfs_is_streaming(stream) ? vorbis_callbacks_stream : vorbis_callbacks) < 0) { |
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
628 aud_vfs_fclose(stream); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
629 return NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
630 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
631 |
2131
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
632 tuple = get_aud_tuple_for_vorbisfile(&vfile, filename); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
633 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
634 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
635 * once the ov_open succeeds, the stream belongs to |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
636 * vorbisfile.a. ov_clear will fclose it |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
637 */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
638 ov_clear(&vfile); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
639 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
640 return tuple; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
641 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
642 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
643 static gchar * |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
644 vorbis_generate_title(OggVorbis_File * vorbisfile, gchar * filename) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
645 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
646 /* Caller should hold vf_mutex */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
647 gchar *displaytitle = NULL; |
1433
d557d987e42d
vorbis: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1417
diff
changeset
|
648 Tuple *input; |
545
f9dc3d58207a
[svn] - display the stream title if it's available, like in mp3 streams
nenolod
parents:
544
diff
changeset
|
649 gchar *tmp; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
650 |
2131
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
651 input = get_aud_tuple_for_vorbisfile(vorbisfile, filename); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
652 |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1973
diff
changeset
|
653 displaytitle = aud_tuple_formatter_make_title_string(input, vorbis_cfg.tag_override ? |
2055 | 654 vorbis_cfg.tag_format : aud_get_gentitle_format()); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
655 |
1978 | 656 if ((tmp = aud_vfs_get_metadata(((VFSVorbisFile *) vorbisfile->datasource)->fd, "stream-name")) != NULL) |
545
f9dc3d58207a
[svn] - display the stream title if it's available, like in mp3 streams
nenolod
parents:
544
diff
changeset
|
657 { |
f9dc3d58207a
[svn] - display the stream title if it's available, like in mp3 streams
nenolod
parents:
544
diff
changeset
|
658 gchar *old = displaytitle; |
1433
d557d987e42d
vorbis: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1417
diff
changeset
|
659 |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1973
diff
changeset
|
660 aud_tuple_associate_string(input, -1, "stream", tmp); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1973
diff
changeset
|
661 aud_tuple_associate_string(input, FIELD_TITLE, NULL, old); |
1433
d557d987e42d
vorbis: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1417
diff
changeset
|
662 |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1973
diff
changeset
|
663 displaytitle = aud_tuple_formatter_process_string(input, "${?title:${title}}${?stream: (${stream})}"); |
545
f9dc3d58207a
[svn] - display the stream title if it's available, like in mp3 streams
nenolod
parents:
544
diff
changeset
|
664 |
f9dc3d58207a
[svn] - display the stream title if it's available, like in mp3 streams
nenolod
parents:
544
diff
changeset
|
665 g_free(old); |
f9dc3d58207a
[svn] - display the stream title if it's available, like in mp3 streams
nenolod
parents:
544
diff
changeset
|
666 g_free(tmp); |
f9dc3d58207a
[svn] - display the stream title if it's available, like in mp3 streams
nenolod
parents:
544
diff
changeset
|
667 } |
f9dc3d58207a
[svn] - display the stream title if it's available, like in mp3 streams
nenolod
parents:
544
diff
changeset
|
668 |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1973
diff
changeset
|
669 aud_tuple_free(input); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
670 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
671 return displaytitle; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
672 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
673 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
674 static void |
1433
d557d987e42d
vorbis: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1417
diff
changeset
|
675 vorbis_aboutbox(void) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
676 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
677 if (about_window) |
2191
329267b09658
get rid of talking with GDK directly
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2134
diff
changeset
|
678 gtk_window_present(GTK_WINDOW(about_window)); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
679 else |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
680 { |
1677
f6f5603a0954
xmms_show_message() changed to audacious_info_dialog()
Matti Hamalainen <ccr@tnsp.org>
parents:
1676
diff
changeset
|
681 about_window = audacious_info_dialog(_("About Ogg Vorbis Audio Plugin"), |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
682 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
683 * I18N: UTF-8 Translation: "Haavard Kvaalen" -> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
684 * "H\303\245vard Kv\303\245len" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
685 */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
686 _ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
687 ("Ogg Vorbis Plugin by the Xiph.org Foundation\n\n" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
688 "Original code by\n" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
689 "Tony Arcieri <bascule@inferno.tusculum.edu>\n" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
690 "Contributions from\n" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
691 "Chris Montgomery <monty@xiph.org>\n" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
692 "Peter Alm <peter@xmms.org>\n" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
693 "Michael Smith <msmith@labyrinth.edu.au>\n" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
694 "Jack Moffitt <jack@icecast.org>\n" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
695 "Jorn Baayen <jorn@nl.linux.org>\n" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
696 "Haavard Kvaalen <havardk@xmms.org>\n" |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
697 "Gian-Carlo Pascutto <gcp@sjeng.org>\n" |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
698 "Eugene Zagidullin <e.asphyx@gmail.com>\n\n" |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
699 "Visit the Xiph.org Foundation at http://www.xiph.org/\n"), |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
700 _("Ok"), FALSE, NULL, NULL); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
701 g_signal_connect(G_OBJECT(about_window), "destroy", |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
702 G_CALLBACK(gtk_widget_destroyed), &about_window); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
703 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
704 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
705 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
706 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
707 static void |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
708 vorbis_init(void) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
709 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
710 ConfigDb *db; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
711 gchar *tmp = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
712 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
713 memset(&vorbis_cfg, 0, sizeof(vorbis_config_t)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
714 vorbis_cfg.http_buffer_size = 128; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
715 vorbis_cfg.http_prebuffer = 25; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
716 vorbis_cfg.proxy_port = 8080; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
717 vorbis_cfg.proxy_use_auth = FALSE; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
718 vorbis_cfg.proxy_user = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
719 vorbis_cfg.proxy_pass = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
720 vorbis_cfg.tag_override = FALSE; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
721 vorbis_cfg.tag_format = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
722 |
2124 | 723 db = aud_cfg_db_open(); |
724 aud_cfg_db_get_int(db, "vorbis", "http_buffer_size", | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
725 &vorbis_cfg.http_buffer_size); |
2124 | 726 aud_cfg_db_get_int(db, "vorbis", "http_prebuffer", |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
727 &vorbis_cfg.http_prebuffer); |
2124 | 728 aud_cfg_db_get_bool(db, "vorbis", "save_http_stream", |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
729 &vorbis_cfg.save_http_stream); |
2124 | 730 if (!aud_cfg_db_get_string(db, "vorbis", "save_http_path", |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
731 &vorbis_cfg.save_http_path)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
732 vorbis_cfg.save_http_path = g_strdup(g_get_home_dir()); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
733 |
2124 | 734 aud_cfg_db_get_bool(db, "vorbis", "tag_override", |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
735 &vorbis_cfg.tag_override); |
2124 | 736 if (!aud_cfg_db_get_string(db, "vorbis", "tag_format", |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
737 &vorbis_cfg.tag_format)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
738 vorbis_cfg.tag_format = g_strdup("%p - %t"); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
739 |
2124 | 740 aud_cfg_db_get_bool(db, NULL, "use_proxy", &vorbis_cfg.use_proxy); |
741 aud_cfg_db_get_string(db, NULL, "proxy_host", &vorbis_cfg.proxy_host); | |
742 aud_cfg_db_get_string(db, NULL, "proxy_port", &tmp); | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
743 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
744 if (tmp != NULL) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
745 vorbis_cfg.proxy_port = atoi(tmp); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
746 |
2124 | 747 aud_cfg_db_get_bool(db, NULL, "proxy_use_auth", &vorbis_cfg.proxy_use_auth); |
748 aud_cfg_db_get_string(db, NULL, "proxy_user", &vorbis_cfg.proxy_user); | |
749 aud_cfg_db_get_string(db, NULL, "proxy_pass", &vorbis_cfg.proxy_pass); | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
750 |
2124 | 751 aud_cfg_db_close(db); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
752 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
753 vf_mutex = g_mutex_new(); |
2032
55f2fd232291
associate with application/ogg mimetype.
William Pitcock <nenolod@atheme.org>
parents:
1998
diff
changeset
|
754 |
55f2fd232291
associate with application/ogg mimetype.
William Pitcock <nenolod@atheme.org>
parents:
1998
diff
changeset
|
755 aud_mime_set_plugin("application/ogg", &vorbis_ip); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
756 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
757 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
758 static void |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
759 vorbis_cleanup(void) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
760 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
761 if (vorbis_cfg.save_http_path) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
762 free(vorbis_cfg.save_http_path); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
763 vorbis_cfg.save_http_path = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
764 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
765 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
766 if (vorbis_cfg.proxy_host) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
767 free(vorbis_cfg.proxy_host); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
768 vorbis_cfg.proxy_host = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
769 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
770 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
771 if (vorbis_cfg.proxy_user) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
772 free(vorbis_cfg.proxy_user); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
773 vorbis_cfg.proxy_user = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
774 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
775 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
776 if (vorbis_cfg.proxy_pass) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
777 free(vorbis_cfg.proxy_pass); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
778 vorbis_cfg.proxy_pass = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
779 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
780 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
781 if (vorbis_cfg.tag_format) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
782 free(vorbis_cfg.tag_format); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
783 vorbis_cfg.tag_format = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
784 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
785 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
786 if (vorbis_cfg.title_encoding) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
787 free(vorbis_cfg.title_encoding); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
788 vorbis_cfg.title_encoding = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
789 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
790 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
791 g_strfreev(vorbis_tag_encoding_list); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
792 g_mutex_free(vf_mutex); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
793 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
794 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
795 static size_t |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
796 ovcb_read(void *ptr, size_t size, size_t nmemb, void *datasource) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
797 { |
478 | 798 VFSVorbisFile *handle = (VFSVorbisFile *) datasource; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
799 |
1978 | 800 return aud_vfs_fread(ptr, size, nmemb, handle->fd); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
801 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
802 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
803 static int |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
804 ovcb_seek(void *datasource, int64_t offset, int whence) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
805 { |
478 | 806 VFSVorbisFile *handle = (VFSVorbisFile *) datasource; |
807 | |
1978 | 808 return aud_vfs_fseek(handle->fd, offset, whence); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
809 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
810 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
811 static int |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
812 ovcb_close(void *datasource) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
813 { |
478 | 814 VFSVorbisFile *handle = (VFSVorbisFile *) datasource; |
815 | |
816 gint ret = 0; | |
817 | |
818 if (handle->probe == FALSE) | |
819 { | |
1978 | 820 ret = aud_vfs_fclose(handle->fd); |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
821 /* g_free(handle); it causes double free. i'm not really sure that commenting out at here is correct. --yaz*/ |
478 | 822 } |
823 | |
824 return ret; | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
825 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
826 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
827 static long |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
828 ovcb_tell(void *datasource) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
829 { |
478 | 830 VFSVorbisFile *handle = (VFSVorbisFile *) datasource; |
831 | |
1978 | 832 return aud_vfs_ftell(handle->fd); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
833 } |