+2005-05-11 mallum,,, <mallum@openedhand.com>
+
+ * clutter/cltr-video.c: (got_buffering), (cltr_video_new),
+ (cltr_video_play), (cltr_video_idler):
+ * examples/photos.c: (main):
+ * examples/player.c: (handle_xevent), (main):
+ * gst/cltrimagesink.c: (gst_cltrimagesink_chain):
+ Fix Gl thread related crash on video playback
+ Make examples less bound to my laptop ;)
+
2005-05-06 mallum,,, <mallum@openedhand.com>
* clutter/cltr-button.c: (cltr_button_new_with_label):
float current_position;
guint update_id;
- char *last_error_message;
+ gchar *last_error_message;
+ gchar *mrl;
};
static gboolean
cb_iterate (CltrVideo *video);
+static void
+reset_error_msg (CltrVideo *video);
+
static gboolean
cltr_video_idler (CltrVideo *video);
#endif
}
+static void
+reset_error_msg (CltrVideo *video)
+{
+ if (video->last_error_message)
+ {
+ g_free (video->last_error_message);
+ video->last_error_message = NULL;
+ }
+}
+
static void
got_error (GstElement *play,
{
gboolean ret;
- if (video->last_error_message)
- {
- g_free (video->last_error_message);
- video->last_error_message = NULL;
- }
+ reset_error_msg (video);
ret = (gst_element_set_state (GST_ELEMENT (video->play),
GST_STATE_PLAYING) == GST_STATE_SUCCESS);
switch (signal->signal_id)
{
case CLTR_VIDEO_ASYNC_TEXTURE:
- video->frame_texture = signal->signal_data.texture.ref;
+ {
+ Pixbuf *pixb = NULL;
- /*
- * we can actually grab the width and height from
- * the textures pixbuf.
- */
+ video->frame_texture = signal->signal_data.texture.ref;
+
+ cltr_texture_lock(video->frame_texture);
+
+ pixb = cltr_texture_get_pixbuf(video->frame_texture);
+
+ if (pixb)
+ cltr_texture_force_rgb_data(video->frame_texture,
+ pixb->width,
+ pixb->height,
+ pixb->data);
- cltr_widget_queue_paint(CLTR_WIDGET(video));
+ cltr_texture_unlock(video->frame_texture);
+
+ cltr_widget_queue_paint(CLTR_WIDGET(video));
+ }
break;
case CLTR_VIDEO_ASYNC_VIDEO_SIZE:
video->video_width = signal->signal_data.video_size.width;
}
gboolean
-cltr_video_set_source(CltrVideo *video, char *location)
+cltr_video_set_source(CltrVideo *video, char *mrl)
{
- /* if (!gst_play_set_location (video->play, location)) */
+ gboolean ret;
- g_object_set (G_OBJECT (video->play), "uri", location, NULL);
+ if (video->mrl && !strcmp (video->mrl, mrl))
+ return TRUE;
+
+ if (video->mrl)
+ g_free (video->mrl);
+
+ video->mrl = g_strdup (mrl);
+
+ gst_element_set_state (GST_ELEMENT (video->play), GST_STATE_READY);
+
+ reset_error_msg (video);
+
+ /* video->got_redirect = FALSE; */
+ video->has_video = FALSE;
+ video->stream_length = 0;
+
+ /* Dont handle subtitles as yet
+ if (g_strrstr (video->mrl, "#subtitle:"))
+ {
+ gchar **uris;
+
+ uris = g_strsplit (video->mrl, "#subtitle:", 2);
+ g_object_set (G_OBJECT (video->play), "uri",
+ uris[0], "suburi", uris[1], NULL);
+ g_strfreev (uris);
+ }
+ else
+ {
+ g_object_set (G_OBJECT (video->play), "uri",
+ video->mrl, "suburi", subtitle_uri, NULL);
+ }
+ */
+
+ g_object_set (G_OBJECT (video->play), "uri",
+ video->mrl, "suburi", NULL, NULL);
+
+
+ ret = (gst_element_set_state (video->play,
+ GST_STATE_PAUSED) == GST_STATE_SUCCESS);
+
+
+ if (!ret /* && !video->got_redirect */)
+ {
+
+ /*
+ g_set_error (error, 0, 0, "%s", video->last_error_message ?
+ video->last_error_message : "Failed to open; reason unknown");
+ */
+
+ g_free (video->mrl);
+ video->mrl = NULL;
+
+ return FALSE;
+ }
+
+ /*
+ if (ret)
+ g_signal_emit (bvw, bvw_table_signals[SIGNAL_CHANNELS_CHANGE], 0);
+ */
+
+ return ret;
- return TRUE;
}
else
cltr_video_pause (video);
Paused ^= 1;
+
break;
}
}
font = font_new("Sans bold 96");
- win = cltr_window_new(1400, 1050);
+ win = cltr_window_new(800, 600);
- video = cltr_video_new(1400, 1050);
+ video = cltr_video_new(800, 600);
cltr_video_set_source(CLTR_VIDEO(video), argv[1]);
cltr_widget_add_child(win, video, 0, 0);
- // label = cltr_label_new("hello world", font, &col);
+ label = cltr_label_new("hello world", font, &col);
- // cltr_widget_add_child(win, label, 100, 300);
+ cltr_widget_add_child(win, label, 100, 300);
cltr_window_on_xevent(CLTR_WINDOW(win), handle_xevent, video);