X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=subprojects%2Fgst-plugins-bad%2Fext%2Fdash%2Fgstmpdclient.c;h=1bf92d49fb0e6cb3248e1d775aa08f7e39698963;hb=9fecc618c16a4ed99834d0202046b3e741613878;hp=fdaaa659c8cf45f8f0a3524d3f5ec657e1adf27c;hpb=a7f54159b724d4966686c84a1f93688ef157e3f2;p=platform%2Fupstream%2Fgstreamer.git diff --git a/subprojects/gst-plugins-bad/ext/dash/gstmpdclient.c b/subprojects/gst-plugins-bad/ext/dash/gstmpdclient.c index fdaaa65..1bf92d4 100644 --- a/subprojects/gst-plugins-bad/ext/dash/gstmpdclient.c +++ b/subprojects/gst-plugins-bad/ext/dash/gstmpdclient.c @@ -79,7 +79,7 @@ gst_mpd_client_get_adaptation_set_with_id (GList * adaptation_sets, guint id) return NULL; } -static GstMPDNode * +GstMPDRepresentationNode * gst_mpd_client_get_representation_with_id (GList * representations, gchar * rep_id) { @@ -89,11 +89,24 @@ gst_mpd_client_get_representation_with_id (GList * representations, for (list = g_list_first (representations); list; list = g_list_next (list)) { representation = (GstMPDRepresentationNode *) list->data; if (!g_strcmp0 (representation->id, rep_id)) - return GST_MPD_NODE (representation); + return GST_MPD_REPRESENTATION_NODE (representation); } return NULL; } +static GstMPDNode * +gst_mpd_client_get_representation_with_id_filter (GList * representations, + gchar * rep_id) +{ + GstMPDRepresentationNode *representation = + gst_mpd_client_get_representation_with_id (representations, rep_id); + + if (representation != NULL) + return GST_MPD_NODE (representation); + + return NULL; +} + static gchar * _generate_new_string_id (GList * list, const gchar * tuple, MpdClientStringIDFilter filter) @@ -248,10 +261,16 @@ gst_mpd_client_fetch_external_segment_list (GstMPDClient * client, uri_string = gst_uri_to_string (uri); gst_uri_unref (base_uri); gst_uri_unref (uri); - +#ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION + download = + gst_uri_downloader_fetch_uri (client->downloader, + uri_string, client->mpd_uri, NULL, NULL, DEFAULT_ADAPTIVE_RETRY, + DEFAULT_ADAPTIVE_TIMEOUT, TRUE, FALSE, TRUE, &err); +#else download = gst_uri_downloader_fetch_uri (client->downloader, uri_string, client->mpd_uri, TRUE, FALSE, TRUE, &err); +#endif g_free (uri_string); if (!download) { @@ -1164,9 +1183,16 @@ gst_mpd_client_fetch_external_periods (GstMPDClient * client, gst_uri_unref (base_uri); gst_uri_unref (uri); +#ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION + download = + gst_uri_downloader_fetch_uri (client->downloader, + uri_string, client->mpd_uri, NULL, NULL, DEFAULT_ADAPTIVE_RETRY, + DEFAULT_ADAPTIVE_TIMEOUT, TRUE, FALSE, TRUE, &err); +#else download = gst_uri_downloader_fetch_uri (client->downloader, uri_string, client->mpd_uri, TRUE, FALSE, TRUE, &err); +#endif g_free (uri_string); if (!download) { @@ -1499,9 +1525,16 @@ gst_mpd_client_fetch_external_adaptation_set (GstMPDClient * client, gst_uri_unref (base_uri); gst_uri_unref (uri); +#ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION + download = + gst_uri_downloader_fetch_uri (client->downloader, + uri_string, client->mpd_uri, NULL, NULL, DEFAULT_ADAPTIVE_RETRY, + DEFAULT_ADAPTIVE_TIMEOUT, TRUE, FALSE, TRUE, &err); +#else download = gst_uri_downloader_fetch_uri (client->downloader, uri_string, client->mpd_uri, TRUE, FALSE, TRUE, &err); +#endif g_free (uri_string); if (!download) { @@ -1692,7 +1725,10 @@ gst_mpd_client_stream_seek (GstMPDClient * client, GstActiveStream * stream, GstClockTime chunk_time; selectedChunk = segment; - repeat_index = (ts - segment->start) / segment->duration; + repeat_index = + ((ts - segment->start) + + ((GstMediaSegment *) stream->segments->pdata[0])->start) / + segment->duration; chunk_time = segment->start + segment->duration * repeat_index; @@ -1752,7 +1788,7 @@ gst_mpd_client_stream_seek (GstMPDClient * client, GstActiveStream * stream, g_return_val_if_fail (GST_MPD_MULT_SEGMENT_BASE_NODE (stream->cur_seg_template)->SegmentTimeline == NULL, FALSE); - if (!GST_CLOCK_TIME_IS_VALID (duration)) { + if (!GST_CLOCK_TIME_IS_VALID (duration) || duration == 0) { return FALSE; } @@ -2025,9 +2061,7 @@ gst_mpd_client_get_next_fragment (GstMPDClient * client, GST_DEBUG ("currentChunk->SegmentURL = %p", currentChunk->SegmentURL); if (currentChunk->SegmentURL != NULL) { - mediaURL = - g_strdup (gst_mpdparser_get_mediaURL (stream, - currentChunk->SegmentURL)); + mediaURL = gst_mpdparser_get_mediaURL (stream, currentChunk->SegmentURL); indexURL = g_strdup (currentChunk->SegmentURL->index); } else if (stream->cur_seg_template != NULL) { mediaURL = @@ -2299,9 +2333,8 @@ gst_mpd_client_get_next_header (GstMPDClient * client, gchar ** uri, *uri = NULL; if (stream->cur_segment_base) { if (stream->cur_segment_base->Initialization) { - *uri = - g_strdup (gst_mpdparser_get_initializationURL (stream, - stream->cur_segment_base->Initialization)); + *uri = gst_mpdparser_get_initializationURL (stream, + stream->cur_segment_base->Initialization); if (stream->cur_segment_base->Initialization->range) { *range_start = stream->cur_segment_base->Initialization->range->first_byte_pos; @@ -2309,9 +2342,8 @@ gst_mpd_client_get_next_header (GstMPDClient * client, gchar ** uri, stream->cur_segment_base->Initialization->range->last_byte_pos; } } else if (stream->cur_segment_base->indexRange) { - *uri = - g_strdup (gst_mpdparser_get_initializationURL (stream, - stream->cur_segment_base->Initialization)); + *uri = gst_mpdparser_get_initializationURL (stream, + stream->cur_segment_base->Initialization); *range_start = 0; *range_end = stream->cur_segment_base->indexRange->first_byte_pos - 1; } @@ -2346,9 +2378,8 @@ gst_mpd_client_get_next_header_index (GstMPDClient * client, gchar ** uri, GST_DEBUG ("Looking for current representation index"); *uri = NULL; if (stream->cur_segment_base && stream->cur_segment_base->indexRange) { - *uri = - g_strdup (gst_mpdparser_get_initializationURL (stream, - stream->cur_segment_base->RepresentationIndex)); + *uri = gst_mpdparser_get_initializationURL (stream, + stream->cur_segment_base->RepresentationIndex); *range_start = stream->cur_segment_base->indexRange->first_byte_pos; *range_end = stream->cur_segment_base->indexRange->last_byte_pos; } else if (stream->cur_seg_template && stream->cur_seg_template->index) { @@ -3243,8 +3274,8 @@ gst_mpd_client_set_representation_node (GstMPDClient * client, (period_node->AdaptationSets, adaptation_set_id)); g_return_val_if_fail (adap_set_node != NULL, NULL); rep_node = - GST_MPD_REPRESENTATION_NODE (gst_mpd_client_get_representation_with_id - (adap_set_node->Representations, representation_id)); + gst_mpd_client_get_representation_with_id (adap_set_node->Representations, + representation_id); if (!rep_node) { rep_node = gst_mpd_representation_node_new (); if (representation_id) @@ -3252,7 +3283,8 @@ gst_mpd_client_set_representation_node (GstMPDClient * client, else rep_node->id = _generate_new_string_id (adap_set_node->Representations, - "representation_%.2d", gst_mpd_client_get_representation_with_id); + "representation_%.2d", + gst_mpd_client_get_representation_with_id_filter); GST_DEBUG_OBJECT (client, "Add a new representation with id %s", rep_node->id); adap_set_node->Representations = @@ -3289,8 +3321,8 @@ gst_mpd_client_set_segment_list (GstMPDClient * client, g_return_val_if_fail (adaptation_set != NULL, FALSE); representation = - GST_MPD_REPRESENTATION_NODE (gst_mpd_client_get_representation_with_id - (adaptation_set->Representations, rep_id)); + gst_mpd_client_get_representation_with_id + (adaptation_set->Representations, rep_id); if (!representation->SegmentList) { representation->SegmentList = gst_mpd_segment_list_node_new (); } @@ -3326,8 +3358,8 @@ gst_mpd_client_set_segment_template (GstMPDClient * client, g_return_val_if_fail (adaptation_set != NULL, FALSE); representation = - GST_MPD_REPRESENTATION_NODE (gst_mpd_client_get_representation_with_id - (adaptation_set->Representations, rep_id)); + gst_mpd_client_get_representation_with_id + (adaptation_set->Representations, rep_id); if (!representation->SegmentTemplate) { representation->SegmentTemplate = gst_mpd_segment_template_node_new (); } @@ -3365,8 +3397,8 @@ gst_mpd_client_add_segment_url (GstMPDClient * client, g_return_val_if_fail (adaptation_set != NULL, FALSE); representation = - GST_MPD_REPRESENTATION_NODE (gst_mpd_client_get_representation_with_id - (adaptation_set->Representations, rep_id)); + gst_mpd_client_get_representation_with_id + (adaptation_set->Representations, rep_id); if (!representation->SegmentList) { representation->SegmentList = gst_mpd_segment_list_node_new ();