summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/phonon
diff options
context:
space:
mode:
authorGareth Stockwell <gareth.stockwell@sosco.com>2009-09-18 17:18:38 (GMT)
committerFrans Englich <frans.englich@nokia.com>2009-09-23 12:39:41 (GMT)
commitda4e047c7bcf6dc966dcb862033ce8c09bd561d9 (patch)
tree333adc7c2e72a450efed0e1f336822a2f093e71e /src/3rdparty/phonon
parentbe44bb7e43c76305133b09918c3ad8d3f9b2bed5 (diff)
downloadQt-da4e047c7bcf6dc966dcb862033ce8c09bd561d9.zip
Qt-da4e047c7bcf6dc966dcb862033ce8c09bd561d9.tar.gz
Qt-da4e047c7bcf6dc966dcb862033ce8c09bd561d9.tar.bz2
Experimenting to make video visible.
Removed the hack to set translucent window background in the mediaplayer. Then tried the following: 1. Direct write to backing store: does not work (backing bitmap is 16MU) 2. Set window background color: does not work (is over-written by control's Draw function) 3. Brush using CWindowGc from widget's paint event: does not work (is over-written by control's Draw function) 4. Hack QSymbianControl to blit a transparent bitmap from the Draw function: does work 5. Hack QSymbianControl to brush using CWindowGc from the Draw function: does work Configuration 5 is the one being committed. Other things we could try: 6. Trigger switch to 16MA backing store if child widgets have been created. This could be tested by calling RWindowTreeNode::Child on the TLW's window. - Maybe we could test whether the child window's display mode is 16MA? 7. Somehow tell QSymbianControl not to draw anything at all - Based on setting Qt::WA_PaintOnScreen? - Then we either: - (Ideally) do nothing, and rely on video stack to paint the necessary transparency - Brush using CWindowGc from widget's paint event
Diffstat (limited to 'src/3rdparty/phonon')
-rw-r--r--src/3rdparty/phonon/mmf/defs.h2
-rw-r--r--src/3rdparty/phonon/mmf/videooutput.cpp36
-rw-r--r--src/3rdparty/phonon/mmf/videoplayer.cpp20
3 files changed, 54 insertions, 4 deletions
diff --git a/src/3rdparty/phonon/mmf/defs.h b/src/3rdparty/phonon/mmf/defs.h
index 348a40f..e4e06e4 100644
--- a/src/3rdparty/phonon/mmf/defs.h
+++ b/src/3rdparty/phonon/mmf/defs.h
@@ -26,7 +26,7 @@ along with this library. If not, see <http://www.gnu.org/licenses/>.
// Defining this macro causes VideoOutput::paintEvent to write transparent
// alpha values directly into the backing store, rather than using QPainter
-//#define PHONON_MMF_DIRECT_WRITE_ALPHA
+#define PHONON_MMF_DIRECT_WRITE_ALPHA
QT_BEGIN_NAMESPACE
diff --git a/src/3rdparty/phonon/mmf/videooutput.cpp b/src/3rdparty/phonon/mmf/videooutput.cpp
index d0f8707..58fa25d 100644
--- a/src/3rdparty/phonon/mmf/videooutput.cpp
+++ b/src/3rdparty/phonon/mmf/videooutput.cpp
@@ -29,12 +29,17 @@ along with this library. If not, see <http://www.gnu.org/licenses/>.
#include <QMoveEvent>
#include <QResizeEvent>
-// Required for implementation of transparentFill
+// Required for implementation of transparentFill (direct write to backing store)
#include <QtGui/private/qwidget_p.h>
#include <QtGui/private/qdrawhelper_p.h>
#include <QtGui/private/qwindowsurface_p.h>
#include <QImage>
+// Required for implementation of transparentFill (GC brush)
+#include <coecntrl.h>
+#include <w32std.h>
+#include <eikenv.h>
+
QT_BEGIN_NAMESPACE
@@ -140,11 +145,35 @@ void MMF::VideoOutput::transparentFill(const QVector<QRect>& rects)
{
TRACE_CONTEXT(VideoOutput::transparentFill, EVideoInternal);
TRACE_ENTRY_0();
+
+/*
+ // Graphics context brushing approach
+ RWindow *const window = static_cast<RWindow *>(winId()->DrawableWindow());
+ const TDisplayMode displayMode = static_cast<TDisplayMode>(window->SetRequiredDisplayMode(EColor16MA));
+ CWindowGc& gc = CEikonEnv::Static()->SystemGc();
+ gc.Activate(*window);
+ gc.SetBrushColor(TRgb(255, 255, 255, 0));
+ gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
+ gc.SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha);
+ window->Invalidate();
+ window->BeginRedraw();
+ gc.Clear();
+ window->EndRedraw();
+ gc.Deactivate();
+*/
+/*
+ // Direct draw into backing store approach (entire TLW)
QImage *image = window()->windowSurface()->buffer(window());
QRgb *data = reinterpret_cast<QRgb *>(image->bits());
const int row_stride = image->bytesPerLine() / 4;
+ const QRgb color =
+ //0xff0000ff // opaque blue
+ 0x000000ff // transparent blue
+ //0x00000000 // transparent black
+ ;
+
// Paint the entire surface
const int imageWidth = image->size().width();
const int imageHeight = image->size().height();
@@ -153,12 +182,13 @@ void MMF::VideoOutput::transparentFill(const QVector<QRect>& rects)
QRgb *ptr = row;
for(int x=0; x<imageWidth; ++x)
- *ptr++ = 0xff0000ff;
+ *ptr++ = color;
row += row_stride;
}
+*/
/*
- // Paint the specified regions
+ // Direct draw into backing store approach (specified regions)
for (QVector<QRect>::const_iterator it = rects.begin(); it != rects.end(); ++it) {
const QRect& rect = *it;
diff --git a/src/3rdparty/phonon/mmf/videoplayer.cpp b/src/3rdparty/phonon/mmf/videoplayer.cpp
index e2c0b7d..cc56671 100644
--- a/src/3rdparty/phonon/mmf/videoplayer.cpp
+++ b/src/3rdparty/phonon/mmf/videoplayer.cpp
@@ -30,6 +30,8 @@ along with this library. If not, see <http://www.gnu.org/licenses/>.
#include "objectdump.h"
#endif
+#include <QtGui/private/qt_s60_p.h> // for QSymbianControl
+
QT_BEGIN_NAMESPACE
using namespace Phonon;
@@ -125,7 +127,9 @@ void MMF::VideoPlayer::doPlay()
updateMmfOutput();
}
+ TRAP_IGNORE(m_player->SetVolumeL(0)); // *** HACK ***
m_player->Play();
+ TRAP_IGNORE(m_player->SetVolumeL(0)); // *** HACK ***
}
void MMF::VideoPlayer::doPause()
@@ -402,11 +406,27 @@ void MMF::VideoPlayer::getNativeWindowSystemHandles()
VideoOutput& output = videoOutput();
CCoeControl* const control = output.winId();
+ // Inform control that it needs to brush rather than blit the backing store
+ QSymbianControl* const symbianControl = static_cast<QSymbianControl *>(control);
+ //symbianControl->setBlit(0xff00ff00); // opaque green
+ //symbianControl->setBlit(0x0000ff00); // transparent green
+ symbianControl->setBlit(0x00000000); // transparent black
+
CCoeEnv* const coeEnv = control->ControlEnv();
m_wsSession = &(coeEnv->WsSession());
m_screenDevice = coeEnv->ScreenDevice();
m_window = control->DrawableWindow();
+/*
+ // Set background window color
+ RWindow *const window = static_cast<RWindow *>(m_window);
+ const TDisplayMode displayMode = static_cast<TDisplayMode>(window->SetRequiredDisplayMode(EColor16MA));
+ //const TInt err = window->SetTransparencyAlphaChannel();
+ //if (err == KErrNone)
+ window->SetBackgroundColor(TRgb(255, 0, 255, 255));
+ window->Invalidate(); // force a redraw
+*/
+
#ifdef _DEBUG
QScopedPointer<ObjectDump::QDumper> dumper(new ObjectDump::QDumper);
dumper->setPrefix("Phonon::MMF"); // to aid searchability of logs