| 231 | } |
| 232 | |
| 233 | int av_buffer_replace(AVBufferRef **pdst, const AVBufferRef *src) |
| 234 | { |
| 235 | AVBufferRef *dst = *pdst; |
| 236 | AVBufferRef *tmp; |
| 237 | |
| 238 | if (!src) { |
| 239 | av_buffer_unref(pdst); |
| 240 | return 0; |
| 241 | } |
| 242 | |
| 243 | if (dst && dst->buffer == src->buffer) { |
| 244 | /* make sure the data pointers match */ |
| 245 | dst->data = src->data; |
| 246 | dst->size = src->size; |
| 247 | return 0; |
| 248 | } |
| 249 | |
| 250 | tmp = av_buffer_ref(src); |
| 251 | if (!tmp) |
| 252 | return AVERROR(ENOMEM); |
| 253 | |
| 254 | av_buffer_unref(pdst); |
| 255 | *pdst = tmp; |
| 256 | return 0; |
| 257 | } |
| 258 | |
| 259 | AVBufferPool *av_buffer_pool_init2(size_t size, void *opaque, |
| 260 | AVBufferRef* (*alloc)(void *opaque, size_t size), |
no test coverage detected