mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-23 23:58:17 +00:00
Fix _pad_get_direction wrt ghostpads.
Original commit message from CVS: * gst/gstpad.c: (gst_pad_get_direction), (_gst_pad_default_fixate_foreach), (gst_pad_collectv), (gst_pad_collect_valist): * testsuite/bins/interface.c: (main): * testsuite/caps/audioscale.c: (test_caps): * testsuite/caps/caps.c: (test1), (test2), (test3): * testsuite/caps/deserialize.c: (main): * testsuite/caps/enumcaps.c: (main): * testsuite/caps/filtercaps.c: (main): * testsuite/caps/intersect2.c: (main): * testsuite/caps/random.c: (main): * testsuite/caps/renegotiate.c: (my_fixate), (main): * testsuite/caps/sets.c: (check_caps): * testsuite/caps/simplify.c: (check_caps), (main): * testsuite/caps/subtract.c: (check_caps): Fix _pad_get_direction wrt ghostpads. Fix caps testsuite.
This commit is contained in:
parent
6cacf76cd9
commit
e82e7b604a
26 changed files with 273 additions and 178 deletions
20
ChangeLog
20
ChangeLog
|
@ -1,3 +1,23 @@
|
|||
2005-03-09 Wim Taymans <wim@fluendo.com>
|
||||
|
||||
* gst/gstpad.c: (gst_pad_get_direction),
|
||||
(_gst_pad_default_fixate_foreach), (gst_pad_collectv),
|
||||
(gst_pad_collect_valist):
|
||||
* testsuite/bins/interface.c: (main):
|
||||
* testsuite/caps/audioscale.c: (test_caps):
|
||||
* testsuite/caps/caps.c: (test1), (test2), (test3):
|
||||
* testsuite/caps/deserialize.c: (main):
|
||||
* testsuite/caps/enumcaps.c: (main):
|
||||
* testsuite/caps/filtercaps.c: (main):
|
||||
* testsuite/caps/intersect2.c: (main):
|
||||
* testsuite/caps/random.c: (main):
|
||||
* testsuite/caps/renegotiate.c: (my_fixate), (main):
|
||||
* testsuite/caps/sets.c: (check_caps):
|
||||
* testsuite/caps/simplify.c: (check_caps), (main):
|
||||
* testsuite/caps/subtract.c: (check_caps):
|
||||
Fix _pad_get_direction wrt ghostpads.
|
||||
Fix caps testsuite.
|
||||
|
||||
2005-03-09 Wim Taymans <wim@fluendo.com>
|
||||
|
||||
* check/Makefile.am:
|
||||
|
|
15
gst/gstpad.c
15
gst/gstpad.c
|
@ -454,16 +454,23 @@ GstPadDirection
|
|||
gst_pad_get_direction (GstPad * pad)
|
||||
{
|
||||
GstPadDirection result;
|
||||
GstRealPad *realpad;
|
||||
|
||||
/* pad unkown is a little silly but we need some sort of
|
||||
/* PAD_UNKNOWN is a little silly but we need some sort of
|
||||
* error return value */
|
||||
g_return_val_if_fail (GST_IS_PAD (pad), GST_PAD_UNKNOWN);
|
||||
|
||||
/* since the direction cannot change at runtime we can
|
||||
* safely read without locking. */
|
||||
result = GST_PAD_DIRECTION (pad);
|
||||
GST_PAD_REALIZE_AND_LOCK (pad, realpad, lost_ghostpad);
|
||||
result = GST_RPAD_DIRECTION (realpad);
|
||||
GST_UNLOCK (realpad);
|
||||
|
||||
return result;
|
||||
|
||||
/* errors */
|
||||
lost_ghostpad:
|
||||
{
|
||||
return GST_PAD_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
#include <gst/gst.h>
|
||||
|
||||
/* tests if gst_bin_get_(all_)by_interface works */
|
||||
/* tests if gst_bin_iterate_(all_)by_interface works */
|
||||
|
||||
gint
|
||||
main (gint argc, gchar * argv[])
|
||||
|
|
|
@ -146,8 +146,8 @@ test_caps (const char *s)
|
|||
g_print ("original: %s\nfiltered: %s\n\n", s, s2);
|
||||
|
||||
g_free (s2);
|
||||
gst_caps_free (caps);
|
||||
gst_caps_free (caps2);
|
||||
gst_caps_unref (caps);
|
||||
gst_caps_unref (caps2);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -12,11 +12,11 @@ test1 (void)
|
|||
|
||||
caps = gst_caps_new_empty ();
|
||||
g_assert (caps != NULL);
|
||||
gst_caps_free (caps);
|
||||
gst_caps_unref (caps);
|
||||
|
||||
caps = gst_caps_new_any ();
|
||||
g_assert (caps != NULL);
|
||||
gst_caps_free (caps);
|
||||
gst_caps_unref (caps);
|
||||
|
||||
caps = gst_caps_new_simple ("audio/raw", "_int", G_TYPE_INT, 100, NULL);
|
||||
g_assert (caps != NULL);
|
||||
|
@ -25,7 +25,7 @@ test1 (void)
|
|||
g_assert (GST_CAPS_IS_SIMPLE (caps) == TRUE);
|
||||
g_assert (gst_caps_is_fixed (caps) == TRUE);
|
||||
g_print ("%s\n", gst_caps_to_string (caps));
|
||||
gst_caps_free (caps);
|
||||
gst_caps_unref (caps);
|
||||
|
||||
caps = gst_caps_new_simple ("audio/raw",
|
||||
"_double", G_TYPE_DOUBLE, 100.0, NULL);
|
||||
|
@ -35,7 +35,7 @@ test1 (void)
|
|||
g_assert (GST_CAPS_IS_SIMPLE (caps) == TRUE);
|
||||
g_assert (gst_caps_is_fixed (caps) == TRUE);
|
||||
g_print ("%s\n", gst_caps_to_string (caps));
|
||||
gst_caps_free (caps);
|
||||
gst_caps_unref (caps);
|
||||
|
||||
caps = gst_caps_new_simple ("audio/raw",
|
||||
"_fourcc", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('a', 'b', 'c', 'd'), NULL);
|
||||
|
@ -45,7 +45,7 @@ test1 (void)
|
|||
g_assert (GST_CAPS_IS_SIMPLE (caps) == TRUE);
|
||||
g_assert (gst_caps_is_fixed (caps) == TRUE);
|
||||
g_print ("%s\n", gst_caps_to_string (caps));
|
||||
gst_caps_free (caps);
|
||||
gst_caps_unref (caps);
|
||||
|
||||
caps = gst_caps_new_simple ("audio/raw",
|
||||
"_boolean", G_TYPE_BOOLEAN, TRUE, NULL);
|
||||
|
@ -55,7 +55,7 @@ test1 (void)
|
|||
g_assert (GST_CAPS_IS_SIMPLE (caps) == TRUE);
|
||||
g_assert (gst_caps_is_fixed (caps) == TRUE);
|
||||
g_print ("%s\n", gst_caps_to_string (caps));
|
||||
gst_caps_free (caps);
|
||||
gst_caps_unref (caps);
|
||||
|
||||
caps =
|
||||
gst_caps_new_full (gst_structure_new ("audio/raw", "_int", G_TYPE_INT,
|
||||
|
@ -67,7 +67,7 @@ test1 (void)
|
|||
g_assert (GST_CAPS_IS_SIMPLE (caps) == FALSE);
|
||||
g_assert (gst_caps_is_fixed (caps) == FALSE);
|
||||
g_print ("%s\n", gst_caps_to_string (caps));
|
||||
gst_caps_free (caps);
|
||||
gst_caps_unref (caps);
|
||||
|
||||
caps = gst_caps_new_simple ("audio/raw", "_int", G_TYPE_INT, 100, NULL);
|
||||
g_assert (caps != NULL);
|
||||
|
@ -79,8 +79,8 @@ test1 (void)
|
|||
g_assert (gst_caps_is_fixed (caps2) == TRUE);
|
||||
g_print ("%s\n", gst_caps_to_string (caps));
|
||||
g_print ("%s\n", gst_caps_to_string (caps2));
|
||||
gst_caps_free (caps);
|
||||
gst_caps_free (caps2);
|
||||
gst_caps_unref (caps);
|
||||
gst_caps_unref (caps2);
|
||||
|
||||
caps = gst_caps_new_simple ("audio/raw", "_int", G_TYPE_INT, 100, NULL);
|
||||
gst_caps_append (caps,
|
||||
|
@ -91,7 +91,7 @@ test1 (void)
|
|||
g_assert (GST_CAPS_IS_SIMPLE (caps) == FALSE);
|
||||
g_assert (gst_caps_is_fixed (caps) == FALSE);
|
||||
g_print ("%s\n", gst_caps_to_string (caps));
|
||||
gst_caps_free (caps);
|
||||
gst_caps_unref (caps);
|
||||
|
||||
caps = gst_caps_new_simple ("audio/raw", "_int", G_TYPE_INT, 100, NULL);
|
||||
g_assert (caps != NULL);
|
||||
|
@ -102,7 +102,7 @@ test1 (void)
|
|||
g_assert (GST_CAPS_IS_SIMPLE (caps) == FALSE);
|
||||
g_assert (gst_caps_is_fixed (caps) == FALSE);
|
||||
g_print ("%s\n", gst_caps_to_string (caps));
|
||||
gst_caps_free (caps);
|
||||
gst_caps_unref (caps);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -122,9 +122,9 @@ test2 (void)
|
|||
NULL), NULL);
|
||||
caps = gst_caps_intersect (caps1, caps2);
|
||||
g_print ("%s\n", gst_caps_to_string (caps));
|
||||
gst_caps_free (caps);
|
||||
gst_caps_free (caps1);
|
||||
gst_caps_free (caps2);
|
||||
gst_caps_unref (caps);
|
||||
gst_caps_unref (caps1);
|
||||
gst_caps_unref (caps2);
|
||||
|
||||
}
|
||||
|
||||
|
@ -143,7 +143,7 @@ test3 (void)
|
|||
g_assert (gst_caps_is_any (caps1));
|
||||
g_assert (gst_caps_get_size (caps1) == 0);
|
||||
|
||||
gst_caps_free (caps1);
|
||||
gst_caps_unref (caps1);
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
@ -66,14 +66,14 @@ main (int argc, char *argv[])
|
|||
abort ();
|
||||
}
|
||||
|
||||
gst_caps_free (caps);
|
||||
gst_caps_unref (caps);
|
||||
}
|
||||
|
||||
g_print ("parsed each structure individually\n");
|
||||
abort ();
|
||||
}
|
||||
|
||||
gst_caps_free (caps);
|
||||
gst_caps_unref (caps);
|
||||
g_free (list[i]);
|
||||
}
|
||||
|
||||
|
|
|
@ -87,8 +87,8 @@ main (gint argc, gchar * argv[])
|
|||
yes = g_value_get_enum (gst_structure_get_value (strc, "yes"));
|
||||
no = g_value_get_enum (gst_structure_get_value (strc, "no"));
|
||||
g_assert (yes == TEST_YES && no == TEST_NO);
|
||||
gst_caps_free (caps);
|
||||
gst_caps_free (res_caps);
|
||||
gst_caps_unref (caps);
|
||||
gst_caps_unref (res_caps);
|
||||
|
||||
/* yes */
|
||||
return 0;
|
||||
|
|
|
@ -39,9 +39,11 @@ main (gint argc, gchar ** argv)
|
|||
caps = gst_pad_get_caps (gst_element_get_pad (identity, "sink"));
|
||||
g_print ("caps: %s\n", gst_caps_to_string (caps));
|
||||
g_assert (!gst_caps_is_any (caps));
|
||||
|
||||
caps = gst_pad_get_allowed_caps (gst_element_get_pad (identity, "sink"));
|
||||
g_print ("allowed caps: %s\n", gst_caps_to_string (caps));
|
||||
g_assert (gst_caps_is_any (caps));
|
||||
/* get_allowed_caps doesn't mean anything if you aren't connected */
|
||||
g_assert (!caps);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -75,8 +75,8 @@ main (int argc, char *argv[])
|
|||
g_print ("caps %s\n", gst_caps_to_string (caps));
|
||||
if (gst_caps_is_empty (caps))
|
||||
return 1;
|
||||
gst_caps_free (caps1);
|
||||
gst_caps_free (caps2);
|
||||
gst_caps_unref (caps1);
|
||||
gst_caps_unref (caps2);
|
||||
|
||||
caps1 = gst_caps_copy (gst_static_caps_get (&rawcaps2));
|
||||
caps2 = gst_caps_copy (gst_static_caps_get (&rawcaps3));
|
||||
|
@ -84,8 +84,8 @@ main (int argc, char *argv[])
|
|||
g_print ("caps %s\n", gst_caps_to_string (caps));
|
||||
if (gst_caps_is_empty (caps))
|
||||
return 1;
|
||||
gst_caps_free (caps1);
|
||||
gst_caps_free (caps2);
|
||||
gst_caps_unref (caps1);
|
||||
gst_caps_unref (caps2);
|
||||
|
||||
caps1 = gst_caps_copy (gst_static_caps_get (&rawcaps4));
|
||||
caps2 = gst_caps_copy (gst_static_caps_get (&rawcaps5));
|
||||
|
@ -94,10 +94,10 @@ main (int argc, char *argv[])
|
|||
caps = gst_caps_intersect (caps3, caps4);
|
||||
g_print ("caps4 %s\n", gst_caps_to_string (caps4));
|
||||
g_print ("caps %s\n", gst_caps_to_string (caps));
|
||||
gst_caps_free (caps1);
|
||||
gst_caps_free (caps2);
|
||||
gst_caps_free (caps3);
|
||||
gst_caps_free (caps4);
|
||||
gst_caps_unref (caps1);
|
||||
gst_caps_unref (caps2);
|
||||
gst_caps_unref (caps3);
|
||||
gst_caps_unref (caps4);
|
||||
|
||||
caps1 = gst_caps_copy (gst_static_caps_get (&rawcaps7));
|
||||
caps2 = gst_caps_copy (gst_static_caps_get (&rawcaps8));
|
||||
|
@ -105,8 +105,8 @@ main (int argc, char *argv[])
|
|||
g_print ("caps %s\n", gst_caps_to_string (caps));
|
||||
if (gst_caps_is_empty (caps))
|
||||
return 1;
|
||||
gst_caps_free (caps1);
|
||||
gst_caps_free (caps2);
|
||||
gst_caps_unref (caps1);
|
||||
gst_caps_unref (caps2);
|
||||
|
||||
caps1 = gst_caps_copy (gst_static_caps_get (&rawcaps9));
|
||||
caps2 = gst_caps_copy (gst_static_caps_get (&rawcaps10));
|
||||
|
@ -114,8 +114,8 @@ main (int argc, char *argv[])
|
|||
g_print ("caps %s\n", gst_caps_to_string (caps));
|
||||
if (gst_caps_is_empty (caps))
|
||||
return 1;
|
||||
gst_caps_free (caps1);
|
||||
gst_caps_free (caps2);
|
||||
gst_caps_unref (caps1);
|
||||
gst_caps_unref (caps2);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ main (gint argc, gchar * argv[])
|
|||
gst_debug_add_log_function (assert_on_error, NULL);
|
||||
gst_caps_do_simplify (caps);
|
||||
gst_debug_remove_log_function (assert_on_error);
|
||||
gst_caps_free (caps);
|
||||
gst_caps_unref (caps);
|
||||
}
|
||||
|
||||
/* TEST 2:
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
#include <gst/gst.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
static GstPad *sinesrcpad;
|
||||
|
||||
|
@ -42,11 +44,11 @@ my_fixate (GstPad * pad, GstCaps * caps, gpointer user_data)
|
|||
}
|
||||
icaps = gst_caps_intersect (caps, mycaps);
|
||||
if (!gst_caps_is_empty (icaps)) {
|
||||
gst_caps_free (icaps);
|
||||
gst_caps_unref (icaps);
|
||||
g_print ("returning %d\n", rate);
|
||||
return gst_caps_copy (mycaps);
|
||||
}
|
||||
gst_caps_free (icaps);
|
||||
gst_caps_unref (icaps);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
@ -56,11 +58,10 @@ int
|
|||
main (int argc, char *argv[])
|
||||
{
|
||||
GstElement *pipeline;
|
||||
const GList *list;
|
||||
const GList *l2;
|
||||
int i;
|
||||
int ret;
|
||||
GError *error = NULL;
|
||||
GstIterator *iter1, *iter2;
|
||||
gint done1 = FALSE, done2 = FALSE;
|
||||
gpointer element;
|
||||
|
||||
gst_init (&argc, &argv);
|
||||
|
||||
|
@ -77,42 +78,73 @@ main (int argc, char *argv[])
|
|||
exit (0);
|
||||
}
|
||||
|
||||
list = gst_bin_get_list (GST_BIN (pipeline));
|
||||
while (list) {
|
||||
GstElement *element = GST_ELEMENT (list->data);
|
||||
iter1 = gst_bin_iterate_elements (GST_BIN (pipeline));
|
||||
while (!done1) {
|
||||
switch (gst_iterator_next (iter1, &element)) {
|
||||
case GST_ITERATOR_OK:
|
||||
{
|
||||
gpointer pad;
|
||||
|
||||
l2 = gst_element_get_pad_list (element);
|
||||
while (l2) {
|
||||
GstPad *pad = GST_PAD (l2->data);
|
||||
iter2 = gst_element_iterate_pads (element);
|
||||
while (!done2) {
|
||||
switch (gst_iterator_next (iter2, &pad)) {
|
||||
case GST_ITERATOR_OK:
|
||||
if (gst_pad_get_direction (pad) == GST_PAD_SRC) {
|
||||
g_signal_connect (G_OBJECT (pad), "fixate",
|
||||
G_CALLBACK (my_fixate), NULL);
|
||||
}
|
||||
gst_object_unref (pad);
|
||||
break;
|
||||
case GST_ITERATOR_DONE:
|
||||
done2 = TRUE;
|
||||
break;
|
||||
case GST_ITERATOR_RESYNC:
|
||||
case GST_ITERATOR_ERROR:
|
||||
exit (1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
gst_iterator_free (iter2);
|
||||
|
||||
if (gst_pad_get_direction (pad) == GST_PAD_SRC) {
|
||||
g_signal_connect (G_OBJECT (pad), "fixate", G_CALLBACK (my_fixate),
|
||||
NULL);
|
||||
gst_object_unref (element);
|
||||
break;
|
||||
}
|
||||
l2 = g_list_next (l2);
|
||||
case GST_ITERATOR_DONE:
|
||||
done1 = TRUE;
|
||||
break;
|
||||
case GST_ITERATOR_RESYNC:
|
||||
case GST_ITERATOR_ERROR:
|
||||
exit (1);
|
||||
break;
|
||||
}
|
||||
list = g_list_next (list);
|
||||
}
|
||||
gst_iterator_free (iter1);
|
||||
|
||||
g_signal_connect (pipeline, "deep_notify",
|
||||
G_CALLBACK (gst_element_default_deep_notify), NULL);
|
||||
/*g_signal_connect (pipeline, "deep_notify",
|
||||
G_CALLBACK (gst_element_default_deep_notify), NULL); */
|
||||
|
||||
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
||||
i = 0;
|
||||
while (1) {
|
||||
gst_bin_iterate (GST_BIN (pipeline));
|
||||
i++;
|
||||
if (i == 10) {
|
||||
stage = 1;
|
||||
g_print ("10 iterations\n");
|
||||
ret = gst_pad_renegotiate (sinesrcpad);
|
||||
g_print ("negotiation returned %d\n", ret);
|
||||
}
|
||||
if (i == 20) {
|
||||
g_print ("20 iterations\n");
|
||||
exit (0);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
i = 0;
|
||||
while (1) {
|
||||
gst_bin_iterate (GST_BIN (pipeline));
|
||||
i++;
|
||||
if (i == 10) {
|
||||
stage = 1;
|
||||
g_print ("10 iterations\n");
|
||||
ret = gst_pad_renegotiate (sinesrcpad);
|
||||
g_print ("negotiation returned %d\n", ret);
|
||||
}
|
||||
if (i == 20) {
|
||||
g_print ("20 iterations\n");
|
||||
exit (0);
|
||||
}
|
||||
}
|
||||
*/
|
||||
/* Like totally not sure how to do this in THREADED. Punting for now! */
|
||||
|
||||
sleep (5);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ check_caps (const gchar * eins, const gchar * zwei)
|
|||
test3 = gst_caps_intersect (test2, two);
|
||||
g_print (" empty = %s\n", gst_caps_to_string (test3));
|
||||
g_assert (gst_caps_is_empty (test3));
|
||||
gst_caps_free (test3);
|
||||
gst_caps_unref (test3);
|
||||
test3 = gst_caps_union (test2, two);
|
||||
g_print (" A + B = %u\n", strlen (gst_caps_to_string (test3)));
|
||||
/* test3 = one - two + two = one + two */
|
||||
|
@ -52,15 +52,15 @@ check_caps (const gchar * eins, const gchar * zwei)
|
|||
test4 = gst_caps_union (one, two);
|
||||
g_assert (gst_caps_is_equal (test3, test4));
|
||||
g_print (" NOT EQUAL\n\n");
|
||||
gst_caps_free (test2);
|
||||
gst_caps_free (test3);
|
||||
gst_caps_free (test4);
|
||||
gst_caps_unref (test2);
|
||||
gst_caps_unref (test3);
|
||||
gst_caps_unref (test4);
|
||||
} else {
|
||||
g_print (" ANY CAPS\n\n");
|
||||
}
|
||||
gst_caps_free (test);
|
||||
gst_caps_free (two);
|
||||
gst_caps_free (one);
|
||||
gst_caps_unref (test);
|
||||
gst_caps_unref (two);
|
||||
gst_caps_unref (one);
|
||||
}
|
||||
|
||||
gint
|
||||
|
|
|
@ -61,7 +61,7 @@ check_caps (GstCaps * caps)
|
|||
|
||||
g_free (before);
|
||||
g_free (after);
|
||||
gst_caps_free (old);
|
||||
gst_caps_unref (old);
|
||||
}
|
||||
|
||||
gint
|
||||
|
@ -86,7 +86,7 @@ main (gint argc, gchar ** argv)
|
|||
|
||||
g_print ("%2u - %2u ", i, j);
|
||||
check_caps (temp);
|
||||
gst_caps_free (temp);
|
||||
gst_caps_unref (temp);
|
||||
/* union */
|
||||
temp = gst_caps_union (caps, caps2);
|
||||
g_print ("%2u + %2u ", i, j);
|
||||
|
@ -99,11 +99,11 @@ main (gint argc, gchar ** argv)
|
|||
temp2 = gst_caps_copy (caps);
|
||||
gst_caps_append (temp2, caps2);
|
||||
g_assert (gst_caps_is_equal (temp, temp2));
|
||||
gst_caps_free (temp2);
|
||||
gst_caps_free (temp);
|
||||
gst_caps_unref (temp2);
|
||||
gst_caps_unref (temp);
|
||||
}
|
||||
}
|
||||
gst_caps_free (caps);
|
||||
gst_caps_unref (caps);
|
||||
}
|
||||
g_print ("\n\nSTATISTICS:\n");
|
||||
g_print ("\nOf all caps tried\n");
|
||||
|
|
|
@ -30,23 +30,23 @@ check_caps (const gchar * set, const gchar * subset)
|
|||
/* basics */
|
||||
test = gst_caps_subtract (one, one);
|
||||
g_assert (gst_caps_is_empty (test));
|
||||
gst_caps_free (test);
|
||||
gst_caps_unref (test);
|
||||
test = gst_caps_subtract (two, two);
|
||||
g_assert (gst_caps_is_empty (test));
|
||||
gst_caps_free (test);
|
||||
gst_caps_unref (test);
|
||||
test = gst_caps_subtract (two, one);
|
||||
g_assert (gst_caps_is_empty (test));
|
||||
gst_caps_free (test);
|
||||
gst_caps_unref (test);
|
||||
/* now the nice part */
|
||||
test = gst_caps_subtract (one, two);
|
||||
g_assert (!gst_caps_is_empty (test));
|
||||
g_print (" A - B = %s\n", gst_caps_to_string (test));
|
||||
test2 = gst_caps_union (test, two);
|
||||
g_print ("A - B + B = %s\n", gst_caps_to_string (test2));
|
||||
gst_caps_free (test);
|
||||
gst_caps_unref (test);
|
||||
test = gst_caps_subtract (test2, one);
|
||||
g_assert (gst_caps_is_empty (test));
|
||||
gst_caps_free (test);
|
||||
gst_caps_unref (test);
|
||||
}
|
||||
|
||||
gint
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
#include <gst/gst.h>
|
||||
|
||||
/* tests if gst_bin_get_(all_)by_interface works */
|
||||
/* tests if gst_bin_iterate_(all_)by_interface works */
|
||||
|
||||
gint
|
||||
main (gint argc, gchar * argv[])
|
||||
|
|
|
@ -146,8 +146,8 @@ test_caps (const char *s)
|
|||
g_print ("original: %s\nfiltered: %s\n\n", s, s2);
|
||||
|
||||
g_free (s2);
|
||||
gst_caps_free (caps);
|
||||
gst_caps_free (caps2);
|
||||
gst_caps_unref (caps);
|
||||
gst_caps_unref (caps2);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -12,11 +12,11 @@ test1 (void)
|
|||
|
||||
caps = gst_caps_new_empty ();
|
||||
g_assert (caps != NULL);
|
||||
gst_caps_free (caps);
|
||||
gst_caps_unref (caps);
|
||||
|
||||
caps = gst_caps_new_any ();
|
||||
g_assert (caps != NULL);
|
||||
gst_caps_free (caps);
|
||||
gst_caps_unref (caps);
|
||||
|
||||
caps = gst_caps_new_simple ("audio/raw", "_int", G_TYPE_INT, 100, NULL);
|
||||
g_assert (caps != NULL);
|
||||
|
@ -25,7 +25,7 @@ test1 (void)
|
|||
g_assert (GST_CAPS_IS_SIMPLE (caps) == TRUE);
|
||||
g_assert (gst_caps_is_fixed (caps) == TRUE);
|
||||
g_print ("%s\n", gst_caps_to_string (caps));
|
||||
gst_caps_free (caps);
|
||||
gst_caps_unref (caps);
|
||||
|
||||
caps = gst_caps_new_simple ("audio/raw",
|
||||
"_double", G_TYPE_DOUBLE, 100.0, NULL);
|
||||
|
@ -35,7 +35,7 @@ test1 (void)
|
|||
g_assert (GST_CAPS_IS_SIMPLE (caps) == TRUE);
|
||||
g_assert (gst_caps_is_fixed (caps) == TRUE);
|
||||
g_print ("%s\n", gst_caps_to_string (caps));
|
||||
gst_caps_free (caps);
|
||||
gst_caps_unref (caps);
|
||||
|
||||
caps = gst_caps_new_simple ("audio/raw",
|
||||
"_fourcc", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('a', 'b', 'c', 'd'), NULL);
|
||||
|
@ -45,7 +45,7 @@ test1 (void)
|
|||
g_assert (GST_CAPS_IS_SIMPLE (caps) == TRUE);
|
||||
g_assert (gst_caps_is_fixed (caps) == TRUE);
|
||||
g_print ("%s\n", gst_caps_to_string (caps));
|
||||
gst_caps_free (caps);
|
||||
gst_caps_unref (caps);
|
||||
|
||||
caps = gst_caps_new_simple ("audio/raw",
|
||||
"_boolean", G_TYPE_BOOLEAN, TRUE, NULL);
|
||||
|
@ -55,7 +55,7 @@ test1 (void)
|
|||
g_assert (GST_CAPS_IS_SIMPLE (caps) == TRUE);
|
||||
g_assert (gst_caps_is_fixed (caps) == TRUE);
|
||||
g_print ("%s\n", gst_caps_to_string (caps));
|
||||
gst_caps_free (caps);
|
||||
gst_caps_unref (caps);
|
||||
|
||||
caps =
|
||||
gst_caps_new_full (gst_structure_new ("audio/raw", "_int", G_TYPE_INT,
|
||||
|
@ -67,7 +67,7 @@ test1 (void)
|
|||
g_assert (GST_CAPS_IS_SIMPLE (caps) == FALSE);
|
||||
g_assert (gst_caps_is_fixed (caps) == FALSE);
|
||||
g_print ("%s\n", gst_caps_to_string (caps));
|
||||
gst_caps_free (caps);
|
||||
gst_caps_unref (caps);
|
||||
|
||||
caps = gst_caps_new_simple ("audio/raw", "_int", G_TYPE_INT, 100, NULL);
|
||||
g_assert (caps != NULL);
|
||||
|
@ -79,8 +79,8 @@ test1 (void)
|
|||
g_assert (gst_caps_is_fixed (caps2) == TRUE);
|
||||
g_print ("%s\n", gst_caps_to_string (caps));
|
||||
g_print ("%s\n", gst_caps_to_string (caps2));
|
||||
gst_caps_free (caps);
|
||||
gst_caps_free (caps2);
|
||||
gst_caps_unref (caps);
|
||||
gst_caps_unref (caps2);
|
||||
|
||||
caps = gst_caps_new_simple ("audio/raw", "_int", G_TYPE_INT, 100, NULL);
|
||||
gst_caps_append (caps,
|
||||
|
@ -91,7 +91,7 @@ test1 (void)
|
|||
g_assert (GST_CAPS_IS_SIMPLE (caps) == FALSE);
|
||||
g_assert (gst_caps_is_fixed (caps) == FALSE);
|
||||
g_print ("%s\n", gst_caps_to_string (caps));
|
||||
gst_caps_free (caps);
|
||||
gst_caps_unref (caps);
|
||||
|
||||
caps = gst_caps_new_simple ("audio/raw", "_int", G_TYPE_INT, 100, NULL);
|
||||
g_assert (caps != NULL);
|
||||
|
@ -102,7 +102,7 @@ test1 (void)
|
|||
g_assert (GST_CAPS_IS_SIMPLE (caps) == FALSE);
|
||||
g_assert (gst_caps_is_fixed (caps) == FALSE);
|
||||
g_print ("%s\n", gst_caps_to_string (caps));
|
||||
gst_caps_free (caps);
|
||||
gst_caps_unref (caps);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -122,9 +122,9 @@ test2 (void)
|
|||
NULL), NULL);
|
||||
caps = gst_caps_intersect (caps1, caps2);
|
||||
g_print ("%s\n", gst_caps_to_string (caps));
|
||||
gst_caps_free (caps);
|
||||
gst_caps_free (caps1);
|
||||
gst_caps_free (caps2);
|
||||
gst_caps_unref (caps);
|
||||
gst_caps_unref (caps1);
|
||||
gst_caps_unref (caps2);
|
||||
|
||||
}
|
||||
|
||||
|
@ -143,7 +143,7 @@ test3 (void)
|
|||
g_assert (gst_caps_is_any (caps1));
|
||||
g_assert (gst_caps_get_size (caps1) == 0);
|
||||
|
||||
gst_caps_free (caps1);
|
||||
gst_caps_unref (caps1);
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
@ -66,14 +66,14 @@ main (int argc, char *argv[])
|
|||
abort ();
|
||||
}
|
||||
|
||||
gst_caps_free (caps);
|
||||
gst_caps_unref (caps);
|
||||
}
|
||||
|
||||
g_print ("parsed each structure individually\n");
|
||||
abort ();
|
||||
}
|
||||
|
||||
gst_caps_free (caps);
|
||||
gst_caps_unref (caps);
|
||||
g_free (list[i]);
|
||||
}
|
||||
|
||||
|
|
|
@ -87,8 +87,8 @@ main (gint argc, gchar * argv[])
|
|||
yes = g_value_get_enum (gst_structure_get_value (strc, "yes"));
|
||||
no = g_value_get_enum (gst_structure_get_value (strc, "no"));
|
||||
g_assert (yes == TEST_YES && no == TEST_NO);
|
||||
gst_caps_free (caps);
|
||||
gst_caps_free (res_caps);
|
||||
gst_caps_unref (caps);
|
||||
gst_caps_unref (res_caps);
|
||||
|
||||
/* yes */
|
||||
return 0;
|
||||
|
|
|
@ -39,9 +39,11 @@ main (gint argc, gchar ** argv)
|
|||
caps = gst_pad_get_caps (gst_element_get_pad (identity, "sink"));
|
||||
g_print ("caps: %s\n", gst_caps_to_string (caps));
|
||||
g_assert (!gst_caps_is_any (caps));
|
||||
|
||||
caps = gst_pad_get_allowed_caps (gst_element_get_pad (identity, "sink"));
|
||||
g_print ("allowed caps: %s\n", gst_caps_to_string (caps));
|
||||
g_assert (gst_caps_is_any (caps));
|
||||
/* get_allowed_caps doesn't mean anything if you aren't connected */
|
||||
g_assert (!caps);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -75,8 +75,8 @@ main (int argc, char *argv[])
|
|||
g_print ("caps %s\n", gst_caps_to_string (caps));
|
||||
if (gst_caps_is_empty (caps))
|
||||
return 1;
|
||||
gst_caps_free (caps1);
|
||||
gst_caps_free (caps2);
|
||||
gst_caps_unref (caps1);
|
||||
gst_caps_unref (caps2);
|
||||
|
||||
caps1 = gst_caps_copy (gst_static_caps_get (&rawcaps2));
|
||||
caps2 = gst_caps_copy (gst_static_caps_get (&rawcaps3));
|
||||
|
@ -84,8 +84,8 @@ main (int argc, char *argv[])
|
|||
g_print ("caps %s\n", gst_caps_to_string (caps));
|
||||
if (gst_caps_is_empty (caps))
|
||||
return 1;
|
||||
gst_caps_free (caps1);
|
||||
gst_caps_free (caps2);
|
||||
gst_caps_unref (caps1);
|
||||
gst_caps_unref (caps2);
|
||||
|
||||
caps1 = gst_caps_copy (gst_static_caps_get (&rawcaps4));
|
||||
caps2 = gst_caps_copy (gst_static_caps_get (&rawcaps5));
|
||||
|
@ -94,10 +94,10 @@ main (int argc, char *argv[])
|
|||
caps = gst_caps_intersect (caps3, caps4);
|
||||
g_print ("caps4 %s\n", gst_caps_to_string (caps4));
|
||||
g_print ("caps %s\n", gst_caps_to_string (caps));
|
||||
gst_caps_free (caps1);
|
||||
gst_caps_free (caps2);
|
||||
gst_caps_free (caps3);
|
||||
gst_caps_free (caps4);
|
||||
gst_caps_unref (caps1);
|
||||
gst_caps_unref (caps2);
|
||||
gst_caps_unref (caps3);
|
||||
gst_caps_unref (caps4);
|
||||
|
||||
caps1 = gst_caps_copy (gst_static_caps_get (&rawcaps7));
|
||||
caps2 = gst_caps_copy (gst_static_caps_get (&rawcaps8));
|
||||
|
@ -105,8 +105,8 @@ main (int argc, char *argv[])
|
|||
g_print ("caps %s\n", gst_caps_to_string (caps));
|
||||
if (gst_caps_is_empty (caps))
|
||||
return 1;
|
||||
gst_caps_free (caps1);
|
||||
gst_caps_free (caps2);
|
||||
gst_caps_unref (caps1);
|
||||
gst_caps_unref (caps2);
|
||||
|
||||
caps1 = gst_caps_copy (gst_static_caps_get (&rawcaps9));
|
||||
caps2 = gst_caps_copy (gst_static_caps_get (&rawcaps10));
|
||||
|
@ -114,8 +114,8 @@ main (int argc, char *argv[])
|
|||
g_print ("caps %s\n", gst_caps_to_string (caps));
|
||||
if (gst_caps_is_empty (caps))
|
||||
return 1;
|
||||
gst_caps_free (caps1);
|
||||
gst_caps_free (caps2);
|
||||
gst_caps_unref (caps1);
|
||||
gst_caps_unref (caps2);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ main (gint argc, gchar * argv[])
|
|||
gst_debug_add_log_function (assert_on_error, NULL);
|
||||
gst_caps_do_simplify (caps);
|
||||
gst_debug_remove_log_function (assert_on_error);
|
||||
gst_caps_free (caps);
|
||||
gst_caps_unref (caps);
|
||||
}
|
||||
|
||||
/* TEST 2:
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
#include <gst/gst.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
static GstPad *sinesrcpad;
|
||||
|
||||
|
@ -42,11 +44,11 @@ my_fixate (GstPad * pad, GstCaps * caps, gpointer user_data)
|
|||
}
|
||||
icaps = gst_caps_intersect (caps, mycaps);
|
||||
if (!gst_caps_is_empty (icaps)) {
|
||||
gst_caps_free (icaps);
|
||||
gst_caps_unref (icaps);
|
||||
g_print ("returning %d\n", rate);
|
||||
return gst_caps_copy (mycaps);
|
||||
}
|
||||
gst_caps_free (icaps);
|
||||
gst_caps_unref (icaps);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
@ -56,11 +58,10 @@ int
|
|||
main (int argc, char *argv[])
|
||||
{
|
||||
GstElement *pipeline;
|
||||
const GList *list;
|
||||
const GList *l2;
|
||||
int i;
|
||||
int ret;
|
||||
GError *error = NULL;
|
||||
GstIterator *iter1, *iter2;
|
||||
gint done1 = FALSE, done2 = FALSE;
|
||||
gpointer element;
|
||||
|
||||
gst_init (&argc, &argv);
|
||||
|
||||
|
@ -77,42 +78,73 @@ main (int argc, char *argv[])
|
|||
exit (0);
|
||||
}
|
||||
|
||||
list = gst_bin_get_list (GST_BIN (pipeline));
|
||||
while (list) {
|
||||
GstElement *element = GST_ELEMENT (list->data);
|
||||
iter1 = gst_bin_iterate_elements (GST_BIN (pipeline));
|
||||
while (!done1) {
|
||||
switch (gst_iterator_next (iter1, &element)) {
|
||||
case GST_ITERATOR_OK:
|
||||
{
|
||||
gpointer pad;
|
||||
|
||||
l2 = gst_element_get_pad_list (element);
|
||||
while (l2) {
|
||||
GstPad *pad = GST_PAD (l2->data);
|
||||
iter2 = gst_element_iterate_pads (element);
|
||||
while (!done2) {
|
||||
switch (gst_iterator_next (iter2, &pad)) {
|
||||
case GST_ITERATOR_OK:
|
||||
if (gst_pad_get_direction (pad) == GST_PAD_SRC) {
|
||||
g_signal_connect (G_OBJECT (pad), "fixate",
|
||||
G_CALLBACK (my_fixate), NULL);
|
||||
}
|
||||
gst_object_unref (pad);
|
||||
break;
|
||||
case GST_ITERATOR_DONE:
|
||||
done2 = TRUE;
|
||||
break;
|
||||
case GST_ITERATOR_RESYNC:
|
||||
case GST_ITERATOR_ERROR:
|
||||
exit (1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
gst_iterator_free (iter2);
|
||||
|
||||
if (gst_pad_get_direction (pad) == GST_PAD_SRC) {
|
||||
g_signal_connect (G_OBJECT (pad), "fixate", G_CALLBACK (my_fixate),
|
||||
NULL);
|
||||
gst_object_unref (element);
|
||||
break;
|
||||
}
|
||||
l2 = g_list_next (l2);
|
||||
case GST_ITERATOR_DONE:
|
||||
done1 = TRUE;
|
||||
break;
|
||||
case GST_ITERATOR_RESYNC:
|
||||
case GST_ITERATOR_ERROR:
|
||||
exit (1);
|
||||
break;
|
||||
}
|
||||
list = g_list_next (list);
|
||||
}
|
||||
gst_iterator_free (iter1);
|
||||
|
||||
g_signal_connect (pipeline, "deep_notify",
|
||||
G_CALLBACK (gst_element_default_deep_notify), NULL);
|
||||
/*g_signal_connect (pipeline, "deep_notify",
|
||||
G_CALLBACK (gst_element_default_deep_notify), NULL); */
|
||||
|
||||
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
||||
i = 0;
|
||||
while (1) {
|
||||
gst_bin_iterate (GST_BIN (pipeline));
|
||||
i++;
|
||||
if (i == 10) {
|
||||
stage = 1;
|
||||
g_print ("10 iterations\n");
|
||||
ret = gst_pad_renegotiate (sinesrcpad);
|
||||
g_print ("negotiation returned %d\n", ret);
|
||||
}
|
||||
if (i == 20) {
|
||||
g_print ("20 iterations\n");
|
||||
exit (0);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
i = 0;
|
||||
while (1) {
|
||||
gst_bin_iterate (GST_BIN (pipeline));
|
||||
i++;
|
||||
if (i == 10) {
|
||||
stage = 1;
|
||||
g_print ("10 iterations\n");
|
||||
ret = gst_pad_renegotiate (sinesrcpad);
|
||||
g_print ("negotiation returned %d\n", ret);
|
||||
}
|
||||
if (i == 20) {
|
||||
g_print ("20 iterations\n");
|
||||
exit (0);
|
||||
}
|
||||
}
|
||||
*/
|
||||
/* Like totally not sure how to do this in THREADED. Punting for now! */
|
||||
|
||||
sleep (5);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ check_caps (const gchar * eins, const gchar * zwei)
|
|||
test3 = gst_caps_intersect (test2, two);
|
||||
g_print (" empty = %s\n", gst_caps_to_string (test3));
|
||||
g_assert (gst_caps_is_empty (test3));
|
||||
gst_caps_free (test3);
|
||||
gst_caps_unref (test3);
|
||||
test3 = gst_caps_union (test2, two);
|
||||
g_print (" A + B = %u\n", strlen (gst_caps_to_string (test3)));
|
||||
/* test3 = one - two + two = one + two */
|
||||
|
@ -52,15 +52,15 @@ check_caps (const gchar * eins, const gchar * zwei)
|
|||
test4 = gst_caps_union (one, two);
|
||||
g_assert (gst_caps_is_equal (test3, test4));
|
||||
g_print (" NOT EQUAL\n\n");
|
||||
gst_caps_free (test2);
|
||||
gst_caps_free (test3);
|
||||
gst_caps_free (test4);
|
||||
gst_caps_unref (test2);
|
||||
gst_caps_unref (test3);
|
||||
gst_caps_unref (test4);
|
||||
} else {
|
||||
g_print (" ANY CAPS\n\n");
|
||||
}
|
||||
gst_caps_free (test);
|
||||
gst_caps_free (two);
|
||||
gst_caps_free (one);
|
||||
gst_caps_unref (test);
|
||||
gst_caps_unref (two);
|
||||
gst_caps_unref (one);
|
||||
}
|
||||
|
||||
gint
|
||||
|
|
|
@ -61,7 +61,7 @@ check_caps (GstCaps * caps)
|
|||
|
||||
g_free (before);
|
||||
g_free (after);
|
||||
gst_caps_free (old);
|
||||
gst_caps_unref (old);
|
||||
}
|
||||
|
||||
gint
|
||||
|
@ -86,7 +86,7 @@ main (gint argc, gchar ** argv)
|
|||
|
||||
g_print ("%2u - %2u ", i, j);
|
||||
check_caps (temp);
|
||||
gst_caps_free (temp);
|
||||
gst_caps_unref (temp);
|
||||
/* union */
|
||||
temp = gst_caps_union (caps, caps2);
|
||||
g_print ("%2u + %2u ", i, j);
|
||||
|
@ -99,11 +99,11 @@ main (gint argc, gchar ** argv)
|
|||
temp2 = gst_caps_copy (caps);
|
||||
gst_caps_append (temp2, caps2);
|
||||
g_assert (gst_caps_is_equal (temp, temp2));
|
||||
gst_caps_free (temp2);
|
||||
gst_caps_free (temp);
|
||||
gst_caps_unref (temp2);
|
||||
gst_caps_unref (temp);
|
||||
}
|
||||
}
|
||||
gst_caps_free (caps);
|
||||
gst_caps_unref (caps);
|
||||
}
|
||||
g_print ("\n\nSTATISTICS:\n");
|
||||
g_print ("\nOf all caps tried\n");
|
||||
|
|
|
@ -30,23 +30,23 @@ check_caps (const gchar * set, const gchar * subset)
|
|||
/* basics */
|
||||
test = gst_caps_subtract (one, one);
|
||||
g_assert (gst_caps_is_empty (test));
|
||||
gst_caps_free (test);
|
||||
gst_caps_unref (test);
|
||||
test = gst_caps_subtract (two, two);
|
||||
g_assert (gst_caps_is_empty (test));
|
||||
gst_caps_free (test);
|
||||
gst_caps_unref (test);
|
||||
test = gst_caps_subtract (two, one);
|
||||
g_assert (gst_caps_is_empty (test));
|
||||
gst_caps_free (test);
|
||||
gst_caps_unref (test);
|
||||
/* now the nice part */
|
||||
test = gst_caps_subtract (one, two);
|
||||
g_assert (!gst_caps_is_empty (test));
|
||||
g_print (" A - B = %s\n", gst_caps_to_string (test));
|
||||
test2 = gst_caps_union (test, two);
|
||||
g_print ("A - B + B = %s\n", gst_caps_to_string (test2));
|
||||
gst_caps_free (test);
|
||||
gst_caps_unref (test);
|
||||
test = gst_caps_subtract (test2, one);
|
||||
g_assert (gst_caps_is_empty (test));
|
||||
gst_caps_free (test);
|
||||
gst_caps_unref (test);
|
||||
}
|
||||
|
||||
gint
|
||||
|
|
Loading…
Reference in a new issue