fixed problen with gst
authorvlad <vlad@vlanout.(none)>
Tue, 3 Aug 2010 17:11:46 +0000 (20:11 +0300)
committervlad <vlad@vlanout.(none)>
Tue, 3 Aug 2010 17:11:46 +0000 (20:11 +0300)
applet/src/livewp-scene.c

index 3ab90c7..a0f62fc 100644 (file)
@@ -198,8 +198,8 @@ gboolean cb_timeout0(AWallpaperPlugin *desktop_plugin) {
     gint64 len;
     gint len_seconds = 0;
 
-    //if (!desktop_plugin || !desktop_plugin->priv->pipeline)
-    //    return FALSE;
+    if (!desktop_plugin || !desktop_plugin->priv->pipeline)
+        return FALSE;
     if (desktop_plugin->priv->theme_int_parametr1 == 0){
         if (!gst_element_seek(GST_PIPELINE (desktop_plugin->priv->pipeline), 1.0, GST_FORMAT_TIME,
                                           GST_SEEK_FLAG_FLUSH, GST_SEEK_TYPE_SET, 
@@ -209,20 +209,16 @@ gboolean cb_timeout0(AWallpaperPlugin *desktop_plugin) {
         return FALSE;
     }
        
-    gst_element_query_position(desktop_plugin->priv->pipeline, &fmt, &len);
-    len_seconds = len / GST_SECOND;
-    fprintf(stderr, "timeout %i %i\n", len_seconds, desktop_plugin->priv->theme_int_parametr1);
-    if (len <0)
+    if (gst_element_get_state (desktop_plugin->priv->pipeline, NULL, NULL, -1) == GST_STATE_CHANGE_FAILURE) 
         return TRUE;
-    if (len_seconds <  desktop_plugin->priv->theme_int_parametr1){
-        if (!gst_element_seek(GST_PIPELINE (desktop_plugin->priv->pipeline), 1.0, GST_FORMAT_TIME,
+    else{
+         if (!gst_element_seek(GST_PIPELINE (desktop_plugin->priv->pipeline), 1.0, GST_FORMAT_TIME,
                                           GST_SEEK_FLAG_FLUSH, GST_SEEK_TYPE_SET, 
                                           desktop_plugin->priv->theme_int_parametr1 * GST_SECOND,
                                           GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE))
             fprintf(stderr,"Error in seek:\n");
-        return TRUE;
-    }else
-        return FALSE;
+         return FALSE;
+    }
 } 
 /*******************************************************************************/
 void