mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 19:51:11 +00:00
Add support for not incrementing bytecounter while we're not at the end of the stream
Original commit message from CVS: Add support for not incrementing bytecounter while we're not at the end of the stream
This commit is contained in:
parent
71921dd910
commit
f1015883d0
2 changed files with 8 additions and 4 deletions
|
@ -387,7 +387,9 @@ gst_filesink_chain (GstPad *pad, GstBuffer *buf)
|
||||||
|
|
||||||
if (GST_FLAG_IS_SET (filesink, GST_FILESINK_OPEN))
|
if (GST_FLAG_IS_SET (filesink, GST_FILESINK_OPEN))
|
||||||
{
|
{
|
||||||
guint bytes_written = 0;
|
guint bytes_written = 0, back_pending = 0;
|
||||||
|
if (ftell(filesink->file) < filesink->data_written)
|
||||||
|
back_pending = filesink->data_written - ftell(filesink->file);
|
||||||
do {
|
do {
|
||||||
size_t wrote = fwrite (GST_BUFFER_DATA (buf) + bytes_written, 1,
|
size_t wrote = fwrite (GST_BUFFER_DATA (buf) + bytes_written, 1,
|
||||||
GST_BUFFER_SIZE (buf) - bytes_written,
|
GST_BUFFER_SIZE (buf) - bytes_written,
|
||||||
|
@ -402,7 +404,7 @@ gst_filesink_chain (GstPad *pad, GstBuffer *buf)
|
||||||
bytes_written += wrote;
|
bytes_written += wrote;
|
||||||
} while (bytes_written < GST_BUFFER_SIZE (buf));
|
} while (bytes_written < GST_BUFFER_SIZE (buf));
|
||||||
|
|
||||||
filesink->data_written += bytes_written;
|
filesink->data_written += bytes_written - back_pending;
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_buffer_unref (buf);
|
gst_buffer_unref (buf);
|
||||||
|
|
|
@ -387,7 +387,9 @@ gst_filesink_chain (GstPad *pad, GstBuffer *buf)
|
||||||
|
|
||||||
if (GST_FLAG_IS_SET (filesink, GST_FILESINK_OPEN))
|
if (GST_FLAG_IS_SET (filesink, GST_FILESINK_OPEN))
|
||||||
{
|
{
|
||||||
guint bytes_written = 0;
|
guint bytes_written = 0, back_pending = 0;
|
||||||
|
if (ftell(filesink->file) < filesink->data_written)
|
||||||
|
back_pending = filesink->data_written - ftell(filesink->file);
|
||||||
do {
|
do {
|
||||||
size_t wrote = fwrite (GST_BUFFER_DATA (buf) + bytes_written, 1,
|
size_t wrote = fwrite (GST_BUFFER_DATA (buf) + bytes_written, 1,
|
||||||
GST_BUFFER_SIZE (buf) - bytes_written,
|
GST_BUFFER_SIZE (buf) - bytes_written,
|
||||||
|
@ -402,7 +404,7 @@ gst_filesink_chain (GstPad *pad, GstBuffer *buf)
|
||||||
bytes_written += wrote;
|
bytes_written += wrote;
|
||||||
} while (bytes_written < GST_BUFFER_SIZE (buf));
|
} while (bytes_written < GST_BUFFER_SIZE (buf));
|
||||||
|
|
||||||
filesink->data_written += bytes_written;
|
filesink->data_written += bytes_written - back_pending;
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_buffer_unref (buf);
|
gst_buffer_unref (buf);
|
||||||
|
|
Loading…
Reference in a new issue