[FFmpeg-devel] [PATCH 1/2] file: operate in blocks, check for interrupts
Derek Buitenhuis
derek.buitenhuis at gmail.com
Wed Jul 10 21:19:54 CEST 2013
On 7/7/2013 1:56 PM, Andrey Utkin wrote:
> static int file_write(URLContext *h, const unsigned char *buf, int size)
> {
> FileContext *c = h->priv_data;
> - int r = write(c->fd, buf, size);
> - return (-1 == r)?AVERROR(errno):r;
> + int to_write = size;
> + int blocksize;
> + int r;
> + while (to_write) {
> + if (ff_check_interrupt(&h->interrupt_callback))
> + return AVERROR_EXIT;
> + blocksize = (c->blocksize < size) ? c->blocksize : size;
> + r = write(c->fd, buf, blocksize);
> + if (r == -1)
> + return AVERROR(errno);
> + if (r == 0)
> + return AVERROR_EOF;
> + to_write -= r;
> + }
> + return size;
> }
Not a tehcnical review, but, if you're going to send a patch to
someone else's codebase, please follow their coding conventions.
We use 4 spaces.
</diego>
- Derek
More information about the ffmpeg-devel
mailing list