OLD | NEW |
1 /* | 1 /* |
2 * This file is part of FFmpeg. | 2 * This file is part of FFmpeg. |
3 * | 3 * |
4 * FFmpeg is free software; you can redistribute it and/or | 4 * FFmpeg is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Lesser General Public | 5 * modify it under the terms of the GNU Lesser General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2.1 of the License, or (at your option) any later version. | 7 * version 2.1 of the License, or (at your option) any later version. |
8 * | 8 * |
9 * FFmpeg is distributed in the hope that it will be useful, | 9 * FFmpeg is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 * @param *f AVFifoBuffer to read from | 74 * @param *f AVFifoBuffer to read from |
75 * @param buf_size number of bytes to read | 75 * @param buf_size number of bytes to read |
76 * @param *func generic read function | 76 * @param *func generic read function |
77 * @param *dest data destination | 77 * @param *dest data destination |
78 */ | 78 */ |
79 int av_fifo_generic_read(AVFifoBuffer *f, void *dest, int buf_size, void (*func)
(void*, void*, int)); | 79 int av_fifo_generic_read(AVFifoBuffer *f, void *dest, int buf_size, void (*func)
(void*, void*, int)); |
80 | 80 |
81 /** | 81 /** |
82 * Feeds data from a user-supplied callback to an AVFifoBuffer. | 82 * Feeds data from a user-supplied callback to an AVFifoBuffer. |
83 * @param *f AVFifoBuffer to write to | 83 * @param *f AVFifoBuffer to write to |
84 * @param *src data source | 84 * @param *src data source; non-const since it may be used as a |
| 85 * modifiable context by the function defined in func |
85 * @param size number of bytes to write | 86 * @param size number of bytes to write |
86 * @param *func generic write function; the first parameter is src, | 87 * @param *func generic write function; the first parameter is src, |
87 * the second is dest_buf, the third is dest_buf_size. | 88 * the second is dest_buf, the third is dest_buf_size. |
88 * func must return the number of bytes written to dest_buf, or <= 0 to | 89 * func must return the number of bytes written to dest_buf, or <= 0 to |
89 * indicate no more data available to write. | 90 * indicate no more data available to write. |
90 * If func is NULL, src is interpreted as a simple byte array for source data. | 91 * If func is NULL, src is interpreted as a simple byte array for source data. |
91 * @return the number of bytes written to the FIFO | 92 * @return the number of bytes written to the FIFO |
92 */ | 93 */ |
93 int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int (*func)(void
*, void*, int)); | 94 int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int (*func)(void
*, void*, int)); |
94 | 95 |
(...skipping 13 matching lines...) Expand all Loading... |
108 void av_fifo_drain(AVFifoBuffer *f, int size); | 109 void av_fifo_drain(AVFifoBuffer *f, int size); |
109 | 110 |
110 static inline uint8_t av_fifo_peek(AVFifoBuffer *f, int offs) | 111 static inline uint8_t av_fifo_peek(AVFifoBuffer *f, int offs) |
111 { | 112 { |
112 uint8_t *ptr = f->rptr + offs; | 113 uint8_t *ptr = f->rptr + offs; |
113 if (ptr >= f->end) | 114 if (ptr >= f->end) |
114 ptr -= f->end - f->buffer; | 115 ptr -= f->end - f->buffer; |
115 return *ptr; | 116 return *ptr; |
116 } | 117 } |
117 #endif /* AVUTIL_FIFO_H */ | 118 #endif /* AVUTIL_FIFO_H */ |
OLD | NEW |