| 215 | } |
| 216 | |
| 217 | static int video_get_buffer(AVCodecContext *s, AVFrame *pic) |
| 218 | { |
| 219 | FramePool *pool = s->internal->pool; |
| 220 | int i; |
| 221 | |
| 222 | if (pic->data[0] || pic->data[1] || pic->data[2] || pic->data[3]) { |
| 223 | av_log(s, AV_LOG_ERROR, "pic->data[*]!=NULL in avcodec_default_get_buffer\n"); |
| 224 | return -1; |
| 225 | } |
| 226 | |
| 227 | memset(pic->data, 0, sizeof(pic->data)); |
| 228 | pic->extended_data = pic->data; |
| 229 | |
| 230 | for (i = 0; i < 4 && pool->pools[i]; i++) { |
| 231 | pic->linesize[i] = pool->linesize[i]; |
| 232 | |
| 233 | pic->buf[i] = av_buffer_pool_get(pool->pools[i]); |
| 234 | if (!pic->buf[i]) |
| 235 | goto fail; |
| 236 | |
| 237 | pic->data[i] = pic->buf[i]->data; |
| 238 | } |
| 239 | for (; i < AV_NUM_DATA_POINTERS; i++) { |
| 240 | pic->data[i] = NULL; |
| 241 | pic->linesize[i] = 0; |
| 242 | } |
| 243 | |
| 244 | if (s->debug & FF_DEBUG_BUFFERS) |
| 245 | av_log(s, AV_LOG_DEBUG, "default_get_buffer called on pic %p\n", pic); |
| 246 | |
| 247 | return 0; |
| 248 | fail: |
| 249 | av_frame_unref(pic); |
| 250 | return AVERROR(ENOMEM); |
| 251 | } |
| 252 | |
| 253 | int avcodec_default_get_buffer2(AVCodecContext *avctx, AVFrame *frame, int flags) |
| 254 | { |
no test coverage detected