[svn r238] Added set channel usability. trunk
authorrosfran
Wed Dec 20 18:55:48 2006 +0000 (2006-12-20)
branchtrunk
changeset 237678cf278c11a
parent 236 d7fb0e36deff
child 238 cc9e9f03a0a6
[svn r238] Added set channel usability.
gmyth/src/gmyth_file_transfer.c
gmyth/src/gmyth_livetv.c
gmyth/src/gmyth_livetv.h
     1.1 --- a/gmyth/src/gmyth_file_transfer.c	Wed Dec 20 18:54:31 2006 +0000
     1.2 +++ b/gmyth/src/gmyth_file_transfer.c	Wed Dec 20 18:55:48 2006 +0000
     1.3 @@ -580,7 +580,7 @@
     1.4  	    bytes_sent = gmyth_string_list_get_int( strlist,  0 ); // -1 on backend error
     1.5  	    gmyth_debug ( "[%s] got SENT buffer message = %d\n", __FUNCTION__, bytes_sent );
     1.6  
     1.7 -    	if ( bytes_sent != 0 ) 
     1.8 +    	if ( bytes_sent >= 0 ) 
     1.9      	{
    1.10          gchar *data_buffer = g_new0 ( gchar, bytes_sent );    
    1.11     	    while ( 0 != bytes_sent ) 
     2.1 --- a/gmyth/src/gmyth_livetv.c	Wed Dec 20 18:54:31 2006 +0000
     2.2 +++ b/gmyth/src/gmyth_livetv.c	Wed Dec 20 18:55:48 2006 +0000
     2.3 @@ -235,8 +235,8 @@
     2.4    
     2.5  }  
     2.6  
     2.7 -gboolean
     2.8 -gmyth_livetv_setup ( GMythLiveTV *livetv, GMythBackendInfo *backend_info )
     2.9 +static gboolean
    2.10 +gmyth_livetv_setup_recorder ( GMythLiveTV *livetv, gint channel, GMythBackendInfo *backend_info )
    2.11  {
    2.12  	gboolean res = TRUE;
    2.13  
    2.14 @@ -288,20 +288,20 @@
    2.15  		res = FALSE;
    2.16  		goto error;
    2.17  	}
    2.18 -
    2.19 -#if 0
    2.20 -  gint ch = 1011;
    2.21 -  gint idx = 0;  
    2.22 -  for ( ; idx < 5; idx++ ) {
    2.23 -  	if ( gmyth_recorder_check_channel( livetv->recorder, ch ) ) {
    2.24 -	  	if ( gmyth_recorder_set_channel( livetv->recorder, ch ) ) {
    2.25 -	  		g_print( "[%s] Channel changed!!! [%d].\n", __FUNCTION__, ch );
    2.26 -	  		break;
    2.27 +	
    2.28 +	if ( channel != -1 ) {
    2.29 +	  gint ch = channel;
    2.30 +	  gint ch_idx = 0;  
    2.31 +	  for ( ; ch_idx < 5; ch_idx++ ) {
    2.32 +	  	if ( gmyth_recorder_check_channel( livetv->recorder, ch ) ) {
    2.33 +		  	if ( gmyth_recorder_set_channel( livetv->recorder, ch ) ) {
    2.34 +		  		g_print( "[%s] Channel changed!!! [%d].\n", __FUNCTION__, ch );
    2.35 +		  		break;
    2.36 +		  	}
    2.37  	  	}
    2.38 -  	}
    2.39 -  	++ch;
    2.40 -  }
    2.41 -#endif
    2.42 +	  	++ch;
    2.43 +	  }
    2.44 +	}
    2.45  
    2.46  	// Spawn live tv. Uses the socket to send mythprotocol data to start livetv in the backend (remotelly)
    2.47  	res = gmyth_recorder_spawntv ( livetv->recorder,
    2.48 @@ -334,7 +334,7 @@
    2.49  	if ( !gmyth_livetv_monitor_handler_start( livetv ) )
    2.50  	{
    2.51  		res = FALSE;
    2.52 -		gmyth_debug("LiveTV MONITOR handler error on setup!");
    2.53 +		gmyth_debug( "LiveTV MONITOR handler error on setup!" );
    2.54  		goto error;		
    2.55  	}
    2.56  	
    2.57 @@ -375,6 +375,18 @@
    2.58  }
    2.59  
    2.60  gboolean
    2.61 +gmyth_livetv_channel_setup ( GMythLiveTV *livetv, gint channel, GMythBackendInfo *backend_info )
    2.62 +{
    2.63 +	return gmyth_livetv_setup_recorder ( livetv, channel, backend_info );
    2.64 +}
    2.65 +
    2.66 +gboolean
    2.67 +gmyth_livetv_setup ( GMythLiveTV *livetv, GMythBackendInfo *backend_info )
    2.68 +{
    2.69 +	return gmyth_livetv_setup_recorder ( livetv, -1, backend_info );
    2.70 +}
    2.71 +
    2.72 +gboolean
    2.73  gmyth_livetv_next_program_chain ( GMythLiveTV *livetv )
    2.74  {
    2.75  	gboolean res = TRUE;
     3.1 --- a/gmyth/src/gmyth_livetv.h	Wed Dec 20 18:54:31 2006 +0000
     3.2 +++ b/gmyth/src/gmyth_livetv.h	Wed Dec 20 18:55:48 2006 +0000
     3.3 @@ -88,6 +88,7 @@
     3.4  gboolean gmyth_livetv_is_recording ( GMythLiveTV *livetv );	
     3.5  
     3.6  gboolean gmyth_livetv_setup (GMythLiveTV *livetv, GMythBackendInfo *backend_info);
     3.7 +gboolean gmyth_livetv_channel_setup ( GMythLiveTV *livetv, gint channel, GMythBackendInfo *backend_info );
     3.8  gboolean gmyth_livetv_next_program_chain ( GMythLiveTV *livetv );
     3.9  
    3.10  GMythFileTransfer *gmyth_livetv_create_file_transfer( GMythLiveTV *livetv );