[svn r685] fixed destructor trunk
authorrenatofilho
Wed May 16 23:53:02 2007 +0100 (2007-05-16)
branchtrunk
changeset 679c9757033ccc6
parent 678 89bdaa9e72bf
child 680 6c0f6e4bd591
[svn r685] fixed destructor
gst-gmyth/mythsrc/gstmythtvsrc.c
     1.1 --- a/gst-gmyth/mythsrc/gstmythtvsrc.c	Wed May 16 23:52:37 2007 +0100
     1.2 +++ b/gst-gmyth/mythsrc/gstmythtvsrc.c	Wed May 16 23:53:02 2007 +0100
     1.3 @@ -332,6 +332,8 @@
     1.4  {
     1.5    mythtv_src->unique_setup = FALSE;
     1.6  
     1.7 +  g_debug ("CLEAR");
     1.8 +
     1.9    if (mythtv_src->spawn_livetv) {
    1.10      g_object_unref (mythtv_src->spawn_livetv);
    1.11      mythtv_src->spawn_livetv = NULL;
    1.12 @@ -351,6 +353,9 @@
    1.13      g_byte_array_free (mythtv_src->bytes_queue, TRUE);
    1.14      mythtv_src->bytes_queue = NULL;
    1.15    }
    1.16 +
    1.17 +
    1.18 +  g_debug ("CLEAR END");
    1.19    
    1.20  }
    1.21  
    1.22 @@ -717,11 +722,27 @@
    1.23      	src->channel_name = ch;
    1.24      	
    1.25      if (src->channel_name != NULL) {
    1.26 -      if (gmyth_livetv_channel_name_setup (src->spawn_livetv, src->channel_name) == FALSE) {
    1.27 -        GST_INFO_OBJECT (src, "LiveTV setup felt down on error");
    1.28 -        ret = FALSE;
    1.29 -        goto init_failed;
    1.30 +      gint try = 0;
    1.31 +	  gboolean result;
    1.32 +
    1.33 +      while (try < 100) {	  
    1.34 +		result = gmyth_livetv_channel_name_setup (src->spawn_livetv, src->channel_name);
    1.35 +		if (result == TRUE) {
    1.36 +		  g_debug ("LIVE STARTED");				
    1.37 +		  break;
    1.38 +		}
    1.39 +
    1.40 +		g_debug ("FAIL TO START LIVE");
    1.41 +		g_usleep (0.5 * G_USEC_PER_SEC);
    1.42 +		try++;		
    1.43        }
    1.44 +
    1.45 +	  if (result == FALSE) {
    1.46 +	     GST_INFO_OBJECT (src, "LiveTV setup felt down on error");
    1.47 +	   	 ret = FALSE;
    1.48 +	  	 goto init_failed;
    1.49 +	  }
    1.50 +
    1.51      } else {
    1.52        if (gmyth_livetv_setup (src->spawn_livetv) == FALSE) {
    1.53          GST_INFO_OBJECT (src, "LiveTV setup felt down on error");
    1.54 @@ -837,11 +858,10 @@
    1.55          src->spawn_livetv = NULL;
    1.56      }
    1.57      
    1.58 -    /*
    1.59      GST_ELEMENT_ERROR (src, LIBRARY, INIT,
    1.60              (NULL), ("Could not initialize MythTV library (%i, %s)", ret,
    1.61              src->uri_name));
    1.62 -    */            
    1.63 +
    1.64  
    1.65      gst_mythtv_src_clear (src);
    1.66  
    1.67 @@ -1019,6 +1039,7 @@
    1.68  
    1.69    switch (transition) {
    1.70      case GST_STATE_CHANGE_READY_TO_NULL:
    1.71 +	  g_debug ("STAAAAAAAAAAAATTTTTTTTTEEEEEEEEE NULLLLLLLLLLLLLLLL");			
    1.72  	  gst_mythtv_src_clear (src);			
    1.73        break;
    1.74      case GST_STATE_CHANGE_PLAYING_TO_PAUSED: