}
static gboolean
-pad_check_get_range (GstPad * pad)
-{
- return FALSE;
-}
-
-static gboolean
decode_file (const gchar * file, gboolean push_mode)
{
GstStateChangeReturn state_ret;
- GstElement *sink, *src, *dec, *pipeline;
+ GstElement *sink, *src, *dec, *queue, *pipeline;
GstMessage *msg;
GstBus *bus;
gchar *path;
fail_unless (src != NULL, "Failed to create filesrc!");
if (push_mode) {
- GstPad *pad = gst_element_get_static_pad (src, "src");
-
- /* KIDS: don't do this at home! */
- gst_pad_set_checkgetrange_function (pad, pad_check_get_range);
- gst_object_unref (pad);
+ queue = gst_element_factory_make ("queue", "queue");
+ } else {
+ queue = gst_element_factory_make ("identity", "identity");
}
- dec = gst_element_factory_make ("decodebin2", "decodebin2");
- fail_unless (dec != NULL, "Failed to create decodebin2!");
+ dec = gst_element_factory_make ("decodebin", "decodebin");
+ fail_unless (dec != NULL, "Failed to create decodebin!");
sink = gst_element_factory_make ("fakesink", "fakesink");
fail_unless (sink != NULL, "Failed to create fakesink!");
* we just want to abort and nothing else */
gst_bus_set_sync_handler (bus, error_cb, (gpointer) file);
- gst_bin_add_many (GST_BIN (pipeline), src, dec, sink, NULL);
- gst_element_link_many (src, dec, NULL);
+ gst_bin_add_many (GST_BIN (pipeline), src, queue, dec, sink, NULL);
+ gst_element_link_many (src, queue, dec, NULL);
path = g_build_filename (GST_TEST_FILES_PATH, file, NULL);
GST_LOG ("reading file '%s'", path);
ret = decode_file (filename, FALSE);
fail_unless (ret == TRUE, "Failed to decode '%s' (pull mode)", filename);
- /* first, pull-based */
+ /* second, push-based */
ret = decode_file (filename, TRUE);
fail_unless (ret == TRUE, "Failed to decode '%s' (push mode)", filename);
}
GST_START_TEST (test_low_sample_rate_adpcm)
{
- if (!gst_default_registry_check_feature_version ("wavparse", 0, 10, 0) ||
- !gst_default_registry_check_feature_version ("decodebin2", 0, 10, 0)) {
+#define MIN_VERSION GST_VERSION_MAJOR, GST_VERSION_MINOR, 0
+ if (!gst_default_registry_check_feature_version ("wavparse", MIN_VERSION) ||
+ !gst_default_registry_check_feature_version ("decodebin", MIN_VERSION)) {
g_printerr ("skipping test_low_sample_rate_adpcm: required element "
- "wavparse or element decodebin2 not found\n");
+ "wavparse or element decodebin not found\n");
return;
}
return GST_BUS_PASS;
}
-static gboolean
-event_probe (GstPad * pad, GstEvent * event, GstTagList ** p_tags)
+static GstProbeReturn
+event_probe (GstPad * pad, GstProbeType type, gpointer type_data,
+ gpointer user_data)
{
+ GstTagList **p_tags = user_data;
+ GstEvent *event = type_data;
+
if (GST_EVENT_TYPE (event) == GST_EVENT_TAG) {
- GST_INFO ("tag event: %" GST_PTR_FORMAT, event->structure);
+ GST_INFO ("tag event: %" GST_PTR_FORMAT, event);
if (*p_tags == NULL) {
+ GstTagList *event_tags;
+
GST_INFO ("first tag, saving");
- *p_tags = gst_tag_list_copy ((GstTagList *) event->structure);
+ gst_event_parse_tag (event, &event_tags);
+ *p_tags = gst_tag_list_copy (event_tags);
}
}
- return TRUE; /* keep the data */
+ return GST_PROBE_OK; /* keep the data */
}
/* FIXME: push_mode not used currently */
src = gst_element_factory_make ("filesrc", "filesrc");
fail_unless (src != NULL, "Failed to create filesrc!");
- dec = gst_element_factory_make ("decodebin2", "decodebin2");
- fail_unless (dec != NULL, "Failed to create decodebin2!");
+ dec = gst_element_factory_make ("decodebin", "decodebin");
+ fail_unless (dec != NULL, "Failed to create decodebin!");
sink = gst_element_factory_make ("fakesink", "fakesink");
fail_unless (sink != NULL, "Failed to create fakesink!");
/* we want to make sure there's a tag event coming out of ffdemux_ape
* (ie. the one apedemux generated) */
pad = gst_element_get_static_pad (sink, "sink");
- gst_pad_add_event_probe (pad, G_CALLBACK (event_probe), &tags);
+ gst_pad_add_probe (pad, GST_PROBE_TYPE_EVENT, event_probe, &tags, NULL);
gst_object_unref (pad);
state_ret = gst_element_set_state (pipeline, GST_STATE_PAUSED);
GST_START_TEST (test_tag_caching)
{
- if (!gst_default_registry_check_feature_version ("apedemux", 0, 10, 0) ||
- !gst_default_registry_check_feature_version ("decodebin2", 0, 10, 0)) {
+#define MIN_VERSION GST_VERSION_MAJOR, GST_VERSION_MINOR, 0
+
+ if (!gst_default_registry_check_feature_version ("apedemux", MIN_VERSION) ||
+ !gst_default_registry_check_feature_version ("decodebin", MIN_VERSION)) {
g_printerr ("Skipping test_tag_caching: required element apedemux or "
- "decodebin2 element not found\n");
+ "decodebin element not found\n");
return;
}