#ifdef HAVE_X
#include <gdk/gdkx.h>
#endif
-#include <gst/interfaces/xoverlay.h>
+#include <gst/video/videooverlay.h>
GST_DEBUG_CATEGORY_STATIC (seek_debug);
#define GST_CAT_DEFAULT (seek_debug)
-#if (!GTK_CHECK_VERSION(2, 23, 0) || GTK_CHECK_VERSION(2, 90, 0)) && !GTK_CHECK_VERSION(2, 91, 1)
-#define gtk_combo_box_text_new gtk_combo_box_new_text
-#define gtk_combo_box_text_append_text gtk_combo_box_append_text
-#define gtk_combo_box_text_remove gtk_combo_box_remove_text
-#define GTK_COMBO_BOX_TEXT GTK_COMBO_BOX
-#endif
-
-#if !GTK_CHECK_VERSION (2, 17, 7)
-static void
-gtk_widget_get_allocation (GtkWidget * w, GtkAllocation * a)
-{
- *a = w->allocation;
-}
-#endif
-
/* configuration */
-
-//#define SOURCE "filesrc"
-#define SOURCE "gnomevfssrc"
+#define SOURCE "filesrc"
#define ASINK "alsasink"
//#define ASINK "osssink"
src = gst_element_factory_make_or_warn (SOURCE, "src");
demux = gst_element_factory_make_or_warn ("oggdemux", "demux");
decoder = gst_element_factory_make_or_warn ("theoradec", "decoder");
- convert = gst_element_factory_make_or_warn ("ffmpegcolorspace", "convert");
+ convert = gst_element_factory_make_or_warn ("videoconvert", "convert");
videosink = gst_element_factory_make_or_warn (VSINK, "sink");
g_object_set (G_OBJECT (src), "location", location, NULL);
video_bin = gst_bin_new ("v_decoder_bin");
v_queue = gst_element_factory_make_or_warn ("queue", "v_queue");
v_decoder = gst_element_factory_make_or_warn ("theoradec", "v_dec");
- v_convert =
- gst_element_factory_make_or_warn ("ffmpegcolorspace", "v_convert");
+ v_convert = gst_element_factory_make_or_warn ("videoconvert", "v_convert");
v_scale = gst_element_factory_make_or_warn ("videoscale", "v_scale");
videosink = gst_element_factory_make_or_warn (VSINK, "v_sink");
video_bin = gst_bin_new ("v_decoder_bin");
v_queue = gst_element_factory_make_or_warn ("queue", "v_queue");
v_decoder = gst_element_factory_make_or_warn ("ffdec_msmpeg4", "v_dec");
- v_convert =
- gst_element_factory_make_or_warn ("ffmpegcolorspace", "v_convert");
+ v_convert = gst_element_factory_make_or_warn ("videoconvert", "v_convert");
videosink = gst_element_factory_make_or_warn (VSINK, "v_sink");
gst_bin_add (GST_BIN (video_bin), v_queue);
video_bin = gst_bin_new ("v_decoder_bin");
v_decoder = gst_element_factory_make_or_warn ("mpeg2dec", "v_dec");
v_queue = gst_element_factory_make_or_warn ("queue", "v_queue");
- v_filter = gst_element_factory_make_or_warn ("ffmpegcolorspace", "v_filter");
+ v_filter = gst_element_factory_make_or_warn ("videoconvert", "v_filter");
videosink = gst_element_factory_make_or_warn (VSINK, "v_sink");
gst_bin_add (GST_BIN (video_bin), v_decoder);
video_bin = gst_bin_new ("v_decoder_bin");
v_decoder = gst_element_factory_make_or_warn ("mpeg2dec", "v_dec");
- v_filter = gst_element_factory_make_or_warn ("ffmpegcolorspace", "v_filter");
+ v_filter = gst_element_factory_make_or_warn ("videoconvert", "v_filter");
videosink = gst_element_factory_make_or_warn (VSINK, "v_sink");
gst_element_link_many (v_decoder, v_filter, videosink, NULL);
static GstElement *
make_playerbin2_pipeline (const gchar * location)
{
- GstElement *pipeline = construct_playerbin ("playbin2", location);
+ GstElement *pipeline = construct_playerbin ("playbin", location);
- /* FIXME: this is not triggered, playbin2 is not forwarding it from the sink */
+ /* FIXME: this is not triggered, playbin is not forwarding it from the sink */
g_signal_connect (pipeline, "notify::volume", G_CALLBACK (volume_notify_cb),
NULL);
return pipeline;
format = seek_formats[i].format;
- if (gst_pad_query_convert (pad, GST_FORMAT_TIME, GST_SECOND, &format,
+ if (gst_pad_query_convert (pad, GST_FORMAT_TIME, GST_SECOND, format,
&value)) {
g_print ("%s %13" G_GINT64_FORMAT " | ", seek_formats[i].name, value);
} else {
format = seek_formats[i].format;
- if (gst_element_query_position (element, &format, &position) &&
- gst_element_query_duration (element, &format, &total)) {
+ if (gst_element_query_position (element, format, &position) &&
+ gst_element_query_duration (element, format, &total)) {
g_print ("%s %13" G_GINT64_FORMAT " / %13" G_GINT64_FORMAT " | ",
seek_formats[i].name, position, total);
} else {
format = seek_formats[i].format;
- if (gst_pad_query_position (pad, &format, &position) &&
- gst_pad_query_duration (pad, &format, &total)) {
+ if (gst_pad_query_position (pad, format, &position) &&
+ gst_pad_query_duration (pad, format, &total)) {
g_print ("%s %13" G_GINT64_FORMAT " / %13" G_GINT64_FORMAT " | ",
seek_formats[i].name, position, total);
} else {
static gboolean
update_scale (gpointer data)
{
- GstFormat format = GST_FORMAT_TIME;
-
- //position = 0;
- //duration = 0;
-
if (elem_seek) {
if (seekable_elements) {
GstElement *element = GST_ELEMENT (seekable_elements->data);
- gst_element_query_position (element, &format, &position);
- gst_element_query_duration (element, &format, &duration);
+ gst_element_query_position (element, GST_FORMAT_TIME, &position);
+ gst_element_query_duration (element, GST_FORMAT_TIME, &duration);
}
} else {
if (seekable_pads) {
GstPad *pad = GST_PAD (seekable_pads->data);
- gst_pad_query_position (pad, &format, &position);
- gst_pad_query_duration (pad, &format, &duration);
+ gst_pad_query_position (pad, GST_FORMAT_TIME, &position);
+ gst_pad_query_duration (pad, GST_FORMAT_TIME, &duration);
}
}
state = STOP_STATE;
gtk_statusbar_push (GTK_STATUSBAR (statusbar), status_id, "Stopped");
+ gtk_widget_queue_draw (video_window);
is_live = FALSE;
buffering = FALSE;
/* remove previous info */
clear_streams (GST_ELEMENT_CAST (pipeline));
- /* here we get and update the different streams detected by playbin2 */
+ /* here we get and update the different streams detected by playbin */
g_object_get (pipeline, "n-video", &n_video, NULL);
g_object_get (pipeline, "n-audio", &n_audio, NULL);
g_object_get (pipeline, "n-text", &n_text, NULL);
vis_entries = g_array_new (FALSE, FALSE, sizeof (VisEntry));
- list = gst_registry_feature_filter (gst_registry_get_default (),
+ list = gst_registry_feature_filter (gst_registry_get (),
filter_features, FALSE, NULL);
for (walk = list; walk; walk = g_list_next (walk)) {
if (!element)
return;
- /* set vis plugin for playbin2 */
+ /* set vis plugin for playbin */
g_object_set (pipeline, "vis-plugin", element, NULL);
}
}
static gulong embed_xid = 0;
-/* We set the xid here in response to the prepare-xwindow-id message via a
+/* We set the xid here in response to the prepare-window-handle message via a
* bus sync handler because we don't know the actual videosink used from the
* start (as we don't know the pipeline, or bin elements such as autovideosink
* or gconfvideosink may be used which create the actual videosink only once
static GstBusSyncReply
bus_sync_handler (GstBus * bus, GstMessage * message, GstPipeline * data)
{
- if ((GST_MESSAGE_TYPE (message) == GST_MESSAGE_ELEMENT) &&
- gst_message_has_name (message, "prepare-xwindow-id")) {
- GstElement *element = GST_ELEMENT (GST_MESSAGE_SRC (message));
+ GstElement *element;
- g_print ("got prepare-xwindow-id, setting XID %lu\n", embed_xid);
+ if (!gst_is_video_overlay_prepare_window_handle_message (message))
+ return GST_BUS_PASS;
- if (g_object_class_find_property (G_OBJECT_GET_CLASS (element),
- "force-aspect-ratio")) {
- g_object_set (element, "force-aspect-ratio", TRUE, NULL);
- }
+ element = GST_ELEMENT (GST_MESSAGE_SRC (message));
- /* Should have been initialised from main thread before (can't use
- * GDK_WINDOW_XID here with Gtk+ >= 2.18, because the sync handler will
- * be called from a streaming thread and GDK_WINDOW_XID maps to more than
- * a simple structure lookup with Gtk+ >= 2.18, where 'more' is stuff that
- * shouldn't be done from a non-GUI thread without explicit locking). */
- g_assert (embed_xid != 0);
+ g_print ("got prepare-window-handle, setting XID %lu\n", embed_xid);
- gst_x_overlay_set_window_handle (GST_X_OVERLAY (element), embed_xid);
+ if (g_object_class_find_property (G_OBJECT_GET_CLASS (element),
+ "force-aspect-ratio")) {
+ g_object_set (element, "force-aspect-ratio", TRUE, NULL);
}
+
+ /* Should have been initialised from main thread before (can't use
+ * GDK_WINDOW_XID here with Gtk+ >= 2.18, because the sync handler will
+ * be called from a streaming thread and GDK_WINDOW_XID maps to more than
+ * a simple structure lookup with Gtk+ >= 2.18, where 'more' is stuff that
+ * shouldn't be done from a non-GUI thread without explicit locking). */
+ g_assert (embed_xid != 0);
+
+ gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (element), embed_xid);
return GST_BUS_PASS;
}
#endif
static gboolean
-handle_expose_cb (GtkWidget * widget, GdkEventExpose * event, gpointer data)
+draw_cb (GtkWidget * widget, cairo_t * cr, gpointer data)
{
if (state < GST_STATE_PAUSED) {
- GtkAllocation allocation;
- GdkWindow *window = gtk_widget_get_window (widget);
- cairo_t *cr;
+ int width, height;
- gtk_widget_get_allocation (widget, &allocation);
- cr = gdk_cairo_create (window);
+ width = gtk_widget_get_allocated_width (widget);
+ height = gtk_widget_get_allocated_height (widget);
cairo_set_source_rgb (cr, 0, 0, 0);
- cairo_rectangle (cr, 0, 0, allocation.width, allocation.height);
+ cairo_rectangle (cr, 0, 0, width, height);
cairo_fill (cr);
- cairo_destroy (cr);
+ return TRUE;
}
return FALSE;
}
static void
realize_cb (GtkWidget * widget, gpointer data)
{
-#if GTK_CHECK_VERSION(2,18,0)
- {
- GdkWindow *window = gtk_widget_get_window (widget);
+ GdkWindow *window = gtk_widget_get_window (widget);
- /* This is here just for pedagogical purposes, GDK_WINDOW_XID will call it
- * as well */
- if (!gdk_window_ensure_native (window))
- g_error ("Couldn't create native window needed for GstXOverlay!");
- }
-#endif
+ /* This is here just for pedagogical purposes, GDK_WINDOW_XID will call it
+ * as well */
+ if (!gdk_window_ensure_native (window))
+ g_error ("Couldn't create native window needed for GstXOverlay!");
#ifdef HAVE_X
- {
- GdkWindow *window = gtk_widget_get_window (video_window);
-
- embed_xid = GDK_WINDOW_XID (window);
- g_print ("Window realize: video window XID = %lu\n", embed_xid);
- }
+ embed_xid = GDK_WINDOW_XID (window);
+ g_print ("Window realize: video window XID = %lu\n", embed_xid);
#endif
}
GstBus *bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
#ifdef HAVE_X
- /* handle prepare-xwindow-id element message synchronously */
+ /* handle prepare-window-handle element message synchronously */
gst_bus_set_sync_handler (bus, (GstBusSyncHandler) bus_sync_handler,
pipeline);
#endif
GOptionContext *ctx;
GError *err = NULL;
+#if !GLIB_CHECK_VERSION (2, 31, 0)
if (!g_thread_supported ())
g_thread_init (NULL);
+#endif
ctx = g_option_context_new ("- test seeking in gsteamer");
g_option_context_add_main_entries (ctx, options, NULL);
/* initialize gui elements ... */
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
video_window = gtk_drawing_area_new ();
- g_signal_connect (video_window, "expose-event",
- G_CALLBACK (handle_expose_cb), NULL);
+ g_signal_connect (video_window, "draw", G_CALLBACK (draw_cb), NULL);
g_signal_connect (video_window, "realize", G_CALLBACK (realize_cb), NULL);
gtk_widget_set_double_buffered (video_window, FALSE);
pipeline);
if (pipeline_type == 16) {
- /* the playbin2 panel controls for the video/audio/subtitle tracks */
+ /* the playbin panel controls for the video/audio/subtitle tracks */
panel = gtk_hbox_new (FALSE, 0);
video_combo = gtk_combo_box_text_new ();
audio_combo = gtk_combo_box_text_new ();
G_CALLBACK (audio_combo_cb), pipeline);
g_signal_connect (G_OBJECT (text_combo), "changed",
G_CALLBACK (text_combo_cb), pipeline);
- /* playbin2 panel for flag checkboxes and volume/mute */
+ /* playbin panel for flag checkboxes and volume/mute */
boxes = gtk_hbox_new (FALSE, 0);
vis_checkbox = gtk_check_button_new_with_label ("Vis");
video_checkbox = gtk_check_button_new_with_label ("Video");
G_CALLBACK (buffer_toggle_cb), pipeline);
g_signal_connect (G_OBJECT (volume_spinbutton), "value_changed",
G_CALLBACK (volume_spinbutton_changed_cb), pipeline);
- /* playbin2 panel for snapshot */
+ /* playbin panel for snapshot */
boxes2 = gtk_hbox_new (FALSE, 0);
shot_button = gtk_button_new_from_stock (GTK_STOCK_SAVE);
gtk_widget_set_tooltip_text (shot_button,
gtk_table_attach_defaults (GTK_TABLE (flagtable), rate_spinbutton, 4, 5, 1,
2);
if (panel && boxes && boxes2) {
- expander = gtk_expander_new ("playbin2 options");
+ expander = gtk_expander_new ("playbin options");
pb2vbox = gtk_vbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (pb2vbox), panel, FALSE, FALSE, 2);
gtk_box_pack_start (GTK_BOX (pb2vbox), boxes, FALSE, FALSE, 2);