mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 09:55:36 +00:00
sys/vcd/vcdsrc.c: Allow the track to be set by using the uri. Fixes #535043.
Original commit message from CVS: 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.
This commit is contained in:
parent
e5a3ccfa81
commit
8d55304d61
2 changed files with 71 additions and 4 deletions
|
@ -1,3 +1,11 @@
|
|||
2008-05-28 Wim Taymans <wim.taymans@collabora.co.uk>
|
||||
|
||||
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 <slomo@circular-chaos.org>
|
||||
|
||||
* gst/interleave/interleave.c: (gst_interleave_src_query_duration),
|
||||
|
|
|
@ -470,21 +470,80 @@ gst_vcdsrc_uri_get_protocols (void)
|
|||
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;
|
||||
GstVCDSrc *src = GST_VCDSRC (handler);
|
||||
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)
|
||||
goto invalid_location;
|
||||
}
|
||||
|
||||
GST_OBJECT_LOCK (src);
|
||||
src->track = tracknr;
|
||||
GST_DEBUG_OBJECT (src, "configured track %d", src->track);
|
||||
GST_OBJECT_UNLOCK (src);
|
||||
|
||||
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");
|
||||
return FALSE;
|
||||
}
|
||||
invalid_location:
|
||||
{
|
||||
GST_ERROR_OBJECT (src, "Invalid location %s in URI '%s'", location, uri);
|
||||
g_free (location);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Reference in a new issue