summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2016-08-24 14:15:09 +0300
committerSebastian Dröge <sebastian@centricular.com>2016-08-24 14:16:23 +0300
commita2c03f2b00bb0871c53217e7212e1401daaf547c (patch)
treec53a042cd5a8a9c8fe591c55cf2537cc87e5b235
parente416e79af81f08fdb321bf6974d8b73218a7f6f3 (diff)
player: On redirects, remember the redirect URI separately and don't consider this an URI property change
The application does not know anything about the redirect, and changing its URI internally will cause confusion. Also don't reset the subtitle URI.
-rw-r--r--gst-libs/gst/player/gstplayer.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/gst-libs/gst/player/gstplayer.c b/gst-libs/gst/player/gstplayer.c
index fe63d120b..7c5c57dbc 100644
--- a/gst-libs/gst/player/gstplayer.c
+++ b/gst-libs/gst/player/gstplayer.c
@@ -155,6 +155,7 @@ struct _GstPlayer
GstPlayerSignalDispatcher *signal_dispatcher;
gchar *uri;
+ gchar *redirect_uri;
gchar *suburi;
GThread *thread;
@@ -490,6 +491,7 @@ gst_player_finalize (GObject * object)
GST_TRACE_OBJECT (self, "Finalizing");
g_free (self->uri);
+ g_free (self->redirect_uri);
g_free (self->suburi);
if (self->global_tags)
gst_tag_list_unref (self->global_tags);
@@ -599,7 +601,8 @@ gst_player_set_suburi_internal (gpointer user_data)
GST_STR_NULL (self->suburi));
g_object_set (self->playbin, "suburi", self->suburi, NULL);
- g_object_set (self->playbin, "uri", self->uri, NULL);
+ g_object_set (self->playbin, "uri",
+ self->redirect_uri ? self->redirect_uri : self->uri, NULL);
g_mutex_unlock (&self->lock);
@@ -650,6 +653,8 @@ gst_player_set_property (GObject * object, guint prop_id,
case PROP_URI:{
g_mutex_lock (&self->lock);
g_free (self->uri);
+ g_free (self->redirect_uri);
+ self->redirect_uri = NULL;
self->uri = g_value_dup_string (value);
GST_DEBUG_OBJECT (self, "Set uri=%s", self->uri);
@@ -1798,14 +1803,14 @@ element_cb (G_GNUC_UNUSED GstBus * bus, GstMessage * msg, gpointer user_data)
/* Remember target state and restore after setting the URI */
target_state = self->target_state;
- g_mutex_lock (&self->lock);
- g_free (self->uri);
+ gst_player_stop_internal (self, TRUE);
- self->uri = g_strdup (new_location);
+ g_mutex_lock (&self->lock);
+ g_free (self->redirect_uri);
+ self->redirect_uri = g_strdup (new_location);
+ g_object_set (self->playbin, "uri", self->redirect_uri, NULL);
g_mutex_unlock (&self->lock);
- gst_player_set_uri_internal (self);
-
if (target_state == GST_STATE_PAUSED)
gst_player_pause_internal (self);
else if (target_state == GST_STATE_PLAYING)