From: Eunhye Choi Date: Wed, 17 Jul 2019 07:34:28 +0000 (+0900) Subject: souphttpsrc: get seekable info from dlna op code X-Git-Tag: accepted/tizen/5.5/unified/20191031.005754^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F50%2F210250%2F3;p=platform%2Fupstream%2Fgst-plugins-good.git souphttpsrc: get seekable info from dlna op code - get seekable info from dlna op code to support seek operation regardless of the server response code. Change-Id: Ica14f9bed5d3121ca8cca3179ea97a7314d2d8c6 --- diff --git a/ext/soup/gstsouphttpsrc.c b/ext/soup/gstsouphttpsrc.c index 64d05fe..40abf46 100644 --- a/ext/soup/gstsouphttpsrc.c +++ b/ext/soup/gstsouphttpsrc.c @@ -140,6 +140,11 @@ enum #define REDUCE_BLOCKSIZE_COUNT 2 #define REDUCE_BLOCKSIZE_FACTOR 0.5 +#ifdef TIZEN_FEATURE_SOUP_MODIFICATION +#define DLNA_OP_TIMED_SEEK 0x02 +#define DLNA_OP_BYTE_SEEK 0x01 +#endif + static void gst_soup_http_src_uri_handler_init (gpointer g_iface, gpointer iface_data); static void gst_soup_http_src_finalize (GObject * gobject); @@ -456,6 +461,7 @@ gst_soup_http_src_reset (GstSoupHTTPSrc * src) g_free (src->dash_newest_segment); src->dash_newest_segment = NULL; } + src->dlna_opt = 0; #endif g_cancellable_reset (src->cancellable); @@ -506,6 +512,7 @@ gst_soup_http_src_init (GstSoupHTTPSrc * src) src->dash_oldest_segment = NULL; src->dash_newest_segment = NULL; src->received_total = 0; + src->dlna_opt = 0; #endif proxy = g_getenv ("http_proxy"); if (!gst_soup_http_src_set_proxy (src, proxy)) { @@ -1250,6 +1257,44 @@ gst_soup_http_src_got_headers (GstSoupHTTPSrc * src, SoupMessage * msg) gst_event_replace (&src->http_headers_event, http_headers_event); gst_event_unref (http_headers_event); +#ifdef TIZEN_FEATURE_SOUP_MODIFICATION + /* Parse DLNA OP CODE */ + if ((value = soup_message_headers_get_one + (msg->response_headers, "contentFeatures.dlna.org")) != NULL) { + gchar **token = NULL; + gchar **ptr = NULL; + + GST_DEBUG_OBJECT (src, "DLNA server response"); + + token = g_strsplit (value, ";", 0); + for (ptr = token ; *ptr ; ptr++) { + gchar *tmp = NULL; + gchar *op_code = NULL; + + if (!strlen (*ptr)) + continue; + + tmp = g_ascii_strup (*ptr, strlen (*ptr)); + if (!strstr (tmp, "DLNA.ORG_OP")) { + g_free (tmp); + continue; + } + + g_free (tmp); + + op_code = strchr (*ptr, '='); + if (op_code) { + op_code++; + + src->dlna_opt = (atoi (op_code) / 10 << 1) | (atoi (op_code) % 10); + GST_DEBUG_OBJECT (src, "dlna op code: %s (0x%X)", op_code, src->dlna_opt); + break; + } + } + g_strfreev (token); + } +#endif + /* Parse Content-Length. */ if (soup_message_headers_get_encoding (msg->response_headers) == SOUP_ENCODING_CONTENT_LENGTH) { @@ -1297,10 +1342,16 @@ gst_soup_http_src_got_headers (GstSoupHTTPSrc * src, SoupMessage * msg) src->seekable = FALSE; } #ifdef TIZEN_FEATURE_SOUP_MODIFICATION + else if (src->dlna_opt & DLNA_OP_BYTE_SEEK) { + if (src->have_size) { + GST_DEBUG_OBJECT (src, "DLNA server is seekable"); + src->seekable = TRUE; + } + } /* The Range request header is always included. * @ref gst_soup_http_src_add_range_header() */ else if ((msg->status_code == SOUP_STATUS_OK) && - (soup_message_headers_get_content_range(msg->response_headers, &start, &stop, &total) == FALSE)) { + (soup_message_headers_get_content_range (msg->response_headers, &start, &stop, &total) == FALSE)) { GST_DEBUG_OBJECT (src, "there is no accept range header"); src->seekable = FALSE; } diff --git a/ext/soup/gstsouphttpsrc.h b/ext/soup/gstsouphttpsrc.h index b6f0065..3b37fe0 100644 --- a/ext/soup/gstsouphttpsrc.h +++ b/ext/soup/gstsouphttpsrc.h @@ -118,6 +118,7 @@ struct _GstSoupHTTPSrc { gchar *dash_oldest_segment; gchar *dash_newest_segment; guint64 received_total; /* temp: for debugging */ + guint dlna_opt; /* DLNA server option */ #endif };