2010-02-13 15:28:39 +00:00
|
|
|
/* GStreamer unit test for dataurisrc
|
|
|
|
*
|
2016-11-28 11:08:24 +00:00
|
|
|
* Copyright (C) 2010, 2016 Tim-Philipp Müller <tim centricular net>
|
2010-02-13 15:28:39 +00:00
|
|
|
*
|
|
|
|
* 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
|
2012-11-03 20:38:00 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
2010-02-13 15:28:39 +00:00
|
|
|
*/
|
2017-11-24 12:41:20 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
2010-02-13 15:28:39 +00:00
|
|
|
|
2019-05-22 07:44:50 +00:00
|
|
|
#include <gst/check/check.h>
|
2010-02-13 15:28:39 +00:00
|
|
|
|
|
|
|
/* sine wave encoded in ogg/vorbis, created with:
|
2015-11-19 17:24:53 +00:00
|
|
|
* gst-launch-1.0 audiotestsrc num-buffers=110 ! audioconvert ! \
|
2012-02-24 11:53:52 +00:00
|
|
|
* audio/x-raw,channels=1 ! vorbisenc ! oggmux ! \
|
2010-02-13 15:28:39 +00:00
|
|
|
* filesink location=sine.ogg
|
|
|
|
* and then encoded to base64 */
|
|
|
|
const gchar data_uri[] = "data:audio/ogg;base64,"
|
|
|
|
"T2dnUwACAAAAAAAAAACVWbd7AAAAAHgH02kBHgF2b3JiaXMA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wY4/FUwHAAAAAAAAAAAAAABwvcUAAIBcX6VTAQCeyt6qN8ntFqHBjj8FTAcAAAAAAAAAAAAAAPDj"
|
|
|
|
"uwAAAJM3TJgWAE9nZ1MAAMC2AQAAAAAAlVm3ewcAAAChMbyhATK+ur7krvf7iNcT84QFpAwAAAAA"
|
|
|
|
"AAAAAAAAAEAnELfPda81yNy2bdpbCkUt8amvXMHuAE9nZ1MABAC4AQAAAAAAlVm3ewgAAAA8WkRh"
|
|
|
|
"AWZeiL1v7LSgX1wHDrB3NhI3k3sSnaKJAAAAAAAAQOJJS94nzV+3/3r/2Ho5ub5tHN70XSuPfdZZ"
|
|
|
|
"C/9eZOtqZc5Zfl8wP5ZenOT3hbWPpZeE6jzjkdY3f+GXCblaF41qKouT/N7UyQA=";
|
|
|
|
|
2016-11-28 11:08:24 +00:00
|
|
|
static GstPad *mysinkpad;
|
|
|
|
|
|
|
|
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
|
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS_ANY);
|
|
|
|
|
|
|
|
static gboolean have_eos;
|
|
|
|
static GCond eos_cond;
|
|
|
|
static GMutex event_mutex;
|
|
|
|
|
|
|
|
static guchar *data;
|
|
|
|
static gsize data_size;
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
event_func (GstPad * pad, GstObject * parent, GstEvent * event)
|
2010-02-13 15:28:39 +00:00
|
|
|
{
|
2016-11-28 11:08:24 +00:00
|
|
|
gboolean res = TRUE;
|
|
|
|
|
|
|
|
g_mutex_lock (&event_mutex);
|
|
|
|
if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) {
|
|
|
|
have_eos = TRUE;
|
|
|
|
GST_DEBUG ("signal EOS");
|
|
|
|
g_cond_broadcast (&eos_cond);
|
|
|
|
}
|
|
|
|
g_mutex_unlock (&event_mutex);
|
|
|
|
|
|
|
|
gst_event_unref (event);
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstElement *
|
|
|
|
setup_dataurisrc (void)
|
|
|
|
{
|
|
|
|
GstElement *dataurisrc;
|
|
|
|
|
|
|
|
g_cond_init (&eos_cond);
|
|
|
|
g_mutex_init (&event_mutex);
|
|
|
|
have_eos = FALSE;
|
|
|
|
|
|
|
|
dataurisrc = gst_check_setup_element ("dataurisrc");
|
|
|
|
mysinkpad = gst_check_setup_sink_pad (dataurisrc, &sinktemplate);
|
|
|
|
gst_pad_set_event_function (mysinkpad, event_func);
|
|
|
|
gst_pad_set_active (mysinkpad, TRUE);
|
|
|
|
|
|
|
|
return dataurisrc;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
cleanup_dataurisrc (GstElement * dataurisrc)
|
|
|
|
{
|
|
|
|
gst_check_drop_buffers ();
|
|
|
|
gst_pad_set_active (mysinkpad, FALSE);
|
|
|
|
gst_check_teardown_sink_pad (dataurisrc);
|
|
|
|
gst_check_teardown_element (dataurisrc);
|
|
|
|
|
|
|
|
g_cond_clear (&eos_cond);
|
|
|
|
g_mutex_clear (&event_mutex);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_START_TEST (test_dataurisrc_pull)
|
|
|
|
{
|
|
|
|
GstFlowReturn flow;
|
|
|
|
GstBuffer *buf1, *buf2;
|
|
|
|
GstElement *src;
|
|
|
|
GstQuery *seeking_query;
|
|
|
|
GstPad *src_pad;
|
|
|
|
gboolean seekable = FALSE;
|
|
|
|
gint64 start = -1, stop = -1;
|
|
|
|
|
|
|
|
data = g_base64_decode (data_uri + 22, &data_size);
|
|
|
|
fail_unless (data != NULL);
|
|
|
|
|
|
|
|
src = setup_dataurisrc ();
|
|
|
|
|
|
|
|
g_object_set (src, "uri", data_uri, NULL);
|
|
|
|
|
|
|
|
fail_unless_equals_int (gst_element_set_state (src, GST_STATE_READY),
|
|
|
|
GST_STATE_CHANGE_SUCCESS);
|
|
|
|
|
|
|
|
/* get the source pad */
|
|
|
|
src_pad = gst_element_get_static_pad (src, "src");
|
|
|
|
fail_unless (src_pad != NULL);
|
|
|
|
|
|
|
|
/* activate the pad in pull mode */
|
|
|
|
fail_unless (gst_pad_activate_mode (src_pad, GST_PAD_MODE_PULL, TRUE));
|
|
|
|
|
|
|
|
/* now start playing */
|
|
|
|
fail_unless_equals_int (gst_element_set_state (src, GST_STATE_PLAYING),
|
|
|
|
GST_STATE_CHANGE_SUCCESS);
|
|
|
|
|
|
|
|
/* Check that dataurisrc is seekable */
|
|
|
|
seeking_query = gst_query_new_seeking (GST_FORMAT_BYTES);
|
|
|
|
fail_unless (gst_element_query (src, seeking_query) == TRUE);
|
|
|
|
gst_query_parse_seeking (seeking_query, NULL, &seekable, &start, &stop);
|
|
|
|
fail_unless (seekable == TRUE);
|
|
|
|
fail_unless_equals_int64 (start, 0);
|
|
|
|
fail_unless_equals_int64 (stop, data_size);
|
|
|
|
gst_query_unref (seeking_query);
|
|
|
|
|
|
|
|
seeking_query = gst_query_new_seeking (GST_FORMAT_BYTES);
|
|
|
|
fail_unless (gst_pad_query (src_pad, seeking_query) == TRUE);
|
|
|
|
gst_query_parse_seeking (seeking_query, NULL, &seekable, &start, &stop);
|
|
|
|
fail_unless (seekable == TRUE);
|
|
|
|
fail_unless_equals_int64 (start, 0);
|
|
|
|
fail_unless_equals_int64 (stop, data_size);
|
|
|
|
gst_query_unref (seeking_query);
|
|
|
|
|
|
|
|
seeking_query = gst_query_new_seeking (GST_FORMAT_TIME);
|
|
|
|
fail_unless (gst_pad_query (src_pad, seeking_query) == FALSE);
|
|
|
|
gst_query_unref (seeking_query);
|
|
|
|
|
|
|
|
/* do some pulls */
|
|
|
|
buf1 = NULL;
|
|
|
|
flow = gst_pad_get_range (src_pad, 0, 100, &buf1);
|
|
|
|
fail_unless_equals_int (flow, GST_FLOW_OK);
|
|
|
|
fail_unless (buf1 != NULL);
|
|
|
|
fail_unless_equals_int (gst_buffer_get_size (buf1), 100);
|
|
|
|
fail_unless (gst_buffer_memcmp (buf1, 0, data, 100) == 0);
|
|
|
|
|
|
|
|
buf2 = NULL;
|
|
|
|
flow = gst_pad_get_range (src_pad, 0, 50, &buf2);
|
|
|
|
fail_unless_equals_int (flow, GST_FLOW_OK);
|
|
|
|
fail_unless (buf2 != NULL);
|
|
|
|
fail_unless_equals_int (gst_buffer_get_size (buf2), 50);
|
|
|
|
fail_unless (gst_buffer_memcmp (buf2, 0, data, 50) == 0);
|
|
|
|
gst_buffer_unref (buf2);
|
|
|
|
gst_buffer_unref (buf1);
|
|
|
|
|
|
|
|
/* read next 50 bytes */
|
|
|
|
buf2 = NULL;
|
|
|
|
flow = gst_pad_get_range (src_pad, 50, 50, &buf2);
|
|
|
|
fail_unless_equals_int (flow, GST_FLOW_OK);
|
|
|
|
fail_unless (buf2 != NULL);
|
|
|
|
fail_unless_equals_int (gst_buffer_get_size (buf2), 50);
|
|
|
|
fail_unless (gst_buffer_memcmp (buf2, 0, data + 50, 50) == 0);
|
|
|
|
gst_buffer_unref (buf2);
|
|
|
|
|
|
|
|
buf1 = NULL;
|
|
|
|
flow = gst_pad_get_range (src_pad, 1, 100, &buf1);
|
|
|
|
fail_unless_equals_int (flow, GST_FLOW_OK);
|
|
|
|
fail_unless (buf1 != NULL);
|
|
|
|
fail_unless_equals_int (gst_buffer_get_size (buf1), 100);
|
|
|
|
fail_unless (gst_buffer_memcmp (buf1, 0, data + 1, 100) == 0);
|
|
|
|
gst_buffer_unref (buf1);
|
|
|
|
|
|
|
|
buf1 = NULL;
|
|
|
|
flow = gst_pad_get_range (src_pad, 0, 999999, &buf1);
|
|
|
|
fail_unless_equals_int (flow, GST_FLOW_OK);
|
|
|
|
fail_unless (buf1 != NULL);
|
|
|
|
fail_unless_equals_int (gst_buffer_get_size (buf1), data_size);
|
|
|
|
fail_unless (gst_buffer_memcmp (buf1, 0, data, data_size) == 0);
|
|
|
|
gst_buffer_unref (buf1);
|
|
|
|
|
|
|
|
buf1 = NULL;
|
|
|
|
flow = gst_pad_get_range (src_pad, 50, 999999, &buf1);
|
|
|
|
fail_unless_equals_int (flow, GST_FLOW_OK);
|
|
|
|
fail_unless (buf1 != NULL);
|
|
|
|
fail_unless_equals_int (gst_buffer_get_size (buf1), data_size - 50);
|
|
|
|
fail_unless (gst_buffer_memcmp (buf1, 0, data + 50, data_size - 50) == 0);
|
|
|
|
gst_buffer_unref (buf1);
|
2010-02-13 15:28:39 +00:00
|
|
|
|
2016-11-28 11:08:24 +00:00
|
|
|
/* read 10 bytes at end-10 should give exactly 10 bytes */
|
|
|
|
buf1 = NULL;
|
|
|
|
flow = gst_pad_get_range (src_pad, data_size - 10, 10, &buf1);
|
|
|
|
fail_unless_equals_int (flow, GST_FLOW_OK);
|
|
|
|
fail_unless (buf1 != NULL);
|
|
|
|
fail_unless_equals_int (gst_buffer_get_size (buf1), 10);
|
|
|
|
gst_buffer_unref (buf1);
|
2010-02-13 15:28:39 +00:00
|
|
|
|
2016-11-28 11:08:24 +00:00
|
|
|
/* read 20 bytes at end-10 should give exactly 10 bytes */
|
|
|
|
buf1 = NULL;
|
|
|
|
flow = gst_pad_get_range (src_pad, data_size - 10, 20, &buf1);
|
|
|
|
fail_unless_equals_int (flow, GST_FLOW_OK);
|
|
|
|
fail_unless (buf1 != NULL);
|
|
|
|
fail_unless_equals_int (gst_buffer_get_size (buf1), 10);
|
|
|
|
gst_buffer_unref (buf1);
|
|
|
|
|
|
|
|
/* read 0 bytes at end-1 should return 0 bytes */
|
|
|
|
buf1 = NULL;
|
|
|
|
flow = gst_pad_get_range (src_pad, data_size - 1, 0, &buf1);
|
|
|
|
fail_unless_equals_int (flow, GST_FLOW_OK);
|
|
|
|
fail_unless (buf1 != NULL);
|
|
|
|
fail_unless_equals_int (gst_buffer_get_size (buf1), 0);
|
|
|
|
gst_buffer_unref (buf1);
|
|
|
|
|
|
|
|
/* read 10 bytes at end-1 should return 1 byte */
|
|
|
|
buf1 = NULL;
|
|
|
|
flow = gst_pad_get_range (src_pad, stop - 1, 10, &buf1);
|
|
|
|
fail_unless_equals_int (flow, GST_FLOW_OK);
|
|
|
|
fail_unless (buf1 != NULL);
|
|
|
|
fail_unless (gst_buffer_get_size (buf1) == 1);
|
|
|
|
gst_buffer_unref (buf1);
|
|
|
|
|
|
|
|
/* read 0 bytes at end should EOS */
|
|
|
|
buf1 = NULL;
|
|
|
|
flow = gst_pad_get_range (src_pad, data_size, 0, &buf1);
|
|
|
|
fail_unless_equals_int (flow, GST_FLOW_EOS);
|
|
|
|
|
|
|
|
/* read 10 bytes after end should EOS */
|
|
|
|
buf1 = NULL;
|
|
|
|
flow = gst_pad_get_range (src_pad, data_size, 10, &buf1);
|
|
|
|
fail_unless_equals_int (flow, GST_FLOW_EOS);
|
|
|
|
|
|
|
|
/* read 0 bytes after end should EOS */
|
|
|
|
buf1 = NULL;
|
|
|
|
flow = gst_pad_get_range (src_pad, data_size + 10, 0, &buf1);
|
|
|
|
fail_unless_equals_int (flow, GST_FLOW_EOS);
|
|
|
|
|
|
|
|
/* read 10 bytes after end should EOS too */
|
|
|
|
buf1 = NULL;
|
|
|
|
flow = gst_pad_get_range (src_pad, data_size + 10, 10, &buf1);
|
|
|
|
fail_unless_equals_int (flow, GST_FLOW_EOS);
|
|
|
|
|
|
|
|
fail_unless_equals_int (gst_element_set_state (src, GST_STATE_NULL),
|
|
|
|
GST_STATE_CHANGE_SUCCESS);
|
|
|
|
|
|
|
|
gst_object_unref (src_pad);
|
|
|
|
cleanup_dataurisrc (src);
|
|
|
|
g_free (data);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
|
|
|
static GstBuffer *
|
|
|
|
dataurisrc_wait_for_eos_and_get_data_buffer (void)
|
|
|
|
{
|
|
|
|
GstBuffer *buf;
|
|
|
|
|
|
|
|
g_mutex_lock (&event_mutex);
|
|
|
|
while (!have_eos)
|
|
|
|
g_cond_wait (&eos_cond, &event_mutex);
|
|
|
|
g_mutex_unlock (&event_mutex);
|
|
|
|
|
|
|
|
buf = gst_buffer_new ();
|
|
|
|
while (buffers != NULL) {
|
|
|
|
buf = gst_buffer_append (buf, buffers->data);
|
|
|
|
buffers = g_list_delete_link (buffers, buffers);
|
2010-02-13 15:28:39 +00:00
|
|
|
}
|
|
|
|
|
2016-11-28 11:08:24 +00:00
|
|
|
return buf;
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_START_TEST (test_dataurisrc_push)
|
|
|
|
{
|
|
|
|
GstElement *src;
|
|
|
|
GstBuffer *buf;
|
|
|
|
|
|
|
|
data = g_base64_decode (data_uri + 22, &data_size);
|
|
|
|
fail_unless (data != NULL);
|
|
|
|
|
|
|
|
src = setup_dataurisrc ();
|
|
|
|
|
|
|
|
g_object_set (src, "uri", data_uri, NULL);
|
|
|
|
|
|
|
|
fail_unless_equals_int (gst_element_set_state (src, GST_STATE_PLAYING),
|
|
|
|
GST_STATE_CHANGE_SUCCESS);
|
|
|
|
|
|
|
|
/* Everything */
|
|
|
|
buf = dataurisrc_wait_for_eos_and_get_data_buffer ();
|
|
|
|
fail_unless_equals_int (gst_buffer_get_size (buf), data_size);
|
|
|
|
fail_unless (gst_buffer_memcmp (buf, 0, data, data_size) == 0);
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
|
|
|
|
/* 500 - 1000 */
|
|
|
|
have_eos = FALSE;
|
|
|
|
gst_pad_push_event (mysinkpad,
|
|
|
|
gst_event_new_seek (1.0, GST_FORMAT_BYTES, GST_SEEK_FLAG_FLUSH,
|
|
|
|
GST_SEEK_TYPE_SET, 500, GST_SEEK_TYPE_SET, 1000));
|
|
|
|
|
|
|
|
buf = dataurisrc_wait_for_eos_and_get_data_buffer ();
|
|
|
|
fail_unless_equals_int (gst_buffer_get_size (buf), 500);
|
|
|
|
fail_unless (gst_buffer_memcmp (buf, 0, data + 500, 500) == 0);
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
|
|
|
|
/* only start changed, stop kept the same (ie. 1000), so 1000-1000 now */
|
|
|
|
have_eos = FALSE;
|
|
|
|
gst_pad_push_event (mysinkpad,
|
|
|
|
gst_event_new_seek (1.0, GST_FORMAT_BYTES, GST_SEEK_FLAG_FLUSH,
|
|
|
|
GST_SEEK_TYPE_SET, 1000, GST_SEEK_TYPE_NONE, -1));
|
|
|
|
|
|
|
|
buf = dataurisrc_wait_for_eos_and_get_data_buffer ();
|
|
|
|
fail_unless_equals_int (gst_buffer_get_size (buf), 0);
|
|
|
|
gst_buffer_unref (buf);
|
2010-02-13 15:28:39 +00:00
|
|
|
|
2016-11-28 11:08:24 +00:00
|
|
|
/* 1000-end */
|
|
|
|
have_eos = FALSE;
|
|
|
|
gst_pad_push_event (mysinkpad,
|
|
|
|
gst_event_new_seek (1.0, GST_FORMAT_BYTES, GST_SEEK_FLAG_FLUSH,
|
|
|
|
GST_SEEK_TYPE_SET, 1000, GST_SEEK_TYPE_SET, -1));
|
2010-02-13 15:28:39 +00:00
|
|
|
|
2016-11-28 11:08:24 +00:00
|
|
|
buf = dataurisrc_wait_for_eos_and_get_data_buffer ();
|
|
|
|
fail_unless_equals_int (gst_buffer_get_size (buf), data_size - 1000);
|
|
|
|
fail_unless (gst_buffer_memcmp (buf, 0, data + 1000, data_size - 1000) == 0);
|
|
|
|
gst_buffer_unref (buf);
|
2010-02-13 15:28:39 +00:00
|
|
|
|
2016-11-28 11:08:24 +00:00
|
|
|
fail_unless_equals_int (gst_element_set_state (src, GST_STATE_NULL),
|
|
|
|
GST_STATE_CHANGE_SUCCESS);
|
2010-02-13 15:28:39 +00:00
|
|
|
|
2016-11-28 11:08:24 +00:00
|
|
|
cleanup_dataurisrc (src);
|
|
|
|
g_free (data);
|
|
|
|
}
|
2010-02-13 15:28:39 +00:00
|
|
|
|
2016-11-28 11:08:24 +00:00
|
|
|
GST_END_TEST;
|
2010-02-13 15:28:39 +00:00
|
|
|
|
2016-11-28 11:08:24 +00:00
|
|
|
GST_START_TEST (test_dataurisrc_uri_iface)
|
|
|
|
{
|
|
|
|
const gchar *const *protocols;
|
|
|
|
GstElement *src;
|
|
|
|
gchar *uri = NULL;
|
|
|
|
|
|
|
|
src = gst_element_factory_make ("dataurisrc", NULL);
|
|
|
|
fail_unless (gst_uri_handler_get_uri (GST_URI_HANDLER (src)) == NULL);
|
|
|
|
fail_unless_equals_int (gst_uri_handler_get_uri_type (GST_URI_HANDLER (src)),
|
|
|
|
GST_URI_SRC);
|
|
|
|
protocols = gst_uri_handler_get_protocols (GST_URI_HANDLER (src));
|
|
|
|
fail_unless (protocols != NULL && *protocols != NULL);
|
|
|
|
fail_unless (g_strv_contains (protocols, "data"));
|
|
|
|
fail_if (gst_uri_handler_set_uri (GST_URI_HANDLER (src), "file:///foo",
|
|
|
|
NULL));
|
|
|
|
fail_unless (gst_uri_handler_set_uri (GST_URI_HANDLER (src), data_uri, NULL));
|
|
|
|
g_object_get (src, "uri", &uri, NULL);
|
|
|
|
fail_unless_equals_string (uri, data_uri);
|
|
|
|
g_free (uri);
|
|
|
|
uri = gst_uri_handler_get_uri (GST_URI_HANDLER (src));
|
|
|
|
fail_unless (uri, data_uri);
|
|
|
|
g_free (uri);
|
|
|
|
gst_object_unref (src);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
|
|
|
GST_START_TEST (test_dataurisrc_from_uri)
|
|
|
|
{
|
|
|
|
GstElement *src, *sink;
|
2010-02-13 15:28:39 +00:00
|
|
|
|
2016-11-28 11:08:24 +00:00
|
|
|
sink = gst_element_make_from_uri (GST_URI_SINK, data_uri, NULL, NULL);
|
|
|
|
fail_unless (sink == NULL);
|
2010-02-13 15:28:39 +00:00
|
|
|
|
2016-11-28 11:08:24 +00:00
|
|
|
src = gst_element_make_from_uri (GST_URI_SRC, data_uri, NULL, NULL);
|
|
|
|
fail_unless (src != NULL);
|
|
|
|
gst_object_unref (src);
|
2010-02-13 15:28:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2019-05-22 07:44:50 +00:00
|
|
|
GST_START_TEST (test_dataurisrc_uris)
|
|
|
|
{
|
|
|
|
#define STRING_CONTENT(s) s, sizeof(s) - 1
|
|
|
|
static const struct
|
|
|
|
{
|
|
|
|
const char *name;
|
|
|
|
const char *uri;
|
|
|
|
const char *mimetype;
|
|
|
|
const char *contents;
|
|
|
|
gsize contents_len;
|
|
|
|
} tests[] = {
|
|
|
|
/* *INDENT-OFF* */
|
|
|
|
{"simple", "data:,HelloWorld", NULL, STRING_CONTENT ("HelloWorld")},
|
|
|
|
{"nodata", "data:,", NULL, STRING_CONTENT ("")},
|
|
|
|
{"case_sensitive", "dATa:,HelloWorld", NULL, STRING_CONTENT ("HelloWorld")},
|
|
|
|
{"semicolon_after_comma", "data:,;base64", NULL,
|
|
|
|
STRING_CONTENT (";base64")},
|
|
|
|
{"mimetype", "data:image/png,nopng", "image/png", STRING_CONTENT ("nopng")},
|
|
|
|
{"charset_base64",
|
|
|
|
"data:text/plain;charset=ISO-8859-5;base64,wOPh29DdILjW0ePb0OLe0g==",
|
|
|
|
"text/plain", STRING_CONTENT ("Руслан Ижбулатов")},
|
|
|
|
/* *INDENT-ON* */
|
|
|
|
};
|
|
|
|
gint i;
|
|
|
|
#undef STRING_CONTENT
|
|
|
|
|
|
|
|
for (i = 0; i < G_N_ELEMENTS (tests); i++) {
|
|
|
|
GstHarness *h;
|
|
|
|
GstElement *src;
|
|
|
|
GstBuffer *buf;
|
|
|
|
|
|
|
|
src = gst_element_factory_make ("dataurisrc", NULL);
|
|
|
|
g_object_set (src, "uri", tests[i].uri, NULL);
|
|
|
|
h = gst_harness_new_with_element (src, NULL, "src");
|
|
|
|
gst_harness_play (h);
|
|
|
|
|
|
|
|
buf = gst_harness_pull (h);
|
|
|
|
fail_unless (buf);
|
|
|
|
|
|
|
|
gst_check_buffer_data (buf, tests[i].contents, tests[i].contents_len);
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
|
|
|
|
gst_harness_teardown (h);
|
|
|
|
gst_object_unref (src);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2010-02-13 15:28:39 +00:00
|
|
|
static Suite *
|
|
|
|
dataurisrc_suite (void)
|
|
|
|
{
|
|
|
|
Suite *s = suite_create ("dataurisrc");
|
|
|
|
TCase *tc_chain = tcase_create ("general");
|
|
|
|
|
|
|
|
suite_add_tcase (s, tc_chain);
|
|
|
|
|
2016-11-28 11:08:24 +00:00
|
|
|
tcase_add_test (tc_chain, test_dataurisrc_pull);
|
|
|
|
tcase_add_test (tc_chain, test_dataurisrc_push);
|
|
|
|
tcase_add_test (tc_chain, test_dataurisrc_uri_iface);
|
|
|
|
tcase_add_test (tc_chain, test_dataurisrc_from_uri);
|
2019-05-22 07:44:50 +00:00
|
|
|
tcase_add_test (tc_chain, test_dataurisrc_uris);
|
2010-02-13 15:28:39 +00:00
|
|
|
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_CHECK_MAIN (dataurisrc);
|