/* Properties */
demux->bitrate_limit = DEFAULT_BITRATE_LIMIT;
demux->connection_speed = DEFAULT_CONNECTION_SPEED;
+#ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
+ demux->max_bandwidth = DEFAULT_ADAPTIVE_VARIANT;
+ demux->max_width = DEFAULT_ADAPTIVE_VARIANT;
+ demux->max_height = DEFAULT_ADAPTIVE_VARIANT;
+#endif
gst_element_add_pad (GST_ELEMENT (demux), demux->sinkpad);
}
return result;
}
+#ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
+static gboolean
+gst_adaptive_demux_check_http_header (GQuark field_id, const GValue * value,
+ gpointer data)
+{
+ GstAdaptiveDemux *demux = GST_ADAPTIVE_DEMUX_CAST (data);
+
+ if (value
+ && g_ascii_strcasecmp (g_quark_to_string (field_id), "User-Agent") == 0) {
+ if (demux->user_agent)
+ g_free (demux->user_agent);
+ demux->user_agent = g_value_dup_string (value);
+ GST_INFO_OBJECT (demux, "User-Agent : %s",
+ (demux->user_agent) ? (demux->user_agent) : NULL);
+ }
+
+ if (value
+ && g_ascii_strcasecmp (g_quark_to_string (field_id), "Set-Cookie") == 0) {
+ guint i = 0;
+ gchar **cookies =
+ (gchar **) g_malloc0 ((gst_value_array_get_size (value) +
+ 1) * sizeof (gchar *));
+
+ for (i = 0; i < gst_value_array_get_size (value); i++) {
+ GST_INFO_OBJECT (demux, "Cookie : %s",
+ g_value_get_string (gst_value_array_get_value (value, i)));
+ cookies[i] = g_value_dup_string (gst_value_array_get_value (value, i));
+ }
+ cookies[i] = NULL;
+ if (demux->cookies)
+ g_strfreev (demux->cookies);
+ demux->cookies = g_strdupv (cookies);
+ g_strfreev (cookies);
+ }
+ return TRUE;
+}
+#endif
+
static gboolean
gst_adaptive_demux_sink_event (GstPad * pad, GstObject * parent,
GstEvent * event)
/* Swallow newsegments, we'll push our own */
gst_event_unref (event);
return TRUE;
+#ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
+ case GST_EVENT_CUSTOM_DOWNSTREAM_STICKY:{
+ const GstStructure *structure;
+ GstStructure *req_headers = NULL;
+ GstStructure *res_headers = NULL;
+
+ structure = gst_event_get_structure (event);
+ if (gst_structure_has_name (structure, "http-headers")) {
+ if (gst_structure_has_field (structure, "request-headers")) {
+ gst_structure_get (structure, "request-headers", GST_TYPE_STRUCTURE,
+ &req_headers, NULL);
+ gst_structure_foreach (req_headers,
+ gst_adaptive_demux_check_http_header, demux);
+ gst_structure_free (req_headers);
+ }
+ if (gst_structure_has_field (structure, "response-headers")) {
+ gst_structure_get (structure, "response-headers", GST_TYPE_STRUCTURE,
+ &res_headers, NULL);
+ gst_structure_foreach (res_headers,
+ gst_adaptive_demux_check_http_header, demux);
+ gst_structure_free (res_headers);
+ }
+ }
+ break;
+ }
+#endif
+
default:
break;
}
g_free (demux->manifest_base_uri);
demux->manifest_uri = NULL;
demux->manifest_base_uri = NULL;
+#ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
+ if (demux->user_agent)
+ g_free (demux->user_agent);
+ if (demux->cookies)
+ g_strfreev (demux->cookies);
+ demux->user_agent = NULL;
+ demux->cookies = NULL;
+#endif
gst_adapter_clear (demux->priv->input_adapter);
demux->priv->have_manifest = FALSE;
GST_MANIFEST_UNLOCK (demux);
break;
+#ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
+ case GST_QUERY_CUSTOM:{
+ /* Let decoder(which can not support DRC automatically) know the current streaming mode */
+
+ const GstStructure *s;
+ s = gst_query_get_structure (query);
+
+ if (gst_structure_has_name (s, "GstAdaptiveStreaming")) {
+ GValue value = { 0, };
+ GST_DEBUG_OBJECT (demux, "custom query to check adaptive streaming");
+
+ g_value_init (&value, G_TYPE_BOOLEAN);
+ g_value_set_boolean (&value, TRUE);
+ gst_structure_set_value ((GstStructure *) s, "adaptive-streaming",
+ &value);
+
+ g_value_set_boolean (&value, gst_adaptive_demux_is_live (demux));
+ gst_structure_set_value ((GstStructure *) s, "is-live", &value);
+
+ ret = TRUE;
+ } else {
+ GST_DEBUG_OBJECT (demux, "Unsupported query");
+ ret = FALSE;
+ }
+ break;
+ }
+#endif
default:
/* Don't forward queries upstream because of the special nature of this
* "demuxer", which relies on the upstream element only to be fed
GST_BUFFER_DURATION (buffer) = GST_CLOCK_TIME_NONE;
GST_BUFFER_DTS (buffer) = GST_CLOCK_TIME_NONE;
if (G_UNLIKELY (stream->pending_caps)) {
+#ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
+ gst_caps_make_writable (stream->pending_caps);
+ if (gst_adaptive_demux_is_live (demux)) {
+ gst_caps_set_simple (stream->pending_caps, "is_live", G_TYPE_BOOLEAN,
+ TRUE, NULL);
+ } else {
+ gst_caps_set_simple (stream->pending_caps, "is_live", G_TYPE_BOOLEAN,
+ FALSE, NULL);
+ }
+#endif
pending_caps = gst_event_new_caps (stream->pending_caps);
gst_caps_unref (stream->pending_caps);
stream->pending_caps = NULL;
g_object_set (uri_handler, "compress", FALSE, NULL);
if (g_object_class_find_property (gobject_class, "keep-alive"))
g_object_set (uri_handler, "keep-alive", TRUE, NULL);
+#ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
+ if (g_object_class_find_property (gobject_class, "user-agent")
+ && (demux->user_agent))
+ g_object_set (stream->src, "user-agent", demux->user_agent, NULL);
+ if (g_object_class_find_property (gobject_class, "cookies")
+ && (demux->cookies))
+ g_object_set (stream->src, "cookies", demux->cookies, NULL);
+ #endif
if (g_object_class_find_property (gobject_class, "extra-headers")) {
if (referer || refresh || !allow_cache) {
GstStructure *extra_headers = gst_structure_new_empty ("headers");
GstFlowReturn ret;
GError *error = NULL;
+#ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
+ download = gst_uri_downloader_fetch_uri (demux->downloader,
+ demux->manifest_uri, NULL, demux->user_agent, demux->cookies,
+ PLAYLIST_ADAPTIVE_RETRY, PLAYLIST_ADAPTIVE_TIMEOUT, TRUE, TRUE, TRUE,
+ NULL);
+#else
download = gst_uri_downloader_fetch_uri (demux->downloader,
demux->manifest_uri, NULL, TRUE, TRUE, TRUE, &error);
+#endif
if (download) {
g_free (demux->manifest_uri);
g_free (demux->manifest_base_uri);