tests: port gdkpixbufsink test

This commit is contained in:
Tim-Philipp Müller 2012-10-01 14:03:19 +01:00
parent e6d37eb30a
commit 2c4b7e03a2

View file

@ -57,8 +57,7 @@ create_element (const gchar * factory_name)
} }
static void static void
new_decoded_pad (GstElement * dec, GstPad * new_pad, gboolean last, new_decoded_pad (GstElement * dec, GstPad * new_pad, AppInfo * info)
AppInfo * info)
{ {
const gchar *sname; const gchar *sname;
GstElement *csp, *scale, *filter; GstElement *csp, *scale, *filter;
@ -70,7 +69,7 @@ new_decoded_pad (GstElement * dec, GstPad * new_pad, gboolean last,
if (info->got_video) if (info->got_video)
return; return;
/* FIXME: is this racy or does decodebin2 make sure caps are always /* FIXME: is this racy or does decodebin make sure caps are always
* negotiated at this point? */ * negotiated at this point? */
caps = gst_pad_query_caps (new_pad, NULL); caps = gst_pad_query_caps (new_pad, NULL);
g_return_if_fail (caps != NULL); g_return_if_fail (caps != NULL);
@ -109,13 +108,17 @@ new_decoded_pad (GstElement * dec, GstPad * new_pad, gboolean last,
return; return;
not_video: not_video:
return;
}
static void
no_more_pads (GstElement * decodebin, AppInfo * info)
{ {
if (last) { if (!info->got_video) {
g_error ("This file does not contain a video track, or you do not have " g_error ("This file does not contain a video track, or you do not have "
"the necessary decoder(s) installed"); "the necessary decoder(s) installed");
} }
} }
}
static void static void
bus_message_cb (GstBus * bus, GstMessage * msg, AppInfo * info) bus_message_cb (GstBus * bus, GstMessage * msg, AppInfo * info)
@ -191,13 +194,15 @@ create_pipeline (AppInfo * info, const gchar * filename)
src = create_element ("filesrc"); src = create_element ("filesrc");
g_object_set (src, "location", filename, NULL); g_object_set (src, "location", filename, NULL);
dec = create_element ("decodebin2"); dec = create_element ("decodebin");
gst_bin_add_many (GST_BIN (info->pipe), src, dec, NULL); gst_bin_add_many (GST_BIN (info->pipe), src, dec, NULL);
if (!gst_element_link (src, dec)) if (!gst_element_link (src, dec))
g_error ("Can't link filesrc to decodebin2"); g_error ("Can't link filesrc to decodebin");
g_signal_connect (dec, "new-decoded-pad", G_CALLBACK (new_decoded_pad), info); g_signal_connect (dec, "pad-added", G_CALLBACK (new_decoded_pad), info);
g_signal_connect (dec, "no-more-pads", G_CALLBACK (no_more_pads), info);
/* set up bus */ /* set up bus */
bus = gst_element_get_bus (info->pipe); bus = gst_element_get_bus (info->pipe);