change backend to gstream
[livewp] / applet / src / livewp-scene.c
index b913aae..35bf499 100644 (file)
@@ -65,25 +65,38 @@ parsestring(char *line, char **argv)
                  *argv = '\0';                 /* mark the end of argument list  */
 }
 
+
 void
 init_scene_Mplayer(AWallpaperPlugin *desktop_plugin)
 {
-    fprintf(stderr,"init_scene_Mplayer\n");
-    char* child_argv[128];
-    char *run_string = NULL;
-
-    fprintf(stderr, "PARAMETR %s\n",  desktop_plugin->priv->theme_string_parametr1);
-    run_string = g_strdup_printf("/usr/bin/mplayer -vo x11 -wid %d %s\n", \
-                                GDK_WINDOW_XID(desktop_plugin->priv->window->window), desktop_plugin->priv->theme_string_parametr1);
-    parsestring(run_string, child_argv);
-
-    desktop_plugin->priv->podpid = fork();
-    if (desktop_plugin->priv->podpid == 0){
-       execvp("/usr/bin/mplayer", child_argv);
-       fprintf(stderr,"Problem with new podprocess");
+    GstElement *pipeline;                                                                                                                    
+    GstElement *bin;                                                                                                                                                           
+    GstElement *videosink;                                                                                                
+    GstFormat format; 
+
+
+
+    fprintf(stderr,"dddddddddddddddddddd\n");
+    pipeline= gst_pipeline_new("gst-player");
+    bin = gst_element_factory_make ("playbin2", "bin");
+    videosink = gst_element_factory_make ("ximagesink", "videosink");
+    g_object_set (G_OBJECT (bin), "video-sink", videosink, NULL);
+    gst_bin_add (GST_BIN (pipeline), bin);
+
+    {
+       GstBus *bus;
+       bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
+//     gst_bus_add_watch(bus, bus_call, NULL);
+//     gst_bus_set_sync_handler(bus, (GstBusSyncHandler)SetVideoAreaXID, desktop_plugin);
+       gst_object_unref (bus);
     }
-    g_free(run_string);
-
+    g_object_set (G_OBJECT (bin), "uri", "file:///home/user/MyDocs/.videos/9.mp4", NULL );
+    g_object_set (G_OBJECT (videosink), "force-aspect-ratio", TRUE, NULL  );
+    if (GST_IS_X_OVERLAY (videosink)){
+           printf("Is Overlay (Win ID: %i)!!\n",GPOINTER_TO_INT(GDK_WINDOW_XWINDOW(desktop_plugin->priv->window->window)));
+           gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (videosink), GDK_DRAWABLE_XID(desktop_plugin->priv->window->window));
+    }
+    gst_element_set_state (pipeline, GST_STATE_PLAYING);
 }
 
 void