video almost done
authorVlad <vlad@gas.by>
Tue, 3 Aug 2010 12:49:01 +0000 (15:49 +0300)
committerVlad <vlad@gas.by>
Tue, 3 Aug 2010 12:49:01 +0000 (15:49 +0300)
applet/src/livewp-common.h
applet/src/livewp-dbus.c
applet/src/livewp-home-widget.c
applet/src/livewp-main.c
applet/src/livewp-scene.c

index 0675404..5693d3c 100644 (file)
@@ -104,7 +104,7 @@ struct _Animation_WallpaperPrivate
     guint alive_timer;
     time_t last_alive_event;
     gchar *theme_string_parametr1;
-    gint theme_int_parametr1;
+    guint theme_int_parametr1;
     GstElement *pipeline;
     gboolean running;
 };
index a1d0a14..8521cc4 100644 (file)
@@ -158,7 +158,6 @@ get_livewp_signal_cb(DBusConnection *conn, DBusMessage *msg, Animation_Wallpaper
     fprintf (stderr, "APPLET PATH11111111111111111111 %s %s %s\n",   dbus_message_get_path(msg),   dbus_message_get_interface (msg), dbus_message_get_member (msg)); 
 #endif
 #endif
-fprintf(stderr, "ddddasddddddddddddddddddddddda!!!!!!!!!!!!!!!\n");
     if (!priv)
         return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
 
@@ -186,7 +185,7 @@ fprintf(stderr, "ddddasddddddddddddddddddddddda!!!!!!!!!!!!!!!\n");
         (priv->view == 2 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_PLAY_LIVEBG_ON_VIEW2))||   
         (priv->view == 3 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_PLAY_LIVEBG_ON_VIEW3))||   
         (priv->view == 4 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_PLAY_LIVEBG_ON_VIEW4))){
-        fprintf(stderr, "Play scene visible %i\n", priv->visible);
+        /* fprintf(stderr, "Play scene visible %i\n", priv->visible); */
         if (priv->visible != TRUE){
             priv->visible = TRUE;
             view_state_changed(priv);
@@ -197,7 +196,7 @@ fprintf(stderr, "ddddasddddddddddddddddddddddda!!!!!!!!!!!!!!!\n");
         (priv->view == 2 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_PAUSE_LIVEBG_ON_VIEW2))||   
         (priv->view == 3 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_PAUSE_LIVEBG_ON_VIEW3))||   
         (priv->view == 4 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_PAUSE_LIVEBG_ON_VIEW4))){
-        fprintf(stderr, "Pause scene visible %i\n", priv->visible);
+         /* fprintf(stderr, "Pause scene visible %i\n", priv->visible); */
          if (priv->visible != FALSE){
             priv->visible = FALSE;
             view_state_changed(priv);
index 809d8c5..f4395b5 100644 (file)
@@ -419,12 +419,12 @@ long_timeout (AWallpaperPlugin *desktop_plugin)
 {
     GstFormat fmt = GST_FORMAT_TIME;
     gint64 p;
-    fprintf(stderr, "long_timeout %i\n", desktop_plugin->priv->long_timer); 
+
+    /* fprintf(stderr, "long_timeout %i\n", desktop_plugin->priv->long_timer); */
     if (desktop_plugin->priv->pipeline){
-        fprintf(stderr, " gst play in run long timeout \n");
        if (!desktop_plugin->priv->visible){
                gst_element_query_position(desktop_plugin->priv->pipeline, &fmt, &p);
-               desktop_plugin->priv->theme_int_parametr1 = p / 1000000;
+               desktop_plugin->priv->theme_int_parametr1 = p / GST_SECOND;
                gst_element_set_state (desktop_plugin->priv->pipeline, GST_STATE_NULL);
                gst_object_unref (GST_OBJECT (desktop_plugin->priv->pipeline));
                desktop_plugin->priv->pipeline = NULL;
@@ -442,7 +442,6 @@ long_timeout (AWallpaperPlugin *desktop_plugin)
         desktop_plugin->priv->long_timer = 0;
         return FALSE;
     }
-  
 
     run_long_timeout(desktop_plugin);
     return TRUE; /* keep running this event */
index 23b9271..f9399c3 100644 (file)
@@ -57,7 +57,6 @@ view_state_changed (Animation_WallpaperPrivate *priv)
        }
        if (!strcmp(priv->theme,"Video")){
            if (priv->pipeline){
-               fprintf(stderr, " gst play \n");
                gst_element_set_state (priv->pipeline, GST_STATE_PLAYING);
            }else{
                init_scene_Video(priv->desktop_plugin);
@@ -69,7 +68,6 @@ view_state_changed (Animation_WallpaperPrivate *priv)
        }
    }else{
         if (priv->pipeline){
-           fprintf(stderr, " gst stop %i\n", priv->long_timer);
            gst_element_set_state (priv->pipeline, GST_STATE_PAUSED);
            return;
         }
@@ -194,7 +192,7 @@ main(int argc, char *argv[])
     priv->podpid = -1;
     priv->running = FALSE;
     priv->window = main_widget;
-    fprintf(stderr,"XWINDOW %i\n",GDK_WINDOW_XID (main_widget->window));
+    /* fprintf(stderr,"XWINDOW %i\n",GDK_WINDOW_XID (main_widget->window)); */
     priv->desktop_plugin = desktop_plugin;
     priv->view = view;
 
@@ -211,7 +209,7 @@ main(int argc, char *argv[])
     set_live_bg(GDK_WINDOW_XDISPLAY (main_widget->window), GDK_WINDOW_XID (main_widget->window), view);
     
     priv->view_notify = 0; 
-    fprintf(stderr,"VISIBLE %i %i\n",priv->visible, current_active_view());
+    /* fprintf(stderr,"VISIBLE %i %i\n",priv->visible, current_active_view()); */
     gconf_client_add_dir(gconf_client_get_default (), "/apps/osso/hildon-desktop/views", GCONF_CLIENT_PRELOAD_NONE, NULL);
     priv->view_notify = gconf_client_notify_add(gconf_client_get_default (),"/apps/osso/hildon-desktop/views/current",
                                                 (GConfClientNotifyFunc)view_changed, priv, NULL, NULL);
index bf48535..8c55810 100644 (file)
@@ -170,6 +170,7 @@ bus_call (GstBus *bus, GstMessage *msg, AWallpaperPlugin *desktop_plugin)
      }
        return TRUE;
 }
+
 /*******************************************************************************/
 void
 init_scene_Xsnow(AWallpaperPlugin *desktop_plugin){
@@ -193,6 +194,39 @@ init_scene_Xsnow(AWallpaperPlugin *desktop_plugin){
     }
     g_free(run_string);
 }
+/*******************************************************************************/
+gboolean cb_timeout0(AWallpaperPlugin *desktop_plugin) {
+    GstFormat fmt = GST_FORMAT_TIME;
+    gboolean test;
+    gint64 len;
+    gint len_seconds = 0;
+
+    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, 
+                                          desktop_plugin->priv->theme_int_parametr1 * GST_SECOND,
+                                          GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE))
+            fprintf(stderr,"Error in seek:\n");
+        return FALSE;
+    }
+       
+    gst_element_query_position(desktop_plugin->priv->pipeline, &fmt, &len);
+    len_seconds = len / GST_SECOND;
+    if (len <0)
+        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,
+                                          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;
+} 
+/*******************************************************************************/
 void
 init_scene_Video(AWallpaperPlugin *desktop_plugin)
 {
@@ -202,7 +236,7 @@ init_scene_Video(AWallpaperPlugin *desktop_plugin)
     gchar *file_plus_uri;
 
 
-    fprintf(stderr, "init scene Video \n");
+    /* fprintf(stderr, "init scene Video \n"); */
     desktop_plugin->priv->pipeline = gst_pipeline_new("gst-player");
     bin = gst_element_factory_make ("playbin2", "bin");
     videosink = gst_element_factory_make ("ximagesink", "videosink");
@@ -221,16 +255,13 @@ init_scene_Video(AWallpaperPlugin *desktop_plugin)
 
     if (GST_IS_X_OVERLAY (videosink))
            gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (videosink), GDK_DRAWABLE_XID(desktop_plugin->priv->window->window));
-    if (desktop_plugin->priv->visible)
-        gst_element_set_state (desktop_plugin->priv->pipeline, GST_STATE_PLAYING);
-    
-    fprintf(stderr,"     desktop_plugin->priv->theme_int_parametr1 %i\n",    desktop_plugin->priv->theme_int_parametr1);
-    GstClockTime nach   = (GstClockTime)(desktop_plugin->priv->theme_int_parametr1 * GST_MSECOND);
-    if (!gst_element_seek(desktop_plugin->priv->pipeline, 1.0, GST_FORMAT_TIME,
-                   (GstSeekFlags) (GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT), GST_SEEK_TYPE_SET, 
-                   nach, GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE))
-        fprintf(stderr,"Error in seek\n");
 
+    if (desktop_plugin->priv->visible){
+        gst_element_set_state (desktop_plugin->priv->pipeline, GST_STATE_PLAYING);
+        g_timeout_add(100, cb_timeout0, desktop_plugin); 
+    }
+   
+    //gst_element_get_state(deskddtop_plugin->priv->pipeline, NULL, NULL, 100 * GST_MSECOND);
 
 }
 /*******************************************************************************/