Go to the documentation of this file.
7 #include "libavutil/pixdesc.h"
13 #define LOC QString("MMALInterop: ")
22 LOG(VB_GENERAL, LOG_INFO,
LOC +
"Destructor");
32 QString renderer =
reinterpret_cast<const char*
>(Render->glGetString(GL_RENDERER));
33 if (!renderer.contains(
"VideoCore", Qt::CaseInsensitive))
35 LOG(VB_GENERAL, LOG_WARNING,
LOC +
36 QString(
"Interop requires the closed source/Broadcom driver - not '%1'").arg(renderer));
40 if (Render->hasExtension(
"GL_OES_EGL_image"))
56 MMAL_BUFFER_HEADER_T* result =
nullptr;
61 LOG(VB_GENERAL, LOG_ERR,
LOC + QString(
"Invalid MMAL buffer %1 %2 %3 %4")
62 .arg(
Frame->m_buffer !=
nullptr).arg(
Frame->m_priv[0] !=
nullptr)
64 .arg(av_get_pix_fmt_name(
static_cast<AVPixelFormat
>(
Frame->m_pixFmt))));
71 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Mismatched OpenGL contexts!");
76 QSize surfacesize(
Frame->m_width,
Frame->m_height);
80 LOG(VB_GENERAL, LOG_WARNING,
LOC +
"Video texture size changed!");
84 result =
reinterpret_cast<MMAL_BUFFER_HEADER_T*
>(
Frame->m_buffer);
88 std::vector<MythVideoTextureOpenGL*>
94 std::vector<MythVideoTextureOpenGL*> result;
138 std::vector<QSize> sizes;
139 for (
uint plane = 0 ; plane < count; ++plane)
143 sizes.push_back(size);
146 std::vector<MythVideoTextureOpenGL*> textures =
148 if (textures.size() != count)
149 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Failed to create all textures");
151 for (
uint i = 0; i < textures.size(); ++i)
153 textures[i]->m_allowGLSLDeint =
true;
154 textures[i]->m_flip =
false;
163 for (
uint plane = 0; plane < result.size(); ++plane)
173 (EGLClientBuffer)buffer->data,
nullptr);
175 LOG(VB_GENERAL, LOG_ERR,
LOC + QString(
"No EGLImage for plane %1 %2")
static constexpr uint64_t DUMMY_INTEROP_ID
virtual std::vector< MythVideoTextureOpenGL * > Acquire(MythRenderOpenGL *Context, MythVideoColourSpace *ColourSpace, MythVideoFrame *Frame, FrameScanType Scan) override
MMAL_BUFFER_HEADER_T * VerifyBuffer(MythRenderOpenGL *Context, MythVideoFrame *Frame)
void * GetEGLDisplay(void)
bool UpdateColourSpace(const MythVideoFrame *Frame)
Set the current colourspace to use.
void eglImageTargetTexture2DOES(GLenum Target, void *Image)
void SetSupportedAttributes(PictureAttributeSupported Supported)
Enable the given set of picture attributes.
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
virtual ~MythMMALInterop() override
static constexpr uint32_t EGL_IMAGE_BRCM_MULTIMEDIA_U
void eglDestroyImageKHR(void *Disp, void *Image)
#define GL_TEXTURE_EXTERNAL_OES
std::map< VideoFrameType, InteropTypes > InteropMap
static void GetMMALTypes(MythRenderOpenGL *Render, MythInteropGPU::InteropMap &Types)
static MythMMALInterop * CreateMMAL(MythRenderOpenGL *Context)
Create an MMAL interop.
MythRenderOpenGL * m_openglContext
static qint32 GetEGLError(void)
static int GetWidthForPlane(VideoFrameType Type, int Width, uint Plane)
static constexpr uint32_t EGL_IMAGE_BRCM_MULTIMEDIA_V
static constexpr uint32_t EGL_IMAGE_BRCM_MULTIMEDIA_Y
MythMMALInterop(MythRenderOpenGL *Context)
#define ALL_PICTURE_ATTRIBUTES
QHash< unsigned long long, std::vector< MythVideoTextureOpenGL * > > m_openglTextures
static int GetHeightForPlane(VideoFrameType Type, int Height, uint Plane)
static QString FormatDescription(VideoFrameType Type)
void * eglCreateImageKHR(void *Disp, void *Context, unsigned int Target, void *Buffer, const int32_t *Attributes)
static uint GetNumPlanes(VideoFrameType Type)
bool is_interlaced(FrameScanType Scan)
MythVideoColourSpace contains a QMatrix4x4 that can convert YCbCr data to RGB.
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.