| 302 | } |
| 303 | |
| 304 | int ff_mpv_alloc_dummy_frames(MpegEncContext *s) |
| 305 | { |
| 306 | AVCodecContext *avctx = s->avctx; |
| 307 | int ret; |
| 308 | |
| 309 | av_assert1(!s->last_pic.ptr || s->last_pic.ptr->f->buf[0]); |
| 310 | av_assert1(!s->next_pic.ptr || s->next_pic.ptr->f->buf[0]); |
| 311 | if (!s->last_pic.ptr && s->pict_type != AV_PICTURE_TYPE_I) { |
| 312 | if (s->pict_type == AV_PICTURE_TYPE_B && s->next_pic.ptr) |
| 313 | av_log(avctx, AV_LOG_DEBUG, |
| 314 | "allocating dummy last picture for B frame\n"); |
| 315 | else if (s->codec_id != AV_CODEC_ID_H261 /* H.261 has no keyframes */ && |
| 316 | (s->picture_structure == PICT_FRAME || s->first_field)) |
| 317 | av_log(avctx, AV_LOG_ERROR, |
| 318 | "warning: first frame is no keyframe\n"); |
| 319 | |
| 320 | /* Allocate a dummy frame */ |
| 321 | ret = alloc_dummy_frame(s, &s->last_pic); |
| 322 | if (ret < 0) |
| 323 | return ret; |
| 324 | |
| 325 | if (!avctx->hwaccel) { |
| 326 | int luma_val = s->codec_id == AV_CODEC_ID_FLV1 || s->codec_id == AV_CODEC_ID_H263 ? 16 : 0x80; |
| 327 | color_frame(s->last_pic.ptr->f, luma_val); |
| 328 | } |
| 329 | } |
| 330 | if (!s->next_pic.ptr && s->pict_type == AV_PICTURE_TYPE_B) { |
| 331 | /* Allocate a dummy frame */ |
| 332 | ret = alloc_dummy_frame(s, &s->next_pic); |
| 333 | if (ret < 0) |
| 334 | return ret; |
| 335 | } |
| 336 | |
| 337 | av_assert0(s->pict_type == AV_PICTURE_TYPE_I || (s->last_pic.ptr && |
| 338 | s->last_pic.ptr->f->buf[0])); |
| 339 | |
| 340 | return 0; |
| 341 | } |
| 342 | |
| 343 | /** |
| 344 | * generic function called after decoding |
no test coverage detected