mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-30 12:10:37 +00:00
hlsdemux2: Add gst_hls_demux_stream_set_playlist_uri
Add a method that configures the new playlist URI for a stream. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883>
This commit is contained in:
parent
2c822735ba
commit
d5edd48f13
3 changed files with 32 additions and 6 deletions
|
@ -1294,11 +1294,6 @@ download_media_playlist (GstHLSDemuxStream * stream, gchar * orig_uri,
|
|||
const gchar *main_uri = gst_adaptive_demux_get_manifest_ref_uri (demux);
|
||||
struct PlaylistDownloadParams dl_params;
|
||||
|
||||
/* FIXME: Set this URI when the variant is changed */
|
||||
if (stream->playlistloader)
|
||||
gst_hls_demux_playlist_loader_set_playlist_uri (stream->playlistloader,
|
||||
main_uri, orig_uri);
|
||||
|
||||
retry:
|
||||
|
||||
memset (&dl_params, 0, sizeof (struct PlaylistDownloadParams));
|
||||
|
@ -1527,6 +1522,23 @@ gst_hls_demux_stream_submit_request (GstAdaptiveDemux2Stream * stream,
|
|||
(stream, download_req);
|
||||
}
|
||||
|
||||
void
|
||||
gst_hls_demux_stream_set_playlist_uri (GstHLSDemuxStream * hls_stream,
|
||||
gchar * uri)
|
||||
{
|
||||
GstAdaptiveDemux *demux = GST_ADAPTIVE_DEMUX2_STREAM_CAST (hls_stream)->demux;
|
||||
|
||||
if (hls_stream->playlistloader == NULL) {
|
||||
hls_stream->playlistloader =
|
||||
gst_hls_demux_playlist_loader_new (demux, demux->download_helper,
|
||||
hls_stream->llhls_enabled);
|
||||
}
|
||||
|
||||
const gchar *main_uri = gst_adaptive_demux_get_manifest_ref_uri (demux);
|
||||
gst_hls_demux_playlist_loader_set_playlist_uri (hls_stream->playlistloader,
|
||||
main_uri, uri);
|
||||
}
|
||||
|
||||
GstFlowReturn
|
||||
gst_hls_demux_stream_update_media_playlist (GstHLSDemuxStream * stream,
|
||||
gchar ** uri, GError ** err)
|
||||
|
@ -2114,6 +2126,9 @@ gst_hls_demux_update_rendition_stream (GstHLSDemux * hlsdemux,
|
|||
}
|
||||
hls_stream->pending_rendition =
|
||||
gst_hls_rendition_stream_ref (replacement_media);
|
||||
|
||||
gst_hls_demux_stream_set_playlist_uri (hls_stream, replacement_media->uri);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -166,6 +166,9 @@ GstFlowReturn
|
|||
gst_hls_demux_stream_seek (GstAdaptiveDemux2Stream * stream, gboolean forward,
|
||||
GstSeekFlags flags, GstClockTimeDiff ts, GstClockTimeDiff * final_ts);
|
||||
|
||||
void
|
||||
gst_hls_demux_stream_set_playlist_uri (GstHLSDemuxStream * stream, gchar * uri);
|
||||
|
||||
GstFlowReturn
|
||||
gst_hls_demux_stream_update_media_playlist (GstHLSDemuxStream * stream, gchar ** uri, GError ** err);
|
||||
|
||||
|
|
|
@ -426,6 +426,10 @@ create_main_variant_stream (GstHLSDemux * demux)
|
|||
|
||||
stream = create_common_hls_stream (demux, "hlsstream-variant");
|
||||
demux->main_stream = hlsdemux_stream = (GstHLSDemuxStream *) stream;
|
||||
|
||||
gst_hls_demux_stream_set_playlist_uri (hlsdemux_stream,
|
||||
demux->current_variant->uri);
|
||||
|
||||
hlsdemux_stream->is_variant = TRUE;
|
||||
hlsdemux_stream->playlist_fetched = TRUE;
|
||||
/* Due to HLS manifest information being so unreliable/inconsistent, we will
|
||||
|
@ -626,6 +630,10 @@ gst_hls_demux_set_current_variant (GstHLSDemux * hlsdemux,
|
|||
GST_DEBUG_OBJECT (hlsdemux, "Setting variant '%s'", variant->name);
|
||||
hlsdemux->current_variant = gst_hls_variant_stream_ref (variant);
|
||||
}
|
||||
|
||||
if (hlsdemux->main_stream) {
|
||||
gst_hls_demux_stream_set_playlist_uri (hlsdemux->main_stream, variant->uri);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -684,7 +692,7 @@ gst_hls_demux_process_manifest (GstAdaptiveDemux * demux, GstBuffer * buf)
|
|||
if (variant) {
|
||||
GST_INFO_OBJECT (hlsdemux,
|
||||
"Manifest processed, initial variant selected : `%s`", variant->name);
|
||||
gst_hls_demux_set_current_variant (hlsdemux, variant); // FIXME: inline?
|
||||
gst_hls_demux_set_current_variant (hlsdemux, variant);
|
||||
}
|
||||
|
||||
GST_DEBUG_OBJECT (hlsdemux, "Manifest handled, now setting up streams");
|
||||
|
|
Loading…
Reference in a new issue