Mercurial > audlegacy-plugins
annotate src/madplug/tuple.c @ 2341:59addab003d7
- reworked replaygain to use individual pre-gain for the files with RG info and the rest.
- default pre-gain have been changed to +6dB for with RG, +0dB for the rest.
- new clipping prevention feature using track peak information has been implemented.
- reworked preferences dialog. widgets have been categorized by function and all changes will take effect immediately. and also, cancel button can reverts all changes have been done in the current session.
- some keys in preferences have been changed.
| author | Yoshiki Yazawa <yaz@cc.rim.or.jp> |
|---|---|
| date | Thu, 31 Jan 2008 15:22:15 +0900 |
| parents | 9a869d4bb0d3 |
| children | bd3a24b39058 |
| rev | line source |
|---|---|
|
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
1 /* |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
2 * mad plugin for audacious |
|
2201
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
3 * Copyright (C) 2005-2007 William Pitcock, Yoshiki Yazawa, Eugene Zagidullin |
|
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
4 * |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
5 * Portions derived from xmms-mad: |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
6 * Copyright (C) 2001-2002 Sam Clegg - See COPYING |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
7 * |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
8 * This program is free software; you can redistribute it and/or modify |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
9 * it under the terms of the GNU General Public License as published by |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
10 * the Free Software Foundation; under version 2 of the License. |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
11 * |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
12 * This program is distributed in the hope that it will be useful, |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
15 * GNU General Public License for more details. |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
16 * |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
17 * You should have received a copy of the GNU General Public License |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
18 * along with this program; if not, write to the Free Software |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
20 */ |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
21 |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
22 #include "config.h" |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
23 |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
24 #include "plugin.h" |
|
2202
f76e846d53d9
updating TLEN frame returned
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2201
diff
changeset
|
25 #include "tuple.h" |
|
f76e846d53d9
updating TLEN frame returned
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2201
diff
changeset
|
26 #include "input.h" |
|
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
27 |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
28 #include <math.h> |
|
2201
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
29 #include <string.h> |
|
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
30 |
|
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
31 #include <glib.h> |
|
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
32 #include <glib/gprintf.h> |
|
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
33 |
|
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
34 #include <audacious/util.h> |
|
2201
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
35 #include <audacious/plugin.h> |
|
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
36 #include <audacious/id3tag.h> |
|
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
37 |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
38 #include <langinfo.h> |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
39 |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
40 static void |
|
2201
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
41 update_id3_frame(struct id3_tag *tag, const char *frame_name, const char *data, int sjis) |
|
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
42 { |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
43 int res; |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
44 struct id3_frame *frame; |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
45 union id3_field *field; |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
46 id3_ucs4_t *ucs4; |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
47 |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
48 if (data == NULL) |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
49 return; |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
50 |
|
2203
13b8ab116b69
removed debugging stuff. some notes added
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2202
diff
changeset
|
51 /* printf ("updating id3: %s: %s\n", frame_name, data); |
| 611 | 52 |
|
2203
13b8ab116b69
removed debugging stuff. some notes added
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2202
diff
changeset
|
53 |
|
13b8ab116b69
removed debugging stuff. some notes added
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2202
diff
changeset
|
54 An empty string removes the frame altogether. |
|
13b8ab116b69
removed debugging stuff. some notes added
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2202
diff
changeset
|
55 */ |
|
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
56 if (strlen(data) == 0) { |
| 629 | 57 while ((frame = id3_tag_findframe(tag, frame_name, 0))) { |
|
2214
9a869d4bb0d3
make use of AUDDBG() for debug print out.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2203
diff
changeset
|
58 AUDDBG("madplug: detachframe\n"); |
|
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
59 id3_tag_detachframe(tag, frame); |
| 629 | 60 } |
|
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
61 return; |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
62 } |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
63 |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
64 frame = id3_tag_findframe(tag, frame_name, 0); |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
65 if (!frame) { |
|
2214
9a869d4bb0d3
make use of AUDDBG() for debug print out.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2203
diff
changeset
|
66 AUDDBG("frame_new\n"); |
|
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
67 frame = id3_frame_new(frame_name); |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
68 id3_tag_attachframe(tag, frame); |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
69 } |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
70 |
|
2203
13b8ab116b69
removed debugging stuff. some notes added
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2202
diff
changeset
|
71 /* setup ucs4 string */ |
|
2201
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
72 if(sjis) { |
| 611 | 73 ucs4 = id3_latin1_ucs4duplicate((id3_latin1_t *) data); |
| 74 } | |
| 75 else { | |
| 76 ucs4 = id3_utf8_ucs4duplicate((id3_utf8_t *) data); | |
| 77 } | |
| 78 | |
|
2203
13b8ab116b69
removed debugging stuff. some notes added
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2202
diff
changeset
|
79 /* set encoding */ |
| 611 | 80 field = id3_frame_field(frame, 0); |
|
2201
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
81 id3_field_settextencoding(field, sjis ? ID3_FIELD_TEXTENCODING_ISO_8859_1 : |
| 611 | 82 ID3_FIELD_TEXTENCODING_UTF_8); |
|
1302
1d3b02d1842b
Guess... Yes, "i18n" stuff.
Stany HENRY <StrassBoy@gmail.com>
parents:
1264
diff
changeset
|
83 |
|
2203
13b8ab116b69
removed debugging stuff. some notes added
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2202
diff
changeset
|
84 /* setup genre code */ |
| 611 | 85 if (!strcmp(frame_name, ID3_FRAME_GENRE)) { |
| 86 char *tmp; | |
| 87 int index = id3_genre_number(ucs4); | |
| 88 g_free(ucs4); | |
|
730
74a46ac77c97
[svn] - now fileinfo dialog shows "Unknown" instead of "Blues" if genre name isn't specified.
yaz
parents:
645
diff
changeset
|
89 |
|
2203
13b8ab116b69
removed debugging stuff. some notes added
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2202
diff
changeset
|
90 if(index == -1) { /* unknown genre. remove TCON frame. */ |
|
2214
9a869d4bb0d3
make use of AUDDBG() for debug print out.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2203
diff
changeset
|
91 AUDDBG("madplug: remove genre frame\n"); |
|
730
74a46ac77c97
[svn] - now fileinfo dialog shows "Unknown" instead of "Blues" if genre name isn't specified.
yaz
parents:
645
diff
changeset
|
92 id3_tag_detachframe(tag, frame); |
|
74a46ac77c97
[svn] - now fileinfo dialog shows "Unknown" instead of "Blues" if genre name isn't specified.
yaz
parents:
645
diff
changeset
|
93 } |
|
2203
13b8ab116b69
removed debugging stuff. some notes added
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2202
diff
changeset
|
94 else { /* meaningful genre */ |
|
730
74a46ac77c97
[svn] - now fileinfo dialog shows "Unknown" instead of "Blues" if genre name isn't specified.
yaz
parents:
645
diff
changeset
|
95 tmp = g_strdup_printf("%d", index); |
|
74a46ac77c97
[svn] - now fileinfo dialog shows "Unknown" instead of "Blues" if genre name isn't specified.
yaz
parents:
645
diff
changeset
|
96 ucs4 = id3_latin1_ucs4duplicate((unsigned char *) tmp); |
|
74a46ac77c97
[svn] - now fileinfo dialog shows "Unknown" instead of "Blues" if genre name isn't specified.
yaz
parents:
645
diff
changeset
|
97 } |
|
1302
1d3b02d1842b
Guess... Yes, "i18n" stuff.
Stany HENRY <StrassBoy@gmail.com>
parents:
1264
diff
changeset
|
98 |
| 611 | 99 } |
| 100 | |
|
2203
13b8ab116b69
removed debugging stuff. some notes added
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2202
diff
changeset
|
101 /* write string */ |
| 611 | 102 if (!strcmp(frame_name, ID3_FRAME_COMMENT)) { |
|
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
103 field = id3_frame_field(frame, 3); |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
104 field->type = ID3_FIELD_TYPE_STRINGFULL; |
| 611 | 105 res = id3_field_setfullstring(field, ucs4); |
|
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
106 } |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
107 else { |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
108 field = id3_frame_field(frame, 1); |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
109 field->type = ID3_FIELD_TYPE_STRINGLIST; |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
110 res = id3_field_setstrings(field, 1, &ucs4); |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
111 } |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
112 |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
113 if (res != 0) |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
114 g_print("error setting id3 field: %s\n", frame_name); |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
115 } |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
116 |
|
2201
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
117 static void |
|
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
118 update_id3_frame_from_tuple(struct id3_tag *id3tag, const char *field, Tuple *tuple, int fieldn, int sjis) |
|
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
119 { |
|
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
120 int val; |
|
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
121 char *text, *text2; |
|
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
122 const char *encoding = sjis ? "SJIS" : "UTF-8"; |
|
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
123 |
|
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
124 if(aud_tuple_get_value_type(tuple, fieldn, NULL) == TUPLE_INT) { |
|
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
125 val = aud_tuple_get_int(tuple, fieldn, NULL); |
|
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
126 if(val > 0) { |
|
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
127 text2 = g_strdup_printf("%d", val); |
|
2214
9a869d4bb0d3
make use of AUDDBG() for debug print out.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2203
diff
changeset
|
128 AUDDBG("madplug: updating field:\"%s\"=\"%s\", enc %s\n", field, text2, encoding); |
|
2201
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
129 update_id3_frame(id3tag, field, text2, 0); |
|
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
130 g_free(text2); |
|
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
131 } else { |
|
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
132 update_id3_frame(id3tag, field, "", 0); /* will be detached */ |
|
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
133 } |
|
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
134 |
|
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
135 } else if(aud_tuple_get_value_type(tuple, fieldn, NULL) == TUPLE_STRING) { |
|
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
136 text = (char*)aud_tuple_get_string(tuple, fieldn, NULL); |
|
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
137 text2 = g_convert(text, strlen(text), encoding, "UTF-8", NULL, NULL, NULL); |
|
2214
9a869d4bb0d3
make use of AUDDBG() for debug print out.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2203
diff
changeset
|
138 AUDDBG("madplug: updating field:\"%s\"=\"%s\", enc %s\n", field, text2, encoding); |
|
2201
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
139 update_id3_frame(id3tag, field, text2, sjis); |
|
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
140 g_free(text2); |
|
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
141 } |
|
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
142 } |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
143 |
|
2201
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
144 gboolean |
|
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
145 audmad_update_song_tuple(Tuple *tuple, VFSFile *fd) |
|
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
146 { |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
147 struct id3_file *id3file; |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
148 struct id3_tag *id3tag; |
|
2202
f76e846d53d9
updating TLEN frame returned
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2201
diff
changeset
|
149 gchar *text; |
|
f76e846d53d9
updating TLEN frame returned
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2201
diff
changeset
|
150 struct mad_info_t songinfo; |
|
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
151 |
|
2201
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
152 if ((id3file = id3_file_vfsopen(fd, ID3_FILE_MODE_READWRITE)) == NULL) return FALSE; |
|
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
153 |
| 629 | 154 id3tag = id3_file_tag(id3file); |
| 155 if (!id3tag) { | |
|
2214
9a869d4bb0d3
make use of AUDDBG() for debug print out.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2203
diff
changeset
|
156 AUDDBG("no id3tag\n. append new tag.\n"); |
|
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
157 id3tag = id3_tag_new(); |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
158 id3_tag_clearframes(id3tag); |
| 629 | 159 id3tag->options |= ID3_TAG_OPTION_APPENDEDTAG | ID3_TAG_OPTION_ID3V1; |
|
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
160 } |
| 629 | 161 |
|
2201
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
162 id3_tag_options(id3tag, ID3_TAG_OPTION_ID3V1, ~0); /* enables id3v1. TODO: make id3v1 optional */ |
|
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
163 |
|
2341
59addab003d7
- reworked replaygain to use individual pre-gain for the files with RG info and the rest.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2214
diff
changeset
|
164 update_id3_frame_from_tuple(id3tag, ID3_FRAME_TITLE, tuple, FIELD_TITLE, audmad_config->sjis); |
|
59addab003d7
- reworked replaygain to use individual pre-gain for the files with RG info and the rest.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2214
diff
changeset
|
165 update_id3_frame_from_tuple(id3tag, ID3_FRAME_ARTIST, tuple, FIELD_ARTIST, audmad_config->sjis); |
|
59addab003d7
- reworked replaygain to use individual pre-gain for the files with RG info and the rest.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2214
diff
changeset
|
166 update_id3_frame_from_tuple(id3tag, ID3_FRAME_ALBUM, tuple, FIELD_ALBUM, audmad_config->sjis); |
|
59addab003d7
- reworked replaygain to use individual pre-gain for the files with RG info and the rest.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2214
diff
changeset
|
167 update_id3_frame_from_tuple(id3tag, ID3_FRAME_YEAR, tuple, FIELD_YEAR, audmad_config->sjis); |
|
59addab003d7
- reworked replaygain to use individual pre-gain for the files with RG info and the rest.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2214
diff
changeset
|
168 update_id3_frame_from_tuple(id3tag, ID3_FRAME_COMMENT, tuple, FIELD_COMMENT, audmad_config->sjis); |
|
59addab003d7
- reworked replaygain to use individual pre-gain for the files with RG info and the rest.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2214
diff
changeset
|
169 update_id3_frame_from_tuple(id3tag, ID3_FRAME_TRACK, tuple, FIELD_TRACK_NUMBER, audmad_config->sjis); |
|
59addab003d7
- reworked replaygain to use individual pre-gain for the files with RG info and the rest.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2214
diff
changeset
|
170 update_id3_frame_from_tuple(id3tag, ID3_FRAME_GENRE, tuple, FIELD_GENRE, audmad_config->sjis); |
|
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
171 |
|
2202
f76e846d53d9
updating TLEN frame returned
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2201
diff
changeset
|
172 if(!id3_tag_findframe(id3tag, "TLEN", 0) && input_init(&songinfo, fd->uri, fd) && !songinfo.remote) { |
|
2214
9a869d4bb0d3
make use of AUDDBG() for debug print out.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2203
diff
changeset
|
173 AUDDBG("update TLEN frame\n"); |
|
2202
f76e846d53d9
updating TLEN frame returned
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2201
diff
changeset
|
174 songinfo.fileinfo_request = FALSE; /* we don't need to read tuple again */ |
|
f76e846d53d9
updating TLEN frame returned
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2201
diff
changeset
|
175 input_get_info(&songinfo, FALSE); |
|
f76e846d53d9
updating TLEN frame returned
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2201
diff
changeset
|
176 text = g_strdup_printf("%ld", mad_timer_count(songinfo.duration, MAD_UNITS_MILLISECONDS)); |
|
2214
9a869d4bb0d3
make use of AUDDBG() for debug print out.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2203
diff
changeset
|
177 AUDDBG("TLEN: \"%s\"\n", text); |
|
2202
f76e846d53d9
updating TLEN frame returned
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2201
diff
changeset
|
178 update_id3_frame(id3tag, "TLEN", text, 0); |
|
f76e846d53d9
updating TLEN frame returned
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2201
diff
changeset
|
179 g_free(text); |
|
f76e846d53d9
updating TLEN frame returned
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2201
diff
changeset
|
180 input_term(&songinfo); |
|
f76e846d53d9
updating TLEN frame returned
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2201
diff
changeset
|
181 } |
|
f76e846d53d9
updating TLEN frame returned
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2201
diff
changeset
|
182 |
|
2201
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
183 if (id3_file_update(id3file) != 0) return FALSE; |
|
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
184 |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
185 id3_file_close(id3file); |
|
2201
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
186 return TRUE; |
|
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
187 } |
|
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
188 |
