diff -r 1eff6a1f7263 -r b0e8a532e882 gst-plugins-mythtv/src/gstmythtvsrc.c --- a/gst-plugins-mythtv/src/gstmythtvsrc.c Mon Mar 26 16:04:46 2007 +0100 +++ b/gst-plugins-mythtv/src/gstmythtvsrc.c Wed Apr 04 22:11:50 2007 +0100 @@ -336,6 +336,7 @@ gint read = 0; guint sizetoread = size; gint max_iters = GMYTHTV_TRANSFER_MAX_RESENDS; + GMythFileTransferReadResult result; GST_LOG_OBJECT (src, "Starting: Reading %d bytes...", sizetoread); @@ -345,22 +346,22 @@ while (sizetoread == size && --max_iters > 0) { - len = gmyth_file_transfer_read (src->file_transfer, + result = gmyth_file_transfer_read (src->file_transfer, data_ptr, sizetoread, src->live_tv); if (len > 0) { - read += len; - sizetoread -= len; + read += data_ptr->len; + sizetoread -= data_ptr->len; } else if (len < 0) { if (src->live_tv == FALSE) { read = -1; goto eos; } else { - if (len == GMYTHTV_FILE_TRANSFER_READ_ERROR) { /* -314 */ + if (result == GMYTH_FILE_TRANSFER_READ_ERROR) { /* -314 */ GST_INFO_OBJECT (src, "[LiveTV] FileTransfer READ_ERROR!"); goto done; - } else if (len == GMYTHTV_FILE_TRANSFER_NEXT_PROG_CHAIN) { /* -315 */ + } else if (result == GMYTH_FILE_TRANSFER_READ_NEXT_PROG_CHAIN) { /* -315 */ GST_INFO_OBJECT (src, "[LiveTV] FileTransfer - Go to the next program chain!"); continue; @@ -368,7 +369,7 @@ goto done; } - } else if (len == 0) + } else if (data_ptr->len == 0) goto done; if (read == sizetoread) @@ -392,7 +393,6 @@ { GstMythtvSrc *src; GstFlowReturn ret = GST_FLOW_OK; - gint read = -1; src = GST_MYTHTV_SRC (psrc); @@ -412,6 +412,7 @@ /* just get from the byte array, no network effort... */ if ((src->buffer_remain = src->bytes_queue->len) < MAX_READ_SIZE) { GByteArray *buffer; + GMythFileTransferReadResult result = GMYTH_FILE_TRANSFER_READ_OK; buffer = NULL; guint buffer_size_inter = (INTERNAL_BUFFER_SIZE - src->buffer_remain); @@ -421,16 +422,16 @@ buffer = g_byte_array_new (); - read = do_read_request_response (src, buffer_size_inter, buffer); + result = do_read_request_response (src, buffer_size_inter, buffer); - if (G_UNLIKELY (read < 0)) { + if (G_UNLIKELY (buffer->len < 0)) { if (buffer != NULL) { g_byte_array_free (buffer, TRUE); buffer = NULL; } - if (src->live_tv || ( read == GMYTHTV_FILE_TRANSFER_NEXT_PROG_CHAIN )) + if (src->live_tv || ( result == GMYTH_FILE_TRANSFER_READ_NEXT_PROG_CHAIN )) goto change_progchain; else goto read_error; @@ -457,13 +458,13 @@ } src->bytes_queue = - g_byte_array_append (src->bytes_queue, buffer->data, read); - if (read > buffer_size_inter) + g_byte_array_append (src->bytes_queue, buffer->data, buffer->len); + if (buffer->len > buffer_size_inter) GST_WARNING_OBJECT (src, "INCREASED buffer size! Backend sent more than we ask him... (%d)", abs (read - buffer_size_inter)); - src->buffer_remain += read; + src->buffer_remain += buffer->len; if (buffer != NULL) { g_byte_array_free (buffer, TRUE); @@ -726,7 +727,7 @@ "MythTV FileTransfer filesize = %lld, content_size = %lld!", src->file_transfer->filesize, src->content_size); - src->content_size = src->file_transfer->filesize; + src->content_size = gmyth_file_transfer_get_filesize (src->file_transfer); src->do_start = FALSE;