}
static void
-new_decoded_pad_cb (GstElement * decodebin, GstPad * pad, gboolean last,
- GstElement * pipeline)
+pad_added_cb (GstElement * decodebin, GstPad * pad, GstElement * pipeline)
{
GstPadLinkReturn ret;
GstElement *fakesink;
gst_element_link_pads (source, "src", decoder, "sink");
- g_signal_connect (decoder, "new-decoded-pad",
- G_CALLBACK (new_decoded_pad_cb), pipeline);
+ g_signal_connect (decoder, "pad-added", G_CALLBACK (pad_added_cb), pipeline);
res = gst_element_set_state (pipeline, GST_STATE_PLAYING);
if (res == GST_STATE_CHANGE_FAILURE) {
element = gst_bin_new ("vbin");
conv = gst_element_factory_make ("videoconvert", "conv");
sink = gst_element_factory_make (DEFAULT_VIDEOSINK, "sink");
+ g_assert (sink);
gst_bin_add (GST_BIN (element), conv);
gst_bin_add (GST_BIN (element), sink);
element = gst_bin_new ("abin");
conv = gst_element_factory_make ("audioconvert", "conv");
sink = gst_element_factory_make (DEFAULT_AUDIOSINK, "sink");
+ g_assert (sink);
gst_bin_add (GST_BIN (element), conv);
gst_bin_add (GST_BIN (element), sink);
}
static void
-cb_newpad (GstElement * decodebin, GstPad * pad, gboolean last, gpointer data)
+pad_added_cb (GstElement * decodebin, GstPad * pad, gpointer data)
{
GstCaps *caps;
GstStructure *str;
decodebin = gst_element_factory_make ("decodebin", "decodebin");
g_assert (decodebin);
- g_signal_connect (G_OBJECT (decodebin), "new-decoded-pad",
- G_CALLBACK (cb_newpad), pipeline);
+ g_signal_connect (G_OBJECT (decodebin), "pad-added",
+ G_CALLBACK (pad_added_cb), pipeline);
gst_bin_add_many (GST_BIN (pipeline), filesrc, decodebin, NULL);
gst_element_link (filesrc, decodebin);
g_print ("usage: %s <uri>\n", argv[0]);
exit (-1);
}
- g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL);
+
+ if (!g_str_has_prefix (argv[1], "file://")) {
+ g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL);
+ } else {
+ g_object_set (G_OBJECT (filesrc), "location", argv[1] + 7, NULL);
+ }
/* set to paused, decodebin will autoplug and signal new_pad callbacks */
res = gst_element_set_state (pipeline, GST_STATE_PAUSED);
static GMainLoop *loop;
static void
-new_pad (GstElement * element, GstPad * pad, gboolean last, GstElement * sink)
+pad_added_cb (GstElement * element, GstPad * pad, GstElement * sink)
{
g_print ("New pad...\n");
}
decodebin = gst_element_factory_make ("decodebin", "decodebin");
g_assert (decodebin);
- g_signal_connect (G_OBJECT (decodebin), "new-decoded-pad",
- G_CALLBACK (new_pad), NULL);
+ g_signal_connect (G_OBJECT (decodebin), "pad-added",
+ G_CALLBACK (pad_added_cb), NULL);
g_signal_connect (G_OBJECT (decodebin), "no-more-pads",
G_CALLBACK (no_more_pads), NULL);
g_print ("usage: %s <uri>\n", argv[0]);
exit (-1);
}
- g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL);
+
+ if (!g_str_has_prefix (argv[1], "file://")) {
+ g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL);
+ } else {
+ g_object_set (G_OBJECT (filesrc), "location", argv[1] + 7, NULL);
+ }
/* event based programming approach */
loop = g_main_loop_new (NULL, TRUE);