summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/gstplay/player.c8
-rw-r--r--examples/seeking/seek.c34
2 files changed, 32 insertions, 10 deletions
diff --git a/examples/gstplay/player.c b/examples/gstplay/player.c
index 7a018fe0..e0bdd413 100644
--- a/examples/gstplay/player.c
+++ b/examples/gstplay/player.c
@@ -90,13 +90,6 @@ seek_timer (GstPlay * play)
return FALSE;
}
-static gboolean
-idle_iterate (GstPlay * play)
-{
- gst_bin_iterate (GST_BIN (play));
- return (GST_STATE (GST_ELEMENT (play)) == GST_STATE_PLAYING);
-}
-
int
main (int argc, char *argv[])
{
@@ -168,7 +161,6 @@ main (int argc, char *argv[])
GST_STATE_PLAYING) == GST_STATE_FAILURE)
g_error ("Could not set state to PLAYING");
- g_idle_add ((GSourceFunc) idle_iterate, play);
g_timeout_add (20000, (GSourceFunc) seek_timer, play);
g_main_loop_run (loop);
diff --git a/examples/seeking/seek.c b/examples/seeking/seek.c
index c85ca8b0..4a5d51ab 100644
--- a/examples/seeking/seek.c
+++ b/examples/seeking/seek.c
@@ -551,15 +551,45 @@ make_mpegnt_pipeline (const gchar * location)
return pipeline;
}
+static GstCaps *
+fixate (GstPad * pad, const GstCaps * in_caps, gpointer data)
+{
+ GstCaps *caps;
+ GstStructure *s;
+
+ if (gst_caps_get_size (in_caps) > 1)
+ return NULL;
+
+ /* nothing if fixed already */
+ s = gst_caps_get_structure (in_caps, 0);
+ if (gst_structure_has_field_typed (s, "width", G_TYPE_INT) &&
+ gst_structure_has_field_typed (s, "height", G_TYPE_INT) &&
+ gst_structure_has_field_typed (s, "framerate", G_TYPE_DOUBLE))
+ return NULL;
+
+ /* fixate */
+ caps = gst_caps_copy (in_caps);
+ s = gst_caps_get_structure (caps, 0);
+ gst_caps_structure_fixate_field_nearest_int (s, "width", 200);
+ gst_caps_structure_fixate_field_nearest_int (s, "height", 150);
+ gst_caps_structure_fixate_field_nearest_double (s, "framerate", 10.0);
+
+ return caps;
+}
+
static GstElement *
make_playerbin_pipeline (const gchar * location)
{
- GstElement *player;
+ GstElement *player, *vis;
player = gst_element_factory_make ("playbin", "player");
+ vis = gst_element_factory_make ("synaesthesia", "vis");
g_assert (player);
+ g_assert (vis);
- g_object_set (G_OBJECT (player), "uri", location, NULL);
+ g_signal_connect (gst_element_get_pad (vis, "src"), "fixate",
+ G_CALLBACK (fixate), NULL);
+ g_object_set (G_OBJECT (player), "uri", location, "vis-plugin", vis, NULL);
seekable_elements = g_list_prepend (seekable_elements, player);