static gint convert_to_millisecs (gint decimals, gint pos);
static int strncmp_ext (const char *s1, const char *s2);
static gchar *gst_mpdparser_parse_baseURL (GstMpdClient * client);
+static gchar *gst_mpdparser_get_segmentURL_for_range (gchar *url, GstRange *range);
static gchar *gst_mpdparser_get_mediaURL (GstSegmentURLNode *segmentURL);
static gchar *gst_mpdparser_get_initializationURL (GstURLType *InitializationURL);
static gchar *gst_mpdparser_build_URL_from_template (const gchar *url_template, const gchar *id, guint number, guint bandwidth, guint time);
}
static gchar *
-gst_mpdparser_get_mediaURL (GstSegmentURLNode *segmentURL)
+gst_mpdparser_get_segmentURL_for_range (gchar *url, GstRange *range)
{
- gchar *mediaURL;
-
- g_return_val_if_fail (segmentURL != NULL, NULL);
- g_return_val_if_fail (segmentURL->media != NULL, NULL);
+ gchar *segmentURL;
- if (segmentURL->mediaRange) {
- gchar *range;
- range = g_strdup_printf ("?range=%llu-%llu", segmentURL->mediaRange->first_byte_pos, segmentURL->mediaRange->last_byte_pos);
- mediaURL = g_strconcat (segmentURL->media, range, NULL);
- g_free (range);
+ if (range) {
+ gchar *range_suffix;
+ range_suffix = g_strdup_printf ("?range=%llu-%llu", range->first_byte_pos, range->last_byte_pos);
+ segmentURL = g_strconcat (url, range_suffix, NULL);
+ g_free (range_suffix);
} else {
- mediaURL = g_strdup (segmentURL->media);
+ segmentURL = g_strdup (url);
}
- return mediaURL;
+ return segmentURL;
}
static gchar *
-gst_mpdparser_get_initializationURL (GstURLType *InitializationURL)
+gst_mpdparser_get_mediaURL (GstSegmentURLNode *segmentURL)
{
- gchar *mediaURL;
+ g_return_val_if_fail (segmentURL != NULL, NULL);
+ g_return_val_if_fail (segmentURL->media != NULL, NULL);
+ return gst_mpdparser_get_segmentURL_for_range(segmentURL->media, segmentURL->mediaRange);
+}
+
+static gchar *
+gst_mpdparser_get_initializationURL (GstURLType *InitializationURL)
+{
g_return_val_if_fail (InitializationURL != NULL, NULL);
g_return_val_if_fail (InitializationURL->sourceURL != NULL, NULL);
- if (InitializationURL->range) {
- gchar *range;
- range = g_strdup_printf ("?range=%llu-%llu", InitializationURL->range->first_byte_pos, InitializationURL->range->last_byte_pos);
- mediaURL = g_strconcat (InitializationURL->sourceURL, range, NULL);
- g_free (range);
- } else {
- mediaURL = g_strdup (InitializationURL->sourceURL);
- }
-
- return mediaURL;
+ return gst_mpdparser_get_segmentURL_for_range(InitializationURL->sourceURL, InitializationURL->range);
}
static gchar *