# HG changeset patch # User renatofilho # Date 1175720013 -3600 # Node ID aa932d8bf85bd927d62a315421fc28c45bb44590 # Parent 4b6e332ac7b3e9de9381c5aad50c32dc6be3e905 [svn r507] diff -r 4b6e332ac7b3 -r aa932d8bf85b libgnomevfs2-mythtv/modules/mythtv-method.c --- a/libgnomevfs2-mythtv/modules/mythtv-method.c Wed Apr 04 21:41:18 2007 +0100 +++ b/libgnomevfs2-mythtv/modules/mythtv-method.c Wed Apr 04 21:53:33 2007 +0100 @@ -56,6 +56,7 @@ GMythBackendInfo *backend_info; GMythURI *gmyth_uri; GMythRecorder *live_recorder; + gboolean started; gint64 offset; gchar *channel_name; @@ -357,39 +358,36 @@ GnomeVFSFileSize * bytes_read, GnomeVFSContext * context) { - GnomeVFSResult result; + GnomeVFSResult retval = GNOME_VFS_OK; MythtvHandle *myth_handle; - gint64 total_read = 0; + GMythFileTransferReadResult result; GByteArray *myth_buffer = g_byte_array_new (); _GNOME_VFS_METHOD_PARAM_CHECK (method_handle != NULL); myth_handle = (MythtvHandle *) method_handle; - result = GNOME_VFS_OK; + result = gmyth_file_transfer_read (myth_handle->file_transfer, + myth_buffer, + num_bytes, gmyth_uri_is_livetv (myth_handle->gmyth_uri)); - total_read = gmyth_file_transfer_read (myth_handle->file_transfer, - myth_buffer, - num_bytes, gmyth_uri_is_livetv (myth_handle->gmyth_uri)); - - if (total_read == -1) { - result = GNOME_VFS_ERROR_IO; - total_read = 0; + if (result == GMYTH_FILE_TRANSFER_READ_ERROR) { + retval = GNOME_VFS_ERROR_IO; } - if (total_read < num_bytes) { - result = GNOME_VFS_ERROR_EOF; + if (result == GMYTH_FILE_TRANSFER_READ_EOF) { + retval = GNOME_VFS_ERROR_EOF; } - if (total_read > 0) { - g_memmove (buffer, myth_buffer->data, total_read); + if (myth_buffer->len > 0) { + g_memmove (buffer, myth_buffer->data, myth_buffer->len); + *bytes_read = (GnomeVFSFileSize) myth_buffer->len; + myth_handle->offset += myth_buffer->len; g_byte_array_free (myth_buffer, TRUE); - myth_handle->offset += total_read; } - *bytes_read = (GnomeVFSFileSize) total_read; - return result; + return retval; } static GnomeVFSResult