| 573 | } |
| 574 | |
| 575 | int ff_nvdec_start_frame(AVCodecContext *avctx, AVFrame *frame) |
| 576 | { |
| 577 | NVDECContext *ctx = avctx->internal->hwaccel_priv_data; |
| 578 | FrameDecodeData *fdd = frame->private_ref; |
| 579 | NVDECFrame *cf = NULL; |
| 580 | int ret; |
| 581 | |
| 582 | ctx->bitstream_len = 0; |
| 583 | ctx->nb_slices = 0; |
| 584 | |
| 585 | if (fdd->hwaccel_priv) |
| 586 | return 0; |
| 587 | |
| 588 | cf = av_mallocz(sizeof(*cf)); |
| 589 | if (!cf) |
| 590 | return AVERROR(ENOMEM); |
| 591 | |
| 592 | cf->decoder = av_refstruct_ref(ctx->decoder); |
| 593 | |
| 594 | cf->idx_ref = av_refstruct_pool_get(ctx->decoder_pool); |
| 595 | if (!cf->idx_ref) { |
| 596 | av_log(avctx, AV_LOG_ERROR, "No decoder surfaces left\n"); |
| 597 | ret = AVERROR(ENOMEM); |
| 598 | goto fail; |
| 599 | } |
| 600 | cf->ref_idx = cf->idx = *cf->idx_ref; |
| 601 | |
| 602 | fdd->hwaccel_priv = cf; |
| 603 | fdd->hwaccel_priv_free = nvdec_fdd_priv_free; |
| 604 | fdd->post_process = nvdec_retrieve_data; |
| 605 | |
| 606 | return 0; |
| 607 | fail: |
| 608 | nvdec_fdd_priv_free(cf); |
| 609 | return ret; |
| 610 | |
| 611 | } |
| 612 | |
| 613 | int ff_nvdec_start_frame_sep_ref(AVCodecContext *avctx, AVFrame *frame, int has_sep_ref) |
| 614 | { |
no test coverage detected