# HG changeset patch # User rosfran # Date 1166640948 0 # Node ID 678cf278c11a6e1b1cab230936e5d62bb69f7c04 # Parent d7fb0e36deff92166ade28c161dfd74e5bde2ef8 [svn r238] Added set channel usability. diff -r d7fb0e36deff -r 678cf278c11a gmyth/src/gmyth_file_transfer.c --- a/gmyth/src/gmyth_file_transfer.c Wed Dec 20 18:54:31 2006 +0000 +++ b/gmyth/src/gmyth_file_transfer.c Wed Dec 20 18:55:48 2006 +0000 @@ -580,7 +580,7 @@ bytes_sent = gmyth_string_list_get_int( strlist, 0 ); // -1 on backend error gmyth_debug ( "[%s] got SENT buffer message = %d\n", __FUNCTION__, bytes_sent ); - if ( bytes_sent != 0 ) + if ( bytes_sent >= 0 ) { gchar *data_buffer = g_new0 ( gchar, bytes_sent ); while ( 0 != bytes_sent ) diff -r d7fb0e36deff -r 678cf278c11a gmyth/src/gmyth_livetv.c --- a/gmyth/src/gmyth_livetv.c Wed Dec 20 18:54:31 2006 +0000 +++ b/gmyth/src/gmyth_livetv.c Wed Dec 20 18:55:48 2006 +0000 @@ -235,8 +235,8 @@ } -gboolean -gmyth_livetv_setup ( GMythLiveTV *livetv, GMythBackendInfo *backend_info ) +static gboolean +gmyth_livetv_setup_recorder ( GMythLiveTV *livetv, gint channel, GMythBackendInfo *backend_info ) { gboolean res = TRUE; @@ -288,20 +288,20 @@ res = FALSE; goto error; } - -#if 0 - gint ch = 1011; - gint idx = 0; - for ( ; idx < 5; idx++ ) { - if ( gmyth_recorder_check_channel( livetv->recorder, ch ) ) { - if ( gmyth_recorder_set_channel( livetv->recorder, ch ) ) { - g_print( "[%s] Channel changed!!! [%d].\n", __FUNCTION__, ch ); - break; + + if ( channel != -1 ) { + gint ch = channel; + gint ch_idx = 0; + for ( ; ch_idx < 5; ch_idx++ ) { + if ( gmyth_recorder_check_channel( livetv->recorder, ch ) ) { + if ( gmyth_recorder_set_channel( livetv->recorder, ch ) ) { + g_print( "[%s] Channel changed!!! [%d].\n", __FUNCTION__, ch ); + break; + } } - } - ++ch; - } -#endif + ++ch; + } + } // Spawn live tv. Uses the socket to send mythprotocol data to start livetv in the backend (remotelly) res = gmyth_recorder_spawntv ( livetv->recorder, @@ -334,7 +334,7 @@ if ( !gmyth_livetv_monitor_handler_start( livetv ) ) { res = FALSE; - gmyth_debug("LiveTV MONITOR handler error on setup!"); + gmyth_debug( "LiveTV MONITOR handler error on setup!" ); goto error; } @@ -375,6 +375,18 @@ } gboolean +gmyth_livetv_channel_setup ( GMythLiveTV *livetv, gint channel, GMythBackendInfo *backend_info ) +{ + return gmyth_livetv_setup_recorder ( livetv, channel, backend_info ); +} + +gboolean +gmyth_livetv_setup ( GMythLiveTV *livetv, GMythBackendInfo *backend_info ) +{ + return gmyth_livetv_setup_recorder ( livetv, -1, backend_info ); +} + +gboolean gmyth_livetv_next_program_chain ( GMythLiveTV *livetv ) { gboolean res = TRUE; diff -r d7fb0e36deff -r 678cf278c11a gmyth/src/gmyth_livetv.h --- a/gmyth/src/gmyth_livetv.h Wed Dec 20 18:54:31 2006 +0000 +++ b/gmyth/src/gmyth_livetv.h Wed Dec 20 18:55:48 2006 +0000 @@ -88,6 +88,7 @@ gboolean gmyth_livetv_is_recording ( GMythLiveTV *livetv ); gboolean gmyth_livetv_setup (GMythLiveTV *livetv, GMythBackendInfo *backend_info); +gboolean gmyth_livetv_channel_setup ( GMythLiveTV *livetv, gint channel, GMythBackendInfo *backend_info ); gboolean gmyth_livetv_next_program_chain ( GMythLiveTV *livetv ); GMythFileTransfer *gmyth_livetv_create_file_transfer( GMythLiveTV *livetv );