AVFoundation: fix camera frames texture format.
Change-Id: I87ca4abf80a5be9983aefc791b8a0ef0cd4ac33d Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>
This commit is contained in:
@@ -174,7 +174,7 @@ public:
|
|||||||
GL_RGBA,
|
GL_RGBA,
|
||||||
CVPixelBufferGetWidth(m_buffer),
|
CVPixelBufferGetWidth(m_buffer),
|
||||||
CVPixelBufferGetHeight(m_buffer),
|
CVPixelBufferGetHeight(m_buffer),
|
||||||
GL_BGRA,
|
GL_RGBA,
|
||||||
GL_UNSIGNED_BYTE,
|
GL_UNSIGNED_BYTE,
|
||||||
0,
|
0,
|
||||||
&m_texture);
|
&m_texture);
|
||||||
@@ -240,18 +240,8 @@ private:
|
|||||||
|
|
||||||
int width = CVPixelBufferGetWidth(imageBuffer);
|
int width = CVPixelBufferGetWidth(imageBuffer);
|
||||||
int height = CVPixelBufferGetHeight(imageBuffer);
|
int height = CVPixelBufferGetHeight(imageBuffer);
|
||||||
QVideoFrame::PixelFormat format;
|
QVideoFrame::PixelFormat format =
|
||||||
|
AVFCameraViewfinderSettingsControl2::QtPixelFormatFromCVFormat(CVPixelBufferGetPixelFormatType(imageBuffer));
|
||||||
#ifdef Q_OS_IOS
|
|
||||||
bool useTexture = m_renderer->supportsTextures()
|
|
||||||
&& CVPixelBufferGetPixelFormatType(imageBuffer) == kCVPixelFormatType_32BGRA;
|
|
||||||
|
|
||||||
if (useTexture)
|
|
||||||
format = QVideoFrame::Format_BGRA32;
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
format = AVFCameraViewfinderSettingsControl2::QtPixelFormatFromCVFormat(CVPixelBufferGetPixelFormatType(imageBuffer));
|
|
||||||
|
|
||||||
if (format == QVideoFrame::Format_Invalid)
|
if (format == QVideoFrame::Format_Invalid)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user