Mercurial > audlegacy-plugins
annotate src/tta/libtta.c @ 1410:cc6203a8cc9f
Switched to new threading model
author | Christian Birchinger <joker@netswarm.net> |
---|---|
date | Mon, 06 Aug 2007 00:58:12 +0200 |
parents | 761e17b23e0c |
children | 90af998f55fa |
rev | line source |
---|---|
290 | 1 /* |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
2 * libtta.c |
290 | 3 * |
4 * Description: TTA input plug-in for Audacious | |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
5 * Developed by: Alexander Djourik <ald@true-audio.com> |
290 | 6 * Audacious port: Yoshiki Yazawa <yaz@cc.rim.or.jp> |
7 * | |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
8 * Copyright (c) 2007 Alexander Djourik. All rights reserved. |
290 | 9 * |
10 */ | |
11 | |
12 /* | |
13 * This library is free software; you can redistribute it and/or | |
14 * modify it under the terms of the GNU Lesser General Public | |
15 * License as published by the Free Software Foundation; either | |
16 * version 2.1 of the License, or (at your option) any later version. | |
17 * | |
18 * This library is distributed in the hope that it will be useful, | |
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
21 * Lesser General Public License for more details. | |
22 * | |
23 * You should have received a copy of the GNU Lesser General Public | |
24 * License along with this library; if not, write to the Free Software | |
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
26 * | |
27 * Please see the file COPYING in this directory for full copyright | |
28 * information. | |
29 */ | |
528 | 30 |
31 #ifdef HAVE_CONFIG_H | |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
32 #include "config.h" |
528 | 33 #endif |
34 | |
290 | 35 #include <stdio.h> |
36 #include <stdlib.h> | |
37 #include <string.h> | |
38 #include <time.h> | |
39 #include <sys/types.h> | |
40 #include <sys/stat.h> | |
41 #include <glib.h> | |
42 #include <string.h> | |
43 | |
44 #include <audacious/util.h> | |
45 #include <audacious/plugin.h> | |
46 #include <audacious/titlestring.h> | |
47 #include <audacious/vfs.h> | |
520
8f1785471613
[svn] - add missing inclusion of audacious/strings.h where necessary
giacomo
parents:
443
diff
changeset
|
48 #include <audacious/output.h> |
8f1785471613
[svn] - add missing inclusion of audacious/strings.h where necessary
giacomo
parents:
443
diff
changeset
|
49 #include <audacious/strings.h> |
527
d124034ebea3
[svn] - glib/gi18n.h -> audacious/i18n.h for automatic dgettext support
nenolod
parents:
520
diff
changeset
|
50 #include <audacious/i18n.h> |
290 | 51 |
661 | 52 #include <audacious/id3tag.h> |
290 | 53 |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
54 #define PLUGIN_VERSION "1.4" |
290 | 55 #define PROJECT_URL "<http://www.true-audio.com>" |
56 | |
57 #include "ttalib.h" | |
58 | |
59 #define OUTPUT_ERROR (MEMORY_ERROR+1) | |
60 #define MAX_BSIZE (MAX_BPS>>3) | |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
61 #define BYTES(x) ((x) * sizeof(id3_ucs4_t)) |
290 | 62 |
63 static void init (); | |
64 static void cleanup (); | |
65 static int is_our_file (char *filename); | |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
528
diff
changeset
|
66 static void play_file (InputPlayback *playback); |
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
528
diff
changeset
|
67 static void tta_pause (InputPlayback *playback, short paused); |
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
528
diff
changeset
|
68 static void stop (InputPlayback *playback); |
1366
4c43c38bd033
- adapt tta for new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1325
diff
changeset
|
69 static void mseek (InputPlayback *playback, gulong millisec); |
4c43c38bd033
- adapt tta for new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1325
diff
changeset
|
70 static void seek (InputPlayback *playback, int sec); |
290 | 71 static void get_song_info (char *filename, char **title, int *length); |
72 static void file_info (char *filename); | |
73 static void about (); | |
74 static TitleInput *get_song_tuple(char *filename); | |
75 static gchar *extname(const char *filename); | |
851 | 76 |
1366
4c43c38bd033
- adapt tta for new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1325
diff
changeset
|
77 static GThread *decode_thread = NULL; |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
78 static char sample_buffer[PCM_BUFFER_LENGTH * MAX_BSIZE * MAX_NCH]; |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
79 static tta_info info; // currently playing file info |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
80 static int seek_position = -1; |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
81 static int read_samples = -1; |
290 | 82 |
372
a157306caf03
[svn] - finalize the plugin-side of the extension-assist ABI
nenolod
parents:
368
diff
changeset
|
83 gchar *tta_fmts[] = { "tta", NULL }; |
a157306caf03
[svn] - finalize the plugin-side of the extension-assist ABI
nenolod
parents:
368
diff
changeset
|
84 |
1321
f0b81aeed25f
Thank you for your help, Giacomo. ;-)
Stany HENRY <StrassBoy@gmail.com>
parents:
1296
diff
changeset
|
85 InputPlugin tta_ip = |
290 | 86 { |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
87 NULL, |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
88 NULL, |
1087 | 89 "True Audio Plugin", |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
90 init, |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
91 about, |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
92 NULL, |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
93 is_our_file, |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
94 NULL, |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
95 play_file, |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
96 stop, |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
97 tta_pause, |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
98 seek, |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
99 NULL, |
1366
4c43c38bd033
- adapt tta for new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1325
diff
changeset
|
100 NULL, |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
101 NULL, |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
102 NULL, |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
103 cleanup, |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
104 NULL, |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
105 NULL, |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
106 NULL, |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
107 NULL, |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
108 get_song_info, |
1321
f0b81aeed25f
Thank you for your help, Giacomo. ;-)
Stany HENRY <StrassBoy@gmail.com>
parents:
1296
diff
changeset
|
109 file_info, |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
110 NULL, |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
111 get_song_tuple, // get_song_tuple |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
112 NULL, // set_song_tuple |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
113 NULL, // buffer |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
114 NULL, // vfs |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
115 tta_fmts, |
1366
4c43c38bd033
- adapt tta for new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1325
diff
changeset
|
116 mseek, |
290 | 117 }; |
118 | |
1087 | 119 InputPlugin *tta_iplist[] = { &tta_ip, NULL }; |
120 | |
1395
761e17b23e0c
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
1366
diff
changeset
|
121 DECLARE_PLUGIN(tta, NULL, NULL, tta_iplist, NULL, NULL, NULL, NULL, NULL); |
290 | 122 |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
123 size_t |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
124 file_size (char *filename) |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
125 { |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
126 VFSFile *f; |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
127 size_t size = -1; |
290 | 128 |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
129 if ((f = vfs_fopen (filename, "r"))) |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
130 { |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
131 vfs_fseek (f, 0, SEEK_END); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
132 size = vfs_ftell (f); |
1321
f0b81aeed25f
Thank you for your help, Giacomo. ;-)
Stany HENRY <StrassBoy@gmail.com>
parents:
1296
diff
changeset
|
133 vfs_fclose (f); |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
134 } |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
135 return size; |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
136 } |
851 | 137 |
290 | 138 static void |
139 tta_error (int error) | |
140 { | |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
141 char *message; |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
142 static GtkWidget *errorbox; |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
143 if (errorbox != NULL) return; |
290 | 144 |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
145 switch (error) |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
146 { |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
147 case OPEN_ERROR: |
1321
f0b81aeed25f
Thank you for your help, Giacomo. ;-)
Stany HENRY <StrassBoy@gmail.com>
parents:
1296
diff
changeset
|
148 message = _("Can't open file\n"); |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
149 break; |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
150 case FORMAT_ERROR: |
1321
f0b81aeed25f
Thank you for your help, Giacomo. ;-)
Stany HENRY <StrassBoy@gmail.com>
parents:
1296
diff
changeset
|
151 message = _("Not supported file format\n"); |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
152 break; |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
153 case FILE_ERROR: |
1321
f0b81aeed25f
Thank you for your help, Giacomo. ;-)
Stany HENRY <StrassBoy@gmail.com>
parents:
1296
diff
changeset
|
154 message = _("File is corrupted\n"); |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
155 break; |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
156 case READ_ERROR: |
1321
f0b81aeed25f
Thank you for your help, Giacomo. ;-)
Stany HENRY <StrassBoy@gmail.com>
parents:
1296
diff
changeset
|
157 message = _("Can't read from file\n"); |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
158 break; |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
159 case MEMORY_ERROR: |
1321
f0b81aeed25f
Thank you for your help, Giacomo. ;-)
Stany HENRY <StrassBoy@gmail.com>
parents:
1296
diff
changeset
|
160 message = _("Insufficient memory available\n"); |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
161 break; |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
162 case OUTPUT_ERROR: |
1321
f0b81aeed25f
Thank you for your help, Giacomo. ;-)
Stany HENRY <StrassBoy@gmail.com>
parents:
1296
diff
changeset
|
163 message = _("Output plugin error\n"); |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
164 break; |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
165 default: |
1321
f0b81aeed25f
Thank you for your help, Giacomo. ;-)
Stany HENRY <StrassBoy@gmail.com>
parents:
1296
diff
changeset
|
166 message = _("Unknown error\n"); |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
167 break; |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
168 } |
290 | 169 |
1321
f0b81aeed25f
Thank you for your help, Giacomo. ;-)
Stany HENRY <StrassBoy@gmail.com>
parents:
1296
diff
changeset
|
170 xmms_show_message (_("TTA Decoder Error"), message, |
f0b81aeed25f
Thank you for your help, Giacomo. ;-)
Stany HENRY <StrassBoy@gmail.com>
parents:
1296
diff
changeset
|
171 _("Ok"), FALSE, NULL, NULL); |
290 | 172 |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
173 gtk_signal_connect(GTK_OBJECT(errorbox), "destroy", |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
174 G_CALLBACK(gtk_widget_destroyed), &errorbox); |
290 | 175 } |
176 | |
177 static gchar * | |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
178 get_song_title(TitleInput *tuple) |
290 | 179 { |
1166 | 180 return xmms_get_titlestring(xmms_get_gentitle_format(), tuple); |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
181 } |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
182 |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
183 static void |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
184 get_song_info (char *filename, char **title, int *length) |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
185 { |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
186 TitleInput *tuple; |
290 | 187 |
1165 | 188 *length = -1; |
189 *title = NULL; | |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
190 |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
191 if ((tuple = get_song_tuple(filename)) != NULL) { |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
192 *length = tuple->length; |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
193 *title = get_song_title(tuple); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
194 } |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
195 |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
196 bmp_title_input_free(tuple); |
290 | 197 } |
198 | |
199 static void * | |
1366
4c43c38bd033
- adapt tta for new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1325
diff
changeset
|
200 play_loop (InputPlayback *playback) |
290 | 201 { |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
202 int bufsize = PCM_BUFFER_LENGTH * info.BSIZE * info.NCH; |
290 | 203 |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
204 //////////////////////////////////////// |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
205 // decode PCM_BUFFER_LENGTH samples |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
206 // into the current PCM buffer position |
290 | 207 |
1366
4c43c38bd033
- adapt tta for new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1325
diff
changeset
|
208 while (playback->playing) |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
209 { |
1190
ed2d7787779e
more warning elimination.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1166
diff
changeset
|
210 while ((read_samples = get_samples ((unsigned char *)sample_buffer)) > 0) |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
211 { |
851 | 212 |
1366
4c43c38bd033
- adapt tta for new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1325
diff
changeset
|
213 while ((playback->output->buffer_free () < bufsize) |
4c43c38bd033
- adapt tta for new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1325
diff
changeset
|
214 && seek_position == -1) |
4c43c38bd033
- adapt tta for new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1325
diff
changeset
|
215 { |
4c43c38bd033
- adapt tta for new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1325
diff
changeset
|
216 if (!playback->playing) |
4c43c38bd033
- adapt tta for new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1325
diff
changeset
|
217 goto DONE; |
4c43c38bd033
- adapt tta for new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1325
diff
changeset
|
218 xmms_usleep (10000); |
4c43c38bd033
- adapt tta for new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1325
diff
changeset
|
219 } |
4c43c38bd033
- adapt tta for new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1325
diff
changeset
|
220 if (seek_position == -1) |
4c43c38bd033
- adapt tta for new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1325
diff
changeset
|
221 { |
4c43c38bd033
- adapt tta for new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1325
diff
changeset
|
222 produce_audio(playback->output->written_time(), |
4c43c38bd033
- adapt tta for new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1325
diff
changeset
|
223 ((info.BPS == 8) ? FMT_U8 : FMT_S16_LE), |
4c43c38bd033
- adapt tta for new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1325
diff
changeset
|
224 info.NCH, |
4c43c38bd033
- adapt tta for new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1325
diff
changeset
|
225 read_samples * info.NCH * info.BSIZE, |
4c43c38bd033
- adapt tta for new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1325
diff
changeset
|
226 sample_buffer, |
4c43c38bd033
- adapt tta for new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1325
diff
changeset
|
227 &playback->playing); |
4c43c38bd033
- adapt tta for new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1325
diff
changeset
|
228 } |
4c43c38bd033
- adapt tta for new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1325
diff
changeset
|
229 else |
4c43c38bd033
- adapt tta for new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1325
diff
changeset
|
230 { |
4c43c38bd033
- adapt tta for new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1325
diff
changeset
|
231 set_position (seek_position); |
4c43c38bd033
- adapt tta for new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1325
diff
changeset
|
232 playback->output->flush (seek_position * SEEK_STEP); |
4c43c38bd033
- adapt tta for new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1325
diff
changeset
|
233 seek_position = -1; |
4c43c38bd033
- adapt tta for new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1325
diff
changeset
|
234 } |
4c43c38bd033
- adapt tta for new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1325
diff
changeset
|
235 if(!playback->playing) |
4c43c38bd033
- adapt tta for new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1325
diff
changeset
|
236 goto DONE; |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
237 } |
851 | 238 |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
239 playback->output->buffer_free (); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
240 playback->output->buffer_free (); |
1270
d73eed18f3f4
make tta decode easy to be interrupted.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1237
diff
changeset
|
241 while (playback->output->buffer_playing()) { |
d73eed18f3f4
make tta decode easy to be interrupted.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1237
diff
changeset
|
242 xmms_usleep(10000); |
1366
4c43c38bd033
- adapt tta for new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1325
diff
changeset
|
243 if(!playback->playing) |
1270
d73eed18f3f4
make tta decode easy to be interrupted.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1237
diff
changeset
|
244 goto DONE; |
d73eed18f3f4
make tta decode easy to be interrupted.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1237
diff
changeset
|
245 } |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
246 } |
290 | 247 |
851 | 248 DONE: |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
249 //////////////////////// |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
250 // destroy memory pools |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
251 player_stop (); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
252 |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
253 /////////////////////////////// |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
254 // close currently playing file |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
255 close_tta_file (&info); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
256 |
1366
4c43c38bd033
- adapt tta for new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1325
diff
changeset
|
257 return NULL; |
290 | 258 } |
259 | |
260 static void | |
261 init () | |
262 { | |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
263 memset (&info, 0, sizeof (tta_info)); |
290 | 264 } |
265 | |
266 static void | |
267 cleanup () | |
268 { | |
269 } | |
270 | |
271 static void | |
272 about () | |
273 { | |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
274 static GtkWidget *aboutbox; |
1321
f0b81aeed25f
Thank you for your help, Giacomo. ;-)
Stany HENRY <StrassBoy@gmail.com>
parents:
1296
diff
changeset
|
275 gchar *about_text; |
f0b81aeed25f
Thank you for your help, Giacomo. ;-)
Stany HENRY <StrassBoy@gmail.com>
parents:
1296
diff
changeset
|
276 |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
277 if (aboutbox != NULL) return; |
290 | 278 |
1321
f0b81aeed25f
Thank you for your help, Giacomo. ;-)
Stany HENRY <StrassBoy@gmail.com>
parents:
1296
diff
changeset
|
279 about_text = g_strjoin("", _("TTA input plugin "), PLUGIN_VERSION, |
f0b81aeed25f
Thank you for your help, Giacomo. ;-)
Stany HENRY <StrassBoy@gmail.com>
parents:
1296
diff
changeset
|
280 _(" for BMP\n" |
f0b81aeed25f
Thank you for your help, Giacomo. ;-)
Stany HENRY <StrassBoy@gmail.com>
parents:
1296
diff
changeset
|
281 "Copyright (c) 2004 True Audio Software\n"), PROJECT_URL, NULL); |
290 | 282 |
1321
f0b81aeed25f
Thank you for your help, Giacomo. ;-)
Stany HENRY <StrassBoy@gmail.com>
parents:
1296
diff
changeset
|
283 aboutbox = xmms_show_message(_("About True Audio Plugin"), |
f0b81aeed25f
Thank you for your help, Giacomo. ;-)
Stany HENRY <StrassBoy@gmail.com>
parents:
1296
diff
changeset
|
284 about_text, |
f0b81aeed25f
Thank you for your help, Giacomo. ;-)
Stany HENRY <StrassBoy@gmail.com>
parents:
1296
diff
changeset
|
285 _("Ok"), FALSE, NULL, NULL); |
f0b81aeed25f
Thank you for your help, Giacomo. ;-)
Stany HENRY <StrassBoy@gmail.com>
parents:
1296
diff
changeset
|
286 |
1325
a33da9237bed
Several "i18n" improvements.
Stany HENRY <StrassBoy@gmail.com>
parents:
1321
diff
changeset
|
287 gtk_signal_connect(GTK_OBJECT(aboutbox), "destroy", |
a33da9237bed
Several "i18n" improvements.
Stany HENRY <StrassBoy@gmail.com>
parents:
1321
diff
changeset
|
288 G_CALLBACK(gtk_widget_destroyed), &aboutbox); |
1321
f0b81aeed25f
Thank you for your help, Giacomo. ;-)
Stany HENRY <StrassBoy@gmail.com>
parents:
1296
diff
changeset
|
289 g_free(about_text); |
290 | 290 } |
291 | |
292 static GtkWidget *window = NULL; | |
293 static GtkWidget *filename_entry, *title_entry, | |
294 *artist_entry, *album_entry, | |
295 *year_entry, *tracknum_entry, | |
296 *comment_entry, *genre_entry, | |
297 *info_frame; | |
298 | |
299 static void | |
300 file_info (char *filename) | |
301 { | |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
302 tta_info ttainfo; |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
303 char *title; |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
304 gchar *utf_filename = NULL; |
1296
2a6865d42dc4
more adaptation for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1270
diff
changeset
|
305 gchar *realfn = NULL; |
290 | 306 |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
307 if (!window) { |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
308 GtkWidget *vbox, *hbox, *left_vbox, *table; |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
309 GtkWidget *label, *filename_hbox, *button_ok; |
290 | 310 |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
311 window = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
312 gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, FALSE); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
313 gtk_signal_connect(GTK_OBJECT(window), "destroy", |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
314 G_CALLBACK(gtk_widget_destroyed), &window); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
315 gtk_container_set_border_width(GTK_CONTAINER(window), 10); |
1321
f0b81aeed25f
Thank you for your help, Giacomo. ;-)
Stany HENRY <StrassBoy@gmail.com>
parents:
1296
diff
changeset
|
316 |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
317 vbox = gtk_vbox_new(FALSE, 10); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
318 gtk_container_add(GTK_CONTAINER(window), vbox); |
290 | 319 |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
320 filename_hbox = gtk_hbox_new(FALSE, 5); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
321 gtk_box_pack_start(GTK_BOX(vbox), filename_hbox, FALSE, TRUE, 0); |
1321
f0b81aeed25f
Thank you for your help, Giacomo. ;-)
Stany HENRY <StrassBoy@gmail.com>
parents:
1296
diff
changeset
|
322 label = gtk_label_new(_("Filename:")); |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
323 gtk_box_pack_start(GTK_BOX(filename_hbox), label, FALSE, TRUE, 0); |
290 | 324 |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
325 filename_entry = gtk_entry_new_with_max_length(1024); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
326 gtk_editable_set_editable(GTK_EDITABLE(filename_entry), FALSE); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
327 gtk_box_pack_start(GTK_BOX(filename_hbox), filename_entry, TRUE, TRUE, 0); |
290 | 328 |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
329 hbox = gtk_hbox_new(FALSE, 10); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
330 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
331 left_vbox = gtk_vbox_new(FALSE, 10); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
332 gtk_box_pack_start(GTK_BOX(hbox), left_vbox, FALSE, FALSE, 0); |
290 | 333 |
1321
f0b81aeed25f
Thank you for your help, Giacomo. ;-)
Stany HENRY <StrassBoy@gmail.com>
parents:
1296
diff
changeset
|
334 info_frame = gtk_frame_new(_("ID3 Tag:")); |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
335 gtk_box_pack_start(GTK_BOX(left_vbox), info_frame, FALSE, FALSE, 0); |
290 | 336 |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
337 table = gtk_table_new(5, 5, FALSE); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
338 gtk_container_set_border_width(GTK_CONTAINER(table), 5); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
339 gtk_container_add(GTK_CONTAINER(info_frame), table); |
290 | 340 |
1321
f0b81aeed25f
Thank you for your help, Giacomo. ;-)
Stany HENRY <StrassBoy@gmail.com>
parents:
1296
diff
changeset
|
341 label = gtk_label_new(_("Title:")); |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
342 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
343 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 5, 5); |
290 | 344 |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
345 title_entry = gtk_entry_new_with_max_length(1024); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
346 gtk_editable_set_editable(GTK_EDITABLE(title_entry), FALSE); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
347 gtk_table_attach(GTK_TABLE(table), title_entry, 1, 4, 0, 1, |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
348 GTK_FILL | GTK_EXPAND | GTK_SHRINK, |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
349 GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); |
290 | 350 |
1321
f0b81aeed25f
Thank you for your help, Giacomo. ;-)
Stany HENRY <StrassBoy@gmail.com>
parents:
1296
diff
changeset
|
351 label = gtk_label_new(_("Artist:")); |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
352 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
353 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
354 GTK_FILL, GTK_FILL, 5, 5); |
290 | 355 |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
356 artist_entry = gtk_entry_new_with_max_length(1024); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
357 gtk_editable_set_editable(GTK_EDITABLE(artist_entry), FALSE); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
358 gtk_table_attach(GTK_TABLE(table), artist_entry, 1, 4, 1, 2, |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
359 GTK_FILL | GTK_EXPAND | GTK_SHRINK, |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
360 GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); |
290 | 361 |
1321
f0b81aeed25f
Thank you for your help, Giacomo. ;-)
Stany HENRY <StrassBoy@gmail.com>
parents:
1296
diff
changeset
|
362 label = gtk_label_new(_("Album:")); |
290 | 363 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); |
364 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 2, 3, | |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
365 GTK_FILL, GTK_FILL, 5, 5); |
290 | 366 |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
367 album_entry = gtk_entry_new_with_max_length(1024); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
368 gtk_editable_set_editable(GTK_EDITABLE(album_entry), FALSE); |
290 | 369 gtk_table_attach(GTK_TABLE(table), album_entry, 1, 4, 2, 3, |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
370 GTK_FILL | GTK_EXPAND | GTK_SHRINK, |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
371 GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); |
290 | 372 |
1321
f0b81aeed25f
Thank you for your help, Giacomo. ;-)
Stany HENRY <StrassBoy@gmail.com>
parents:
1296
diff
changeset
|
373 label = gtk_label_new(_("Comment:")); |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
374 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
375 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 3, 4, |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
376 GTK_FILL, GTK_FILL, 5, 5); |
290 | 377 |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
378 comment_entry = gtk_entry_new_with_max_length(1024); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
379 gtk_editable_set_editable(GTK_EDITABLE(comment_entry), FALSE); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
380 gtk_table_attach(GTK_TABLE(table), comment_entry, 1, 4, 3, 4, |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
381 GTK_FILL | GTK_EXPAND | GTK_SHRINK, |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
382 GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); |
290 | 383 |
1321
f0b81aeed25f
Thank you for your help, Giacomo. ;-)
Stany HENRY <StrassBoy@gmail.com>
parents:
1296
diff
changeset
|
384 label = gtk_label_new(_("Year:")); |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
385 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
386 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 4, 5, |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
387 GTK_FILL, GTK_FILL, 5, 5); |
290 | 388 |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
389 year_entry = gtk_entry_new_with_max_length(4); |
290 | 390 gtk_editable_set_editable(GTK_EDITABLE(year_entry), FALSE); |
391 gtk_widget_set_usize(year_entry, 40, -1); | |
392 gtk_table_attach(GTK_TABLE(table), year_entry, 1, 2, 4, 5, | |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
393 GTK_FILL | GTK_EXPAND | GTK_SHRINK, |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
394 GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); |
290 | 395 |
1321
f0b81aeed25f
Thank you for your help, Giacomo. ;-)
Stany HENRY <StrassBoy@gmail.com>
parents:
1296
diff
changeset
|
396 label = gtk_label_new(_("Track number:")); |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
397 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
398 gtk_table_attach(GTK_TABLE(table), label, 2, 3, 4, 5, |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
399 GTK_FILL, GTK_FILL, 5, 5); |
290 | 400 |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
401 tracknum_entry = gtk_entry_new_with_max_length(3); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
402 gtk_editable_set_editable(GTK_EDITABLE(tracknum_entry), FALSE); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
403 gtk_widget_set_usize(tracknum_entry, 40, -1); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
404 gtk_table_attach(GTK_TABLE(table), tracknum_entry, 3, 4, 4, 5, |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
405 GTK_FILL | GTK_EXPAND | GTK_SHRINK, |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
406 GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); |
290 | 407 |
1321
f0b81aeed25f
Thank you for your help, Giacomo. ;-)
Stany HENRY <StrassBoy@gmail.com>
parents:
1296
diff
changeset
|
408 label = gtk_label_new(_("Genre:")); |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
409 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
410 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 5, 6, |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
411 GTK_FILL, GTK_FILL, 5, 5); |
290 | 412 |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
413 genre_entry = gtk_entry_new_with_max_length(1024); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
414 gtk_editable_set_editable(GTK_EDITABLE(genre_entry), FALSE); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
415 gtk_widget_set_usize(genre_entry, 40, -1); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
416 gtk_table_attach(GTK_TABLE(table), genre_entry, 1, 4, 5, 6, |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
417 GTK_FILL | GTK_EXPAND | GTK_SHRINK, |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
418 GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); |
290 | 419 |
1321
f0b81aeed25f
Thank you for your help, Giacomo. ;-)
Stany HENRY <StrassBoy@gmail.com>
parents:
1296
diff
changeset
|
420 button_ok = gtk_button_new_with_label(_("Ok")); |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
421 gtk_signal_connect_object(GTK_OBJECT(button_ok), "clicked", |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
422 G_CALLBACK(gtk_widget_destroy), G_OBJECT(window)); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
423 GTK_WIDGET_SET_FLAGS(button_ok, GTK_CAN_DEFAULT); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
424 gtk_box_pack_start(GTK_BOX(vbox), button_ok, TRUE, TRUE, 0); |
290 | 425 |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
426 gtk_widget_show_all (window); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
427 } |
1296
2a6865d42dc4
more adaptation for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1270
diff
changeset
|
428 realfn = g_filename_from_uri(filename, NULL, NULL); |
2a6865d42dc4
more adaptation for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1270
diff
changeset
|
429 utf_filename = str_to_utf8(realfn ? realfn : filename); |
2a6865d42dc4
more adaptation for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1270
diff
changeset
|
430 g_free(realfn); realfn = NULL; |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
431 title = g_strdup_printf(_("File Info - %s"), g_basename(utf_filename)); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
432 gtk_window_set_title(GTK_WINDOW(window), title); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
433 g_free(title); |
1321
f0b81aeed25f
Thank you for your help, Giacomo. ;-)
Stany HENRY <StrassBoy@gmail.com>
parents:
1296
diff
changeset
|
434 |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
435 gtk_entry_set_text(GTK_ENTRY(filename_entry), utf_filename); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
436 gtk_editable_set_position(GTK_EDITABLE(filename_entry), -1); |
290 | 437 |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
438 title = g_strdup(g_basename(utf_filename)); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
439 gtk_entry_set_text(GTK_ENTRY(title_entry), title); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
440 |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
441 g_free(title); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
442 g_free(utf_filename); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
443 |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
444 if (open_tta_file (filename, &ttainfo, 0) >= 0) |
290 | 445 { |
1190
ed2d7787779e
more warning elimination.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1166
diff
changeset
|
446 gtk_entry_set_text(GTK_ENTRY(title_entry), (gchar *)ttainfo.ID3.title); |
ed2d7787779e
more warning elimination.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1166
diff
changeset
|
447 gtk_entry_set_text(GTK_ENTRY(artist_entry), (gchar *)ttainfo.ID3.artist); |
ed2d7787779e
more warning elimination.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1166
diff
changeset
|
448 gtk_entry_set_text(GTK_ENTRY(album_entry), (gchar *)ttainfo.ID3.album); |
ed2d7787779e
more warning elimination.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1166
diff
changeset
|
449 gtk_entry_set_text(GTK_ENTRY(year_entry), (gchar *)ttainfo.ID3.year); |
ed2d7787779e
more warning elimination.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1166
diff
changeset
|
450 gtk_entry_set_text(GTK_ENTRY(tracknum_entry), (gchar *)ttainfo.ID3.track); |
ed2d7787779e
more warning elimination.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1166
diff
changeset
|
451 gtk_entry_set_text(GTK_ENTRY(comment_entry), (gchar *)ttainfo.ID3.comment); |
ed2d7787779e
more warning elimination.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1166
diff
changeset
|
452 gtk_entry_set_text(GTK_ENTRY(genre_entry), (gchar *)ttainfo.ID3.genre); |
290 | 453 } |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
454 close_tta_file (&ttainfo); |
290 | 455 |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
456 gtk_widget_set_sensitive(info_frame, TRUE); |
290 | 457 } |
458 | |
459 static int | |
460 is_our_file (char *filename) | |
461 { | |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
462 gchar *ext = strrchr(filename, '.'); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
463 |
1152
949457464b28
[svn] - fix for crash when file extension is not available.
yaz
parents:
1087
diff
changeset
|
464 if (ext && !strncasecmp(ext, ".tta", 4)) |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
465 return TRUE; |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
466 |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
467 return FALSE; |
290 | 468 } |
469 | |
470 static void | |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
528
diff
changeset
|
471 play_file (InputPlayback *playback) |
290 | 472 { |
1237
0d5b0f861bf0
- quick fix for link breakage to libaudid3tag.so when --prefix is specified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1190
diff
changeset
|
473 gchar *filename = playback->filename; |
1296
2a6865d42dc4
more adaptation for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1270
diff
changeset
|
474 char *title = NULL; |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
475 int datasize, origsize, bitrate; |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
476 TitleInput *tuple = NULL; |
290 | 477 |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
478 //////////////////////////////////////// |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
479 // open TTA file |
1237
0d5b0f861bf0
- quick fix for link breakage to libaudid3tag.so when --prefix is specified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1190
diff
changeset
|
480 if (open_tta_file (filename, &info, 0) > 0) |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
481 { |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
482 tta_error (info.STATE); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
483 close_tta_file (&info); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
484 return; |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
485 } |
290 | 486 |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
487 //////////////////////////////////////// |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
488 // initialize TTA player |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
489 if (player_init (&info) < 0) |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
490 { |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
491 tta_error (info.STATE); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
492 close_tta_file (&info); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
493 return; |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
494 } |
290 | 495 |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
496 if (playback->output->open_audio ((info.BPS == 8) ? FMT_U8 : FMT_S16_LE, |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
497 info.SAMPLERATE, info.NCH) == 0) |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
498 { |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
499 tta_error (OUTPUT_ERROR); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
500 close_tta_file (&info); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
501 return; |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
502 } |
290 | 503 |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
504 tuple = get_song_tuple(filename); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
505 title = get_song_title(tuple); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
506 bmp_title_input_free(tuple); |
290 | 507 |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
508 datasize = file_size(filename) - info.DATAPOS; |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
509 origsize = info.DATALENGTH * info.BSIZE * info.NCH; |
290 | 510 |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
511 bitrate = (int) ((float) datasize / origsize * |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
512 (info.SAMPLERATE * info.NCH * info.BPS)); |
290 | 513 |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
514 tta_ip.set_info (title, 1000 * info.LENGTH, bitrate, info.SAMPLERATE, info.NCH); |
1321
f0b81aeed25f
Thank you for your help, Giacomo. ;-)
Stany HENRY <StrassBoy@gmail.com>
parents:
1296
diff
changeset
|
515 |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
516 if (title) |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
517 g_free (title); |
290 | 518 |
1165 | 519 playback->playing = 1; |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
520 seek_position = -1; |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
521 read_samples = -1; |
290 | 522 |
1366
4c43c38bd033
- adapt tta for new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1325
diff
changeset
|
523 decode_thread = g_thread_self(); |
4c43c38bd033
- adapt tta for new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1325
diff
changeset
|
524 play_loop(playback); |
290 | 525 } |
526 | |
527 static void | |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
528
diff
changeset
|
528 tta_pause (InputPlayback *playback, short paused) |
290 | 529 { |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
530 playback->output->pause (paused); |
290 | 531 } |
851 | 532 |
290 | 533 static void |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
528
diff
changeset
|
534 stop (InputPlayback *playback) |
290 | 535 { |
1366
4c43c38bd033
- adapt tta for new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1325
diff
changeset
|
536 if (playback->playing) |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
537 { |
1165 | 538 playback->playing = 0; |
1366
4c43c38bd033
- adapt tta for new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1325
diff
changeset
|
539 g_thread_join(decode_thread); |
4c43c38bd033
- adapt tta for new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1325
diff
changeset
|
540 decode_thread = NULL; |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
541 playback->output->close_audio (); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
542 close_tta_file (&info); |
1366
4c43c38bd033
- adapt tta for new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1325
diff
changeset
|
543 read_samples = -1; |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
544 } |
290 | 545 } |
546 | |
547 static void | |
1366
4c43c38bd033
- adapt tta for new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1325
diff
changeset
|
548 mseek (InputPlayback *data, gulong millisec) |
290 | 549 { |
1366
4c43c38bd033
- adapt tta for new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1325
diff
changeset
|
550 if (data->playing) |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
551 { |
1366
4c43c38bd033
- adapt tta for new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1325
diff
changeset
|
552 seek_position = (int)(millisec / SEEK_STEP); |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
553 |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
554 while (seek_position != -1) |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
555 xmms_usleep (10000); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
556 } |
290 | 557 } |
558 | |
1366
4c43c38bd033
- adapt tta for new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1325
diff
changeset
|
559 static void |
4c43c38bd033
- adapt tta for new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1325
diff
changeset
|
560 seek (InputPlayback *data, int sec) |
290 | 561 { |
1366
4c43c38bd033
- adapt tta for new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1325
diff
changeset
|
562 gulong millisec = 1000 * sec; |
4c43c38bd033
- adapt tta for new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1325
diff
changeset
|
563 mseek(data, millisec); |
290 | 564 } |
565 | |
566 static TitleInput * | |
567 get_song_tuple(char *filename) | |
568 { | |
569 TitleInput *tuple = NULL; | |
570 tta_info *ttainfo; | |
571 VFSFile *file; | |
1296
2a6865d42dc4
more adaptation for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1270
diff
changeset
|
572 gchar *realfn = NULL; |
290 | 573 |
574 ttainfo = g_malloc0(sizeof(tta_info)); | |
575 | |
576 if((file = vfs_fopen(filename, "rb")) != NULL) { | |
577 if(open_tta_file(filename, ttainfo, 0) >= 0) { | |
578 tuple = bmp_title_input_new(); | |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
579 |
1296
2a6865d42dc4
more adaptation for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1270
diff
changeset
|
580 realfn = g_filename_from_uri(filename, NULL, NULL); |
2a6865d42dc4
more adaptation for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1270
diff
changeset
|
581 tuple->file_name = g_path_get_basename(realfn ? realfn : filename); |
2a6865d42dc4
more adaptation for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1270
diff
changeset
|
582 tuple->file_path = g_path_get_dirname(realfn ? realfn : filename); |
2a6865d42dc4
more adaptation for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1270
diff
changeset
|
583 tuple->file_ext = extname(realfn ? realfn : filename); |
290 | 584 tuple->length = ttainfo->LENGTH * 1000; |
1296
2a6865d42dc4
more adaptation for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1270
diff
changeset
|
585 g_free(realfn); realfn = NULL; |
290 | 586 |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
587 if (ttainfo->ID3.id3has) { |
1190
ed2d7787779e
more warning elimination.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1166
diff
changeset
|
588 if(ttainfo->ID3.artist && strlen((char *)ttainfo->ID3.artist)) |
ed2d7787779e
more warning elimination.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1166
diff
changeset
|
589 tuple->performer = g_strdup((gchar *)ttainfo->ID3.artist); |
1166 | 590 |
1190
ed2d7787779e
more warning elimination.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1166
diff
changeset
|
591 if(ttainfo->ID3.album && strlen((char *)ttainfo->ID3.album)) |
ed2d7787779e
more warning elimination.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1166
diff
changeset
|
592 tuple->album_name = g_strdup((gchar *)ttainfo->ID3.album); |
1166 | 593 |
1190
ed2d7787779e
more warning elimination.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1166
diff
changeset
|
594 if(ttainfo->ID3.title && strlen((char *)ttainfo->ID3.title)) |
ed2d7787779e
more warning elimination.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1166
diff
changeset
|
595 tuple->track_name = g_strdup((gchar *)ttainfo->ID3.title); |
1166 | 596 |
1190
ed2d7787779e
more warning elimination.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1166
diff
changeset
|
597 if(ttainfo->ID3.year && strlen((char *)ttainfo->ID3.year)) |
ed2d7787779e
more warning elimination.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1166
diff
changeset
|
598 tuple->year = atoi((char *)ttainfo->ID3.year); |
1166 | 599 |
1190
ed2d7787779e
more warning elimination.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1166
diff
changeset
|
600 if(ttainfo->ID3.track && strlen((char *)ttainfo->ID3.track)) |
ed2d7787779e
more warning elimination.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1166
diff
changeset
|
601 tuple->track_number = atoi((char *)ttainfo->ID3.track); |
1166 | 602 |
1190
ed2d7787779e
more warning elimination.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1166
diff
changeset
|
603 if(ttainfo->ID3.genre && strlen((char *)ttainfo->ID3.genre)) |
ed2d7787779e
more warning elimination.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1166
diff
changeset
|
604 tuple->genre = g_strdup((gchar *)ttainfo->ID3.genre); |
1166 | 605 |
1190
ed2d7787779e
more warning elimination.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1166
diff
changeset
|
606 if(ttainfo->ID3.comment && strlen((char *)ttainfo->ID3.comment)) |
ed2d7787779e
more warning elimination.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1166
diff
changeset
|
607 tuple->comment = g_strdup((gchar *)ttainfo->ID3.comment); |
290 | 608 } |
609 close_tta_file (ttainfo); | |
610 } | |
611 vfs_fclose(file); | |
612 } | |
613 return tuple; | |
614 } | |
615 | |
616 static gchar * | |
617 extname(const char *filename) | |
618 { | |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
619 gchar *ext = strrchr(filename, '.'); |
290 | 620 |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
621 if (ext != NULL) |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
622 ++ext; |
290 | 623 |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
624 return ext; |
290 | 625 } |
626 | |
627 /* return length in letters */ | |
628 size_t tta_ucs4len(id3_ucs4_t *ucs) | |
629 { | |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
630 id3_ucs4_t *ptr = ucs; |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
631 size_t len = 0; |
290 | 632 |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
633 while(*ptr++ != 0) |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
634 len++; |
290 | 635 |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
636 return len; |
290 | 637 } |
638 | |
639 /* duplicate id3_ucs4_t string. new string will be terminated with 0. */ | |
640 id3_ucs4_t *tta_ucs4dup(id3_ucs4_t *org) | |
641 { | |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
642 id3_ucs4_t *new = NULL; |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
643 size_t len = tta_ucs4len(org); |
290 | 644 |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
645 new = g_malloc0((len + 1) * sizeof(id3_ucs4_t)); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
646 memcpy(new, org, len * sizeof(id3_ucs4_t)); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
647 *(new + len) = 0; //terminate |
290 | 648 |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
649 return new; |
290 | 650 } |
651 | |
652 id3_ucs4_t *tta_parse_genre(const id3_ucs4_t *string) | |
653 { | |
654 id3_ucs4_t *ret = NULL; | |
655 id3_ucs4_t *tmp = NULL; | |
656 id3_ucs4_t *genre = NULL; | |
657 id3_ucs4_t *ptr, *end, *tail, *tp; | |
658 size_t ret_len = 0; //num of ucs4 char! | |
659 size_t tmp_len = 0; | |
660 gboolean is_num = TRUE; | |
661 | |
662 tail = (id3_ucs4_t *)string + tta_ucs4len((id3_ucs4_t *)string); | |
663 | |
664 ret = g_malloc0(1024); | |
665 | |
666 for(ptr = (id3_ucs4_t *)string; *ptr != 0 && ptr <= tail; ptr++) { | |
667 if(*ptr == '(') { | |
668 if(*(++ptr) == '(') { // escaped text like: ((something) | |
669 for(end = ptr; *end != ')' && *end != 0;) { // copy "(something)" | |
670 end++; | |
671 } | |
672 end++; //include trailing ')' | |
673 memcpy(ret, ptr, BYTES(end - ptr)); | |
674 ret_len += (end - ptr); | |
675 *(ret + ret_len) = 0; //terminate | |
676 ptr = end + 1; | |
677 } | |
678 else { | |
679 // reference to an id3v1 genre code | |
680 for(end = ptr; *end != ')' && *end != 0;) { | |
681 end++; | |
682 } | |
683 | |
684 tmp = g_malloc0(BYTES(end - ptr + 1)); | |
685 memcpy(tmp, ptr, BYTES(end - ptr)); | |
686 *(tmp + (end - ptr)) = 0; //terminate | |
687 ptr += end - ptr; | |
688 | |
689 genre = (id3_ucs4_t *)id3_genre_name((const id3_ucs4_t *)tmp); | |
690 | |
691 g_free(tmp); | |
692 tmp = NULL; | |
693 | |
694 tmp_len = tta_ucs4len(genre); | |
695 | |
696 memcpy(ret + BYTES(ret_len), genre, BYTES(tmp_len)); | |
697 | |
698 ret_len += tmp_len; | |
699 *(ret + ret_len) = 0; //terminate | |
700 } | |
701 } | |
702 else { | |
703 for(end = ptr; *end != '(' && *end != 0; ) { | |
704 end++; | |
705 } | |
706 // scan string to determine whether a genre code number or not | |
707 tp = ptr; | |
708 is_num = TRUE; | |
709 while(tp < end) { | |
710 if(*tp < '0' || *tp > '9') { // anything else than number appears. | |
711 is_num = FALSE; | |
712 break; | |
713 } | |
714 tp++; | |
715 } | |
716 if(is_num) { | |
717 #ifdef DEBUG | |
718 printf("is_num!\n"); | |
719 #endif | |
720 tmp = g_malloc0(BYTES(end - ptr + 1)); | |
721 memcpy(tmp, ptr, BYTES(end - ptr)); | |
722 *(tmp + (end - ptr)) = 0; //terminate | |
723 ptr += end - ptr; | |
724 | |
725 genre = (id3_ucs4_t *)id3_genre_name((const id3_ucs4_t *)tmp); | |
726 #ifdef DEBUG | |
727 printf("genre length = %d\n", tta_ucs4len(genre)); | |
728 #endif | |
729 g_free(tmp); | |
730 tmp = NULL; | |
731 | |
732 tmp_len = tta_ucs4len(genre); | |
733 | |
734 memcpy(ret + BYTES(ret_len), genre, BYTES(tmp_len)); | |
735 | |
736 ret_len += tmp_len; | |
737 *(ret + ret_len) = 0; //terminate | |
738 } | |
739 else { // plain text | |
740 #ifdef DEBUG | |
741 printf("plain!\n"); | |
742 printf("ret_len = %d\n", ret_len); | |
743 #endif | |
744 memcpy(ret + BYTES(ret_len), ptr, BYTES(end - ptr)); | |
745 ret_len = ret_len + (end - ptr); | |
746 *(ret + ret_len) = 0; //terminate | |
747 ptr += (end - ptr); | |
748 } | |
749 } | |
750 } | |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
751 |
290 | 752 return ret; |
753 } | |
754 | |
755 gchar *tta_input_id3_get_string(struct id3_tag * tag, char *frame_name) | |
756 { | |
757 gchar *rtn; | |
758 gchar *rtn2; | |
759 const id3_ucs4_t *string_const; | |
760 id3_ucs4_t *string; | |
761 id3_ucs4_t *ucsptr; | |
762 struct id3_frame *frame; | |
763 union id3_field *field; | |
764 gboolean flagutf = FALSE; | |
765 | |
766 frame = id3_tag_findframe(tag, frame_name, 0); | |
767 if (!frame) | |
768 return NULL; | |
769 | |
1190
ed2d7787779e
more warning elimination.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1166
diff
changeset
|
770 if (!strcmp(frame_name, ID3_FRAME_COMMENT)) |
290 | 771 field = id3_frame_field(frame, 3); |
772 else | |
773 field = id3_frame_field(frame, 1); | |
774 | |
775 if (!field) | |
776 return NULL; | |
777 | |
1190
ed2d7787779e
more warning elimination.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1166
diff
changeset
|
778 if (!strcmp(frame_name, ID3_FRAME_COMMENT)) |
290 | 779 string_const = id3_field_getfullstring(field); |
780 else | |
781 string_const = id3_field_getstrings(field, 0); | |
782 | |
783 if (!string_const) | |
784 return NULL; | |
785 | |
786 string = tta_ucs4dup((id3_ucs4_t *)string_const); | |
787 | |
1190
ed2d7787779e
more warning elimination.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1166
diff
changeset
|
788 if (!strcmp(frame_name, ID3_FRAME_GENRE)) { |
290 | 789 id3_ucs4_t *string2 = NULL; |
790 string2 = tta_parse_genre(string); | |
791 g_free((void *)string); | |
792 string = string2; | |
793 } | |
794 | |
795 ucsptr = (id3_ucs4_t *)string; | |
796 while (*ucsptr) { | |
797 if (*ucsptr > 0x000000ffL) { | |
798 flagutf = TRUE; | |
799 break; | |
800 } | |
801 ucsptr++; | |
802 } | |
803 | |
804 if (flagutf) { | |
805 #ifdef DEBUG | |
806 g_message("aud-tta: flagutf!\n"); | |
807 #endif | |
1190
ed2d7787779e
more warning elimination.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1166
diff
changeset
|
808 rtn = (gchar *)id3_ucs4_utf8duplicate(string); |
290 | 809 } |
810 else { | |
1190
ed2d7787779e
more warning elimination.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1166
diff
changeset
|
811 rtn = (gchar *)id3_ucs4_latin1duplicate(string); |
290 | 812 rtn2 = str_to_utf8(rtn); |
813 free(rtn); | |
814 rtn = rtn2; | |
815 } | |
816 g_free(string); | |
817 string = NULL; | |
818 #ifdef DEBUG | |
819 g_print("string = %s\n", rtn); | |
1321
f0b81aeed25f
Thank you for your help, Giacomo. ;-)
Stany HENRY <StrassBoy@gmail.com>
parents:
1296
diff
changeset
|
820 #endif |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
821 |
290 | 822 return rtn; |
823 } | |
824 | |
825 int get_id3_tags (const char *filename, tta_info *ttainfo) { | |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
826 int id3v2_size = 0; |
290 | 827 gchar *str = NULL; |
1296
2a6865d42dc4
more adaptation for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1270
diff
changeset
|
828 gchar *realfn = NULL; |
290 | 829 |
830 struct id3_file *id3file = NULL; | |
831 struct id3_tag *tag = NULL; | |
832 | |
1296
2a6865d42dc4
more adaptation for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1270
diff
changeset
|
833 realfn = g_filename_from_uri(filename, NULL, NULL); |
2a6865d42dc4
more adaptation for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1270
diff
changeset
|
834 id3file = id3_file_open (realfn ? realfn : filename, ID3_FILE_MODE_READONLY); |
2a6865d42dc4
more adaptation for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1270
diff
changeset
|
835 g_free(realfn); realfn = NULL; |
290 | 836 |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
837 if (id3file) { |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
838 tag = id3_file_tag (id3file); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
839 |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
840 if (tag) { |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
841 ttainfo->ID3.id3has = 1; |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
842 id3v2_size = tag->paddedsize; |
290 | 843 |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
844 str = tta_input_id3_get_string (tag, ID3_FRAME_ARTIST); |
1190
ed2d7787779e
more warning elimination.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1166
diff
changeset
|
845 if(str) strncpy((char *)ttainfo->ID3.artist, str, MAX_LINE); |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
846 free(str); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
847 str = NULL; |
290 | 848 |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
849 str = tta_input_id3_get_string (tag, ID3_FRAME_ALBUM); |
1190
ed2d7787779e
more warning elimination.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1166
diff
changeset
|
850 if(str) strncpy((char *)ttainfo->ID3.album, str, MAX_LINE); |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
851 free(str); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
852 str = NULL; |
290 | 853 |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
854 str = tta_input_id3_get_string (tag, ID3_FRAME_TITLE); |
1190
ed2d7787779e
more warning elimination.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1166
diff
changeset
|
855 if(str) strncpy((char *)ttainfo->ID3.title, str, MAX_LINE); |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
856 free(str); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
857 str = NULL; |
290 | 858 |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
859 str = tta_input_id3_get_string (tag, ID3_FRAME_YEAR); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
860 if(!str) str = tta_input_id3_get_string (tag, "TYER"); |
1190
ed2d7787779e
more warning elimination.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1166
diff
changeset
|
861 if(str) strncpy((char *)ttainfo->ID3.year, str, MAX_YEAR); |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
862 free(str); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
863 str = NULL; |
290 | 864 |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
865 str = tta_input_id3_get_string (tag, ID3_FRAME_TRACK); |
1190
ed2d7787779e
more warning elimination.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1166
diff
changeset
|
866 if(str) strncpy((char *)ttainfo->ID3.track, str, MAX_TRACK); |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
867 free(str); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
868 str = NULL; |
290 | 869 |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
870 str = tta_input_id3_get_string (tag, ID3_FRAME_GENRE); |
1190
ed2d7787779e
more warning elimination.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1166
diff
changeset
|
871 if(str) strncpy((char *)ttainfo->ID3.genre, str, MAX_GENRE); |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
872 free(str); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
873 str = NULL; |
290 | 874 |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
875 str = tta_input_id3_get_string (tag, ID3_FRAME_COMMENT); |
1190
ed2d7787779e
more warning elimination.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1166
diff
changeset
|
876 if(str) strncpy((char *)ttainfo->ID3.comment, str, MAX_LINE); |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
877 free(str); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
878 str = NULL; |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
879 } |
290 | 880 |
1012
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
881 id3_file_close(id3file); |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
882 } |
d0d99b22e393
[svn] import major update by Aleksander Djuric (the original author).
yaz
parents:
912
diff
changeset
|
883 |
290 | 884 return id3v2_size; // not used |
885 } |