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"
26class MediaCodecTextureHandles :
public QVideoFrameTexturesHandles
29 MediaCodecTextureHandles(TextureConverterBackendPtr &&converterBackend, quint64 textureHandle)
30 : m_parentConverterBackend(std::move(converterBackend)), m_handle(textureHandle)
34 quint64 textureHandle(QRhi &,
int plane)
override {
return (plane == 0) ? m_handle : 0; }
37 TextureConverterBackendPtr m_parentConverterBackend;
41void deleteSurface(AVHWDeviceContext *ctx)
49 if (!frame || !frame->hw_frames_ctx)
52 auto *frameContext =
reinterpret_cast<AVHWFramesContext *>(frame->hw_frames_ctx->data);
54 if (!frameContext || !frameContext->device_ctx)
57 AVHWDeviceContext *deviceContext = frameContext->device_ctx;
120 qWarning() <<
"Failed to create the external texture!";
132 qWarning() <<
"Received a frame without AVMediaCodecBuffer.";
134 qWarning() <<
"Failed to render buffer to surface.";
std::conditional_t< QT_FFMPEG_AVIO_WRITE_CONST, const uint8_t *, uint8_t * > AvioWriteBufferType