#define THEME_PATH "/usr/share/livewp/theme"
#define SHORT_TIMER 75 /* 100 milisecond */
//#define LONG_TIMER 5*60*1000 /* 10 minutes */
-#define LONG_TIMER 20*1000 /* 10 minutes */
+#define LONG_TIMER 20*1000 /* 20 seconds */
enum { SHORT_TIMER_TYPE, LONG_TIMER_TYPE };
#define SKY_LEVEL 0
#define SUN_LEVEL 0
guint alive_timer;
time_t last_alive_event;
gchar *theme_string_parametr1;
+ gint theme_int_parametr1;
GstElement *pipeline;
gboolean running;
};
(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);
if (priv->visible != TRUE){
priv->visible = TRUE;
view_state_changed(priv);
(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);
if (priv->visible != FALSE){
priv->visible = FALSE;
view_state_changed(priv);
Actor *actor;
gboolean stop_flag = TRUE;
-if (!desktop_plugin->priv->visible || !desktop_plugin->priv->rich_animation){
+ if (!desktop_plugin->priv->visible || !desktop_plugin->priv->rich_animation){
desktop_plugin->priv->short_timer = 0;
return FALSE;
}
gboolean
long_timeout (AWallpaperPlugin *desktop_plugin)
{
- /* fprintf(stderr, "long_timeout %i\n", desktop_plugin->priv->long_timer); */
+ GstFormat fmt = GST_FORMAT_TIME;
+ gint64 p;
+ 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;
+ 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;
+ }
+ return TRUE;
+ }
+
if (desktop_plugin->priv->long_timer == 0 )
return FALSE;
if (!desktop_plugin->priv->visible){
#include "livewp-home-widget.h"
/*******************************************************************************/
-void
-btn_setting_clicked(HildonButton *btn, gpointer data)
-{
- Animation_WallpaperPrivate *priv = data;
- // open settings dialog
- fprintf(stderr, "btn setting clicked, %s\n", priv->theme);
- lw_main_settings(priv, NULL);
- fprintf(stderr, "btn setting clicked, %s\n", priv->theme);
-}
-/*******************************************************************************/
-void
-btn_power_clicked(HildonButton *btn, gpointer data)
-{
- const gchar *value;
- value = hildon_button_get_value(btn);
- fprintf(stderr, "applet must be %s\n", value);
- if (!strcmp(value, "stop"))
- hildon_button_set_text(HILDON_BUTTON(btn), _("Start"), "start");
- else
- hildon_button_set_text(HILDON_BUTTON(btn), _("Stop"), "stop");
-}
-/*******************************************************************************/
static void set_live_bg (Display *display, Window xwindow, int mode);
static
void set_live_bg (Display *display, Window xwindow, int mode)
(unsigned char *) &mode, 1);
}
/*******************************************************************************/
+
void
view_state_changed (Animation_WallpaperPrivate *priv)
{
init_scene_Xsnow(priv->desktop_plugin);
}
}
- if (priv->pipeline)
- gst_element_set_state (priv->pipeline, GST_STATE_PLAYING);
+ 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);
+ }
+ }
if (priv->long_timer == 0 ){
priv->long_timer = g_timeout_add(LONG_TIMER, (GtkFunction)long_timeout, priv->desktop_plugin);
run_long_timeout(priv->desktop_plugin);
}
}else{
if (priv->pipeline){
- gst_element_set_state (priv->pipeline, GST_STATE_PAUSED);
+ fprintf(stderr, " gst stop %i\n", priv->long_timer);
+ gst_element_set_state (priv->pipeline, GST_STATE_PAUSED);
+ return;
}
if (priv->long_timer != 0 ){
g_source_remove(priv->long_timer);
priv->view_notify = gconf_client_notify_add(gconf_client_get_default (),"/apps/osso/hildon-desktop/views/current",
(GConfClientNotifyFunc)view_changed, priv, NULL, NULL);
+ /* Set start position of Video to zero */
+ if (!strcmp(priv->theme,"Video"))
+ priv->theme_int_parametr1 = 0;
+
init_scene_theme(desktop_plugin);
priv->long_timer = g_timeout_add(LONG_TIMER, (GtkFunction)long_timeout, desktop_plugin);
if (desktop_plugin->priv->pipeline){
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;
}
if (desktop_plugin->priv->podpid > 1){
kill (desktop_plugin->priv->podpid, SIGTERM);
gchar *file_plus_uri;
+ 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");
file_plus_uri = g_strdup_printf("file://%s",desktop_plugin->priv->theme_string_parametr1);
g_object_set (G_OBJECT (bin), "uri", file_plus_uri, NULL );
g_object_set (G_OBJECT (videosink), "force-aspect-ratio", TRUE, NULL );
+
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");
+
+
}
/*******************************************************************************/
void