1.1 --- a/libgnomevfs2-mythtv/modules/mythtv-method.c Wed Apr 04 21:41:18 2007 +0100
1.2 +++ b/libgnomevfs2-mythtv/modules/mythtv-method.c Wed Apr 04 21:53:33 2007 +0100
1.3 @@ -56,6 +56,7 @@
1.4 GMythBackendInfo *backend_info;
1.5 GMythURI *gmyth_uri;
1.6 GMythRecorder *live_recorder;
1.7 + gboolean started;
1.8 gint64 offset;
1.9
1.10 gchar *channel_name;
1.11 @@ -357,39 +358,36 @@
1.12 GnomeVFSFileSize * bytes_read,
1.13 GnomeVFSContext * context)
1.14 {
1.15 - GnomeVFSResult result;
1.16 + GnomeVFSResult retval = GNOME_VFS_OK;
1.17 MythtvHandle *myth_handle;
1.18 - gint64 total_read = 0;
1.19 + GMythFileTransferReadResult result;
1.20 GByteArray *myth_buffer = g_byte_array_new ();
1.21
1.22 _GNOME_VFS_METHOD_PARAM_CHECK (method_handle != NULL);
1.23
1.24 myth_handle = (MythtvHandle *) method_handle;
1.25 - result = GNOME_VFS_OK;
1.26 + result = gmyth_file_transfer_read (myth_handle->file_transfer,
1.27 + myth_buffer,
1.28 + num_bytes, gmyth_uri_is_livetv (myth_handle->gmyth_uri));
1.29
1.30 - total_read = gmyth_file_transfer_read (myth_handle->file_transfer,
1.31 - myth_buffer,
1.32 - num_bytes, gmyth_uri_is_livetv (myth_handle->gmyth_uri));
1.33
1.34 -
1.35 - if (total_read == -1) {
1.36 - result = GNOME_VFS_ERROR_IO;
1.37 - total_read = 0;
1.38 + if (result == GMYTH_FILE_TRANSFER_READ_ERROR) {
1.39 + retval = GNOME_VFS_ERROR_IO;
1.40 }
1.41
1.42 - if (total_read < num_bytes) {
1.43 - result = GNOME_VFS_ERROR_EOF;
1.44 + if (result == GMYTH_FILE_TRANSFER_READ_EOF) {
1.45 + retval = GNOME_VFS_ERROR_EOF;
1.46 }
1.47
1.48 - if (total_read > 0) {
1.49 - g_memmove (buffer, myth_buffer->data, total_read);
1.50 + if (myth_buffer->len > 0) {
1.51 + g_memmove (buffer, myth_buffer->data, myth_buffer->len);
1.52 + *bytes_read = (GnomeVFSFileSize) myth_buffer->len;
1.53 + myth_handle->offset += myth_buffer->len;
1.54 g_byte_array_free (myth_buffer, TRUE);
1.55 - myth_handle->offset += total_read;
1.56 }
1.57
1.58 - *bytes_read = (GnomeVFSFileSize) total_read;
1.59
1.60 - return result;
1.61 + return retval;
1.62 }
1.63
1.64 static GnomeVFSResult