9#include "libavutil/pixdesc.h"
15#define LOC QString("MMALInterop: ")
24 LOG(VB_GENERAL, LOG_INFO,
LOC +
"Destructor");
34 QString renderer =
reinterpret_cast<const char*
>(Render->glGetString(GL_RENDERER));
35 if (!renderer.contains(
"VideoCore", Qt::CaseInsensitive))
37 LOG(VB_GENERAL, LOG_WARNING,
LOC +
38 QString(
"Interop requires the closed source/Broadcom driver - not '%1'").arg(renderer));
42 if (Render->hasExtension(
"GL_OES_EGL_image"))
58 MMAL_BUFFER_HEADER_T* result =
nullptr;
63 LOG(VB_GENERAL, LOG_ERR,
LOC + QString(
"Invalid MMAL buffer %1 %2 %3 %4")
64 .arg(
Frame->m_buffer !=
nullptr).arg(
Frame->m_priv[0] !=
nullptr)
66 .arg(av_get_pix_fmt_name(
static_cast<AVPixelFormat
>(
Frame->m_pixFmt))));
73 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Mismatched OpenGL contexts!");
78 QSize surfacesize(
Frame->m_width,
Frame->m_height);
82 LOG(VB_GENERAL, LOG_WARNING,
LOC +
"Video texture size changed!");
86 result =
reinterpret_cast<MMAL_BUFFER_HEADER_T*
>(
Frame->m_buffer);
90std::vector<MythVideoTextureOpenGL*>
96 std::vector<MythVideoTextureOpenGL*> result;
140 std::vector<QSize> sizes;
141 for (
uint plane = 0 ; plane < count; ++plane)
145 sizes.push_back(size);
148 std::vector<MythVideoTextureOpenGL*> textures =
150 if (textures.size() != count)
151 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Failed to create all textures");
153 for (
uint i = 0; i < textures.size(); ++i)
155 textures[i]->m_allowGLSLDeint =
true;
156 textures[i]->m_flip =
false;
165 for (
uint plane = 0; plane < result.size(); ++plane)
175 (EGLClientBuffer)buffer->data,
nullptr);
177 LOG(VB_GENERAL, LOG_ERR,
LOC + QString(
"No EGLImage for plane %1 %2")
void * GetEGLDisplay(void)
void eglImageTargetTexture2DOES(GLenum Target, void *Image)
void eglDestroyImageKHR(void *Disp, void *Image)
static qint32 GetEGLError(void)
void * eglCreateImageKHR(void *Disp, void *Context, unsigned int Target, void *Buffer, const int32_t *Attributes)
std::map< VideoFrameType, InteropTypes > InteropMap
MythMMALInterop(MythRenderOpenGL *Context)
MMAL_BUFFER_HEADER_T * VerifyBuffer(MythRenderOpenGL *Context, MythVideoFrame *Frame)
static void GetMMALTypes(MythRenderOpenGL *Render, MythInteropGPU::InteropMap &Types)
static MythMMALInterop * CreateMMAL(MythRenderOpenGL *Context)
Create an MMAL interop.
virtual std::vector< MythVideoTextureOpenGL * > Acquire(MythRenderOpenGL *Context, MythVideoColourSpace *ColourSpace, MythVideoFrame *Frame, FrameScanType Scan) override
virtual ~MythMMALInterop() override
MythRenderOpenGL * m_openglContext
QHash< unsigned long long, std::vector< MythVideoTextureOpenGL * > > m_openglTextures
MythVideoColourSpace contains a QMatrix4x4 that can convert YCbCr data to RGB.
void SetSupportedAttributes(PictureAttributeSupported Supported)
Enable the given set of picture attributes.
bool UpdateColourSpace(const MythVideoFrame *Frame)
Set the current colourspace to use.
static uint GetNumPlanes(VideoFrameType Type)
static QString FormatDescription(VideoFrameType Type)
static int GetHeightForPlane(VideoFrameType Type, int Height, uint Plane)
static int GetWidthForPlane(VideoFrameType Type, int Width, uint Plane)
static std::vector< MythVideoTextureOpenGL * > CreateTextures(MythRenderOpenGL *Context, VideoFrameType Type, VideoFrameType Format, std::vector< QSize > Sizes, GLenum Target=QOpenGLTexture::Target2D)
Create a set of textures suitable for the given Type and Format.
static constexpr uint32_t EGL_IMAGE_BRCM_MULTIMEDIA_U
static constexpr uint32_t EGL_IMAGE_BRCM_MULTIMEDIA_V
static constexpr uint32_t EGL_IMAGE_BRCM_MULTIMEDIA_Y
static constexpr uint64_t DUMMY_INTEROP_ID
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
#define GL_TEXTURE_EXTERNAL_OES
bool is_interlaced(FrameScanType Scan)
#define ALL_PICTURE_ATTRIBUTES