Mercurial > audlegacy-plugins
annotate src/stdio/stdio.c @ 3198:83b1a4e5f453
alsa-ng: Keep mixer open even when playback stopped.
author | John Lindgren <john.lindgren@tds.net> |
---|---|
date | Wed, 22 Jul 2009 16:42:16 -0400 |
parents | 6dd886b5c72b |
children |
rev | line source |
---|---|
3161
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
1 /* Audacious |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
2 * Copyright (c) 2006 William Pitcock |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
3 * |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
4 * This program is free software; you can redistribute it and/or modify |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
5 * it under the terms of the GNU General Public License as published by |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
6 * the Free Software Foundation; either version 2 of the License, or |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
7 * (at your option) any later version. |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
8 * |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
9 * This program is distributed in the hope that it will be useful, |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
12 * GNU General Public License for more details. |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
13 * |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
14 * You should have received a copy of the GNU General Public License |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
15 * along with this program; if not, write to the Free Software |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
17 */ |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
18 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
19 #include "config.h" |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
20 #include <audlegacy/plugin.h> |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
21 #include <stdio.h> |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
22 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
23 #include <unistd.h> |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
24 #include <sys/stat.h> |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
25 #include <sys/types.h> |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
26 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
27 #include <string.h> |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
28 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
29 static gchar * |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
30 aud_vfs_stdio_urldecode_path(const gchar * encoded_path) |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
31 { |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
32 const gchar *cur, *ext; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
33 gchar *path, *tmp; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
34 gint realchar; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
35 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
36 if (!encoded_path) |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
37 return NULL; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
38 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
39 if (!aud_str_has_prefix_nocase(encoded_path, "file:")) |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
40 return NULL; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
41 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
42 cur = encoded_path + 5; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
43 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
44 if (aud_str_has_prefix_nocase(cur, "//localhost")) |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
45 cur += 11; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
46 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
47 if (*cur == '/') |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
48 while (cur[1] == '/') |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
49 cur++; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
50 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
51 tmp = g_malloc0(strlen(cur) + 1); |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
52 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
53 while ((ext = strchr(cur, '%')) != NULL) { |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
54 strncat(tmp, cur, ext - cur); |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
55 ext++; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
56 cur = ext + 2; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
57 if (!sscanf(ext, "%2x", &realchar)) { |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
58 /* Assume it is a literal '%'. Several file |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
59 * managers send unencoded file: urls on drag |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
60 * and drop. */ |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
61 realchar = '%'; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
62 cur -= 2; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
63 } |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
64 tmp[strlen(tmp)] = realchar; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
65 } |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
66 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
67 path = g_strconcat(tmp, cur, NULL); |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
68 g_free(tmp); |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
69 return path; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
70 } |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
71 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
72 VFSFile * |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
73 stdio_aud_vfs_fopen_impl(const gchar * path, |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
74 const gchar * mode) |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
75 { |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
76 VFSFile *file; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
77 gchar *decpath; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
78 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
79 if (!path || !mode) |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
80 return NULL; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
81 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
82 decpath = aud_vfs_stdio_urldecode_path(path); |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
83 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
84 file = g_new(VFSFile, 1); |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
85 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
86 file->handle = fopen(decpath != NULL ? decpath : path, mode); |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
87 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
88 g_free(decpath); |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
89 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
90 if (file->handle == NULL) { |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
91 g_free(file); |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
92 file = NULL; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
93 } |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
94 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
95 return file; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
96 } |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
97 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
98 gint |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
99 stdio_aud_vfs_fclose_impl(VFSFile * file) |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
100 { |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
101 gint ret = 0; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
102 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
103 if (file == NULL) |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
104 return -1; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
105 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
106 if (file->handle) |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
107 { |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
108 FILE *handle = (FILE *) file->handle; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
109 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
110 if (fclose(handle) != 0) |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
111 ret = -1; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
112 file->handle = NULL; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
113 } |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
114 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
115 return ret; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
116 } |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
117 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
118 size_t |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
119 stdio_aud_vfs_fread_impl(gpointer ptr, |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
120 size_t size, |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
121 size_t nmemb, |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
122 VFSFile * file) |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
123 { |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
124 FILE *handle; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
125 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
126 if (file == NULL) |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
127 return 0; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
128 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
129 handle = (FILE *) file->handle; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
130 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
131 return fread(ptr, size, nmemb, handle); |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
132 } |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
133 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
134 size_t |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
135 stdio_aud_vfs_fwrite_impl(gconstpointer ptr, |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
136 size_t size, |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
137 size_t nmemb, |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
138 VFSFile * file) |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
139 { |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
140 FILE *handle; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
141 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
142 if (file == NULL) |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
143 return 0; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
144 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
145 handle = (FILE *) file->handle; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
146 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
147 return fwrite(ptr, size, nmemb, handle); |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
148 } |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
149 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
150 gint |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
151 stdio_aud_vfs_getc_impl(VFSFile *stream) |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
152 { |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
153 FILE *handle = (FILE *) stream->handle; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
154 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
155 return getc( handle ); |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
156 } |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
157 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
158 gint |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
159 stdio_aud_vfs_ungetc_impl(gint c, VFSFile * file) |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
160 { |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
161 FILE *handle; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
162 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
163 if (file == NULL) |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
164 return -1; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
165 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
166 handle = (FILE *) file->handle; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
167 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
168 return ungetc(c, handle); |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
169 } |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
170 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
171 gint |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
172 stdio_aud_vfs_fseek_impl(VFSFile * file, |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
173 glong offset, |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
174 gint whence) |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
175 { |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
176 FILE *handle; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
177 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
178 if (file == NULL) |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
179 return 0; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
180 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
181 handle = (FILE *) file->handle; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
182 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
183 return fseek(handle, offset, whence); |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
184 } |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
185 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
186 void |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
187 stdio_aud_vfs_rewind_impl(VFSFile * file) |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
188 { |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
189 FILE *handle; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
190 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
191 if (file == NULL) |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
192 return; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
193 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
194 handle = (FILE *) file->handle; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
195 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
196 rewind(handle); |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
197 } |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
198 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
199 glong |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
200 stdio_aud_vfs_ftell_impl(VFSFile * file) |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
201 { |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
202 FILE *handle; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
203 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
204 if (file == NULL) |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
205 return 0; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
206 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
207 handle = (FILE *) file->handle; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
208 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
209 return ftell(handle); |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
210 } |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
211 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
212 gboolean |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
213 stdio_aud_vfs_feof_impl(VFSFile * file) |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
214 { |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
215 FILE *handle; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
216 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
217 if (file == NULL) |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
218 return FALSE; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
219 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
220 handle = (FILE *) file->handle; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
221 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
222 return (gboolean) feof(handle); |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
223 } |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
224 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
225 gint |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
226 stdio_aud_vfs_truncate_impl(VFSFile * file, glong size) |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
227 { |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
228 FILE *handle; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
229 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
230 if (file == NULL) |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
231 return -1; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
232 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
233 handle = (FILE *) file->handle; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
234 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
235 return ftruncate(fileno(handle), size); |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
236 } |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
237 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
238 off_t |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
239 stdio_aud_vfs_fsize_impl(VFSFile * file) |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
240 { |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
241 FILE *handle; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
242 struct stat s; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
243 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
244 if (file == NULL) |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
245 return -1; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
246 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
247 handle = (FILE *) file->handle; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
248 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
249 if (fstat(fileno(handle), &s) == -1) |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
250 return -1; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
251 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
252 return s.st_size; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
253 } |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
254 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
255 VFSConstructor file_const = { |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
256 .uri_id = "file://", |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
257 .vfs_fopen_impl = stdio_aud_vfs_fopen_impl, |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
258 .vfs_fclose_impl = stdio_aud_vfs_fclose_impl, |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
259 .vfs_fread_impl = stdio_aud_vfs_fread_impl, |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
260 .vfs_fwrite_impl = stdio_aud_vfs_fwrite_impl, |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
261 .vfs_getc_impl = stdio_aud_vfs_getc_impl, |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
262 .vfs_ungetc_impl = stdio_aud_vfs_ungetc_impl, |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
263 .vfs_fseek_impl = stdio_aud_vfs_fseek_impl, |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
264 .vfs_rewind_impl = stdio_aud_vfs_rewind_impl, |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
265 .vfs_ftell_impl = stdio_aud_vfs_ftell_impl, |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
266 .vfs_feof_impl = stdio_aud_vfs_feof_impl, |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
267 .vfs_truncate_impl = stdio_aud_vfs_truncate_impl, |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
268 .vfs_fsize_impl = stdio_aud_vfs_fsize_impl |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
269 }; |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
270 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
271 static void init(void) |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
272 { |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
273 aud_vfs_register_transport(&file_const); |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
274 } |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
275 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
276 static void cleanup(void) |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
277 { |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
278 #if 0 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
279 aud_vfs_unregister_transport(&file_const); |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
280 #endif |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
281 } |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
282 |
6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
283 DECLARE_PLUGIN(stdio, init, cleanup, NULL, NULL, NULL, NULL, NULL, NULL); |