update opengl exporter to pass encoderptr along to exporter base class
This commit is contained in:
@@ -1,9 +1,10 @@
|
|||||||
#include "openglexporter.h"
|
#include "openglexporter.h"
|
||||||
|
|
||||||
#include "render/backend/opengl/functions.h"
|
#include "render/backend/opengl/functions.h"
|
||||||
|
#include "render/pixelservice.h"
|
||||||
|
|
||||||
OpenGLExporter::OpenGLExporter(ViewerOutput* viewer, const VideoRenderingParams& params, const QMatrix4x4& transform, ColorProcessorPtr color_processor, QObject* parent) :
|
OpenGLExporter::OpenGLExporter(ViewerOutput* viewer, const VideoRenderingParams& params, const QMatrix4x4 &transform, ColorProcessorPtr color_processor, EncoderPtr encoder, QObject* parent) :
|
||||||
Exporter(viewer, params, transform, color_processor, parent)
|
Exporter(viewer, params, transform, color_processor, encoder, parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,6 +45,9 @@ FramePtr OpenGLExporter::TextureToFrame(const QVariant& texture)
|
|||||||
frame->set_format(params_.format());
|
frame->set_format(params_.format());
|
||||||
frame->allocate();
|
frame->allocate();
|
||||||
|
|
||||||
|
QOpenGLFunctions* f = QOpenGLContext::currentContext()->functions();
|
||||||
|
f->glViewport(0, 0, texture_->width(), texture_->height());
|
||||||
|
|
||||||
// Blit for transform if the width/height are different
|
// Blit for transform if the width/height are different
|
||||||
OpenGLTexturePtr input_tex = texture.value<OpenGLTexturePtr>();
|
OpenGLTexturePtr input_tex = texture.value<OpenGLTexturePtr>();
|
||||||
if (input_tex) {
|
if (input_tex) {
|
||||||
@@ -59,6 +63,21 @@ FramePtr OpenGLExporter::TextureToFrame(const QVariant& texture)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Perform OpenGL read
|
// Perform OpenGL read
|
||||||
|
buffer_.Attach(texture_);
|
||||||
|
f->glBindFramebuffer(GL_READ_FRAMEBUFFER, buffer_.buffer());
|
||||||
|
|
||||||
|
PixelFormatInfo format_info = PixelService::GetPixelFormatInfo(params_.format());
|
||||||
|
|
||||||
|
f->glReadPixels(0,
|
||||||
|
0,
|
||||||
|
texture_->width(),
|
||||||
|
texture_->height(),
|
||||||
|
format_info.pixel_format,
|
||||||
|
format_info.gl_pixel_type,
|
||||||
|
frame->data());
|
||||||
|
|
||||||
|
f->glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
|
||||||
|
buffer_.Detach();
|
||||||
|
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,12 @@
|
|||||||
class OpenGLExporter : public Exporter
|
class OpenGLExporter : public Exporter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
OpenGLExporter(ViewerOutput *viewer, const VideoRenderingParams ¶ms, const QMatrix4x4 &transform, ColorProcessorPtr color_processor, QObject* parent = nullptr);
|
OpenGLExporter(ViewerOutput* viewer,
|
||||||
|
const VideoRenderingParams& params,
|
||||||
|
const QMatrix4x4& transform,
|
||||||
|
ColorProcessorPtr color_processor,
|
||||||
|
EncoderPtr encoder,
|
||||||
|
QObject* parent = nullptr);
|
||||||
|
|
||||||
virtual ~OpenGLExporter() override;
|
virtual ~OpenGLExporter() override;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user