mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-30 16:02:00 +02:00
clapper: media-item: Fix construct with NULL as "cache-location"
This commit is contained in:
@@ -167,7 +167,7 @@ clapper_media_item_new_cached (const gchar *uri, const gchar *location)
|
|||||||
{
|
{
|
||||||
ClapperMediaItem *item = clapper_media_item_new (uri);
|
ClapperMediaItem *item = clapper_media_item_new (uri);
|
||||||
|
|
||||||
if (G_LIKELY (item != NULL) && location)
|
if (location && G_LIKELY (item != NULL))
|
||||||
clapper_media_item_set_cache_location (item, location);
|
clapper_media_item_set_cache_location (item, location);
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
@@ -486,9 +486,13 @@ clapper_media_item_update_from_discoverer_info (ClapperMediaItem *self, GstDisco
|
|||||||
void
|
void
|
||||||
clapper_media_item_set_cache_location (ClapperMediaItem *self, const gchar *location)
|
clapper_media_item_set_cache_location (ClapperMediaItem *self, const gchar *location)
|
||||||
{
|
{
|
||||||
g_free (self->cache_uri);
|
g_clear_pointer (&self->cache_uri, g_free);
|
||||||
self->cache_uri = g_filename_to_uri (location, NULL, NULL);
|
|
||||||
GST_DEBUG_OBJECT (self, "Set cache URI: \"%s\"", self->cache_uri);
|
if (location)
|
||||||
|
self->cache_uri = g_filename_to_uri (location, NULL, NULL);
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (self, "Set cache URI: \"%s\"",
|
||||||
|
GST_STR_NULL (self->cache_uri));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXX: Can only be read from player thread.
|
/* XXX: Can only be read from player thread.
|
||||||
@@ -509,9 +513,7 @@ clapper_media_item_get_playback_uri (ClapperMediaItem *self)
|
|||||||
return self->cache_uri;
|
return self->cache_uri;
|
||||||
|
|
||||||
/* Do not test file existence next time */
|
/* Do not test file existence next time */
|
||||||
GST_DEBUG_OBJECT (self, "Cleared cache URI for non-existing file: \"%s\"",
|
clapper_media_item_set_cache_location (self, NULL);
|
||||||
self->cache_uri);
|
|
||||||
g_clear_pointer (&self->cache_uri, g_free);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return self->uri;
|
return self->uri;
|
||||||
|
Reference in New Issue
Block a user