4#include <QtFFmpegMediaPluginImpl/private/qffmpeghwaccel_mediacodec_p.h>
6#include <QtGui/rhi/qrhi.h>
12#include <libavcodec/mediacodec.h>
13#include <libavutil/hwcontext_mediacodec.h>
16#if !defined(Q_OS_ANDROID)
17# error "Configuration error"
24class MediaCodecTextureHandles :
public QVideoFrameTexturesHandles
27 MediaCodecTextureHandles(TextureConverterBackendPtr &&converterBackend, quint64 textureHandle)
28 : m_parentConverterBackend(std::move(converterBackend)), m_handle(textureHandle)
32 quint64 textureHandle(QRhi &,
int plane)
override {
return (plane == 0) ? m_handle : 0; }
35 TextureConverterBackendPtr m_parentConverterBackend;
39void deleteSurface(AVHWDeviceContext *ctx)
47 if (!frame || !frame->hw_frames_ctx)
50 auto *frameContext =
reinterpret_cast<AVHWFramesContext *>(frame->hw_frames_ctx->data);
52 if (!frameContext || !frameContext->device_ctx)
55 AVHWDeviceContext *deviceContext = frameContext->device_ctx;
118 qWarning() <<
"Failed to create the external texture!";
130 qWarning() <<
"Received a frame without AVMediaCodecBuffer.";
132 qWarning() <<
"Failed to render buffer to surface.";
std::conditional_t< QT_FFMPEG_AVIO_WRITE_CONST, const uint8_t *, uint8_t * > AvioWriteBufferType