From kde-commits Sun Feb 24 17:21:51 2013 From: Jean-Baptiste Mardelle Date: Sun, 24 Feb 2013 17:21:51 +0000 To: kde-commits Subject: [kdenlive] src: Switch to rgb24 instead of rbg24a when requesting frames from MLT. Fixes: http://kde Message-Id: <20130224172151.464A8A6091 () git ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=136172652100527 Git commit e692395e685251de32144abfdf85b6c57319c41b by Jean-Baptiste Mardel= le. Committed on 24/02/2013 at 18:20. Pushed by mardelle into branch 'master'. Switch to rgb24 instead of rbg24a when requesting frames from MLT. Fixes: h= ttp://kdenlive.org/mantis/view.php?id=3D2990 M +5 -4 src/mltdevicecapture.cpp M +9 -9 src/renderer.cpp M +2 -2 src/videoglwidget.cpp M +1 -1 src/videoglwidget.h http://commits.kde.org/kdenlive/e692395e685251de32144abfdf85b6c57319c41b diff --git a/src/mltdevicecapture.cpp b/src/mltdevicecapture.cpp index 6a23773..629ed51 100644 --- a/src/mltdevicecapture.cpp +++ b/src/mltdevicecapture.cpp @@ -252,13 +252,14 @@ void MltDeviceCapture::emitFrameUpdated(Mlt::Frame& f= rame) } */ = - mlt_image_format format =3D mlt_image_rgb24a; + mlt_image_format format =3D mlt_image_rgb24; int width =3D 0; int height =3D 0; const uchar* image =3D frame.get_image(format, width, height); - QImage qimage(width, height, QImage::Format_ARGB32_Premultiplied); - memcpy(qimage.bits(), image, width * height * 4); - emit frameUpdated(qimage.rgbSwapped()); + QImage qimage(width, height, QImage::Format_RGB888); + //QImage qimage(width, height, QImage::Format_ARGB32_Premultiplied); + memcpy(qimage.bits(), image, width * height * 3); + emit frameUpdated(qimage); } = void MltDeviceCapture::showFrame(Mlt::Frame& frame) diff --git a/src/renderer.cpp b/src/renderer.cpp index 983896d..512afae 100644 --- a/src/renderer.cpp +++ b/src/renderer.cpp @@ -223,7 +223,7 @@ void Render::buildConsumer(const QString &profileName) setenv("MLT_PROFILE", m_activeProfile.toUtf8().constData(), 1); m_mltProfile->set_explicit(true); = - m_blackClip =3D new Mlt::Producer(*m_mltProfile, "colour", "black"); + m_blackClip =3D new Mlt::Producer(*m_mltProfile, "colour:black"); m_blackClip->set("id", "black"); m_blackClip->set("mlt_type", "producer"); if (KdenliveSettings::external_display() && m_name !=3D Kdenlive::clip= Monitor && m_winid !=3D 0) { @@ -1797,13 +1797,13 @@ int Render::seekFramePosition() const = void Render::emitFrameUpdated(Mlt::Frame& frame) { - mlt_image_format format =3D mlt_image_rgb24a; + mlt_image_format format =3D mlt_image_rgb24; int width =3D 0; int height =3D 0; const uchar* image =3D frame.get_image(format, width, height); - QImage qimage(width, height, QImage::Format_ARGB32_Premultiplied); - memcpy(qimage.scanLine(0), image, width * height * 4); - emit frameUpdated(qimage.rgbSwapped()); + QImage qimage(width, height, QImage::Format_RGB888); //Format_ARGB32_= Premultiplied); + memcpy(qimage.scanLine(0), image, width * height * 3); + emit frameUpdated(qimage); } = int Render::getCurrentSeekPosition() const @@ -1880,17 +1880,17 @@ void Render::showFrame(Mlt::Frame* frame) if (currentPos =3D=3D requestedSeekPosition) requestedSeekPosition =3D= SEEK_INACTIVE; emit rendererPosition(currentPos); if (frame->is_valid()) { - mlt_image_format format =3D mlt_image_rgb24a; + mlt_image_format format =3D mlt_image_rgb24; int width =3D 0; int height =3D 0; const uchar* image =3D frame->get_image(format, width, height); - QImage qimage(width, height, QImage::Format_ARGB32_Premultiplied); - memcpy(qimage.scanLine(0), image, width * height * 4); + QImage qimage(width, height, QImage::Format_RGB888); //Format_ARGB32_Prem= ultiplied); + memcpy(qimage.scanLine(0), image, width * height * 3); if (analyseAudio) showAudio(*frame); delete frame; emit showImageSignal(qimage); if (sendFrameForAnalysis) { - emit frameUpdated(qimage.rgbSwapped()); + emit frameUpdated(qimage);//.rgbSwapped()); } } else delete frame; showFrameSemaphore.release(); diff --git a/src/videoglwidget.cpp b/src/videoglwidget.cpp index af6527a..c613feb 100644 --- a/src/videoglwidget.cpp +++ b/src/videoglwidget.cpp @@ -129,7 +129,7 @@ void VideoGLWidget::paintGL() } } = -void VideoGLWidget::showImage(QImage image) +void VideoGLWidget::showImage(const QImage image) { m_image_width =3D image.width(); m_image_height =3D image.height(); @@ -142,7 +142,7 @@ void VideoGLWidget::showImage(QImage image) glBindTexture(GL_TEXTURE_RECTANGLE_EXT, m_texture); glTexParameteri(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_MIN_FILTER, GL_LI= NEAR); glTexParameterf(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_MAG_FILTER, GL_LI= NEAR); - glTexImage2D(GL_TEXTURE_RECTANGLE_EXT, 0, GL_RGBA8, m_image_width, m_i= mage_height, 0, GL_RGBA, + glTexImage2D(GL_TEXTURE_RECTANGLE_EXT, 0, GL_RGBA8, m_image_width, m_i= mage_height, 0, GL_RGB, GL_UNSIGNED_BYTE, image.bits()); updateGL(); } diff --git a/src/videoglwidget.h b/src/videoglwidget.h index 2d492d9..8601562 100644 --- a/src/videoglwidget.h +++ b/src/videoglwidget.h @@ -28,7 +28,7 @@ private: Qt::WindowFlags m_baseFlags; = public slots: - void showImage(QImage image); + void showImage(const QImage image); = protected: void initializeGL();