diff -r 4f7789e3bfd4 -r 899326948b25 gst-plugins-mythtv/src/gstmythtvsrc.c --- a/gst-plugins-mythtv/src/gstmythtvsrc.c Wed Nov 22 20:21:46 2006 +0000 +++ b/gst-plugins-mythtv/src/gstmythtvsrc.c Fri Nov 24 14:29:09 2006 +0000 @@ -85,9 +85,6 @@ static void gst_mythtv_src_finalize (GObject * gobject); -//static GstFlowReturn gst_mythtv_src_create (GstBaseSrc * psrc, guint64 offset, -// guint size, GstBuffer ** outbuf); - static GstFlowReturn gst_mythtv_src_create ( GstPushSrc* psrc, GstBuffer** outbuf ); static gboolean gst_mythtv_src_start (GstBaseSrc * bsrc); @@ -95,8 +92,10 @@ static gboolean gst_mythtv_src_get_size (GstBaseSrc * bsrc, guint64 * size); static gboolean gst_mythtv_src_is_seekable( GstBaseSrc *push_src ); -//static void gst_mythtv_src_get_times (GstBaseSrc * src, GstBuffer * buffer, -// GstClockTime * start, GstClockTime * end); +/* +static void gst_mythtv_src_get_times (GstBaseSrc * src, GstBuffer * buffer, + GstClockTime * start, GstClockTime * end); +*/ static gboolean gst_mythtv_src_do_seek( GstBaseSrc *base, GstSegment *segment ); @@ -135,9 +134,6 @@ "MythTV src"); } -//GST_BOILERPLATE_FULL (GstMythtvSrc, gst_mythtv_src, GstBaseSrc, -// GST_TYPE_BASE_SRC, _urihandler_init) - GST_BOILERPLATE_FULL (GstMythtvSrc, gst_mythtv_src, GstPushSrc, GST_TYPE_PUSH_SRC, _urihandler_init) @@ -278,13 +274,11 @@ this->bytes_queue = NULL; - //this->th_read_ahead = NULL; - this->th_mutex = NULL; gst_base_src_set_format( GST_BASE_SRC( this ), GST_FORMAT_BYTES ); - //gst_base_src_set_live ( GST_BASE_SRC( this ), TRUE ); + /* gst_base_src_set_live ( GST_BASE_SRC( this ), TRUE ); */ gst_pad_set_event_function ( GST_BASE_SRC_PAD(GST_BASE_SRC(this)), gst_mythtv_src_handle_event ); @@ -341,9 +335,7 @@ guint sizetoread = size; guint max_iters = GMYTHTV_TRANSFER_MAX_RESENDS; - //*data_ptr = g_malloc0( size ); - - g_print( "Starting: [%s] Reading %d bytes...\n", __FUNCTION__, sizetoread ); + GST_LOG_OBJECT( src, "Starting: [%s] Reading %d bytes...\n", __FUNCTION__, sizetoread ); /* Loop sending the Myth File Transfer request: * Retry whilst authentication fails and we supply it. */ @@ -409,10 +401,10 @@ goto change_progchain; //g_static_rec_mutex_lock( &th_mutex ); - g_print ( "[%s] offset = %llu, size = %d...\n", __FUNCTION__, + GST_DEBUG_OBJECT( src, "[%s] offset = %llu, size = %d...\n", __FUNCTION__, src->read_offset, MAX_READ_SIZE ); - g_print ( "[%s]\t\tCreate: buffer_remain: %d\n", __FUNCTION__, + GST_DEBUG_OBJECT ( src, "[%s]\t\tCreate: buffer_remain: %d\n", __FUNCTION__, (gint) src->buffer_remain); /* just get from the byte array, no network effort... */ @@ -433,6 +425,9 @@ goto change_progchain; src->bytes_queue = g_byte_array_append( src->bytes_queue, g_memdup( buffer->data, read ), read ); + if ( read > buffer_size_inter ) + GST_WARNING_OBJECT( src, "[%s] INCREASED buffer size! Backend sent more than we ask him... (%d)\n", + __FUNCTION__, abs( read - buffer_size_inter ) ); src->buffer_remain = src->buffer_remain + read; @@ -441,7 +436,7 @@ buffer = NULL; } - g_print( "[%s]\tBYTES READ (actual) = %d, BYTES READ (cumulative) = %llu, "\ + GST_DEBUG_OBJECT( src, "[%s]\tBYTES READ (actual) = %d, BYTES READ (cumulative) = %llu, "\ "OFFSET = %llu, CONTENT SIZE = %llu.\n", __FUNCTION__, read, src->bytes_read, src->read_offset, src->content_size ); @@ -464,7 +459,7 @@ /* gets the first buffer_size bytes from the byte array buffer variable */ guint8 *buf = g_memdup( src->bytes_queue->data, buffer_size ); - g_print( "[%s] read from network? %s!, buffer_remain = %d\n", __FUNCTION__, + GST_DEBUG_OBJECT( src, "[%s] read from network? %s!, buffer_remain = %d\n", __FUNCTION__, read == -1 ? "NO, got from buffer" : "YES, go see the backend's log file", src->buffer_remain ); GST_BUFFER_SIZE (*outbuf) = buffer_size; @@ -478,12 +473,12 @@ src->read_offset += GST_BUFFER_SIZE (*outbuf); src->bytes_read += GST_BUFFER_SIZE (*outbuf); - g_print ( "[%s]\t\tBuffer output with size: %d\n", __FUNCTION__, GST_BUFFER_SIZE (*outbuf) ); + GST_DEBUG_OBJECT( src, "[%s]\t\tBuffer output with size: %d\n", __FUNCTION__, GST_BUFFER_SIZE (*outbuf) ); /* flushs the newly buffer got from byte array */ src->bytes_queue = g_byte_array_remove_range( src->bytes_queue, 0, buffer_size ); - g_print( "Got buffer: [%s]\t\tBUFFER --->SIZE = %d, OFFSET = %llu, "\ + GST_DEBUG_OBJECT( src, "Got buffer: [%s]\t\tBUFFER --->SIZE = %d, OFFSET = %llu, "\ "OFFSET_END = %llu.\n\n", __FUNCTION__, GST_BUFFER_SIZE (*outbuf), GST_BUFFER_OFFSET (*outbuf), GST_BUFFER_OFFSET_END (*outbuf) ); @@ -530,139 +525,6 @@ } -#if 0 -static GstFlowReturn -gst_mythtv_src_create ( GstBaseSrc * psrc, guint64 offset, guint size, GstBuffer **outbuf ) -{ - GstMythtvSrc *src; - GstFlowReturn ret = GST_FLOW_OK; - gint read = -1; - gint adapter_size = 0; - guint max_adapter_rep = 1; - - src = GST_MYTHTV_SRC ( psrc ); - - /* The caller should know the number of bytes and not read beyond EOS. */ - if (G_UNLIKELY (src->eos)) - goto eos; - if ( G_UNLIKELY (src->update_prog_chain) ) - goto change_progchain; - - //g_static_rec_mutex_lock( &th_mutex ); - g_print ( "[%s] offset = %llu, size = %d...\n", __FUNCTION__, offset, size ); - - g_print ( "[%s]\t\tCreate: buffer_remain: %d\n", __FUNCTION__, - (gint) src->buffer_remain); - - /* just get from the byte array, no network effort... */ - if ( ( src->buffer_remain = src->bytes_queue->len ) < MAX_READ_SIZE ) { - guint8 *buffer = g_malloc0( INTERNAL_BUFFER_SIZE - src->buffer_remain ); - - read = do_read_request_response( src, 0, INTERNAL_BUFFER_SIZE - src->buffer_remain, &(buffer) ); - - if (G_UNLIKELY (read < 0)) { - if ( src->live_tv ) - goto change_progchain; - else - goto read_error; - } - - if ( G_UNLIKELY (src->update_prog_chain) ) - goto change_progchain; - - src->bytes_queue = g_byte_array_append( src->bytes_queue, buffer, read ); - - src->buffer_remain = src->buffer_remain + read; - - g_print( "[%s]\tBYTES READ (actual) = %d, BYTES READ (cumulative) = %llu, "\ - "OFFSET = %llu, CONTENT SIZE = %llu.\n", __FUNCTION__, read, src->bytes_read, - src->read_offset, src->content_size ); - - } - - guint buffer_size = ( src->buffer_remain < MAX_READ_SIZE) ? src->buffer_remain : MAX_READ_SIZE; - - /* Create the buffer. */ - ret = gst_pad_alloc_buffer ( GST_BASE_SRC_PAD (GST_BASE_SRC (psrc)), - offset, buffer_size, - GST_PAD_CAPS (GST_BASE_SRC_PAD (GST_BASE_SRC (psrc))), outbuf ); - - if (G_UNLIKELY (ret != GST_FLOW_OK)) { - if ( src->live_tv ) - goto change_progchain; - else - goto done; - } - - guint8 *buf = g_memdup( src->bytes_queue->data, buffer_size ); - - g_print( "[%s] read = %d, buffer_remain = %d\n", __FUNCTION__, read, src->buffer_remain ); - //src->read_offset = offset; - - GST_BUFFER_SIZE (*outbuf) = buffer_size; - GST_BUFFER_MALLOCDATA( *outbuf ) = g_malloc0( GST_BUFFER_SIZE (*outbuf) ); - GST_BUFFER_DATA( *outbuf ) = GST_BUFFER_MALLOCDATA( *outbuf ); - g_memmove( GST_BUFFER_DATA( (*outbuf) ), buf, GST_BUFFER_SIZE(*outbuf) ); - GST_BUFFER_OFFSET (*outbuf) = offset; - GST_BUFFER_OFFSET_END (*outbuf) = offset + GST_BUFFER_SIZE (*outbuf); - - src->buffer_remain -= GST_BUFFER_SIZE (*outbuf); - - src->read_offset += GST_BUFFER_SIZE (*outbuf); - src->bytes_read += GST_BUFFER_SIZE (*outbuf); - g_print ( "[%s]\t\tBuffer output with size: %d\n", __FUNCTION__, GST_BUFFER_SIZE (*outbuf) ); - - /* flushs the newly buffer got from byte array */ - src->bytes_queue = g_byte_array_remove_range( src->bytes_queue, 0, buffer_size ); - - g_print( "Got buffer: [%s]\t\tBUFFER --->SIZE = %d, OFFSET = %llu, "\ - "OFFSET_END = %llu.\n\n", __FUNCTION__, GST_BUFFER_SIZE (*outbuf), - GST_BUFFER_OFFSET (*outbuf), GST_BUFFER_OFFSET_END (*outbuf) ); - - return ret; - -done: - { - const gchar *reason = gst_flow_get_name (ret); - - GST_DEBUG_OBJECT (src, "DONE task, reason %s", reason); - return ret; - } -eos: - { - const gchar *reason = gst_flow_get_name (ret); - - GST_DEBUG_OBJECT (src, "pausing task, reason %s", reason); - return GST_FLOW_UNEXPECTED; - } - /* ERRORS */ -read_error: - { - GST_ELEMENT_ERROR (src, RESOURCE, READ, - (NULL), ("Could not read any bytes (%i, %s)", read, - src->uri_name)); - return GST_FLOW_ERROR; - } -change_progchain: - { - GST_ELEMENT_ERROR (src, RESOURCE, READ, - (NULL), ("Seek failed, go to the next program info... (%i, %s)", read, - src->uri_name)); - - gst_pad_push_event ( GST_BASE_SRC_PAD (GST_BASE_SRC (psrc)), - gst_event_new_new_segment (TRUE, 1.0, GST_FORMAT_TIME, 0, -1, 0 ) ); - // go to the next program chain - src->unique_setup = FALSE; - src->update_prog_chain = TRUE; - - gst_mythtv_src_next_program_chain( src ); - - return GST_FLOW_ERROR_NO_DATA; - } - -} -#endif - gint64 gst_mythtv_src_get_position ( GstMythtvSrc* src ) { @@ -679,7 +541,7 @@ src->content_size = size_tmp; else if ( size_tmp > 0 && --max_tries > 0 ) goto get_file_pos; - g_print( "\t[%s]\tGET_POSITION: file_position = %lld\n", + GST_LOG_OBJECT( src, "\t[%s]\tGET_POSITION: file_position = %lld\n", __FUNCTION__, size_tmp ); /* sets the last content size amount before it can be updated */ src->prev_content_size = src->content_size; @@ -697,22 +559,23 @@ gint64 actual_seek = segment->start; gboolean ret = TRUE; - g_print( "[%s]DO Seek called! (start = %lld, stop = %lld)\n", __FUNCTION__, segment->start, segment->stop ); + GST_LOG_OBJECT( src, "[%s]DO Seek called! (start = %lld, stop = %lld)\n", __FUNCTION__, + segment->start, segment->stop ); if ( segment->format == GST_FORMAT_TIME ) { goto done; //actual_seek = ( ( segment->start / 1000 ) * 28 ) * 4000; } - g_print( "[%s]Trying to seek at the value (actual_seek = %lld, read_offset = %lld)\n", __FUNCTION__, actual_seek, src->read_offset ); + GST_LOG_OBJECT( src, "[%s]Trying to seek at the value (actual_seek = %lld, read_offset = %lld)\n", __FUNCTION__, actual_seek, src->read_offset ); /* verify if it needs to seek */ if ( src->read_offset != actual_seek ) { new_offset = gmyth_file_transfer_seek( src->file_transfer, segment->start, SEEK_SET ); - g_print( "[%s] Segment offset start = %lld, SRC Offset = %lld, NEW actual backend SEEK Offset = %lld.\n", - __FUNCTION__, segment->start, src->read_offset, new_offset ); + GST_LOG_OBJECT( src, "[%s] Segment offset start = %lld, SRC Offset = %lld, NEW actual backend SEEK Offset = %lld.\n", + __FUNCTION__, segment->start, src->read_offset, new_offset ); if ( G_UNLIKELY (new_offset < 0 ) ) { ret = FALSE; @@ -725,7 +588,7 @@ src->read_offset = new_offset; if ( ret == FALSE ) { - g_print( "[%s] Failed to set the SEEK on segment!\n", __FUNCTION__ ); + GST_INFO_OBJECT( src, "[%s] Failed to set the SEEK on segment!\n", __FUNCTION__ ); } } @@ -737,7 +600,6 @@ { GST_DEBUG_OBJECT (src, "EOS found on seeking!!!"); - //gst_object_unref( src ); return FALSE; } change_progchain: @@ -759,64 +621,6 @@ } -#if 0 -static void -gst_mythtv_src_read_ahead ( void *data ) { - - GstMythtvSrc *src = NULL; - - GstBuffer *outbuf = NULL; - - guint size = 5*2048; - gint total = 0; - gint read = -1; - - src = GST_MYTHTV_SRC( data ); - - //GST_PAD_STREAM_TRYLOCK( GST_BASE_SRC_PAD (GST_BASE_SRC (src)) ); - - do { - GST_TASK_WAIT( src->th_read_ahead ); - - gint8 *data = NULL; - - outbuf = gst_buffer_new_and_alloc( size ); - - read = do_read_request_response ( src, src->adapter_offset, size, &data ); - - if ( read > 0 ) { - src->read_offset += read; - src->bytes_read += read; - total += read; - - g_print( "[%s]\tBYTES READ (actual) = %d, BYTES READ (cumulative) = %llu, "\ - "OFFSET = %llu, CONTENT SIZE = %llu.\n", __FUNCTION__, read, src->bytes_read, - src->read_offset, src->content_size ); - - GST_BUFFER_SIZE (outbuf) = read; - GST_BUFFER_MALLOCDATA( outbuf ) = g_malloc0( GST_BUFFER_SIZE (outbuf) ); - GST_BUFFER_DATA( outbuf ) = GST_BUFFER_MALLOCDATA( outbuf ); - g_memmove( GST_BUFFER_DATA( outbuf ), data, read ); - GST_BUFFER_OFFSET (outbuf) = src->adapter_offset; - GST_BUFFER_OFFSET_END (outbuf) = src->adapter_offset + read; - g_print( "Got buffer: [%s]\t\tBUFFER --->SIZE = %d, OFFSET = %llu, "\ - "OFFSET_END = %llu.\n\n", __FUNCTION__, GST_BUFFER_SIZE (outbuf), - GST_BUFFER_OFFSET (outbuf), GST_BUFFER_OFFSET_END (outbuf) ); - - } - - gst_adapter_push( src->adapter, outbuf ); - - GST_TASK_SIGNAL( src->th_read_ahead ); - - } while ( read < size ); - - //GST_PAD_STREAM_UNLOCK( GST_BASE_SRC_PAD (GST_BASE_SRC (src)) ); - - return; -} -#endif - /* create a socket for connecting to remote server */ static gboolean gst_mythtv_src_start ( GstBaseSrc * bsrc ) @@ -849,10 +653,10 @@ chain_id_local = gmyth_tvchain_get_id( src->spawn_livetv->tvchain ); if ( chain_id_local != NULL ) { src->live_chain_id = g_strdup( chain_id_local->str ); - g_print( "\t[%s]\tLocal chain ID = %s.\n", __FUNCTION__, src->live_chain_id ); + GST_INFO_OBJECT( src, "\t[%s]\tLocal chain ID = %s.\n", __FUNCTION__, src->live_chain_id ); } src->live_tv_id = src->spawn_livetv->recorder->recorder_num; - g_print ( "[%s] LiveTV id = %d, URI path = %s.\n", __FUNCTION__, src->live_tv_id, src->uri_name ); + GST_LOG_OBJECT( src, "[%s] LiveTV id = %d, URI path = %s.\n", __FUNCTION__, src->live_tv_id, src->uri_name ); } src->file_transfer = gmyth_file_transfer_new( src->live_tv_id, @@ -883,7 +687,7 @@ if ( ret == FALSE ) { #ifndef GST_DISABLE_GST_DEBUG if ( src->mythtv_msgs_dbg ) - g_printerr( "MythTV FileTransfer request failed when setting up socket connection!\n" ); + GST_INFO_OBJECT( src, "MythTV FileTransfer request failed when setting up socket connection!\n" ); #endif goto begin_req_failed; } @@ -936,16 +740,6 @@ } } -#if 0 -static void -gst_mythtv_src_get_times (GstBaseSrc * src, GstBuffer * buffer, - GstClockTime * start, GstClockTime * end) -{ - *start = -1; - *end = -1; -} -#endif - /* create a new socket for connecting to the next program chain */ static gboolean gst_mythtv_src_next_program_chain ( GstMythtvSrc *src ) @@ -976,7 +770,7 @@ if ( src->live_tv ) { if ( gmyth_livetv_next_program_chain( src->spawn_livetv ) == FALSE ) { - g_print( "\n\n[%s]\t\tFailed to go to the next program chain!!!\n\n", __FUNCTION__ ); + GST_INFO_OBJECT( src, "\n\n[%s]\t\tFailed to go to the next program chain!!!\n\n", __FUNCTION__ ); ret = FALSE; goto init_failed; } @@ -985,10 +779,10 @@ chain_id_local = gmyth_tvchain_get_id( src->spawn_livetv->tvchain ); if ( chain_id_local != NULL ) { src->live_chain_id = g_strdup( chain_id_local->str ); - g_print( "\t[%s]\tLocal chain ID = %s.\n", __FUNCTION__, src->live_chain_id ); + GST_DEBUG_OBJECT( src, "\t[%s]\tLocal chain ID = %s.\n", __FUNCTION__, src->live_chain_id ); } src->live_tv_id = src->spawn_livetv->recorder->recorder_num; - g_print ( "[%s] LiveTV id = %d, URI path = %s.\n", __FUNCTION__, src->live_tv_id, src->uri_name ); + GST_LOG_OBJECT( src, "[%s] LiveTV id = %d, URI path = %s.\n", __FUNCTION__, src->live_tv_id, src->uri_name ); } src->file_transfer = gmyth_file_transfer_new( src->live_tv_id, @@ -1018,23 +812,12 @@ if ( ret == FALSE ) { #ifndef GST_DISABLE_GST_DEBUG if ( src->mythtv_msgs_dbg ) - g_printerr( "MythTV FileTransfer request failed when setting up socket connection!\n" ); + GST_ERROR_OBJECT( src, "MythTV FileTransfer request failed when setting up socket connection!\n" ); #endif goto begin_req_failed; } src->content_size_last = src->content_size; -#if 0 - if ( src->content_size < src->file_transfer->filesize ) { - src->content_size = src->file_transfer->filesize; - } else { - //gint64 pos = gst_mythtv_src_get_position(src); - //if ( pos > src->file_transfer->filesize ) - // src->content_size = pos; - - } -#endif - src->content_size = src->file_transfer->filesize; if ( src->live_tv ) { wait_to_transfer = 0; @@ -1081,14 +864,13 @@ { GstMythtvSrc *src = GST_MYTHTV_SRC (bsrc); gboolean ret = TRUE; - g_print( "[%s] Differs from previous content size: %d (max.: %d)\n", __FUNCTION__, + GST_LOG_OBJECT( src, "[%s] Differs from previous content size: %d (max.: %d)\n", __FUNCTION__, abs( src->content_size - src->prev_content_size ), GMYTHTV_TRANSFER_MAX_BUFFER ); if ( src->live_tv ) { ret = FALSE; } else if ( src->live_tv && src->enable_timing_position && ( abs( src->content_size - src->bytes_read ) < GMYTHTV_TRANSFER_MAX_BUFFER ) ) { - //g_static_mutex_lock( &update_size_mutex ); gint64 new_offset = gmyth_file_transfer_get_file_position( src->file_transfer ); if ( new_offset > 0 && new_offset > src->content_size ) { @@ -1097,11 +879,10 @@ src->update_prog_chain = TRUE; } - //g_static_mutex_unlock( &update_size_mutex ); } *size = src->content_size; - g_print( "[%s] Content size = %lld\n", __FUNCTION__, src->content_size ); + GST_LOG_OBJECT( src, "[%s] Content size = %lld\n", __FUNCTION__, src->content_size ); return ret; @@ -1139,38 +920,8 @@ gboolean ret = FALSE; switch (GST_EVENT_TYPE (event)) { -#if 0 - case GST_EVENT_FLUSH_START: - //src->eos = FALSE; - g_print( "\n\n\n[%s]\t\tGot FLUSH_START event!!!\n\n\n", __FUNCTION__ ); - cont_size = gst_mythtv_src_get_position (src); - if ( !src->live_tv ) { - if ( cont_size > src->content_size ) { - src->content_size = cont_size; - src->eos = FALSE; - } else { - src->eos = TRUE; - gst_element_set_state ( GST_ELEMENT (src), GST_STATE_NULL ); - gst_element_set_locked_state ( GST_ELEMENT (src), FALSE ); - } - } else { - if ( cont_size <= 0 ) { - src->update_prog_chain = TRUE; - src->eos = TRUE; - src->unique_setup = FALSE; - src->do_start = TRUE; - } - } - break; - case GST_EVENT_FLUSH_STOP: - src->do_start = TRUE; - src->eos = FALSE; - gst_element_set_state (GST_ELEMENT(src), GST_STATE_NULL); - //gst_element_set_locked_state (GST_ELEMENT(src), TRUE); - break; -#endif case GST_EVENT_EOS: - g_print( "[%s] Got EOS event!!!\n", __FUNCTION__ ); + GST_WARNING_OBJECT( src, "[%s] Got EOS event!!!\n", __FUNCTION__ ); if ( src->live_tv ) { cont_size = gst_mythtv_src_get_position (src); @@ -1187,7 +938,7 @@ ret = TRUE; break; case GST_EVENT_NEWSEGMENT: - g_print( "[%s] Got NEWSEGMENT!!!\n", __FUNCTION__ ); + GST_INFO_OBJECT( src, "[%s] Got NEWSEGMENT!!!\n", __FUNCTION__ ); ret = gst_pad_event_default (pad, event); break; case GST_EVENT_SEEK: @@ -1195,7 +946,6 @@ gst_event_ref( event ); gdouble rate; - //gboolean update = TRUE; GstFormat format; GstSeekType cur_type, stop_type; GstSeekFlags flags; @@ -1204,9 +954,9 @@ &flags, &cur_type, &cur, &stop_type, &stop ); - g_print( "[%s] Got EVENT_SEEK (pos = %lld)!!!\n", __FUNCTION__, cur ); + GST_INFO_OBJECT( src, "[%s] Got EVENT_SEEK (pos = %lld)!!!\n", __FUNCTION__, cur ); if ( !( flags & GST_SEEK_FLAG_FLUSH ) ) { - g_print( "[%s] Could get the FLAG_FLUSH message.\n", __FUNCTION__ ); + GST_WARNING_OBJECT( src, "[%s] Could get the FLAG_FLUSH message.\n", __FUNCTION__ ); } if ( format == GST_FORMAT_TIME && ( ret = gst_pad_event_default (pad, event) ) == FALSE ) { gst_event_unref( event ); @@ -1289,13 +1039,16 @@ switch (transition) { case GST_STATE_CHANGE_READY_TO_NULL: - g_print( "[%s] READY to NULL called!\n", __FUNCTION__ ); + GST_INFO_OBJECT( src, "[%s] READY to NULL called!\n", __FUNCTION__ ); break; case GST_STATE_CHANGE_PLAYING_TO_PAUSED: - g_print( "[%s] PLAYING to PAUSED called!\n", __FUNCTION__ ); + GST_INFO_OBJECT( src, "[%s] PLAYING to PAUSED called!\n", __FUNCTION__ ); case GST_STATE_CHANGE_PAUSED_TO_READY: - g_print( "[%s] PAUSED to READY called!\n", __FUNCTION__ ); - + GST_INFO_OBJECT( src, "[%s] PAUSED to READY called!\n", __FUNCTION__ ); + if ( !gmyth_recorder_send_frontend_ready_command( src->spawn_livetv->recorder ) ) + GST_WARNING_OBJECT( src, "[%s] Couldn't send the FRONTEND_READY message to the backend!", __FUNCTION__ ); + else + GST_DEBUG_OBJECT( src, "[%s] Message FRONTEND_READY was sent to the backend!", __FUNCTION__ ); if ( src->live_tv && src->update_prog_chain ) { /*