mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 07:58:51 +00:00
uridownloader: Add refresh parameter to hint caches that they should check if they're up to date
This commit is contained in:
parent
dfc6745143
commit
aa875604c9
2 changed files with 21 additions and 34 deletions
|
@ -323,7 +323,7 @@ gst_uri_downloader_set_range (GstUriDownloader * downloader,
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_uri_downloader_set_uri (GstUriDownloader * downloader, const gchar * uri,
|
gst_uri_downloader_set_uri (GstUriDownloader * downloader, const gchar * uri,
|
||||||
const gchar * referer, gboolean compress)
|
const gchar * referer, gboolean compress, gboolean refresh)
|
||||||
{
|
{
|
||||||
GstPad *pad;
|
GstPad *pad;
|
||||||
GObjectClass *gobject_class;
|
GObjectClass *gobject_class;
|
||||||
|
@ -379,10 +379,15 @@ gst_uri_downloader_set_uri (GstUriDownloader * downloader, const gchar * uri,
|
||||||
if (g_object_class_find_property (gobject_class, "keep-alive"))
|
if (g_object_class_find_property (gobject_class, "keep-alive"))
|
||||||
g_object_set (downloader->priv->urisrc, "keep-alive", TRUE, NULL);
|
g_object_set (downloader->priv->urisrc, "keep-alive", TRUE, NULL);
|
||||||
if (g_object_class_find_property (gobject_class, "extra-headers")) {
|
if (g_object_class_find_property (gobject_class, "extra-headers")) {
|
||||||
if (referer) {
|
if (referer || refresh) {
|
||||||
GstStructure *extra_headers =
|
GstStructure *extra_headers = gst_structure_new_empty ("headers");
|
||||||
gst_structure_new ("headers", "Referer", G_TYPE_STRING, referer,
|
|
||||||
NULL);
|
if (referer)
|
||||||
|
gst_structure_set (extra_headers, "Referer", G_TYPE_STRING, referer,
|
||||||
|
NULL);
|
||||||
|
if (refresh)
|
||||||
|
gst_structure_set (extra_headers, "Cache-Control", G_TYPE_STRING,
|
||||||
|
"max-age=0", NULL);
|
||||||
|
|
||||||
g_object_set (downloader->priv->urisrc, "extra-headers", extra_headers,
|
g_object_set (downloader->priv->urisrc, "extra-headers", extra_headers,
|
||||||
NULL);
|
NULL);
|
||||||
|
@ -408,32 +413,16 @@ gst_uri_downloader_set_uri (GstUriDownloader * downloader, const gchar * uri,
|
||||||
}
|
}
|
||||||
|
|
||||||
GstFragment *
|
GstFragment *
|
||||||
gst_uri_downloader_fetch_uri (GstUriDownloader * downloader, const gchar * uri,
|
gst_uri_downloader_fetch_uri (GstUriDownloader * downloader,
|
||||||
gboolean compress, GError ** err)
|
const gchar * uri, const gchar * referer, gboolean compress,
|
||||||
|
gboolean refresh, GError ** err)
|
||||||
{
|
{
|
||||||
return gst_uri_downloader_fetch_uri_with_range_and_referer (downloader, uri,
|
return gst_uri_downloader_fetch_uri_with_range (downloader, uri,
|
||||||
NULL, compress, 0, -1, err);
|
referer, compress, refresh, 0, -1, err);
|
||||||
}
|
|
||||||
|
|
||||||
GstFragment *
|
|
||||||
gst_uri_downloader_fetch_uri_with_referer (GstUriDownloader * downloader,
|
|
||||||
const gchar * uri, const gchar * referer, gboolean compress, GError ** err)
|
|
||||||
{
|
|
||||||
return gst_uri_downloader_fetch_uri_with_range_and_referer (downloader, uri,
|
|
||||||
referer, compress, 0, -1, err);
|
|
||||||
}
|
|
||||||
|
|
||||||
GstFragment *
|
|
||||||
gst_uri_downloader_fetch_uri_with_range (GstUriDownloader * downloader,
|
|
||||||
const gchar * uri, gboolean compress, gint64 range_start, gint64 range_end,
|
|
||||||
GError ** err)
|
|
||||||
{
|
|
||||||
return gst_uri_downloader_fetch_uri_with_range_and_referer (downloader, uri,
|
|
||||||
NULL, compress, range_start, range_end, err);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_uri_downloader_fetch_uri_with_range_and_referer:
|
* gst_uri_downloader_fetch_uri_with_range:
|
||||||
* @downloader: the #GstUriDownloader
|
* @downloader: the #GstUriDownloader
|
||||||
* @uri: the uri
|
* @uri: the uri
|
||||||
* @range_start: the starting byte index
|
* @range_start: the starting byte index
|
||||||
|
@ -442,9 +431,9 @@ gst_uri_downloader_fetch_uri_with_range (GstUriDownloader * downloader,
|
||||||
* Returns the downloaded #GstFragment
|
* Returns the downloaded #GstFragment
|
||||||
*/
|
*/
|
||||||
GstFragment *
|
GstFragment *
|
||||||
gst_uri_downloader_fetch_uri_with_range_and_referer (GstUriDownloader *
|
gst_uri_downloader_fetch_uri_with_range (GstUriDownloader *
|
||||||
downloader, const gchar * uri, const gchar * referer, gboolean compress,
|
downloader, const gchar * uri, const gchar * referer, gboolean compress,
|
||||||
gint64 range_start, gint64 range_end, GError ** err)
|
gboolean refresh, gint64 range_start, gint64 range_end, GError ** err)
|
||||||
{
|
{
|
||||||
GstStateChangeReturn ret;
|
GstStateChangeReturn ret;
|
||||||
GstFragment *download = NULL;
|
GstFragment *download = NULL;
|
||||||
|
@ -461,7 +450,7 @@ gst_uri_downloader_fetch_uri_with_range_and_referer (GstUriDownloader *
|
||||||
goto quit;
|
goto quit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gst_uri_downloader_set_uri (downloader, uri, referer, compress)) {
|
if (!gst_uri_downloader_set_uri (downloader, uri, referer, compress, refresh)) {
|
||||||
GST_WARNING_OBJECT (downloader, "Failed to set URI");
|
GST_WARNING_OBJECT (downloader, "Failed to set URI");
|
||||||
goto quit;
|
goto quit;
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,10 +56,8 @@ struct _GstUriDownloaderClass
|
||||||
GType gst_uri_downloader_get_type (void);
|
GType gst_uri_downloader_get_type (void);
|
||||||
|
|
||||||
GstUriDownloader * gst_uri_downloader_new (void);
|
GstUriDownloader * gst_uri_downloader_new (void);
|
||||||
GstFragment * gst_uri_downloader_fetch_uri (GstUriDownloader * downloader, const gchar * uri, gboolean compress, GError ** err);
|
GstFragment * gst_uri_downloader_fetch_uri (GstUriDownloader * downloader, const gchar * uri, const gchar * referer, gboolean compress, gboolean refresh, GError ** err);
|
||||||
GstFragment * gst_uri_downloader_fetch_uri_with_range (GstUriDownloader * downloader, const gchar * uri, gboolean compress, gint64 range_start, gint64 range_end, GError ** err);
|
GstFragment * gst_uri_downloader_fetch_uri_with_range (GstUriDownloader * downloader, const gchar * uri, const gchar * referer, gboolean compress, gboolean refresh, gint64 range_start, gint64 range_end, GError ** err);
|
||||||
GstFragment * gst_uri_downloader_fetch_uri_with_referer (GstUriDownloader * downloader, const gchar * uri, const gchar * referer, gboolean compress, GError ** err);
|
|
||||||
GstFragment * gst_uri_downloader_fetch_uri_with_range_and_referer (GstUriDownloader * downloader, const gchar * uri, const gchar * referer, gboolean compress, gint64 range_start, gint64 range_end, GError ** err);
|
|
||||||
void gst_uri_downloader_reset (GstUriDownloader *downloader);
|
void gst_uri_downloader_reset (GstUriDownloader *downloader);
|
||||||
void gst_uri_downloader_cancel (GstUriDownloader *downloader);
|
void gst_uri_downloader_cancel (GstUriDownloader *downloader);
|
||||||
void gst_uri_downloader_free (GstUriDownloader *downloader);
|
void gst_uri_downloader_free (GstUriDownloader *downloader);
|
||||||
|
|
Loading…
Reference in a new issue