summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMathieu Duponchelle <mathieu.duponchelle@opencreed.com>2015-05-03 03:18:28 +0200
committerMathieu Duponchelle <mathieu.duponchelle@opencreed.com>2015-05-19 18:48:07 +0200
commit2e423dd129f9ea509181a9f3dc952a29fbfc7251 (patch)
treee781536619a46ddcddfc9b3cb0ef72139f1dcff5 /tests
parentfaafaaec56de31ebecf02b87e1fc0e4c07ed9ecc (diff)
discoverer: Add serialization methods.
[API] gst_discoverer_info_to_variant [API] gst_discoverer_info_from_variant [API] GstDiscovererSerializeFlags + Serializes as a GVariant + Adds a test + Does not serialize potential GstToc (s) https://bugzilla.gnome.org/show_bug.cgi?id=748814
Diffstat (limited to 'tests')
-rw-r--r--tests/check/libs/discoverer.c52
1 files changed, 51 insertions, 1 deletions
diff --git a/tests/check/libs/discoverer.c b/tests/check/libs/discoverer.c
index c7d2679c2..8fe5ecf5f 100644
--- a/tests/check/libs/discoverer.c
+++ b/tests/check/libs/discoverer.c
@@ -44,6 +44,56 @@ GST_START_TEST (test_disco_init)
GST_END_TEST;
+GST_START_TEST (test_disco_serializing)
+{
+ GError *err = NULL;
+ GstDiscoverer *dc;
+ GstDiscovererInfo *info, *dinfo;
+ gchar *uri;
+ GVariant *serialized, *reserialized;
+ GList *audio_streams;
+ gchar *path =
+ g_build_filename (GST_TEST_FILES_PATH, "theora-vorbis.ogg", NULL);
+
+ /* high timeout, in case we're running under valgrind */
+ dc = gst_discoverer_new (5 * GST_SECOND, &err);
+ fail_unless (dc != NULL);
+ fail_unless (err == NULL);
+
+ uri = gst_filename_to_uri (path, &err);
+ g_free (path);
+ fail_unless (err == NULL);
+
+ info = gst_discoverer_discover_uri (dc, uri, &err);
+ fail_unless (info);
+ serialized =
+ gst_discoverer_info_to_variant (info, GST_DISCOVERER_SERIALIZE_ALL);
+
+
+ fail_unless (serialized);
+ dinfo = gst_discoverer_info_from_variant (serialized);
+
+ fail_unless (dinfo);
+ audio_streams = gst_discoverer_info_get_audio_streams (dinfo);
+ fail_unless_equals_int (g_list_length (audio_streams), 1);
+ gst_discoverer_stream_info_list_free (audio_streams);
+
+ reserialized =
+ gst_discoverer_info_to_variant (dinfo, GST_DISCOVERER_SERIALIZE_ALL);
+
+ fail_unless (g_variant_equal (serialized, reserialized));
+
+ gst_discoverer_info_unref (info);
+ gst_discoverer_info_unref (dinfo);
+ g_free (uri);
+ g_variant_unref (serialized);
+ g_variant_unref (reserialized);
+
+ g_object_unref (dc);
+}
+
+GST_END_TEST;
+
GST_START_TEST (test_disco_sync)
{
GError *err = NULL;
@@ -78,7 +128,6 @@ GST_START_TEST (test_disco_sync)
}
GST_END_TEST;
-
static void
test_disco_sync_reuse (const gchar * test_fn, guint num, GstClockTime timeout)
{
@@ -195,6 +244,7 @@ discoverer_suite (void)
tcase_add_test (tc_chain, test_disco_sync_reuse_mp3);
tcase_add_test (tc_chain, test_disco_sync_reuse_timeout);
tcase_add_test (tc_chain, test_disco_missing_plugins);
+ tcase_add_test (tc_chain, test_disco_serializing);
return s;
}