[svn r95] Minor fixes on the GstAdapter (cache buffer).
1.1 --- a/gst-plugins-mythtv/src/gstmythtvsrc.c Fri Nov 17 15:20:28 2006 +0000
1.2 +++ b/gst-plugins-mythtv/src/gstmythtvsrc.c Fri Nov 17 18:18:24 2006 +0000
1.3 @@ -42,7 +42,7 @@
1.4 //( 32*1024 )
1.5
1.6 /* 4*1024 ??? */
1.7 -#define MAX_READ_SIZE 6*1024
1.8 +#define MAX_READ_SIZE 4*1024
1.9 //( 32*1024 )
1.10
1.11 #define GST_FLOW_ERROR_NO_DATA -101
1.12 @@ -620,12 +620,9 @@
1.13 }
1.14
1.15 if ( ( src->buffer_remain = gst_adapter_available_fast( src->adapter ) ) < MAX_READ_SIZE ) {
1.16 - //gint8 *tmp_buffer = g_malloc0( INTERNAL_BUFFER_SIZE ); // FIXME: DON'T ALLOC EVERY TIME
1.17 +
1.18 buffer = gst_buffer_new_and_alloc( INTERNAL_BUFFER_SIZE - src->buffer_remain );
1.19
1.20 - //g_memmove (tmp_buffer, src->buffer + src->buffer_offset, src->buffer_remain);
1.21 - //g_memmove( tmp_buffer, src->buffer, src->buffer_remain );
1.22 -
1.23 read = do_read_request_response( src, 0, INTERNAL_BUFFER_SIZE - src->buffer_remain, &(GST_BUFFER_DATA(buffer)) );
1.24
1.25 if (G_UNLIKELY (read < 0)) {
1.26 @@ -640,15 +637,12 @@
1.27
1.28 gst_adapter_push( src->adapter, buffer );
1.29
1.30 - //len = gmyth_file_transfer_read( src->file_transfer,
1.31 - // tmp_buffer + src->buffer_remain, INTERNAL_BUFFER_SIZE - src->buffer_remain, TRUE );
1.32 - // fixme: handle eos
1.33 - // fixme: can I deallocate the previous buffer here?
1.34 - //g_memmove( src->buffer, tmp_buffer, INTERNAL_BUFFER_SIZE );
1.35 src->buffer_offset = 0;
1.36 src->buffer_remain = src->buffer_remain + read;
1.37
1.38 - //g_free( tmp_buffer );
1.39 + g_print( "[%s]\tBYTES READ (actual) = %d, BYTES READ (cumulative) = %llu, "\
1.40 + "OFFSET = %llu, CONTENT SIZE = %llu.\n", __FUNCTION__, read, src->bytes_read,
1.41 + src->read_offset, src->content_size );
1.42
1.43 }
1.44
1.45 @@ -675,11 +669,7 @@
1.46 //gst_adapter_flush( src->adapter, size );
1.47 gst_buffer_unref( buffer );
1.48
1.49 - g_print( "[%s]\tBYTES READ (actual) = %d, BYTES READ (cumulative) = %llu, "\
1.50 - "OFFSET = %llu, CONTENT SIZE = %llu.\n", __FUNCTION__, read, src->bytes_read,
1.51 - src->read_offset, src->content_size );
1.52 -
1.53 - g_print( "Got buffer: [%s]\t\tBUFFER --->SIZE = %d, OFFSET = %llu, "\
1.54 + g_print( "Got buffer: [%s]\t\tBUFFER --->SIZE = %d, OFFSET = %llu, "\
1.55 "OFFSET_END = %llu.\n\n", __FUNCTION__, GST_BUFFER_SIZE (*outbuf),
1.56 GST_BUFFER_OFFSET (*outbuf), GST_BUFFER_OFFSET_END (*outbuf) );
1.57