Commit graph

28 commits

Author SHA1 Message Date
Sebastian Dröge
dcb2be3282 filesink: Add a new full buffer mode to filesink
Previously the default and full modes were the same. Now the default
mode is like before: it accumulates all buffers in a buffer list until
the threshold is reached and then writes them all out, potentially in
multiple writes.

The new full mode works by always copying memory to a single memory area
and writing everything out with a single write once the threshold is
reached.
2020-03-26 11:31:03 +00:00
Sebastian Dröge
eec9bd8db3 filesink: Implement workaround for some (network) filesystems that spuriously return EACCES on write
This seems to happen when another client is accessing the file at the
same time, and retrying after a short amount of time solves it.

Sometimes partial data is written at that point already but we have no
idea how much it is, or if what was written is correct (it sometimes
isn't) so we always first seek back to the current position and repeat
the whole failed write.

It happens at least on Linux and macOS on SMB/CIFS and NFS file systems.

Between write attempts that failed with EACCES we wait 10ms, and after
enough consecutive tries that failed with EACCES we simply time out.

In theory a valid EACCES for files to which we simply have no access
should've happened already during the call to open(), except for NFS
(see open(2)).

This can be enabled with the new max-transient-error-timeout property, and
a new o-sync boolean property was added to open the file in O_SYNC mode
as without that it's not guaranteed that we get EACCES for the actual
writev() call that failed but might only get it at a later time.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/305
2019-05-16 14:15:02 +03:00
Sebastian Dröge
6b4fc62b7b filesink: Implement buffering internally
We use writev() so every call ends up going to the kernel but for small
buffers we generally would prefer to do as few write calls as possible.

https://bugzilla.gnome.org/show_bug.cgi?id=794173
2018-08-16 17:01:07 +03:00
Sebastian Dröge
e975e0cae8 filesink: Remove buffer, deprecate line-buffer mode and don't use fflush()
fflush() has no effect because we use writev() directly, so fsync()
should be used instead which is actually flushing the kernel-side
buffers.

As a next step, a non-line-buffered buffering mode is to be added.

https://bugzilla.gnome.org/show_bug.cgi?id=794173
2018-08-14 13:56:08 +03:00
Reynaldo H. Verdejo Pinochet
c0d2c1e793 filesink: indentation fixes 2015-12-09 14:15:26 -08:00
Nicolas Dufresne
25fa87a9e4 doc/filesink: Add BufferMode enumeration
This is purely for documentation purpose. This way the values will
show up in the HTML documentation.
2015-07-28 16:57:36 -04:00
Tim-Philipp Müller
5a4fb5c314 filesink: implement ::render_list() function that uses writev() 2014-11-30 14:40:46 +00:00
Tim-Philipp Müller
666c8c11c6 Fix FSF address
https://bugzilla.gnome.org/show_bug.cgi?id=687520
2012-11-03 20:44:48 +00:00
Tim-Philipp Müller
14632db174 plugins: sprinkle some more G_GNUC_INTERNAL 2012-07-14 20:05:53 +01:00
Stefan Kost
cfb4aa4627 build: sprintf, sscanf need stdio.h 2009-10-07 10:59:54 +03:00
Laurent Glayal
abafed991e filesink: Add property to allow to append to an already existing file
Fixes bug #591441.
2009-08-18 08:45:08 +02:00
Laurent Glayal
2f22776f23 configure.ac: Check for stdio_ext.h for the filesink changes.
Original commit message from CVS:
Based on Patch by: Laurent Glayal <spglegle at yahoo dot fr>
* configure.ac:
Check for stdio_ext.h for the filesink changes.
* plugins/elements/gstfilesink.c: (buffer_mode_get_type),
(gst_file_sink_class_init), (gst_file_sink_init),
(gst_file_sink_dispose), (gst_file_sink_set_property),
(gst_file_sink_get_property), (gst_file_sink_open_file),
(gst_file_sink_close_file):
* plugins/elements/gstfilesink.h:
Add two properties to control the buffering mode and size.
API: GstFileSink::buffer-mode
API: GstFileSink::buffer-size
2007-12-24 19:11:29 +00:00
Mark Nauwelaerts
8eaf66d000 plugins/elements/gstfilesink.*: Fix position reporting; rename data_written member to current_pos to reflect its real...
Original commit message from CVS:
Patch by: Mark Nauwelaerts <manauw at skynet be>
* plugins/elements/gstfilesink.c: (gst_file_sink_open_file),
(gst_file_sink_query), (gst_file_sink_do_seek),
(gst_file_sink_get_current_offset), (gst_file_sink_render):
* plugins/elements/gstfilesink.h:
Fix position reporting; rename data_written member to current_pos to
reflect its real meaning (fixes #412648).
2007-05-22 11:43:07 +00:00
Wim Taymans
766bc10bc2 plugins/elements/gstfilesink.*: Check if we can seek in the file instead of assuming we always can. Post an error whe...
Original commit message from CVS:
* plugins/elements/gstfilesink.c: (gst_file_sink_open_file),
(gst_file_sink_close_file), (gst_file_sink_do_seek),
(gst_file_sink_event), (gst_file_sink_render):
* plugins/elements/gstfilesink.h:
Check if we can seek in the file instead of assuming
we always can. Post an error when we are asked to seek in a
non-seekable file (like a fifo). Fixes #343312.
Some cleanups.
2006-06-16 16:28:37 +00:00
Stefan Kost
86b5887cd7 gst/gsttagsetter.h: Can't cast ifaces to a class
Original commit message from CVS:
* gst/gsttagsetter.h:
Can't cast ifaces to a class
* libs/gst/net/gstnetclientclock.h:
* libs/gst/net/gstnettimeprovider.h:
* plugins/elements/gstfakesink.h:
* plugins/elements/gstfakesrc.h:
* plugins/elements/gstfdsink.h:
* plugins/elements/gstfdsrc.h:
* plugins/elements/gstfilesink.h:
* plugins/elements/gstfilesrc.h:
* plugins/elements/gstidentity.h:
* plugins/elements/gstqueue.h:
* plugins/elements/gsttee.h:
* plugins/indexers/gstfileindex.c:
* plugins/indexers/gstmemindex.c:
* tests/old/examples/plugins/example.h:
Fix more gobject macros: obj<->klass, GstXXX<->GstXXXClass
2006-06-01 18:22:14 +00:00
Wim Taymans
a9f7f7b7b6 Doc fixes.
Original commit message from CVS:
Doc fixes.
2005-11-24 09:44:07 +00:00
Thomas Vander Stichele
259dec97fd more autistic cleanliness in functions/names/defines
Original commit message from CVS:
more autistic cleanliness in functions/names/defines
2005-07-14 09:35:12 +00:00
Wim Taymans
113250d274 gst/: Added object to help in making collect pad based elements.
Original commit message from CVS:
* gst/base/Makefile.am:
* gst/base/gstbasesink.h:
* gst/base/gstbasesrc.c: (gst_basesrc_init),
(gst_basesrc_set_dataflow_funcs), (gst_basesrc_query):
* gst/base/gstcollectpads.c: (gst_collectpads_get_type),
(gst_collectpads_class_init), (gst_collectpads_init),
(gst_collectpads_finalize), (gst_collectpads_new),
(gst_collectpads_set_function), (gst_collectpads_add_pad),
(find_pad), (gst_collectpads_remove_pad),
(gst_collectpads_is_active), (gst_collectpads_collect),
(gst_collectpads_collect_range), (gst_collectpads_start),
(gst_collectpads_stop), (gst_collectpads_peek),
(gst_collectpads_pop), (gst_collectpads_available),
(gst_collectpads_read), (gst_collectpads_flush),
(gst_collectpads_chain):
* gst/base/gstcollectpads.h:
* gst/elements/Makefile.am:
* gst/elements/gstelements.c:
* gst/elements/gstfakesink.c: (gst_fakesink_class_init),
(gst_fakesink_get_times), (gst_fakesink_event),
(gst_fakesink_preroll), (gst_fakesink_render):
* gst/elements/gstfilesink.c: (gst_filesink_class_init),
(gst_filesink_init), (gst_filesink_set_location),
(gst_filesink_open_file), (gst_filesink_close_file),
(gst_filesink_pad_query), (gst_filesink_event),
(gst_filesink_render), (gst_filesink_change_state):
* gst/elements/gstfilesink.h:
Added object to help in making collect pad based elements.
Ported filesink.
Make event function in sink baseclass return gboolean.
2005-05-05 09:31:59 +00:00
Johan Dahlin
ecd88e381d Revert again, this time without post-commit reindent hooks to put back the indentation :-)
Original commit message from CVS:
Revert again, this time without post-commit reindent hooks
to put back the indentation :-)
2004-03-15 14:43:35 +00:00
Johan Dahlin
e2b3dc3e47 *.h: Revert indentation changes.
Original commit message from CVS:
* *.h: Revert indentation changes.
2004-03-15 14:31:41 +00:00
Thomas Vander Stichele
a967370df5 gst-indent run on core
Original commit message from CVS:
gst-indent run on core
2004-03-13 15:27:01 +00:00
Benjamin Otte
25f85868d4 implement URI schemes
Original commit message from CVS:
implement URI schemes
Elements can now register as a source or sink for a protocol and applications can use gst_element_make_from_uri () to get an element that handles a given URI.
This patch provides:
- removal of old broken URI handling scheme.
- new URI handling using interfaces.
- updates for registry to save handled URIs.
- interface for URI handlers.
- implementation of that in filesrc and filesink for the file:// URI
- extension to pipeline parsing to allow specifying only a URI instead of element

Does not include:
- tests
- inclusion in docs build
2003-11-24 03:21:54 +00:00
Benjamin Otte
907e3e97d9 update plugin initialization restructuring (see email for details
Original commit message from CVS:
update plugin initialization restructuring (see email for details
2003-10-31 19:32:47 +00:00
Benjamin Otte
803ce6bf48 GST_DEBUG reorganization containing loads of stuff:
Original commit message from CVS:
GST_DEBUG reorganization
This is a big diff (ca 450k), containing loads of stuff:
- gstinfo.[ch] complete rewrite
- changing of all GST_DEBUG messages to reflect that change
- reorganization of subsystem disabling
- addition of gstconfig.h.in so we can track the disablings
- <gst/gst.h> does not include <unistd.h> and <config.h> anymore
- documentation updated for gstinfo stuff (build the docs yourself to know what changed)
- bugfixes for making of the docs (files from CVS are not deleted anymore
- testsuite for debugging changes in testsuite/debug

expect breakage
2003-06-29 14:05:49 +00:00
Ronald S. Bultje
2ddc5c4974 I don't know how I ever got to introducing this madness, but I was wrong. *REALLY* wrong. It hasn't even worked, it s...
Original commit message from CVS:
I don't know how I ever got to introducing this madness, but I was wrong. *REALLY* wrong. It hasn't even worked, it still doesn't work and it will never work because the whole concept of doing a multifile output in filesink is completely braindead. Signal EOS, close file, set new filename and reset to PLAYING is so much easier. This patch removes all the multifile output cruft that I introduced and makes filesink simply work.
2003-06-01 12:27:39 +00:00
Thomas Vander Stichele
bdea7633cd a bunch of gtk-doc fixes
Original commit message from CVS:
a bunch of gtk-doc fixes
2003-05-18 15:03:34 +00:00
David I. Lehn
31efa36756 use G_{BEGIN,END}_DECLS
Original commit message from CVS:
use G_{BEGIN,END}_DECLS
2002-10-30 09:17:34 +00:00
Thomas Vander Stichele
651f3262ab rename operation
Original commit message from CVS:
rename operation
2002-04-28 17:08:59 +00:00