GST_WARNING_OBJECT (demux, "Could not find seeked Period");
return FALSE;
}
- if (current_period != demux->client->period_idx) {
+ if (current_period != gst_mpd_client_get_period_index (demux->client)) {
GST_DEBUG_OBJECT (demux, "Seeking to Period %d", current_period);
/* setup video, audio and subtitle streams, starting from the new Period */
- if (!gst_mpd_client_get_period_by_index (demux->client, current_period) ||
+ if (!gst_mpd_client_set_period_index (demux->client, current_period) ||
!gst_dash_demux_setup_all_streams (demux))
return FALSE;
}
stream =
gst_mpdparser_get_active_stream_by_index (demux->client,
stream_idx);
- /* FIXME: we should'nt fiddle with stream internals like that */
- stream->segment_idx = current_sequence;
+ gst_mpd_client_set_segment_index (stream, current_sequence);
}
/* Calculate offset in the next fragment */
demux->position = gst_mpd_client_get_current_position (demux->client);
}
/* setup video, audio and subtitle streams, starting from first Period */
- if (!gst_mpd_client_get_period_by_index (demux->client, 0) ||
+ if (!gst_mpd_client_set_period_index (demux->client, 0) ||
!gst_dash_demux_setup_all_streams (demux))
return FALSE;
if (demux->end_of_period) {
GST_INFO_OBJECT (demux, "Reached the end of the Period");
/* setup video, audio and subtitle streams, starting from the next Period */
- if (!gst_mpd_client_get_period_by_index (demux->client, demux->client->period_idx + 1) ||
+ if (!gst_mpd_client_set_period_index (demux->client, gst_mpd_client_get_period_index (demux->client) + 1) ||
!gst_dash_demux_setup_all_streams (demux)) {
GST_INFO_OBJECT (demux, "Reached the end of the manifest file");
demux->end_of_manifest = TRUE;
gst_mpdparser_get_active_stream_by_index (demux->client, stream_idx);
if (stream == NULL)
return FALSE;
- /* FIXME: we should'nt fiddle with stream internals like that */
- download->index = stream->segment_idx - 1;
+
+ download->index = gst_mpd_client_get_segment_index (stream) - 1;
GstCaps *caps = gst_dash_demux_get_input_caps (demux, stream);
g_return_val_if_fail (client != NULL, NULL);
g_return_val_if_fail (client->periods != NULL, NULL);
- return g_list_nth_data (client->periods, client->period_idx);
+ return g_list_nth_data (client->periods, gst_mpd_client_get_period_index (client));
}
/* select a stream and extract the baseURL (if present) */
stream->baseURL_idx = 0;
stream->mimeType = mimeType;
stream->representation_idx = 0;
- stream->segment_idx = 0;
stream->cur_adapt_set = adapt_set;
+ gst_mpd_client_set_segment_index (stream, 0);
/* retrive representation list */
if (stream->cur_adapt_set != NULL)
GstActiveStream *stream = NULL;
GstMediaSegment *currentChunk;
gchar *mediaURL = NULL;
+ guint segment_idx;
/* select stream */
g_return_val_if_fail (client != NULL, FALSE);
g_return_val_if_fail (discontinuity != NULL, FALSE);
GST_MPD_CLIENT_LOCK (client);
- GST_DEBUG ("Looking for fragment sequence chunk %d", stream->segment_idx);
+ segment_idx = gst_mpd_client_get_segment_index (stream);
+ GST_DEBUG ("Looking for fragment sequence chunk %d", segment_idx);
- currentChunk = gst_mpdparser_get_chunk_by_index (client, indexStream, stream->segment_idx);
+ currentChunk = gst_mpdparser_get_chunk_by_index (client, indexStream, segment_idx);
if (currentChunk == NULL) {
GST_MPD_CLIENT_UNLOCK (client);
return FALSE;
*timestamp = currentChunk->start_time;
*duration = currentChunk->duration;
- *discontinuity = stream->segment_idx != currentChunk->number;
+ *discontinuity = segment_idx != currentChunk->number;
if (mediaURL == NULL) {
/* single segment with URL encoded in the baseURL syntax element */
*uri = g_strdup (gst_mpdparser_get_baseURL (client));
} else {
*uri = mediaURL;
}
- stream->segment_idx += 1;
+ gst_mpd_client_set_segment_index (stream, segment_idx + 1);
GST_MPD_CLIENT_UNLOCK (client);
GST_DEBUG ("Loading chunk with URL %s", *uri);
stream = g_list_nth_data (client->active_streams, client->stream_idx);
g_return_val_if_fail (stream != NULL, GST_CLOCK_TIME_NONE);
- media_segment = g_list_nth_data (stream->segments, stream->segment_idx);
+ media_segment = g_list_nth_data (stream->segments, gst_mpd_client_get_segment_index (stream));
g_return_val_if_fail (media_segment != NULL, GST_CLOCK_TIME_NONE);
return media_segment->start_time;
stream = g_list_nth_data (client->active_streams, client->stream_idx);
g_return_val_if_fail (stream != NULL, 0);
- media_segment = g_list_nth_data (stream->segments, stream->segment_idx);
+ media_segment = g_list_nth_data (stream->segments, gst_mpd_client_get_segment_index (stream));
return media_segment == NULL ? 0 : media_segment->duration;
}
}
gboolean
-gst_mpd_client_get_period_by_index (GstMpdClient *client, guint period_idx)
+gst_mpd_client_set_period_index (GstMpdClient *client, guint period_idx)
{
GstStreamPeriod *next_stream_period;
return TRUE;
}
+guint
+gst_mpd_client_get_period_index (GstMpdClient *client)
+{
+ return client->period_idx;
+}
+
+void
+gst_mpd_client_set_segment_index (GstActiveStream * stream, guint segment_idx)
+{
+ stream->segment_idx = segment_idx;
+}
+
+guint
+gst_mpd_client_get_segment_index (GstActiveStream * stream)
+{
+ return stream->segment_idx;
+}
+
gboolean
gst_mpd_client_is_live (GstMpdClient * client)
{
gboolean gst_mpd_client_is_live (GstMpdClient * client);
/* Period selection */
-gboolean gst_mpd_client_get_period_by_index (GstMpdClient *client, guint period_idx);
+gboolean gst_mpd_client_set_period_index (GstMpdClient *client, guint period_idx);
+guint gst_mpd_client_get_period_index (GstMpdClient *client);
/* Representation selection */
gint gst_mpdparser_get_rep_idx_with_max_bandwidth (GList *Representations, gint max_bandwidth);
/* AdaptationSet */
guint gst_mpdparser_get_nb_adaptationSet (GstMpdClient *client);
+/* Segment */
+void gst_mpd_client_set_segment_index (GstActiveStream * stream, guint segment_idx);
+guint gst_mpd_client_get_segment_index (GstActiveStream * stream);
+
/* Get audio/video stream parameters (mimeType, width, height, rate, number of channels) */
const gchar *gst_mpd_client_get_stream_mimeType (GstActiveStream * stream);
guint gst_mpd_client_get_video_stream_width (GstActiveStream * stream);