Mercurial > audlegacy-plugins
annotate src/vorbis/vorbis.c @ 2914:457260d55428
Automated merge with ssh://hg.atheme-project.org//hg//audacious-plugins
author | Calin Crisan ccrisan@gmail.com |
---|---|
date | Fri, 15 Aug 2008 16:00:53 +0200 |
parents | bd3a24b39058 |
children | 3134a0987162 |
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> |
527
d124034ebea3
[svn] - glib/gi18n.h -> audacious/i18n.h for automatic dgettext support
nenolod
parents:
484
diff
changeset
|
57 #include <audacious/i18n.h> |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
58 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
59 #include "vorbis.h" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
60 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
61 extern vorbis_config_t vorbis_cfg; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
62 |
1433
d557d987e42d
vorbis: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1417
diff
changeset
|
63 static Tuple *get_song_tuple(gchar *filename); |
475 | 64 static int vorbis_check_fd(char *filename, VFSFile *stream); |
559 | 65 static void vorbis_play(InputPlayback *data); |
66 static void vorbis_stop(InputPlayback *data); | |
67 static void vorbis_pause(InputPlayback *data, short p); | |
68 static void vorbis_seek(InputPlayback *data, int time); | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
69 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
|
70 static void vorbis_aboutbox(void); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
71 static void vorbis_init(void); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
72 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
|
73 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
|
74 float *pcmout); |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
75 static gboolean vorbis_update_replaygain(ReplayGainInfo *rg_info); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
76 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
77 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
|
78 void *datasource); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
79 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
|
80 static int ovcb_close(void *datasource); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
81 static long ovcb_tell(void *datasource); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
82 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
83 ov_callbacks vorbis_callbacks = { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
84 ovcb_read, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
85 ovcb_seek, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
86 ovcb_close, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
87 ovcb_tell |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
88 }; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
89 |
2131
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
90 ov_callbacks vorbis_callbacks_stream = { |
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
91 ovcb_read, |
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
92 NULL, |
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
93 ovcb_close, |
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
94 NULL |
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
95 }; |
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
96 |
375 | 97 gchar *vorbis_fmts[] = { "ogg", "ogm", NULL }; |
98 | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
99 InputPlugin vorbis_ip = { |
1618
177aec41b238
vorbis: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1489
diff
changeset
|
100 .description = "Ogg Vorbis Audio Plugin", /* description */ |
177aec41b238
vorbis: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1489
diff
changeset
|
101 .init = vorbis_init, /* init */ |
177aec41b238
vorbis: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1489
diff
changeset
|
102 .about = vorbis_aboutbox, /* aboutbox */ |
177aec41b238
vorbis: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1489
diff
changeset
|
103 .configure = vorbis_configure, /* configure */ |
177aec41b238
vorbis: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1489
diff
changeset
|
104 .play_file = vorbis_play, |
177aec41b238
vorbis: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1489
diff
changeset
|
105 .stop = vorbis_stop, |
177aec41b238
vorbis: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1489
diff
changeset
|
106 .pause = vorbis_pause, |
177aec41b238
vorbis: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1489
diff
changeset
|
107 .seek = vorbis_seek, |
177aec41b238
vorbis: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1489
diff
changeset
|
108 .cleanup = vorbis_cleanup, |
177aec41b238
vorbis: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1489
diff
changeset
|
109 .get_song_tuple = get_song_tuple, |
177aec41b238
vorbis: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1489
diff
changeset
|
110 .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
|
111 .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
|
112 .update_song_tuple = vorbis_update_song_tuple, |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
113 }; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
114 |
1078 | 115 InputPlugin *vorbis_iplist[] = { &vorbis_ip, NULL }; |
116 | |
1395
761e17b23e0c
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
1373
diff
changeset
|
117 DECLARE_PLUGIN(vorbis, NULL, NULL, vorbis_iplist, NULL, NULL, NULL, NULL, NULL); |
1078 | 118 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
119 static OggVorbis_File vf; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
120 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
121 static GThread *thread; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
122 static volatile int seekneeded = -1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
123 static int samplerate, channels; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
124 GMutex *vf_mutex; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
125 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
126 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
|
127 static GtkWidget *about_window; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
128 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
129 static int |
475 | 130 vorbis_check_fd(char *filename, VFSFile *stream) |
131 { | |
132 OggVorbis_File vfile; /* avoid thread interaction */ | |
133 gint result; | |
478 | 134 VFSVorbisFile *fd; |
135 | |
136 fd = g_new0(VFSVorbisFile, 1); | |
137 fd->fd = stream; | |
138 fd->probe = TRUE; | |
475 | 139 |
140 /* | |
141 * The open function performs full stream detection and machine | |
142 * initialization. If it returns zero, the stream *is* Vorbis and | |
143 * we're fully ready to decode. | |
144 */ | |
145 | |
146 /* libvorbisfile isn't thread safe... */ | |
147 memset(&vfile, 0, sizeof(vfile)); | |
148 g_mutex_lock(vf_mutex); | |
149 | |
2131
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
150 result = ov_test_callbacks(fd, &vfile, NULL, 0, aud_vfs_is_streaming(stream) ? vorbis_callbacks_stream : vorbis_callbacks); |
475 | 151 |
152 switch (result) { | |
153 case OV_EREAD: | |
154 #ifdef DEBUG | |
155 g_message("** vorbis.c: Media read error: %s", filename); | |
156 #endif | |
157 g_mutex_unlock(vf_mutex); | |
158 return FALSE; | |
159 break; | |
160 case OV_ENOTVORBIS: | |
161 #ifdef DEBUG | |
162 g_message("** vorbis.c: Not Vorbis data: %s", filename); | |
163 #endif | |
164 g_mutex_unlock(vf_mutex); | |
165 return FALSE; | |
166 break; | |
167 case OV_EVERSION: | |
168 #ifdef DEBUG | |
169 g_message("** vorbis.c: Version mismatch: %s", filename); | |
170 #endif | |
171 g_mutex_unlock(vf_mutex); | |
172 return FALSE; | |
173 break; | |
174 case OV_EBADHEADER: | |
175 #ifdef DEBUG | |
176 g_message("** vorbis.c: Invalid Vorbis bistream header: %s", | |
177 filename); | |
178 #endif | |
179 g_mutex_unlock(vf_mutex); | |
180 return FALSE; | |
181 break; | |
182 case OV_EFAULT: | |
183 #ifdef DEBUG | |
184 g_message("** vorbis.c: Internal logic fault while reading %s", | |
185 filename); | |
186 #endif | |
187 g_mutex_unlock(vf_mutex); | |
188 return FALSE; | |
189 break; | |
190 case 0: | |
191 break; | |
192 default: | |
193 break; | |
194 } | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
195 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
196 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
|
197 vorbisfile.a. ov_clear will fclose it */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
198 g_mutex_unlock(vf_mutex); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
199 return TRUE; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
200 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
201 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
202 static void |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
203 vorbis_jump_to_time(InputPlayback *playback, long time) |
0
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 g_mutex_lock(vf_mutex); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
206 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
207 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
208 * 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
|
209 * 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
|
210 * to this |
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 if (time == ov_time_total(&vf, -1)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
213 time--; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
214 |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
215 playback->output->flush(time * 1000); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
216 ov_time_seek(&vf, time); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
217 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
218 g_mutex_unlock(vf_mutex); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
219 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
220 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
221 static void |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
222 do_seek(InputPlayback *playback) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
223 { |
2131
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
224 if (seekneeded != -1) { |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
225 vorbis_jump_to_time(playback, seekneeded); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
226 seekneeded = -1; |
564
6b959c9914a7
[svn] Fix a dumb mistake, and also use generic flags and get_time.
iabervon
parents:
561
diff
changeset
|
227 playback->eof = FALSE; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
228 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
229 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
230 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
231 #define PCM_FRAMES 1024 |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
232 #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
|
233 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
234 static gpointer |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
235 vorbis_play_loop(gpointer arg) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
236 { |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
237 InputPlayback *playback = arg; |
564
6b959c9914a7
[svn] Fix a dumb mistake, and also use generic flags and get_time.
iabervon
parents:
561
diff
changeset
|
238 char *filename = playback->filename; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
239 gchar *title = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
240 double time; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
241 long timercount = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
242 vorbis_info *vi; |
1372
495825028a70
Division by 1000 is not necessary.
William Pitcock <nenolod@atheme-project.org>
parents:
1370
diff
changeset
|
243 gint br; |
478 | 244 VFSVorbisFile *fd = NULL; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
245 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
246 int last_section = -1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
247 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
248 VFSFile *stream = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
249 void *datasource = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
250 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
251 /*gboolean use_rg; |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
252 /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
|
253 |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
254 ReplayGainInfo rg_info; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
255 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
256 memset(&vf, 0, sizeof(vf)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
257 |
1978 | 258 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
|
259 playback->eof = TRUE; |
478 | 260 goto play_cleanup; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
261 } |
478 | 262 |
263 fd = g_new0(VFSVorbisFile, 1); | |
264 fd->fd = stream; | |
265 datasource = (void *) fd; | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
266 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
267 /*char pcmout[4096];*/ |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
268 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
|
269 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
|
270 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
|
271 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
272 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
273 * The open function performs full stream detection and |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
274 * 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
|
275 * 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
|
276 * |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
277 * 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
|
278 * 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
|
279 * 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
|
280 * 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
|
281 * 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
|
282 */ |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
283 |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
284 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
285 g_mutex_lock(vf_mutex); |
2131
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
286 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
|
287 vorbis_callbacks.close_func(datasource); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
288 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
|
289 playback->eof = TRUE; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
290 goto play_cleanup; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
291 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
292 vi = ov_info(&vf, -1); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
293 |
2131
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
294 if (aud_vfs_is_streaming(fd->fd)) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
295 time = -1; |
2134
fd0d5615f674
Fix seeking for non-streamed files.
William Pitcock <nenolod@atheme.org>
parents:
2133
diff
changeset
|
296 else |
fd0d5615f674
Fix seeking for non-streamed files.
William Pitcock <nenolod@atheme.org>
parents:
2133
diff
changeset
|
297 time = ov_time_total(&vf, -1) * 1000; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
298 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
299 if (vi->channels > 2) { |
564
6b959c9914a7
[svn] Fix a dumb mistake, and also use generic flags and get_time.
iabervon
parents:
561
diff
changeset
|
300 playback->eof = TRUE; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
301 g_mutex_unlock(vf_mutex); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
302 goto play_cleanup; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
303 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
304 |
1372
495825028a70
Division by 1000 is not necessary.
William Pitcock <nenolod@atheme-project.org>
parents:
1370
diff
changeset
|
305 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
|
306 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
|
307 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
|
308 |
1372
495825028a70
Division by 1000 is not necessary.
William Pitcock <nenolod@atheme-project.org>
parents:
1370
diff
changeset
|
309 vi = ov_info(&vf, -1); |
495825028a70
Division by 1000 is not necessary.
William Pitcock <nenolod@atheme-project.org>
parents:
1370
diff
changeset
|
310 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
311 samplerate = vi->rate; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
312 channels = vi->channels; |
1372
495825028a70
Division by 1000 is not necessary.
William Pitcock <nenolod@atheme-project.org>
parents:
1370
diff
changeset
|
313 br = vi->bitrate_nominal; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
314 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
315 g_mutex_unlock(vf_mutex); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
316 |
1987 | 317 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
|
318 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
|
319 playback->error = TRUE; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
320 goto play_cleanup; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
321 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
322 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
323 seekneeded = -1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
324 |
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 * 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
|
327 * 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
|
328 * 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
|
329 * using the ov_ interface. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
330 */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
331 |
564
6b959c9914a7
[svn] Fix a dumb mistake, and also use generic flags and get_time.
iabervon
parents:
561
diff
changeset
|
332 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
|
333 |
564
6b959c9914a7
[svn] Fix a dumb mistake, and also use generic flags and get_time.
iabervon
parents:
561
diff
changeset
|
334 if (playback->eof) { |
1676
aee4ebea943a
xmms_usleep() was removed, use g_usleep()
Matti Hamalainen <ccr@tnsp.org>
parents:
1618
diff
changeset
|
335 g_usleep(20000); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
336 continue; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
337 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
338 |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
339 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
|
340 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
|
341 |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
342 |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
343 int current_section = last_section; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
344 |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
345 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
|
346 |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
347 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
|
348 |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
349 if (bytes > 0) |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
350 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
|
351 |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
352 /* |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
353 * 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
|
354 */ |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
355 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
|
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 * EOF |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
358 */ |
2375
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
359 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
|
360 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
|
361 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
|
362 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
|
363 } |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
364 |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
365 if (current_section <= last_section) { |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
366 /* |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
367 * 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
|
368 * 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
|
369 * requests the current one |
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 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
|
372 |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
373 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
|
374 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
|
375 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
|
376 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
|
377 } |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
378 |
533
2fa253251598
[svn] - fix uninitialized value conditional jump, maybe it will help
nenolod
parents:
527
diff
changeset
|
379 |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
380 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
|
381 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
|
382 channels = vi->channels; |
2375
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
383 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
|
384 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
|
385 if (!playback->output-> |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
386 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
|
387 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
|
388 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
|
389 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
|
390 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
|
391 } |
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->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
|
393 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
|
394 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
|
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 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
397 |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
398 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
|
399 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
400 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
|
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 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
|
403 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
|
404 |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
405 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
|
406 do_seek(playback); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
407 |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
408 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
|
409 |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
410 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
|
411 /* |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
412 * 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
|
413 * current section |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
414 */ |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
415 if (title) |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
416 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
|
417 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
418 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
|
419 title = vorbis_generate_title(&vf, filename); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
420 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
421 if (time != -1) |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
422 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
|
423 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
424 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
|
425 |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
426 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
|
427 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
428 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
|
429 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
430 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
|
431 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
432 } |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
433 } /* 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
|
434 |
2375
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
435 if (!playback->error) { |
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
436 /*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
|
437 * 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
|
438 * |
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
439 * majeru |
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
440 */ |
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
441 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
|
442 while(playback->output->buffer_playing()) { |
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
443 AUDDBG("waiting for empty output buffer\n"); |
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
444 g_usleep(50000); |
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
445 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
446 |
2375
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
447 playback->output->close_audio(); |
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
448 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
449 |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
450 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
451 play_cleanup: |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
452 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
|
453 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
454 /* |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
455 * 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
|
456 * 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
|
457 */ |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
458 g_mutex_lock(vf_mutex); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
459 ov_clear(&vf); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
460 g_mutex_unlock(vf_mutex); |
1373
85ffec632924
Use InputPlayback.playing properly.
William Pitcock <nenolod@atheme-project.org>
parents:
1372
diff
changeset
|
461 playback->playing = 0; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
462 return NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
463 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
464 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
465 static void |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
466 vorbis_play(InputPlayback *playback) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
467 { |
564
6b959c9914a7
[svn] Fix a dumb mistake, and also use generic flags and get_time.
iabervon
parents:
561
diff
changeset
|
468 playback->playing = 1; |
6b959c9914a7
[svn] Fix a dumb mistake, and also use generic flags and get_time.
iabervon
parents:
561
diff
changeset
|
469 playback->eof = 0; |
6b959c9914a7
[svn] Fix a dumb mistake, and also use generic flags and get_time.
iabervon
parents:
561
diff
changeset
|
470 playback->error = FALSE; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
471 |
1352
ab66f3ee7a11
vorbis: new threading model
William Pitcock <nenolod@atheme-project.org>
parents:
1279
diff
changeset
|
472 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
|
473 playback->set_pb_ready(playback); |
1352
ab66f3ee7a11
vorbis: new threading model
William Pitcock <nenolod@atheme-project.org>
parents:
1279
diff
changeset
|
474 vorbis_play_loop(playback); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
475 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
476 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
477 static void |
564
6b959c9914a7
[svn] Fix a dumb mistake, and also use generic flags and get_time.
iabervon
parents:
561
diff
changeset
|
478 vorbis_stop(InputPlayback *playback) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
479 { |
564
6b959c9914a7
[svn] Fix a dumb mistake, and also use generic flags and get_time.
iabervon
parents:
561
diff
changeset
|
480 if (playback->playing) { |
6b959c9914a7
[svn] Fix a dumb mistake, and also use generic flags and get_time.
iabervon
parents:
561
diff
changeset
|
481 playback->playing = 0; |
2375
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
482 AUDDBG("waiting for playback thread finished\n"); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
483 g_thread_join(thread); |
2375
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
484 AUDDBG("playback finished\n"); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
485 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
486 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
487 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
488 static void |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
489 vorbis_pause(InputPlayback *playback, short p) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
490 { |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
491 playback->output->pause(p); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
492 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
493 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
494 static void |
559 | 495 vorbis_seek(InputPlayback *data, int time) |
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 seekneeded = time; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
498 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
499 while (seekneeded != -1) |
1676
aee4ebea943a
xmms_usleep() was removed, use g_usleep()
Matti Hamalainen <ccr@tnsp.org>
parents:
1618
diff
changeset
|
500 g_usleep(20000); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
501 } |
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 /* 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
|
504 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
505 static gboolean |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
506 vorbis_update_replaygain(ReplayGainInfo *rg_info) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
507 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
508 vorbis_comment *comment; |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
509 char *rg_gain = NULL, *rg_peak = NULL; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
510 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
511 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
|
512 return FALSE; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
513 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
514 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
|
515 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
|
516 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
|
517 |
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_track_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_radio", 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->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
|
521 |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
522 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
|
523 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
|
524 |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
525 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
|
526 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
|
527 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
|
528 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
529 return TRUE; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
530 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
531 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
532 static long |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
533 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
|
534 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
535 int i, j; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
536 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
|
537 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
|
538 *pcmout++ = pcm[j][i]; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
539 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
540 return ch * samples * sizeof(float); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
541 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
542 |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1973
diff
changeset
|
543 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
|
544 { |
1687
d158ce84fda7
Modified for Tuplez/plugin API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1489
diff
changeset
|
545 if (string) { |
2050
2ffc6a69fcd1
string API calls -> vtable
William Pitcock <nenolod@atheme.org>
parents:
2033
diff
changeset
|
546 gchar *str = aud_str_to_utf8(string); |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1973
diff
changeset
|
547 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
|
548 g_free(str); |
d158ce84fda7
Modified for Tuplez/plugin API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1489
diff
changeset
|
549 } |
1433
d557d987e42d
vorbis: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1417
diff
changeset
|
550 } |
d557d987e42d
vorbis: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1417
diff
changeset
|
551 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
552 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
553 * Ok, nhjm449! Are you *happy* now?! -nenolod |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
554 */ |
1433
d557d987e42d
vorbis: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1417
diff
changeset
|
555 static Tuple * |
2131
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
556 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
|
557 { |
2131
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
558 VFSVorbisFile *vfd = (VFSVorbisFile *) vorbisfile->datasource; |
1433
d557d987e42d
vorbis: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1417
diff
changeset
|
559 Tuple *tuple = NULL; |
2134
fd0d5615f674
Fix seeking for non-streamed files.
William Pitcock <nenolod@atheme.org>
parents:
2133
diff
changeset
|
560 gint length; |
2212
a13b8f308dce
vorbis: mimetype field added. also little fix
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2211
diff
changeset
|
561 vorbis_comment *comment = NULL; |
2131
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
562 |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1973
diff
changeset
|
563 tuple = aud_tuple_new_from_filename(filename); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
564 |
2134
fd0d5615f674
Fix seeking for non-streamed files.
William Pitcock <nenolod@atheme.org>
parents:
2133
diff
changeset
|
565 if (aud_vfs_is_streaming(vfd->fd)) |
fd0d5615f674
Fix seeking for non-streamed files.
William Pitcock <nenolod@atheme.org>
parents:
2133
diff
changeset
|
566 length = -1; |
fd0d5615f674
Fix seeking for non-streamed files.
William Pitcock <nenolod@atheme.org>
parents:
2133
diff
changeset
|
567 else |
fd0d5615f674
Fix seeking for non-streamed files.
William Pitcock <nenolod@atheme.org>
parents:
2133
diff
changeset
|
568 length = ov_time_total(vorbisfile, -1) * 1000; |
fd0d5615f674
Fix seeking for non-streamed files.
William Pitcock <nenolod@atheme.org>
parents:
2133
diff
changeset
|
569 |
fd0d5615f674
Fix seeking for non-streamed files.
William Pitcock <nenolod@atheme.org>
parents:
2133
diff
changeset
|
570 /* associate with tuple */ |
fd0d5615f674
Fix seeking for non-streamed files.
William Pitcock <nenolod@atheme.org>
parents:
2133
diff
changeset
|
571 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
|
572 /* 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
|
573 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
|
574 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
575 if ((comment = ov_comment(vorbisfile, -1))) { |
1687
d158ce84fda7
Modified for Tuplez/plugin API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1489
diff
changeset
|
576 gchar *tmps; |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1973
diff
changeset
|
577 _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
|
578 _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
|
579 _aud_tuple_associate_string(tuple, FIELD_ALBUM, NULL, vorbis_comment_query(comment, "album", 0)); |
2106 | 580 _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
|
581 _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
|
582 _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
|
583 |
1687
d158ce84fda7
Modified for Tuplez/plugin API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1489
diff
changeset
|
584 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
|
585 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
|
586 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
587 |
2212
a13b8f308dce
vorbis: mimetype field added. also little fix
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2211
diff
changeset
|
588 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
|
589 |
2212
a13b8f308dce
vorbis: mimetype field added. also little fix
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2211
diff
changeset
|
590 if (comment && comment->vendor) |
a13b8f308dce
vorbis: mimetype field added. also little fix
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2211
diff
changeset
|
591 { |
a13b8f308dce
vorbis: mimetype field added. also little fix
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2211
diff
changeset
|
592 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
|
593 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
|
594 g_free(codec); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
595 } |
2212
a13b8f308dce
vorbis: mimetype field added. also little fix
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2211
diff
changeset
|
596 else |
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, "Ogg Vorbis"); |
a13b8f308dce
vorbis: mimetype field added. also little fix
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2211
diff
changeset
|
598 |
a13b8f308dce
vorbis: mimetype field added. also little fix
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2211
diff
changeset
|
599 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
|
600 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
601 return tuple; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
602 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
603 |
1433
d557d987e42d
vorbis: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1417
diff
changeset
|
604 static Tuple * |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
605 get_song_tuple(gchar *filename) |
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 VFSFile *stream = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
608 OggVorbis_File vfile; /* avoid thread interaction */ |
1433
d557d987e42d
vorbis: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1417
diff
changeset
|
609 Tuple *tuple = NULL; |
481 | 610 VFSVorbisFile *fd = NULL; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
611 |
1978 | 612 if ((stream = aud_vfs_fopen(filename, "r")) == NULL) |
481 | 613 return NULL; |
614 | |
615 fd = g_new0(VFSVorbisFile, 1); | |
616 fd->fd = stream; | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
617 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
618 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
619 * The open function performs full stream detection and |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
620 * machine initialization. If it returns zero, the stream |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
621 * *is* Vorbis and we're fully ready to decode. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
622 */ |
2131
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
623 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
|
624 aud_vfs_fclose(stream); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
625 return NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
626 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
627 |
2131
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
628 tuple = get_aud_tuple_for_vorbisfile(&vfile, filename); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
629 |
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 * once the ov_open succeeds, the stream belongs to |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
632 * vorbisfile.a. ov_clear will fclose it |
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 ov_clear(&vfile); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
635 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
636 return tuple; |
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 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
639 static gchar * |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
640 vorbis_generate_title(OggVorbis_File * vorbisfile, gchar * filename) |
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 /* Caller should hold vf_mutex */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
643 gchar *displaytitle = NULL; |
1433
d557d987e42d
vorbis: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1417
diff
changeset
|
644 Tuple *input; |
545
f9dc3d58207a
[svn] - display the stream title if it's available, like in mp3 streams
nenolod
parents:
544
diff
changeset
|
645 gchar *tmp; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
646 |
2131
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
647 input = get_aud_tuple_for_vorbisfile(vorbisfile, filename); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
648 |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1973
diff
changeset
|
649 displaytitle = aud_tuple_formatter_make_title_string(input, vorbis_cfg.tag_override ? |
2055 | 650 vorbis_cfg.tag_format : aud_get_gentitle_format()); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
651 |
1978 | 652 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
|
653 { |
f9dc3d58207a
[svn] - display the stream title if it's available, like in mp3 streams
nenolod
parents:
544
diff
changeset
|
654 gchar *old = displaytitle; |
1433
d557d987e42d
vorbis: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1417
diff
changeset
|
655 |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1973
diff
changeset
|
656 aud_tuple_associate_string(input, -1, "stream", tmp); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1973
diff
changeset
|
657 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
|
658 |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1973
diff
changeset
|
659 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
|
660 |
f9dc3d58207a
[svn] - display the stream title if it's available, like in mp3 streams
nenolod
parents:
544
diff
changeset
|
661 g_free(old); |
f9dc3d58207a
[svn] - display the stream title if it's available, like in mp3 streams
nenolod
parents:
544
diff
changeset
|
662 g_free(tmp); |
f9dc3d58207a
[svn] - display the stream title if it's available, like in mp3 streams
nenolod
parents:
544
diff
changeset
|
663 } |
f9dc3d58207a
[svn] - display the stream title if it's available, like in mp3 streams
nenolod
parents:
544
diff
changeset
|
664 |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1973
diff
changeset
|
665 aud_tuple_free(input); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
666 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
667 return displaytitle; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
668 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
669 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
670 static void |
1433
d557d987e42d
vorbis: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1417
diff
changeset
|
671 vorbis_aboutbox(void) |
0
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 if (about_window) |
2191
329267b09658
get rid of talking with GDK directly
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2134
diff
changeset
|
674 gtk_window_present(GTK_WINDOW(about_window)); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
675 else |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
676 { |
1677
f6f5603a0954
xmms_show_message() changed to audacious_info_dialog()
Matti Hamalainen <ccr@tnsp.org>
parents:
1676
diff
changeset
|
677 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
|
678 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
679 * I18N: UTF-8 Translation: "Haavard Kvaalen" -> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
680 * "H\303\245vard Kv\303\245len" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
681 */ |
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 ("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
|
684 "Original code by\n" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
685 "Tony Arcieri <bascule@inferno.tusculum.edu>\n" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
686 "Contributions from\n" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
687 "Chris Montgomery <monty@xiph.org>\n" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
688 "Peter Alm <peter@xmms.org>\n" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
689 "Michael Smith <msmith@labyrinth.edu.au>\n" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
690 "Jack Moffitt <jack@icecast.org>\n" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
691 "Jorn Baayen <jorn@nl.linux.org>\n" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
692 "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
|
693 "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
|
694 "Eugene Zagidullin <e.asphyx@gmail.com>\n\n" |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
695 "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
|
696 _("Ok"), FALSE, NULL, NULL); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
697 g_signal_connect(G_OBJECT(about_window), "destroy", |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
698 G_CALLBACK(gtk_widget_destroyed), &about_window); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
699 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
700 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
701 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
702 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
703 static void |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
704 vorbis_init(void) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
705 { |
2523
769e17da93dd
Replaced s/ConfigDb/mcs_handle_t/g, as per changes in the core.
Matti Hamalainen <ccr@tnsp.org>
parents:
2496
diff
changeset
|
706 mcs_handle_t *db; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
707 gchar *tmp = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
708 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
709 memset(&vorbis_cfg, 0, sizeof(vorbis_config_t)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
710 vorbis_cfg.http_buffer_size = 128; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
711 vorbis_cfg.http_prebuffer = 25; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
712 vorbis_cfg.proxy_port = 8080; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
713 vorbis_cfg.proxy_use_auth = FALSE; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
714 vorbis_cfg.proxy_user = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
715 vorbis_cfg.proxy_pass = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
716 vorbis_cfg.tag_override = FALSE; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
717 vorbis_cfg.tag_format = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
718 |
2124 | 719 db = aud_cfg_db_open(); |
720 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
|
721 &vorbis_cfg.http_buffer_size); |
2124 | 722 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
|
723 &vorbis_cfg.http_prebuffer); |
2124 | 724 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
|
725 &vorbis_cfg.save_http_stream); |
2124 | 726 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
|
727 &vorbis_cfg.save_http_path)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
728 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
|
729 |
2124 | 730 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
|
731 &vorbis_cfg.tag_override); |
2124 | 732 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
|
733 &vorbis_cfg.tag_format)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
734 vorbis_cfg.tag_format = g_strdup("%p - %t"); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
735 |
2124 | 736 aud_cfg_db_get_bool(db, NULL, "use_proxy", &vorbis_cfg.use_proxy); |
737 aud_cfg_db_get_string(db, NULL, "proxy_host", &vorbis_cfg.proxy_host); | |
738 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
|
739 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
740 if (tmp != NULL) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
741 vorbis_cfg.proxy_port = atoi(tmp); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
742 |
2124 | 743 aud_cfg_db_get_bool(db, NULL, "proxy_use_auth", &vorbis_cfg.proxy_use_auth); |
744 aud_cfg_db_get_string(db, NULL, "proxy_user", &vorbis_cfg.proxy_user); | |
745 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
|
746 |
2124 | 747 aud_cfg_db_close(db); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
748 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
749 vf_mutex = g_mutex_new(); |
2032
55f2fd232291
associate with application/ogg mimetype.
William Pitcock <nenolod@atheme.org>
parents:
1998
diff
changeset
|
750 |
55f2fd232291
associate with application/ogg mimetype.
William Pitcock <nenolod@atheme.org>
parents:
1998
diff
changeset
|
751 aud_mime_set_plugin("application/ogg", &vorbis_ip); |
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 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
754 static void |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
755 vorbis_cleanup(void) |
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 if (vorbis_cfg.save_http_path) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
758 free(vorbis_cfg.save_http_path); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
759 vorbis_cfg.save_http_path = NULL; |
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 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
762 if (vorbis_cfg.proxy_host) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
763 free(vorbis_cfg.proxy_host); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
764 vorbis_cfg.proxy_host = NULL; |
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 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
767 if (vorbis_cfg.proxy_user) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
768 free(vorbis_cfg.proxy_user); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
769 vorbis_cfg.proxy_user = NULL; |
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 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
772 if (vorbis_cfg.proxy_pass) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
773 free(vorbis_cfg.proxy_pass); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
774 vorbis_cfg.proxy_pass = NULL; |
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 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
777 if (vorbis_cfg.tag_format) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
778 free(vorbis_cfg.tag_format); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
779 vorbis_cfg.tag_format = NULL; |
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 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
782 if (vorbis_cfg.title_encoding) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
783 free(vorbis_cfg.title_encoding); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
784 vorbis_cfg.title_encoding = NULL; |
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 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
787 g_strfreev(vorbis_tag_encoding_list); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
788 g_mutex_free(vf_mutex); |
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 static size_t |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
792 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
|
793 { |
478 | 794 VFSVorbisFile *handle = (VFSVorbisFile *) datasource; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
795 |
1978 | 796 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
|
797 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
798 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
799 static int |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
800 ovcb_seek(void *datasource, int64_t offset, int whence) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
801 { |
478 | 802 VFSVorbisFile *handle = (VFSVorbisFile *) datasource; |
803 | |
1978 | 804 return aud_vfs_fseek(handle->fd, offset, whence); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
805 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
806 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
807 static int |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
808 ovcb_close(void *datasource) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
809 { |
478 | 810 VFSVorbisFile *handle = (VFSVorbisFile *) datasource; |
811 | |
812 gint ret = 0; | |
813 | |
814 if (handle->probe == FALSE) | |
815 { | |
1978 | 816 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
|
817 /* g_free(handle); it causes double free. i'm not really sure that commenting out at here is correct. --yaz*/ |
478 | 818 } |
819 | |
820 return ret; | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
821 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
822 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
823 static long |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
824 ovcb_tell(void *datasource) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
825 { |
478 | 826 VFSVorbisFile *handle = (VFSVorbisFile *) datasource; |
827 | |
1978 | 828 return aud_vfs_ftell(handle->fd); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
829 } |