GStreamerVideoFrameHolder.h [plain text]
#pragma once
#if ENABLE(VIDEO) && USE(GSTREAMER) && USE(TEXTURE_MAPPER_GL)
#include "MediaPlayerPrivateGStreamer.h"
#include "TextureMapperPlatformLayerBuffer.h"
#include "TextureMapperPlatformLayerProxy.h"
namespace WebCore {
class GstVideoFrameHolder : public TextureMapperPlatformLayerBuffer::UnmanagedBufferDataHolder {
public:
explicit GstVideoFrameHolder(GstSample*, Optional<GstVideoDecoderPlatform>, TextureMapperGL::Flags, bool gstGLEnabled);
virtual ~GstVideoFrameHolder();
#if USE(WPE_VIDEO_PLANE_DISPLAY_DMABUF)
void handoffVideoDmaBuf(struct wpe_video_plane_display_dmabuf_source*, const IntRect&);
#endif
#if USE(GSTREAMER_GL)
virtual void waitForCPUSync();
#endif
const IntSize& size() const { return m_size; }
bool hasAlphaChannel() const { return m_hasAlphaChannel; }
TextureMapperGL::Flags flags() const { return m_flags; }
GLuint textureID() const { return m_textureID; }
bool hasMappedTextures() const { return m_hasMappedTextures; }
const GstVideoFrame& videoFrame() const { return m_videoFrame; }
void updateTexture(BitmapTextureGL&);
std::unique_ptr<TextureMapperPlatformLayerBuffer> platformLayerBuffer();
bool hasDMABuf() const
{
#if USE(WPE_VIDEO_PLANE_DISPLAY_DMABUF)
return m_dmabufFD >= 0;
#else
return false;
#endif
}
private:
GRefPtr<GstBuffer> m_buffer;
GstVideoFrame m_videoFrame { };
IntSize m_size;
bool m_hasAlphaChannel;
Optional<GstVideoDecoderPlatform> m_videoDecoderPlatform;
TextureMapperGL::Flags m_flags { };
GLuint m_textureID { 0 };
#if USE(GSTREAMER_GL)
GstGLTextureTarget m_textureTarget { GST_GL_TEXTURE_TARGET_NONE };
#endif
bool m_isMapped { false };
bool m_hasMappedTextures { false };
#if USE(WPE_VIDEO_PLANE_DISPLAY_DMABUF)
int m_dmabufFD { 0 };
int m_dmabufStride { 0 };
#endif
};
}
#endif // ENABLE(VIDEO) && USE(GSTREAMER) && USE(TEXTURE_MAPPER_GL)