Mercurial > audlegacy-plugins
changeset 494:631bd25d2380 trunk
[svn] - getc/ungetc emulation
author | nenolod |
---|---|
date | Sun, 21 Jan 2007 19:36:36 -0800 |
parents | 31d21ad70903 |
children | 218ef0b740ac |
files | ChangeLog src/curl/curl.c |
diffstat | 2 files changed, 38 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Sun Jan 21 16:08:19 2007 -0800 +++ b/ChangeLog Sun Jan 21 19:36:36 2007 -0800 @@ -1,3 +1,12 @@ +2007-01-22 00:08:19 +0000 Giacomo Lozito <james@develia.org> + revision [1072] + flac 113 plugin: stability fixes and a new option to disable bitrate update in player window during playback (saves cpu, this is the solution for most people playing flac and reporting high cpu usage) + trunk/src/flac113/configure.c | 21 ++++++++++++++++++--- + trunk/src/flac113/configure.h | 1 + + trunk/src/flac113/plugin.c | 15 +++++++++------ + 3 files changed, 28 insertions(+), 9 deletions(-) + + 2007-01-22 00:03:30 +0000 Giacomo Lozito <james@develia.org> revision [1070] flac 112 plugin: stability fixes and a new option to disable bitrate update in player window during playback (saves cpu, this is the solution for most people playing flac and reporting high cpu usage)
--- a/src/curl/curl.c Sun Jan 21 16:08:19 2007 -0800 +++ b/src/curl/curl.c Sun Jan 21 19:36:36 2007 -0800 @@ -65,6 +65,8 @@ gchar *name; gchar *title; + + GSList *charstack; // getc/ungetc emulation --nenolod }; VFSConstructor curl_const; @@ -592,17 +594,41 @@ gint curl_vfs_getc_impl(VFSFile *stream) { + CurlHandle *handle = (CurlHandle *) stream->handle; gchar c; - if (curl_vfs_fread_impl(&c, 1, 1, stream) != 1) + + g_return_val_if_fail(handle != NULL, EOF); + + g_print("curl_vfs_getc reached\n"); + + if (handle->charstack != NULL) + { + c = GPOINTER_TO_INT(handle->charstack->data); + handle->charstack = g_slist_delete_link(handle->charstack, handle->charstack); + return c; + } + else if (curl_vfs_fread_impl(&c, 1, 1, stream) != 1) return -1; + return c; } gint curl_vfs_ungetc_impl(gint c, VFSFile *stream) { - g_print("Tried ungetc\n"); - return -1; + CurlHandle *handle = (CurlHandle *) stream->handle; + + g_return_val_if_fail(handle != NULL, EOF); + + g_print("curl_vfs_ungetc reached\n"); + + handle->charstack = g_slist_prepend(handle->charstack, GINT_TO_POINTER(c)); + + if (handle->charstack != NULL) + return c; + + /* only reached if there is an error... */ + return EOF; } gint