diff options
author | Tim-Philipp Müller <tim.muller@collabora.co.uk> | 2012-11-29 13:42:45 +0000 |
---|---|---|
committer | Tim-Philipp Müller <tim.muller@collabora.co.uk> | 2012-11-29 15:00:39 +0000 |
commit | 64c4fa2ca0a5690a19da4b658f33e316d71f225d (patch) | |
tree | e8fe2940690bd356bc7f63a48940b88912049d65 | |
parent | 8edd1443a8c1615676c05722004575f7759157a6 (diff) |
test: add test for playbin in combination with appsink
Make sure appsink works multiple times in a row.
Disable it though for now though.
https://bugzilla.gnome.org/show_bug.cgi?id=644989
-rw-r--r-- | tests/check/elements/playbin.c | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/tests/check/elements/playbin.c b/tests/check/elements/playbin.c index 950d56c4b..8f4f62428 100644 --- a/tests/check/elements/playbin.c +++ b/tests/check/elements/playbin.c @@ -766,6 +766,70 @@ gst_codec_src_init (GstCodecSrc * src) { } +#if 0 +GST_START_TEST (test_appsink_twice) +{ + GstElement *playbin, *appsink; + GstSample *sample; + gchar *fn, *uri; + int flags; + + fn = g_build_filename (GST_TEST_FILES_PATH, "theora-vorbis.ogg", NULL); + uri = gst_filename_to_uri (fn, NULL); + g_free (fn); + + playbin = gst_element_factory_make ("playbin", NULL); + g_object_set (playbin, "uri", uri, NULL); + g_free (uri); + + /* disable video decoding/rendering (doesn't actually work yet though) */ + g_object_get (playbin, "flags", &flags, NULL); + g_object_set (playbin, "flags", flags & ~1, NULL); + + appsink = gst_element_factory_make ("appsink", "appsink"); + g_object_set (playbin, "audio-sink", appsink, NULL); + + fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_PLAYING), + GST_STATE_CHANGE_ASYNC); + fail_unless_equals_int (gst_element_get_state (playbin, NULL, NULL, + GST_CLOCK_TIME_NONE), GST_STATE_CHANGE_SUCCESS); + + do { + g_signal_emit_by_name (appsink, "pull-sample", &sample); + GST_LOG ("got sample: %p", sample); + if (sample) + gst_sample_unref (sample); + } + while (sample != NULL); + + GST_INFO ("got first EOS"); + + fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_NULL), + GST_STATE_CHANGE_SUCCESS); + fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_PLAYING), + GST_STATE_CHANGE_ASYNC); + fail_unless_equals_int (gst_element_get_state (playbin, NULL, NULL, + GST_CLOCK_TIME_NONE), GST_STATE_CHANGE_SUCCESS); + + do { + g_signal_emit_by_name (appsink, "pull-sample", &sample); + GST_LOG ("got sample: %p", sample); + if (sample) + gst_sample_unref (sample); + } + while (sample != NULL); + + GST_INFO ("got second EOS"); + + fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_NULL), + GST_STATE_CHANGE_SUCCESS); + + gst_object_unref (playbin); +} + +GST_END_TEST; +#endif + #endif /* GST_DISABLE_REGISTRY */ @@ -789,6 +853,18 @@ playbin_suite (void) tcase_add_test (tc_chain, test_refcount); tcase_add_test (tc_chain, test_source_setup); +#if 0 + { + GstRegistry *reg = gst_registry_get (); + + if (gst_registry_check_feature_version (reg, "oggdemux", 1, 0, 0) && + gst_registry_check_feature_version (reg, "theoradec", 1, 0, 0) && + gst_registry_check_feature_version (reg, "vorbisdec", 1, 0, 0)) { + tcase_add_test (tc_chain, test_appsink_twice); + } + } +#endif + /* one day we might also want to have the following checks: * tcase_add_test (tc_chain, test_missing_secondary_decoder_one_fatal); * tcase_add_test (tc_chain, test_missing_secondary_decoder_two_fatal); |