From: Gianluca Gennari Date: Mon, 17 Dec 2012 14:00:52 +0000 (+0100) Subject: dashdemux: new API to load the stream Period with a given index X-Git-Tag: 1.19.3~507^2~13600 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e7fad847bb8b17e20e5632b5036c41499f0a0916;p=platform%2Fupstream%2Fgstreamer.git dashdemux: new API to load the stream Period with a given index this avoids to fiddle with stream internals in the code --- diff --git a/ext/dash/gstdashdemux.c b/ext/dash/gstdashdemux.c index a0ff293..4cb99ec 100644 --- a/ext/dash/gstdashdemux.c +++ b/ext/dash/gstdashdemux.c @@ -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) { diff --git a/ext/dash/gstmpdparser.c b/ext/dash/gstmpdparser.c index 73950f9..f4c436c 100644 --- a/ext/dash/gstmpdparser.c +++ b/ext/dash/gstmpdparser.c @@ -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; } diff --git a/ext/dash/gstmpdparser.h b/ext/dash/gstmpdparser.h index 8254c87..dccae1c 100644 --- a/ext/dash/gstmpdparser.h +++ b/ext/dash/gstmpdparser.h @@ -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);