tests: port to 0.11

Some still fail though, for various reasons. ffmpeg warning:
"get_buffer() cannot be called after ff_thread_finish_setup()".
This commit is contained in:
Tim-Philipp Müller 2011-10-30 12:23:51 +00:00
parent 6501cdbf92
commit 487175f573
4 changed files with 36 additions and 33 deletions

View file

@ -34,7 +34,8 @@ TESTS = $(check_PROGRAMS)
noinst_PROGRAMS =
AM_CFLAGS = $(GST_OBJ_CFLAGS) $(GST_CHECK_CFLAGS) $(CHECK_CFLAGS) \
$(GST_OPTION_CFLAGS) -DGST_TEST_FILES_PATH="\"$(TEST_FILES_DIRECTORY)\""
$(GST_OPTION_CFLAGS) -DGST_TEST_FILES_PATH="\"$(TEST_FILES_DIRECTORY)\"" \
-DGST_USE_UNSTABLE_API
LDADD = $(GST_OBJ_LIBS) $(GST_CHECK_LIBS) $(CHECK_LIBS)

View file

@ -51,17 +51,11 @@ error_cb (GstBus * bus, GstMessage * msg, gpointer user_data)
return GST_BUS_PASS;
}
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;
@ -73,15 +67,13 @@ decode_file (const gchar * file, gboolean push_mode)
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!");
@ -92,8 +84,8 @@ decode_file (const gchar * file, gboolean push_mode)
* 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);
@ -139,17 +131,18 @@ run_check_for_file (const gchar * filename)
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;
}

View file

@ -51,17 +51,24 @@ error_cb (GstBus * bus, GstMessage * msg, gpointer user_data)
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 */
@ -81,8 +88,8 @@ read_tags_from_file (const gchar * file, gboolean push_mode)
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!");
@ -106,7 +113,7 @@ read_tags_from_file (const gchar * file, gboolean push_mode)
/* 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);
@ -168,10 +175,12 @@ check_for_apedemux_tags (const GstTagList * tags, const gchar * file)
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;
}

View file

@ -111,7 +111,7 @@ GST_START_TEST (test_libavcodec_locks)
sinks = g_strjoinv (" ", sink);
s = g_strdup_printf
("videotestsrc ! video/x-raw-yuv,format=(fourcc)I420,width=320,height=240,framerate=(fraction)10/1 ! tee name=t %s",
("videotestsrc ! video/x-raw,format=(string)I420,width=320,height=240,framerate=(fraction)10/1 ! tee name=t %s",
sinks);
run_pipeline (setup_pipeline (s), s,