Revision 765d4f3b

View differences:

libavutil/fifo.c
50 50
 */
51 51
int av_fifo_read(AVFifoBuffer *f, uint8_t *buf, int buf_size)
52 52
{
53
    int size = av_fifo_size(f);
54

  
55
    if (size < buf_size)
56
        return -1;
57
    while (buf_size > 0) {
58
        int len = FFMIN(f->end - f->rptr, buf_size);
59
        memcpy(buf, f->rptr, len);
60
        buf += len;
61
        f->rptr += len;
62
        if (f->rptr >= f->end)
63
            f->rptr = f->buffer;
64
        buf_size -= len;
65
    }
66
    return 0;
53
    return av_fifo_generic_read(f, buf_size, NULL, buf);
67 54
}
68 55

  
69 56
/**
......
111 98
        return -1;
112 99
    while (buf_size > 0) {
113 100
        int len = FFMIN(f->end - f->rptr, buf_size);
114
        func(dest, f->rptr, len);
101
        if(func) func(dest, f->rptr, len);
102
        else{
103
            memcpy(dest, f->rptr, len);
104
            dest = (uint8_t*)dest + len;
105
        }
115 106
        f->rptr += len;
116 107
        if (f->rptr >= f->end)
117 108
            f->rptr = f->buffer;

Also available in: Unified diff