diff -r 2af89a257a86 -r e863d5b45e52 gst-gmyth/mythsrc/gstmythtvsrc.c --- a/gst-gmyth/mythsrc/gstmythtvsrc.c Wed May 16 18:48:13 2007 +0100 +++ b/gst-gmyth/mythsrc/gstmythtvsrc.c Thu May 17 20:06:15 2007 +0100 @@ -332,6 +332,8 @@ { mythtv_src->unique_setup = FALSE; + g_debug ("CLEAR"); + if (mythtv_src->spawn_livetv) { g_object_unref (mythtv_src->spawn_livetv); mythtv_src->spawn_livetv = NULL; @@ -351,6 +353,9 @@ g_byte_array_free (mythtv_src->bytes_queue, TRUE); mythtv_src->bytes_queue = NULL; } + + + g_debug ("CLEAR END"); } @@ -717,11 +722,27 @@ src->channel_name = ch; if (src->channel_name != NULL) { - if (gmyth_livetv_channel_name_setup (src->spawn_livetv, src->channel_name) == FALSE) { - GST_INFO_OBJECT (src, "LiveTV setup felt down on error"); - ret = FALSE; - goto init_failed; + gint try = 0; + gboolean result; + + while (try < 100) { + result = gmyth_livetv_channel_name_setup (src->spawn_livetv, src->channel_name); + if (result == TRUE) { + g_debug ("LIVE STARTED"); + break; + } + + g_debug ("FAIL TO START LIVE"); + g_usleep (0.5 * G_USEC_PER_SEC); + try++; } + + if (result == FALSE) { + GST_INFO_OBJECT (src, "LiveTV setup felt down on error"); + ret = FALSE; + goto init_failed; + } + } else { if (gmyth_livetv_setup (src->spawn_livetv) == FALSE) { GST_INFO_OBJECT (src, "LiveTV setup felt down on error"); @@ -837,11 +858,10 @@ src->spawn_livetv = NULL; } - /* GST_ELEMENT_ERROR (src, LIBRARY, INIT, (NULL), ("Could not initialize MythTV library (%i, %s)", ret, src->uri_name)); - */ + gst_mythtv_src_clear (src); @@ -1019,6 +1039,7 @@ switch (transition) { case GST_STATE_CHANGE_READY_TO_NULL: + g_debug ("STAAAAAAAAAAAATTTTTTTTTEEEEEEEEE NULLLLLLLLLLLLLLLL"); gst_mythtv_src_clear (src); break; case GST_STATE_CHANGE_PLAYING_TO_PAUSED: