check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 2005 Andy Wingo <wingo@pobox.com>
|
2005-06-22 19:22:34 +00:00
|
|
|
* Copyright (C) <2005> Thomas Vander Stichele <thomas at apestaart dot org>
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
*
|
|
|
|
* gstcaps.c: Unit test for GstCaps
|
|
|
|
*
|
|
|
|
* 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:44:48 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
*/
|
2017-11-24 12:41:20 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
|
2005-08-20 12:14:28 +00:00
|
|
|
#include <gst/check/gstcheck.h>
|
2006-07-02 12:54:03 +00:00
|
|
|
#include <gst/gstcaps.h>
|
2005-06-22 19:22:34 +00:00
|
|
|
#include "capslist.h"
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
|
2005-07-09 16:36:18 +00:00
|
|
|
GST_START_TEST (test_from_string)
|
2005-06-22 19:22:34 +00:00
|
|
|
{
|
|
|
|
GstCaps *caps;
|
2005-11-22 11:56:01 +00:00
|
|
|
GstCaps *caps2;
|
|
|
|
gchar *to_str;
|
2005-06-22 19:22:34 +00:00
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < G_N_ELEMENTS (caps_list); i++) {
|
|
|
|
caps = gst_caps_from_string (caps_list[i]);
|
|
|
|
fail_if (caps == NULL,
|
|
|
|
"Could not create caps from string %s\n", caps_list[i]);
|
2005-11-22 11:56:01 +00:00
|
|
|
to_str = gst_caps_to_string (caps);
|
|
|
|
fail_if (to_str == NULL,
|
|
|
|
"Could not convert caps back to string %s\n", caps_list[i]);
|
gstvalue: Add GstFlagSet type
GstFlagSet is a new type designed for negotiating sets
of boolean capabilities flags, consisting of a 32-bit
flags bitfield and 32-bit mask field. The mask field
indicates which of the flags bits an element needs to have
as specific values, and which it doesn't care about.
This allows efficient negotiation of arrays of boolean
capabilities.
The standard serialisation format is FLAGS:MASK, with
flags and mask fields expressed in hexadecimal, however
GstFlagSet has a gst_register_flagset() function, which
associates a new GstFlagSet derived type with an existing
GFlags gtype. When serializing a GstFlagSet with an
associated set of GFlags, it also serializes a human-readable
form of the flags for easier debugging.
It is possible to parse a GFlags style serialisation of a
flagset, without the hex portion on the front. ie,
+flag1/flag2/flag3+flag4, to indicate that
flag1 & flag4 must be set, and flag2/flag3 must be unset,
and any other flags are don't-care.
https://bugzilla.gnome.org/show_bug.cgi?id=746373
2015-05-25 06:23:33 +00:00
|
|
|
caps2 = gst_caps_from_string (to_str);
|
2005-11-22 11:56:01 +00:00
|
|
|
fail_if (caps2 == NULL, "Could not create caps from string %s\n", to_str);
|
|
|
|
|
2006-07-01 20:56:56 +00:00
|
|
|
fail_unless (gst_caps_is_equal (caps, caps));
|
2005-11-22 11:56:01 +00:00
|
|
|
fail_unless (gst_caps_is_equal (caps, caps2));
|
|
|
|
|
2006-01-28 00:59:37 +00:00
|
|
|
gst_caps_unref (caps);
|
|
|
|
gst_caps_unref (caps2);
|
2005-11-22 11:56:01 +00:00
|
|
|
g_free (to_str);
|
2005-06-22 19:22:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-07-09 16:36:18 +00:00
|
|
|
GST_END_TEST;
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
|
2005-07-09 16:36:18 +00:00
|
|
|
GST_START_TEST (test_double_append)
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
{
|
|
|
|
GstStructure *s1;
|
|
|
|
GstCaps *c1;
|
|
|
|
|
2020-01-27 11:58:57 +00:00
|
|
|
c1 = gst_caps_new_empty ();
|
2011-08-22 10:19:19 +00:00
|
|
|
s1 = gst_structure_from_string ("audio/x-raw,rate=44100", NULL);
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
gst_caps_append_structure (c1, s1);
|
|
|
|
ASSERT_CRITICAL (gst_caps_append_structure (c1, s1));
|
2005-10-10 23:55:39 +00:00
|
|
|
|
|
|
|
gst_caps_unref (c1);
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
}
|
|
|
|
|
2005-07-09 16:36:18 +00:00
|
|
|
GST_END_TEST;
|
2005-06-22 19:22:34 +00:00
|
|
|
|
2005-07-09 16:36:18 +00:00
|
|
|
GST_START_TEST (test_mutability)
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
{
|
|
|
|
GstStructure *s1;
|
|
|
|
GstCaps *c1;
|
|
|
|
gint ret;
|
|
|
|
|
2020-01-27 11:58:57 +00:00
|
|
|
c1 = gst_caps_new_empty ();
|
2011-08-22 10:19:19 +00:00
|
|
|
s1 = gst_structure_from_string ("audio/x-raw,rate=44100", NULL);
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
gst_structure_set (s1, "rate", G_TYPE_INT, 48000, NULL);
|
|
|
|
gst_caps_append_structure (c1, s1);
|
|
|
|
gst_structure_set (s1, "rate", G_TYPE_INT, 22500, NULL);
|
|
|
|
gst_caps_ref (c1);
|
|
|
|
ASSERT_CRITICAL (gst_structure_set (s1, "rate", G_TYPE_INT, 11250, NULL));
|
|
|
|
fail_unless (gst_structure_get_int (s1, "rate", &ret));
|
|
|
|
fail_unless (ret == 22500);
|
|
|
|
ASSERT_CRITICAL (gst_caps_set_simple (c1, "rate", G_TYPE_INT, 11250, NULL));
|
|
|
|
fail_unless (gst_structure_get_int (s1, "rate", &ret));
|
|
|
|
fail_unless (ret == 22500);
|
|
|
|
gst_caps_unref (c1);
|
|
|
|
gst_structure_set (s1, "rate", G_TYPE_INT, 11250, NULL);
|
|
|
|
fail_unless (gst_structure_get_int (s1, "rate", &ret));
|
|
|
|
fail_unless (ret == 11250);
|
|
|
|
gst_caps_set_simple (c1, "rate", G_TYPE_INT, 1, NULL);
|
|
|
|
fail_unless (gst_structure_get_int (s1, "rate", &ret));
|
|
|
|
fail_unless (ret == 1);
|
2005-10-10 23:55:39 +00:00
|
|
|
gst_caps_unref (c1);
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
}
|
2005-06-22 19:22:34 +00:00
|
|
|
|
2005-07-09 16:36:18 +00:00
|
|
|
GST_END_TEST;
|
2005-06-22 19:22:34 +00:00
|
|
|
|
2005-08-22 15:08:44 +00:00
|
|
|
GST_START_TEST (test_static_caps)
|
|
|
|
{
|
2011-08-22 10:19:19 +00:00
|
|
|
static GstStaticCaps scaps = GST_STATIC_CAPS ("audio/x-raw,rate=44100");
|
2005-08-22 15:08:44 +00:00
|
|
|
GstCaps *caps1;
|
|
|
|
GstCaps *caps2;
|
2013-03-25 08:16:05 +00:00
|
|
|
static GstStaticCaps sany = GST_STATIC_CAPS_ANY;
|
|
|
|
static GstStaticCaps snone = GST_STATIC_CAPS_NONE;
|
2005-08-22 15:08:44 +00:00
|
|
|
|
|
|
|
/* caps creation */
|
|
|
|
caps1 = gst_static_caps_get (&scaps);
|
|
|
|
fail_unless (caps1 != NULL);
|
|
|
|
/* 1 refcount core, one from us */
|
|
|
|
fail_unless (GST_CAPS_REFCOUNT (caps1) == 2);
|
|
|
|
|
|
|
|
/* caps should be the same */
|
|
|
|
caps2 = gst_static_caps_get (&scaps);
|
|
|
|
fail_unless (caps2 != NULL);
|
|
|
|
/* 1 refcount core, two from us */
|
|
|
|
fail_unless (GST_CAPS_REFCOUNT (caps1) == 3);
|
|
|
|
/* caps must be equal */
|
|
|
|
fail_unless (caps1 == caps2);
|
|
|
|
|
|
|
|
gst_caps_unref (caps1);
|
|
|
|
gst_caps_unref (caps2);
|
2013-03-25 08:16:05 +00:00
|
|
|
|
|
|
|
caps1 = gst_static_caps_get (&sany);
|
|
|
|
fail_unless (gst_caps_is_equal (caps1, GST_CAPS_ANY));
|
|
|
|
caps2 = gst_static_caps_get (&snone);
|
|
|
|
fail_unless (gst_caps_is_equal (caps2, GST_CAPS_NONE));
|
|
|
|
fail_if (gst_caps_is_equal (caps1, caps2));
|
|
|
|
gst_caps_unref (caps1);
|
|
|
|
gst_caps_unref (caps2);
|
2005-08-22 15:08:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2005-09-29 10:56:57 +00:00
|
|
|
static const gchar non_simple_caps_string[] =
|
2011-08-22 10:19:19 +00:00
|
|
|
"video/x-raw, format=(string)I420, framerate=(fraction)[ 1/100, 100 ], "
|
|
|
|
"width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-raw, "
|
|
|
|
"format=(string)YUY2, framerate=(fraction)[ 1/100, 100 ], width=(int)[ 16, 4096 ], "
|
|
|
|
"height=(int)[ 16, 4096 ]; video/x-raw, format=(string)RGB8_PALETTED, "
|
|
|
|
"framerate=(fraction)[ 1/100, 100 ], width=(int)[ 16, 4096 ], "
|
|
|
|
"height=(int)[ 16, 4096 ]; video/x-raw, "
|
|
|
|
"format=(string){ I420, YUY2, YV12 }, width=(int)[ 16, 4096 ], "
|
Implement fraction ranges and extend GstFraction to support arithmetic subtraction, as well as deserialization from i...
Original commit message from CVS:
* check/gst/capslist.h:
* check/gst/gstcaps.c: (GST_START_TEST):
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
* gst/gststructure.c: (gst_structure_parse_range),
(gst_structure_fixate_field_nearest_fraction):
* gst/gststructure.h:
* gst/gstvalue.c: (gst_value_init_fraction_range),
(gst_value_free_fraction_range), (gst_value_copy_fraction_range),
(gst_value_collect_fraction_range),
(gst_value_lcopy_fraction_range), (gst_value_set_fraction_range),
(gst_value_set_fraction_range_full),
(gst_value_get_fraction_range_min),
(gst_value_get_fraction_range_max),
(gst_value_serialize_fraction_range),
(gst_value_transform_fraction_range_string),
(gst_value_compare_fraction_range),
(gst_value_deserialize_fraction_range),
(gst_value_intersect_fraction_fraction_range),
(gst_value_intersect_fraction_range_fraction_range),
(gst_value_subtract_fraction_fraction_range),
(gst_value_subtract_fraction_range_fraction),
(gst_value_subtract_fraction_range_fraction_range),
(gst_value_collect_fraction), (gst_value_fraction_multiply),
(gst_value_fraction_subtract), (gst_value_deserialize_fraction),
(gst_value_transform_string_fraction), (_gst_value_initialize):
* gst/gstvalue.h:
Implement fraction ranges and extend GstFraction to support
arithmetic subtraction, as well as deserialization from integer
strings such as "100"
Add a testsuite as for int and double range set operations
2005-11-21 23:54:59 +00:00
|
|
|
"height=(int)[ 16, 4096 ], framerate=(fraction)[ 1/100, 100 ]";
|
2005-09-29 10:56:57 +00:00
|
|
|
|
|
|
|
static gboolean
|
2011-08-22 10:19:19 +00:00
|
|
|
check_string_list (const GValue * format_value)
|
2005-09-29 10:56:57 +00:00
|
|
|
{
|
2011-08-22 10:19:19 +00:00
|
|
|
const GValue *string_value;
|
|
|
|
gboolean got_rgb8 = FALSE;
|
2005-09-29 10:56:57 +00:00
|
|
|
gboolean got_yv12 = FALSE;
|
|
|
|
gboolean got_i420 = FALSE;
|
|
|
|
gboolean got_yuy2 = FALSE;
|
2011-08-22 10:19:19 +00:00
|
|
|
const gchar *string;
|
|
|
|
|
|
|
|
string_value = gst_value_list_get_value (format_value, 0);
|
|
|
|
fail_unless (string_value != NULL);
|
|
|
|
fail_unless (G_VALUE_HOLDS_STRING (string_value));
|
|
|
|
string = g_value_get_string (string_value);
|
|
|
|
fail_unless (string != NULL);
|
|
|
|
got_rgb8 = got_rgb8 || (g_str_equal (string, "RGB8_PALETTED"));
|
|
|
|
got_i420 = got_i420 || (g_str_equal (string, "I420"));
|
|
|
|
got_yuy2 = got_yuy2 || (g_str_equal (string, "YUY2"));
|
|
|
|
got_yv12 = got_yv12 || (g_str_equal (string, "YV12"));
|
|
|
|
|
|
|
|
string_value = gst_value_list_get_value (format_value, 1);
|
|
|
|
fail_unless (string_value != NULL);
|
|
|
|
fail_unless (G_VALUE_HOLDS_STRING (string_value));
|
|
|
|
string = g_value_get_string (string_value);
|
|
|
|
fail_unless (string != NULL);
|
|
|
|
got_rgb8 = got_rgb8 || (g_str_equal (string, "RGB8_PALETTED"));
|
|
|
|
got_i420 = got_i420 || (g_str_equal (string, "I420"));
|
|
|
|
got_yuy2 = got_yuy2 || (g_str_equal (string, "YUY2"));
|
|
|
|
got_yv12 = got_yv12 || (g_str_equal (string, "YV12"));
|
|
|
|
|
|
|
|
string_value = gst_value_list_get_value (format_value, 2);
|
|
|
|
fail_unless (string_value != NULL);
|
|
|
|
fail_unless (G_VALUE_HOLDS_STRING (string_value));
|
|
|
|
string = g_value_get_string (string_value);
|
|
|
|
fail_unless (string != NULL);
|
|
|
|
got_rgb8 = got_rgb8 || (g_str_equal (string, "RGB8_PALETTED"));
|
|
|
|
got_i420 = got_i420 || (g_str_equal (string, "I420"));
|
|
|
|
got_yuy2 = got_yuy2 || (g_str_equal (string, "YUY2"));
|
|
|
|
got_yv12 = got_yv12 || (g_str_equal (string, "YV12"));
|
|
|
|
|
|
|
|
string_value = gst_value_list_get_value (format_value, 3);
|
|
|
|
fail_unless (string_value != NULL);
|
|
|
|
fail_unless (G_VALUE_HOLDS_STRING (string_value));
|
|
|
|
string = g_value_get_string (string_value);
|
|
|
|
fail_unless (string != NULL);
|
|
|
|
got_rgb8 = got_rgb8 || (g_str_equal (string, "RGB8_PALETTED"));
|
|
|
|
got_i420 = got_i420 || (g_str_equal (string, "I420"));
|
|
|
|
got_yuy2 = got_yuy2 || (g_str_equal (string, "YUY2"));
|
|
|
|
got_yv12 = got_yv12 || (g_str_equal (string, "YV12"));
|
|
|
|
|
|
|
|
return (got_rgb8 && got_i420 && got_yuy2 && got_yv12);
|
2005-09-29 10:56:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GST_START_TEST (test_simplify)
|
|
|
|
{
|
2011-08-22 10:19:19 +00:00
|
|
|
GstStructure *s1;
|
2006-07-02 12:57:19 +00:00
|
|
|
GstCaps *caps;
|
2005-09-29 10:56:57 +00:00
|
|
|
|
|
|
|
caps = gst_caps_from_string (non_simple_caps_string);
|
|
|
|
fail_unless (caps != NULL,
|
|
|
|
"gst_caps_from_string (non_simple_caps_string) failed");
|
|
|
|
|
2012-03-12 10:38:37 +00:00
|
|
|
caps = gst_caps_simplify (caps);
|
|
|
|
fail_unless (caps != NULL, "gst_caps_simplify() should have worked");
|
2005-09-29 10:56:57 +00:00
|
|
|
|
|
|
|
/* check simplified caps, should be:
|
|
|
|
*
|
2011-08-22 10:19:19 +00:00
|
|
|
* video/x-raw, format=(string){ RGB8_PALETTED, YV12, YUY2, I420 },
|
2005-10-15 15:53:59 +00:00
|
|
|
* width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ],
|
Implement fraction ranges and extend GstFraction to support arithmetic subtraction, as well as deserialization from i...
Original commit message from CVS:
* check/gst/capslist.h:
* check/gst/gstcaps.c: (GST_START_TEST):
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
* gst/gststructure.c: (gst_structure_parse_range),
(gst_structure_fixate_field_nearest_fraction):
* gst/gststructure.h:
* gst/gstvalue.c: (gst_value_init_fraction_range),
(gst_value_free_fraction_range), (gst_value_copy_fraction_range),
(gst_value_collect_fraction_range),
(gst_value_lcopy_fraction_range), (gst_value_set_fraction_range),
(gst_value_set_fraction_range_full),
(gst_value_get_fraction_range_min),
(gst_value_get_fraction_range_max),
(gst_value_serialize_fraction_range),
(gst_value_transform_fraction_range_string),
(gst_value_compare_fraction_range),
(gst_value_deserialize_fraction_range),
(gst_value_intersect_fraction_fraction_range),
(gst_value_intersect_fraction_range_fraction_range),
(gst_value_subtract_fraction_fraction_range),
(gst_value_subtract_fraction_range_fraction),
(gst_value_subtract_fraction_range_fraction_range),
(gst_value_collect_fraction), (gst_value_fraction_multiply),
(gst_value_fraction_subtract), (gst_value_deserialize_fraction),
(gst_value_transform_string_fraction), (_gst_value_initialize):
* gst/gstvalue.h:
Implement fraction ranges and extend GstFraction to support
arithmetic subtraction, as well as deserialization from integer
strings such as "100"
Add a testsuite as for int and double range set operations
2005-11-21 23:54:59 +00:00
|
|
|
* framerate=(fraction)[ 1/100, 100 ]
|
2005-09-29 10:56:57 +00:00
|
|
|
*/
|
2011-08-22 10:19:19 +00:00
|
|
|
GST_DEBUG ("simplyfied %" GST_PTR_FORMAT, caps);
|
|
|
|
fail_unless (gst_caps_get_size (caps) == 1);
|
2005-09-29 10:56:57 +00:00
|
|
|
s1 = gst_caps_get_structure (caps, 0);
|
|
|
|
fail_unless (s1 != NULL);
|
|
|
|
|
2011-08-22 10:19:19 +00:00
|
|
|
fail_unless (gst_structure_has_name (s1, "video/x-raw"));
|
2005-09-29 10:56:57 +00:00
|
|
|
{
|
|
|
|
const GValue *framerate_value;
|
|
|
|
const GValue *format_value;
|
|
|
|
const GValue *width_value;
|
|
|
|
const GValue *height_value;
|
Implement fraction ranges and extend GstFraction to support arithmetic subtraction, as well as deserialization from i...
Original commit message from CVS:
* check/gst/capslist.h:
* check/gst/gstcaps.c: (GST_START_TEST):
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
* gst/gststructure.c: (gst_structure_parse_range),
(gst_structure_fixate_field_nearest_fraction):
* gst/gststructure.h:
* gst/gstvalue.c: (gst_value_init_fraction_range),
(gst_value_free_fraction_range), (gst_value_copy_fraction_range),
(gst_value_collect_fraction_range),
(gst_value_lcopy_fraction_range), (gst_value_set_fraction_range),
(gst_value_set_fraction_range_full),
(gst_value_get_fraction_range_min),
(gst_value_get_fraction_range_max),
(gst_value_serialize_fraction_range),
(gst_value_transform_fraction_range_string),
(gst_value_compare_fraction_range),
(gst_value_deserialize_fraction_range),
(gst_value_intersect_fraction_fraction_range),
(gst_value_intersect_fraction_range_fraction_range),
(gst_value_subtract_fraction_fraction_range),
(gst_value_subtract_fraction_range_fraction),
(gst_value_subtract_fraction_range_fraction_range),
(gst_value_collect_fraction), (gst_value_fraction_multiply),
(gst_value_fraction_subtract), (gst_value_deserialize_fraction),
(gst_value_transform_string_fraction), (_gst_value_initialize):
* gst/gstvalue.h:
Implement fraction ranges and extend GstFraction to support
arithmetic subtraction, as well as deserialization from integer
strings such as "100"
Add a testsuite as for int and double range set operations
2005-11-21 23:54:59 +00:00
|
|
|
const GValue *val_fps;
|
|
|
|
GValue test_fps = { 0, };
|
2005-09-29 10:56:57 +00:00
|
|
|
gint min_width, max_width;
|
|
|
|
gint min_height, max_height;
|
|
|
|
|
2011-08-22 10:19:19 +00:00
|
|
|
format_value = gst_structure_get_value (s1, "format");
|
2005-09-29 10:56:57 +00:00
|
|
|
fail_unless (format_value != NULL);
|
|
|
|
fail_unless (GST_VALUE_HOLDS_LIST (format_value));
|
2011-08-22 10:19:19 +00:00
|
|
|
fail_unless (gst_value_list_get_size (format_value) == 4);
|
|
|
|
fail_unless (check_string_list (format_value) == TRUE);
|
2005-09-29 10:56:57 +00:00
|
|
|
|
Implement fraction ranges and extend GstFraction to support arithmetic subtraction, as well as deserialization from i...
Original commit message from CVS:
* check/gst/capslist.h:
* check/gst/gstcaps.c: (GST_START_TEST):
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
* gst/gststructure.c: (gst_structure_parse_range),
(gst_structure_fixate_field_nearest_fraction):
* gst/gststructure.h:
* gst/gstvalue.c: (gst_value_init_fraction_range),
(gst_value_free_fraction_range), (gst_value_copy_fraction_range),
(gst_value_collect_fraction_range),
(gst_value_lcopy_fraction_range), (gst_value_set_fraction_range),
(gst_value_set_fraction_range_full),
(gst_value_get_fraction_range_min),
(gst_value_get_fraction_range_max),
(gst_value_serialize_fraction_range),
(gst_value_transform_fraction_range_string),
(gst_value_compare_fraction_range),
(gst_value_deserialize_fraction_range),
(gst_value_intersect_fraction_fraction_range),
(gst_value_intersect_fraction_range_fraction_range),
(gst_value_subtract_fraction_fraction_range),
(gst_value_subtract_fraction_range_fraction),
(gst_value_subtract_fraction_range_fraction_range),
(gst_value_collect_fraction), (gst_value_fraction_multiply),
(gst_value_fraction_subtract), (gst_value_deserialize_fraction),
(gst_value_transform_string_fraction), (_gst_value_initialize):
* gst/gstvalue.h:
Implement fraction ranges and extend GstFraction to support
arithmetic subtraction, as well as deserialization from integer
strings such as "100"
Add a testsuite as for int and double range set operations
2005-11-21 23:54:59 +00:00
|
|
|
g_value_init (&test_fps, GST_TYPE_FRACTION);
|
2011-08-22 10:19:19 +00:00
|
|
|
framerate_value = gst_structure_get_value (s1, "framerate");
|
2005-09-29 10:56:57 +00:00
|
|
|
fail_unless (framerate_value != NULL);
|
Implement fraction ranges and extend GstFraction to support arithmetic subtraction, as well as deserialization from i...
Original commit message from CVS:
* check/gst/capslist.h:
* check/gst/gstcaps.c: (GST_START_TEST):
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
* gst/gststructure.c: (gst_structure_parse_range),
(gst_structure_fixate_field_nearest_fraction):
* gst/gststructure.h:
* gst/gstvalue.c: (gst_value_init_fraction_range),
(gst_value_free_fraction_range), (gst_value_copy_fraction_range),
(gst_value_collect_fraction_range),
(gst_value_lcopy_fraction_range), (gst_value_set_fraction_range),
(gst_value_set_fraction_range_full),
(gst_value_get_fraction_range_min),
(gst_value_get_fraction_range_max),
(gst_value_serialize_fraction_range),
(gst_value_transform_fraction_range_string),
(gst_value_compare_fraction_range),
(gst_value_deserialize_fraction_range),
(gst_value_intersect_fraction_fraction_range),
(gst_value_intersect_fraction_range_fraction_range),
(gst_value_subtract_fraction_fraction_range),
(gst_value_subtract_fraction_range_fraction),
(gst_value_subtract_fraction_range_fraction_range),
(gst_value_collect_fraction), (gst_value_fraction_multiply),
(gst_value_fraction_subtract), (gst_value_deserialize_fraction),
(gst_value_transform_string_fraction), (_gst_value_initialize):
* gst/gstvalue.h:
Implement fraction ranges and extend GstFraction to support
arithmetic subtraction, as well as deserialization from integer
strings such as "100"
Add a testsuite as for int and double range set operations
2005-11-21 23:54:59 +00:00
|
|
|
fail_unless (GST_VALUE_HOLDS_FRACTION_RANGE (framerate_value));
|
|
|
|
|
|
|
|
val_fps = gst_value_get_fraction_range_min (framerate_value);
|
|
|
|
gst_value_set_fraction (&test_fps, 1, 100);
|
|
|
|
fail_unless (gst_value_compare (&test_fps, val_fps) == GST_VALUE_EQUAL);
|
|
|
|
|
|
|
|
val_fps = gst_value_get_fraction_range_max (framerate_value);
|
|
|
|
gst_value_set_fraction (&test_fps, 100, 1);
|
|
|
|
fail_unless (gst_value_compare (&test_fps, val_fps) == GST_VALUE_EQUAL);
|
|
|
|
|
|
|
|
g_value_unset (&test_fps);
|
2005-09-29 10:56:57 +00:00
|
|
|
|
2011-08-22 10:19:19 +00:00
|
|
|
width_value = gst_structure_get_value (s1, "width");
|
2005-09-29 10:56:57 +00:00
|
|
|
fail_unless (width_value != NULL);
|
|
|
|
fail_unless (GST_VALUE_HOLDS_INT_RANGE (width_value));
|
|
|
|
min_width = gst_value_get_int_range_min (width_value);
|
|
|
|
max_width = gst_value_get_int_range_max (width_value);
|
|
|
|
fail_unless (min_width == 16 && max_width == 4096);
|
|
|
|
|
2011-08-22 10:19:19 +00:00
|
|
|
height_value = gst_structure_get_value (s1, "height");
|
2005-09-29 10:56:57 +00:00
|
|
|
fail_unless (height_value != NULL);
|
|
|
|
fail_unless (GST_VALUE_HOLDS_INT_RANGE (height_value));
|
|
|
|
min_height = gst_value_get_int_range_min (height_value);
|
|
|
|
max_height = gst_value_get_int_range_max (height_value);
|
|
|
|
fail_unless (min_height == 16 && max_height == 4096);
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_caps_unref (caps);
|
2020-03-07 09:09:05 +00:00
|
|
|
|
|
|
|
caps = gst_caps_new_empty ();
|
|
|
|
caps = gst_caps_simplify (caps);
|
|
|
|
fail_unless (gst_caps_is_empty (caps));
|
|
|
|
gst_caps_unref (caps);
|
|
|
|
|
|
|
|
caps = gst_caps_new_any ();
|
|
|
|
caps = gst_caps_simplify (caps);
|
|
|
|
fail_unless (gst_caps_is_any (caps));
|
|
|
|
gst_caps_unref (caps);
|
2005-09-29 10:56:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2006-07-02 12:54:03 +00:00
|
|
|
GST_START_TEST (test_truncate)
|
|
|
|
{
|
|
|
|
GstCaps *caps;
|
|
|
|
|
|
|
|
caps = gst_caps_from_string (non_simple_caps_string);
|
|
|
|
fail_unless (caps != NULL,
|
|
|
|
"gst_caps_from_string (non_simple_caps_string) failed");
|
|
|
|
fail_unless_equals_int (gst_caps_get_size (caps), 4);
|
2012-03-11 17:57:44 +00:00
|
|
|
caps = gst_caps_truncate (caps);
|
2006-07-02 12:54:03 +00:00
|
|
|
fail_unless_equals_int (gst_caps_get_size (caps), 1);
|
|
|
|
gst_caps_unref (caps);
|
2020-03-07 09:09:05 +00:00
|
|
|
|
|
|
|
caps = gst_caps_new_empty ();
|
|
|
|
caps = gst_caps_truncate (caps);
|
|
|
|
fail_if (caps == NULL);
|
|
|
|
fail_unless (gst_caps_is_empty (caps));
|
|
|
|
gst_caps_unref (caps);
|
|
|
|
|
|
|
|
caps = gst_caps_new_any ();
|
|
|
|
caps = gst_caps_truncate (caps);
|
|
|
|
fail_if (caps == NULL);
|
|
|
|
fail_unless (gst_caps_is_any (caps));
|
|
|
|
gst_caps_unref (caps);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
|
|
|
GST_START_TEST (test_fixate)
|
|
|
|
{
|
|
|
|
GstCaps *caps, *expected;
|
|
|
|
|
|
|
|
caps = gst_caps_from_string (non_simple_caps_string);
|
|
|
|
fail_unless (caps != NULL,
|
|
|
|
"gst_caps_from_string (non_simple_caps_string) failed");
|
|
|
|
fail_unless_equals_int (gst_caps_get_size (caps), 4);
|
|
|
|
caps = gst_caps_fixate (caps);
|
|
|
|
fail_unless_equals_int (gst_caps_get_size (caps), 1);
|
|
|
|
expected =
|
|
|
|
gst_caps_from_string
|
|
|
|
("video/x-raw, format=(string)I420, framerate=(fraction)1/100, "
|
|
|
|
"width=(int)16, height=(int)16");
|
|
|
|
fail_unless (gst_caps_is_equal (caps, expected));
|
|
|
|
gst_caps_unref (caps);
|
|
|
|
gst_caps_unref (expected);
|
|
|
|
|
|
|
|
caps = gst_caps_new_empty ();
|
|
|
|
caps = gst_caps_fixate (caps);
|
|
|
|
fail_if (caps == NULL);
|
|
|
|
fail_unless (gst_caps_is_empty (caps));
|
|
|
|
gst_caps_unref (caps);
|
2006-07-02 12:54:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2011-05-27 11:38:51 +00:00
|
|
|
GST_START_TEST (test_subset)
|
|
|
|
{
|
|
|
|
GstCaps *c1, *c2;
|
|
|
|
|
2011-08-22 10:19:19 +00:00
|
|
|
c1 = gst_caps_from_string ("video/x-raw; video/x-raw");
|
|
|
|
c2 = gst_caps_from_string ("video/x-raw, format=(string)YUY2");
|
2011-05-27 11:38:51 +00:00
|
|
|
fail_unless (gst_caps_is_subset (c2, c1));
|
|
|
|
fail_if (gst_caps_is_subset (c1, c2));
|
|
|
|
gst_caps_unref (c1);
|
|
|
|
gst_caps_unref (c2);
|
|
|
|
|
|
|
|
c1 = gst_caps_from_string
|
2011-08-22 10:19:19 +00:00
|
|
|
("audio/x-raw, channels=(int)[ 1, 2 ], rate=(int)44100");
|
|
|
|
c2 = gst_caps_from_string ("audio/x-raw, channels=(int)1, rate=(int)44100");
|
2011-05-27 11:38:51 +00:00
|
|
|
fail_unless (gst_caps_is_subset (c2, c1));
|
|
|
|
fail_if (gst_caps_is_subset (c1, c2));
|
|
|
|
gst_caps_unref (c1);
|
|
|
|
gst_caps_unref (c2);
|
2011-05-30 05:36:58 +00:00
|
|
|
|
2011-08-22 10:19:19 +00:00
|
|
|
c1 = gst_caps_from_string ("audio/x-raw, channels=(int) {1}");
|
|
|
|
c2 = gst_caps_from_string ("audio/x-raw, channels=(int)1");
|
2011-05-30 05:36:58 +00:00
|
|
|
fail_unless (gst_caps_is_subset (c2, c1));
|
|
|
|
fail_unless (gst_caps_is_subset (c1, c2));
|
|
|
|
fail_unless (gst_caps_is_equal (c1, c2));
|
|
|
|
gst_caps_unref (c1);
|
|
|
|
gst_caps_unref (c2);
|
|
|
|
|
|
|
|
c1 = gst_caps_from_string
|
2011-08-22 10:19:19 +00:00
|
|
|
("audio/x-raw, rate=(int)44100, channels=(int)3, format=(string)U16_LE");
|
2011-05-30 05:36:58 +00:00
|
|
|
c2 = gst_caps_from_string
|
2011-08-22 10:19:19 +00:00
|
|
|
("audio/x-raw, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ], format=(string){ S16_LE, U16_LE }");
|
2011-05-30 05:36:58 +00:00
|
|
|
fail_unless (gst_caps_is_subset (c1, c2));
|
|
|
|
fail_if (gst_caps_is_subset (c2, c1));
|
|
|
|
gst_caps_unref (c1);
|
|
|
|
gst_caps_unref (c2);
|
2013-02-13 09:46:37 +00:00
|
|
|
|
|
|
|
c1 = gst_caps_from_string ("video/x-h264, parsed=(boolean)true");
|
|
|
|
c2 = gst_caps_from_string
|
|
|
|
("video/x-h264, stream-format=(string)byte-stream, alignment=(string)nal");
|
|
|
|
fail_if (gst_caps_is_subset (c2, c1));
|
|
|
|
fail_if (gst_caps_is_subset (c1, c2));
|
|
|
|
fail_if (gst_caps_is_equal (c1, c2));
|
|
|
|
gst_caps_unref (c1);
|
|
|
|
gst_caps_unref (c2);
|
2020-03-07 09:09:05 +00:00
|
|
|
|
|
|
|
c1 = gst_caps_from_string ("video/x-h264, parsed=(boolean)true");
|
|
|
|
c2 = gst_caps_new_empty ();
|
|
|
|
fail_unless (gst_caps_is_subset (c2, c1));
|
|
|
|
fail_if (gst_caps_is_subset (c1, c2));
|
|
|
|
fail_if (gst_caps_is_equal (c1, c2));
|
|
|
|
gst_caps_unref (c1);
|
|
|
|
gst_caps_unref (c2);
|
|
|
|
|
|
|
|
c1 = gst_caps_from_string ("video/x-h264, parsed=(boolean)true");
|
|
|
|
c2 = gst_caps_new_any ();
|
|
|
|
fail_if (gst_caps_is_subset (c2, c1));
|
|
|
|
fail_unless (gst_caps_is_subset (c1, c2));
|
|
|
|
fail_if (gst_caps_is_equal (c1, c2));
|
|
|
|
gst_caps_unref (c1);
|
|
|
|
gst_caps_unref (c2);
|
2011-05-27 11:38:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2013-10-02 11:03:54 +00:00
|
|
|
GST_START_TEST (test_subset_duplication)
|
|
|
|
{
|
|
|
|
GstCaps *c1, *c2;
|
|
|
|
|
|
|
|
c1 = gst_caps_from_string ("audio/x-raw, format=(string)F32LE");
|
2013-11-13 18:55:41 +00:00
|
|
|
c2 = gst_caps_from_string ("audio/x-raw, format=(string)F32LE");
|
|
|
|
|
|
|
|
fail_unless (gst_caps_is_subset (c1, c2));
|
|
|
|
fail_unless (gst_caps_is_subset (c2, c1));
|
|
|
|
|
|
|
|
gst_caps_unref (c2);
|
|
|
|
c2 = gst_caps_from_string ("audio/x-raw, format=(string){ F32LE }");
|
|
|
|
|
|
|
|
fail_unless (gst_caps_is_subset (c1, c2));
|
|
|
|
fail_unless (gst_caps_is_subset (c2, c1));
|
|
|
|
|
|
|
|
gst_caps_unref (c2);
|
2013-10-02 11:03:54 +00:00
|
|
|
c2 = gst_caps_from_string ("audio/x-raw, format=(string){ F32LE, F32LE }");
|
|
|
|
|
|
|
|
fail_unless (gst_caps_is_subset (c1, c2));
|
2013-11-13 18:55:41 +00:00
|
|
|
fail_unless (gst_caps_is_subset (c2, c1));
|
|
|
|
|
|
|
|
gst_caps_unref (c2);
|
|
|
|
c2 = gst_caps_from_string
|
|
|
|
("audio/x-raw, format=(string){ F32LE, F32LE, F32LE }");
|
|
|
|
|
|
|
|
fail_unless (gst_caps_is_subset (c1, c2));
|
|
|
|
fail_unless (gst_caps_is_subset (c2, c1));
|
|
|
|
|
2013-10-02 11:03:54 +00:00
|
|
|
gst_caps_unref (c1);
|
|
|
|
gst_caps_unref (c2);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2006-08-24 10:40:31 +00:00
|
|
|
GST_START_TEST (test_merge_fundamental)
|
|
|
|
{
|
|
|
|
GstCaps *c1, *c2;
|
|
|
|
|
|
|
|
/* ANY + specific = ANY */
|
2011-08-22 10:19:19 +00:00
|
|
|
c1 = gst_caps_from_string ("audio/x-raw,rate=44100");
|
2006-08-24 10:40:31 +00:00
|
|
|
c2 = gst_caps_new_any ();
|
2012-03-11 17:57:44 +00:00
|
|
|
c2 = gst_caps_merge (c2, c1);
|
2006-08-24 10:40:31 +00:00
|
|
|
GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2);
|
|
|
|
fail_unless (gst_caps_get_size (c2) == 0, NULL);
|
|
|
|
fail_unless (gst_caps_is_any (c2), NULL);
|
|
|
|
gst_caps_unref (c2);
|
|
|
|
|
|
|
|
/* specific + ANY = ANY */
|
2011-08-22 10:19:19 +00:00
|
|
|
c2 = gst_caps_from_string ("audio/x-raw,rate=44100");
|
2006-08-24 10:40:31 +00:00
|
|
|
c1 = gst_caps_new_any ();
|
2012-03-11 17:57:44 +00:00
|
|
|
c2 = gst_caps_merge (c2, c1);
|
2006-08-24 10:40:31 +00:00
|
|
|
GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2);
|
|
|
|
fail_unless (gst_caps_get_size (c2) == 0, NULL);
|
|
|
|
fail_unless (gst_caps_is_any (c2), NULL);
|
|
|
|
gst_caps_unref (c2);
|
|
|
|
|
|
|
|
/* EMPTY + specific = specific */
|
2011-08-22 10:19:19 +00:00
|
|
|
c1 = gst_caps_from_string ("audio/x-raw,rate=44100");
|
2006-08-24 10:40:31 +00:00
|
|
|
c2 = gst_caps_new_empty ();
|
2012-03-11 17:57:44 +00:00
|
|
|
c2 = gst_caps_merge (c2, c1);
|
2006-08-24 10:40:31 +00:00
|
|
|
GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2);
|
|
|
|
fail_unless (gst_caps_get_size (c2) == 1, NULL);
|
|
|
|
fail_if (gst_caps_is_empty (c2), NULL);
|
|
|
|
gst_caps_unref (c2);
|
|
|
|
|
|
|
|
/* specific + EMPTY = specific */
|
2011-08-22 10:19:19 +00:00
|
|
|
c2 = gst_caps_from_string ("audio/x-raw,rate=44100");
|
2006-08-24 10:40:31 +00:00
|
|
|
c1 = gst_caps_new_empty ();
|
2012-03-11 17:57:44 +00:00
|
|
|
c2 = gst_caps_merge (c2, c1);
|
2006-08-24 10:40:31 +00:00
|
|
|
GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2);
|
|
|
|
fail_unless (gst_caps_get_size (c2) == 1, NULL);
|
|
|
|
fail_if (gst_caps_is_empty (c2), NULL);
|
|
|
|
gst_caps_unref (c2);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
|
|
|
GST_START_TEST (test_merge_same)
|
|
|
|
{
|
2008-08-07 12:28:28 +00:00
|
|
|
GstCaps *c1, *c2, *test;
|
2006-08-24 10:40:31 +00:00
|
|
|
|
|
|
|
/* this is the same */
|
2011-08-22 10:19:19 +00:00
|
|
|
c1 = gst_caps_from_string ("audio/x-raw,rate=44100,channels=1");
|
|
|
|
c2 = gst_caps_from_string ("audio/x-raw,rate=44100,channels=1");
|
2012-03-11 17:57:44 +00:00
|
|
|
c2 = gst_caps_merge (c2, c1);
|
2006-08-24 10:40:31 +00:00
|
|
|
GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2);
|
|
|
|
fail_unless (gst_caps_get_size (c2) == 1, NULL);
|
2011-08-22 10:19:19 +00:00
|
|
|
test = gst_caps_from_string ("audio/x-raw,rate=44100,channels=1");
|
2008-08-07 12:28:28 +00:00
|
|
|
fail_unless (gst_caps_is_equal (c2, test));
|
|
|
|
gst_caps_unref (test);
|
2006-08-24 12:30:04 +00:00
|
|
|
gst_caps_unref (c2);
|
2006-08-24 10:40:31 +00:00
|
|
|
|
|
|
|
/* and so is this */
|
2011-08-22 10:19:19 +00:00
|
|
|
c1 = gst_caps_from_string ("audio/x-raw,rate=44100,channels=1");
|
|
|
|
c2 = gst_caps_from_string ("audio/x-raw,channels=1,rate=44100");
|
2012-03-11 17:57:44 +00:00
|
|
|
c2 = gst_caps_merge (c2, c1);
|
2006-08-24 10:40:31 +00:00
|
|
|
GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2);
|
|
|
|
fail_unless (gst_caps_get_size (c2) == 1, NULL);
|
2006-08-24 12:30:04 +00:00
|
|
|
gst_caps_unref (c2);
|
|
|
|
|
|
|
|
c1 = gst_caps_from_string ("video/x-foo, data=(buffer)AA");
|
|
|
|
c2 = gst_caps_from_string ("video/x-foo, data=(buffer)AABB");
|
2012-03-11 17:57:44 +00:00
|
|
|
c2 = gst_caps_merge (c2, c1);
|
2006-08-24 12:30:04 +00:00
|
|
|
GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2);
|
|
|
|
fail_unless (gst_caps_get_size (c2) == 2, NULL);
|
|
|
|
gst_caps_unref (c2);
|
|
|
|
|
|
|
|
c1 = gst_caps_from_string ("video/x-foo, data=(buffer)AABB");
|
|
|
|
c2 = gst_caps_from_string ("video/x-foo, data=(buffer)AA");
|
2012-03-11 17:57:44 +00:00
|
|
|
c2 = gst_caps_merge (c2, c1);
|
2006-08-24 12:30:04 +00:00
|
|
|
GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2);
|
|
|
|
fail_unless (gst_caps_get_size (c2) == 2, NULL);
|
|
|
|
gst_caps_unref (c2);
|
|
|
|
|
|
|
|
c1 = gst_caps_from_string ("video/x-foo, data=(buffer)AA");
|
|
|
|
c2 = gst_caps_from_string ("video/x-foo, data=(buffer)AA");
|
2012-03-11 17:57:44 +00:00
|
|
|
c2 = gst_caps_merge (c2, c1);
|
2006-08-24 12:30:04 +00:00
|
|
|
GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2);
|
|
|
|
fail_unless (gst_caps_get_size (c2) == 1, NULL);
|
|
|
|
gst_caps_unref (c2);
|
2006-08-24 10:40:31 +00:00
|
|
|
|
2006-08-24 12:30:04 +00:00
|
|
|
c1 = gst_caps_from_string ("video/x-foo, data=(buffer)AA");
|
|
|
|
c2 = gst_caps_from_string ("video/x-bar, data=(buffer)AA");
|
2012-03-11 17:57:44 +00:00
|
|
|
c2 = gst_caps_merge (c2, c1);
|
2006-08-24 12:30:04 +00:00
|
|
|
GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2);
|
|
|
|
fail_unless (gst_caps_get_size (c2) == 2, NULL);
|
2006-08-24 10:40:31 +00:00
|
|
|
gst_caps_unref (c2);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
|
|
|
GST_START_TEST (test_merge_subset)
|
|
|
|
{
|
2008-08-07 12:28:28 +00:00
|
|
|
GstCaps *c1, *c2, *test;
|
2006-08-24 10:40:31 +00:00
|
|
|
|
|
|
|
/* the 2nd is already covered */
|
2011-08-22 10:19:19 +00:00
|
|
|
c2 = gst_caps_from_string ("audio/x-raw,channels=[1,2]");
|
|
|
|
c1 = gst_caps_from_string ("audio/x-raw,channels=1");
|
2012-03-11 17:57:44 +00:00
|
|
|
c2 = gst_caps_merge (c2, c1);
|
2006-08-24 10:40:31 +00:00
|
|
|
GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2);
|
|
|
|
fail_unless (gst_caps_get_size (c2) == 1, NULL);
|
2011-08-22 10:19:19 +00:00
|
|
|
test = gst_caps_from_string ("audio/x-raw,channels=[1,2]");
|
2008-08-07 12:28:28 +00:00
|
|
|
fail_unless (gst_caps_is_equal (c2, test));
|
2006-08-24 12:30:04 +00:00
|
|
|
gst_caps_unref (c2);
|
2008-08-07 12:28:28 +00:00
|
|
|
gst_caps_unref (test);
|
2006-08-24 10:40:31 +00:00
|
|
|
|
|
|
|
/* here it is not */
|
2011-08-22 10:19:19 +00:00
|
|
|
c2 = gst_caps_from_string ("audio/x-raw,channels=1,rate=44100");
|
|
|
|
c1 = gst_caps_from_string ("audio/x-raw,channels=[1,2],rate=44100");
|
2012-03-11 17:57:44 +00:00
|
|
|
c2 = gst_caps_merge (c2, c1);
|
2006-08-24 10:40:31 +00:00
|
|
|
GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2);
|
|
|
|
fail_unless (gst_caps_get_size (c2) == 2, NULL);
|
2011-08-22 10:19:19 +00:00
|
|
|
test = gst_caps_from_string ("audio/x-raw,channels=[1,2],rate=44100");
|
2008-08-07 12:28:28 +00:00
|
|
|
fail_unless (gst_caps_is_equal (c2, test));
|
|
|
|
gst_caps_unref (c2);
|
|
|
|
gst_caps_unref (test);
|
|
|
|
|
|
|
|
/* second one was already contained in the first one */
|
2011-08-22 10:19:19 +00:00
|
|
|
c2 = gst_caps_from_string ("audio/x-raw,channels=[1,3]");
|
|
|
|
c1 = gst_caps_from_string ("audio/x-raw,channels=[1,2]");
|
2012-03-11 17:57:44 +00:00
|
|
|
c2 = gst_caps_merge (c2, c1);
|
2008-08-07 12:28:28 +00:00
|
|
|
GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2);
|
|
|
|
fail_unless (gst_caps_get_size (c2) == 1, NULL);
|
2011-08-22 10:19:19 +00:00
|
|
|
test = gst_caps_from_string ("audio/x-raw,channels=[1,3]");
|
2008-08-07 12:28:28 +00:00
|
|
|
fail_unless (gst_caps_is_equal (c2, test));
|
|
|
|
gst_caps_unref (c2);
|
|
|
|
gst_caps_unref (test);
|
|
|
|
|
|
|
|
/* second one was already contained in the first one */
|
2011-08-22 10:19:19 +00:00
|
|
|
c2 = gst_caps_from_string ("audio/x-raw,channels=[1,4]");
|
|
|
|
c1 = gst_caps_from_string ("audio/x-raw,channels=[1,2]");
|
2012-03-11 17:57:44 +00:00
|
|
|
c2 = gst_caps_merge (c2, c1);
|
2008-08-07 12:28:28 +00:00
|
|
|
GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2);
|
|
|
|
fail_unless (gst_caps_get_size (c2) == 1, NULL);
|
2011-08-22 10:19:19 +00:00
|
|
|
test = gst_caps_from_string ("audio/x-raw,channels=[1,4]");
|
2008-08-07 12:28:28 +00:00
|
|
|
fail_unless (gst_caps_is_equal (c2, test));
|
|
|
|
gst_caps_unref (c2);
|
|
|
|
gst_caps_unref (test);
|
|
|
|
|
|
|
|
/* second one was already contained in the first one */
|
2011-08-22 10:19:19 +00:00
|
|
|
c2 = gst_caps_from_string ("audio/x-raw,channels=[1,4]");
|
|
|
|
c1 = gst_caps_from_string ("audio/x-raw,channels=[2,4]");
|
2012-03-11 17:57:44 +00:00
|
|
|
c2 = gst_caps_merge (c2, c1);
|
2008-08-07 12:28:28 +00:00
|
|
|
GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2);
|
|
|
|
fail_unless (gst_caps_get_size (c2) == 1, NULL);
|
2011-08-22 10:19:19 +00:00
|
|
|
test = gst_caps_from_string ("audio/x-raw,channels=[1,4]");
|
2008-08-07 12:28:28 +00:00
|
|
|
fail_unless (gst_caps_is_equal (c2, test));
|
|
|
|
gst_caps_unref (c2);
|
|
|
|
gst_caps_unref (test);
|
|
|
|
|
|
|
|
/* second one was already contained in the first one */
|
2011-08-22 10:19:19 +00:00
|
|
|
c2 = gst_caps_from_string ("audio/x-raw,channels=[1,4]");
|
|
|
|
c1 = gst_caps_from_string ("audio/x-raw,channels=[2,3]");
|
2012-03-11 17:57:44 +00:00
|
|
|
c2 = gst_caps_merge (c2, c1);
|
2008-08-07 12:28:28 +00:00
|
|
|
GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2);
|
|
|
|
fail_unless (gst_caps_get_size (c2) == 1, NULL);
|
2011-08-22 10:19:19 +00:00
|
|
|
test = gst_caps_from_string ("audio/x-raw,channels=[1,4]");
|
2008-08-07 12:28:28 +00:00
|
|
|
fail_unless (gst_caps_is_equal (c2, test));
|
|
|
|
gst_caps_unref (c2);
|
|
|
|
gst_caps_unref (test);
|
|
|
|
|
|
|
|
/* these caps cannot be merged */
|
2011-08-22 10:19:19 +00:00
|
|
|
c2 = gst_caps_from_string ("audio/x-raw,channels=[2,3]");
|
|
|
|
c1 = gst_caps_from_string ("audio/x-raw,channels=[1,4]");
|
2012-03-11 17:57:44 +00:00
|
|
|
c2 = gst_caps_merge (c2, c1);
|
2008-08-07 12:28:28 +00:00
|
|
|
GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2);
|
|
|
|
fail_unless (gst_caps_get_size (c2) == 2, NULL);
|
|
|
|
test =
|
|
|
|
gst_caps_from_string
|
2011-08-22 10:19:19 +00:00
|
|
|
("audio/x-raw,channels=[2,3];audio/x-raw,channels=[1,4]");
|
2008-08-07 12:28:28 +00:00
|
|
|
fail_unless (gst_caps_is_equal (c2, test));
|
|
|
|
gst_caps_unref (c2);
|
|
|
|
gst_caps_unref (test);
|
|
|
|
|
|
|
|
/* these caps cannot be merged */
|
2011-08-22 10:19:19 +00:00
|
|
|
c2 = gst_caps_from_string ("audio/x-raw,channels=[1,2]");
|
|
|
|
c1 = gst_caps_from_string ("audio/x-raw,channels=[1,3]");
|
2012-03-11 17:57:44 +00:00
|
|
|
c2 = gst_caps_merge (c2, c1);
|
2008-08-07 12:28:28 +00:00
|
|
|
GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2);
|
|
|
|
fail_unless (gst_caps_get_size (c2) == 2, NULL);
|
|
|
|
test =
|
|
|
|
gst_caps_from_string
|
2011-08-22 10:19:19 +00:00
|
|
|
("audio/x-raw,channels=[1,2];audio/x-raw,channels=[1,3]");
|
2008-08-07 12:28:28 +00:00
|
|
|
fail_unless (gst_caps_is_equal (c2, test));
|
|
|
|
gst_caps_unref (c2);
|
|
|
|
gst_caps_unref (test);
|
2006-08-24 10:40:31 +00:00
|
|
|
|
2011-08-22 10:19:19 +00:00
|
|
|
c2 = gst_caps_from_string ("audio/x-raw,channels={1,2}");
|
|
|
|
c1 = gst_caps_from_string ("audio/x-raw,channels={1,2,3,4}");
|
2012-03-11 17:57:44 +00:00
|
|
|
c2 = gst_caps_merge (c2, c1);
|
2008-08-07 12:28:28 +00:00
|
|
|
GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2);
|
|
|
|
fail_unless (gst_caps_get_size (c2) == 2, NULL);
|
2011-08-22 10:19:19 +00:00
|
|
|
test = gst_caps_from_string ("audio/x-raw,channels={1,2};"
|
|
|
|
"audio/x-raw,channels={1,2,3,4}");
|
2008-08-07 12:28:28 +00:00
|
|
|
fail_unless (gst_caps_is_equal (c2, test));
|
|
|
|
gst_caps_unref (c2);
|
|
|
|
gst_caps_unref (test);
|
|
|
|
|
2011-08-22 10:19:19 +00:00
|
|
|
c2 = gst_caps_from_string ("audio/x-raw,channels={1,2}");
|
|
|
|
c1 = gst_caps_from_string ("audio/x-raw,channels={1,3}");
|
2012-03-11 17:57:44 +00:00
|
|
|
c2 = gst_caps_merge (c2, c1);
|
2008-08-07 12:28:28 +00:00
|
|
|
GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2);
|
|
|
|
fail_unless (gst_caps_get_size (c2) == 2, NULL);
|
2011-08-22 10:19:19 +00:00
|
|
|
test = gst_caps_from_string ("audio/x-raw,channels={1,2};"
|
|
|
|
"audio/x-raw,channels={1,3}");
|
2008-08-07 12:28:28 +00:00
|
|
|
fail_unless (gst_caps_is_equal (c2, test));
|
|
|
|
gst_caps_unref (c2);
|
|
|
|
gst_caps_unref (test);
|
|
|
|
|
2011-08-22 10:19:19 +00:00
|
|
|
c2 = gst_caps_from_string ("video/x-raw, framerate=(fraction){ 15/2, 5/1 }");
|
|
|
|
c1 = gst_caps_from_string ("video/x-raw, framerate=(fraction){ 15/1, 5/1 }");
|
2008-08-07 12:28:28 +00:00
|
|
|
test = gst_caps_copy (c1);
|
2012-03-11 17:57:44 +00:00
|
|
|
c2 = gst_caps_merge (c2, c1);
|
2008-08-07 12:28:28 +00:00
|
|
|
GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2);
|
|
|
|
fail_unless (gst_caps_is_subset (test, c2));
|
|
|
|
gst_caps_unref (test);
|
2006-08-24 10:40:31 +00:00
|
|
|
gst_caps_unref (c2);
|
2011-05-27 11:37:06 +00:00
|
|
|
|
2011-08-22 10:19:19 +00:00
|
|
|
c2 = gst_caps_from_string ("audio/x-raw");
|
|
|
|
c1 = gst_caps_from_string ("audio/x-raw,channels=1");
|
2012-03-11 17:57:44 +00:00
|
|
|
c2 = gst_caps_merge (c2, c1);
|
2011-05-27 11:37:06 +00:00
|
|
|
GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2);
|
|
|
|
fail_unless (gst_caps_get_size (c2) == 1, NULL);
|
2011-08-22 10:19:19 +00:00
|
|
|
test = gst_caps_from_string ("audio/x-raw");
|
2011-05-27 11:37:06 +00:00
|
|
|
fail_unless (gst_caps_is_equal (c2, test));
|
|
|
|
gst_caps_unref (c2);
|
|
|
|
gst_caps_unref (test);
|
|
|
|
|
2011-08-22 10:19:19 +00:00
|
|
|
c2 = gst_caps_from_string ("audio/x-raw,channels=1");
|
|
|
|
c1 = gst_caps_from_string ("audio/x-raw");
|
2012-03-11 17:57:44 +00:00
|
|
|
c2 = gst_caps_merge (c2, c1);
|
2011-05-27 11:37:06 +00:00
|
|
|
GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2);
|
|
|
|
fail_unless (gst_caps_get_size (c2) == 2, NULL);
|
2011-08-22 10:19:19 +00:00
|
|
|
test = gst_caps_from_string ("audio/x-raw,channels=1; audio/x-raw");
|
2011-05-27 11:37:06 +00:00
|
|
|
fail_unless (gst_caps_is_equal (c2, test));
|
|
|
|
gst_caps_unref (c2);
|
|
|
|
gst_caps_unref (test);
|
2006-08-24 10:40:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2006-09-27 09:23:18 +00:00
|
|
|
GST_START_TEST (test_intersect)
|
|
|
|
{
|
|
|
|
GstStructure *s;
|
|
|
|
GstCaps *c1, *c2, *ci1, *ci2;
|
|
|
|
|
|
|
|
/* field not specified = any value possible, so the intersection
|
|
|
|
* should keep fields which are only part of one set of caps */
|
2011-08-22 10:19:19 +00:00
|
|
|
c2 = gst_caps_from_string ("video/x-raw,format=(string)I420,width=20");
|
|
|
|
c1 = gst_caps_from_string ("video/x-raw,format=(string)I420");
|
2006-09-27 09:23:18 +00:00
|
|
|
|
|
|
|
ci1 = gst_caps_intersect (c2, c1);
|
|
|
|
GST_DEBUG ("intersected: %" GST_PTR_FORMAT, ci1);
|
|
|
|
fail_unless (gst_caps_get_size (ci1) == 1, NULL);
|
|
|
|
s = gst_caps_get_structure (ci1, 0);
|
2011-08-22 10:19:19 +00:00
|
|
|
fail_unless (gst_structure_has_name (s, "video/x-raw"));
|
2006-09-27 09:23:18 +00:00
|
|
|
fail_unless (gst_structure_get_value (s, "format") != NULL);
|
|
|
|
fail_unless (gst_structure_get_value (s, "width") != NULL);
|
|
|
|
|
|
|
|
/* with changed order */
|
|
|
|
ci2 = gst_caps_intersect (c1, c2);
|
|
|
|
GST_DEBUG ("intersected: %" GST_PTR_FORMAT, ci2);
|
|
|
|
fail_unless (gst_caps_get_size (ci2) == 1, NULL);
|
|
|
|
s = gst_caps_get_structure (ci2, 0);
|
2011-08-22 10:19:19 +00:00
|
|
|
fail_unless (gst_structure_has_name (s, "video/x-raw"));
|
2006-09-27 09:23:18 +00:00
|
|
|
fail_unless (gst_structure_get_value (s, "format") != NULL);
|
|
|
|
fail_unless (gst_structure_get_value (s, "width") != NULL);
|
|
|
|
|
|
|
|
fail_unless (gst_caps_is_equal (ci1, ci2));
|
|
|
|
|
|
|
|
gst_caps_unref (ci1);
|
|
|
|
gst_caps_unref (ci2);
|
|
|
|
|
|
|
|
gst_caps_unref (c1);
|
|
|
|
gst_caps_unref (c2);
|
|
|
|
|
|
|
|
/* ========== */
|
|
|
|
|
2011-08-22 10:19:19 +00:00
|
|
|
c2 = gst_caps_from_string ("video/x-raw,format=(string)I420,width=20");
|
|
|
|
c1 = gst_caps_from_string ("video/x-raw,format=(string)I420,width=30");
|
2006-09-27 09:23:18 +00:00
|
|
|
|
|
|
|
ci1 = gst_caps_intersect (c2, c1);
|
|
|
|
GST_DEBUG ("intersected: %" GST_PTR_FORMAT, ci1);
|
|
|
|
fail_unless (gst_caps_is_empty (ci1), NULL);
|
|
|
|
|
|
|
|
/* with changed order */
|
|
|
|
ci2 = gst_caps_intersect (c1, c2);
|
|
|
|
GST_DEBUG ("intersected: %" GST_PTR_FORMAT, ci2);
|
|
|
|
fail_unless (gst_caps_is_empty (ci2), NULL);
|
|
|
|
|
|
|
|
fail_unless (gst_caps_is_equal (ci1, ci2));
|
|
|
|
|
|
|
|
gst_caps_unref (ci1);
|
|
|
|
gst_caps_unref (ci2);
|
|
|
|
|
|
|
|
gst_caps_unref (c1);
|
|
|
|
gst_caps_unref (c2);
|
|
|
|
|
|
|
|
/* ========== */
|
|
|
|
|
2011-08-22 10:19:19 +00:00
|
|
|
c2 = gst_caps_from_string ("video/x-raw,format=(string)I420,width=20");
|
|
|
|
c1 = gst_caps_from_string ("video/x-raw2,format=(string)I420,width=20");
|
2006-09-27 09:23:18 +00:00
|
|
|
|
|
|
|
ci1 = gst_caps_intersect (c2, c1);
|
|
|
|
GST_DEBUG ("intersected: %" GST_PTR_FORMAT, ci1);
|
|
|
|
fail_unless (gst_caps_is_empty (ci1), NULL);
|
|
|
|
|
|
|
|
/* with changed order */
|
|
|
|
ci2 = gst_caps_intersect (c1, c2);
|
|
|
|
GST_DEBUG ("intersected: %" GST_PTR_FORMAT, ci2);
|
|
|
|
fail_unless (gst_caps_is_empty (ci2), NULL);
|
|
|
|
|
|
|
|
fail_unless (gst_caps_is_equal (ci1, ci2));
|
|
|
|
|
|
|
|
gst_caps_unref (ci1);
|
|
|
|
gst_caps_unref (ci2);
|
|
|
|
|
|
|
|
gst_caps_unref (c1);
|
|
|
|
gst_caps_unref (c2);
|
|
|
|
|
|
|
|
/* ========== */
|
|
|
|
|
2011-08-22 10:19:19 +00:00
|
|
|
c2 = gst_caps_from_string ("video/x-raw,format=(string)I420,width=20");
|
|
|
|
c1 = gst_caps_from_string ("video/x-raw,format=(string)I420,height=30");
|
2006-09-27 09:23:18 +00:00
|
|
|
|
|
|
|
ci1 = gst_caps_intersect (c2, c1);
|
|
|
|
GST_DEBUG ("intersected: %" GST_PTR_FORMAT, ci1);
|
|
|
|
fail_unless (gst_caps_get_size (ci1) == 1, NULL);
|
|
|
|
s = gst_caps_get_structure (ci1, 0);
|
2011-08-22 10:19:19 +00:00
|
|
|
fail_unless (gst_structure_has_name (s, "video/x-raw"));
|
2006-09-27 09:23:18 +00:00
|
|
|
fail_unless (gst_structure_get_value (s, "format") != NULL);
|
|
|
|
fail_unless (gst_structure_get_value (s, "width") != NULL);
|
|
|
|
fail_unless (gst_structure_get_value (s, "height") != NULL);
|
|
|
|
|
|
|
|
/* with changed order */
|
|
|
|
ci2 = gst_caps_intersect (c1, c2);
|
|
|
|
GST_DEBUG ("intersected: %" GST_PTR_FORMAT, ci2);
|
|
|
|
fail_unless (gst_caps_get_size (ci2) == 1, NULL);
|
|
|
|
s = gst_caps_get_structure (ci2, 0);
|
2011-08-22 10:19:19 +00:00
|
|
|
fail_unless (gst_structure_has_name (s, "video/x-raw"));
|
2006-09-27 09:23:18 +00:00
|
|
|
fail_unless (gst_structure_get_value (s, "format") != NULL);
|
|
|
|
fail_unless (gst_structure_get_value (s, "height") != NULL);
|
|
|
|
fail_unless (gst_structure_get_value (s, "width") != NULL);
|
|
|
|
|
|
|
|
fail_unless (gst_caps_is_equal (ci1, ci2));
|
|
|
|
|
|
|
|
gst_caps_unref (ci1);
|
|
|
|
gst_caps_unref (ci2);
|
|
|
|
|
|
|
|
gst_caps_unref (c1);
|
|
|
|
gst_caps_unref (c2);
|
2020-03-07 09:09:05 +00:00
|
|
|
|
|
|
|
/* ========== */
|
|
|
|
|
|
|
|
c1 = gst_caps_from_string ("video/x-raw,format=(string)I420,width=20");
|
|
|
|
c2 = gst_caps_new_empty ();
|
|
|
|
|
|
|
|
ci1 = gst_caps_intersect (c1, c2);
|
|
|
|
GST_DEBUG ("intersected: %" GST_PTR_FORMAT, ci1);
|
|
|
|
|
|
|
|
fail_unless (gst_caps_is_empty (ci1));
|
|
|
|
fail_unless (gst_caps_get_size (ci1) == 0);
|
|
|
|
|
|
|
|
ci2 = gst_caps_intersect (c2, c1);
|
|
|
|
GST_DEBUG ("intersected: %" GST_PTR_FORMAT, ci2);
|
|
|
|
|
|
|
|
fail_unless (gst_caps_is_empty (ci2));
|
|
|
|
fail_unless (gst_caps_get_size (ci2) == 0);
|
|
|
|
|
|
|
|
fail_unless (gst_caps_is_equal (ci1, ci2));
|
|
|
|
|
|
|
|
gst_caps_unref (ci1);
|
|
|
|
gst_caps_unref (ci2);
|
|
|
|
|
|
|
|
gst_caps_unref (c1);
|
|
|
|
gst_caps_unref (c2);
|
|
|
|
|
|
|
|
|
|
|
|
/* ========== */
|
|
|
|
|
|
|
|
c1 = gst_caps_from_string ("video/x-raw,format=(string)I420,width=20");
|
|
|
|
c2 = gst_caps_new_any ();
|
|
|
|
|
|
|
|
ci1 = gst_caps_intersect (c1, c2);
|
|
|
|
GST_DEBUG ("intersected: %" GST_PTR_FORMAT, ci1);
|
|
|
|
|
|
|
|
fail_unless (gst_caps_is_equal (ci1, c1));
|
|
|
|
|
|
|
|
ci2 = gst_caps_intersect (c2, c1);
|
|
|
|
GST_DEBUG ("intersected: %" GST_PTR_FORMAT, ci2);
|
|
|
|
|
|
|
|
fail_unless (gst_caps_is_equal (ci2, c1));
|
|
|
|
|
|
|
|
fail_unless (gst_caps_is_equal (ci1, ci2));
|
|
|
|
|
|
|
|
gst_caps_unref (ci1);
|
|
|
|
gst_caps_unref (ci2);
|
|
|
|
|
|
|
|
gst_caps_unref (c1);
|
|
|
|
gst_caps_unref (c2);
|
2006-09-27 09:23:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
2006-07-02 12:54:03 +00:00
|
|
|
|
2008-05-18 11:52:39 +00:00
|
|
|
GST_START_TEST (test_intersect2)
|
|
|
|
{
|
|
|
|
GstCaps *caps1, *caps2, *icaps;
|
|
|
|
|
|
|
|
/* tests array subtraction */
|
2011-08-22 10:19:19 +00:00
|
|
|
caps1 = gst_caps_from_string ("audio/x-raw, "
|
2008-05-18 11:52:39 +00:00
|
|
|
"channel-positions=(int)< "
|
|
|
|
"{ 1, 2, 3, 4, 5, 6 }, "
|
|
|
|
"{ 1, 2, 3, 4, 5, 6 }, "
|
|
|
|
"{ 1, 2, 3, 4, 5, 6 }, "
|
|
|
|
"{ 1, 2, 3, 4, 5, 6 }, "
|
|
|
|
"{ 1, 2, 3, 4, 5, 6 }, " "{ 1, 2, 3, 4, 5, 6 }>");
|
2011-08-22 10:19:19 +00:00
|
|
|
caps2 = gst_caps_from_string ("audio/x-raw, "
|
2008-05-18 11:52:39 +00:00
|
|
|
"channel-positions=(int)< 1, 2, 3, 4, 5, 6 >");
|
|
|
|
icaps = gst_caps_intersect (caps1, caps2);
|
|
|
|
GST_LOG ("intersected caps: %" GST_PTR_FORMAT, icaps);
|
|
|
|
fail_if (gst_caps_is_empty (icaps));
|
|
|
|
fail_unless (gst_caps_is_equal (icaps, caps2));
|
|
|
|
gst_caps_unref (caps1);
|
|
|
|
gst_caps_unref (caps2);
|
|
|
|
gst_caps_unref (icaps);
|
|
|
|
|
|
|
|
/* ===== */
|
|
|
|
|
|
|
|
caps1 = gst_caps_from_string ("some/type, foo=(int)< { 1, 2 }, { 3, 4} >");
|
|
|
|
caps2 = gst_caps_from_string ("some/type, foo=(int)< 1, 3 >");
|
|
|
|
icaps = gst_caps_intersect (caps1, caps2);
|
|
|
|
GST_LOG ("intersected caps: %" GST_PTR_FORMAT, icaps);
|
|
|
|
fail_if (gst_caps_is_empty (icaps));
|
|
|
|
fail_unless (gst_caps_is_equal (icaps, caps2));
|
|
|
|
gst_caps_unref (caps1);
|
|
|
|
gst_caps_unref (caps2);
|
|
|
|
gst_caps_unref (icaps);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2012-09-29 13:35:58 +00:00
|
|
|
GST_START_TEST (test_intersect_list_duplicate)
|
|
|
|
{
|
|
|
|
GstCaps *caps1, *caps2, *icaps;
|
|
|
|
|
|
|
|
/* make sure we don't take too long to intersect these.. */
|
|
|
|
caps1 = gst_caps_from_string ("video/x-raw, format=(string)YV12; "
|
|
|
|
"video/x-raw, format=(string)I420; video/x-raw, format=(string)YUY2; "
|
|
|
|
"video/x-raw, format=(string)UYVY; "
|
|
|
|
"video/x-raw, format=(string){ I420, YV12, YUY2, UYVY, AYUV, RGBx, BGRx,"
|
|
|
|
" xRGB, xBGR, { RGBA, RGBA, { RGBA, RGBA }, "
|
|
|
|
"{ RGBA, RGBA, { RGBA, RGBA } }, { RGBA, RGBA, { RGBA, RGBA }, "
|
|
|
|
"{ RGBA, RGBA, { RGBA, RGBA } } }, { RGBA, RGBA, { RGBA, RGBA }, "
|
|
|
|
"{ RGBA, RGBA, { RGBA, RGBA } }, { RGBA, RGBA, { RGBA, RGBA }, "
|
|
|
|
"{ RGBA, RGBA, { RGBA, RGBA } } } }, { RGBA, RGBA, { RGBA, RGBA }, "
|
|
|
|
"{ RGBA, RGBA, { RGBA, RGBA } }, { RGBA, RGBA, { RGBA, RGBA }, "
|
|
|
|
"{ RGBA, RGBA, { RGBA, RGBA } } }, { RGBA, RGBA, { RGBA, RGBA }, "
|
|
|
|
"{ RGBA, RGBA, { RGBA, RGBA } }, { RGBA, RGBA, { RGBA, RGBA }, "
|
|
|
|
"{ RGBA, RGBA, { RGBA, RGBA } } } } } }, BGRA, ARGB, { ABGR, ABGR, "
|
|
|
|
"{ ABGR, ABGR }, { ABGR, ABGR, { ABGR, ABGR } }, "
|
|
|
|
"{ ABGR, ABGR, { ABGR, ABGR }, { ABGR, ABGR, { ABGR, ABGR } } }, "
|
|
|
|
"{ ABGR, ABGR, { ABGR, ABGR }, { ABGR, ABGR, { ABGR, ABGR } }, "
|
|
|
|
"{ ABGR, ABGR, { ABGR, ABGR }, { ABGR, ABGR, { ABGR, ABGR } } } }, "
|
|
|
|
"{ ABGR, ABGR, { ABGR, ABGR }, { ABGR, ABGR, { ABGR, ABGR } }, "
|
|
|
|
"{ ABGR, ABGR, { ABGR, ABGR }, { ABGR, ABGR, { ABGR, ABGR } } }, "
|
|
|
|
"{ ABGR, ABGR, { ABGR, ABGR }, { ABGR, ABGR, { ABGR, ABGR } }, "
|
|
|
|
"{ ABGR, ABGR, { ABGR, ABGR }, { ABGR, ABGR, { ABGR, ABGR } } } } } }, "
|
|
|
|
"RGB, BGR, Y41B, Y42B, YVYU, Y444 }; "
|
|
|
|
"video/x-raw, format=(string){ I420, YV12, YUY2, UYVY, AYUV, RGBx, BGRx, "
|
|
|
|
"xRGB, xBGR, { RGBA, RGBA, { RGBA, RGBA }, "
|
|
|
|
"{ RGBA, RGBA, { RGBA, RGBA } }, { RGBA, RGBA, { RGBA, RGBA }, "
|
|
|
|
"{ RGBA, RGBA, { RGBA, RGBA } } }, { RGBA, RGBA, { RGBA, RGBA }, "
|
|
|
|
"{ RGBA, RGBA, { RGBA, RGBA } }, { RGBA, RGBA, { RGBA, RGBA }, "
|
|
|
|
"{ RGBA, RGBA, { RGBA, RGBA } } } }, { RGBA, RGBA, { RGBA, RGBA }, "
|
|
|
|
"{ RGBA, RGBA, { RGBA, RGBA } }, { RGBA, RGBA, { RGBA, RGBA }, "
|
|
|
|
"{ RGBA, RGBA, { RGBA, RGBA } } }, { RGBA, RGBA, { RGBA, RGBA }, "
|
|
|
|
"{ RGBA, RGBA, { RGBA, RGBA } }, { RGBA, RGBA, { RGBA, RGBA }, "
|
|
|
|
"{ RGBA, RGBA, { RGBA, RGBA } } } } } }, BGRA, ARGB, "
|
|
|
|
"{ ABGR, ABGR, { ABGR, ABGR }, { ABGR, ABGR, { ABGR, ABGR } }, "
|
|
|
|
"{ ABGR, ABGR, { ABGR, ABGR }, { ABGR, ABGR, { ABGR, ABGR } } }, "
|
|
|
|
"{ ABGR, ABGR, { ABGR, ABGR }, { ABGR, ABGR, { ABGR, ABGR } }, "
|
|
|
|
"{ ABGR, ABGR, { ABGR, ABGR }, { ABGR, ABGR, { ABGR, ABGR } } } }, "
|
|
|
|
"{ ABGR, ABGR, { ABGR, ABGR }, { ABGR, ABGR, { ABGR, ABGR } }, "
|
|
|
|
"{ ABGR, ABGR, { ABGR, ABGR }, { ABGR, ABGR, { ABGR, ABGR } } }, "
|
|
|
|
"{ ABGR, ABGR, { ABGR, ABGR }, { ABGR, ABGR, { ABGR, ABGR } }, "
|
|
|
|
"{ ABGR, ABGR, { ABGR, ABGR }, { ABGR, ABGR, { ABGR, ABGR } } } } } }, "
|
|
|
|
"RGB, BGR, Y41B, Y42B, YVYU, Y444, NV12, NV21 }; "
|
|
|
|
"video/x-raw, format=(string){ I420, YV12, YUY2, UYVY, AYUV, RGBx, "
|
|
|
|
"BGRx, xRGB, xBGR, { RGBA, RGBA, { RGBA, RGBA }, "
|
|
|
|
"{ RGBA, RGBA, { RGBA, RGBA } }, { RGBA, RGBA, { RGBA, RGBA }, "
|
|
|
|
"{ RGBA, RGBA, { RGBA, RGBA } } } }, BGRA, ARGB, "
|
|
|
|
"{ ABGR, ABGR, { ABGR, ABGR }, { ABGR, ABGR, { ABGR, ABGR } }, "
|
|
|
|
"{ ABGR, ABGR, { ABGR, ABGR }, { ABGR, ABGR, { ABGR, ABGR } } } }, "
|
|
|
|
"RGB, BGR, Y41B, Y42B, YVYU, Y444, NV12, NV21 }");
|
|
|
|
|
|
|
|
caps2 = gst_caps_copy (caps1);
|
|
|
|
|
|
|
|
icaps = gst_caps_intersect (caps1, caps2);
|
|
|
|
|
|
|
|
gst_caps_unref (caps1);
|
|
|
|
gst_caps_unref (caps2);
|
|
|
|
gst_caps_unref (icaps);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
2011-02-25 13:25:26 +00:00
|
|
|
|
|
|
|
GST_START_TEST (test_intersect_zigzag)
|
|
|
|
{
|
|
|
|
GstCaps *caps1, *caps2, *icaps, *result;
|
|
|
|
|
|
|
|
/* tests if caps order is maintained */
|
|
|
|
caps1 = gst_caps_from_string ("format/A; format/B; format/C; format/D");
|
|
|
|
caps2 = gst_caps_from_string ("format/D; format/A; format/B; format/C");
|
|
|
|
|
|
|
|
icaps = gst_caps_intersect_full (caps1, caps2, GST_CAPS_INTERSECT_ZIG_ZAG);
|
|
|
|
result = gst_caps_from_string ("format/B; format/A; format/D; format/C");
|
|
|
|
GST_LOG ("intersected caps: %" GST_PTR_FORMAT, icaps);
|
|
|
|
fail_if (gst_caps_is_empty (icaps));
|
|
|
|
fail_unless (gst_caps_is_equal (icaps, result));
|
|
|
|
gst_caps_unref (icaps);
|
|
|
|
gst_caps_unref (result);
|
|
|
|
|
|
|
|
icaps = gst_caps_intersect_full (caps2, caps1, GST_CAPS_INTERSECT_FIRST);
|
|
|
|
result = gst_caps_from_string ("format/A; format/B; format/D; format/C");
|
|
|
|
GST_LOG ("intersected caps: %" GST_PTR_FORMAT, icaps);
|
|
|
|
fail_if (gst_caps_is_empty (icaps));
|
|
|
|
fail_unless (gst_caps_is_equal (icaps, result));
|
|
|
|
gst_caps_unref (icaps);
|
|
|
|
gst_caps_unref (result);
|
|
|
|
|
|
|
|
gst_caps_unref (caps1);
|
|
|
|
gst_caps_unref (caps2);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
|
|
|
|
|
|
|
GST_START_TEST (test_intersect_first)
|
|
|
|
{
|
|
|
|
GstCaps *caps1, *caps2, *icaps, *result;
|
|
|
|
|
|
|
|
/* tests if caps order is maintained */
|
|
|
|
caps1 = gst_caps_from_string ("format/A; format/B; format/C; format/D");
|
|
|
|
caps2 = gst_caps_from_string ("format/C; format/D; format/A");
|
|
|
|
icaps = gst_caps_intersect_full (caps1, caps2, GST_CAPS_INTERSECT_FIRST);
|
|
|
|
result = gst_caps_from_string ("format/A; format/C; format/D");
|
|
|
|
GST_LOG ("intersected caps: %" GST_PTR_FORMAT, icaps);
|
|
|
|
fail_if (gst_caps_is_empty (icaps));
|
|
|
|
fail_unless (gst_caps_is_equal (icaps, result));
|
|
|
|
gst_caps_unref (caps1);
|
|
|
|
gst_caps_unref (caps2);
|
|
|
|
gst_caps_unref (icaps);
|
|
|
|
gst_caps_unref (result);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
|
|
|
|
|
|
|
GST_START_TEST (test_intersect_first2)
|
|
|
|
{
|
|
|
|
GstCaps *caps1, *caps2, *icaps, *result;
|
|
|
|
|
|
|
|
/* tests if caps order is maintained */
|
|
|
|
caps1 = gst_caps_from_string ("format/A; format/B; format/C; format/D");
|
|
|
|
caps2 = gst_caps_from_string ("format/D; format/A; format/B; format/C");
|
|
|
|
|
|
|
|
icaps = gst_caps_intersect_full (caps1, caps2, GST_CAPS_INTERSECT_FIRST);
|
|
|
|
result = gst_caps_from_string ("format/A; format/B; format/C; format/D");
|
|
|
|
GST_LOG ("intersected caps: %" GST_PTR_FORMAT, icaps);
|
|
|
|
fail_if (gst_caps_is_empty (icaps));
|
|
|
|
fail_unless (gst_caps_is_equal (icaps, result));
|
|
|
|
gst_caps_unref (icaps);
|
|
|
|
gst_caps_unref (result);
|
|
|
|
|
|
|
|
icaps = gst_caps_intersect_full (caps2, caps1, GST_CAPS_INTERSECT_FIRST);
|
|
|
|
result = gst_caps_from_string ("format/D; format/A; format/B; format/C");
|
|
|
|
GST_LOG ("intersected caps: %" GST_PTR_FORMAT, icaps);
|
|
|
|
fail_if (gst_caps_is_empty (icaps));
|
|
|
|
fail_unless (gst_caps_is_equal (icaps, result));
|
|
|
|
gst_caps_unref (icaps);
|
|
|
|
gst_caps_unref (result);
|
|
|
|
|
|
|
|
gst_caps_unref (caps1);
|
|
|
|
gst_caps_unref (caps2);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2011-05-05 09:28:38 +00:00
|
|
|
GST_START_TEST (test_intersect_duplication)
|
|
|
|
{
|
|
|
|
GstCaps *c1, *c2, *test;
|
|
|
|
|
|
|
|
c1 = gst_caps_from_string
|
2011-08-22 10:19:19 +00:00
|
|
|
("audio/x-raw, format=(string)S16_LE, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2 ]");
|
2011-05-05 09:28:38 +00:00
|
|
|
c2 = gst_caps_from_string
|
2011-08-22 10:19:19 +00:00
|
|
|
("audio/x-raw, format=(string) { S16_LE, S16_BE, U16_LE, U16_BE }, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2 ]; audio/x-raw, format=(string) { S16_LE, S16_BE, U16_LE, U16_BE }, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 11 ]; audio/x-raw, format=(string) { S16_LE, S16_BE, U16_LE, U16_BE }, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 11 ]");
|
2011-05-05 09:28:38 +00:00
|
|
|
|
|
|
|
test = gst_caps_intersect_full (c1, c2, GST_CAPS_INTERSECT_FIRST);
|
|
|
|
fail_unless_equals_int (gst_caps_get_size (test), 1);
|
|
|
|
fail_unless (gst_caps_is_equal (c1, test));
|
|
|
|
gst_caps_unref (c1);
|
|
|
|
gst_caps_unref (c2);
|
|
|
|
gst_caps_unref (test);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
2011-02-25 13:25:26 +00:00
|
|
|
|
gstvalue: Add GstFlagSet type
GstFlagSet is a new type designed for negotiating sets
of boolean capabilities flags, consisting of a 32-bit
flags bitfield and 32-bit mask field. The mask field
indicates which of the flags bits an element needs to have
as specific values, and which it doesn't care about.
This allows efficient negotiation of arrays of boolean
capabilities.
The standard serialisation format is FLAGS:MASK, with
flags and mask fields expressed in hexadecimal, however
GstFlagSet has a gst_register_flagset() function, which
associates a new GstFlagSet derived type with an existing
GFlags gtype. When serializing a GstFlagSet with an
associated set of GFlags, it also serializes a human-readable
form of the flags for easier debugging.
It is possible to parse a GFlags style serialisation of a
flagset, without the hex portion on the front. ie,
+flag1/flag2/flag3+flag4, to indicate that
flag1 & flag4 must be set, and flag2/flag3 must be unset,
and any other flags are don't-care.
https://bugzilla.gnome.org/show_bug.cgi?id=746373
2015-05-25 06:23:33 +00:00
|
|
|
GST_START_TEST (test_intersect_flagset)
|
|
|
|
{
|
|
|
|
GstCaps *c1, *c2, *test;
|
|
|
|
GType test_flagset_type;
|
|
|
|
GstSeekFlags test_flags, test_mask;
|
|
|
|
gchar *test_string;
|
|
|
|
|
|
|
|
/* Test that matching bits inside the mask intersect,
|
|
|
|
* and bits outside the mask don't matter */
|
|
|
|
c1 = gst_caps_from_string ("test/x-caps,field=ffd81d:fffff0");
|
|
|
|
c2 = gst_caps_from_string ("test/x-caps,field=0fd81f:0ffff0");
|
|
|
|
|
|
|
|
test = gst_caps_intersect_full (c1, c2, GST_CAPS_INTERSECT_FIRST);
|
|
|
|
fail_unless_equals_int (gst_caps_get_size (test), 1);
|
|
|
|
fail_unless (gst_caps_is_equal (c1, test));
|
|
|
|
gst_caps_unref (c1);
|
|
|
|
gst_caps_unref (c2);
|
|
|
|
gst_caps_unref (test);
|
|
|
|
|
|
|
|
/* Test that non-matching bits in the mask don't intersect */
|
|
|
|
c1 = gst_caps_from_string ("test/x-caps,field=ff001d:0ffff0");
|
|
|
|
c2 = gst_caps_from_string ("test/x-caps,field=0fd81f:0ffff0");
|
|
|
|
|
|
|
|
test = gst_caps_intersect_full (c1, c2, GST_CAPS_INTERSECT_FIRST);
|
|
|
|
fail_unless (gst_caps_is_empty (test));
|
|
|
|
gst_caps_unref (c1);
|
|
|
|
gst_caps_unref (c2);
|
|
|
|
gst_caps_unref (test);
|
|
|
|
|
|
|
|
/* Check custom flags type serialisation and de-serialisation */
|
|
|
|
test_flagset_type = gst_flagset_register (GST_TYPE_SEEK_FLAGS);
|
|
|
|
fail_unless (g_type_is_a (test_flagset_type, GST_TYPE_FLAG_SET));
|
|
|
|
|
|
|
|
test_flags =
|
|
|
|
GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_TRICKMODE |
|
|
|
|
GST_SEEK_FLAG_TRICKMODE_KEY_UNITS;
|
|
|
|
test_mask =
|
|
|
|
GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_TRICKMODE |
|
|
|
|
GST_SEEK_FLAG_TRICKMODE_NO_AUDIO;
|
|
|
|
|
|
|
|
c1 = gst_caps_new_simple ("test/x-caps", "field", test_flagset_type,
|
2015-06-29 04:57:11 +00:00
|
|
|
test_flags, test_mask, NULL);
|
gstvalue: Add GstFlagSet type
GstFlagSet is a new type designed for negotiating sets
of boolean capabilities flags, consisting of a 32-bit
flags bitfield and 32-bit mask field. The mask field
indicates which of the flags bits an element needs to have
as specific values, and which it doesn't care about.
This allows efficient negotiation of arrays of boolean
capabilities.
The standard serialisation format is FLAGS:MASK, with
flags and mask fields expressed in hexadecimal, however
GstFlagSet has a gst_register_flagset() function, which
associates a new GstFlagSet derived type with an existing
GFlags gtype. When serializing a GstFlagSet with an
associated set of GFlags, it also serializes a human-readable
form of the flags for easier debugging.
It is possible to parse a GFlags style serialisation of a
flagset, without the hex portion on the front. ie,
+flag1/flag2/flag3+flag4, to indicate that
flag1 & flag4 must be set, and flag2/flag3 must be unset,
and any other flags are don't-care.
https://bugzilla.gnome.org/show_bug.cgi?id=746373
2015-05-25 06:23:33 +00:00
|
|
|
|
|
|
|
test_string = gst_caps_to_string (c1);
|
|
|
|
fail_if (test_string == NULL);
|
|
|
|
|
|
|
|
GST_DEBUG ("Serialised caps to %s", test_string);
|
|
|
|
c2 = gst_caps_from_string (test_string);
|
2015-05-30 12:01:09 +00:00
|
|
|
g_free (test_string);
|
gstvalue: Add GstFlagSet type
GstFlagSet is a new type designed for negotiating sets
of boolean capabilities flags, consisting of a 32-bit
flags bitfield and 32-bit mask field. The mask field
indicates which of the flags bits an element needs to have
as specific values, and which it doesn't care about.
This allows efficient negotiation of arrays of boolean
capabilities.
The standard serialisation format is FLAGS:MASK, with
flags and mask fields expressed in hexadecimal, however
GstFlagSet has a gst_register_flagset() function, which
associates a new GstFlagSet derived type with an existing
GFlags gtype. When serializing a GstFlagSet with an
associated set of GFlags, it also serializes a human-readable
form of the flags for easier debugging.
It is possible to parse a GFlags style serialisation of a
flagset, without the hex portion on the front. ie,
+flag1/flag2/flag3+flag4, to indicate that
flag1 & flag4 must be set, and flag2/flag3 must be unset,
and any other flags are don't-care.
https://bugzilla.gnome.org/show_bug.cgi?id=746373
2015-05-25 06:23:33 +00:00
|
|
|
|
2017-03-09 01:09:57 +00:00
|
|
|
fail_unless (gst_caps_is_equal (c1, c2), "Caps %s != %s",
|
|
|
|
gst_caps_to_string (c1), gst_caps_to_string (c2));
|
gstvalue: Add GstFlagSet type
GstFlagSet is a new type designed for negotiating sets
of boolean capabilities flags, consisting of a 32-bit
flags bitfield and 32-bit mask field. The mask field
indicates which of the flags bits an element needs to have
as specific values, and which it doesn't care about.
This allows efficient negotiation of arrays of boolean
capabilities.
The standard serialisation format is FLAGS:MASK, with
flags and mask fields expressed in hexadecimal, however
GstFlagSet has a gst_register_flagset() function, which
associates a new GstFlagSet derived type with an existing
GFlags gtype. When serializing a GstFlagSet with an
associated set of GFlags, it also serializes a human-readable
form of the flags for easier debugging.
It is possible to parse a GFlags style serialisation of a
flagset, without the hex portion on the front. ie,
+flag1/flag2/flag3+flag4, to indicate that
flag1 & flag4 must be set, and flag2/flag3 must be unset,
and any other flags are don't-care.
https://bugzilla.gnome.org/show_bug.cgi?id=746373
2015-05-25 06:23:33 +00:00
|
|
|
|
|
|
|
gst_caps_unref (c1);
|
|
|
|
gst_caps_unref (c2);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
|
|
|
GST_START_TEST (test_union)
|
|
|
|
{
|
|
|
|
GstCaps *c1, *c2, *test, *expect;
|
|
|
|
|
|
|
|
/* Test that matching bits inside the masks union OK, */
|
|
|
|
c1 = gst_caps_from_string ("test/x-caps,field=ffd81d:0ffff0");
|
|
|
|
c2 = gst_caps_from_string ("test/x-caps,field=0fd81f:0ffff0");
|
|
|
|
|
|
|
|
test = gst_caps_merge (c1, c2);
|
|
|
|
test = gst_caps_simplify (test);
|
|
|
|
/* c1, c2 now invalid */
|
|
|
|
fail_unless_equals_int (gst_caps_get_size (test), 1);
|
|
|
|
gst_caps_unref (test);
|
|
|
|
|
|
|
|
/* Test that non-intersecting sets of masked bits are OK */
|
|
|
|
c1 = gst_caps_from_string ("test/x-caps,field=ff001d:0ffff0");
|
|
|
|
c2 = gst_caps_from_string ("test/x-caps,field=4fd81f:f00000");
|
|
|
|
expect = gst_caps_from_string ("test/x-caps,field=4f001d:fffff0");
|
|
|
|
test = gst_caps_simplify (gst_caps_merge (c1, c2));
|
|
|
|
/* c1, c2 now invalid */
|
|
|
|
GST_LOG ("Expected caps %" GST_PTR_FORMAT " got %" GST_PTR_FORMAT "\n",
|
|
|
|
expect, test);
|
|
|
|
fail_unless (gst_caps_is_equal (test, expect));
|
|
|
|
gst_caps_unref (test);
|
|
|
|
gst_caps_unref (expect);
|
|
|
|
|
|
|
|
/* Test that partially-intersecting sets of masked bits that match are OK */
|
|
|
|
c1 = gst_caps_from_string ("test/x-caps,field=ff001d:0ffff0");
|
|
|
|
c2 = gst_caps_from_string ("test/x-caps,field=4fd81f:ff0000");
|
|
|
|
expect = gst_caps_from_string ("test/x-caps,field=4f001d:fffff0");
|
|
|
|
test = gst_caps_simplify (gst_caps_merge (c1, c2));
|
|
|
|
/* c1, c2 now invalid */
|
|
|
|
GST_LOG ("Expected caps %" GST_PTR_FORMAT " got %" GST_PTR_FORMAT "\n",
|
|
|
|
expect, test);
|
|
|
|
fail_unless (gst_caps_is_equal (test, expect));
|
|
|
|
gst_caps_unref (test);
|
|
|
|
gst_caps_unref (expect);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2010-07-01 15:56:33 +00:00
|
|
|
static gboolean
|
|
|
|
_caps_is_fixed_foreach (GQuark field_id, const GValue * value, gpointer unused)
|
|
|
|
{
|
|
|
|
return gst_value_is_fixed (value);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
GST_START_TEST (test_normalize)
|
|
|
|
{
|
|
|
|
GstCaps *in, *norm, *out;
|
|
|
|
guint i;
|
|
|
|
|
|
|
|
in = gst_caps_from_string ("some/type, foo=(int){ 1 , 2 }");
|
|
|
|
out = gst_caps_from_string ("some/type, foo=(int) 1; some/type, foo=(int) 2");
|
|
|
|
norm = gst_caps_normalize (in);
|
|
|
|
fail_if (gst_caps_is_empty (norm));
|
|
|
|
fail_unless (gst_caps_is_equal (norm, out));
|
|
|
|
for (i = 0; i < gst_caps_get_size (norm); i++) {
|
|
|
|
GstStructure *st = gst_caps_get_structure (norm, i);
|
|
|
|
/* Make sure all fields of all structures are fixed */
|
|
|
|
fail_unless (gst_structure_foreach (st, _caps_is_fixed_foreach, NULL));
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_caps_unref (out);
|
|
|
|
gst_caps_unref (norm);
|
|
|
|
|
|
|
|
in = gst_caps_from_string
|
|
|
|
("some/type, foo=(int){ 1 , 2 }, bar=(int){ 3, 4 }");
|
|
|
|
out =
|
|
|
|
gst_caps_from_string
|
|
|
|
("some/type, foo=(int) 1, bar=(int) 3; some/type, foo=(int) 2, bar=(int) 3;"
|
|
|
|
"some/type, foo=(int) 1, bar=(int) 4; some/type, foo=(int) 2, bar=(int) 4;");
|
|
|
|
norm = gst_caps_normalize (in);
|
|
|
|
fail_if (gst_caps_is_empty (norm));
|
|
|
|
fail_unless (gst_caps_is_equal (norm, out));
|
|
|
|
for (i = 0; i < gst_caps_get_size (norm); i++) {
|
|
|
|
GstStructure *st = gst_caps_get_structure (norm, i);
|
|
|
|
/* Make sure all fields of all structures are fixed */
|
|
|
|
fail_unless (gst_structure_foreach (st, _caps_is_fixed_foreach, NULL));
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_caps_unref (out);
|
|
|
|
gst_caps_unref (norm);
|
|
|
|
|
|
|
|
in = gst_caps_from_string
|
|
|
|
("some/type, foo=(string){ 1 , 2 }, bar=(string) { 3 }");
|
|
|
|
out =
|
|
|
|
gst_caps_from_string
|
|
|
|
("some/type, foo=(string) 1, bar=(string) 3; some/type, foo=(string) 2, bar=(string) 3");
|
|
|
|
norm = gst_caps_normalize (in);
|
|
|
|
fail_if (gst_caps_is_empty (norm));
|
|
|
|
fail_unless (gst_caps_is_equal (norm, out));
|
|
|
|
for (i = 0; i < gst_caps_get_size (norm); i++) {
|
|
|
|
GstStructure *st = gst_caps_get_structure (norm, i);
|
|
|
|
/* Make sure all fields of all structures are fixed */
|
|
|
|
fail_unless (gst_structure_foreach (st, _caps_is_fixed_foreach, NULL));
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_caps_unref (out);
|
|
|
|
gst_caps_unref (norm);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
2010-05-22 19:46:40 +00:00
|
|
|
|
2011-03-07 21:13:56 +00:00
|
|
|
GST_START_TEST (test_broken)
|
|
|
|
{
|
2018-11-06 09:20:17 +00:00
|
|
|
GstCaps *c1 = NULL;
|
2011-03-07 21:13:56 +00:00
|
|
|
|
|
|
|
/* NULL is not valid for media_type */
|
|
|
|
ASSERT_CRITICAL (c1 =
|
|
|
|
gst_caps_new_simple (NULL, "field", G_TYPE_INT, 1, NULL));
|
|
|
|
fail_if (c1);
|
|
|
|
|
|
|
|
/* such a name is not valid, see gst_structure_validate_name() */
|
|
|
|
ASSERT_CRITICAL (c1 =
|
|
|
|
gst_caps_new_simple ("1#@abc", "field", G_TYPE_INT, 1, NULL));
|
|
|
|
fail_if (c1);
|
2018-12-11 11:12:50 +00:00
|
|
|
|
|
|
|
c1 = gst_caps_new_empty_simple ("test/broken-fraction");
|
|
|
|
fail_unless (c1);
|
|
|
|
/* denominator must be non-zero value */
|
|
|
|
ASSERT_CRITICAL (gst_caps_set_simple (c1, "foo", GST_TYPE_FRACTION, 1, 0,
|
|
|
|
NULL));
|
|
|
|
gst_caps_unref (c1);
|
2011-03-07 21:13:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2013-03-30 14:35:19 +00:00
|
|
|
GST_START_TEST (test_features)
|
|
|
|
{
|
|
|
|
GstCaps *c1, *c2, *c3;
|
|
|
|
GstStructure *s1, *s2;
|
|
|
|
GstCapsFeatures *f1, *f2;
|
|
|
|
gchar *str1;
|
|
|
|
static GstStaticCaps scaps =
|
|
|
|
GST_STATIC_CAPS
|
|
|
|
("video/x-raw(memory:EGLImage), width=320, height=[ 240, 260 ]");
|
|
|
|
|
|
|
|
c1 = gst_caps_new_empty ();
|
|
|
|
fail_unless (c1 != NULL);
|
|
|
|
s1 = gst_structure_new ("video/x-raw", "width", G_TYPE_INT, 320, "height",
|
|
|
|
GST_TYPE_INT_RANGE, 240, 260, NULL);
|
|
|
|
fail_unless (s1 != NULL);
|
|
|
|
f1 = gst_caps_features_new ("memory:EGLImage", NULL);
|
|
|
|
fail_unless (f1 != NULL);
|
|
|
|
|
|
|
|
gst_caps_append_structure_full (c1, s1, f1);
|
|
|
|
s2 = gst_caps_get_structure (c1, 0);
|
|
|
|
fail_unless (s1 == s2);
|
|
|
|
f2 = gst_caps_get_features (c1, 0);
|
|
|
|
fail_unless (f1 == f2);
|
|
|
|
|
|
|
|
str1 = gst_caps_to_string (c1);
|
|
|
|
fail_unless (str1 != NULL);
|
|
|
|
c2 = gst_caps_from_string (str1);
|
|
|
|
fail_unless (c2 != NULL);
|
|
|
|
g_free (str1);
|
|
|
|
|
|
|
|
fail_unless (gst_caps_is_equal (c1, c2));
|
|
|
|
fail_unless (gst_caps_is_subset (c1, c2));
|
|
|
|
fail_unless (gst_caps_is_subset (c2, c1));
|
|
|
|
fail_unless (gst_caps_can_intersect (c1, c2));
|
|
|
|
|
|
|
|
gst_caps_unref (c2);
|
|
|
|
|
|
|
|
c2 = gst_caps_new_empty ();
|
|
|
|
fail_unless (c2 != NULL);
|
|
|
|
s2 = gst_structure_new ("video/x-raw", "width", G_TYPE_INT, 320, "height",
|
|
|
|
GST_TYPE_INT_RANGE, 240, 260, NULL);
|
|
|
|
fail_unless (s2 != NULL);
|
|
|
|
f2 = gst_caps_features_new ("memory:VASurface", "meta:VAMeta", NULL);
|
|
|
|
fail_unless (f2 != NULL);
|
|
|
|
gst_caps_append_structure_full (c2, s2, f2);
|
|
|
|
|
|
|
|
fail_if (gst_caps_is_equal (c1, c2));
|
|
|
|
fail_if (gst_caps_is_subset (c1, c2));
|
|
|
|
fail_if (gst_caps_is_subset (c2, c1));
|
|
|
|
fail_if (gst_caps_can_intersect (c1, c2));
|
|
|
|
|
|
|
|
str1 = gst_caps_to_string (c2);
|
|
|
|
fail_unless (str1 != NULL);
|
|
|
|
c3 = gst_caps_from_string (str1);
|
|
|
|
fail_unless (c3 != NULL);
|
|
|
|
g_free (str1);
|
|
|
|
|
|
|
|
fail_unless (gst_caps_is_equal (c2, c3));
|
|
|
|
fail_unless (gst_caps_is_subset (c2, c3));
|
|
|
|
fail_unless (gst_caps_is_subset (c3, c2));
|
|
|
|
fail_unless (gst_caps_can_intersect (c2, c3));
|
|
|
|
|
|
|
|
f1 = gst_caps_get_features (c3, 0);
|
|
|
|
fail_unless (f1 != NULL);
|
|
|
|
fail_if (f1 == f2);
|
|
|
|
gst_caps_features_contains (f1, "memory:VASurface");
|
|
|
|
gst_caps_features_remove (f1, "memory:VASurface");
|
|
|
|
fail_if (gst_caps_is_equal (c2, c3));
|
|
|
|
fail_if (gst_caps_is_subset (c2, c3));
|
|
|
|
fail_if (gst_caps_is_subset (c3, c2));
|
|
|
|
fail_if (gst_caps_can_intersect (c2, c3));
|
|
|
|
|
|
|
|
gst_caps_unref (c3);
|
|
|
|
gst_caps_unref (c2);
|
|
|
|
|
|
|
|
c2 = gst_static_caps_get (&scaps);
|
|
|
|
fail_unless (c2 != NULL);
|
|
|
|
fail_unless (gst_caps_is_equal (c1, c2));
|
|
|
|
fail_unless (gst_caps_is_subset (c1, c2));
|
|
|
|
fail_unless (gst_caps_is_subset (c2, c1));
|
|
|
|
fail_unless (gst_caps_can_intersect (c1, c2));
|
2013-04-06 19:21:39 +00:00
|
|
|
gst_caps_unref (c2);
|
2013-03-30 14:35:19 +00:00
|
|
|
|
2013-04-06 19:21:39 +00:00
|
|
|
c2 = gst_caps_from_string
|
|
|
|
("video/x-raw(ANY), width=320, height=[ 240, 260 ]");
|
|
|
|
fail_unless (c2 != NULL);
|
|
|
|
fail_if (gst_caps_is_equal (c1, c2));
|
|
|
|
fail_unless (gst_caps_is_subset (c1, c2));
|
|
|
|
fail_if (gst_caps_is_subset (c2, c1));
|
|
|
|
fail_unless (gst_caps_can_intersect (c1, c2));
|
|
|
|
|
|
|
|
c3 = gst_caps_intersect (c1, c2);
|
|
|
|
fail_unless (gst_caps_is_equal (c3, c1));
|
|
|
|
|
|
|
|
gst_caps_unref (c3);
|
2013-03-30 14:35:19 +00:00
|
|
|
gst_caps_unref (c2);
|
2013-04-06 19:21:39 +00:00
|
|
|
gst_caps_unref (c1);
|
2014-01-29 14:39:19 +00:00
|
|
|
|
|
|
|
c1 = gst_caps_from_string ("video/x-raw");
|
|
|
|
c2 = gst_caps_from_string ("video/x-raw");
|
|
|
|
|
|
|
|
f1 = gst_caps_get_features (c1, 0);
|
|
|
|
gst_caps_features_add (f1, "memory:VASurface");
|
|
|
|
|
|
|
|
fail_unless (gst_caps_features_is_equal (f1, gst_caps_get_features (c1, 0)));
|
2014-08-09 13:57:56 +00:00
|
|
|
fail_if (gst_caps_can_intersect (c1, c2));
|
2014-01-29 14:39:19 +00:00
|
|
|
|
|
|
|
f2 = gst_caps_get_features (c2, 0);
|
|
|
|
fail_unless (gst_caps_features_is_equal
|
|
|
|
(GST_CAPS_FEATURES_MEMORY_SYSTEM_MEMORY, f2));
|
|
|
|
|
|
|
|
gst_caps_unref (c2);
|
|
|
|
gst_caps_unref (c1);
|
2014-06-26 08:58:04 +00:00
|
|
|
|
|
|
|
c1 = gst_caps_from_string ("video/x-raw");
|
|
|
|
f1 = gst_caps_get_features (c1, 0);
|
|
|
|
f2 = gst_caps_features_new ("memory:dmabuf", NULL);
|
|
|
|
gst_caps_set_features (c1, 0, f2);
|
|
|
|
|
|
|
|
gst_caps_unref (c1);
|
2018-12-11 09:48:46 +00:00
|
|
|
|
|
|
|
/* gst_caps_set_features_simple() */
|
|
|
|
c1 = gst_caps_from_string
|
|
|
|
("video/x-raw, format=NV12; video/x-raw, format=NV16");
|
|
|
|
fail_unless_equals_int (gst_caps_get_size (c1), 2);
|
|
|
|
|
|
|
|
f1 = gst_caps_features_new ("memory:EGLImage", NULL);
|
|
|
|
gst_caps_set_features_simple (c1, f1);
|
|
|
|
|
|
|
|
f2 = gst_caps_get_features (c1, 0);
|
|
|
|
fail_unless (gst_caps_features_is_equal (f1, f2));
|
|
|
|
f2 = gst_caps_get_features (c1, 1);
|
|
|
|
fail_unless (gst_caps_features_is_equal (f1, f2));
|
|
|
|
|
|
|
|
gst_caps_unref (c1);
|
2020-01-27 11:58:57 +00:00
|
|
|
|
|
|
|
c1 = gst_caps_new_any ();
|
|
|
|
fail_unless_equals_int (gst_caps_get_size (c1), 0);
|
|
|
|
|
|
|
|
f1 = gst_caps_features_new ("memory:EGLImage", NULL);
|
|
|
|
/* Nothing to set the features on, but method should still take
|
|
|
|
* ownership of the given features */
|
|
|
|
gst_caps_set_features_simple (c1, f1);
|
|
|
|
fail_unless_equals_int (gst_caps_get_size (c1), 0);
|
|
|
|
fail_unless (gst_caps_is_any (c1));
|
|
|
|
|
|
|
|
gst_caps_unref (c1);
|
2013-03-30 14:35:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
2011-03-07 21:13:56 +00:00
|
|
|
|
2014-06-22 11:52:01 +00:00
|
|
|
GST_START_TEST (test_special_caps)
|
|
|
|
{
|
|
|
|
GstCaps *caps;
|
|
|
|
|
|
|
|
caps = gst_caps_new_any ();
|
|
|
|
fail_unless (gst_caps_is_any (caps));
|
|
|
|
fail_unless (gst_caps_is_any (caps) == TRUE);
|
|
|
|
fail_if (gst_caps_is_empty (caps));
|
|
|
|
fail_unless (gst_caps_is_empty (caps) == FALSE);
|
|
|
|
gst_caps_unref (caps);
|
|
|
|
|
|
|
|
caps = gst_caps_new_empty ();
|
|
|
|
fail_if (gst_caps_is_any (caps));
|
|
|
|
fail_unless (gst_caps_is_any (caps) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_empty (caps));
|
|
|
|
fail_unless (gst_caps_is_empty (caps) == TRUE);
|
|
|
|
gst_caps_unref (caps);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
2014-11-07 10:15:09 +00:00
|
|
|
|
|
|
|
static gboolean
|
|
|
|
foreach_append_function (GstCapsFeatures * features, GstStructure * structure,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
GstCaps *caps = user_data;
|
|
|
|
|
|
|
|
gst_caps_append_structure_full (caps, gst_structure_copy (structure),
|
|
|
|
features ? gst_caps_features_copy (features) : NULL);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_START_TEST (test_foreach)
|
|
|
|
{
|
|
|
|
GstCaps *caps, *caps2;
|
|
|
|
|
|
|
|
caps =
|
|
|
|
gst_caps_from_string
|
|
|
|
("video/x-raw, format=I420; video/x-raw(foo:bar); video/x-h264");
|
|
|
|
caps2 = gst_caps_new_empty ();
|
|
|
|
fail_unless (gst_caps_foreach (caps, foreach_append_function, caps2));
|
|
|
|
fail_unless (gst_caps_is_strictly_equal (caps, caps2));
|
|
|
|
gst_caps_unref (caps);
|
|
|
|
gst_caps_unref (caps2);
|
|
|
|
|
|
|
|
caps = gst_caps_new_empty ();
|
|
|
|
caps2 = gst_caps_new_empty ();
|
|
|
|
fail_unless (gst_caps_foreach (caps, foreach_append_function, caps2));
|
|
|
|
fail_unless (gst_caps_is_strictly_equal (caps, caps2));
|
|
|
|
gst_caps_unref (caps);
|
|
|
|
gst_caps_unref (caps2);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
map_function (GstCapsFeatures * features, GstStructure * structure,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
/* Remove caps features if there are any, otherwise add some dummy */
|
|
|
|
if (gst_caps_features_contains (features, "foo:bar")) {
|
|
|
|
gst_caps_features_remove (features, "foo:bar");
|
|
|
|
} else {
|
|
|
|
gst_caps_features_add (features, "foo:bar");
|
|
|
|
gst_caps_features_remove (features, GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Set some dummy integer in the structure */
|
|
|
|
gst_structure_set (structure, "foo", G_TYPE_INT, 123, NULL);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_START_TEST (test_map_in_place)
|
|
|
|
{
|
|
|
|
GstCaps *caps, *caps2;
|
|
|
|
|
|
|
|
caps =
|
|
|
|
gst_caps_from_string
|
|
|
|
("video/x-raw, format=I420; video/x-raw(foo:bar); video/x-h264");
|
|
|
|
caps2 =
|
|
|
|
gst_caps_from_string
|
|
|
|
("video/x-raw(foo:bar), foo=(int)123, format=I420; video/x-raw, foo=(int)123; video/x-h264(foo:bar), foo=(int)123");
|
|
|
|
fail_unless (gst_caps_map_in_place (caps, map_function, NULL));
|
|
|
|
fail_unless (gst_caps_is_strictly_equal (caps, caps2));
|
|
|
|
gst_caps_unref (caps);
|
|
|
|
gst_caps_unref (caps2);
|
|
|
|
|
|
|
|
caps = gst_caps_new_empty ();
|
|
|
|
caps2 = gst_caps_new_empty ();
|
|
|
|
fail_unless (gst_caps_map_in_place (caps, map_function, NULL));
|
|
|
|
fail_unless (gst_caps_is_strictly_equal (caps, caps2));
|
|
|
|
gst_caps_unref (caps);
|
|
|
|
gst_caps_unref (caps2);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2014-12-16 15:31:21 +00:00
|
|
|
static gboolean
|
|
|
|
filter_map_function (GstCapsFeatures * features, GstStructure * structure,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
if (!gst_structure_has_name (structure, "video/x-raw"))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (!gst_caps_features_contains (features, "foo:bar"))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
/* Set some dummy integer in the structure */
|
|
|
|
gst_structure_set (structure, "foo", G_TYPE_INT, 123, NULL);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_START_TEST (test_filter_and_map_in_place)
|
|
|
|
{
|
|
|
|
GstCaps *caps, *caps2;
|
|
|
|
|
|
|
|
caps =
|
|
|
|
gst_caps_from_string
|
|
|
|
("video/x-raw, format=I420; video/x-raw(foo:bar); video/x-h264");
|
|
|
|
caps2 = gst_caps_from_string ("video/x-raw(foo:bar), foo=(int)123");
|
|
|
|
gst_caps_filter_and_map_in_place (caps, filter_map_function, NULL);
|
|
|
|
fail_unless (gst_caps_is_strictly_equal (caps, caps2));
|
|
|
|
gst_caps_unref (caps);
|
|
|
|
gst_caps_unref (caps2);
|
|
|
|
|
|
|
|
caps = gst_caps_from_string ("video/x-raw, format=I420; video/x-h264");
|
|
|
|
caps2 = gst_caps_new_empty ();
|
|
|
|
gst_caps_filter_and_map_in_place (caps, filter_map_function, NULL);
|
|
|
|
fail_unless (gst_caps_is_strictly_equal (caps, caps2));
|
|
|
|
gst_caps_unref (caps);
|
|
|
|
gst_caps_unref (caps2);
|
|
|
|
|
|
|
|
caps = gst_caps_new_empty ();
|
|
|
|
caps2 = gst_caps_new_empty ();
|
|
|
|
gst_caps_filter_and_map_in_place (caps, filter_map_function, NULL);
|
|
|
|
fail_unless (gst_caps_is_strictly_equal (caps, caps2));
|
|
|
|
gst_caps_unref (caps);
|
|
|
|
gst_caps_unref (caps2);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2020-01-21 19:02:48 +00:00
|
|
|
GST_START_TEST (test_equality)
|
|
|
|
{
|
|
|
|
GstCaps *empty1, *empty2, *any1, *any2, *caps1, *caps2, *caps3, *caps4,
|
|
|
|
*caps5, *caps6, *caps7, *caps8, *caps9;
|
|
|
|
GstStructure *s;
|
|
|
|
|
|
|
|
empty1 = gst_caps_new_empty ();
|
|
|
|
|
|
|
|
empty2 = gst_caps_new_empty ();
|
|
|
|
|
|
|
|
any1 = gst_caps_new_any ();
|
|
|
|
|
|
|
|
any2 = gst_caps_new_any ();
|
|
|
|
s = gst_structure_new ("structure", "int", G_TYPE_INT, 4, "float",
|
|
|
|
G_TYPE_FLOAT, 5.7, NULL);
|
|
|
|
fail_unless (s);
|
|
|
|
gst_caps_append_structure (any2, s);
|
2020-01-27 11:58:57 +00:00
|
|
|
/* should still be ANY after append */
|
2020-01-21 19:02:48 +00:00
|
|
|
|
|
|
|
caps1 = gst_caps_new_simple ("structure", "int", G_TYPE_INT, 4, "float",
|
|
|
|
G_TYPE_FLOAT, 5.7, NULL);
|
|
|
|
fail_unless (caps1);
|
|
|
|
|
|
|
|
caps2 = gst_caps_new_simple ("structure", "int", G_TYPE_INT, 4, "float",
|
|
|
|
G_TYPE_FLOAT, 5.7, NULL);
|
|
|
|
fail_unless (caps2);
|
|
|
|
/* append an identical structure */
|
|
|
|
s = gst_structure_new ("structure", "int", G_TYPE_INT, 4, "float",
|
|
|
|
G_TYPE_FLOAT, 5.7, NULL);
|
|
|
|
fail_unless (s);
|
|
|
|
gst_caps_append_structure (caps2, s);
|
|
|
|
|
|
|
|
/* change field name */
|
|
|
|
caps3 = gst_caps_new_simple ("structure", "intX", G_TYPE_INT, 4, "float",
|
|
|
|
G_TYPE_FLOAT, 5.7, NULL);
|
|
|
|
fail_unless (caps3);
|
|
|
|
|
|
|
|
/* change field type */
|
|
|
|
caps4 = gst_caps_new_simple ("structure", "int", G_TYPE_UINT, 4, "float",
|
|
|
|
G_TYPE_FLOAT, 5.7, NULL);
|
|
|
|
fail_unless (caps4);
|
|
|
|
|
|
|
|
/* change structure name */
|
|
|
|
caps5 = gst_caps_new_simple ("structureX", "int", G_TYPE_INT, 4, "float",
|
|
|
|
G_TYPE_FLOAT, 5.7, NULL);
|
|
|
|
fail_unless (caps5);
|
|
|
|
|
|
|
|
/* change field value */
|
|
|
|
caps6 = gst_caps_new_simple ("structure", "int", G_TYPE_INT, 3, "float",
|
|
|
|
G_TYPE_FLOAT, 5.7, NULL);
|
|
|
|
fail_unless (caps6);
|
|
|
|
|
|
|
|
/* change caps features */
|
|
|
|
caps7 = gst_caps_new_simple ("structure", "int", G_TYPE_INT, 4, "float",
|
|
|
|
G_TYPE_FLOAT, 5.7, NULL);
|
|
|
|
fail_unless (caps6);
|
|
|
|
gst_caps_set_features (caps7, 0, gst_caps_features_new_any ());
|
|
|
|
|
|
|
|
/* add structure */
|
|
|
|
caps8 = gst_caps_new_simple ("structure", "int", G_TYPE_INT, 4, "float",
|
|
|
|
G_TYPE_FLOAT, 5.7, NULL);
|
|
|
|
fail_unless (caps8);
|
|
|
|
s = gst_structure_new ("structure2", "string", G_TYPE_STRING, "val", NULL);
|
|
|
|
fail_unless (s);
|
|
|
|
gst_caps_append_structure (caps8, s);
|
|
|
|
|
|
|
|
/* reverse the order of the structures */
|
|
|
|
caps9 = gst_caps_new_simple ("structure2", "string", G_TYPE_STRING, "val",
|
|
|
|
NULL);
|
|
|
|
fail_unless (caps9);
|
|
|
|
s = gst_structure_new ("structure", "int", G_TYPE_INT, 4, "float",
|
|
|
|
G_TYPE_FLOAT, 5.7, NULL);
|
|
|
|
fail_unless (s);
|
|
|
|
gst_caps_append_structure (caps9, s);
|
|
|
|
|
|
|
|
fail_unless (gst_caps_is_equal (empty1, empty2) == TRUE);
|
|
|
|
fail_unless (gst_caps_is_strictly_equal (empty1, empty2) == TRUE);
|
|
|
|
fail_unless (gst_caps_is_equal (empty1, any1) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_strictly_equal (empty1, any1) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_equal (empty1, any2) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_strictly_equal (empty1, any2) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_equal (empty1, caps1) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_strictly_equal (empty1, caps1) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_equal (empty1, caps2) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_strictly_equal (empty1, caps2) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_equal (empty1, caps3) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_strictly_equal (empty1, caps3) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_equal (empty1, caps4) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_strictly_equal (empty1, caps4) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_equal (empty1, caps5) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_strictly_equal (empty1, caps5) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_equal (empty1, caps6) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_strictly_equal (empty1, caps6) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_equal (empty1, caps7) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_strictly_equal (empty1, caps7) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_equal (empty1, caps8) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_strictly_equal (empty1, caps8) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_equal (empty1, caps9) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_strictly_equal (empty1, caps9) == FALSE);
|
|
|
|
|
|
|
|
fail_unless (gst_caps_is_equal (any1, any2) == TRUE);
|
|
|
|
fail_unless (gst_caps_is_strictly_equal (any1, any2) == TRUE);
|
|
|
|
fail_unless (gst_caps_is_equal (any1, caps1) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_strictly_equal (any1, caps1) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_equal (any1, caps2) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_strictly_equal (any1, caps2) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_equal (any1, caps3) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_strictly_equal (any1, caps3) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_equal (any1, caps4) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_strictly_equal (any1, caps4) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_equal (any1, caps5) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_strictly_equal (any1, caps5) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_equal (any1, caps6) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_strictly_equal (any1, caps6) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_equal (any1, caps7) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_strictly_equal (any1, caps7) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_equal (any1, caps8) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_strictly_equal (any1, caps8) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_equal (any1, caps9) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_strictly_equal (any1, caps9) == FALSE);
|
|
|
|
|
|
|
|
fail_unless (gst_caps_is_equal (any2, caps1) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_strictly_equal (any2, caps1) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_equal (any2, caps2) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_strictly_equal (any2, caps2) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_equal (any2, caps3) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_strictly_equal (any2, caps3) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_equal (any2, caps4) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_strictly_equal (any2, caps4) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_equal (any2, caps5) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_strictly_equal (any2, caps5) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_equal (any2, caps6) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_strictly_equal (any2, caps6) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_equal (any2, caps7) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_strictly_equal (any2, caps7) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_equal (any2, caps8) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_strictly_equal (any2, caps8) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_equal (any2, caps9) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_strictly_equal (any2, caps9) == FALSE);
|
|
|
|
|
|
|
|
/* caps1 and caps2 are equal, but not strictly equal because one has
|
|
|
|
* two copies of the same structure */
|
|
|
|
fail_unless (gst_caps_is_equal (caps1, caps2) == TRUE);
|
|
|
|
fail_unless (gst_caps_is_strictly_equal (caps1, caps2) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_equal (caps1, caps3) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_strictly_equal (caps1, caps3) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_equal (caps1, caps4) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_strictly_equal (caps1, caps4) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_equal (caps1, caps5) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_strictly_equal (caps1, caps5) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_equal (caps1, caps6) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_strictly_equal (caps1, caps6) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_equal (caps1, caps7) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_strictly_equal (caps1, caps7) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_equal (caps1, caps8) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_strictly_equal (caps1, caps8) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_equal (caps1, caps9) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_strictly_equal (caps1, caps9) == FALSE);
|
|
|
|
|
|
|
|
fail_unless (gst_caps_is_equal (caps2, caps3) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_strictly_equal (caps2, caps3) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_equal (caps2, caps4) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_strictly_equal (caps2, caps4) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_equal (caps2, caps5) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_strictly_equal (caps2, caps5) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_equal (caps2, caps6) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_strictly_equal (caps2, caps6) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_equal (caps2, caps7) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_strictly_equal (caps2, caps7) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_equal (caps2, caps8) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_strictly_equal (caps2, caps8) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_equal (caps2, caps9) == FALSE);
|
|
|
|
fail_unless (gst_caps_is_strictly_equal (caps2, caps9) == FALSE);
|
|
|
|
|
|
|
|
/* caps8 and caps9 are equal, but not strictly equal because their
|
|
|
|
* order of structures is different */
|
|
|
|
fail_unless (gst_caps_is_equal (caps8, caps9) == TRUE);
|
|
|
|
fail_unless (gst_caps_is_strictly_equal (caps8, caps9) == FALSE);
|
|
|
|
|
|
|
|
gst_caps_unref (empty1);
|
|
|
|
gst_caps_unref (empty2);
|
|
|
|
gst_caps_unref (any1);
|
|
|
|
gst_caps_unref (any2);
|
|
|
|
gst_caps_unref (caps1);
|
|
|
|
gst_caps_unref (caps2);
|
|
|
|
gst_caps_unref (caps3);
|
|
|
|
gst_caps_unref (caps4);
|
|
|
|
gst_caps_unref (caps5);
|
|
|
|
gst_caps_unref (caps6);
|
|
|
|
gst_caps_unref (caps7);
|
|
|
|
gst_caps_unref (caps8);
|
|
|
|
gst_caps_unref (caps9);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2020-01-27 11:58:57 +00:00
|
|
|
GST_START_TEST (test_remains_any)
|
|
|
|
{
|
|
|
|
GstCaps *any, *caps;
|
|
|
|
GstStructure *s;
|
|
|
|
|
|
|
|
/* test append structure to ANY */
|
|
|
|
any = gst_caps_new_any ();
|
|
|
|
fail_unless (gst_caps_is_any (any));
|
|
|
|
fail_if (gst_caps_get_size (any));
|
|
|
|
s = gst_structure_new ("structure", "int", G_TYPE_INT, 4, NULL);
|
|
|
|
fail_unless (s);
|
|
|
|
gst_caps_append_structure (any, s);
|
|
|
|
fail_unless (gst_caps_is_any (any));
|
|
|
|
fail_if (gst_caps_get_size (any));
|
|
|
|
ASSERT_CRITICAL (gst_caps_get_structure (any, 0));
|
|
|
|
|
|
|
|
s = gst_structure_new ("structure", "int", G_TYPE_INT, 4, NULL);
|
|
|
|
fail_unless (s);
|
|
|
|
gst_caps_append_structure_full (any, s, gst_caps_features_new_any ());
|
|
|
|
fail_unless (gst_caps_is_any (any));
|
|
|
|
fail_if (gst_caps_get_size (any));
|
|
|
|
ASSERT_CRITICAL (gst_caps_get_structure (any, 0));
|
|
|
|
|
|
|
|
/* test merge structure with ANY */
|
|
|
|
s = gst_structure_new ("structure", "int", G_TYPE_INT, 4, NULL);
|
|
|
|
fail_unless (s);
|
|
|
|
any = gst_caps_merge_structure (any, s);
|
|
|
|
fail_unless (gst_caps_is_any (any));
|
|
|
|
fail_if (gst_caps_get_size (any));
|
|
|
|
ASSERT_CRITICAL (gst_caps_get_structure (any, 0));
|
|
|
|
|
|
|
|
s = gst_structure_new ("structure", "int", G_TYPE_INT, 4, NULL);
|
|
|
|
fail_unless (s);
|
|
|
|
any = gst_caps_merge_structure_full (any, s, gst_caps_features_new_any ());
|
|
|
|
fail_unless (gst_caps_is_any (any));
|
|
|
|
fail_if (gst_caps_get_size (any));
|
|
|
|
ASSERT_CRITICAL (gst_caps_get_structure (any, 0));
|
|
|
|
|
|
|
|
/* test appending non-ANY to ANY */
|
|
|
|
caps = gst_caps_new_simple ("structure", "int", G_TYPE_INT, 4, NULL);
|
|
|
|
fail_unless (caps);
|
|
|
|
gst_caps_append (any, caps);
|
|
|
|
fail_unless (gst_caps_is_any (any));
|
|
|
|
fail_if (gst_caps_get_size (any));
|
|
|
|
ASSERT_CRITICAL (gst_caps_get_structure (any, 0));
|
|
|
|
|
|
|
|
/* test merging non-ANY with ANY */
|
|
|
|
caps = gst_caps_new_simple ("structure", "int", G_TYPE_INT, 4, NULL);
|
|
|
|
fail_unless (caps);
|
|
|
|
any = gst_caps_merge (any, caps);
|
|
|
|
fail_unless (gst_caps_is_any (any));
|
|
|
|
fail_if (gst_caps_get_size (any));
|
|
|
|
ASSERT_CRITICAL (gst_caps_get_structure (any, 0));
|
|
|
|
|
|
|
|
caps = gst_caps_new_simple ("structure", "int", G_TYPE_INT, 4, NULL);
|
|
|
|
fail_unless (caps);
|
|
|
|
any = gst_caps_merge (caps, any);
|
|
|
|
fail_unless (gst_caps_is_any (any));
|
|
|
|
fail_if (gst_caps_get_size (any));
|
|
|
|
ASSERT_CRITICAL (gst_caps_get_structure (any, 0));
|
|
|
|
|
|
|
|
gst_caps_unref (any);
|
|
|
|
|
|
|
|
/* test appending ANY to non-ANY */
|
|
|
|
caps = gst_caps_new_simple ("structure", "int", G_TYPE_INT, 4, NULL);
|
|
|
|
fail_unless (caps);
|
|
|
|
fail_unless_equals_int (gst_caps_get_size (caps), 1);
|
|
|
|
fail_unless (gst_caps_get_structure (caps, 0));
|
|
|
|
gst_caps_append (caps, gst_caps_new_any ());
|
|
|
|
fail_unless (gst_caps_is_any (caps));
|
|
|
|
fail_if (gst_caps_get_size (caps));
|
|
|
|
ASSERT_CRITICAL (gst_caps_get_structure (caps, 0));
|
|
|
|
|
|
|
|
gst_caps_unref (caps);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
2020-01-21 19:02:48 +00:00
|
|
|
|
2008-02-29 13:59:24 +00:00
|
|
|
static Suite *
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
gst_caps_suite (void)
|
|
|
|
{
|
|
|
|
Suite *s = suite_create ("GstCaps");
|
2010-05-22 19:46:40 +00:00
|
|
|
TCase *tc_chain = tcase_create ("operations");
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
|
|
|
|
suite_add_tcase (s, tc_chain);
|
2005-06-22 19:22:34 +00:00
|
|
|
tcase_add_test (tc_chain, test_from_string);
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
tcase_add_test (tc_chain, test_double_append);
|
|
|
|
tcase_add_test (tc_chain, test_mutability);
|
2005-08-22 15:08:44 +00:00
|
|
|
tcase_add_test (tc_chain, test_static_caps);
|
2005-09-29 10:56:57 +00:00
|
|
|
tcase_add_test (tc_chain, test_simplify);
|
2006-07-02 12:54:03 +00:00
|
|
|
tcase_add_test (tc_chain, test_truncate);
|
2020-03-07 09:09:05 +00:00
|
|
|
tcase_add_test (tc_chain, test_fixate);
|
2011-05-27 11:38:51 +00:00
|
|
|
tcase_add_test (tc_chain, test_subset);
|
2013-11-13 18:55:41 +00:00
|
|
|
tcase_add_test (tc_chain, test_subset_duplication);
|
2006-08-24 10:40:31 +00:00
|
|
|
tcase_add_test (tc_chain, test_merge_fundamental);
|
|
|
|
tcase_add_test (tc_chain, test_merge_same);
|
|
|
|
tcase_add_test (tc_chain, test_merge_subset);
|
2006-09-27 09:23:18 +00:00
|
|
|
tcase_add_test (tc_chain, test_intersect);
|
2008-05-18 11:52:39 +00:00
|
|
|
tcase_add_test (tc_chain, test_intersect2);
|
2012-09-29 13:35:58 +00:00
|
|
|
tcase_add_test (tc_chain, test_intersect_list_duplicate);
|
2011-02-25 13:25:26 +00:00
|
|
|
tcase_add_test (tc_chain, test_intersect_zigzag);
|
|
|
|
tcase_add_test (tc_chain, test_intersect_first);
|
|
|
|
tcase_add_test (tc_chain, test_intersect_first2);
|
2011-05-05 09:28:38 +00:00
|
|
|
tcase_add_test (tc_chain, test_intersect_duplication);
|
gstvalue: Add GstFlagSet type
GstFlagSet is a new type designed for negotiating sets
of boolean capabilities flags, consisting of a 32-bit
flags bitfield and 32-bit mask field. The mask field
indicates which of the flags bits an element needs to have
as specific values, and which it doesn't care about.
This allows efficient negotiation of arrays of boolean
capabilities.
The standard serialisation format is FLAGS:MASK, with
flags and mask fields expressed in hexadecimal, however
GstFlagSet has a gst_register_flagset() function, which
associates a new GstFlagSet derived type with an existing
GFlags gtype. When serializing a GstFlagSet with an
associated set of GFlags, it also serializes a human-readable
form of the flags for easier debugging.
It is possible to parse a GFlags style serialisation of a
flagset, without the hex portion on the front. ie,
+flag1/flag2/flag3+flag4, to indicate that
flag1 & flag4 must be set, and flag2/flag3 must be unset,
and any other flags are don't-care.
https://bugzilla.gnome.org/show_bug.cgi?id=746373
2015-05-25 06:23:33 +00:00
|
|
|
tcase_add_test (tc_chain, test_intersect_flagset);
|
|
|
|
tcase_add_test (tc_chain, test_union);
|
2010-07-01 15:56:33 +00:00
|
|
|
tcase_add_test (tc_chain, test_normalize);
|
2011-03-07 21:13:56 +00:00
|
|
|
tcase_add_test (tc_chain, test_broken);
|
2013-03-30 14:35:19 +00:00
|
|
|
tcase_add_test (tc_chain, test_features);
|
2014-06-22 11:52:01 +00:00
|
|
|
tcase_add_test (tc_chain, test_special_caps);
|
2014-11-07 10:15:09 +00:00
|
|
|
tcase_add_test (tc_chain, test_foreach);
|
|
|
|
tcase_add_test (tc_chain, test_map_in_place);
|
2014-12-16 15:31:21 +00:00
|
|
|
tcase_add_test (tc_chain, test_filter_and_map_in_place);
|
2020-01-21 19:02:48 +00:00
|
|
|
tcase_add_test (tc_chain, test_equality);
|
2020-01-27 11:58:57 +00:00
|
|
|
tcase_add_test (tc_chain, test_remains_any);
|
2005-08-22 15:08:44 +00:00
|
|
|
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
2006-07-01 20:56:56 +00:00
|
|
|
GST_CHECK_MAIN (gst_caps);
|