[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. trunk
authorrosfran
Mon Jan 22 18:37:42 2007 +0000 (2007-01-22)
branchtrunk
changeset 28844a72b1226eb
parent 287 42ce5f7bfa6e
child 289 fdac5773d2a6
[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.
gmyth/src/gmyth_livetv.c
     1.1 --- a/gmyth/src/gmyth_livetv.c	Sat Jan 20 00:20:20 2007 +0000
     1.2 +++ b/gmyth/src/gmyth_livetv.c	Mon Jan 22 18:37:42 2007 +0000
     1.3 @@ -48,6 +48,7 @@
     1.4  
     1.5  #define GMYTHTV_RECORDER_HEADER         "QUERY_RECORDER"
     1.6  
     1.7 +#define GMYTHTV_TRANSFER_MAX_WAITS	    100
     1.8  
     1.9  G_DEFINE_TYPE(GMythLiveTV, gmyth_livetv, G_TYPE_OBJECT)
    1.10  
    1.11 @@ -248,8 +249,6 @@
    1.12  		goto error;
    1.13  	}
    1.14  	
    1.15 -	//livetv->recorder = GMYTH_RECORDER ( g_object_new(GMYTH_RECORDER_TYPE, NULL) );
    1.16 -	
    1.17  	livetv->is_livetv = TRUE;
    1.18  	
    1.19  	livetv->local_hostname  = gmyth_socket_get_local_hostname ();
    1.20 @@ -294,6 +293,41 @@
    1.21  		res = FALSE;
    1.22  		goto error;
    1.23  	}
    1.24 +	
    1.25 +  if ( res == TRUE ) {
    1.26 +    /* loop finished, set the max tries variable to zero again... */
    1.27 +    gint wait_to_transfer = 0;
    1.28 +
    1.29 +    while (wait_to_transfer++ < GMYTHTV_TRANSFER_MAX_WAITS &&
    1.30 +        (gmyth_livetv_is_recording (livetv) == FALSE))
    1.31 +      g_usleep (500);
    1.32 +
    1.33 +    /* IS_RECORDING again, just like the MythTV backend does... */
    1.34 +    gmyth_livetv_is_recording (livetv);
    1.35 +    
    1.36 +		if ( channel != -1 ) 
    1.37 +		{
    1.38 +			/* Pauses remote encoder. */
    1.39 +			res = gmyth_recorder_pause_recording(livetv->recorder);
    1.40 +			if ( !res ) {
    1.41 +				g_warning ("[%s] Fail while pausing remote encoder\n", __FUNCTION__);
    1.42 +				res = FALSE;
    1.43 +				goto error;
    1.44 +			}
    1.45 +	
    1.46 +	  	if ( gmyth_recorder_check_channel( livetv->recorder, channel ) )
    1.47 +	  	{
    1.48 +		  	if ( gmyth_recorder_set_channel( livetv->recorder, channel ) )
    1.49 +		  	{
    1.50 +		  		g_print( "[%s] Channel changed!!! abc1 [%d].\n", __FUNCTION__, channel );
    1.51 +		  	}
    1.52 +	  	}
    1.53 +	
    1.54 +		}
    1.55 +		
    1.56 +    sleep (6);                  /* FIXME: this is evil (tpm) */
    1.57 +  }
    1.58 +
    1.59  
    1.60  	// Reload all TV chain from Mysql database.
    1.61  	gmyth_tvchain_reload_all (livetv->tvchain);
    1.62 @@ -302,21 +336,7 @@
    1.63  		res = FALSE;
    1.64  		goto error;
    1.65  	}
    1.66 -
    1.67 -/*
    1.68 -	if ( channel != -1 ) 
    1.69 -	{
    1.70 -	  gint ch = channel;
    1.71 -  	//if ( gmyth_recorder_check_channel( livetv->recorder, ch ) ) 
    1.72 -  	//{
    1.73 -	  	if ( gmyth_recorder_set_channel_name( livetv->recorder, "abc1" ) )
    1.74 -	  	{
    1.75 -	  		g_print( "[%s] Channel changed!!! abc1 [%d].\n", __FUNCTION__, ch );
    1.76 -	  	}
    1.77 -  	//}
    1.78 -
    1.79 -	}
    1.80 -*/
    1.81 +	
    1.82  	// Get program info from database using chanid and starttime
    1.83  	livetv->proginfo = gmyth_tvchain_get_program_at (livetv->tvchain, tvchain_curr_index++ );
    1.84  	if ( livetv->proginfo == NULL ) {