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
@ -252,6 +252,25 @@ missing_element:
|
|||||||
return FALSE;
|
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
|
static void
|
||||||
gst_hls_sink_handle_message (GstBin * bin, GstMessage * message)
|
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:
|
case GST_MESSAGE_ELEMENT:
|
||||||
{
|
{
|
||||||
const char *filename;
|
const char *filename;
|
||||||
char *playlist_content;
|
|
||||||
GstClockTime running_time, duration;
|
GstClockTime running_time, duration;
|
||||||
gboolean discont = FALSE;
|
gboolean discont = FALSE;
|
||||||
GError *error = NULL;
|
|
||||||
gchar *entry_location;
|
gchar *entry_location;
|
||||||
const GstStructure *structure;
|
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,
|
gst_m3u8_playlist_add_entry (sink->playlist, entry_location,
|
||||||
NULL, duration, sink->index, discont);
|
NULL, duration, sink->index, discont);
|
||||||
g_free (entry_location);
|
g_free (entry_location);
|
||||||
playlist_content = gst_m3u8_playlist_render (sink->playlist);
|
|
||||||
if (!g_file_set_contents (sink->playlist_location,
|
gst_hls_sink_write_playlist (sink);
|
||||||
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);
|
|
||||||
|
|
||||||
/* multifilesink is starting a new file. It means that upstream sent a key
|
/* multifilesink is starting a new file. It means that upstream sent a key
|
||||||
* unit and we can schedule the next key unit now.
|
* 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;
|
message = NULL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case GST_MESSAGE_EOS:{
|
||||||
|
sink->playlist->end_list = TRUE;
|
||||||
|
gst_hls_sink_write_playlist (sink);
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user