[svn r108] Added is_recording to gmyth_livetv trunk
authormelunko
Fri Nov 24 14:29:09 2006 +0000 (2006-11-24)
branchtrunk
changeset 107899326948b25
parent 106 a4a151d4735d
child 108 f2b53549deef
[svn r108] Added is_recording to gmyth_livetv
gmyth/src/gmyth_livetv.c
gmyth/src/gmyth_livetv.h
     1.1 --- a/gmyth/src/gmyth_livetv.c	Fri Nov 24 01:53:43 2006 +0000
     1.2 +++ b/gmyth/src/gmyth_livetv.c	Fri Nov 24 14:29:09 2006 +0000
     1.3 @@ -40,6 +40,9 @@
     1.4  
     1.5  static gint tvchain_curr_index = -1; 
     1.6  
     1.7 +#define GMYTHTV_RECORDER_HEADER         "QUERY_RECORDER"
     1.8 +
     1.9 +
    1.10  G_DEFINE_TYPE(GMythLiveTV, gmyth_livetv, G_TYPE_OBJECT)
    1.11  
    1.12  static void
    1.13 @@ -303,6 +306,47 @@
    1.14  }
    1.15  
    1.16  gboolean
    1.17 +gmyth_livetv_is_recording ( GMythLiveTV *livetv )
    1.18 +{
    1.19 +  gboolean ret = TRUE;
    1.20 +
    1.21 +  GMythStringList *str_list = gmyth_string_list_new ();
    1.22 +  GString *message = g_string_new ("");
    1.23 +
    1.24 +  g_debug ( "[%s]\n", __FUNCTION__ );
    1.25 +  //g_static_mutex_lock (&mutex);
    1.26 +  //
    1.27 +  g_string_printf( message, "%s %d", GMYTHTV_RECORDER_HEADER,
    1.28 +      /* FIXME file_transfer->rec_id >= 0 ? file_transfer->rec_id : file_transfer->card_id );*/
    1.29 +        livetv->recorder->recorder_num);
    1.30 +  gmyth_string_list_append_string (str_list, message);
    1.31 +  gmyth_string_list_append_string (str_list, g_string_new ("IS_RECORDING"));
    1.32 +
    1.33 +  gmyth_socket_sendreceive_stringlist ( livetv->recorder->myth_socket, str_list );
    1.34 +
    1.35 +  if ( str_list != NULL && gmyth_string_list_length(str_list) > 0 )
    1.36 +  {
    1.37 +    GString *str = NULL;
    1.38 +    if ( ( str = gmyth_string_list_get_string( str_list, 0 ) ) != NULL && strcmp( str->str, "bad" )!= 0 ) {
    1.39 +      gint is_rec = gmyth_string_list_get_int( str_list, 0 );
    1.40 +      if ( is_rec != 0 )
    1.41 +        ret = TRUE;
    1.42 +      else
    1.43 +        ret = FALSE;
    1.44 +    }
    1.45 +  }
    1.46 +  g_print( "[%s] %s, stream is %s being recorded!\n", __FUNCTION__, ret ? "YES" : "NO", ret ? "" : "NOT" );
    1.47 +  //g_static_mutex_unlock (&mutex);
    1.48 +
    1.49 +  if ( str_list != NULL )
    1.50 +    g_object_unref (str_list);
    1.51 +
    1.52 +  return ret;
    1.53 +
    1.54 +}
    1.55 +
    1.56 +
    1.57 +gboolean
    1.58  gmyth_livetv_is_playing (GMythLiveTV *livetv)
    1.59  {
    1.60  	return TRUE;
     2.1 --- a/gmyth/src/gmyth_livetv.h	Fri Nov 24 01:53:43 2006 +0000
     2.2 +++ b/gmyth/src/gmyth_livetv.h	Fri Nov 24 14:29:09 2006 +0000
     2.3 @@ -79,6 +79,9 @@
     2.4  void gmyth_livetv_start_playing (GMythLiveTV *livetv);
     2.5  void gmyth_livetv_stop_playing (GMythLiveTV *livetv);
     2.6  
     2.7 +gboolean gmyth_livetv_is_recording ( GMythLiveTV *livetv );
     2.8 +	
     2.9 +
    2.10  gboolean gmyth_livetv_setup (GMythLiveTV *livetv);
    2.11  gboolean gmyth_livetv_next_program_chain ( GMythLiveTV *livetv );
    2.12