From e49c0699954e6c4dd62f46e2a57c5880dca582db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 12 Apr 2012 19:41:52 +0200 Subject: Rename everything from gst-ffmpeg to gst-libav Also change elements factory names to avenc_*, avdec_*, avmux_* and avdemux_*. The actual filenames, type names, function/variable names are not touched to make merging with 0.10 easier at this point. Once 0.10 is not supported anymore everything should be renamed. --- tests/check/Makefile.am | 10 +- tests/check/elements/avdec_adpcm.c | 168 +++++++++++++++++++++++++ tests/check/elements/avdemux_ape.c | 206 +++++++++++++++++++++++++++++++ tests/check/elements/ffdec_adpcm.c | 168 ------------------------- tests/check/elements/ffdemux_ape.c | 206 ------------------------------- tests/check/generic/libavcodec-locking.c | 6 +- tests/check/generic/plugin-test.c | 34 ++--- tests/check/gst-ffmpeg.supp | 0 tests/check/gst-libav.supp | 0 9 files changed, 399 insertions(+), 399 deletions(-) create mode 100644 tests/check/elements/avdec_adpcm.c create mode 100644 tests/check/elements/avdemux_ape.c delete mode 100644 tests/check/elements/ffdec_adpcm.c delete mode 100644 tests/check/elements/ffdemux_ape.c delete mode 100644 tests/check/gst-ffmpeg.supp create mode 100644 tests/check/gst-libav.supp (limited to 'tests') diff --git a/tests/check/Makefile.am b/tests/check/Makefile.am index e8a9902..1e83e53 100644 --- a/tests/check/Makefile.am +++ b/tests/check/Makefile.am @@ -19,14 +19,14 @@ clean-local: clean-local-check check_PROGRAMS = \ generic/plugin-test \ generic/libavcodec-locking \ - elements/ffdec_adpcm \ - elements/ffdemux_ape \ + elements/avdec_adpcm \ + elements/avdemux_ape \ elements/postproc VALGRIND_TO_FIX = \ generic/plugin-test \ generic/libavcodec-locking \ - elements/ffdemux_ape + elements/avdemux_ape TESTS = $(check_PROGRAMS) @@ -42,6 +42,6 @@ LDADD = $(GST_OBJ_LIBS) $(GST_CHECK_LIBS) $(CHECK_LIBS) # valgrind testing VALGRIND_TESTS_DISABLE = $(VALGRIND_TO_FIX) -SUPPRESSIONS = $(top_srcdir)/common/gst.supp $(srcdir)/gst-ffmpeg.supp +SUPPRESSIONS = $(top_srcdir)/common/gst.supp $(srcdir)/gst-libav.supp -EXTRA_DIST = gst-ffmpeg.supp +EXTRA_DIST = gst-libav.supp diff --git a/tests/check/elements/avdec_adpcm.c b/tests/check/elements/avdec_adpcm.c new file mode 100644 index 0000000..daad580 --- /dev/null +++ b/tests/check/elements/avdec_adpcm.c @@ -0,0 +1,168 @@ +/* GStreamer unit tests for avdec_adpcm + * + * Copyright (C) 2009 Tim-Philipp Müller + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include + +#include + +static void +pad_added_cb (GstElement * decodebin, GstPad * pad, GstBin * pipeline) +{ + GstElement *sink; + + GST_INFO_OBJECT (pad, "got pad"); + + sink = gst_bin_get_by_name (pipeline, "fakesink"); + fail_unless (gst_element_link (decodebin, sink)); + gst_object_unref (sink); + + gst_element_set_state (sink, GST_STATE_PAUSED); +} + +static GstBusSyncReply +error_cb (GstBus * bus, GstMessage * msg, gpointer user_data) +{ + if (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_ERROR) { + const gchar *file = (const gchar *) user_data; + GError *err = NULL; + gchar *dbg = NULL; + + gst_message_parse_error (msg, &err, &dbg); + g_error ("ERROR for %s: %s\n%s\n", file, err->message, dbg); + } + + return GST_BUS_PASS; +} + +static gboolean +decode_file (const gchar * file, gboolean push_mode) +{ + GstStateChangeReturn state_ret; + GstElement *sink, *src, *dec, *queue, *pipeline; + GstMessage *msg; + GstBus *bus; + gchar *path; + + pipeline = gst_pipeline_new ("pipeline"); + fail_unless (pipeline != NULL, "Failed to create pipeline!"); + + src = gst_element_factory_make ("filesrc", "filesrc"); + fail_unless (src != NULL, "Failed to create filesrc!"); + + if (push_mode) { + queue = gst_element_factory_make ("queue", "queue"); + } else { + queue = gst_element_factory_make ("identity", "identity"); + } + + 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!"); + + bus = gst_element_get_bus (pipeline); + + /* kids, don't use a sync handler for this at home, really; we do because + * 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, 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); + g_object_set (src, "location", path, NULL); + + /* can't link uridecodebin and sink yet, do that later */ + g_signal_connect (dec, "pad-added", G_CALLBACK (pad_added_cb), pipeline); + + state_ret = gst_element_set_state (pipeline, GST_STATE_PAUSED); + fail_unless (state_ret != GST_STATE_CHANGE_FAILURE); + + if (state_ret == GST_STATE_CHANGE_ASYNC) { + GST_LOG ("waiting for pipeline to reach PAUSED state"); + state_ret = gst_element_get_state (pipeline, NULL, NULL, -1); + fail_unless_equals_int (state_ret, GST_STATE_CHANGE_SUCCESS); + } + + state_ret = gst_element_set_state (pipeline, GST_STATE_PLAYING); + fail_unless (state_ret != GST_STATE_CHANGE_FAILURE); + + GST_LOG ("PAUSED, let's decode"); + msg = gst_bus_timed_pop_filtered (bus, 10 * GST_SECOND, GST_MESSAGE_EOS); + GST_LOG ("Done, got EOS message"); + fail_unless (msg != NULL); + gst_message_unref (msg); + gst_object_unref (bus); + + fail_unless_equals_int (gst_element_set_state (pipeline, GST_STATE_NULL), + GST_STATE_CHANGE_SUCCESS); + gst_object_unref (pipeline); + + g_free (path); + + return TRUE; +} + +static void +run_check_for_file (const gchar * filename) +{ + gboolean ret; + + /* first, pull-based */ + ret = decode_file (filename, FALSE); + fail_unless (ret == TRUE, "Failed to decode '%s' (pull mode)", filename); + + /* 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) +{ +#define MIN_VERSION GST_VERSION_MAJOR, GST_VERSION_MINOR, 0 + if (!gst_registry_check_feature_version (gst_registry_get (), "wavparse", + MIN_VERSION) + || !gst_registry_check_feature_version (gst_registry_get (), "decodebin", + MIN_VERSION)) { + g_printerr ("skipping test_low_sample_rate_adpcm: required element " + "wavparse or element decodebin not found\n"); + return; + } + + run_check_for_file ("591809.wav"); +} + +GST_END_TEST; + +static Suite * +avdec_adpcm_suite (void) +{ + Suite *s = suite_create ("avdec_adpcm"); + TCase *tc_chain = tcase_create ("general"); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_low_sample_rate_adpcm); + + return s; +} + +GST_CHECK_MAIN (avdec_adpcm) diff --git a/tests/check/elements/avdemux_ape.c b/tests/check/elements/avdemux_ape.c new file mode 100644 index 0000000..74151b7 --- /dev/null +++ b/tests/check/elements/avdemux_ape.c @@ -0,0 +1,206 @@ +/* GStreamer unit tests for avdemux_ape + * + * Copyright (C) 2009 Tim-Philipp Müller + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include + +#include + +typedef void (CheckTagsFunc) (const GstTagList * tags, const gchar * file); + +static void +pad_added_cb (GstElement * decodebin, GstPad * pad, GstBin * pipeline) +{ + GstElement *sink; + + sink = gst_bin_get_by_name (pipeline, "fakesink"); + fail_unless (gst_element_link (decodebin, sink)); + gst_object_unref (sink); + + gst_element_set_state (sink, GST_STATE_PAUSED); +} + +static GstBusSyncReply +error_cb (GstBus * bus, GstMessage * msg, gpointer user_data) +{ + if (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_ERROR) { + const gchar *file = (const gchar *) user_data; + GError *err = NULL; + gchar *dbg = NULL; + + gst_message_parse_error (msg, &err, &dbg); + g_error ("ERROR for %s: %s\n%s\n", file, err->message, dbg); + } + + return GST_BUS_PASS; +} + +static GstPadProbeReturn +event_probe (GstPad * pad, GstPadProbeInfo * info, gpointer user_data) +{ + GstTagList **p_tags = user_data; + GstEvent *event = GST_PAD_PROBE_INFO_EVENT (info); + + if (GST_EVENT_TYPE (event) == GST_EVENT_TAG) { + GST_INFO ("tag event: %" GST_PTR_FORMAT, event); + if (*p_tags == NULL) { + GstTagList *event_tags; + + GST_INFO ("first tag, saving"); + gst_event_parse_tag (event, &event_tags); + *p_tags = gst_tag_list_copy (event_tags); + } + } + return GST_PAD_PROBE_OK; /* keep the data */ +} + +/* FIXME: push_mode not used currently */ +static GstTagList * +read_tags_from_file (const gchar * file, gboolean push_mode) +{ + GstStateChangeReturn state_ret; + GstTagList *tags = NULL; + GstElement *sink, *src, *dec, *pipeline; + GstBus *bus; + GstPad *pad; + gchar *path; + + pipeline = gst_pipeline_new ("pipeline"); + fail_unless (pipeline != NULL, "Failed to create pipeline!"); + + src = gst_element_factory_make ("filesrc", "filesrc"); + fail_unless (src != NULL, "Failed to create filesrc!"); + + 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!"); + + bus = gst_element_get_bus (pipeline); + + /* kids, don't use a sync handler for this at home, really; we do because + * 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); + + path = g_build_filename (GST_TEST_FILES_PATH, file, NULL); + GST_LOG ("reading file '%s'", path); + g_object_set (src, "location", path, NULL); + + /* can't link uridecodebin and sink yet, do that later */ + g_signal_connect (dec, "pad-added", G_CALLBACK (pad_added_cb), pipeline); + + /* we want to make sure there's a tag event coming out of avdemux_ape + * (ie. the one apedemux generated) */ + pad = gst_element_get_static_pad (sink, "sink"); + gst_pad_add_probe (pad, GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM, event_probe, + &tags, NULL); + gst_object_unref (pad); + + state_ret = gst_element_set_state (pipeline, GST_STATE_PAUSED); + fail_unless (state_ret != GST_STATE_CHANGE_FAILURE); + + if (state_ret == GST_STATE_CHANGE_ASYNC) { + GST_LOG ("waiting for pipeline to reach PAUSED state"); + state_ret = gst_element_get_state (pipeline, NULL, NULL, -1); + fail_unless_equals_int (state_ret, GST_STATE_CHANGE_SUCCESS); + } + + GST_LOG ("PAUSED, let's retrieve our tags"); + + fail_unless (tags != NULL, "Expected tag event! (%s)", file); + + gst_object_unref (bus); + + fail_unless_equals_int (gst_element_set_state (pipeline, GST_STATE_NULL), + GST_STATE_CHANGE_SUCCESS); + gst_object_unref (pipeline); + + g_free (path); + + GST_INFO ("%s: tags = %" GST_PTR_FORMAT, file, tags); + return tags; +} + +static void +run_check_for_file (const gchar * filename, CheckTagsFunc * check_func) +{ + GstTagList *tags; + + /* first, pull-based */ + tags = read_tags_from_file (filename, FALSE); + fail_unless (tags != NULL, "Failed to extract tags from '%s'", filename); + check_func (tags, filename); + gst_tag_list_free (tags); +} + +#define tag_list_has_tag(taglist,tag) \ + (gst_tag_list_get_value_index((taglist),(tag),0) != NULL) + +/* just make sure avdemux_ape forwarded the tags extracted by apedemux + * (should be the first tag list / tag event too) */ +static void +check_for_apedemux_tags (const GstTagList * tags, const gchar * file) +{ + gchar *artist = NULL; + + fail_unless (gst_tag_list_get_string (tags, GST_TAG_ARTIST, &artist)); + fail_unless (artist != NULL); + fail_unless_equals_string (artist, "Marvin Gaye"); + g_free (artist); + + fail_unless (tag_list_has_tag (tags, GST_TAG_CONTAINER_FORMAT)); + + GST_LOG ("all good"); +} + +GST_START_TEST (test_tag_caching) +{ +#define MIN_VERSION GST_VERSION_MAJOR, GST_VERSION_MINOR, 0 + + if (!gst_registry_check_feature_version (gst_registry_get (), "apedemux", + MIN_VERSION) + || !gst_registry_check_feature_version (gst_registry_get (), "decodebin", + MIN_VERSION)) { + g_printerr ("Skipping test_tag_caching: required element apedemux or " + "decodebin element not found\n"); + return; + } + + run_check_for_file ("586957.ape", check_for_apedemux_tags); +} + +GST_END_TEST; + +static Suite * +avdemux_ape_suite (void) +{ + Suite *s = suite_create ("avdemux_ape"); + TCase *tc_chain = tcase_create ("general"); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_tag_caching); + + return s; +} + +GST_CHECK_MAIN (avdemux_ape) diff --git a/tests/check/elements/ffdec_adpcm.c b/tests/check/elements/ffdec_adpcm.c deleted file mode 100644 index c4c0c89..0000000 --- a/tests/check/elements/ffdec_adpcm.c +++ /dev/null @@ -1,168 +0,0 @@ -/* GStreamer unit tests for ffdec_adpcm - * - * Copyright (C) 2009 Tim-Philipp Müller - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include - -#include - -static void -pad_added_cb (GstElement * decodebin, GstPad * pad, GstBin * pipeline) -{ - GstElement *sink; - - GST_INFO_OBJECT (pad, "got pad"); - - sink = gst_bin_get_by_name (pipeline, "fakesink"); - fail_unless (gst_element_link (decodebin, sink)); - gst_object_unref (sink); - - gst_element_set_state (sink, GST_STATE_PAUSED); -} - -static GstBusSyncReply -error_cb (GstBus * bus, GstMessage * msg, gpointer user_data) -{ - if (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_ERROR) { - const gchar *file = (const gchar *) user_data; - GError *err = NULL; - gchar *dbg = NULL; - - gst_message_parse_error (msg, &err, &dbg); - g_error ("ERROR for %s: %s\n%s\n", file, err->message, dbg); - } - - return GST_BUS_PASS; -} - -static gboolean -decode_file (const gchar * file, gboolean push_mode) -{ - GstStateChangeReturn state_ret; - GstElement *sink, *src, *dec, *queue, *pipeline; - GstMessage *msg; - GstBus *bus; - gchar *path; - - pipeline = gst_pipeline_new ("pipeline"); - fail_unless (pipeline != NULL, "Failed to create pipeline!"); - - src = gst_element_factory_make ("filesrc", "filesrc"); - fail_unless (src != NULL, "Failed to create filesrc!"); - - if (push_mode) { - queue = gst_element_factory_make ("queue", "queue"); - } else { - queue = gst_element_factory_make ("identity", "identity"); - } - - 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!"); - - bus = gst_element_get_bus (pipeline); - - /* kids, don't use a sync handler for this at home, really; we do because - * 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, 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); - g_object_set (src, "location", path, NULL); - - /* can't link uridecodebin and sink yet, do that later */ - g_signal_connect (dec, "pad-added", G_CALLBACK (pad_added_cb), pipeline); - - state_ret = gst_element_set_state (pipeline, GST_STATE_PAUSED); - fail_unless (state_ret != GST_STATE_CHANGE_FAILURE); - - if (state_ret == GST_STATE_CHANGE_ASYNC) { - GST_LOG ("waiting for pipeline to reach PAUSED state"); - state_ret = gst_element_get_state (pipeline, NULL, NULL, -1); - fail_unless_equals_int (state_ret, GST_STATE_CHANGE_SUCCESS); - } - - state_ret = gst_element_set_state (pipeline, GST_STATE_PLAYING); - fail_unless (state_ret != GST_STATE_CHANGE_FAILURE); - - GST_LOG ("PAUSED, let's decode"); - msg = gst_bus_timed_pop_filtered (bus, 10 * GST_SECOND, GST_MESSAGE_EOS); - GST_LOG ("Done, got EOS message"); - fail_unless (msg != NULL); - gst_message_unref (msg); - gst_object_unref (bus); - - fail_unless_equals_int (gst_element_set_state (pipeline, GST_STATE_NULL), - GST_STATE_CHANGE_SUCCESS); - gst_object_unref (pipeline); - - g_free (path); - - return TRUE; -} - -static void -run_check_for_file (const gchar * filename) -{ - gboolean ret; - - /* first, pull-based */ - ret = decode_file (filename, FALSE); - fail_unless (ret == TRUE, "Failed to decode '%s' (pull mode)", filename); - - /* 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) -{ -#define MIN_VERSION GST_VERSION_MAJOR, GST_VERSION_MINOR, 0 - if (!gst_registry_check_feature_version (gst_registry_get (), "wavparse", - MIN_VERSION) - || !gst_registry_check_feature_version (gst_registry_get (), "decodebin", - MIN_VERSION)) { - g_printerr ("skipping test_low_sample_rate_adpcm: required element " - "wavparse or element decodebin not found\n"); - return; - } - - run_check_for_file ("591809.wav"); -} - -GST_END_TEST; - -static Suite * -ffdec_adpcm_suite (void) -{ - Suite *s = suite_create ("ffdec_adpcm"); - TCase *tc_chain = tcase_create ("general"); - - suite_add_tcase (s, tc_chain); - tcase_add_test (tc_chain, test_low_sample_rate_adpcm); - - return s; -} - -GST_CHECK_MAIN (ffdec_adpcm) diff --git a/tests/check/elements/ffdemux_ape.c b/tests/check/elements/ffdemux_ape.c deleted file mode 100644 index f9b73bd..0000000 --- a/tests/check/elements/ffdemux_ape.c +++ /dev/null @@ -1,206 +0,0 @@ -/* GStreamer unit tests for ffdemux_ape - * - * Copyright (C) 2009 Tim-Philipp Müller - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include - -#include - -typedef void (CheckTagsFunc) (const GstTagList * tags, const gchar * file); - -static void -pad_added_cb (GstElement * decodebin, GstPad * pad, GstBin * pipeline) -{ - GstElement *sink; - - sink = gst_bin_get_by_name (pipeline, "fakesink"); - fail_unless (gst_element_link (decodebin, sink)); - gst_object_unref (sink); - - gst_element_set_state (sink, GST_STATE_PAUSED); -} - -static GstBusSyncReply -error_cb (GstBus * bus, GstMessage * msg, gpointer user_data) -{ - if (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_ERROR) { - const gchar *file = (const gchar *) user_data; - GError *err = NULL; - gchar *dbg = NULL; - - gst_message_parse_error (msg, &err, &dbg); - g_error ("ERROR for %s: %s\n%s\n", file, err->message, dbg); - } - - return GST_BUS_PASS; -} - -static GstPadProbeReturn -event_probe (GstPad * pad, GstPadProbeInfo * info, gpointer user_data) -{ - GstTagList **p_tags = user_data; - GstEvent *event = GST_PAD_PROBE_INFO_EVENT (info); - - if (GST_EVENT_TYPE (event) == GST_EVENT_TAG) { - GST_INFO ("tag event: %" GST_PTR_FORMAT, event); - if (*p_tags == NULL) { - GstTagList *event_tags; - - GST_INFO ("first tag, saving"); - gst_event_parse_tag (event, &event_tags); - *p_tags = gst_tag_list_copy (event_tags); - } - } - return GST_PAD_PROBE_OK; /* keep the data */ -} - -/* FIXME: push_mode not used currently */ -static GstTagList * -read_tags_from_file (const gchar * file, gboolean push_mode) -{ - GstStateChangeReturn state_ret; - GstTagList *tags = NULL; - GstElement *sink, *src, *dec, *pipeline; - GstBus *bus; - GstPad *pad; - gchar *path; - - pipeline = gst_pipeline_new ("pipeline"); - fail_unless (pipeline != NULL, "Failed to create pipeline!"); - - src = gst_element_factory_make ("filesrc", "filesrc"); - fail_unless (src != NULL, "Failed to create filesrc!"); - - 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!"); - - bus = gst_element_get_bus (pipeline); - - /* kids, don't use a sync handler for this at home, really; we do because - * 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); - - path = g_build_filename (GST_TEST_FILES_PATH, file, NULL); - GST_LOG ("reading file '%s'", path); - g_object_set (src, "location", path, NULL); - - /* can't link uridecodebin and sink yet, do that later */ - g_signal_connect (dec, "pad-added", G_CALLBACK (pad_added_cb), pipeline); - - /* 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_probe (pad, GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM, event_probe, - &tags, NULL); - gst_object_unref (pad); - - state_ret = gst_element_set_state (pipeline, GST_STATE_PAUSED); - fail_unless (state_ret != GST_STATE_CHANGE_FAILURE); - - if (state_ret == GST_STATE_CHANGE_ASYNC) { - GST_LOG ("waiting for pipeline to reach PAUSED state"); - state_ret = gst_element_get_state (pipeline, NULL, NULL, -1); - fail_unless_equals_int (state_ret, GST_STATE_CHANGE_SUCCESS); - } - - GST_LOG ("PAUSED, let's retrieve our tags"); - - fail_unless (tags != NULL, "Expected tag event! (%s)", file); - - gst_object_unref (bus); - - fail_unless_equals_int (gst_element_set_state (pipeline, GST_STATE_NULL), - GST_STATE_CHANGE_SUCCESS); - gst_object_unref (pipeline); - - g_free (path); - - GST_INFO ("%s: tags = %" GST_PTR_FORMAT, file, tags); - return tags; -} - -static void -run_check_for_file (const gchar * filename, CheckTagsFunc * check_func) -{ - GstTagList *tags; - - /* first, pull-based */ - tags = read_tags_from_file (filename, FALSE); - fail_unless (tags != NULL, "Failed to extract tags from '%s'", filename); - check_func (tags, filename); - gst_tag_list_free (tags); -} - -#define tag_list_has_tag(taglist,tag) \ - (gst_tag_list_get_value_index((taglist),(tag),0) != NULL) - -/* just make sure ffdemux_ape forwarded the tags extracted by apedemux - * (should be the first tag list / tag event too) */ -static void -check_for_apedemux_tags (const GstTagList * tags, const gchar * file) -{ - gchar *artist = NULL; - - fail_unless (gst_tag_list_get_string (tags, GST_TAG_ARTIST, &artist)); - fail_unless (artist != NULL); - fail_unless_equals_string (artist, "Marvin Gaye"); - g_free (artist); - - fail_unless (tag_list_has_tag (tags, GST_TAG_CONTAINER_FORMAT)); - - GST_LOG ("all good"); -} - -GST_START_TEST (test_tag_caching) -{ -#define MIN_VERSION GST_VERSION_MAJOR, GST_VERSION_MINOR, 0 - - if (!gst_registry_check_feature_version (gst_registry_get (), "apedemux", - MIN_VERSION) - || !gst_registry_check_feature_version (gst_registry_get (), "decodebin", - MIN_VERSION)) { - g_printerr ("Skipping test_tag_caching: required element apedemux or " - "decodebin element not found\n"); - return; - } - - run_check_for_file ("586957.ape", check_for_apedemux_tags); -} - -GST_END_TEST; - -static Suite * -ffdemux_ape_suite (void) -{ - Suite *s = suite_create ("ffdemux_ape"); - TCase *tc_chain = tcase_create ("general"); - - suite_add_tcase (s, tc_chain); - tcase_add_test (tc_chain, test_tag_caching); - - return s; -} - -GST_CHECK_MAIN (ffdemux_ape) diff --git a/tests/check/generic/libavcodec-locking.c b/tests/check/generic/libavcodec-locking.c index 271acea..453d6a0 100644 --- a/tests/check/generic/libavcodec-locking.c +++ b/tests/check/generic/libavcodec-locking.c @@ -2,7 +2,7 @@ * Copyright (C) 2005 Luca Ognibene * Based (copied) on simple_launch_lines.c * - * ffmpeg-lock.c: Unit test for libavcodec's locks + * libavcodec-locking.c: Unit test for libavcodec's locks * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -103,7 +103,7 @@ GST_START_TEST (test_libavcodec_locks) for (i = 0; i < NUM_SINKS; i++) sink[i] = g_strdup_printf - (" t.src_%u ! queue ! ffenc_mpeg4 ! ffdec_mpeg4 ! fakesink sync=true", + (" t.src_%u ! queue ! avenc_mpeg4 ! avdec_mpeg4 ! fakesink sync=true", i); sink[NUM_SINKS] = NULL; @@ -147,7 +147,7 @@ simple_launch_lines_suite (void) #ifndef GST_DISABLE_PARSE /* only run this if we haven't been configured with --disable-encoders */ - if (gst_registry_check_feature_version (gst_registry_get (), "ffenc_mpeg4", + if (gst_registry_check_feature_version (gst_registry_get (), "avenc_mpeg4", GST_VERSION_MAJOR, GST_VERSION_MINOR, 0)) { tcase_add_test (tc_chain, test_libavcodec_locks); } else { diff --git a/tests/check/generic/plugin-test.c b/tests/check/generic/plugin-test.c index e784b2d..d661fce 100644 --- a/tests/check/generic/plugin-test.c +++ b/tests/check/generic/plugin-test.c @@ -24,9 +24,9 @@ #include #include -GST_START_TEST (test_ffmpeg_plugin) +GST_START_TEST (test_libav_plugin) { - GstPlugin *plugin = gst_plugin_load_by_name ("ffmpeg"); + GstPlugin *plugin = gst_plugin_load_by_name ("libav"); fail_if (plugin == NULL, "Could not load FFmpeg plugin"); @@ -36,21 +36,21 @@ GST_START_TEST (test_ffmpeg_plugin) GST_END_TEST; -GST_START_TEST (test_ffmpeg_update_reg) +GST_START_TEST (test_libav_update_reg) { GstElement *encoder, *muxer, *decoder; /* Ask for elements the first time */ - encoder = gst_element_factory_make ("ffenc_mpeg2video", "sink"); - GST_DEBUG ("Creating element ffenc_mpeg2video %p", encoder); + encoder = gst_element_factory_make ("avenc_mpeg2video", "sink"); + GST_DEBUG ("Creating element avenc_mpeg2video %p", encoder); fail_unless (encoder != NULL); - decoder = gst_element_factory_make ("ffdec_mpeg2video", "sink"); - GST_DEBUG ("Creating element ffdec_mpeg2video %p", decoder); + decoder = gst_element_factory_make ("avdec_mpeg2video", "sink"); + GST_DEBUG ("Creating element avdec_mpeg2video %p", decoder); fail_unless (decoder != NULL); - muxer = gst_element_factory_make ("ffmux_dvd", "sink"); - GST_DEBUG ("Creating element ffmux_dvd %p", muxer); + muxer = gst_element_factory_make ("avmux_dvd", "sink"); + GST_DEBUG ("Creating element avmux_dvd %p", muxer); fail_unless (muxer != NULL); gst_object_unref (encoder); @@ -62,16 +62,16 @@ GST_START_TEST (test_ffmpeg_update_reg) /* Ask for elements the second time */ - encoder = gst_element_factory_make ("ffenc_mpeg2video", "sink"); - GST_DEBUG ("Creating element ffenc_mpeg2video %p", encoder); + encoder = gst_element_factory_make ("avenc_mpeg2video", "sink"); + GST_DEBUG ("Creating element avenc_mpeg2video %p", encoder); fail_unless (encoder != NULL); - decoder = gst_element_factory_make ("ffdec_mpeg2video", "sink"); - GST_DEBUG ("Creating element ffdec_mpeg2video %p", decoder); + decoder = gst_element_factory_make ("avdec_mpeg2video", "sink"); + GST_DEBUG ("Creating element avdec_mpeg2video %p", decoder); fail_unless (decoder != NULL); - muxer = gst_element_factory_make ("ffmux_dvd", "sink"); - GST_DEBUG ("Creating element ffmux_dvd %p", muxer); + muxer = gst_element_factory_make ("avmux_dvd", "sink"); + GST_DEBUG ("Creating element avmux_dvd %p", muxer); fail_unless (muxer != NULL); gst_object_unref (encoder); @@ -89,8 +89,8 @@ plugin_test_suite (void) suite_add_tcase (s, tc_chain); - tcase_add_test (tc_chain, test_ffmpeg_plugin); - tcase_add_test (tc_chain, test_ffmpeg_update_reg); + tcase_add_test (tc_chain, test_libav_plugin); + tcase_add_test (tc_chain, test_libav_update_reg); return s; } diff --git a/tests/check/gst-ffmpeg.supp b/tests/check/gst-ffmpeg.supp deleted file mode 100644 index e69de29..0000000 diff --git a/tests/check/gst-libav.supp b/tests/check/gst-libav.supp new file mode 100644 index 0000000..e69de29 -- cgit v1.2.1