dashdemux: remove unused functions

These functions of directly getting and setting segment indexes
are no longer useful as now we need 2 indexes: repeat and segment
index.

The only operations needed are advance_segment, going back to the
first one or seeking for a timestamp.
This commit is contained in:
Thiago Santos 2015-05-08 16:58:36 -03:00
parent d617139ee7
commit f298fca8ad
2 changed files with 10 additions and 53 deletions

View file

@ -3453,6 +3453,7 @@ gst_mpd_client_stream_seek (GstMpdClient * client, GstActiveStream * stream,
GstClockTime ts) GstClockTime ts)
{ {
gint index = 0; gint index = 0;
gint repeat_index = 0;
GstMediaSegment *selectedChunk = NULL; GstMediaSegment *selectedChunk = NULL;
g_return_val_if_fail (stream != NULL, 0); g_return_val_if_fail (stream != NULL, 0);
@ -3465,7 +3466,7 @@ gst_mpd_client_stream_seek (GstMpdClient * client, GstActiveStream * stream,
if (segment->start <= ts if (segment->start <= ts
&& ts < segment->start + (segment->repeat + 1) * segment->duration) { && ts < segment->start + (segment->repeat + 1) * segment->duration) {
selectedChunk = segment; selectedChunk = segment;
index = segment->number + (ts - segment->start) / segment->duration; repeat_index = (ts - segment->start) / segment->duration;
break; break;
} }
} }
@ -3484,7 +3485,8 @@ gst_mpd_client_stream_seek (GstMpdClient * client, GstActiveStream * stream,
index = ts / duration; index = ts / duration;
} }
gst_mpd_client_set_segment_index (stream, index); stream->segment_repeat_index = repeat_index;
stream->segment_index = index;
return TRUE; return TRUE;
} }
@ -3566,17 +3568,14 @@ gst_mpd_client_get_next_fragment_timestamp (GstMpdClient * client,
guint stream_idx, GstClockTime * ts) guint stream_idx, GstClockTime * ts)
{ {
GstActiveStream *stream; GstActiveStream *stream;
gint segment_idx;
GstMediaSegment *currentChunk; GstMediaSegment *currentChunk;
GST_DEBUG ("Stream index: %i", stream_idx); GST_DEBUG ("Stream index: %i", stream_idx);
stream = g_list_nth_data (client->active_streams, stream_idx); stream = g_list_nth_data (client->active_streams, stream_idx);
g_return_val_if_fail (stream != NULL, 0); g_return_val_if_fail (stream != NULL, 0);
segment_idx = gst_mpd_client_get_segment_index (stream); GST_DEBUG ("Looking for fragment sequence chunk %d", stream->segment_index);
GST_DEBUG ("Looking for fragment sequence chunk %d", segment_idx); currentChunk = g_ptr_array_index (stream->segments, stream->segment_index);
currentChunk = g_ptr_array_index (stream->segments, segment_idx);
*ts = *ts =
currentChunk->start + currentChunk->start +
@ -3608,7 +3607,6 @@ gst_mpd_client_get_next_fragment (GstMpdClient * client,
gchar *mediaURL = NULL; gchar *mediaURL = NULL;
gchar *indexURL = NULL; gchar *indexURL = NULL;
GstUri *base_url, *frag_url; GstUri *base_url, *frag_url;
guint segment_idx;
/* select stream */ /* select stream */
g_return_val_if_fail (client != NULL, FALSE); g_return_val_if_fail (client != NULL, FALSE);
@ -3617,10 +3615,8 @@ gst_mpd_client_get_next_fragment (GstMpdClient * client,
g_return_val_if_fail (stream != NULL, FALSE); g_return_val_if_fail (stream != NULL, FALSE);
g_return_val_if_fail (stream->cur_representation != NULL, FALSE); g_return_val_if_fail (stream->cur_representation != NULL, FALSE);
segment_idx = gst_mpd_client_get_segment_index (stream); GST_DEBUG ("Looking for fragment sequence chunk %d", stream->segment_index);
GST_DEBUG ("Looking for fragment sequence chunk %d", segment_idx); currentChunk = g_ptr_array_index (stream->segments, stream->segment_index);
currentChunk = g_ptr_array_index (stream->segments, segment_idx);
GST_DEBUG ("currentChunk->SegmentURL = %p", currentChunk->SegmentURL); GST_DEBUG ("currentChunk->SegmentURL = %p", currentChunk->SegmentURL);
if (currentChunk->SegmentURL != NULL) { if (currentChunk->SegmentURL != NULL) {
@ -3851,7 +3847,7 @@ gst_mpd_client_get_next_fragment_duration (GstMpdClient * client,
g_return_val_if_fail (stream != NULL, 0); g_return_val_if_fail (stream != NULL, 0);
seg_idx = gst_mpd_client_get_segment_index (stream); seg_idx = stream->segment_index;
if (stream->segments) { if (stream->segments) {
if (seg_idx < stream->segments->len) if (seg_idx < stream->segments->len)
@ -3982,42 +3978,6 @@ gst_mpd_client_has_next_period (GstMpdClient * client)
return next_stream_period != NULL; return next_stream_period != NULL;
} }
void
gst_mpd_client_set_segment_index_for_all_streams (GstMpdClient * client,
guint segment_idx)
{
GList *list;
g_return_if_fail (client != NULL);
g_return_if_fail (client->active_streams != NULL);
for (list = g_list_first (client->active_streams); list;
list = g_list_next (list)) {
GstActiveStream *stream = (GstActiveStream *) list->data;
if (stream) {
stream->segment_index = segment_idx;
stream->segment_repeat_index = 0;
}
}
}
void
gst_mpd_client_set_segment_index (GstActiveStream * stream, guint segment_idx)
{
g_return_if_fail (stream != NULL);
stream->segment_index = segment_idx;
stream->segment_repeat_index = 0;
}
guint
gst_mpd_client_get_segment_index (GstActiveStream * stream)
{
g_return_val_if_fail (stream != NULL, 0);
return stream->segment_index;
}
void void
gst_mpd_client_seek_to_first_segment (GstMpdClient * client) gst_mpd_client_seek_to_first_segment (GstMpdClient * client)
{ {
@ -4246,7 +4206,7 @@ gst_mpd_client_get_next_segment_availability_end_time (GstMpdClient * client,
stream_period = gst_mpdparser_get_stream_period (client); stream_period = gst_mpdparser_get_stream_period (client);
seg_idx = gst_mpd_client_get_segment_index (stream); seg_idx = stream->segment_index;
seg_duration = gst_mpd_client_get_segment_duration (client, stream, NULL); seg_duration = gst_mpd_client_get_segment_duration (client, stream, NULL);
if (seg_duration == 0) if (seg_duration == 0)
return NULL; return NULL;

View file

@ -534,9 +534,6 @@ GstActiveStream *gst_mpdparser_get_active_stream_by_index (GstMpdClient *client,
guint gst_mpdparser_get_nb_adaptationSet (GstMpdClient *client); guint gst_mpdparser_get_nb_adaptationSet (GstMpdClient *client);
/* Segment */ /* Segment */
void gst_mpd_client_set_segment_index_for_all_streams (GstMpdClient * client, guint segment_idx);
guint gst_mpd_client_get_segment_index (GstActiveStream * stream);
void gst_mpd_client_set_segment_index (GstActiveStream * stream, guint segment_idx);
GstFlowReturn gst_mpd_client_advance_segment (GstMpdClient * client, GstActiveStream * stream, gboolean forward); GstFlowReturn gst_mpd_client_advance_segment (GstMpdClient * client, GstActiveStream * stream, gboolean forward);
void gst_mpd_client_seek_to_first_segment (GstMpdClient * client); void gst_mpd_client_seek_to_first_segment (GstMpdClient * client);