From: <wt...@ke...> - 2008-05-28 08:53:07
|
CVS Root: /cvs/gstreamer Module: gst-plugins-bad Changes by: wtay Date: Wed May 28 2008 08:53:14 UTC Log message: Based on patch by: <onkarshinde at gmail dot com> * sys/vcd/vcdsrc.c: (gst_vcdsrc_uri_get_uri), (gst_vcdsrc_uri_set_uri): Allow the track to be set by using the uri. Fixes #535043. Modified files: . : ChangeLog sys/vcd : vcdsrc.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-bad/ChangeLog.diff?r1=1.3336&r2=1.3337 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-bad/sys/vcd/vcdsrc.c.diff?r1=1.26&r2=1.27 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gst-plugins-bad/ChangeLog,v retrieving revision 1.3336 retrieving revision 1.3337 diff -u -d -r1.3336 -r1.3337 --- ChangeLog 28 May 2008 08:14:14 -0000 1.3336 +++ ChangeLog 28 May 2008 08:52:58 -0000 1.3337 @@ -1,3 +1,11 @@ +2008-05-28 Wim Taymans <wim...@co...> + + Based on patch by: <onkarshinde at gmail dot com> + * sys/vcd/vcdsrc.c: (gst_vcdsrc_uri_get_uri), + (gst_vcdsrc_uri_set_uri): + Allow the track to be set by using the uri. Fixes #535043. 2008-05-28 Sebastian Dröge <sl...@ci...> * gst/interleave/interleave.c: (gst_interleave_src_query_duration), Index: vcdsrc.c RCS file: /cvs/gstreamer/gst-plugins-bad/sys/vcd/vcdsrc.c,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- vcdsrc.c 24 Sep 2007 10:53:37 -0000 1.26 +++ vcdsrc.c 28 May 2008 08:53:00 -0000 1.27 @@ -470,21 +470,80 @@ static const gchar * gst_vcdsrc_uri_get_uri (GstURIHandler * handler) { - return "vcd://"; + GstVCDSrc *src = GST_VCDSRC (handler); + gchar *result; + GST_OBJECT_LOCK (src); + result = g_strdup_printf ("vcd://%d", src->track); + GST_OBJECT_UNLOCK (src); + return result; } static gboolean gst_vcdsrc_uri_set_uri (GstURIHandler * handler, const gchar * uri) - gboolean ret; gchar *protocol; + gchar *location = NULL; + gint tracknr; + GST_DEBUG_OBJECT (src, "setting uri '%s'", uri); protocol = gst_uri_get_protocol (uri); - ret = (protocol && !strcmp (protocol, "vcd")) ? TRUE : FALSE; + if (protocol == NULL || strcmp (protocol, "vcd")) + goto wrong_protocol; + GST_DEBUG_OBJECT (src, "have protocol '%s'", protocol); g_free (protocol); - return ret; + /* parse out the track in the location */ + if (!(location = gst_uri_get_location (uri))) + goto no_location; + GST_DEBUG_OBJECT (src, "have location '%s'", location); + if (*location == '\0') { + /* empty location selects track 1 */ + tracknr = 1; + } else { + /* scan the track number */ + if (sscanf (location, "%d", &tracknr) != 1) + goto invalid_location; + if (tracknr < 1) + } + src->track = tracknr; + GST_DEBUG_OBJECT (src, "configured track %d", src->track); + g_free (location); + return TRUE; + /* ERRORS */ +wrong_protocol: + { + GST_ERROR_OBJECT (src, "wrong protocol %s specified", + GST_STR_NULL (protocol)); + g_free (protocol); + return FALSE; +no_location: + GST_ERROR_OBJECT (src, "no location specified"); +invalid_location: + GST_ERROR_OBJECT (src, "Invalid location %s in URI '%s'", location, uri); + g_free (location); static void |