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
@ -527,10 +527,9 @@ gst_dash_demux_src_event (GstPad * pad, GstEvent * event)
|
|||||||
}
|
}
|
||||||
if (current_period != demux->client->period_idx) {
|
if (current_period != demux->client->period_idx) {
|
||||||
GST_DEBUG_OBJECT (demux, "Seeking to Period %d", current_period);
|
GST_DEBUG_OBJECT (demux, "Seeking to Period %d", current_period);
|
||||||
/* FIXME: we should'nt fiddle with client internals like that */
|
/* setup video, audio and subtitle streams, starting from the new Period */
|
||||||
demux->client->period_idx = current_period;
|
if (!gst_mpd_client_get_period_by_index (demux->client, current_period) ||
|
||||||
/* setup video, audio and subtitle streams */
|
!gst_dash_demux_setup_all_streams (demux))
|
||||||
if (!gst_dash_demux_setup_all_streams (demux))
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -707,11 +706,12 @@ gst_dash_demux_sink_event (GstPad * pad, GstEvent * event)
|
|||||||
("Incompatible manifest file."), (NULL));
|
("Incompatible manifest file."), (NULL));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
/* start from first Period */
|
|
||||||
demux->client->period_idx = 0;
|
/* setup video, audio and subtitle streams, starting from first Period */
|
||||||
/* setup video, audio and subtitle streams */
|
if (!gst_mpd_client_get_period_by_index (demux->client, 0) ||
|
||||||
if (!gst_dash_demux_setup_all_streams (demux))
|
!gst_dash_demux_setup_all_streams (demux))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* Send duration message */
|
/* Send duration message */
|
||||||
if (!gst_mpd_client_is_live (demux->client)) {
|
if (!gst_mpd_client_is_live (demux->client)) {
|
||||||
GstClockTime duration =
|
GstClockTime duration =
|
||||||
@ -1196,9 +1196,9 @@ gst_dash_demux_download_loop (GstDashDemux * demux)
|
|||||||
while (!gst_dash_demux_get_next_fragment_set (demux)) {
|
while (!gst_dash_demux_get_next_fragment_set (demux)) {
|
||||||
if (demux->end_of_period) {
|
if (demux->end_of_period) {
|
||||||
GST_INFO_OBJECT (demux, "Reached the end of the Period");
|
GST_INFO_OBJECT (demux, "Reached the end of the Period");
|
||||||
/* load the next Period in the Media Presentation */
|
/* setup video, audio and subtitle streams, starting from the next Period */
|
||||||
if (!gst_mpd_client_get_next_period (demux->client)
|
if (!gst_mpd_client_get_period_by_index (demux->client, demux->client->period_idx + 1) ||
|
||||||
|| !gst_dash_demux_setup_all_streams (demux)) {
|
!gst_dash_demux_setup_all_streams (demux)) {
|
||||||
GST_INFO_OBJECT (demux, "Reached the end of the manifest file");
|
GST_INFO_OBJECT (demux, "Reached the end of the manifest file");
|
||||||
demux->end_of_manifest = TRUE;
|
demux->end_of_manifest = TRUE;
|
||||||
if (GST_STATE (demux) != GST_STATE_PLAYING) {
|
if (GST_STATE (demux) != GST_STATE_PLAYING) {
|
||||||
|
@ -3054,18 +3054,18 @@ gst_mpd_client_get_media_presentation_duration (GstMpdClient * client)
|
|||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
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;
|
GstStreamPeriod *next_stream_period;
|
||||||
|
|
||||||
g_return_val_if_fail (client != NULL, FALSE);
|
g_return_val_if_fail (client != NULL, FALSE);
|
||||||
g_return_val_if_fail (client->periods != 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)
|
if (next_stream_period == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
client->period_idx++;
|
client->period_idx = period_idx;
|
||||||
|
|
||||||
return TRUE;
|
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);
|
gboolean gst_mpd_client_is_live (GstMpdClient * client);
|
||||||
|
|
||||||
/* Period selection */
|
/* 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 */
|
/* Representation selection */
|
||||||
gint gst_mpdparser_get_rep_idx_with_max_bandwidth (GList *Representations, gint max_bandwidth);
|
gint gst_mpdparser_get_rep_idx_with_max_bandwidth (GList *Representations, gint max_bandwidth);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user