| 451 | } |
| 452 | |
| 453 | static int oh_decode_wrap_hw_buffer(AVCodecContext *avctx, AVFrame *frame, |
| 454 | OHBufferQueueItem *output, |
| 455 | const OH_AVCodecBufferAttr *attr) |
| 456 | { |
| 457 | OHCodecDecContext *s = avctx->priv_data; |
| 458 | |
| 459 | frame->width = s->width; |
| 460 | frame->height = s->height; |
| 461 | int ret = ff_decode_frame_props(avctx, frame); |
| 462 | if (ret < 0) |
| 463 | return ret; |
| 464 | |
| 465 | frame->format = AV_PIX_FMT_OHCODEC; |
| 466 | OHCodecBuffer *buffer = av_mallocz(sizeof(*buffer)); |
| 467 | if (!buffer) |
| 468 | return AVERROR(ENOMEM); |
| 469 | |
| 470 | buffer->dec_ref = av_refstruct_ref(s->dec_ref); |
| 471 | |
| 472 | buffer->index = output->index; |
| 473 | buffer->buffer = output->buffer; |
| 474 | frame->buf[0] = av_buffer_create((uint8_t *)buffer->buffer, 1, |
| 475 | oh_buffer_release, |
| 476 | buffer, AV_BUFFER_FLAG_READONLY); |
| 477 | if (!frame->buf[0]) { |
| 478 | oh_buffer_release(buffer, NULL); |
| 479 | return AVERROR(ENOMEM); |
| 480 | } |
| 481 | // Point to OH_AVBuffer |
| 482 | frame->data[3] = frame->buf[0]->data; |
| 483 | frame->pts = av_rescale_q(attr->pts, AV_TIME_BASE_Q, avctx->pkt_timebase); |
| 484 | frame->pkt_dts = AV_NOPTS_VALUE; |
| 485 | |
| 486 | return 0; |
| 487 | } |
| 488 | |
| 489 | static int oh_decode_wrap_sw_buffer(AVCodecContext *avctx, AVFrame *frame, |
| 490 | OHBufferQueueItem *output, |
no test coverage detected