| 533 | } |
| 534 | |
| 535 | static int oh_decode_output_frame(AVCodecContext *avctx, AVFrame *frame, |
| 536 | OHBufferQueueItem *output) |
| 537 | { |
| 538 | OHCodecDecContext *s = avctx->priv_data; |
| 539 | OH_AVCodecBufferAttr attr; |
| 540 | |
| 541 | OH_AVErrCode err = OH_AVBuffer_GetBufferAttr(output->buffer, &attr); |
| 542 | if (err != AV_ERR_OK) |
| 543 | return ff_oh_err_to_ff_err(err); |
| 544 | |
| 545 | if (attr.flags & AVCODEC_BUFFER_FLAGS_EOS) { |
| 546 | av_log(avctx, AV_LOG_DEBUG, "Buffer flag eos\n"); |
| 547 | OH_VideoDecoder_FreeOutputBuffer(s->dec, output->index); |
| 548 | return AVERROR_EOF; |
| 549 | } |
| 550 | |
| 551 | if (!s->got_stream_info) { |
| 552 | // This shouldn't happen, add a warning message. |
| 553 | av_log(avctx, AV_LOG_WARNING, |
| 554 | "decoder didn't notify stream info, try get format explicitly\n"); |
| 555 | |
| 556 | OH_AVFormat *format = OH_VideoDecoder_GetOutputDescription(s->dec); |
| 557 | if (!format) { |
| 558 | av_log(avctx, AV_LOG_ERROR, "GetOutputDescription failed\n"); |
| 559 | return AVERROR_EXTERNAL; |
| 560 | } |
| 561 | |
| 562 | oh_decode_on_stream_changed(s->dec, format, avctx); |
| 563 | OH_AVFormat_Destroy(format); |
| 564 | if (!s->got_stream_info) |
| 565 | return AVERROR_EXTERNAL; |
| 566 | } |
| 567 | |
| 568 | if (s->output_to_window) |
| 569 | return oh_decode_wrap_hw_buffer(avctx, frame, output, &attr); |
| 570 | return oh_decode_wrap_sw_buffer(avctx, frame, output, &attr); |
| 571 | } |
| 572 | |
| 573 | static int oh_decode_send_pkt(AVCodecContext *avctx, OHBufferQueueItem *input) |
| 574 | { |
no test coverage detected