10#include "libavutil/hwcontext_mediacodec.h"
11#include "libavcodec/mediacodec.h"
14#define LOC QString("MediaCodecInterop: ")
24 if (result->Initialise(Size))
36 m_colourSpaceInitialised(
false),
40 m_textureTransform(nullptr),
60 QWaitCondition *wait =
reinterpret_cast<QWaitCondition*
>(Wait);
72 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Must be created in UI thread");
80 std::vector<QSize> sizes;
81 sizes.push_back(Size);
82 std::vector<MythVideoTextureOpenGL*> textures =
86 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Failed to create texture");
100 "(Landroid/graphics/SurfaceTexture$OnFrameAvailableListener;)V",
103 "(Landroid/graphics/SurfaceTexture;)V",
108 LOG(VB_GENERAL, LOG_INFO,
LOC +
"Created Android Surface");
111 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Failed to create Android Surface");
113 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Failed to create Android SurfaceTexture");
118std::vector<MythVideoTextureOpenGL*>
124 std::vector<MythVideoTextureOpenGL*> result;
129 if (!
Frame->m_buffer)
139 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Failed");
152 AVMediaCodecBuffer *buffer =
reinterpret_cast<AVMediaCodecBuffer*
>(
Frame->m_buffer);
155 LOG(VB_GENERAL, LOG_ERR,
LOC +
"No AVMediaCodecBuffer");
161 if (av_mediacodec_release_buffer(buffer, 1) < 0)
162 LOG(VB_GENERAL, LOG_ERR ,
LOC +
"av_mediacodec_release_buffer failed");
166 LOG(VB_GENERAL, LOG_WARNING,
LOC +
"Timed out waiting for frame update");
170 Frame->m_buffer =
nullptr;
#define QAndroidJniEnvironment
#define QAndroidJniObject
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 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 void DeleteTextures(MythRenderOpenGL *Context, std::vector< MythVideoTextureOpenGL * > &Textures)
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
static constexpr uint64_t DUMMY_INTEROP_ID
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
#define GL_TEXTURE_EXTERNAL_OES
@ kPictureAttributeSupported_None