summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5209cdd)
raw | patch | inline | side by side (parent: 5209cdd)
author | Tim-Philipp Müller <tim.muller@collabora.co.uk> | |
Sun, 25 Dec 2011 12:29:46 +0000 (12:29 +0000) | ||
committer | Tim-Philipp Müller <tim.muller@collabora.co.uk> | |
Sun, 25 Dec 2011 12:54:48 +0000 (12:54 +0000) |
Rename woffset variable, maintain separate bytes_read in addition
to length variable.
to length variable.
plugins/elements/gstfilesrc.c | patch | blob | history |
index d2b88c63293477dde93021cb92539f3e1966a4ce..9844f0d9c2ffd1a146edc3caa281657e39fbcd5b 100644 (file)
{
int ret;
GstBuffer *buf;
- guint64 woffset;
+ guint to_read, bytes_read;
if (G_UNLIKELY (src->read_position != offset)) {
off_t res;
GST_BUFFER_SIZE (buf) = 0;
GST_BUFFER_OFFSET (buf) = offset;
GST_BUFFER_OFFSET_END (buf) = offset;
- woffset = 0;
- while (length > 0) {
+ bytes_read = 0;
+ to_read = length;
+ while (to_read > 0) {
GST_LOG_OBJECT (src, "Reading %d bytes at offset 0x%" G_GINT64_MODIFIER "x",
- length, offset + woffset);
+ to_read, offset + bytes_read);
errno = 0;
- ret = read (src->fd, GST_BUFFER_DATA (buf) + woffset, length);
+ ret = read (src->fd, GST_BUFFER_DATA (buf) + bytes_read, to_read);
if (G_UNLIKELY (ret < 0)) {
if (errno == EAGAIN || errno == EINTR)
continue;
if (G_UNLIKELY (ret == 0))
goto eos;
- length -= ret;
- woffset += ret;
- GST_BUFFER_SIZE (buf) += ret;
- GST_BUFFER_OFFSET_END (buf) += ret;
+ to_read -= ret;
+ bytes_read += ret;
src->read_position += ret;
}
+ GST_BUFFER_SIZE (buf) = bytes_read;
+ GST_BUFFER_OFFSET_END (buf) = offset + bytes_read;
+
*buffer = buf;
return GST_FLOW_OK;