mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 07:58:51 +00:00
mpdparser: Fix missing baseURL query
When no initializationURL or mediaURL, return baseURL that also contains original URI query if available. This fixes a problem where URI query was being omitted in the HTTP requests. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1147>
This commit is contained in:
parent
548bbc3147
commit
30c2bdad61
2 changed files with 50 additions and 30 deletions
|
@ -1366,46 +1366,56 @@ gst_mpdparser_free_active_stream (GstActiveStream * active_stream)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gchar *
|
||||||
|
get_base_url_with_query (GstActiveStream * stream)
|
||||||
|
{
|
||||||
|
GstUri *uri;
|
||||||
|
gchar *uri_str;
|
||||||
|
|
||||||
|
if (!stream->queryURL)
|
||||||
|
return g_strdup (stream->baseURL);
|
||||||
|
|
||||||
|
uri = gst_uri_from_string (stream->baseURL);
|
||||||
|
gst_uri_set_query_string (uri, stream->queryURL);
|
||||||
|
uri_str = gst_uri_to_string (uri);
|
||||||
|
|
||||||
|
gst_uri_unref (uri);
|
||||||
|
return uri_str;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* gst_mpdparser_get_initializationURL:
|
* gst_mpdparser_get_initializationURL:
|
||||||
*
|
*
|
||||||
* Returns: (transfer full): stream initializationURL if available,
|
* Returns: (transfer full): stream initializationURL if available,
|
||||||
* baseURL otherwise.
|
* baseURL combined with queryURL otherwise.
|
||||||
*/
|
*/
|
||||||
gchar *
|
gchar *
|
||||||
gst_mpdparser_get_initializationURL (GstActiveStream * stream,
|
gst_mpdparser_get_initializationURL (GstActiveStream * stream,
|
||||||
GstMPDURLTypeNode * InitializationURL)
|
GstMPDURLTypeNode * InitializationURL)
|
||||||
{
|
{
|
||||||
const gchar *url_prefix;
|
|
||||||
|
|
||||||
g_return_val_if_fail (stream != NULL, NULL);
|
g_return_val_if_fail (stream != NULL, NULL);
|
||||||
|
|
||||||
url_prefix = (InitializationURL
|
return (InitializationURL && InitializationURL->sourceURL)
|
||||||
&& InitializationURL->sourceURL) ? InitializationURL->sourceURL : stream->
|
? g_strdup (InitializationURL->sourceURL)
|
||||||
baseURL;
|
: get_base_url_with_query (stream);
|
||||||
|
|
||||||
return g_strdup (url_prefix);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* gst_mpdparser_get_mediaURL:
|
* gst_mpdparser_get_mediaURL:
|
||||||
*
|
*
|
||||||
* Returns: (transfer full): stream mediaURL if available,
|
* Returns: (transfer full): stream mediaURL if available,
|
||||||
* baseURL otherwise.
|
* baseURL combined with queryURL otherwise.
|
||||||
*/
|
*/
|
||||||
gchar *
|
gchar *
|
||||||
gst_mpdparser_get_mediaURL (GstActiveStream * stream,
|
gst_mpdparser_get_mediaURL (GstActiveStream * stream,
|
||||||
GstMPDSegmentURLNode * segmentURL)
|
GstMPDSegmentURLNode * segmentURL)
|
||||||
{
|
{
|
||||||
const gchar *url_prefix;
|
|
||||||
|
|
||||||
g_return_val_if_fail (stream != NULL, NULL);
|
g_return_val_if_fail (stream != NULL, NULL);
|
||||||
g_return_val_if_fail (segmentURL != NULL, NULL);
|
g_return_val_if_fail (segmentURL != NULL, NULL);
|
||||||
|
|
||||||
url_prefix = segmentURL->media ? segmentURL->media : stream->baseURL;
|
return (segmentURL->media)
|
||||||
g_return_val_if_fail (url_prefix != NULL, NULL);
|
? g_strdup (segmentURL->media)
|
||||||
|
: get_base_url_with_query (stream);
|
||||||
return g_strdup (url_prefix);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* navigation functions */
|
/* navigation functions */
|
||||||
|
|
|
@ -1397,46 +1397,56 @@ gst_mpdparser_free_active_stream (GstActiveStream * active_stream)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gchar *
|
||||||
|
get_base_url_with_query (GstActiveStream * stream)
|
||||||
|
{
|
||||||
|
GstUri *uri;
|
||||||
|
gchar *uri_str;
|
||||||
|
|
||||||
|
if (!stream->queryURL)
|
||||||
|
return g_strdup (stream->baseURL);
|
||||||
|
|
||||||
|
uri = gst_uri_from_string (stream->baseURL);
|
||||||
|
gst_uri_set_query_string (uri, stream->queryURL);
|
||||||
|
uri_str = gst_uri_to_string (uri);
|
||||||
|
|
||||||
|
gst_uri_unref (uri);
|
||||||
|
return uri_str;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* gst_mpdparser_get_initializationURL:
|
* gst_mpdparser_get_initializationURL:
|
||||||
*
|
*
|
||||||
* Returns: (transfer full): stream initializationURL if available,
|
* Returns: (transfer full): stream initializationURL if available,
|
||||||
* baseURL otherwise.
|
* baseURL combined with queryURL otherwise.
|
||||||
*/
|
*/
|
||||||
gchar *
|
gchar *
|
||||||
gst_mpdparser_get_initializationURL (GstActiveStream * stream,
|
gst_mpdparser_get_initializationURL (GstActiveStream * stream,
|
||||||
GstMPDURLTypeNode * InitializationURL)
|
GstMPDURLTypeNode * InitializationURL)
|
||||||
{
|
{
|
||||||
const gchar *url_prefix;
|
|
||||||
|
|
||||||
g_return_val_if_fail (stream != NULL, NULL);
|
g_return_val_if_fail (stream != NULL, NULL);
|
||||||
|
|
||||||
url_prefix = (InitializationURL
|
return (InitializationURL && InitializationURL->sourceURL)
|
||||||
&& InitializationURL->sourceURL) ? InitializationURL->sourceURL : stream->
|
? g_strdup (InitializationURL->sourceURL)
|
||||||
baseURL;
|
: get_base_url_with_query (stream);
|
||||||
|
|
||||||
return g_strdup (url_prefix);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* gst_mpdparser_get_mediaURL:
|
* gst_mpdparser_get_mediaURL:
|
||||||
*
|
*
|
||||||
* Returns: (transfer full): stream mediaURL if available,
|
* Returns: (transfer full): stream mediaURL if available,
|
||||||
* baseURL otherwise.
|
* baseURL combined with queryURL otherwise.
|
||||||
*/
|
*/
|
||||||
gchar *
|
gchar *
|
||||||
gst_mpdparser_get_mediaURL (GstActiveStream * stream,
|
gst_mpdparser_get_mediaURL (GstActiveStream * stream,
|
||||||
GstMPDSegmentURLNode * segmentURL)
|
GstMPDSegmentURLNode * segmentURL)
|
||||||
{
|
{
|
||||||
const gchar *url_prefix;
|
|
||||||
|
|
||||||
g_return_val_if_fail (stream != NULL, NULL);
|
g_return_val_if_fail (stream != NULL, NULL);
|
||||||
g_return_val_if_fail (segmentURL != NULL, NULL);
|
g_return_val_if_fail (segmentURL != NULL, NULL);
|
||||||
|
|
||||||
url_prefix = segmentURL->media ? segmentURL->media : stream->baseURL;
|
return (segmentURL->media)
|
||||||
g_return_val_if_fail (url_prefix != NULL, NULL);
|
? g_strdup (segmentURL->media)
|
||||||
|
: get_base_url_with_query (stream);
|
||||||
return g_strdup (url_prefix);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* navigation functions */
|
/* navigation functions */
|
||||||
|
|
Loading…
Reference in a new issue