10#include "libavutil/hwcontext_mediacodec.h"
11#include "libavcodec/mediacodec.h"
14#define LOC QString("MediaCodecInterop: ")
24 if (result->Initialise(Size))
53 auto *wait =
reinterpret_cast<QWaitCondition*
>(Wait);
65 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Must be created in UI thread");
73 std::vector<QSize> sizes;
74 sizes.push_back(Size);
75 std::vector<MythVideoTextureOpenGL*> textures =
79 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Failed to create texture");
93 "(Landroid/graphics/SurfaceTexture$OnFrameAvailableListener;)V",
96 "(Landroid/graphics/SurfaceTexture;)V",
101 LOG(VB_GENERAL, LOG_INFO,
LOC +
"Created Android Surface");
104 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Failed to create Android Surface");
106 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Failed to create Android SurfaceTexture");
111std::vector<MythVideoTextureOpenGL*>
117 std::vector<MythVideoTextureOpenGL*> result;
122 if (!
Frame->m_buffer)
132 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Failed");
145 auto *buffer =
reinterpret_cast<AVMediaCodecBuffer*
>(
Frame->m_buffer);
148 LOG(VB_GENERAL, LOG_ERR,
LOC +
"No AVMediaCodecBuffer");
154 if (av_mediacodec_release_buffer(buffer, 1) < 0)
155 LOG(VB_GENERAL, LOG_ERR ,
LOC +
"av_mediacodec_release_buffer failed");
159 LOG(VB_GENERAL, LOG_WARNING,
LOC +
"Timed out waiting for frame update");
163 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