# HG changeset patch # User rosfran # Date 1169491062 0 # Node ID 44a72b1226eb8858a97b0c4cd314605f79692b95 # Parent 42ce5f7bfa6ecb6bd4de3c3aca8638d907311f7c [svn r289] Added pause recording calls to gmyth_livetv; removed sleep calls from the MythTV plug-in, put it back to livetv_setup function call. diff -r 42ce5f7bfa6e -r 44a72b1226eb gmyth/src/gmyth_livetv.c --- a/gmyth/src/gmyth_livetv.c Sat Jan 20 00:20:20 2007 +0000 +++ b/gmyth/src/gmyth_livetv.c Mon Jan 22 18:37:42 2007 +0000 @@ -48,6 +48,7 @@ #define GMYTHTV_RECORDER_HEADER "QUERY_RECORDER" +#define GMYTHTV_TRANSFER_MAX_WAITS 100 G_DEFINE_TYPE(GMythLiveTV, gmyth_livetv, G_TYPE_OBJECT) @@ -248,8 +249,6 @@ goto error; } - //livetv->recorder = GMYTH_RECORDER ( g_object_new(GMYTH_RECORDER_TYPE, NULL) ); - livetv->is_livetv = TRUE; livetv->local_hostname = gmyth_socket_get_local_hostname (); @@ -294,6 +293,41 @@ res = FALSE; goto error; } + + if ( res == TRUE ) { + /* loop finished, set the max tries variable to zero again... */ + gint wait_to_transfer = 0; + + while (wait_to_transfer++ < GMYTHTV_TRANSFER_MAX_WAITS && + (gmyth_livetv_is_recording (livetv) == FALSE)) + g_usleep (500); + + /* IS_RECORDING again, just like the MythTV backend does... */ + gmyth_livetv_is_recording (livetv); + + if ( channel != -1 ) + { + /* Pauses remote encoder. */ + res = gmyth_recorder_pause_recording(livetv->recorder); + if ( !res ) { + g_warning ("[%s] Fail while pausing remote encoder\n", __FUNCTION__); + res = FALSE; + goto error; + } + + if ( gmyth_recorder_check_channel( livetv->recorder, channel ) ) + { + if ( gmyth_recorder_set_channel( livetv->recorder, channel ) ) + { + g_print( "[%s] Channel changed!!! abc1 [%d].\n", __FUNCTION__, channel ); + } + } + + } + + sleep (6); /* FIXME: this is evil (tpm) */ + } + // Reload all TV chain from Mysql database. gmyth_tvchain_reload_all (livetv->tvchain); @@ -302,21 +336,7 @@ res = FALSE; goto error; } - -/* - if ( channel != -1 ) - { - gint ch = channel; - //if ( gmyth_recorder_check_channel( livetv->recorder, ch ) ) - //{ - if ( gmyth_recorder_set_channel_name( livetv->recorder, "abc1" ) ) - { - g_print( "[%s] Channel changed!!! abc1 [%d].\n", __FUNCTION__, ch ); - } - //} - - } -*/ + // Get program info from database using chanid and starttime livetv->proginfo = gmyth_tvchain_get_program_at (livetv->tvchain, tvchain_curr_index++ ); if ( livetv->proginfo == NULL ) {