MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / oh_decode_wrap_hw_buffer

Function oh_decode_wrap_hw_buffer

libavcodec/ohdec.c:453–487  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

451}
452
453static 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
489static int oh_decode_wrap_sw_buffer(AVCodecContext *avctx, AVFrame *frame,
490 OHBufferQueueItem *output,

Callers 1

oh_decode_output_frameFunction · 0.85

Calls 6

ff_decode_frame_propsFunction · 0.85
av_refstruct_refFunction · 0.85
av_buffer_createFunction · 0.85
oh_buffer_releaseFunction · 0.85
av_rescale_qFunction · 0.85
av_malloczFunction · 0.50

Tested by

no test coverage detected