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:
Ronald S. Bultje 2003-07-22 21:33:02 +00:00
parent 71921dd910
commit f1015883d0
2 changed files with 8 additions and 4 deletions

View file

@ -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);

View file

@ -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);