void S60VideoPlayerSession::setVideoRenderer(QObject *videoOutput) { DP0("S60VideoPlayerSession::setVideoRenderer +++"); if (videoOutput != m_videoOutputControl) { if (m_videoOutputDisplay) { disconnect(m_videoOutputDisplay); m_videoOutputDisplay->disconnect(this); m_videoOutputDisplay = 0; } if (videoOutput) { if (S60VideoWidgetControl *control = qobject_cast<S60VideoWidgetControl *>(videoOutput)) m_videoOutputDisplay = control->display(); if (!m_videoOutputDisplay) return; m_videoOutputDisplay->setNativeSize(m_nativeSize); connect(this, SIGNAL(nativeSizeChanged(QSize)), m_videoOutputDisplay, SLOT(setNativeSize(QSize))); connect(m_videoOutputDisplay, SIGNAL(windowHandleChanged(RWindow *)), this, SLOT(windowHandleChanged())); connect(m_videoOutputDisplay, SIGNAL(displayRectChanged(QRect, QRect)), this, SLOT(displayRectChanged())); connect(m_videoOutputDisplay, SIGNAL(aspectRatioModeChanged(Qt::AspectRatioMode)), this, SLOT(aspectRatioChanged())); connect(m_videoOutputDisplay, SIGNAL(rotationChanged(qreal)), this, SLOT(rotationChanged())); #ifndef VIDEOOUTPUT_GRAPHICS_SURFACES connect(m_videoOutputDisplay, SIGNAL(beginVideoWindowNativePaint()), this, SLOT(suspendDirectScreenAccess())); connect(m_videoOutputDisplay, SIGNAL(endVideoWindowNativePaint()), this, SLOT(resumeDirectScreenAccess())); #endif } m_videoOutputControl = videoOutput; windowHandleChanged(); } DP0("S60VideoPlayerSession::setVideoRenderer ---"); }
S60VideoWidgetDisplay::S60VideoWidgetDisplay(QObject *parent) : S60VideoDisplay(parent) , m_widget(new S60VideoWidget) { connect(this, SIGNAL(paintingEnabledChanged(bool)), m_widget, SLOT(setPaintingEnabled(bool))); connect(this, SIGNAL(fullScreenChanged(bool)), m_widget, SLOT(setFullScreen(bool))); connect(this, SIGNAL(contentRectChanged(const QRect&)), m_widget, SLOT(setContentRect(const QRect &))); #ifndef VIDEOOUTPUT_GRAPHICS_SURFACES connect(m_widget, SIGNAL(beginVideoWidgetNativePaint()), this, SIGNAL(beginVideoWindowNativePaint())); connect(m_widget, SIGNAL(endVideoWidgetNativePaint()), this, SIGNAL(endVideoWindowNativePaint())); #endif m_widget->installEventFilter(this); m_widget->setPaintingEnabled(false); }
void S60VideoPlayerSession::setVideoRenderer(QObject *videoOutput) { if (videoOutput == m_videoOutput) return; S60VideoWidgetControl *newWidgetControl = qobject_cast<S60VideoWidgetControl *>(videoOutput); S60VideoWidgetControl *oldWidgetControl = qobject_cast<S60VideoWidgetControl *>(m_videoOutput); if (oldWidgetControl) { disconnect(oldWidgetControl, SIGNAL(widgetUpdated()), this, SLOT(resetVideoDisplay())); disconnect(oldWidgetControl, SIGNAL(beginVideoWindowNativePaint()), this, SLOT(suspendDirectScreenAccess())); disconnect(oldWidgetControl, SIGNAL(endVideoWindowNativePaint()), this, SLOT(resumeDirectScreenAccess())); disconnect(this, SIGNAL(stateChanged(QMediaPlayer::State)), oldWidgetControl, SLOT(videoStateChanged(QMediaPlayer::State))); } if (newWidgetControl) { connect(newWidgetControl, SIGNAL(widgetUpdated()), this, SLOT(resetVideoDisplay())); connect(newWidgetControl, SIGNAL(beginVideoWindowNativePaint()), this, SLOT(suspendDirectScreenAccess())); connect(newWidgetControl, SIGNAL(endVideoWindowNativePaint()), this, SLOT(resumeDirectScreenAccess())); connect(this, SIGNAL(stateChanged(QMediaPlayer::State)), newWidgetControl, SLOT(videoStateChanged(QMediaPlayer::State))); } m_videoOutput = videoOutput; resetVideoDisplay(); }