diff --git a/ext/dash/gstdashdemux.c b/ext/dash/gstdashdemux.c index 92fc0e5e83..ea6b8bbc4d 100644 --- a/ext/dash/gstdashdemux.c +++ b/ext/dash/gstdashdemux.c @@ -205,6 +205,8 @@ static GstFlowReturn gst_dash_demux_stream_update_fragment_info (GstAdaptiveDemuxStream * stream); static GstFlowReturn gst_dash_demux_stream_seek (GstAdaptiveDemuxStream * stream, GstClockTime ts); +static gboolean +gst_dash_demux_stream_has_next_fragment (GstAdaptiveDemuxStream * stream); static GstFlowReturn gst_dash_demux_stream_advance_fragment (GstAdaptiveDemuxStream * stream); static gboolean @@ -361,6 +363,8 @@ gst_dash_demux_class_init (GstDashDemuxClass * klass) gstadaptivedemux_class->has_next_period = gst_dash_demux_has_next_period; gstadaptivedemux_class->advance_period = gst_dash_demux_advance_period; + gstadaptivedemux_class->stream_has_next_fragment = + gst_dash_demux_stream_has_next_fragment; gstadaptivedemux_class->stream_advance_fragment = gst_dash_demux_stream_advance_fragment; gstadaptivedemux_class->stream_get_fragment_waiting_time = @@ -969,6 +973,16 @@ gst_dash_demux_stream_advance_subfragment (GstAdaptiveDemuxStream * stream) return !fragment_finished; } +static gboolean +gst_dash_demux_stream_has_next_fragment (GstAdaptiveDemuxStream * stream) +{ + GstDashDemux *dashdemux = GST_DASH_DEMUX_CAST (stream->demux); + GstDashDemuxStream *dashstream = (GstDashDemuxStream *) stream; + + return gst_mpd_client_has_next_segment (dashdemux->client, + dashstream->active_stream, stream->demux->segment.rate > 0.0); +} + static GstFlowReturn gst_dash_demux_stream_advance_fragment (GstAdaptiveDemuxStream * stream) { diff --git a/ext/dash/gstmpdparser.c b/ext/dash/gstmpdparser.c index 2aa8fe9703..edb53a10a1 100644 --- a/ext/dash/gstmpdparser.c +++ b/ext/dash/gstmpdparser.c @@ -3720,6 +3720,21 @@ gst_mpd_client_get_next_fragment (GstMpdClient * client, return TRUE; } +gboolean +gst_mpd_client_has_next_segment (GstMpdClient * client, + GstActiveStream * stream, gboolean forward) +{ + if (forward) { + if (stream->segment_index >= stream->segments->len) + return FALSE; + } else { + if (stream->segment_index < 0) + return FALSE; + } + + return TRUE; +} + GstFlowReturn gst_mpd_client_advance_segment (GstMpdClient * client, GstActiveStream * stream, gboolean forward) diff --git a/ext/dash/gstmpdparser.h b/ext/dash/gstmpdparser.h index f69740fb85..9f7f78b39c 100644 --- a/ext/dash/gstmpdparser.h +++ b/ext/dash/gstmpdparser.h @@ -534,6 +534,7 @@ GstActiveStream *gst_mpdparser_get_active_stream_by_index (GstMpdClient *client, guint gst_mpdparser_get_nb_adaptationSet (GstMpdClient *client); /* Segment */ +gboolean gst_mpd_client_has_next_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);