diff options
author | Thiago Santos <thiagoss@osg.samsung.com> | 2015-03-30 11:14:09 -0300 |
---|---|---|
committer | Thiago Santos <thiagoss@osg.samsung.com> | 2015-04-04 07:58:44 -0300 |
commit | e00f0de4f3e863c993af3137e7f75e364e3f6ac6 (patch) | |
tree | 12ec0ddd3551b6d509f9f2902e22c6b117ff7935 /gst | |
parent | a33d2bf0920e07ad85b21f678f04e12e860cb382 (diff) |
multifilesink: post file message on EOS
When multifilesink is operating in any mode other than one file
per buffer, the last file created won't have a file message posted
as multifilesink doesn't handle the EOS event.
This patch fixes it by using the last position to post a file
message when EOS is received. This should ensure at least the
time related data and the filename are posted to the application
or other elements
https://bugzilla.gnome.org/show_bug.cgi?id=747000
Diffstat (limited to 'gst')
-rw-r--r-- | gst/multifile/gstmultifilesink.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/gst/multifile/gstmultifilesink.c b/gst/multifile/gstmultifilesink.c index 85d1cd3a6..c9fc2f55c 100644 --- a/gst/multifile/gstmultifilesink.c +++ b/gst/multifile/gstmultifilesink.c @@ -434,6 +434,30 @@ gst_multi_file_sink_post_message_full (GstMultiFileSink * multifilesink, gst_message_new_element (GST_OBJECT_CAST (multifilesink), s)); } +static void +gst_multi_file_sink_post_message_from_time (GstMultiFileSink * multifilesink, + GstClockTime timestamp, GstClockTime duration, const char *filename) +{ + GstClockTime running_time, stream_time; + guint64 offset, offset_end; + GstSegment *segment; + GstFormat format; + + if (!multifilesink->post_messages) + return; + + segment = &GST_BASE_SINK (multifilesink)->segment; + format = segment->format; + + offset = -1; + offset_end = -1; + + running_time = gst_segment_to_running_time (segment, format, timestamp); + stream_time = gst_segment_to_stream_time (segment, format, timestamp); + + gst_multi_file_sink_post_message_full (multifilesink, timestamp, duration, + offset, offset_end, running_time, stream_time, filename); +} static void gst_multi_file_sink_post_message (GstMultiFileSink * multifilesink, @@ -826,6 +850,19 @@ gst_multi_file_sink_event (GstBaseSink * sink, GstEvent * event) break; } + case GST_EVENT_EOS: + if (multifilesink->file) { + gchar *filename; + + filename = g_strdup_printf (multifilesink->filename, + multifilesink->index); + gst_multi_file_sink_post_message_from_time (multifilesink, + GST_BASE_SINK (multifilesink)->segment.position, -1, filename); + g_free (filename); + + gst_multi_file_sink_close_file (multifilesink, NULL); + } + break; default: break; } |