static void
gst_cdda_base_src_set_device (GstCddaBaseSrc * src, const gchar * device)
{
+ if (src->device)
+ g_free (src->device);
+ src->device = NULL;
+
+ if (!device)
+ return;
+
/* skip multiple slashes */
while (*device == '/' && *(device + 1) == '/')
device++;
case ARG_DEVICE:{
const gchar *dev = g_value_get_string (value);
- g_free (src->device);
- if (dev && *dev) {
- gst_cdda_base_src_set_device (src, dev);
- } else {
- src->device = NULL;
- }
+ gst_cdda_base_src_set_device (src, dev);
break;
}
case ARG_TRACK:{
}
static void
-test_uri_parse (const char *uri, const char *device, int track)
+test_uri_parse (const gchar * uri, const gchar * device, gint track)
{
GstElement *foosrc;
- char *set_device;
- int set_track;
+ gchar *set_device = NULL;
+ gint set_track = 0;
foosrc = gst_element_factory_make ("cdfoosrc", "cdfoosrc");
fail_unless (gst_uri_handler_set_uri (GST_URI_HANDLER (foosrc), uri) == TRUE,
"couldn't set uri %s", uri);
g_object_get (foosrc, "device", &set_device, "track", &set_track, NULL);
+ fail_unless (set_device != NULL);
fail_unless (strcmp (set_device, device) == 0,
"device set was %s, expected %s", set_device, device);
fail_unless (set_track == track, "track set was %d, expected %d", set_track,
track);
+ g_free (set_device);
gst_object_unref (foosrc);
}