Skip to content

Commit

Permalink
VideoToolBox: Fixes for rectangular texture support
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-kendall committed Mar 10, 2019
1 parent 514f6f5 commit 667d4e1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
7 changes: 6 additions & 1 deletion mythtv/libs/libmythtv/openglvideo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,12 @@ bool OpenGLVideo::CreateVideoShader(VideoShaderType Type, QString Deinterlacer)
fragment.replace("SELECT_COLUMN", (kGLUYVY == frametype) ? SelectColumn : "");
// update packing code so this can be removed
fragment.replace("%SWIZZLE%", kGLUYVY == frametype ? "arb" : "abr");
if (m_textureTarget == QOpenGLTexture::TextureRectangle)

// N.B. Rectangular texture support is only currently used for VideoToolBox
// video frames which are NV12. Do not use rectangular textures for the 'default'
// shaders as it breaks video resizing and would require changes to our
// FramebufferObject code.
if ((m_textureTarget == QOpenGLTexture::TargetRectangle) && (Default != Type))
{
// N.B. Currently only NV12 shaders are supported and deinterlacing parameters
// need fixing as well (when interop deinterlacing is fixed)
Expand Down
8 changes: 4 additions & 4 deletions mythtv/libs/libmythui/mythrender_opengl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ MythGLTexture* MythRenderOpenGL::CreateTexture(QSize Size,
result->m_pixelFormat = PixelFormat;
result->m_pixelType = PixelType;
result->m_vbo = CreateVBO(kVertexSize);
result->m_totalSize = GetTextureSize(Size, result->m_target != QOpenGLTexture::TextureRectangle);
result->m_totalSize = GetTextureSize(Size, result->m_target != QOpenGLTexture::TargetRectangle);
result->m_bufferSize = datasize;
result->m_size = Size;
return result;
Expand All @@ -631,7 +631,7 @@ MythGLTexture* MythRenderOpenGL::CreateTextureFromQImage(QImage *Image)
MythGLTexture *result = new MythGLTexture(texture);
result->m_texture = texture;
result->m_vbo = CreateVBO(kVertexSize);
result->m_totalSize = GetTextureSize(Image->size(), result->m_target != QOpenGLTexture::TextureRectangle);
result->m_totalSize = GetTextureSize(Image->size(), result->m_target != QOpenGLTexture::TargetRectangle);
// N.B. Format and type per qopengltexure.cpp
result->m_pixelFormat = QOpenGLTexture::RGBA;
result->m_pixelType = QOpenGLTexture::UInt8;
Expand All @@ -656,7 +656,7 @@ MythGLTexture* MythRenderOpenGL::CreateExternalTexture(QSize Size, bool SetFilte
return nullptr;
MythGLTexture* result = new MythGLTexture(textureid);
result->m_size = Size;
result->m_totalSize = GetTextureSize(Size, result->m_target != QOpenGLTexture::TextureRectangle);
result->m_totalSize = GetTextureSize(Size, result->m_target != QOpenGLTexture::TargetRectangle);
result->m_vbo = CreateVBO(kVertexSize);
if (SetFilters)
SetTextureFilters(result, QOpenGLTexture::Linear, QOpenGLTexture::ClampToEdge);
Expand Down Expand Up @@ -1327,7 +1327,7 @@ bool MythRenderOpenGL::UpdateTextureVertices(MythGLTexture *Texture, const QRect
int width = Texture->m_crop ? min(Source.width(), size.width()) : Source.width();
int height = Texture->m_crop ? min(Source.height(), size.height()) : Source.height();

if (Texture->m_target != QOpenGLTexture::TextureRectangle)
if (Texture->m_target != QOpenGLTexture::TargetRectangle)
{
data[0 + TEX_OFFSET] = Source.left() / static_cast<GLfloat>(size.width());
data[(Texture->m_flip ? 7 : 1) + TEX_OFFSET] = (Source.top() + height) / static_cast<GLfloat>(size.height());
Expand Down

0 comments on commit 667d4e1

Please sign in to comment.