summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac8
-rw-r--r--lib/insanity-gst/insanitygstpipelinetest.c71
-rw-r--r--lib/insanity-gst/insanitygsttest.c16
-rw-r--r--tests/Makefile.am8
-rw-r--r--tests/insanity-fake-appsink.c11
-rw-r--r--tests/insanity-file-appsrc.c12
-rw-r--r--tests/insanity-http-server.c54
-rw-r--r--tests/insanity-test-gst-decoder.c43
-rw-r--r--tests/insanity-test-gst-demuxer.c117
-rw-r--r--tests/insanity-test-gst-discoverer.c14
-rw-r--r--tests/insanity-test-gst-dvd.c6
-rw-r--r--tests/insanity-test-gst-hls.c44
-rw-r--r--tests/insanity-test-gst-http.c7
-rw-r--r--tests/insanity-test-gst-play.c6
-rw-r--r--tests/insanity-test-gst-rtsp.c11
-rw-r--r--tests/insanity-test-gst-seek.c38
-rw-r--r--tests/insanity-test-gst-stream-switch.c354
-rw-r--r--tests/insanity-test-gst-subtitles.c73
-rw-r--r--tests/media-descriptor-parser.c4
-rw-r--r--tests/media-descriptor-writer.c2
20 files changed, 403 insertions, 496 deletions
diff --git a/configure.ac b/configure.ac
index ad5940e..8b02b01 100644
--- a/configure.ac
+++ b/configure.ac
@@ -28,9 +28,9 @@ dnl 6. If any interfaces have been removed since the last public release,
dnl then set AGE to 0.
LIBINSANITY_GST_SHARED_VERSION="0:0:0"
AC_SUBST(LIBINSANITY_GST_SHARED_VERSION)
-LIBINSANITY_GST_API_VERSION=0.10
+LIBINSANITY_GST_API_VERSION=1.0
AC_SUBST(LIBINSANITY_GST_API_VERSION)
-GST_TARGET=0.10
+GST_TARGET=1.0
AC_SUBST(GST_TARGET)
# automake 1.12 seems to require this, but automake 1.11 doesn't recognize it
@@ -71,14 +71,14 @@ PKG_CHECK_MODULES(GIO, gio-2.0 >= 2.30)
PKG_CHECK_MODULES(GST, gstreamer-${GST_TARGET})
PKG_CHECK_MODULES(GST_BASE, gstreamer-base-${GST_TARGET})
PKG_CHECK_MODULES(GST_PBUTILS, gstreamer-pbutils-${GST_TARGET})
-PKG_CHECK_MODULES(GST_INTERFACES, gstreamer-interfaces-${GST_TARGET})
+PKG_CHECK_MODULES(GST_AUDIO, gstreamer-audio-${GST_TARGET})
PKG_CHECK_MODULES(GST_VIDEO, gstreamer-video-${GST_TARGET})
PKG_CHECK_MODULES(INSANITY, insanity-1.0)
dnl optional packages
PKG_CHECK_MODULES(SOUP, libsoup-2.4, HAVE_SOUP=yes, HAVE_SOUP=no)
AM_CONDITIONAL(HAVE_SOUP,test "$HAVE_SOUP" = "yes")
-PKG_CHECK_MODULES(GST_RTSP_SERVER, gst-rtsp-server-0.10, HAVE_GST_RTSP_SERVER=yes, HAVE_GST_RTSP_SERVER=no)
+PKG_CHECK_MODULES(GST_RTSP_SERVER, gstreamer-rtsp-server-${GST_TARGET}, HAVE_GST_RTSP_SERVER=yes, HAVE_GST_RTSP_SERVER=no)
AM_CONDITIONAL(HAVE_GST_RTSP_SERVER,test "$HAVE_GST_RTSP_SERVER" = "yes")
dnl check for gobject-introspection
diff --git a/lib/insanity-gst/insanitygstpipelinetest.c b/lib/insanity-gst/insanitygstpipelinetest.c
index 120eb2d..6254dda 100644
--- a/lib/insanity-gst/insanitygstpipelinetest.c
+++ b/lib/insanity-gst/insanitygstpipelinetest.c
@@ -159,19 +159,19 @@ watch_container (InsanityGstPipelineTest * ptest, GstBin * bin)
{
GstIterator *it;
gboolean done = FALSE;
- gpointer data;
+ GValue data = { 0, };
GstElement *e;
it = gst_bin_iterate_elements (bin);
while (!done) {
switch (gst_iterator_next (it, &data)) {
case GST_ITERATOR_OK:
- e = GST_ELEMENT_CAST (data);
+ e = GST_ELEMENT_CAST (g_value_get_object (&data));
add_element_used (ptest, e);
if (GST_IS_BIN (e)) {
watch_container (ptest, GST_BIN (e));
}
- gst_object_unref (e);
+ g_value_reset (&data);
break;
case GST_ITERATOR_RESYNC:
gst_iterator_resync (it);
@@ -182,6 +182,7 @@ watch_container (InsanityGstPipelineTest * ptest, GstBin * bin)
break;
}
}
+ g_value_unset (&data);
gst_iterator_free (it);
return g_signal_connect (bin, "element-added", (GCallback) on_element_added,
@@ -216,20 +217,24 @@ send_tag (const GstTagList * list, const gchar * tag, gpointer data)
if (gst_tag_get_type (tag) == G_TYPE_STRING) {
if (!gst_tag_list_get_string_index (list, tag, i, &str))
g_assert_not_reached ();
- } else if (gst_tag_get_type (tag) == GST_TYPE_BUFFER) {
- GstBuffer *img;
+ } else if (gst_tag_get_type (tag) == GST_TYPE_SAMPLE) {
+ GstSample *img;
- img = gst_value_get_buffer (gst_tag_list_get_value_index (list, tag, i));
+ img = gst_value_get_sample (gst_tag_list_get_value_index (list, tag, i));
if (img) {
+ GstBuffer *buffer;
+ GstCaps *caps;
gchar *caps_str;
- caps_str = GST_BUFFER_CAPS (img) ?
- gst_caps_to_string (GST_BUFFER_CAPS (img)) : g_strdup ("unknown");
- str = g_strdup_printf ("buffer of %u bytes, type: %s",
- GST_BUFFER_SIZE (img), caps_str);
+ buffer = gst_sample_get_buffer (img);
+ caps = gst_sample_get_caps (img);
+
+ caps_str = caps ? gst_caps_to_string (caps) : g_strdup ("unknown");
+ str = g_strdup_printf ("sample of %" G_GSIZE_FORMAT " bytes, type: %s",
+ gst_buffer_get_size (buffer), caps_str);
g_free (caps_str);
} else {
- str = g_strdup ("NULL buffer");
+ str = g_strdup ("NULL sample");
}
} else if (gst_tag_get_type (tag) == GST_TYPE_DATE_TIME) {
GstDateTime *dt = NULL;
@@ -297,16 +302,15 @@ insanity_gst_pipeline_test_query_duration (InsanityGstPipelineTest * ptest,
GstFormat fmt, gint64 * duration)
{
gboolean res;
- GstFormat fmt_tmp = fmt;
gint64 dur = -1;
g_return_val_if_fail (INSANITY_IS_GST_PIPELINE_TEST (ptest), FALSE);
res =
- gst_element_query_duration (GST_ELEMENT (ptest->priv->pipeline), &fmt_tmp,
+ gst_element_query_duration (GST_ELEMENT (ptest->priv->pipeline), fmt,
&dur);
- if (res && fmt == fmt_tmp && dur != -1) {
+ if (res && dur != -1) {
g_signal_emit (ptest, duration_signal, gst_format_to_quark (fmt), fmt, dur,
NULL);
if (duration)
@@ -716,41 +720,6 @@ insanity_gst_pipeline_test_finalize (GObject * gobject)
G_OBJECT_CLASS (insanity_gst_pipeline_test_parent_class)->finalize (gobject);
}
-#define g_marshal_value_peek_object(v) g_value_get_object (v)
-static void
-insanity_cclosure_user_marshal_BOOLEAN__MINIOBJECT (GClosure * closure,
- GValue * return_value G_GNUC_UNUSED,
- guint n_param_values,
- const GValue * param_values,
- gpointer invocation_hint G_GNUC_UNUSED, gpointer marshal_data)
-{
- typedef gboolean (*GMarshalFunc_BOOLEAN__MINIOBJECT) (gpointer data1,
- gpointer arg_1, gpointer data2);
- register GMarshalFunc_BOOLEAN__MINIOBJECT callback;
- register GCClosure *cc = (GCClosure *) closure;
- register gpointer data1, data2;
- gboolean v_return;
-
- g_return_if_fail (return_value != NULL);
- g_return_if_fail (n_param_values == 2);
-
- if (G_CCLOSURE_SWAP_DATA (closure)) {
- data1 = closure->data;
- data2 = g_value_peek_pointer (param_values + 0);
- } else {
- data1 = g_value_peek_pointer (param_values + 0);
- data2 = closure->data;
- }
- callback =
- (GMarshalFunc_BOOLEAN__MINIOBJECT) (marshal_data ? marshal_data :
- cc->callback);
-
- v_return = callback (data1,
- gst_value_get_mini_object (param_values + 1), data2);
-
- g_value_set_boolean (return_value, v_return);
-}
-
static gboolean
stop_accumulator (GSignalInvocationHint * ihint,
GValue * return_accu, const GValue * handler_return, gpointer data)
@@ -792,9 +761,7 @@ insanity_gst_pipeline_test_class_init (InsanityGstPipelineTestClass * klass)
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST | G_SIGNAL_NO_RECURSE | G_SIGNAL_NO_HOOKS,
G_STRUCT_OFFSET (InsanityGstPipelineTestClass, bus_message),
- &stop_accumulator, NULL,
- insanity_cclosure_user_marshal_BOOLEAN__MINIOBJECT,
- G_TYPE_BOOLEAN /* return_type */ ,
+ &stop_accumulator, NULL, NULL, G_TYPE_BOOLEAN /* return_type */ ,
1, GST_TYPE_MESSAGE, NULL);
reached_initial_state_signal = g_signal_new ("reached-initial-state",
G_TYPE_FROM_CLASS (klass),
diff --git a/lib/insanity-gst/insanitygsttest.c b/lib/insanity-gst/insanitygsttest.c
index 97ee1c6..e0f1cf1 100644
--- a/lib/insanity-gst/insanitygsttest.c
+++ b/lib/insanity-gst/insanitygsttest.c
@@ -182,10 +182,14 @@ free_data_probe_ctx (DataProbeCtx * ctx)
g_slice_free (DataProbeCtx, ctx);
}
-static gboolean
-data_probe_cb (GstPad * pad, GstMiniObject * obj, DataProbeCtx * ctx)
+static GstPadProbeReturn
+data_probe_cb (GstPad * pad, GstPadProbeInfo * info, DataProbeCtx * ctx)
{
- return ctx->func (ctx->test, pad, obj, ctx->user_data);
+ gboolean ret;
+
+ ret = ctx->func (ctx->test, pad, info->data, ctx->user_data);
+
+ return ret ? GST_PAD_PROBE_OK : GST_PAD_PROBE_DROP;
}
/**
@@ -246,8 +250,8 @@ insanity_gst_test_add_data_probe (InsanityGstTest * test, GstBin * bin,
ctx->user_data = user_data;
ctx->dnotify = dnotify;
- *probe_id =
- gst_pad_add_data_probe_full (*pad, (GCallback) data_probe_cb, ctx,
+ *probe_id = gst_pad_add_probe (*pad, GST_PAD_PROBE_TYPE_ALL_BOTH,
+ (GstPadProbeCallback) data_probe_cb, ctx,
(GDestroyNotify) free_data_probe_ctx);
if (*probe_id != 0) {
@@ -281,5 +285,5 @@ insanity_gst_test_remove_data_probe (InsanityGstTest * test,
g_return_if_fail (GST_IS_PAD (pad));
g_return_if_fail (probe != 0);
- gst_pad_remove_data_probe (pad, probe);
+ gst_pad_remove_probe (pad, probe);
}
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 9faec43..3e83269 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -32,8 +32,8 @@ insanity_test_gst_seek_CFLAGS=$(common_cflags)
insanity_test_gst_seek_LDADD=../lib/insanity-gst/libinsanity-gst-@GST_TARGET@.la $(common_ldadd) $(GIO_LIBS) libinsanityhelper.la
insanity_test_gst_dvd_SOURCES=insanity-test-gst-dvd.c
-insanity_test_gst_dvd_CFLAGS=$(GST_INTERFACES_CFLAGS) $(common_cflags)
-insanity_test_gst_dvd_LDADD=../lib/insanity-gst/libinsanity-gst-@GST_TARGET@.la $(GST_INTERFACES_LIBS) $(common_ldadd)
+insanity_test_gst_dvd_CFLAGS=$(GST_VIDEO_CFLAGS) $(common_cflags)
+insanity_test_gst_dvd_LDADD=../lib/insanity-gst/libinsanity-gst-@GST_TARGET@.la $(GST_VIDEO_LIBS) $(common_ldadd)
insanity_test_gst_demuxer_SOURCES=insanity-test-gst-demuxer.c
insanity_test_gst_demuxer_CFLAGS=$(GST_PBUTILS_CFLAGS) $(GST_INTERFACES_CFLAGS) $(common_cflags)
@@ -44,8 +44,8 @@ insanity_test_gst_decoder_CFLAGS=$(GST_INTERFACES_CFLAGS) $(common_cflags)
insanity_test_gst_decoder_LDADD=../lib/insanity-gst/libinsanity-gst-@GST_TARGET@.la libtestsxmlhelper.la $(GST_INTERFACES_LIBS) $(common_ldadd)
insanity_test_gst_stream_switch_SOURCES=insanity-test-gst-stream-switch.c
-insanity_test_gst_stream_switch_CFLAGS=$(GST_VIDEO_CFLAGS) $(GST_BASE_CFLAGS) $(common_cflags)
-insanity_test_gst_stream_switch_LDADD=../lib/insanity-gst/libinsanity-gst-@GST_TARGET@.la $(GST_VIDEO_LIBS) $(GST_BASE_LIBS) $(common_ldadd)
+insanity_test_gst_stream_switch_CFLAGS=$(GST_AUDIO_CFLAGS) $(GST_VIDEO_CFLAGS) $(GST_BASE_CFLAGS) $(common_cflags)
+insanity_test_gst_stream_switch_LDADD=../lib/insanity-gst/libinsanity-gst-@GST_TARGET@.la $(GST_AUDIO_LIBS) $(GST_VIDEO_LIBS) $(GST_BASE_LIBS) $(common_ldadd)
insanity_test_gst_discoverer_SOURCES=insanity-test-gst-discoverer.c
insanity_test_gst_discoverer_CFLAGS=$(GST_PBUTILS_CFLAGS) $(common_cflags)
diff --git a/tests/insanity-fake-appsink.c b/tests/insanity-fake-appsink.c
index 333e5ce..0861388 100644
--- a/tests/insanity-fake-appsink.c
+++ b/tests/insanity-fake-appsink.c
@@ -57,8 +57,8 @@ on_new_buffer (GstElement * appsink, gpointer userdata)
}
-static gboolean
-cb_have_data (GstPad * pad, GstBuffer * buffer, gpointer u_data)
+static GstPadProbeReturn
+cb_have_data (GstPad * pad, GstPadProbeInfo * info, gpointer u_data)
{
App *app = NULL;
@@ -73,8 +73,7 @@ cb_have_data (GstPad * pad, GstBuffer * buffer, gpointer u_data)
gst_object_unref (appsink);
- return TRUE;
-
+ return GST_PAD_PROBE_OK;
}
static void
@@ -130,8 +129,8 @@ insanity_fake_appsink_new (const gchar * name, InsanityTest * test)
app->appsink = appsink;
app->test = test;
- pad = gst_element_get_pad (appsink, "sink");
- gst_pad_add_buffer_probe (pad, G_CALLBACK (cb_have_data), NULL);
+ pad = gst_element_get_static_pad (appsink, "sink");
+ gst_pad_add_probe (pad, GST_PAD_PROBE_TYPE_BUFFER, cb_have_data, NULL, NULL);
gst_object_unref (pad);
g_object_set_qdata_full ((GObject *) appsink,
diff --git a/tests/insanity-file-appsrc.c b/tests/insanity-file-appsrc.c
index 1e092e5..25976d1 100644
--- a/tests/insanity-file-appsrc.c
+++ b/tests/insanity-file-appsrc.c
@@ -60,6 +60,7 @@ static void
feed_data (GstElement * appsrc, guint size, App * app)
{
GstBuffer *buffer;
+ GstMapInfo minfo;
gsize len;
GstFlowReturn ret;
GError *error = NULL;
@@ -73,12 +74,13 @@ feed_data (GstElement * appsrc, guint size, App * app)
size = app->length - app->offset;
}
- buffer = gst_buffer_new_and_alloc (size);
+ buffer = gst_buffer_new_allocate (NULL, size, NULL);
+ gst_buffer_map (buffer, &minfo, GST_MAP_WRITE);
if (g_str_has_prefix (app->mode, "random-access")) {
/* read the amount of data, we are allowed to return less if we are EOS */
g_input_stream_read_all (G_INPUT_STREAM (app->stream),
- GST_BUFFER_DATA (buffer), size, &len, NULL, &error);
+ minfo.data, size, &len, NULL, &error);
if (error) {
LOG ("ERROR: %s\n", error->message);
g_error_free (error);
@@ -89,14 +91,14 @@ feed_data (GstElement * appsrc, guint size, App * app)
} else {
/* read any amount of data, we are allowed to return less if we are EOS */
len = g_input_stream_read (G_INPUT_STREAM (app->stream),
- GST_BUFFER_DATA (buffer), size, NULL, &error);
+ minfo.data, size, NULL, &error);
if (error) {
LOG ("ERROR: %s\n", error->message);
g_error_free (error);
}
}
-
- GST_BUFFER_SIZE (buffer) = len;
+ gst_buffer_unmap (buffer, &minfo);
+ gst_buffer_set_size (buffer, len);
if (error) {
LOG ("Cannot read file: %s\n", error->message);
diff --git a/tests/insanity-http-server.c b/tests/insanity-http-server.c
index 1ac61d7..eb7f826 100644
--- a/tests/insanity-http-server.c
+++ b/tests/insanity-http-server.c
@@ -35,7 +35,6 @@
#include <glib.h>
#include <string.h>
-#include <gst/gstmarshal.h>
#include <libsoup/soup-address.h>
#include <libsoup/soup-message.h>
#include <libsoup/soup-misc.h>
@@ -130,6 +129,8 @@ typedef struct
gsize size;
const char *contents;
const char *ptr;
+
+ GstMapInfo minfo;
} ChunkedTransmitter;
G_DEFINE_TYPE (InsanityHttpServer, insanity_http_server, G_TYPE_OBJECT);
@@ -226,40 +227,6 @@ insanity_http_server_get_property (GObject * gobject,
}
}
-#define g_marshal_value_peek_object(v) g_value_get_object (v)
-static void
-insanity_cclosure_user_marshal_GSTBUFFER__VOID (GClosure * closure,
- GValue * return_value G_GNUC_UNUSED,
- guint n_param_values,
- const GValue * param_values,
- gpointer invocation_hint G_GNUC_UNUSED, gpointer marshal_data)
-{
- typedef GstBuffer *(*GMarshalFunc_GSTBUFFER__VOID) (gpointer data1,
- gpointer data2);
- register GMarshalFunc_GSTBUFFER__VOID callback;
- register GCClosure *cc = (GCClosure *) closure;
- register gpointer data1, data2;
- GstBuffer *v_return;
-
- g_return_if_fail (return_value != NULL);
- g_return_if_fail (n_param_values == 1);
-
- if (G_CCLOSURE_SWAP_DATA (closure)) {
- data1 = closure->data;
- data2 = g_value_peek_pointer (param_values + 0);
- } else {
- data1 = g_value_peek_pointer (param_values + 0);
- data2 = closure->data;
- }
- callback =
- (GMarshalFunc_GSTBUFFER__VOID) (marshal_data ? marshal_data :
- cc->callback);
-
- v_return = callback (data1, data2);
-
- gst_value_set_buffer (return_value, v_return);
-}
-
static void
insanity_http_server_set_property (GObject * gobject,
guint prop_id, const GValue * value, GParamSpec * pspec)
@@ -303,8 +270,7 @@ insanity_http_server_class_init (InsanityHttpServerClass * klass)
signals[SIGNAL_GET_CONTENT] = g_signal_new ("get-content",
G_TYPE_FROM_CLASS (gobject_class),
G_SIGNAL_RUN_LAST | G_SIGNAL_NO_RECURSE | G_SIGNAL_NO_HOOKS,
- 0, NULL, NULL, insanity_cclosure_user_marshal_GSTBUFFER__VOID,
- GST_TYPE_BUFFER, 0, NULL);
+ 0, NULL, NULL, NULL, GST_TYPE_BUFFER, 0, NULL);
signals[SIGNAL_WRITING_CHUNK] = g_signal_new ("writing-chunk", G_TYPE_FROM_CLASS (gobject_class), G_SIGNAL_RUN_LAST | G_SIGNAL_NO_RECURSE | G_SIGNAL_NO_HOOKS, 0, NULL, NULL, NULL, G_TYPE_NONE, 4, G_TYPE_STRING, /* Path to file */
G_TYPE_POINTER, /* Pointer to the data prepared to be written */
@@ -359,8 +325,10 @@ free_chunked_transmitter (ChunkedTransmitter * ct)
if (ct->f)
g_mapped_file_unref (ct->f);
- if (ct->buf)
+ if (ct->buf) {
+ gst_buffer_unmap (ct->buf, &ct->minfo);
gst_buffer_unref (ct->buf);
+ }
g_free (ct->path);
@@ -434,7 +402,7 @@ do_get (InsanityHttpServer * srv, SoupServer * server, SoupMessage * msg,
if (priv->source_folder == NULL) {
g_signal_emit (srv, signals[SIGNAL_GET_CONTENT], 0, &buf);
- size = GST_BUFFER_SIZE (buf);
+ size = gst_buffer_get_size (buf);
if (buf == NULL || size == -1) {
LOG ("Make sure to set a callback to the "
"\"content-size\" signal or set a local folder");
@@ -461,12 +429,17 @@ do_get (InsanityHttpServer * srv, SoupServer * server, SoupMessage * msg,
SoupRange *ranges = NULL;
int nranges = 0;
goffset start, end;
+ GstMapInfo minfo;
if (size == 0) {
contents = "";
} else {
if (priv->source_folder == NULL) {
- contents = (gchar *) GST_BUFFER_DATA (buf);
+ if (gst_buffer_map (buf, &minfo, GST_MAP_READ)) {
+ g_assert (size == minfo.size);
+ contents = (gchar *) minfo.data;
+ size = minfo.size;
+ }
} else
contents = g_mapped_file_get_contents (f);
}
@@ -500,6 +473,7 @@ do_get (InsanityHttpServer * srv, SoupServer * server, SoupMessage * msg,
} else {
ct->buf = gst_buffer_ref (buf);
ct->f = NULL;
+ ct->minfo = minfo;
}
ct->contents = contents;
ct->ptr = contents + start;
diff --git a/tests/insanity-test-gst-decoder.c b/tests/insanity-test-gst-decoder.c
index 7424cd2..c4a4b27 100644
--- a/tests/insanity-test-gst-decoder.c
+++ b/tests/insanity-test-gst-decoder.c
@@ -580,7 +580,7 @@ probe_cb (InsanityGstTest * ptest, GstPad * pad, GstMiniObject * object,
/* First check clipping */
if (glob_testing_parser == FALSE && GST_CLOCK_TIME_IS_VALID (ts) &&
glob_waiting_segment == FALSE) {
- gint64 ts_end, cstart, cstop;
+ GstClockTime ts_end, cstart, cstop;
/* Check if buffer is completely outside the segment */
ts_end = ts;
@@ -691,24 +691,16 @@ probe_cb (InsanityGstTest * ptest, GstPad * pad, GstMiniObject * object,
}
switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_NEWSEGMENT:
+ case GST_EVENT_SEGMENT:
{
- GstFormat fmt;
- gint64 start, stop, position;
- gdouble rate, applied_rate;
- gboolean update;
-
- gst_event_parse_new_segment_full (event, &update, &rate,
- &applied_rate, &fmt, &start, &stop, &position);
- gst_segment_set_newsegment_full (&glob_last_segment, update, rate,
- applied_rate, fmt, start, stop, position);
+ gst_event_copy_segment (event, &glob_last_segment);
if (glob_waiting_segment == FALSE)
/* Cache the segment as it will be our reference but don't look
* further */
goto done;
- glob_last_segment_start_time = start;
+ glob_last_segment_start_time = glob_last_segment.start;
if (glob_waiting_first_segment == TRUE) {
insanity_test_validate_checklist_item (test, "first-segment", TRUE,
NULL);
@@ -721,17 +713,22 @@ probe_cb (InsanityGstTest * ptest, GstPad * pad, GstMiniObject * object,
GstClockTimeDiff wdiff, rdiff;
rdiff =
- ABS (GST_CLOCK_DIFF (stop, start)) * ABS (rate * applied_rate);
- wdiff = ABS (GST_CLOCK_DIFF (glob_seek_stop_ts,
+ ABS (GST_CLOCK_DIFF (glob_last_segment.stop,
+ glob_last_segment.start)) * ABS (glob_last_segment.rate *
+ glob_last_segment.applied_rate);
+ wdiff =
+ ABS (GST_CLOCK_DIFF (glob_seek_stop_ts,
glob_seek_segment_seektime));
- diff = GST_CLOCK_DIFF (position, glob_seek_segment_seektime);
+ diff =
+ GST_CLOCK_DIFF (glob_last_segment.position,
+ glob_seek_segment_seektime);
if (diff < 0)
diff = -diff;
/* Now compare with the expected segment */
- if ((rate * applied_rate) == glob_seek_rate && diff <= SEEK_THRESHOLD
- && valid_stop) {
+ if ((glob_last_segment.rate * glob_last_segment.applied_rate) ==
+ glob_seek_rate && diff <= SEEK_THRESHOLD && valid_stop) {
glob_seek_got_segment = TRUE;
} else {
GstClockTime stopdiff = ABS (GST_CLOCK_DIFF (rdiff, wdiff));
@@ -739,7 +736,9 @@ probe_cb (InsanityGstTest * ptest, GstPad * pad, GstMiniObject * object,
gchar *validate_msg =
g_strdup_printf ("Wrong segment received, Rate %f expected "
"%f, start time diff %" GST_TIME_FORMAT " stop diff %"
- GST_TIME_FORMAT, (rate * applied_rate), glob_seek_rate,
+ GST_TIME_FORMAT,
+ (glob_last_segment.rate * glob_last_segment.applied_rate),
+ glob_seek_rate,
GST_TIME_ARGS (diff), GST_TIME_ARGS (stopdiff));
validate_current_test (test, FALSE, validate_msg);
@@ -779,7 +778,7 @@ pad_added_cb (GstElement * element, GstPad * new_pad, InsanityTest * test)
DECODER_TEST_LOCK ();
/* First check if the pad caps are compatible with the decoder */
- caps = gst_pad_get_caps (new_pad);
+ caps = gst_pad_get_current_caps (new_pad);
decodesinkpad = gst_element_get_compatible_pad (glob_decoder, new_pad, caps);
if (decodesinkpad == NULL)
@@ -969,7 +968,6 @@ bus_message_cb (InsanityGstPipelineTest * ptest, GstMessage * msg)
static GstPipeline *
create_pipeline (InsanityGstPipelineTest * ptest, gpointer unused_data)
{
- gboolean uri_set;
GstElementFactory *decofactory = NULL;
GError *err = NULL;
@@ -1007,8 +1005,9 @@ create_pipeline (InsanityGstPipelineTest * ptest, gpointer unused_data)
uri = tmpuri;
}
- uri_set = gst_uri_handler_set_uri (GST_URI_HANDLER (glob_src), uri);
- if (uri_set == FALSE) {
+ gst_uri_handler_set_uri (GST_URI_HANDLER (glob_src), uri, &err);
+ if (err != NULL) {
+ ERROR (test, "Error setting uri %s", err->message);
goto failed;
}
diff --git a/tests/insanity-test-gst-demuxer.c b/tests/insanity-test-gst-demuxer.c
index 6dc4d07..c9fcbfe 100644
--- a/tests/insanity-test-gst-demuxer.c
+++ b/tests/insanity-test-gst-demuxer.c
@@ -141,7 +141,8 @@ static gboolean glob_unlinked_pad = FALSE;
static guint glob_unlinked_buf_timeout = 0;
static gboolean glob_buf_on_linked_pad = FALSE;
-static void block_pad_cb (GstPad * pad, gboolean blocked, InsanityTest * test);
+static GstPadProbeReturn block_pad_cb (GstPad * pad, gboolean blocked,
+ InsanityTest * test);
static gboolean next_test (InsanityTest * test);
static void
@@ -365,8 +366,8 @@ test_unlink_pad (InsanityTest * test)
return;
}
- gst_pad_set_blocked_async (glob_prob_ctxs[0].pad, TRUE,
- (GstPadBlockCallback) block_pad_cb, test);
+ gst_pad_add_probe (glob_prob_ctxs[0].pad, GST_PAD_PROBE_TYPE_BLOCK,
+ (GstPadProbeCallback) block_pad_cb, test, NULL);
DEMUX_TEST_UNLOCK ();
}
@@ -810,7 +811,7 @@ fakesink_handoff_cb (GstElement * fsink, GstBuffer * buf, GstPad * pad,
g_signal_handlers_disconnect_by_func (fsink, fakesink_handoff_cb, test);
}
-static void
+static GstPadProbeReturn
block_pad_cb (GstPad * pad, gboolean blocked, InsanityTest * test)
{
ProbeContext *probectx;
@@ -840,49 +841,48 @@ block_pad_cb (GstPad * pad, gboolean blocked, InsanityTest * test)
gst_element_set_state (probectx->fakesink, GST_STATE_NULL);
if (gst_element_get_state (probectx->fakesink, &state, NULL,
GST_CLOCK_TIME_NONE) == GST_STATE_CHANGE_SUCCESS) {
- gst_object_unref (probectx->fakesink);
- gst_pad_set_blocked_async (probectx->pad, FALSE,
- (GstPadBlockCallback) block_pad_cb, test);
- } else {
- validate_current_test (test, FALSE, "Could not set sink to STATE_NULL");
- next_test (test);
- }
- } else {
- probectx->unlinked = TRUE;
- glob_unlinked_pad = TRUE;
-
- if (glob_nb_pads > 1) {
- guint i;
-
- for (i = 0; i < glob_nb_pads; i++) {
- if (glob_prob_ctxs[i].unlinked == FALSE) {
- g_object_set (glob_prob_ctxs[i].fakesink, "signal-handoffs", TRUE,
- NULL);
- g_signal_connect (glob_prob_ctxs[i].fakesink, "handoff",
- G_CALLBACK (fakesink_handoff_cb), test);
- break;
+ gst_object_unref (probectx->fakesink);
+ probectx->unlinked = TRUE;
+ glob_unlinked_pad = TRUE;
+
+ if (glob_nb_pads > 1) {
+ guint i;
+
+ for (i = 0; i < glob_nb_pads; i++) {
+ if (glob_prob_ctxs[i].unlinked == FALSE) {
+ g_object_set (glob_prob_ctxs[i].fakesink, "signal-handoffs", TRUE,
+ NULL);
+ g_signal_connect (glob_prob_ctxs[i].fakesink, "handoff",
+ G_CALLBACK (fakesink_handoff_cb), test);
+ break;
+ }
}
- }
- /*Seek if possible to avoid hitting EOS */
- if (glob_seekable) {
- GstEvent *event;
+ /*Seek if possible to avoid hitting EOS */
+ if (glob_seekable) {
+ GstEvent *event;
- event = gst_event_new_seek (1, GST_FORMAT_TIME,
- GST_SEEK_FLAG_FLUSH, GST_SEEK_TYPE_SET, 0, GST_SEEK_TYPE_NONE,
- GST_CLOCK_TIME_NONE);
- set_waiting_segment ();
- glob_seqnum_found = FALSE;
- glob_seqnum = gst_util_seqnum_next ();
- gst_event_set_seqnum (event, glob_seqnum);
- gst_element_send_event (glob_pipeline, event);
+ event = gst_event_new_seek (1, GST_FORMAT_TIME,
+ GST_SEEK_FLAG_FLUSH, GST_SEEK_TYPE_SET, 0, GST_SEEK_TYPE_NONE,
+ GST_CLOCK_TIME_NONE);
+ set_waiting_segment ();
+ glob_seqnum_found = FALSE;
+ glob_seqnum = gst_util_seqnum_next ();
+ gst_event_set_seqnum (event, glob_seqnum);
+ gst_element_send_event (glob_pipeline, event);
- /* ret is not really important here */
+ /* ret is not really important here */
+ }
}
+ /* Else waiting error on the bus */
+ } else {
+ validate_current_test (test, FALSE, "Could not set sink to STATE_NULL");
+ next_test (test);
}
- /* Else waiting error on the bus */
}
+
+ return GST_PAD_PROBE_REMOVE;
}
static inline void
@@ -1053,23 +1053,15 @@ probe_cb (InsanityGstTest * ptest, GstPad * pad, GstMiniObject * object,
}
break;
}
- case GST_EVENT_NEWSEGMENT:
+ case GST_EVENT_SEGMENT:
{
- GstFormat fmt;
- gint64 start, stop, position;
- gdouble rate, applied_rate;
- gboolean update;
-
if (glob_seqnum == 0 && glob_seqnum_found == FALSE) {
/* This should only happen for the first segment */
glob_seqnum = gst_event_get_seqnum (event);
glob_seqnum_found = TRUE;
}
- gst_event_parse_new_segment_full (event, &update, &rate,
- &applied_rate, &fmt, &start, &stop, &position);
- gst_segment_set_newsegment_full (&probectx->last_segment, update, rate,
- applied_rate, fmt, start, stop, position);
+ gst_event_copy_segment (event, &probectx->last_segment);
if (probectx->waiting_segment == FALSE)
/* Cache the segment as it will be our reference but don't look
@@ -1086,22 +1078,31 @@ probe_cb (InsanityGstTest * ptest, GstPad * pad, GstMiniObject * object,
GstClockTimeDiff wdiff, rdiff;
rdiff =
- ABS (GST_CLOCK_DIFF (stop, start)) * ABS (rate * applied_rate);
+ ABS (GST_CLOCK_DIFF (probectx->last_segment.stop,
+ probectx->last_segment.start)) *
+ ABS (probectx->last_segment.rate *
+ probectx->last_segment.applied_rate);
wdiff =
ABS (GST_CLOCK_DIFF (glob_seek_stop_ts,
glob_seek_segment_seektime));
- diff = GST_CLOCK_DIFF (position, glob_seek_segment_seektime);
+ diff =
+ GST_CLOCK_DIFF (probectx->last_segment.position,
+ glob_seek_segment_seektime);
/* Now compare with the expected segment */
- if (((rate * applied_rate) == glob_seek_rate
- && position == glob_seek_segment_seektime) == FALSE) {
+ if (((probectx->last_segment.rate *
+ probectx->last_segment.applied_rate) == glob_seek_rate
+ && probectx->last_segment.position ==
+ glob_seek_segment_seektime) == FALSE) {
GstClockTime stopdiff = ABS (GST_CLOCK_DIFF (rdiff, wdiff));
gchar *validate_msg =
g_strdup_printf ("Wrong segment received, Rate %lf expected "
"%f, start time diff %" GST_TIME_FORMAT " stop diff %"
- GST_TIME_FORMAT, (rate * applied_rate), glob_seek_rate,
+ GST_TIME_FORMAT,
+ (probectx->last_segment.rate *
+ probectx->last_segment.applied_rate), glob_seek_rate,
GST_TIME_ARGS (diff), GST_TIME_ARGS (stopdiff));
validate_current_test (test, FALSE, validate_msg);
@@ -1301,6 +1302,8 @@ demux_test_create_pipeline (InsanityGstPipelineTest * ptest,
GstElementFactory *decofactory = NULL;
gchar *demuxname = NULL, *uri = NULL, *location = NULL;
+ GError *error = NULL;
+
InsanityTest *test = INSANITY_TEST (ptest);
DEMUX_TEST_LOCK ();
@@ -1333,8 +1336,11 @@ demux_test_create_pipeline (InsanityGstPipelineTest * ptest,
uri = tmpuri;
}
- if (gst_uri_handler_set_uri (GST_URI_HANDLER (glob_src), uri) == FALSE)
+ gst_uri_handler_set_uri (GST_URI_HANDLER (glob_src), uri, &error);
+ if (error != NULL) {
+ ERROR (test, "Error setting uri %s", error->message);
goto failed;
+ }
/* ... create the demuxer */
if (!insanity_test_get_string_argument (test, "demuxer", &demuxname) ||
@@ -1382,6 +1388,7 @@ demux_test_create_pipeline (InsanityGstPipelineTest * ptest,
done:
DEMUX_TEST_UNLOCK ();
+ g_clear_error (&error);
g_free (demuxname);
g_free (uri);
g_free (location);
diff --git a/tests/insanity-test-gst-discoverer.c b/tests/insanity-test-gst-discoverer.c
index 96bca73..7db2e0b 100644
--- a/tests/insanity-test-gst-discoverer.c
+++ b/tests/insanity-test-gst-discoverer.c
@@ -1235,9 +1235,17 @@ search_tag (GQuark field_id, const GValue * value, gpointer user_data)
if (G_VALUE_HOLDS_STRING (value))
ser = g_value_dup_string (value);
- else if (GST_VALUE_HOLDS_BUFFER (value)) {
- GstBuffer *buf = gst_value_get_buffer (value);
- ser = g_strdup_printf ("<GstBuffer [%d bytes]>", GST_BUFFER_SIZE (buf));
+ else if (GST_VALUE_HOLDS_SAMPLE (value)) {
+ GstSample *smpl = gst_value_get_sample (value);
+ GstBuffer *buf = gst_sample_get_buffer (smpl);
+ GstCaps *caps = gst_sample_get_caps (smpl);
+ gchar *caps_str;
+
+ caps_str = caps ? gst_caps_to_string (caps) : g_strdup ("unknown");
+ ser =
+ g_strdup_printf ("<GstSample [%" G_GSIZE_FORMAT " bytes, type %s]>",
+ gst_buffer_get_size (buf), caps_str);
+ g_free (caps_str);
} else
ser = gst_value_serialize (value);
diff --git a/tests/insanity-test-gst-dvd.c b/tests/insanity-test-gst-dvd.c
index 055f67f..8cd095f 100644
--- a/tests/insanity-test-gst-dvd.c
+++ b/tests/insanity-test-gst-dvd.c
@@ -27,7 +27,7 @@
#include <string.h>
#include <glib.h>
#include <glib-object.h>
-#include <gst/interfaces/navigation.h>
+#include <gst/video/navigation.h>
#include <insanity-gst/insanity-gst.h>
/* Number of random commands to send to move between menus */
@@ -84,7 +84,7 @@ static GstPipeline *
dvd_test_create_pipeline (InsanityGstPipelineTest * ptest, gpointer userdata)
{
GstElement *pipeline = NULL;
- const char *launch_line = "playbin2 audio-sink=fakesink video-sink=fakesink";
+ const char *launch_line = "playbin audio-sink=fakesink video-sink=fakesink";
GError *error = NULL;
pipeline = gst_parse_launch (launch_line, &error);
@@ -626,7 +626,7 @@ dvd_test_bus_message (InsanityGstPipelineTest * ptest, GstMessage * msg)
break;
case GST_MESSAGE_ELEMENT:
{
- const GstStructure *s = msg->structure;
+ const GstStructure *s = gst_message_get_structure (msg);
const char *str;
gint n, ntitles;
GstClockTime duration, longest_duration = 0;
diff --git a/tests/insanity-test-gst-hls.c b/tests/insanity-test-gst-hls.c
index 7397388..db53b97 100644
--- a/tests/insanity-test-gst-hls.c
+++ b/tests/insanity-test-gst-hls.c
@@ -105,7 +105,7 @@ hls_test_create_pipeline (InsanityGstPipelineTest * ptest, gpointer userdata)
{
GstElement *pipeline = NULL;
const char *launch_line =
- "playbin2 audio-sink=\"fakesink name=asink\" video-sink=\"fakesink name=vsink\"";
+ "playbin audio-sink=\"fakesink name=asink\" video-sink=\"fakesink name=vsink\"";
GError *error = NULL;
pipeline = gst_parse_launch (launch_line, &error);
@@ -137,11 +137,8 @@ hls_test_get_position (InsanityTest * test)
{
gint64 pos = 0;
gboolean res;
- GstFormat format = GST_FORMAT_TIME;
- res = gst_element_query_position (glob_pipeline, &format, &pos);
- if (format != GST_FORMAT_TIME)
- res = FALSE;
+ res = gst_element_query_position (glob_pipeline, GST_FORMAT_TIME, &pos);
LOG ("Position %" GST_TIME_FORMAT " ..queried (success %i)\n",
GST_TIME_ARGS (pos), res);
@@ -263,8 +260,9 @@ buffering_timeout (gpointer data)
}
static gint
-find_hlsdemux (GstElement * e)
+find_hlsdemux (GValue * value, gpointer user_data)
{
+ GstElement *e = GST_ELEMENT (g_value_get_object (value));
GstObject *fact = GST_OBJECT (gst_element_get_factory (e));
gchar *name = gst_object_get_name (fact);
@@ -274,7 +272,6 @@ find_hlsdemux (GstElement * e)
}
g_free (name);
- gst_object_unref (e);
return 1;
}
@@ -323,26 +320,21 @@ probe (InsanityGstTest * ptest, GstPad * pad, GstMiniObject * object,
} else {
GstEvent *event = GST_EVENT (object);
- if (GST_EVENT_TYPE (event) == GST_EVENT_NEWSEGMENT) {
- gint64 start;
- gboolean update;
+ if (GST_EVENT_TYPE (event) == GST_EVENT_SEGMENT) {
+ GstSegment segment;
- gst_event_parse_new_segment (event, &update, NULL, NULL, &start, NULL,
- NULL);
-
- /* ignore segment updates */
- if (update)
- goto ignore_segment;
+ gst_event_copy_segment (event, &segment);
/* Not waiting for a segment, ignoring */
if (!GST_CLOCK_TIME_IS_VALID (glob_target)) {
LOG ("Got segment starting at %" GST_TIME_FORMAT
- ", but we are not waiting for segment\n", GST_TIME_ARGS (start));
+ ", but we are not waiting for segment\n",
+ GST_TIME_ARGS (segment.start));
goto ignore_segment;
}
/* Checking the segment has good timing */
- diff = GST_CLOCK_DIFF (start, glob_target);
+ diff = GST_CLOCK_DIFF (segment.start, glob_target);
if (diff < 0)
diff = -diff;
@@ -350,17 +342,17 @@ probe (InsanityGstTest * ptest, GstPad * pad, GstMiniObject * object,
LOG ("Got segment start %" GST_TIME_FORMAT
", expected around %" GST_TIME_FORMAT ", off by %" GST_TIME_FORMAT
", method %d\n",
- GST_TIME_ARGS (start), GST_TIME_ARGS (glob_target),
+ GST_TIME_ARGS (segment.start), GST_TIME_ARGS (glob_target),
GST_TIME_ARGS (diff), glob_state);
} else {
LOG ("Got segment start %" GST_TIME_FORMAT
", expected around %" GST_TIME_FORMAT ", off by %" GST_TIME_FORMAT
- ", method %d\n", GST_TIME_ARGS (start), GST_TIME_ARGS (glob_target),
- GST_TIME_ARGS (diff), glob_state);
+ ", method %d\n", GST_TIME_ARGS (segment.start),
+ GST_TIME_ARGS (glob_target), GST_TIME_ARGS (diff), glob_state);
seek_targets[glob_seek_nb].segment_received = TRUE;
- glob_segment = start;
+ glob_segment = segment.start;
}
}
@@ -453,6 +445,7 @@ hls_test_bus_message (InsanityGstPipelineTest * ptest, GstMessage * msg)
gst_message_parse_state_changed (msg, &oldstate, &newstate, &pending);
if (newstate == GST_STATE_PAUSED && oldstate == GST_STATE_READY) {
GstIterator *it;
+ GValue v = { 0, };
gboolean queried;
InsanityTest *test = INSANITY_TEST (ptest);
GstQuery *query = gst_query_new_latency ();
@@ -484,8 +477,11 @@ hls_test_bus_message (InsanityGstPipelineTest * ptest, GstMessage * msg)
/* Iterate over the bins to find a hlsdemux */
it = gst_bin_iterate_recurse (GST_BIN (glob_pipeline));
- glob_hlsdemux = gst_iterator_find_custom (it,
- (GCompareFunc) find_hlsdemux, NULL);
+ if (gst_iterator_find_custom (it, (GCompareFunc) find_hlsdemux, &v,
+ NULL)) {
+ glob_hlsdemux = g_value_dup_object (&v);
+ }
+ g_value_unset (&v);
gst_iterator_free (it);
if (glob_hlsdemux != NULL) {
diff --git a/tests/insanity-test-gst-http.c b/tests/insanity-test-gst-http.c
index 335ea62..694bb23 100644
--- a/tests/insanity-test-gst-http.c
+++ b/tests/insanity-test-gst-http.c
@@ -59,7 +59,7 @@ static GstPipeline *
http_test_create_pipeline (InsanityGstPipelineTest * ptest, gpointer userdata)
{
GstElement *pipeline = NULL;
- const char *launch_line = "playbin2 audio-sink=fakesink video-sink=fakesink";
+ const char *launch_line = "playbin audio-sink=fakesink video-sink=fakesink";
GError *error = NULL;
pipeline = gst_parse_launch (launch_line, &error);
@@ -91,11 +91,8 @@ http_test_get_position (InsanityTest * test)
{
gint64 pos = 0;
gboolean res;
- GstFormat format = GST_FORMAT_TIME;
- res = gst_element_query_position (global_pipeline, &format, &pos);
- if (format != GST_FORMAT_TIME)
- res = FALSE;
+ res = gst_element_query_position (global_pipeline, GST_FORMAT_TIME, &pos);
insanity_test_validate_checklist_item (test, "position-queried", res, NULL);
if (!res) {
pos = GST_CLOCK_TIME_NONE;
diff --git a/tests/insanity-test-gst-play.c b/tests/insanity-test-gst-play.c
index cf79ef0..a9e4a45 100644
--- a/tests/insanity-test-gst-play.c
+++ b/tests/insanity-test-gst-play.c
@@ -125,14 +125,12 @@ play_gst_test_create_pipeline (InsanityGstPipelineTest * ptest,
static gboolean
check_position (InsanityTest * test)
{
- GstFormat fmt;
gint64 position;
/* Check if we're changing the position and if we do
* the test is not dead yet */
- fmt = GST_FORMAT_TIME;
- if (gst_element_query_position (global_pipeline, &fmt, &position) &&
- fmt == GST_FORMAT_TIME && position != -1) {
+ if (gst_element_query_position (global_pipeline, GST_FORMAT_TIME, &position)
+ && position != -1) {
if (first_position == GST_CLOCK_TIME_NONE)
first_position = position;
last_position = position;
diff --git a/tests/insanity-test-gst-rtsp.c b/tests/insanity-test-gst-rtsp.c
index 33e032c..7249d3d 100644
--- a/tests/insanity-test-gst-rtsp.c
+++ b/tests/insanity-test-gst-rtsp.c
@@ -50,11 +50,8 @@ rtsp_test_get_position (InsanityTest * test)
{
gint64 pos = 0;
gboolean res;
- GstFormat format = GST_FORMAT_TIME;
- res = gst_element_query_position (global_pipeline, &format, &pos);
- if (format != GST_FORMAT_TIME)
- res = FALSE;
+ res = gst_element_query_position (global_pipeline, GST_FORMAT_TIME, &pos);
insanity_test_validate_checklist_item (test, "position-queried", res, NULL);
if (!res) {
pos = GST_CLOCK_TIME_NONE;
@@ -79,7 +76,7 @@ static GstPipeline *
rtsp_test_create_pipeline (InsanityGstPipelineTest * ptest, gpointer userdata)
{
GstElement *pipeline = NULL;
- const char *launch_line = "playbin2 uri=rtsp://127.0.0.1:8554/test"
+ const char *launch_line = "playbin uri=rtsp://127.0.0.1:8554/test"
#if 0
" audio-sink=fakesink video-sink=fakesink"
#endif
@@ -153,6 +150,7 @@ rtsp_test_teardown (InsanityTest * test)
rtsp_test_destroy_server ();
}
+#if 0
static void
rtsp_test_reset_server (void)
{
@@ -162,6 +160,7 @@ rtsp_test_reset_server (void)
gst_rtsp_media_mapping_remove_factory (mapping, "/test");
g_object_unref (mapping);
}
+#endif
static gboolean
rtsp_test_configure_server_for_uri (const char *uri)
@@ -509,6 +508,7 @@ rtsp_test_wait (InsanityGstPipelineTest * ptest, const char *step,
return NEXT_STEP_NOW;
}
+#if 0
static NextStepTrigger
rtsp_test_seek (InsanityGstPipelineTest * ptest, const char *step,
guintptr data)
@@ -536,6 +536,7 @@ rtsp_test_seek (InsanityGstPipelineTest * ptest, const char *step,
g_timeout_add (5000, (GSourceFunc) & state_change_timeout, ptest);
return NEXT_STEP_ON_PLAYING;
}
+#endif
static NextStepTrigger
rtsp_test_set_protocols (InsanityGstPipelineTest * ptest, const char *step,
diff --git a/tests/insanity-test-gst-seek.c b/tests/insanity-test-gst-seek.c
index 5e25c99..66df16b 100644
--- a/tests/insanity-test-gst-seek.c
+++ b/tests/insanity-test-gst-seek.c
@@ -525,10 +525,9 @@ probe (InsanityGstTest * ptest, GstPad * pad, GstMiniObject * object,
GstClockTime ts = GST_BUFFER_TIMESTAMP (buffer);
insanity_test_printf (INSANITY_TEST (ptest),
- "[%d] Got %s buffer at %" GST_TIME_FORMAT ", %u bytes, %s, target %"
+ "[%d] Got buffer at %" GST_TIME_FORMAT ", %u bytes, %s, target %"
GST_TIME_FORMAT "\n", index,
- gst_structure_get_name (gst_caps_get_structure (GST_BUFFER_CAPS
- (buffer), 0)), GST_TIME_ARGS (ts), GST_BUFFER_SIZE (buffer),
+ GST_TIME_ARGS (ts), gst_buffer_get_size (buffer),
get_waiting_string (global_waiting[index]),
GST_TIME_ARGS (global_seek_rate >
0 ? global_seek_stop : global_target));
@@ -558,7 +557,8 @@ probe (InsanityGstTest * ptest, GstPad * pad, GstMiniObject * object,
if (GST_CLOCK_TIME_IS_VALID (ts)) {
gint64 stime_ts;
GstClockTimeDiff diff;
- gint64 ts_end, cstart, cstop;
+ gint64 ts_end;
+ guint64 cstart, cstop;
/* Check if buffer is completely outside the segment */
ts_end = ts;
@@ -655,32 +655,21 @@ probe (InsanityGstTest * ptest, GstPad * pad, GstMiniObject * object,
insanity_test_printf (INSANITY_TEST (ptest), "[%d] %s event\n", index,
GST_EVENT_TYPE_NAME (event));
- if (GST_EVENT_TYPE (event) == GST_EVENT_NEWSEGMENT) {
- GstFormat fmt;
- gint64 start, stop, position;
- gdouble rate, applied_rate;
- gboolean update;
-
- gst_event_parse_new_segment_full (event, &update, &rate, &applied_rate,
- &fmt, &start, &stop, &position);
- gst_segment_set_newsegment_full (&global_segment[index], update, rate,
- applied_rate, fmt, start, stop, position);
+ if (GST_EVENT_TYPE (event) == GST_EVENT_SEGMENT) {
+ gst_event_copy_segment (event, &global_segment[index]);
/* ignore segment updates */
- if (update)
- goto ignore_segment;
-
if (global_waiting[index] != WAIT_STATE_SEGMENT) {
insanity_test_printf (INSANITY_TEST (ptest),
"[%d] Got segment starting at %" GST_TIME_FORMAT
", but we are not waiting for segment\n", index,
- GST_TIME_ARGS (start));
+ GST_TIME_ARGS (global_segment[index].start));
goto ignore_segment;
}
insanity_test_printf (INSANITY_TEST (ptest),
"[%d] Got segment starting at %" GST_TIME_FORMAT ", %s\n",
- index, GST_TIME_ARGS (start),
+ index, GST_TIME_ARGS (global_segment[index].start),
get_waiting_string (global_waiting[index]));
/* Only check segment start time against target if we're not expecting EOS,
@@ -692,19 +681,22 @@ probe (InsanityGstTest * ptest, GstPad * pad, GstMiniObject * object,
stime_start =
gst_segment_to_stream_time (&global_segment[index],
- global_segment[index].format, start);
+ global_segment[index].format, global_segment[index].start);
diff = GST_CLOCK_DIFF (stime_start, global_target);
if (diff < 0)
diff = -diff;
- if (diff > SEEK_THRESHOLD || (rate * applied_rate) != global_seek_rate) {
- char *msg = g_strdup_printf ("Got segment start %" GST_TIME_FORMAT
+ if (diff > SEEK_THRESHOLD
+ || (global_segment[index].rate *
+ global_segment[index].applied_rate) != global_seek_rate) {
+ char *msg =
+ g_strdup_printf ("Got segment start %" GST_TIME_FORMAT
", expected around %" GST_TIME_FORMAT ", off by %" GST_TIME_FORMAT
", got rate %lf expected rate %lf, method %d",
GST_TIME_ARGS (stime_start),
GST_TIME_ARGS (global_target), GST_TIME_ARGS (diff),
- (rate * applied_rate),
+ (global_segment[index].rate * global_segment[index].applied_rate),
global_seek_rate, global_state);
insanity_test_validate_checklist_item (INSANITY_TEST (ptest),
diff --git a/tests/insanity-test-gst-stream-switch.c b/tests/insanity-test-gst-stream-switch.c
index dc13cc3..33a9d67 100644
--- a/tests/insanity-test-gst-stream-switch.c
+++ b/tests/insanity-test-gst-stream-switch.c
@@ -26,6 +26,7 @@
#include <gst/gst.h>
#include <gst/base/gstbasesink.h>
#include <gst/base/gstpushsrc.h>
+#include <gst/audio/audio.h>
#include <gst/video/video.h>
#include <insanity-gst/insanity-gst.h>
#include <string.h>
@@ -39,7 +40,7 @@ static GType gst_video_codec_sink_get_type (void);
/***** Source element that creates buffers with specific caps *****/
#undef parent_class
-#define parent_class caps_src_parent_class
+#define parent_class gst_caps_src_parent_class
typedef struct _GstCapsSrc GstCapsSrc;
typedef GstPushSrcClass GstCapsSrcClass;
@@ -53,29 +54,30 @@ struct _GstCapsSrc
};
static GstURIType
-gst_caps_src_uri_get_type (void)
+gst_caps_src_uri_get_type (GType type)
{
return GST_URI_SRC;
}
-static gchar **
-gst_caps_src_uri_get_protocols (void)
+static const gchar *const *
+gst_caps_src_uri_get_protocols (GType type)
{
- static gchar *protocols[] = { (char *) "caps", NULL };
+ static const gchar *const protocols[] = { (char *) "caps", NULL };
return protocols;
}
-static const gchar *
+static gchar *
gst_caps_src_uri_get_uri (GstURIHandler * handler)
{
GstCapsSrc *src = (GstCapsSrc *) handler;
- return src->uri;
+ return g_strdup (src->uri);
}
static gboolean
-gst_caps_src_uri_set_uri (GstURIHandler * handler, const gchar * uri)
+gst_caps_src_uri_set_uri (GstURIHandler * handler, const gchar * uri,
+ GError ** err)
{
GstCapsSrc *src = (GstCapsSrc *) handler;
@@ -103,31 +105,9 @@ gst_caps_src_uri_handler_init (gpointer g_iface, gpointer iface_data)
iface->set_uri = gst_caps_src_uri_set_uri;
}
-static void
-gst_caps_src_init_type (GType type)
-{
- static const GInterfaceInfo uri_hdlr_info = {
- gst_caps_src_uri_handler_init, NULL, NULL
- };
-
- g_type_add_interface_static (type, GST_TYPE_URI_HANDLER, &uri_hdlr_info);
-}
-
-GST_BOILERPLATE_FULL (GstCapsSrc, gst_caps_src, GstPushSrc,
- GST_TYPE_PUSH_SRC, gst_caps_src_init_type);
-
-static void
-gst_caps_src_base_init (gpointer klass)
-{
- static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC, GST_PAD_ALWAYS,
- GST_STATIC_CAPS_ANY);
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
- gst_element_class_add_static_pad_template (element_class, &src_templ);
- gst_element_class_set_details_simple (element_class,
- "CapsSource", "Source/Generic", "yep", "me");
-}
+G_DEFINE_TYPE_WITH_CODE (GstCapsSrc, gst_caps_src, GST_TYPE_PUSH_SRC,
+ G_IMPLEMENT_INTERFACE (GST_TYPE_URI_HANDLER,
+ gst_caps_src_uri_handler_init));
static void
gst_caps_src_finalize (GObject * object)
@@ -160,7 +140,6 @@ gst_caps_src_create (GstPushSrc * psrc, GstBuffer ** p_buf)
}
buf = gst_buffer_new ();
- gst_buffer_set_caps (buf, src->caps);
GST_BUFFER_TIMESTAMP (buf) =
gst_util_uint64_scale (src->nbuffers, GST_SECOND, 25);
GST_BUFFER_DURATION (buf) =
@@ -175,15 +154,24 @@ gst_caps_src_create (GstPushSrc * psrc, GstBuffer ** p_buf)
static void
gst_caps_src_class_init (GstCapsSrcClass * klass)
{
+ static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src",
+ GST_PAD_SRC, GST_PAD_ALWAYS,
+ GST_STATIC_CAPS_ANY);
GObjectClass *gobject_class = (GObjectClass *) klass;
GstPushSrcClass *pushsrc_class = (GstPushSrcClass *) klass;
+ GstElementClass *element_class = (GstElementClass *) klass;
gobject_class->finalize = gst_caps_src_finalize;
pushsrc_class->create = gst_caps_src_create;
+
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&src_templ));
+ gst_element_class_set_details_simple (element_class, "CapsSource",
+ "Source/Generic", "yep", "me");
}
static void
-gst_caps_src_init (GstCapsSrc * src, GstCapsSrcClass * klass)
+gst_caps_src_init (GstCapsSrc * src)
{
gst_base_src_set_format (GST_BASE_SRC (src), GST_FORMAT_TIME);
}
@@ -191,7 +179,7 @@ gst_caps_src_init (GstCapsSrc * src, GstCapsSrcClass * klass)
/***** Demux element that creates a specific number of streams based on caps *****/
#undef parent_class
-#define parent_class multiple_stream_demux_parent_class
+#define parent_class gst_multiple_stream_demux_parent_class
typedef struct _GstMultipleStreamDemux GstMultipleStreamDemux;
typedef GstElementClass GstMultipleStreamDemuxClass;
typedef struct _GstMultipleStreamDemuxStream GstMultipleStreamDemuxStream;
@@ -221,37 +209,10 @@ struct _GstMultipleStreamDemux
GList *pending_events;
};
-GST_BOILERPLATE (GstMultipleStreamDemux, gst_multiple_stream_demux, GstElement,
+G_DEFINE_TYPE (GstMultipleStreamDemux, gst_multiple_stream_demux,
GST_TYPE_ELEMENT);
static void
-gst_multiple_stream_demux_base_init (gpointer klass)
-{
- static GstStaticPadTemplate sink_templ = GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK, GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("application/x-multiple-streams, "
- "n-audio = (int) [0, 32], "
- "n-non-raw-audio = (int) [0, 32], "
- "n-video = (int) [0, 32], "
- "n-non-raw-video = (int) [0, 32], "
- "n-text = (int) [0, 64], " "n-other = (int) [0, 64]")
- );
- static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src_%d",
- GST_PAD_SRC, GST_PAD_SOMETIMES,
- GST_STATIC_CAPS
- ("audio/x-raw-int; audio/x-compressed; "
- "video/x-raw-rgb; video/x-compressed; "
- "text/plain; application/x-something")
- );
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
- gst_element_class_add_static_pad_template (element_class, &sink_templ);
- gst_element_class_add_static_pad_template (element_class, &src_templ);
- gst_element_class_set_details_simple (element_class,
- "MultipleStreamDemux", "Codec/Demux", "yep", "me");
-}
-
-static void
gst_multiple_stream_demux_finalize (GObject * object)
{
GstMultipleStreamDemux *demux = (GstMultipleStreamDemux *) object;
@@ -271,9 +232,34 @@ gst_multiple_stream_demux_finalize (GObject * object)
static void
gst_multiple_stream_demux_class_init (GstMultipleStreamDemuxClass * klass)
{
+ static GstStaticPadTemplate sink_templ = GST_STATIC_PAD_TEMPLATE ("sink",
+ GST_PAD_SINK, GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("application/x-multiple-streams, "
+ "n-audio = (int) [0, 32], "
+ "n-non-raw-audio = (int) [0, 32], "
+ "n-video = (int) [0, 32], "
+ "n-non-raw-video = (int) [0, 32], "
+ "n-text = (int) [0, 64], " "n-other = (int) [0, 64]")
+ );
+ static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src_%d",
+ GST_PAD_SRC, GST_PAD_SOMETIMES,
+ GST_STATIC_CAPS
+ ("audio/x-raw; audio/x-compressed; "
+ "video/x-raw; video/x-compressed; "
+ "text/plain; application/x-something")
+ );
GObjectClass *gobject_class = (GObjectClass *) klass;
+ GstElementClass *element_class = (GstElementClass *) klass;
gobject_class->finalize = gst_multiple_stream_demux_finalize;
+
+
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&sink_templ));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&src_templ));
+ gst_element_class_set_details_simple (element_class, "MultipleStreamDemux",
+ "Codec/Demux", "yep", "me");
}
static GstFlowReturn
@@ -297,10 +283,10 @@ done:
}
static GstFlowReturn
-gst_multiple_stream_demux_chain (GstPad * pad, GstBuffer * buf)
+gst_multiple_stream_demux_chain (GstPad * pad, GstObject * parent,
+ GstBuffer * buf)
{
- GstMultipleStreamDemux *demux =
- (GstMultipleStreamDemux *) GST_PAD_PARENT (pad);
+ GstMultipleStreamDemux *demux = (GstMultipleStreamDemux *) parent;
GstFlowReturn ret = GST_FLOW_OK;
gint i;
@@ -316,38 +302,34 @@ gst_multiple_stream_demux_chain (GstPad * pad, GstBuffer * buf)
switch (stream->type) {
case STREAM_TYPE_VIDEO:{
- size = gst_video_format_get_size (GST_VIDEO_FORMAT_xRGB, 800, 600);
- outbuf = gst_buffer_new_and_alloc (size);
- gst_buffer_copy_metadata (outbuf, buf,
- GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_TIMESTAMPS);
- gst_buffer_set_caps (outbuf, GST_PAD_CAPS (stream->srcpad));
+ GstVideoInfo info;
+
+ gst_video_info_init (&info);
+ gst_video_info_set_format (&info, GST_VIDEO_FORMAT_xRGB, 800, 600);
+ size = GST_VIDEO_INFO_SIZE (&info);
break;
}
case STREAM_TYPE_AUDIO:{
size =
gst_util_uint64_scale (GST_BUFFER_DURATION (buf), 48000 * 2,
GST_SECOND);
- outbuf = gst_buffer_new_and_alloc (size);
- gst_buffer_copy_metadata (outbuf, buf,
- GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_TIMESTAMPS);
- gst_buffer_set_caps (outbuf, GST_PAD_CAPS (stream->srcpad));
break;
}
case STREAM_TYPE_OTHER:
case STREAM_TYPE_TEXT:{
size = 256;
- outbuf = gst_buffer_new_and_alloc (size);
- gst_buffer_copy_metadata (outbuf, buf,
- GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_TIMESTAMPS);
- gst_buffer_set_caps (outbuf, GST_PAD_CAPS (stream->srcpad));
break;
}
default:
g_assert_not_reached ();
}
+ outbuf = gst_buffer_new_allocate (NULL, size, NULL);
+ gst_buffer_copy_into (outbuf, buf,
+ GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_TIMESTAMPS, 0, -1);
+
/* Mark the stream ID of this buffer */
- memset (GST_BUFFER_DATA (outbuf), i, size);
+ gst_buffer_memset (outbuf, 0, i, size);
ret = gst_pad_push (stream->srcpad, outbuf);
ret = gst_multiple_stream_demux_combine_flow_ret (demux, stream, ret);
@@ -365,42 +347,6 @@ done:
return ret;
}
-static gboolean
-gst_multiple_stream_demux_event (GstPad * pad, GstEvent * event)
-{
- GstMultipleStreamDemux *demux =
- (GstMultipleStreamDemux *) gst_pad_get_parent (pad);
- gboolean ret = TRUE;
-
- if (GST_EVENT_TYPE (event) == GST_EVENT_FLUSH_STOP) {
- gint i;
-
- for (i = 0; i < demux->n_streams; i++)
- demux->streams[i].last_flow = GST_FLOW_OK;
-
- g_list_foreach (demux->pending_events, (GFunc) gst_event_unref, NULL);
- g_list_free (demux->pending_events);
- demux->pending_events = NULL;
- }
-
- if (demux->streams) {
- gint i;
-
- for (i = 0; i < demux->n_streams; i++)
- ret = ret
- && gst_pad_push_event (demux->streams[i].srcpad,
- gst_event_ref (event));
- } else if (GST_EVENT_IS_SERIALIZED (event)) {
- demux->pending_events =
- g_list_append (demux->pending_events, gst_event_ref (event));
- }
-
- gst_event_unref (event);
-
- gst_object_unref (demux);
- return ret;
-}
-
static void
create_pad (GstMultipleStreamDemux * demux,
GstMultipleStreamDemuxStream * stream, gint idx, GstCaps * caps)
@@ -423,10 +369,10 @@ create_pad (GstMultipleStreamDemux * demux,
}
static gboolean
-gst_multiple_stream_demux_setcaps (GstPad * pad, GstCaps * caps)
+gst_multiple_stream_demux_setcaps (GstPad * pad, GstObject * parent,
+ GstCaps * caps)
{
- GstMultipleStreamDemux *demux =
- (GstMultipleStreamDemux *) gst_pad_get_parent (pad);
+ GstMultipleStreamDemux *demux = (GstMultipleStreamDemux *) parent;
GstStructure *s;
gint n_audio, n_nonraw_audio, n_video, n_nonraw_video;
gint n_text, n_other, n;
@@ -456,15 +402,12 @@ gst_multiple_stream_demux_setcaps (GstPad * pad, GstCaps * caps)
j = 0;
for (i = 0; i < n_audio; i++, j++) {
GstMultipleStreamDemuxStream *stream = &demux->streams[j];
+ GstAudioInfo ainfo;
GstCaps *caps;
- caps = gst_caps_new_simple ("audio/x-raw-int",
- "rate", G_TYPE_INT, 48000,
- "channels", G_TYPE_INT, 1,
- "width", G_TYPE_INT, 16,
- "depth", G_TYPE_INT, 16,
- "endianness", G_TYPE_INT, G_BYTE_ORDER,
- "signed", G_TYPE_BOOLEAN, TRUE, NULL);
+ gst_audio_info_init (&ainfo);
+ gst_audio_info_set_format (&ainfo, GST_AUDIO_FORMAT_S16, 48000, 1, NULL);
+ caps = gst_audio_info_to_caps (&ainfo);
create_pad (demux, stream, j, caps);
gst_caps_unref (caps);
@@ -475,7 +418,7 @@ gst_multiple_stream_demux_setcaps (GstPad * pad, GstCaps * caps)
GstMultipleStreamDemuxStream *stream = &demux->streams[j];
GstCaps *caps;
- caps = gst_caps_new_simple ("audio/x-compressed", NULL);
+ caps = gst_caps_new_simple ("audio/x-compressed", NULL, NULL);
create_pad (demux, stream, j, caps);
gst_caps_unref (caps);
@@ -484,11 +427,12 @@ gst_multiple_stream_demux_setcaps (GstPad * pad, GstCaps * caps)
for (i = 0; i < n_video; i++, j++) {
GstMultipleStreamDemuxStream *stream = &demux->streams[j];
+ GstVideoInfo vinfo;
GstCaps *caps;
- caps =
- gst_video_format_new_caps (GST_VIDEO_FORMAT_xRGB, 800, 600, 25, 1, 1,
- 1);
+ gst_video_info_init (&vinfo);
+ gst_video_info_set_format (&vinfo, GST_VIDEO_FORMAT_xRGB, 800, 600);
+ caps = gst_video_info_to_caps (&vinfo);
create_pad (demux, stream, j, caps);
gst_caps_unref (caps);
@@ -499,7 +443,7 @@ gst_multiple_stream_demux_setcaps (GstPad * pad, GstCaps * caps)
GstMultipleStreamDemuxStream *stream = &demux->streams[j];
GstCaps *caps;
- caps = gst_caps_new_simple ("video/x-compressed", NULL);
+ caps = gst_caps_new_simple ("video/x-compressed", NULL, NULL);
create_pad (demux, stream, j, caps);
gst_caps_unref (caps);
@@ -510,7 +454,7 @@ gst_multiple_stream_demux_setcaps (GstPad * pad, GstCaps * caps)
GstMultipleStreamDemuxStream *stream = &demux->streams[j];
GstCaps *caps;
- caps = gst_caps_new_simple ("text/plain", NULL);
+ caps = gst_caps_new_simple ("text/plain", NULL, NULL);
create_pad (demux, stream, j, caps);
gst_caps_unref (caps);
@@ -521,7 +465,7 @@ gst_multiple_stream_demux_setcaps (GstPad * pad, GstCaps * caps)
GstMultipleStreamDemuxStream *stream = &demux->streams[j];
GstCaps *caps;
- caps = gst_caps_new_simple ("application/x-something", NULL);
+ caps = gst_caps_new_simple ("application/x-something", NULL, NULL);
create_pad (demux, stream, j, caps);
gst_caps_unref (caps);
@@ -534,16 +478,55 @@ gst_multiple_stream_demux_setcaps (GstPad * pad, GstCaps * caps)
return TRUE;
}
+static gboolean
+gst_multiple_stream_demux_event (GstPad * pad, GstObject * parent,
+ GstEvent * event)
+{
+ GstMultipleStreamDemux *demux = (GstMultipleStreamDemux *) parent;
+ gboolean ret = TRUE;
+
+ if (GST_EVENT_TYPE (event) == GST_EVENT_FLUSH_STOP) {
+ gint i;
+
+ for (i = 0; i < demux->n_streams; i++)
+ demux->streams[i].last_flow = GST_FLOW_OK;
+
+ g_list_foreach (demux->pending_events, (GFunc) gst_event_unref, NULL);
+ g_list_free (demux->pending_events);
+ demux->pending_events = NULL;
+ } else if (GST_EVENT_TYPE (event) == GST_EVENT_CAPS) {
+ GstCaps *caps;
+
+ gst_event_parse_caps (event, &caps);
+ ret = gst_multiple_stream_demux_setcaps (pad, parent, caps);
+ goto done;
+ }
+
+ if (demux->streams) {
+ gint i;
+
+ for (i = 0; i < demux->n_streams; i++)
+ ret = ret
+ && gst_pad_push_event (demux->streams[i].srcpad,
+ gst_event_ref (event));
+ } else if (GST_EVENT_IS_SERIALIZED (event)) {
+ demux->pending_events =
+ g_list_append (demux->pending_events, gst_event_ref (event));
+ }
+
+done:
+ gst_event_unref (event);
+ return ret;
+}
+
static void
-gst_multiple_stream_demux_init (GstMultipleStreamDemux * demux,
- GstMultipleStreamDemuxClass * klass)
+gst_multiple_stream_demux_init (GstMultipleStreamDemux * demux)
{
+ GstElementClass *klass = GST_ELEMENT_GET_CLASS (demux);
GstPadTemplate *templ;
templ = gst_element_class_get_pad_template (klass, "sink");
demux->sinkpad = gst_pad_new_from_template (templ, "sink");
- gst_pad_set_setcaps_function (demux->sinkpad,
- GST_DEBUG_FUNCPTR (gst_multiple_stream_demux_setcaps));
gst_pad_set_chain_function (demux->sinkpad,
GST_DEBUG_FUNCPTR (gst_multiple_stream_demux_chain));
gst_pad_set_event_function (demux->sinkpad,
@@ -552,7 +535,7 @@ gst_multiple_stream_demux_init (GstMultipleStreamDemux * demux,
}
#undef parent_class
-#define parent_class codec_sink_parent_class
+#define parent_class gst_codec_sink_parent_class
typedef struct _GstCodecSink GstCodecSink;
typedef GstBaseSinkClass GstCodecSinkClass;
@@ -566,12 +549,7 @@ struct _GstCodecSink
gint n_raw, n_compressed;
};
-GST_BOILERPLATE (GstCodecSink, gst_codec_sink, GstBaseSink, GST_TYPE_BASE_SINK);
-
-static void
-gst_codec_sink_base_init (gpointer klass)
-{
-}
+G_DEFINE_TYPE (GstCodecSink, gst_codec_sink, GST_TYPE_BASE_SINK);
static gboolean
gst_codec_sink_start (GstBaseSink * bsink)
@@ -607,34 +585,20 @@ gst_codec_sink_class_init (GstCodecSinkClass * klass)
}
static void
-gst_codec_sink_init (GstCodecSink * sink, GstCodecSinkClass * klass)
+gst_codec_sink_init (GstCodecSink * sink)
{
gst_base_sink_set_sync (GST_BASE_SINK (sink), TRUE);
}
#undef parent_class
-#define parent_class audio_codec_sink_parent_class
+#define parent_class gst_audio_codec_sink_parent_class
typedef GstCodecSink GstAudioCodecSink;
typedef GstCodecSinkClass GstAudioCodecSinkClass;
-GST_BOILERPLATE (GstAudioCodecSink, gst_audio_codec_sink, GstBaseSink,
+G_DEFINE_TYPE (GstAudioCodecSink, gst_audio_codec_sink,
gst_codec_sink_get_type ());
-static void
-gst_audio_codec_sink_base_init (gpointer klass)
-{
- static GstStaticPadTemplate sink_templ = GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK, GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("audio/x-raw-int; audio/x-compressed")
- );
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
- gst_element_class_add_static_pad_template (element_class, &sink_templ);
- gst_element_class_set_details_simple (element_class,
- "AudioCodecSink", "Sink/Audio", "yep", "me");
-}
-
static gboolean
gst_audio_codec_sink_set_caps (GstBaseSink * bsink, GstCaps * caps)
{
@@ -643,7 +607,7 @@ gst_audio_codec_sink_set_caps (GstBaseSink * bsink, GstCaps * caps)
s = gst_caps_get_structure (caps, 0);
- if (gst_structure_has_name (s, "audio/x-raw-int")) {
+ if (gst_structure_has_name (s, "audio/x-raw")) {
sink->raw = TRUE;
} else if (gst_structure_has_name (s, "audio/x-compressed")) {
sink->raw = FALSE;
@@ -657,41 +621,36 @@ gst_audio_codec_sink_set_caps (GstBaseSink * bsink, GstCaps * caps)
static void
gst_audio_codec_sink_class_init (GstAudioCodecSinkClass * klass)
{
+ static GstStaticPadTemplate sink_templ = GST_STATIC_PAD_TEMPLATE ("sink",
+ GST_PAD_SINK, GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("audio/x-raw; audio/x-compressed")
+ );
GstBaseSinkClass *basesink_class = (GstBaseSinkClass *) klass;
+ GstElementClass *element_class = (GstElementClass *) klass;
basesink_class->set_caps = gst_audio_codec_sink_set_caps;
+
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&sink_templ));
+ gst_element_class_set_details_simple (element_class, "AudioCodecSink",
+ "Sink/Audio", "yep", "me");
}
static void
-gst_audio_codec_sink_init (GstAudioCodecSink * sink,
- GstAudioCodecSinkClass * klass)
+gst_audio_codec_sink_init (GstAudioCodecSink * sink)
{
sink->audio = TRUE;
}
#undef parent_class
-#define parent_class video_codec_sink_parent_class
+#define parent_class gst_video_codec_sink_parent_class
typedef GstCodecSink GstVideoCodecSink;
typedef GstCodecSinkClass GstVideoCodecSinkClass;
-GST_BOILERPLATE (GstVideoCodecSink, gst_video_codec_sink, GstBaseSink,
+G_DEFINE_TYPE (GstVideoCodecSink, gst_video_codec_sink,
gst_codec_sink_get_type ());
-static void
-gst_video_codec_sink_base_init (gpointer klass)
-{
- static GstStaticPadTemplate sink_templ = GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK, GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("video/x-raw-rgb; video/x-compressed")
- );
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
- gst_element_class_add_static_pad_template (element_class, &sink_templ);
- gst_element_class_set_details_simple (element_class,
- "VideoCodecSink", "Sink/Video", "yep", "me");
-}
-
static gboolean
gst_video_codec_sink_set_caps (GstBaseSink * bsink, GstCaps * caps)
{
@@ -700,7 +659,7 @@ gst_video_codec_sink_set_caps (GstBaseSink * bsink, GstCaps * caps)
s = gst_caps_get_structure (caps, 0);
- if (gst_structure_has_name (s, "video/x-raw-rgb")) {
+ if (gst_structure_has_name (s, "video/x-raw")) {
sink->raw = TRUE;
} else if (gst_structure_has_name (s, "video/x-compressed")) {
sink->raw = FALSE;
@@ -714,18 +673,29 @@ gst_video_codec_sink_set_caps (GstBaseSink * bsink, GstCaps * caps)
static void
gst_video_codec_sink_class_init (GstVideoCodecSinkClass * klass)
{
+ static GstStaticPadTemplate sink_templ = GST_STATIC_PAD_TEMPLATE ("sink",
+ GST_PAD_SINK, GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("video/x-raw; video/x-compressed")
+ );
+ GstElementClass *element_class = (GstElementClass *) klass;
GstBaseSinkClass *basesink_class = (GstBaseSinkClass *) klass;
basesink_class->set_caps = gst_video_codec_sink_set_caps;
+
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&sink_templ));
+ gst_element_class_set_details_simple (element_class, "VideoCodecSink",
+ "Sink/Video", "yep", "me");
}
static void
-gst_video_codec_sink_init (GstVideoCodecSink * sink,
- GstVideoCodecSinkClass * klass)
+gst_video_codec_sink_init (GstVideoCodecSink * sink)
{
sink->audio = FALSE;
}
+#undef parent_class
+
/***** The actual test *****/
#define SWITCH_TIMEOUT (15)
#define NSWITCHES (100)
@@ -785,7 +755,7 @@ stream_switch_test_create_pipeline (InsanityGstPipelineTest * ptest,
gpointer userdata)
{
const char *launch_line =
- "playbin2 audio-sink=\"audiocodecsink name=asink\" video-sink=\"videocodecsink name=vsink\" text-sink=\"capsfilter caps=\\\"text/plain\\\" ! fakesink name=tsink sync=true\"";
+ "playbin audio-sink=\"audiocodecsink name=asink\" video-sink=\"videocodecsink name=vsink\" text-sink=\"capsfilter caps=\\\"text/plain\\\" ! fakesink name=tsink sync=true\"";
GError *error = NULL;
gst_element_register (NULL, "capssrc", GST_RANK_PRIMARY,
@@ -1406,12 +1376,12 @@ probe (InsanityGstTest * gtest, GstPad * pad, GstMiniObject * object,
TEST_LOCK ();
buffer = GST_BUFFER (object);
- caps = GST_BUFFER_CAPS (object);
+ caps = gst_pad_get_current_caps (pad);
s = gst_caps_get_structure (caps, 0);
- if (gst_structure_has_name (s, "video/x-raw-rgb")
+ if (gst_structure_has_name (s, "video/x-raw")
|| gst_structure_has_name (s, "video/x-compressed"))
type = STREAM_TYPE_VIDEO;
- else if (gst_structure_has_name (s, "audio/x-raw-int")
+ else if (gst_structure_has_name (s, "audio/x-raw")
|| gst_structure_has_name (s, "audio/x-compressed"))
type = STREAM_TYPE_AUDIO;
else if (gst_structure_has_name (s, "text/plain"))
@@ -1419,9 +1389,7 @@ probe (InsanityGstTest * gtest, GstPad * pad, GstMiniObject * object,
else
g_assert_not_reached ();
- g_assert (GST_BUFFER_SIZE (buffer) > 0);
-
- marker = GST_BUFFER_DATA (buffer)[0];
+ gst_buffer_extract (buffer, 0, &marker, 1);
insanity_test_printf (test,
"%d: Found marker %d, current marker %d (wait switch: %d)\n", type,
@@ -1542,7 +1510,7 @@ main (int argc, char **argv)
g_type_init ();
ptest = insanity_gst_pipeline_test_new ("stream-switch-test",
- "Tests stream switching inside playbin2", NULL);
+ "Tests stream switching inside playbin", NULL);
test = INSANITY_TEST (ptest);
g_value_init (&vdef, G_TYPE_UINT);
@@ -1556,7 +1524,7 @@ main (int argc, char **argv)
insanity_test_add_checklist_item (test, "install-probes",
"Probes were installed on the sinks", NULL, FALSE);
insanity_test_add_checklist_item (test, "found-all-streams",
- "Streams were successfully detected by playbin2", NULL, FALSE);
+ "Streams were successfully detected by playbin", NULL, FALSE);
insanity_test_add_checklist_item (test, "stream-switch",
"Streams were successfully switched", NULL, FALSE);
insanity_test_add_checklist_item (test, "streams-constant",
diff --git a/tests/insanity-test-gst-subtitles.c b/tests/insanity-test-gst-subtitles.c
index 70888b8..ce0d444 100644
--- a/tests/insanity-test-gst-subtitles.c
+++ b/tests/insanity-test-gst-subtitles.c
@@ -97,6 +97,7 @@ static GstElement *glob_videotestsrc = NULL;
/* Gloabl fields */
static MediaDescriptorParser *glob_parser = NULL;
static GList *glob_subtitled_frames = NULL;
+static GstVideoInfo glob_video_info;
/* Media descriptor writer context */
static MediaDescriptorWriter *glob_writer = NULL;
@@ -422,22 +423,13 @@ renderer_probe_cb (InsanityGstTest * ptest, GstPad * pad,
GstEvent *event = GST_EVENT (object);
switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_NEWSEGMENT:
+ case GST_EVENT_SEGMENT:
{
- GstFormat fmt;
- gint64 start, stop, position;
- gdouble rate, applied_rate;
- gboolean update;
-
/* We do not care about event during subtitle generation */
if (glob_in_progress == TEST_SUBTTILE_DESCRIPTOR_GENERATION)
goto done;
- gst_event_parse_new_segment_full (event, &update, &rate,
- &applied_rate, &fmt, &start, &stop, &position);
- gst_segment_set_newsegment_full
- (&glob_renderer_sink_probe->last_segment, update, rate,
- applied_rate, fmt, start, stop, position);
+ gst_event_copy_segment (event, &glob_renderer_sink_probe->last_segment);
if (glob_renderer_sink_probe->waiting_segment == FALSE)
/* Cache the segment as it will be our reference but don't look
@@ -465,12 +457,15 @@ done:
static gboolean
frame_contains_subtitles (GstBuffer * buff)
{
+ GstVideoFrame frame;
guint x, y, first_sub_pix_x = 0, first_sub_pix_y = 0, last_sub_y = 0;
+ guint8 *data;
- guint8 *data = GST_BUFFER_DATA (buff);
+ gst_video_frame_map (&frame, &glob_video_info, buff, GST_MAP_READ);
+ data = frame.data[0];
- for (y = 0; y < 1080; y++) {
- for (x = 0; x < 1920 * 3; x += 3) {
+ for (y = 0; y < GST_VIDEO_INFO_HEIGHT (&glob_video_info); y++) {
+ for (x = 0; x < GST_VIDEO_INFO_WIDTH (&glob_video_info) * 3; x += 3) {
if ((data[x + y * 1920 * 3] != 0x00) ||
(data[x + y * 1920 * 3 + 1] != 0x00) ||
(data[x + y * 1920 * 3 + 2] != 0x00)) {
@@ -601,18 +596,10 @@ probe_cb (InsanityGstTest * ptest, GstPad * pad, GstMiniObject * object,
GstEvent *event = GST_EVENT (object);
switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_NEWSEGMENT:
+ case GST_EVENT_SEGMENT:
{
- GstFormat fmt;
- gint64 start, stop, position;
- gdouble rate, applied_rate;
- gboolean update;
-
- gst_event_parse_new_segment_full (event, &update, &rate,
- &applied_rate, &fmt, &start, &stop, &position);
- gst_segment_set_newsegment_full
- (&glob_suboverlay_src_probe->last_segment, update, rate,
- applied_rate, fmt, start, stop, position);
+ gst_event_copy_segment (event,
+ &glob_suboverlay_src_probe->last_segment);
if (glob_suboverlay_src_probe->waiting_first_segment == TRUE) {
insanity_test_validate_checklist_item (test, "first-segment", TRUE,
@@ -646,7 +633,7 @@ done:
static gint
find_renderer_subtitle_sinkpad (GstPad * pad)
{
- GstCaps *caps = gst_pad_get_caps (pad);
+ GstCaps *caps = gst_pad_get_current_caps (pad);
GstStructure *stru = gst_caps_get_structure (caps, 0);
gst_object_unref (pad);
@@ -664,11 +651,12 @@ static void
suboverlay_child_added_cb (GstElement * suboverlay, GstElement * child,
InsanityTest * test)
{
- GstIterator *it;
+ GstIterator *it = NULL;
GstPad *render_sub_sink, *tmppad;
GstElementFactory *fact;
const gchar *klass, *name;
gulong probe_id;
+ GValue value = { 0, };
gboolean is_renderer = FALSE;
@@ -690,15 +678,18 @@ suboverlay_child_added_cb (GstElement * suboverlay, GstElement * child,
is_renderer = TRUE;
if (is_renderer == FALSE)
- return;
+ goto done;
LOG (test, "Renderer found: %s", name);
/* Now adding the probe to the renderer "subtitle" sink pad */
it = gst_element_iterate_sink_pads (child);
- render_sub_sink = gst_iterator_find_custom (it,
- (GCompareFunc) find_renderer_subtitle_sinkpad, NULL);
- gst_iterator_free (it);
+ if (gst_iterator_find_custom (it,
+ (GCompareFunc) find_renderer_subtitle_sinkpad, &value, NULL)) {
+ render_sub_sink = g_value_get_object (&value);
+ } else {
+ goto done;
+ }
if (insanity_gst_test_add_data_probe (INSANITY_GST_TEST (test),
GST_BIN (glob_pipeline), GST_OBJECT_NAME (child),
@@ -718,9 +709,13 @@ suboverlay_child_added_cb (GstElement * suboverlay, GstElement * child,
"Failed to attach probe to fakesink");
insanity_test_done (test);
- return;
+ goto done;
}
+done:
+ if (it)
+ gst_iterator_free (it);
+
}
static gboolean
@@ -738,7 +733,7 @@ pad_added_cb (GstElement * element, GstPad * new_pad, InsanityTest * test)
SUBTITLES_TEST_LOCK ();
/* First check if the pad caps are compatible with the suboverlay */
- caps = gst_pad_get_caps (new_pad);
+ caps = gst_pad_get_current_caps (new_pad);
suboverlaysinkpad = gst_element_get_compatible_pad (glob_suboverlay, new_pad,
caps);
@@ -881,8 +876,10 @@ create_pipeline (InsanityGstPipelineTest * ptest, gpointer unused_data)
if (capsfilter == NULL)
goto creation_failed;
- caps = gst_video_format_new_caps (GST_VIDEO_FORMAT_RGB, 1920, 1080, 25, 1,
- 1, 1);
+ gst_video_info_init (&glob_video_info);
+ gst_video_info_set_format (&glob_video_info, GST_VIDEO_FORMAT_RGB, 1920,
+ 1080);
+ caps = gst_video_info_to_caps (&glob_video_info);
g_object_set (capsfilter, "caps", caps, NULL);
@@ -892,15 +889,13 @@ create_pipeline (InsanityGstPipelineTest * ptest, gpointer unused_data)
/* We want the last frame that we will "parse" to check if it contains
* subtitles to be in RGB to make simpler for us */
- caps = gst_caps_from_string ("video/x-raw-rgb, bpp=24, height=(gint)1080,"
- "width=(gint)1920;");
g_object_set (capsfilter1, "caps", caps, NULL);
- colorspace = gst_element_factory_make ("ffmpegcolorspace", NULL);
+ colorspace = gst_element_factory_make ("videoconvert", NULL);
if (colorspace == NULL)
goto creation_failed;
- colorspace1 = gst_element_factory_make ("ffmpegcolorspace", NULL);
+ colorspace1 = gst_element_factory_make ("videoconvert", NULL);
if (colorspace1 == NULL)
goto creation_failed;
diff --git a/tests/media-descriptor-parser.c b/tests/media-descriptor-parser.c
index cd54255..47d4211 100644
--- a/tests/media-descriptor-parser.c
+++ b/tests/media-descriptor-parser.c
@@ -116,7 +116,7 @@ deserialize_tagnode (const gchar ** names, const gchar ** values)
for (i = 0; names[i] != NULL; i++) {
if (g_strcmp0 (names[i], "content") == 0)
- tagnode->taglist = gst_structure_from_string (values[i], NULL);
+ tagnode->taglist = gst_tag_list_new_from_string (values[i]);
}
return tagnode;
@@ -366,7 +366,7 @@ media_descriptor_parser_add_stream (MediaDescriptorParser * parser,
g_return_val_if_fail (IS_MEDIA_DESCRIPTOR_PARSER (parser), FALSE);
g_return_val_if_fail (parser->priv->filenode, FALSE);
- caps = gst_pad_get_caps (pad);
+ caps = gst_pad_query_caps (pad, NULL);
for (tmp = parser->priv->filenode->streams; tmp; tmp = tmp->next) {
StreamNode *streamnode = (StreamNode *) tmp->data;
diff --git a/tests/media-descriptor-writer.c b/tests/media-descriptor-writer.c
index c7c6ec4..9c82738 100644
--- a/tests/media-descriptor-writer.c
+++ b/tests/media-descriptor-writer.c
@@ -194,7 +194,7 @@ media_descriptor_writer_add_stream (MediaDescriptorWriter * writer,
g_return_val_if_fail (IS_MEDIA_DESCRIPTOR_WRITER (writer), FALSE);
g_return_val_if_fail (writer->priv->filenode, FALSE);
- caps = gst_pad_get_caps (pad);
+ caps = gst_pad_get_current_caps (pad);
for (tmp = writer->priv->filenode->streams; tmp; tmp = tmp->next) {
StreamNode *streamnode = (StreamNode *) tmp->data;