From 46c355038b9998ab57801511797ad17e8b013dfa Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Thu, 6 Oct 2011 10:50:12 +0200 Subject: gnlsource: Don't use _accept_caps to figure out compatible pads It isn't reliable due to issues with gst_caps_is_subset. Instead we just check if a pad caps intersect with the target caps Ported from 0.11 (471611). Fixes bug #662312. Conflicts: gnl/gnlsource.c --- gnl/gnlsource.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/gnl/gnlsource.c b/gnl/gnlsource.c index cec125a..fcce139 100644 --- a/gnl/gnlsource.c +++ b/gnl/gnlsource.c @@ -202,6 +202,8 @@ static void element_pad_added_cb (GstElement * element G_GNUC_UNUSED, GstPad * pad, GnlSource * source) { + GstCaps *srccaps; + GST_DEBUG_OBJECT (source, "pad %s:%s", GST_DEBUG_PAD_NAME (pad)); if (source->priv->ghostpad || source->priv->pendingblock) { @@ -212,10 +214,13 @@ element_pad_added_cb (GstElement * element G_GNUC_UNUSED, GstPad * pad, return; } - if (!(gst_pad_accept_caps (pad, GNL_OBJECT (source)->caps))) { + srccaps = gst_pad_get_caps_reffed (pad); + if (!gst_caps_can_intersect (srccaps, GNL_OBJECT (source)->caps)) { + gst_caps_unref (srccaps); GST_DEBUG_OBJECT (source, "Pad doesn't have valid caps, ignoring"); return; } + gst_caps_unref (srccaps); GST_DEBUG_OBJECT (pad, "valid pad, about to add event probe and pad block"); @@ -267,13 +272,19 @@ static gint compare_src_pad (GstPad * pad, GstCaps * caps) { gint ret; + GstCaps *padcaps; + + padcaps = gst_pad_get_caps_reffed (pad); - if (gst_pad_accept_caps (pad, caps)) + if (gst_caps_can_intersect (padcaps, caps)) ret = 0; else { gst_object_unref (pad); ret = 1; } + + gst_caps_unref (padcaps); + return ret; } -- cgit v1.2.3 From 49e185c5720b747e84dd2d36d24a2a2efec14d19 Mon Sep 17 00:00:00 2001 From: Tim-Philipp Müller Date: Fri, 13 Jan 2012 12:18:14 +0000 Subject: gnlfilesource: use gst_filename_to_uri() to create a proper file URI This will create a correct URI even for relative paths, which are allowed for "location" properties. Bump GStreamer core/base requirement to 0.10.33 for that API. --- configure.ac | 4 ++-- gnl/gnlfilesource.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 9ca0667..b8ebbb9 100644 --- a/configure.ac +++ b/configure.ac @@ -45,8 +45,8 @@ AC_LIBTOOL_WIN32_DLL AM_PROG_LIBTOOL dnl *** required versions of GStreamer stuff *** -GST_REQ=0.10.30 -GSTPB_REQ=0.10.30 +GST_REQ=0.10.33 +GSTPB_REQ=0.10.33 dnl *** autotools stuff **** diff --git a/gnl/gnlfilesource.c b/gnl/gnlfilesource.c index 84238aa..688a1a5 100644 --- a/gnl/gnlfilesource.c +++ b/gnl/gnlfilesource.c @@ -109,7 +109,7 @@ gnl_filesource_set_location (GnlFileSource * fs, const gchar * location) GST_DEBUG_OBJECT (fs, "location: '%s'", location); if (g_ascii_strncasecmp (location, "file://", 7)) - tmp = g_strdup_printf ("file://%s", location); + tmp = gst_filename_to_uri (location, NULL); else tmp = g_strdup (location); GST_DEBUG ("%s", tmp); -- cgit v1.2.3 From 3fe47d77f1a167effe92096f7d6b6e099ea707dd Mon Sep 17 00:00:00 2001 From: Tim-Philipp Müller Date: Fri, 13 Jan 2012 12:19:31 +0000 Subject: gnlfilesource: unescape URIs when converting an URI into a filename URIs may contain escapes, which need to be unescaped when creating a filename (even if we pass an URI that's unescaped, we may get back an escaped one, can't really make any assumptions). --- gnl/gnlfilesource.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gnl/gnlfilesource.c b/gnl/gnlfilesource.c index 688a1a5..82d789b 100644 --- a/gnl/gnlfilesource.c +++ b/gnl/gnlfilesource.c @@ -146,10 +146,12 @@ gnl_filesource_get_property (GObject * object, guint prop_id, const gchar *uri = NULL;; g_object_get (fs, "uri", &uri, NULL); - if (uri != NULL && g_str_has_prefix (uri, "file://")) - g_value_set_string (value, uri + 7); - else + if (uri != NULL && g_str_has_prefix (uri, "file://")) { + /* URIs may contain escaped characters, need to unescape those */ + g_value_take_string (value, g_filename_from_uri (uri, NULL, NULL)); + } else { g_value_set_string (value, NULL); + } } break; default: -- cgit v1.2.3 From 68dbcd3bc5f5608368273fc7d0ef1d84fae653c0 Mon Sep 17 00:00:00 2001 From: Tim-Philipp Müller Date: Fri, 13 Jan 2012 12:32:29 +0000 Subject: tests: don't redefine fail_unless_equals_int64() Fixes compiler warnings with recent GStreamer versions. --- tests/check/gnl/common.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/check/gnl/common.h b/tests/check/gnl/common.h index f13b315..03ec691 100644 --- a/tests/check/gnl/common.h +++ b/tests/check/gnl/common.h @@ -1,6 +1,7 @@ #include +#ifndef fail_unless_equals_int64 #define fail_unless_equals_int64(a, b) \ G_STMT_START { \ gint64 first = a; \ @@ -9,6 +10,7 @@ G_STMT_START { \ "'" #a "' (%" G_GINT64_FORMAT ") is not equal to '" #b"' (%" \ G_GINT64_FORMAT ")", first, second); \ } G_STMT_END; +#endif #define check_start_stop_duration(object, startval, stopval, durval) \ G_STMT_START { guint64 start, stop; \ -- cgit v1.2.3 From bb08fe9cf80da451c8aac0338e698e4052f748b7 Mon Sep 17 00:00:00 2001 From: Sebastian Dröge Date: Tue, 6 Mar 2012 15:33:49 +0100 Subject: gnl: Fix 'signed shift result (0x20000000000) requires 43 bits to represent, but 'int' only has 32 bits' compiler warning Seems we don't have that many flags left... --- gnl/gnlobject.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gnl/gnlobject.h b/gnl/gnlobject.h index 568b973..c5a3b2e 100644 --- a/gnl/gnlobject.h +++ b/gnl/gnlobject.h @@ -57,7 +57,7 @@ typedef enum GNL_OBJECT_OPERATION = (GST_BIN_FLAG_LAST << 1), GNL_OBJECT_EXPANDABLE = (GST_BIN_FLAG_LAST << 2), /* padding */ - GNL_OBJECT_LAST_FLAG = (GST_BIN_FLAG_LAST << 16) + GNL_OBJECT_LAST_FLAG = (GST_BIN_FLAG_LAST << 5) } GnlObjectFlags; -- cgit v1.2.3