Unified · Split
| @@ -153,7 +153,7 @@ · 152 unmodified lines | |||
| 153 | */ | 153 | */ |
| 154 | 154 | ||
| 155 | #define LIBAVUTIL_VERSION_MAJOR 51 | 155 | #define LIBAVUTIL_VERSION_MAJOR 51 |
| 156 | #define LIBAVUTIL_VERSION_MINOR 51 | 156 | #define LIBAVUTIL_VERSION_MINOR 52 |
| 157 | #define LIBAVUTIL_VERSION_MICRO 100 | 157 | #define LIBAVUTIL_VERSION_MICRO 100 |
| 158 | 158 | ||
| 159 | #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ | 159 | #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ |
| @@ -79,6 +79,19 @@ int av_fifo_realloc2(AVFifoBuffer *f, unsigned int new_size) · 78 unmodified lines | |||
| 79 | return 0; | 79 | return 0; |
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | int av_fifo_grow(AVFifoBuffer *f, unsigned int size) | ||
| 83 | { | ||
| 84 | unsigned int old_size = f->end - f->buffer; | ||
| 85 | if(size + (unsigned)av_fifo_size(f) < size) | ||
| 86 | return AVERROR(EINVAL); | ||
| 87 | |||
| 88 | size += av_fifo_size(f); | ||
| 89 | |||
| 90 | if (old_size < size) | ||
| 91 | return av_fifo_realloc2(f, FFMAX(size, 2*size)); | ||
| 92 | return 0; | ||
| 93 | } | ||
| 94 | |||
| 82 | // src must NOT be const as it can be a context for func that may need updating (like a pointer or byte counter) | 95 | // src must NOT be const as it can be a context for func that may need updating (like a pointer or byte counter) |
| 83 | int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int (*func)(void*, void*, int)) | 96 | int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int (*func)(void*, void*, int)) |
| 84 | { | 97 | { |
| @@ -102,6 +102,17 @@ int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int (*func)(void · 101 unmodified lines | |||
| 102 | */ | 102 | */ |
| 103 | int av_fifo_realloc2(AVFifoBuffer *f, unsigned int size); | 103 | int av_fifo_realloc2(AVFifoBuffer *f, unsigned int size); |
| 104 | 104 | ||
| 105 | /** | ||
| 106 | * Enlarge an AVFifoBuffer. | ||
| 107 | * In case of reallocation failure, the old FIFO is kept unchanged. | ||
| 108 | * The new fifo size may be larger than the requested size. | ||
| 109 | * | ||
| 110 | * @param f AVFifoBuffer to resize | ||
| 111 | * @param additional_space the amount of space in bytes to allocate in addition to av_fifo_size() | ||
| 112 | * @return <0 for failure, >=0 otherwise | ||
| 113 | */ | ||
| 114 | int av_fifo_grow(AVFifoBuffer *f, unsigned int additional_space); | ||
| 115 | |||
| 105 | /** | 116 | /** |
| 106 | * Read and discard the specified amount of data from an AVFifoBuffer. | 117 | * Read and discard the specified amount of data from an AVFifoBuffer. |
| 107 | * @param f AVFifoBuffer to read from | 118 | * @param f AVFifoBuffer to read from |