Mercurial > audlegacy-plugins
annotate src/madplug/input.c @ 621:1b50f674e0b9 trunk
[svn] - remove ID3_FIELD_TEXTENCODING_UTF_16 case.
author | yaz |
---|---|
date | Thu, 08 Feb 2007 01:52:27 -0800 |
parents | 7a181a17f995 |
children | e0d131145768 |
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 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
3 * Copyright (C) 2005-2007 William Pitcock, Yoshiki Yazawa |
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 #ifdef HAVE_ASSERT_H |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
25 #include <assert.h> |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
26 #endif /* HAVE_ASSERT_H */ |
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 #ifdef HAVE_SYS_TYPES_H |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
29 #include <sys/types.h> |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
30 #endif /* HAVE_SYS_TYPES_H */ |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
31 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
32 #ifdef HAVE_SYS_SOCKET_H |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
33 #include <sys/socket.h> |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
34 #endif /* HAVE_SYS_SOCKET_H */ |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
35 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
36 #ifdef HAVE_NETINET_IN_H |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
37 #include <netinet/in.h> |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
38 #endif /* HAVE_NETINET_IN_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 #ifdef HAVE_ARPA_INET_H |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
41 #include <arpa/inet.h> |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
42 #endif /* HAVE_ARPA_INET_H */ |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
43 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
44 #ifdef HAVE_NETDB_H |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
45 #include <netdb.h> |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
46 #endif /* HAVE_NETDB_H */ |
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 #ifdef HAVE_SYS_STAT_H |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
49 #include <sys/stat.h> |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
50 #endif /* HAVE_SYS_STAT_H */ |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
51 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
52 #ifdef HAVE_SYS_TIME_H |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
53 #include <sys/time.h> |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
54 #endif /* HAVE_SYS_TIME_H */ |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
55 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
56 #include <fcntl.h> |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
57 #include <errno.h> |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
58 #include <audacious/util.h> |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
59 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
60 #include "input.h" |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
61 #include "replaygain.h" |
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 #define DIR_SEPARATOR '/' |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
64 #define HEADER_SIZE 256 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
65 #define LINE_LENGTH 256 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
66 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
67 extern gboolean scan_file(struct mad_info_t *info, gboolean fast); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
68 |
611 | 69 // new VFS handles url. |
70 static void input_parse_url(struct mad_info_t *info) | |
71 { | |
72 info->filename = g_strdup(info->url); | |
73 return; | |
74 } | |
75 | |
76 | |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
77 /** |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
78 * init the mad_info_t struct. |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
79 */ |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
80 gboolean input_init(struct mad_info_t * info, const char *url) |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
81 { |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
82 #ifdef DEBUG |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
83 g_message("f: input_init"); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
84 #endif |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
85 memset(info, 0, sizeof(struct mad_info_t)); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
86 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
87 info->fmt = FMT_S16_LE; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
88 info->channels = -1; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
89 info->mpeg_layer = -1; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
90 info->size = -1; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
91 info->freq = -1; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
92 info->seek = -1; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
93 info->duration = mad_timer_zero; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
94 info->pos = mad_timer_zero; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
95 info->url = g_strdup(url); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
96 info->current_frame = 0; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
97 info->frames = 0; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
98 info->bitrate = 0; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
99 info->vbr = 0; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
100 info->mode = 0; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
101 info->title = 0; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
102 info->offset = 0; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
103 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
104 info->replaygain_album_str = 0; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
105 info->replaygain_track_str = 0; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
106 info->replaygain_album_peak_str = 0; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
107 info->replaygain_track_peak_str = 0; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
108 info->mp3gain_undo_str = 0; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
109 info->mp3gain_minmax_str = 0; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
110 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
111 info->tuple = NULL; |
611 | 112 |
113 input_parse_url(info); | |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
114 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
115 info->infile = vfs_fopen(info->filename, "rb"); |
611 | 116 if (info->infile == NULL) { |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
117 return FALSE; |
611 | 118 } |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
119 // obtain file size |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
120 vfs_fseek(info->infile, 0, SEEK_END); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
121 info->size = vfs_ftell(info->infile); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
122 vfs_fseek(info->infile, 0, SEEK_SET); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
123 info->remote = info->size == 0 ? TRUE : FALSE; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
124 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
125 #ifdef DEBUG |
613
85a70ace8c02
[svn] - press F5 on not yet played stream no longer hangs.
yaz
parents:
612
diff
changeset
|
126 g_message("i: info->size == %lu", info->size); |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
127 g_message("e: input_init"); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
128 #endif |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
129 return TRUE; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
130 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
131 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
132 /* return length in letters */ |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
133 size_t mad_ucs4len(id3_ucs4_t *ucs) |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
134 { |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
135 id3_ucs4_t *ptr = ucs; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
136 size_t len = 0; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
137 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
138 while(*ptr++ != 0) |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
139 len++; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
140 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
141 return len; |
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 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
144 /* duplicate id3_ucs4_t string. new string will be terminated with 0. */ |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
145 id3_ucs4_t *mad_ucs4dup(id3_ucs4_t *org) |
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 id3_ucs4_t *new = NULL; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
148 size_t len = mad_ucs4len(org); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
149 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
150 new = g_malloc0((len + 1) * sizeof(id3_ucs4_t)); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
151 memcpy(new, org, len * sizeof(id3_ucs4_t)); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
152 *(new + len) = 0; //terminate |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
153 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
154 return new; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
155 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
156 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
157 #define BYTES(x) ((x) * sizeof(id3_ucs4_t)) |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
158 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
159 id3_ucs4_t *mad_parse_genre(const id3_ucs4_t *string) |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
160 { |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
161 id3_ucs4_t *ret = NULL; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
162 id3_ucs4_t *tmp = NULL; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
163 id3_ucs4_t *genre = NULL; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
164 id3_ucs4_t *ptr, *end, *tail, *tp; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
165 size_t ret_len = 0; //num of ucs4 char! |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
166 size_t tmp_len = 0; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
167 gboolean is_num = TRUE; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
168 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
169 tail = (id3_ucs4_t *)string + mad_ucs4len((id3_ucs4_t *)string); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
170 |
611 | 171 ret = g_malloc0(1024); |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
172 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
173 for(ptr = (id3_ucs4_t *)string; *ptr != 0 && ptr <= tail; ptr++) { |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
174 if(*ptr == '(') { |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
175 if(*(++ptr) == '(') { // escaped text like: ((something) |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
176 for(end = ptr; *end != ')' && *end != 0;) { // copy "(something)" |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
177 end++; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
178 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
179 end++; //include trailing ')' |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
180 memcpy(ret, ptr, BYTES(end - ptr)); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
181 ret_len += (end - ptr); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
182 *(ret + ret_len) = 0; //terminate |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
183 ptr = end + 1; |
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 else { |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
186 // reference to an id3v1 genre code |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
187 for(end = ptr; *end != ')' && *end != 0;) { |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
188 end++; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
189 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
190 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
191 tmp = g_malloc0(BYTES(end - ptr + 1)); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
192 memcpy(tmp, ptr, BYTES(end - ptr)); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
193 *(tmp + (end - ptr)) = 0; //terminate |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
194 ptr += end - ptr; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
195 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
196 genre = (id3_ucs4_t *)id3_genre_name((const id3_ucs4_t *)tmp); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
197 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
198 g_free(tmp); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
199 tmp = NULL; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
200 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
201 tmp_len = mad_ucs4len(genre); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
202 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
203 memcpy(ret + BYTES(ret_len), genre, BYTES(tmp_len)); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
204 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
205 ret_len += tmp_len; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
206 *(ret + ret_len) = 0; //terminate |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
207 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
208 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
209 else { |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
210 for(end = ptr; *end != '(' && *end != 0; ) { |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
211 end++; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
212 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
213 // scan string to determine whether a genre code number or not |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
214 tp = ptr; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
215 is_num = TRUE; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
216 while(tp < end) { |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
217 if(*tp < '0' || *tp > '9') { // anything else than number appears. |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
218 is_num = FALSE; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
219 break; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
220 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
221 tp++; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
222 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
223 if(is_num) { |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
224 #ifdef DEBUG |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
225 printf("is_num!\n"); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
226 #endif |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
227 tmp = g_malloc0(BYTES(end - ptr + 1)); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
228 memcpy(tmp, ptr, BYTES(end - ptr)); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
229 *(tmp + (end - ptr)) = 0; //terminate |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
230 ptr += end - ptr; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
231 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
232 genre = (id3_ucs4_t *)id3_genre_name((const id3_ucs4_t *)tmp); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
233 #ifdef DEBUG |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
234 printf("genre length = %d\n", mad_ucs4len(genre)); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
235 #endif |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
236 g_free(tmp); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
237 tmp = NULL; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
238 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
239 tmp_len = mad_ucs4len(genre); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
240 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
241 memcpy(ret + BYTES(ret_len), genre, BYTES(tmp_len)); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
242 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
243 ret_len += tmp_len; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
244 *(ret + ret_len) = 0; //terminate |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
245 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
246 else { // plain text |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
247 #ifdef DEBUG |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
248 printf("plain!\n"); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
249 printf("ret_len = %d\n", ret_len); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
250 #endif |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
251 memcpy(ret + BYTES(ret_len), ptr, BYTES(end - ptr)); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
252 ret_len = ret_len + (end - ptr); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
253 *(ret + ret_len) = 0; //terminate |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
254 ptr += (end - ptr); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
255 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
256 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
257 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
258 return ret; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
259 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
260 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
261 gchar *input_id3_get_string(struct id3_tag * tag, char *frame_name) |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
262 { |
618
a7a28782c1b0
[svn] - revise input_id3_get_string() to take encoding of field into account.
yaz
parents:
613
diff
changeset
|
263 gchar *rtn0 = NULL, *rtn = NULL; |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
264 const id3_ucs4_t *string_const; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
265 id3_ucs4_t *string; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
266 struct id3_frame *frame; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
267 union id3_field *field; |
618
a7a28782c1b0
[svn] - revise input_id3_get_string() to take encoding of field into account.
yaz
parents:
613
diff
changeset
|
268 int encoding = -1; |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
269 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
270 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
|
271 if (!frame) |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
272 return NULL; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
273 |
618
a7a28782c1b0
[svn] - revise input_id3_get_string() to take encoding of field into account.
yaz
parents:
613
diff
changeset
|
274 field = id3_frame_field(frame, 0); |
a7a28782c1b0
[svn] - revise input_id3_get_string() to take encoding of field into account.
yaz
parents:
613
diff
changeset
|
275 encoding = id3_field_gettextencoding(field); |
a7a28782c1b0
[svn] - revise input_id3_get_string() to take encoding of field into account.
yaz
parents:
613
diff
changeset
|
276 |
620 | 277 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
|
278 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
|
279 else |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
280 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
|
281 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
282 if (!field) |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
283 return NULL; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
284 |
620 | 285 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
|
286 string_const = id3_field_getfullstring(field); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
287 else |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
288 string_const = id3_field_getstrings(field, 0); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
289 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
290 if (!string_const) |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
291 return NULL; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
292 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
293 string = mad_ucs4dup((id3_ucs4_t *)string_const); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
294 |
620 | 295 if (!strcmp(frame_name, ID3_FRAME_GENRE)) { |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
296 id3_ucs4_t *string2 = NULL; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
297 string2 = mad_parse_genre(string); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
298 g_free((void *)string); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
299 string = string2; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
300 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
301 |
618
a7a28782c1b0
[svn] - revise input_id3_get_string() to take encoding of field into account.
yaz
parents:
613
diff
changeset
|
302 switch (encoding) { |
a7a28782c1b0
[svn] - revise input_id3_get_string() to take encoding of field into account.
yaz
parents:
613
diff
changeset
|
303 case ID3_FIELD_TEXTENCODING_ISO_8859_1: |
a7a28782c1b0
[svn] - revise input_id3_get_string() to take encoding of field into account.
yaz
parents:
613
diff
changeset
|
304 rtn0 = id3_ucs4_latin1duplicate(string); |
a7a28782c1b0
[svn] - revise input_id3_get_string() to take encoding of field into account.
yaz
parents:
613
diff
changeset
|
305 break; |
a7a28782c1b0
[svn] - revise input_id3_get_string() to take encoding of field into account.
yaz
parents:
613
diff
changeset
|
306 case ID3_FIELD_TEXTENCODING_UTF_8: |
a7a28782c1b0
[svn] - revise input_id3_get_string() to take encoding of field into account.
yaz
parents:
613
diff
changeset
|
307 default: |
a7a28782c1b0
[svn] - revise input_id3_get_string() to take encoding of field into account.
yaz
parents:
613
diff
changeset
|
308 rtn0 = id3_ucs4_utf8duplicate(string); |
a7a28782c1b0
[svn] - revise input_id3_get_string() to take encoding of field into account.
yaz
parents:
613
diff
changeset
|
309 break; |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
310 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
311 |
618
a7a28782c1b0
[svn] - revise input_id3_get_string() to take encoding of field into account.
yaz
parents:
613
diff
changeset
|
312 rtn = str_to_utf8(rtn0); |
a7a28782c1b0
[svn] - revise input_id3_get_string() to take encoding of field into account.
yaz
parents:
613
diff
changeset
|
313 g_free(rtn0); |
a7a28782c1b0
[svn] - revise input_id3_get_string() to take encoding of field into account.
yaz
parents:
613
diff
changeset
|
314 |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
315 #ifdef DEBUG |
618
a7a28782c1b0
[svn] - revise input_id3_get_string() to take encoding of field into account.
yaz
parents:
613
diff
changeset
|
316 g_print("i: string = %s\n", rtn); |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
317 #endif |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
318 return rtn; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
319 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
320 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
321 /** |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
322 * read the ID3 tag |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
323 */ |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
324 static void input_read_tag(struct mad_info_t *info) |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
325 { |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
326 gchar *string = NULL; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
327 TitleInput *title_input; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
328 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
329 if (info->tuple == NULL) { |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
330 title_input = bmp_title_input_new(); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
331 info->tuple = title_input; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
332 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
333 else |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
334 title_input = info->tuple; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
335 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
336 info->id3file = id3_file_open(info->filename, ID3_FILE_MODE_READONLY); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
337 if (!info->id3file) { |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
338 return; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
339 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
340 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
341 info->tag = id3_file_tag(info->id3file); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
342 if (!info->tag) { |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
343 return; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
344 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
345 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
346 title_input->performer = |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
347 input_id3_get_string(info->tag, ID3_FRAME_ARTIST); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
348 title_input->track_name = |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
349 input_id3_get_string(info->tag, ID3_FRAME_TITLE); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
350 title_input->album_name = |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
351 input_id3_get_string(info->tag, ID3_FRAME_ALBUM); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
352 title_input->genre = input_id3_get_string(info->tag, ID3_FRAME_GENRE); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
353 title_input->comment = |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
354 input_id3_get_string(info->tag, ID3_FRAME_COMMENT); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
355 string = input_id3_get_string(info->tag, ID3_FRAME_TRACK); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
356 if (string) { |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
357 title_input->track_number = atoi(string); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
358 g_free(string); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
359 string = NULL; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
360 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
361 // year |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
362 string = NULL; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
363 string = input_id3_get_string(info->tag, ID3_FRAME_YEAR); //TDRC |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
364 if (!string) |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
365 string = input_id3_get_string(info->tag, "TYER"); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
366 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
367 if (string) { |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
368 title_input->year = atoi(string); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
369 g_free(string); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
370 string = NULL; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
371 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
372 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
373 title_input->file_name = g_strdup(g_basename(info->filename)); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
374 title_input->file_path = g_path_get_dirname(info->filename); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
375 if ((string = strrchr(title_input->file_name, '.'))) { |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
376 title_input->file_ext = string + 1; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
377 *string = '\0'; // make filename end at dot. |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
378 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
379 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
380 info->title = xmms_get_titlestring(audmad_config.title_override == TRUE ? |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
381 audmad_config.id3_format : xmms_get_gentitle_format(), title_input); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
382 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
383 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
384 /** |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
385 * Retrieve meta-information about URL. |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
386 * For local files this means ID3 tag etc. |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
387 */ |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
388 gboolean input_get_info(struct mad_info_t *info, gboolean fast_scan) |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
389 { |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
390 #ifdef DEBUG |
612 | 391 g_message("f: input_get_info: %s, fast_scan = %s", info->title, fast_scan ? "TRUE" : "FALSE"); |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
392 #endif /* DEBUG */ |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
393 input_read_tag(info); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
394 input_read_replaygain(info); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
395 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
396 /* scan mp3 file, decoding headers unless fast_scan is set */ |
611 | 397 if (scan_file(info, fast_scan) == FALSE) { |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
398 return FALSE; |
611 | 399 } |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
400 /* reset the input file to the start */ |
611 | 401 vfs_fseek(info->infile, 0, SEEK_SET); |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
402 info->offset = 0; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
403 |
611 | 404 if(info->remote){ |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
405 gchar *stream_name = vfs_get_metadata(info->infile, "stream-name"); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
406 gchar *track_name = vfs_get_metadata(info->infile, "track-name"); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
407 gchar *tmp = NULL; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
408 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
409 g_free(info->title); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
410 g_free(info->tuple->track_name); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
411 g_free(info->tuple->album_name); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
412 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
413 info->title = g_strdup(track_name); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
414 info->tuple->track_name = g_strdup(track_name); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
415 info->tuple->album_name = g_strdup(stream_name); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
416 tmp = g_strdup_printf("%s (%s)", track_name, stream_name); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
417 mad_plugin->set_info(tmp, |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
418 -1, // indicates the stream is unseekable |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
419 info->bitrate, info->freq, info->channels); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
420 g_free(tmp); g_free(stream_name); g_free(track_name); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
421 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
422 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
423 /* use the filename for the title as a last resort */ |
611 | 424 if (!info->title) { |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
425 char *pos = strrchr(info->filename, DIR_SEPARATOR); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
426 if (pos) |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
427 info->title = g_strdup(pos + 1); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
428 else |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
429 info->title = g_strdup(info->filename); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
430 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
431 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
432 #ifdef DEBUG |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
433 g_message("e: input_get_info"); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
434 #endif /* DEBUG */ |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
435 return TRUE; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
436 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
437 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
438 |
611 | 439 |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
440 /** |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
441 * Read data from the source given my madinfo into the buffer |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
442 * provided. Return the number of bytes read. |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
443 * @return 0 on EOF |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
444 * @return -1 on error |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
445 */ |
611 | 446 // this function may be called before info->playback initialized. |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
447 int |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
448 input_get_data(struct mad_info_t *madinfo, guchar * buffer, |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
449 int buffer_size) |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
450 { |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
451 int len = 0; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
452 #ifdef DEBUG |
611 | 453 #ifdef DEBUG_INTENSIVELY |
454 g_message ("f: input_get_data: %d", buffer_size); | |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
455 #endif |
611 | 456 #endif |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
457 /* simply read to data from the file */ |
618
a7a28782c1b0
[svn] - revise input_id3_get_string() to take encoding of field into account.
yaz
parents:
613
diff
changeset
|
458 len = vfs_fread(buffer, 1, buffer_size, madinfo->infile); //vfs_fread returns num of elements. |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
459 |
611 | 460 if(len == 0){ |
461 if(madinfo->playback) | |
462 madinfo->playback->eof = TRUE; | |
463 } | |
464 | |
465 if(madinfo->remote) { | |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
466 gchar *stream_name = vfs_get_metadata(madinfo->infile, "stream-name"); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
467 gchar *track_name = vfs_get_metadata(madinfo->infile, "track-name"); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
468 gchar *tmp = NULL; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
469 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
470 g_free(madinfo->title); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
471 g_free(madinfo->tuple->track_name); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
472 g_free(madinfo->tuple->album_name); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
473 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
474 madinfo->title = g_strdup(track_name); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
475 madinfo->tuple->track_name = g_strdup(track_name); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
476 madinfo->tuple->album_name = g_strdup(stream_name); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
477 tmp = g_strdup_printf("%s (%s)", track_name, stream_name); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
478 mad_plugin->set_info(tmp, |
611 | 479 -1, // indicate the stream is unseekable |
480 madinfo->bitrate, madinfo->freq, madinfo->channels); | |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
481 g_free(tmp); g_free(stream_name); g_free(track_name); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
482 } |
611 | 483 |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
484 #ifdef DEBUG |
611 | 485 #ifdef DEBUG_INTENSIVELY |
486 g_message ("e: input_get_data: size=%d offset=%d", len, madinfo->offset); | |
487 #endif | |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
488 #endif |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
489 madinfo->offset += len; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
490 return len; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
491 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
492 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
493 /** |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
494 * Free up all mad_info_t related resourses. |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
495 */ |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
496 gboolean input_term(struct mad_info_t * info) |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
497 { |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
498 #ifdef DEBUG |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
499 g_message("f: input_term"); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
500 #endif |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
501 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
502 if (info->title) |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
503 g_free(info->title); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
504 if (info->url) |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
505 g_free(info->url); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
506 if (info->filename) |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
507 g_free(info->filename); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
508 if (info->infile) |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
509 vfs_fclose(info->infile); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
510 if (info->id3file) |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
511 id3_file_close(info->id3file); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
512 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
513 if (info->replaygain_album_str) |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
514 g_free(info->replaygain_album_str); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
515 if (info->replaygain_track_str) |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
516 g_free(info->replaygain_track_str); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
517 if (info->replaygain_album_peak_str) |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
518 g_free(info->replaygain_album_peak_str); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
519 if (info->replaygain_track_peak_str) |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
520 g_free(info->replaygain_track_peak_str); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
521 if (info->mp3gain_undo_str) |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
522 g_free(info->mp3gain_undo_str); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
523 if (info->mp3gain_minmax_str) |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
524 g_free(info->mp3gain_minmax_str); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
525 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
526 if (info->tuple) { |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
527 bmp_title_input_free(info->tuple); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
528 info->tuple = NULL; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
529 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
530 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
531 /* set everything to zero in case it gets used again. */ |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
532 memset(info, 0, sizeof(struct mad_info_t)); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
533 #ifdef DEBUG |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
534 g_message("e: input_term"); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
535 #endif |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
536 return TRUE; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
537 } |