From 4db445cf84d04d61912334beedcd3a8e41149f7c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim-Philipp=20M=C3=BCller?= Date: Sun, 13 Nov 2011 19:01:31 +0000 Subject: [PATCH] dvdreadsrc, pnmsrc: update for GstURIHandler changes --- ext/dvdread/dvdreadsrc.c | 41 +++++++++++++++-------------------------- ext/dvdread/dvdreadsrc.h | 1 - gst/realmedia/pnmsrc.c | 11 +++++------ 3 files changed, 20 insertions(+), 33 deletions(-) diff --git a/ext/dvdread/dvdreadsrc.c b/ext/dvdread/dvdreadsrc.c index 50f89a4..471b0f7 100644 --- a/ext/dvdread/dvdreadsrc.c +++ b/ext/dvdread/dvdreadsrc.c @@ -100,7 +100,6 @@ gst_dvd_read_src_finalize (GObject * object) GstDvdReadSrc *src = GST_DVD_READ_SRC (object); g_free (src->location); - g_free (src->last_uri); G_OBJECT_CLASS (parent_class)->finalize (object); } @@ -114,7 +113,6 @@ gst_dvd_read_src_init (GstDvdReadSrc * src) src->dvd_title = NULL; src->location = g_strdup ("/dev/dvd"); - src->last_uri = NULL; src->new_seek = TRUE; src->new_cell = TRUE; src->change_cell = FALSE; @@ -1642,36 +1640,25 @@ gst_dvd_read_src_uri_get_protocols (GType type) return protocols; } -static const gchar * +static gchar * gst_dvd_read_src_uri_get_uri (GstURIHandler * handler) { GstDvdReadSrc *src = GST_DVD_READ_SRC (handler); + gchar *uri; GST_OBJECT_LOCK (src); - - g_free (src->last_uri); - src->last_uri = g_strdup_printf ("dvd://%d,%d,%d", src->uri_title, - src->uri_chapter, src->uri_angle); - + uri = g_strdup_printf ("dvd://%d,%d,%d", src->uri_title, src->uri_chapter, + src->uri_angle); GST_OBJECT_UNLOCK (src); - return src->last_uri; + return uri; } static gboolean -gst_dvd_read_src_uri_set_uri (GstURIHandler * handler, const gchar * uri) +gst_dvd_read_src_uri_set_uri (GstURIHandler * handler, const gchar * uri, + GError ** error) { GstDvdReadSrc *src = GST_DVD_READ_SRC (handler); - gboolean ret; - gchar *protocol; - - protocol = gst_uri_get_protocol (uri); - ret = (protocol != NULL && g_str_equal (protocol, "dvd")); - g_free (protocol); - protocol = NULL; - - if (!ret) - return ret; /* parse out the new t/c/a and seek to them */ { @@ -1682,15 +1669,15 @@ gst_dvd_read_src_uri_set_uri (GstURIHandler * handler, const gchar * uri) location = gst_uri_get_location (uri); - if (!location) - return ret; - GST_OBJECT_LOCK (src); src->uri_title = 1; src->uri_chapter = 1; src->uri_angle = 1; + if (!location) + goto empty_location; + strcur = strs = g_strsplit (location, ",", 0); while (strcur && *strcur) { gint val; @@ -1727,13 +1714,15 @@ gst_dvd_read_src_uri_set_uri (GstURIHandler * handler, const gchar * uri) src->new_seek = TRUE; } - GST_OBJECT_UNLOCK (src); - g_strfreev (strs); g_free (location); + + empty_location: + + GST_OBJECT_UNLOCK (src); } - return ret; + return TRUE; } static void diff --git a/ext/dvdread/dvdreadsrc.h b/ext/dvdread/dvdreadsrc.h index 77e8183..9224379 100644 --- a/ext/dvdread/dvdreadsrc.h +++ b/ext/dvdread/dvdreadsrc.h @@ -47,7 +47,6 @@ struct _GstDvdReadSrc { /* location */ gchar *location; - gchar *last_uri; gboolean new_seek; gboolean change_cell; diff --git a/gst/realmedia/pnmsrc.c b/gst/realmedia/pnmsrc.c index 008df37..64768fc 100644 --- a/gst/realmedia/pnmsrc.c +++ b/gst/realmedia/pnmsrc.c @@ -207,22 +207,21 @@ gst_pnm_src_uri_get_protocols (GType type) return protocols; } -static const gchar * +static gchar * gst_pnm_src_uri_get_uri (GstURIHandler * handler) { GstPNMSrc *src = GST_PNM_SRC (handler); - return src->location; + /* FIXME: make thread-safe */ + return g_strdup (src->location); } static gboolean -gst_pnm_src_uri_set_uri (GstURIHandler * handler, const gchar * uri) +gst_pnm_src_uri_set_uri (GstURIHandler * handler, const gchar * uri, + GError ** error) { GstPNMSrc *src = GST_PNM_SRC (handler); - if (!g_str_has_prefix (uri, "pnm://")) - return FALSE; - g_free (src->location); src->location = g_strdup (uri); -- 2.7.4