"Filedescriptor Sink",
"Sink/File",
"Write data to a file descriptor", "Erik Walthinsen <omega@cse.ogi.edu>");
- gst_element_class_add_pad_template (gstelement_class,
- gst_static_pad_template_get (&sinktemplate));
+ gst_element_class_add_static_pad_template (gstelement_class, &sinktemplate);
gstbasesink_class->render = GST_DEBUG_FUNCPTR (gst_fd_sink_render);
gstbasesink_class->render_list = GST_DEBUG_FUNCPTR (gst_fd_sink_render_list);
gst_fd_sink_render_buffers (GstFdSink * sink, GstBuffer ** buffers,
guint num_buffers, guint8 * mem_nums, guint total_mems)
{
- return gst_writev_buffers (GST_OBJECT_CAST (sink), sink->fd, sink->fdset,
- buffers, num_buffers, mem_nums, total_mems, &sink->bytes_written,
- &sink->current_pos);
+ GstFlowReturn ret;
+ guint64 skip = 0;
+
+ for (;;) {
+ guint64 bytes_written = 0;
+
+ ret = gst_writev_buffers (GST_OBJECT_CAST (sink), sink->fd, sink->fdset,
+ buffers, num_buffers, mem_nums, total_mems, &bytes_written, skip);
+
+ sink->bytes_written += bytes_written;
+ sink->current_pos += bytes_written;
+ skip += bytes_written;
+
+ if (!sink->unlock)
+ break;
+
+ ret = gst_base_sink_wait_preroll (GST_BASE_SINK (sink));
+ if (ret != GST_FLOW_OK)
+ return ret;
+ }
+
+ return ret;
}
static GstFlowReturn
GST_LOG_OBJECT (fdsink, "Flushing");
GST_OBJECT_LOCK (fdsink);
+ fdsink->unlock = TRUE;
gst_poll_set_flushing (fdsink->fdset, TRUE);
GST_OBJECT_UNLOCK (fdsink);
GST_LOG_OBJECT (fdsink, "No longer flushing");
GST_OBJECT_LOCK (fdsink);
+ fdsink->unlock = FALSE;
gst_poll_set_flushing (fdsink->fdset, FALSE);
GST_OBJECT_UNLOCK (fdsink);