mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-04 22:48:54 +00:00
dashdemux: new API to load the stream Period with a given index
this avoids to fiddle with stream internals in the code
This commit is contained in:
parent
9d43e33319
commit
e7fad847bb
3 changed files with 15 additions and 15 deletions
|
@ -527,10 +527,9 @@ gst_dash_demux_src_event (GstPad * pad, GstEvent * event)
|
|||
}
|
||||
if (current_period != demux->client->period_idx) {
|
||||
GST_DEBUG_OBJECT (demux, "Seeking to Period %d", current_period);
|
||||
/* FIXME: we should'nt fiddle with client internals like that */
|
||||
demux->client->period_idx = current_period;
|
||||
/* setup video, audio and subtitle streams */
|
||||
if (!gst_dash_demux_setup_all_streams (demux))
|
||||
/* setup video, audio and subtitle streams, starting from the new Period */
|
||||
if (!gst_mpd_client_get_period_by_index (demux->client, current_period) ||
|
||||
!gst_dash_demux_setup_all_streams (demux))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -707,11 +706,12 @@ gst_dash_demux_sink_event (GstPad * pad, GstEvent * event)
|
|||
("Incompatible manifest file."), (NULL));
|
||||
return FALSE;
|
||||
}
|
||||
/* start from first Period */
|
||||
demux->client->period_idx = 0;
|
||||
/* setup video, audio and subtitle streams */
|
||||
if (!gst_dash_demux_setup_all_streams (demux))
|
||||
|
||||
/* setup video, audio and subtitle streams, starting from first Period */
|
||||
if (!gst_mpd_client_get_period_by_index (demux->client, 0) ||
|
||||
!gst_dash_demux_setup_all_streams (demux))
|
||||
return FALSE;
|
||||
|
||||
/* Send duration message */
|
||||
if (!gst_mpd_client_is_live (demux->client)) {
|
||||
GstClockTime duration =
|
||||
|
@ -1196,9 +1196,9 @@ gst_dash_demux_download_loop (GstDashDemux * demux)
|
|||
while (!gst_dash_demux_get_next_fragment_set (demux)) {
|
||||
if (demux->end_of_period) {
|
||||
GST_INFO_OBJECT (demux, "Reached the end of the Period");
|
||||
/* load the next Period in the Media Presentation */
|
||||
if (!gst_mpd_client_get_next_period (demux->client)
|
||||
|| !gst_dash_demux_setup_all_streams (demux)) {
|
||||
/* 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) ||
|
||||
!gst_dash_demux_setup_all_streams (demux)) {
|
||||
GST_INFO_OBJECT (demux, "Reached the end of the manifest file");
|
||||
demux->end_of_manifest = TRUE;
|
||||
if (GST_STATE (demux) != GST_STATE_PLAYING) {
|
||||
|
|
|
@ -3054,18 +3054,18 @@ gst_mpd_client_get_media_presentation_duration (GstMpdClient * client)
|
|||
}
|
||||
|
||||
gboolean
|
||||
gst_mpd_client_get_next_period (GstMpdClient *client)
|
||||
gst_mpd_client_get_period_by_index (GstMpdClient *client, guint period_idx)
|
||||
{
|
||||
GstStreamPeriod *next_stream_period;
|
||||
|
||||
g_return_val_if_fail (client != NULL, FALSE);
|
||||
g_return_val_if_fail (client->periods != NULL, FALSE);
|
||||
|
||||
next_stream_period = g_list_nth_data (client->periods, client->period_idx + 1);
|
||||
next_stream_period = g_list_nth_data (client->periods, period_idx);
|
||||
if (next_stream_period == NULL)
|
||||
return FALSE;
|
||||
|
||||
client->period_idx++;
|
||||
client->period_idx = period_idx;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -475,7 +475,7 @@ gboolean gst_mpd_client_get_next_header (GstMpdClient *client, const gchar **uri
|
|||
gboolean gst_mpd_client_is_live (GstMpdClient * client);
|
||||
|
||||
/* Period selection */
|
||||
gboolean gst_mpd_client_get_next_period (GstMpdClient *client);
|
||||
gboolean gst_mpd_client_get_period_by_index (GstMpdClient *client, guint period_idx);
|
||||
|
||||
/* Representation selection */
|
||||
gint gst_mpdparser_get_rep_idx_with_max_bandwidth (GList *Representations, gint max_bandwidth);
|
||||
|
|
Loading…
Reference in a new issue