# HG changeset patch # User melunko # Date 1164378549 0 # Node ID 899326948b257cde76361bacc9f1e2c4b27d8d3d # Parent a4a151d4735d4001c5ec57cf87b248252448ad24 [svn r108] Added is_recording to gmyth_livetv diff -r a4a151d4735d -r 899326948b25 gmyth/src/gmyth_livetv.c --- a/gmyth/src/gmyth_livetv.c Fri Nov 24 01:53:43 2006 +0000 +++ b/gmyth/src/gmyth_livetv.c Fri Nov 24 14:29:09 2006 +0000 @@ -40,6 +40,9 @@ static gint tvchain_curr_index = -1; +#define GMYTHTV_RECORDER_HEADER "QUERY_RECORDER" + + G_DEFINE_TYPE(GMythLiveTV, gmyth_livetv, G_TYPE_OBJECT) static void @@ -303,6 +306,47 @@ } gboolean +gmyth_livetv_is_recording ( GMythLiveTV *livetv ) +{ + gboolean ret = TRUE; + + GMythStringList *str_list = gmyth_string_list_new (); + GString *message = g_string_new (""); + + g_debug ( "[%s]\n", __FUNCTION__ ); + //g_static_mutex_lock (&mutex); + // + g_string_printf( message, "%s %d", GMYTHTV_RECORDER_HEADER, + /* FIXME file_transfer->rec_id >= 0 ? file_transfer->rec_id : file_transfer->card_id );*/ + livetv->recorder->recorder_num); + gmyth_string_list_append_string (str_list, message); + gmyth_string_list_append_string (str_list, g_string_new ("IS_RECORDING")); + + gmyth_socket_sendreceive_stringlist ( livetv->recorder->myth_socket, str_list ); + + if ( str_list != NULL && gmyth_string_list_length(str_list) > 0 ) + { + GString *str = NULL; + if ( ( str = gmyth_string_list_get_string( str_list, 0 ) ) != NULL && strcmp( str->str, "bad" )!= 0 ) { + gint is_rec = gmyth_string_list_get_int( str_list, 0 ); + if ( is_rec != 0 ) + ret = TRUE; + else + ret = FALSE; + } + } + g_print( "[%s] %s, stream is %s being recorded!\n", __FUNCTION__, ret ? "YES" : "NO", ret ? "" : "NOT" ); + //g_static_mutex_unlock (&mutex); + + if ( str_list != NULL ) + g_object_unref (str_list); + + return ret; + +} + + +gboolean gmyth_livetv_is_playing (GMythLiveTV *livetv) { return TRUE; diff -r a4a151d4735d -r 899326948b25 gmyth/src/gmyth_livetv.h --- a/gmyth/src/gmyth_livetv.h Fri Nov 24 01:53:43 2006 +0000 +++ b/gmyth/src/gmyth_livetv.h Fri Nov 24 14:29:09 2006 +0000 @@ -79,6 +79,9 @@ void gmyth_livetv_start_playing (GMythLiveTV *livetv); void gmyth_livetv_stop_playing (GMythLiveTV *livetv); +gboolean gmyth_livetv_is_recording ( GMythLiveTV *livetv ); + + gboolean gmyth_livetv_setup (GMythLiveTV *livetv); gboolean gmyth_livetv_next_program_chain ( GMythLiveTV *livetv );