summaryrefslogtreecommitdiff
path: root/gst-libs/gst/uridownloader
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2014-05-28 09:42:44 +0200
committerSebastian Dröge <sebastian@centricular.com>2014-05-28 09:44:24 +0200
commit8372fa6eccd7a93663e6532db867be568f02c722 (patch)
tree2d4e48e4059f9cc9f9bf05950ae3dcd099318dda /gst-libs/gst/uridownloader
parent78524309349936d7163d9ddd3fe40307d02d795d (diff)
downloadgstreamer-plugins-bad-8372fa6eccd7a93663e6532db867be568f02c722.tar.gz
uridownloader: Store URI and redirect target in the downloaded fragments
Diffstat (limited to 'gst-libs/gst/uridownloader')
-rw-r--r--gst-libs/gst/uridownloader/gstfragment.c2
-rw-r--r--gst-libs/gst/uridownloader/gstfragment.h4
-rw-r--r--gst-libs/gst/uridownloader/gsturidownloader.c16
3 files changed, 20 insertions, 2 deletions
diff --git a/gst-libs/gst/uridownloader/gstfragment.c b/gst-libs/gst/uridownloader/gstfragment.c
index 33e4d7040..2060ea283 100644
--- a/gst-libs/gst/uridownloader/gstfragment.c
+++ b/gst-libs/gst/uridownloader/gstfragment.c
@@ -180,6 +180,8 @@ gst_fragment_finalize (GObject * gobject)
{
GstFragment *fragment = GST_FRAGMENT (gobject);
+ g_free (fragment->uri);
+ g_free (fragment->redirect_uri);
g_free (fragment->name);
g_mutex_clear (&fragment->priv->lock);
diff --git a/gst-libs/gst/uridownloader/gstfragment.h b/gst-libs/gst/uridownloader/gstfragment.h
index d7292b452..bdf04f3cd 100644
--- a/gst-libs/gst/uridownloader/gstfragment.h
+++ b/gst-libs/gst/uridownloader/gstfragment.h
@@ -41,6 +41,10 @@ struct _GstFragment
{
GObject parent;
+ gchar * uri; /* URI of the fragment */
+ gchar * redirect_uri; /* Redirect target if any */
+ gboolean redirect_permanent; /* If the redirect is permanent */
+
gchar * name; /* Name of the fragment */
gboolean completed; /* Whether the fragment is complete or not */
guint64 download_start_time; /* Epoch time when the download started */
diff --git a/gst-libs/gst/uridownloader/gsturidownloader.c b/gst-libs/gst/uridownloader/gsturidownloader.c
index 99d88e88b..c33be1858 100644
--- a/gst-libs/gst/uridownloader/gsturidownloader.c
+++ b/gst-libs/gst/uridownloader/gsturidownloader.c
@@ -545,10 +545,22 @@ quit:
/* set the element state to NULL */
GST_OBJECT_UNLOCK (downloader);
- if (download == NULL)
+ if (download == NULL) {
gst_element_set_state (urisrc, GST_STATE_NULL);
- else
+ } else {
+ GstQuery *query;
+
+ /* Download successfull, let's query the URI */
+ query = gst_query_new_uri ();
+ if (gst_element_query (urisrc, query)) {
+ gst_query_parse_uri (query, &download->uri);
+ gst_query_parse_uri_redirection (query, &download->redirect_uri);
+ gst_query_parse_uri_redirection_permanent (query,
+ &download->redirect_permanent);
+ }
+ gst_query_unref (query);
gst_element_set_state (urisrc, GST_STATE_READY);
+ }
GST_OBJECT_LOCK (downloader);
gst_element_set_bus (urisrc, NULL);