1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-10 06:10:52 +02:00

fifo: K&R formatting cosmetics

This commit is contained in:
Luca Barbato
2013-07-06 12:05:27 +02:00
parent 4e7f0b082d
commit 73142e7533

View File

@@ -59,7 +59,8 @@ int av_fifo_space(AVFifoBuffer *f)
return f->end - f->buffer - av_fifo_size(f); return f->end - f->buffer - av_fifo_size(f);
} }
int av_fifo_realloc2(AVFifoBuffer *f, unsigned int new_size) { int av_fifo_realloc2(AVFifoBuffer *f, unsigned int new_size)
{
unsigned int old_size = f->end - f->buffer; unsigned int old_size = f->end - f->buffer;
if (old_size < new_size) { if (old_size < new_size) {
@@ -78,8 +79,10 @@ int av_fifo_realloc2(AVFifoBuffer *f, unsigned int new_size) {
return 0; return 0;
} }
// src must NOT be const as it can be a context for func that may need updating (like a pointer or byte counter) /* src must NOT be const as it can be a context for func that may need
int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int (*func)(void*, void*, int)) * updating (like a pointer or byte counter) */
int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size,
int (*func)(void *, void *, int))
{ {
int total = size; int total = size;
do { do {
@@ -101,13 +104,14 @@ int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int (*func)(void
return total - size; return total - size;
} }
int av_fifo_generic_read(AVFifoBuffer *f, void *dest, int buf_size,
int av_fifo_generic_read(AVFifoBuffer *f, void *dest, int buf_size, void (*func)(void*, void*, int)) void (*func)(void *, void *, int))
{ {
// Read memory barrier needed for SMP here in theory // Read memory barrier needed for SMP here in theory
do { do {
int len = FFMIN(f->end - f->rptr, buf_size); int len = FFMIN(f->end - f->rptr, buf_size);
if(func) func(dest, f->rptr, len); if (func)
func(dest, f->rptr, len);
else { else {
memcpy(dest, f->rptr, len); memcpy(dest, f->rptr, len);
dest = (uint8_t *)dest + len; dest = (uint8_t *)dest + len;