mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-10 10:04:23 +00:00
hlssink: write the playlist end marker on EOS
Catch EOS from the multifilesink and add the endlist marker to the playlist when it happens https://bugzilla.gnome.org/show_bug.cgi?id=747319
This commit is contained in:
parent
7fb02dc918
commit
75c9a5f129
1 changed files with 26 additions and 12 deletions
|
@ -252,6 +252,25 @@ missing_element:
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_hls_sink_write_playlist (GstHlsSink * sink)
|
||||
{
|
||||
char *playlist_content;
|
||||
GError *error = NULL;
|
||||
|
||||
playlist_content = gst_m3u8_playlist_render (sink->playlist);
|
||||
if (!g_file_set_contents (sink->playlist_location,
|
||||
playlist_content, -1, &error)) {
|
||||
GST_ERROR ("Failed to write playlist: %s", error->message);
|
||||
GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE,
|
||||
(("Failed to write playlist '%s'."), error->message), (NULL));
|
||||
g_error_free (error);
|
||||
error = NULL;
|
||||
}
|
||||
g_free (playlist_content);
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
gst_hls_sink_handle_message (GstBin * bin, GstMessage * message)
|
||||
{
|
||||
|
@ -261,10 +280,8 @@ gst_hls_sink_handle_message (GstBin * bin, GstMessage * message)
|
|||
case GST_MESSAGE_ELEMENT:
|
||||
{
|
||||
const char *filename;
|
||||
char *playlist_content;
|
||||
GstClockTime running_time, duration;
|
||||
gboolean discont = FALSE;
|
||||
GError *error = NULL;
|
||||
gchar *entry_location;
|
||||
const GstStructure *structure;
|
||||
|
||||
|
@ -289,16 +306,8 @@ gst_hls_sink_handle_message (GstBin * bin, GstMessage * message)
|
|||
gst_m3u8_playlist_add_entry (sink->playlist, entry_location,
|
||||
NULL, duration, sink->index, discont);
|
||||
g_free (entry_location);
|
||||
playlist_content = gst_m3u8_playlist_render (sink->playlist);
|
||||
if (!g_file_set_contents (sink->playlist_location,
|
||||
playlist_content, -1, &error)) {
|
||||
GST_ERROR ("Failed to write playlist: %s", error->message);
|
||||
GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE,
|
||||
(("Failed to write playlist '%s'."), error->message), (NULL));
|
||||
g_error_free (error);
|
||||
error = NULL;
|
||||
}
|
||||
g_free (playlist_content);
|
||||
|
||||
gst_hls_sink_write_playlist (sink);
|
||||
|
||||
/* multifilesink is starting a new file. It means that upstream sent a key
|
||||
* unit and we can schedule the next key unit now.
|
||||
|
@ -313,6 +322,11 @@ gst_hls_sink_handle_message (GstBin * bin, GstMessage * message)
|
|||
message = NULL;
|
||||
break;
|
||||
}
|
||||
case GST_MESSAGE_EOS:{
|
||||
sink->playlist->end_list = TRUE;
|
||||
gst_hls_sink_write_playlist (sink);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue