std::unique_ptr<CDMSession> CDM::createSession(CDMSessionClient& client) { auto session = m_private->createSession(&client); if (mediaPlayer()) mediaPlayer()->setCDMSession(session.get()); return session; }
std::unique_ptr<CDMSession> CDM::createSession() { std::unique_ptr<CDMSession> session = m_private->createSession(); if (mediaPlayer()) mediaPlayer()->setCDMSession(session.get()); return session; }
void UniqueLibraryMediaPlayerControl::skipBackward() { if (!_uniqueLibrary->currentTrack()) { return; } mediaPlayer()->blockSignals(true); if (_uniqueLibrary->playbackModeButton->isChecked()) { if (_uniqueLibrary->randomHistoryList()->isEmpty()) { return; } else { _uniqueLibrary->playSingleTrack(_uniqueLibrary->randomHistoryList()->takeLast()); } } else { QModelIndex current = _uniqueLibrary->proxy()->mapFromSource(_uniqueLibrary->uniqueTable->model()->index(_uniqueLibrary->currentTrack()->row(), 1)); int row = current.row(); while (row >= 0) { QModelIndex previous = current.sibling(row - 1, 1); if (_uniqueLibrary->playSingleTrack(previous)) { _uniqueLibrary->uniqueTable->scrollTo(previous); break; } else { row--; } } } mediaPlayer()->blockSignals(false); }
/** Returns true if current playlist has a plabackMode to Random. */ bool ViewPlaylistsMediaPlayerControl::isInShuffleState() const { if (!mediaPlayer()->playlist()) { return false; } return mediaPlayer()->playlist()->playbackMode() == QMediaPlaylist::Random; }
void UniqueLibraryMediaPlayerControl::togglePlayback() { if (_uniqueLibrary->currentTrack() && mediaPlayer()->state() == QMediaPlayer::StoppedState) { _uniqueLibrary->playSingleTrack(_uniqueLibrary->proxy()->mapFromSource(_uniqueLibrary->currentTrack()->index())); } else { mediaPlayer()->togglePlayback(); } }
void ViewPlaylistsMediaPlayerControl::toggleShuffle(bool checked) { if (checked) { mediaPlayer()->playlist()->setPlaybackMode(QMediaPlaylist::Random); } else { mediaPlayer()->playlist()->setPlaybackMode(QMediaPlaylist::Sequential); } }
void FullScreenVideoQt::exitFullScreenForNode(Node* node) { Q_ASSERT(node); #if USE(QT_MULTIMEDIA) HTMLVideoElement* videoElement = static_cast<HTMLVideoElement*>(node); PlatformMedia platformMedia = videoElement->platformMedia(); ASSERT(platformMedia.type == PlatformMedia::QtMediaPlayerType); if (platformMedia.type != PlatformMedia::QtMediaPlayerType) return; Q_ASSERT(m_FullScreenVideoHandler); if (!m_FullScreenVideoHandler) return; m_FullScreenVideoHandler->exitFullScreen(); MediaPlayerPrivateQt* mediaPlayerQt = mediaPlayer(); mediaPlayerQt->restoreVideoItem(); #endif #if USE(GSTREAMER) m_FullScreenVideoHandlerGStreamer->exitFullScreen(); #endif #if USE(QTKIT) m_FullScreenVideoHandlerQTKit->exitFullScreen(); #endif }
void UniqueLibraryMediaPlayerControl::stop() { if (_uniqueLibrary->currentTrack()) { _uniqueLibrary->currentTrack()->setData(false, Miam::DF_Highlighted); } mediaPlayer()->stop(); }
void UniqueLibraryMediaPlayerControl::skipForward() { mediaPlayer()->blockSignals(true); if (_uniqueLibrary->currentTrack()) { _uniqueLibrary->currentTrack()->setData(false, Miam::DF_Highlighted); // Append to random history the track the player is playing if (_uniqueLibrary->playbackModeButton->isChecked()) { _uniqueLibrary->randomHistoryList()->append(_uniqueLibrary->proxy()->mapFromSource(_uniqueLibrary->currentTrack()->index())); } } if (_uniqueLibrary->playbackModeButton->isChecked()) { int rows = _uniqueLibrary->uniqueTable->model()->rowCount(); if (rows > 0) { int r = rand() % rows; QModelIndex idx = _uniqueLibrary->uniqueTable->model()->index(r, 1); while (_uniqueLibrary->uniqueTable->model()->itemFromIndex(idx)->type() != Miam::IT_Track) { idx = _uniqueLibrary->uniqueTable->model()->index(rand() % rows, 1); } QModelIndex next = _uniqueLibrary->proxy()->mapFromSource(idx); _uniqueLibrary->playSingleTrack(next); } } else { QModelIndex current; if (_uniqueLibrary->currentTrack()) { current = _uniqueLibrary->proxy()->mapFromSource(_uniqueLibrary->uniqueTable->model()->index(_uniqueLibrary->currentTrack()->row(), 1)); } else { current = _uniqueLibrary->proxy()->index(0, 1); } int row = current.row(); while (row < _uniqueLibrary->uniqueTable->model()->rowCount()) { QModelIndex next = current.sibling(row + 1, 1); if (_uniqueLibrary->playSingleTrack(next)) { break; } else { row++; } } } mediaPlayer()->blockSignals(false); }
void VideoLayerWebKitThread::boundsChanged() { if (!mediaPlayer()) return; // For video layers, the entire layer should be hole punched // Hole punch rectangle size is equal to the size of this layer. // Note that although we know the *size* of this layer, we won't know the position of this layer // until the LayerCompositingThread::setDrawTransform method is called from the LayerRenderer. setHolePunchRect(IntRect(IntPoint::zero(), m_bounds)); }
FloatQuad LayerCompositingThread::getTransformedHolePunchRect() const { // FIXME: the following line disables clipping a video in an iframe i.e. the fix associated with PR 99638. // Some revised test case (e.g. video-iframe.html) show that the original fix works correctly when scrolling // the contents of the frame, but fails to clip correctly if the page (main frame) is scrolled. static bool enableVideoClipping = false; if (!mediaPlayer() || !enableVideoClipping) { // m_holePunchClipRect is valid only when there's a media player. return getTransformedRect(m_bounds, m_holePunchRect, m_drawTransform); } // The hole punch rectangle may need to be clipped, // e.g. if the <video> is on a layer that's included and clipped by an <iframe>. // In order to clip we need to determine the current position of this layer, which // is encoded in the m_drawTransform value, which was used to initialize m_drawRect. IntRect drawRect = m_layerRenderer->toWebKitDocumentCoordinates(m_drawRect); // Assert that in this case, where the hole punch rectangle equals the size of the layer, // the drawRect has the same size as the hole punch. // ASSERT(drawRect.size() == m_holePunchRect.size()); // Don't assert it programtically though because there may be off-by-one error due to rounding when there's zooming. // The difference between drawRect and m_holePunchRect is that drawRect has an accurate position // in WebKit document coordinates, whereas the m_holePunchRect location is (0,0) i.e. it's relative to this layer. // Clip the drawRect. // Both drawRect and m_holePunchClipRect already have correct locations, in WebKit document coordinates. IntPoint location = drawRect.location(); drawRect.intersect(m_holePunchClipRect); // Shift the clipped drawRect to have the same kind of located-at-zero position as the original holePunchRect. drawRect.move(-location.x(), -location.y()); #if DEBUG_VIDEO_CLIPPING IntRect drawRectInWebKitDocumentCoordination = m_layerRenderer->toWebKitDocumentCoordinates(m_drawRect); BlackBerry::Platform::log(BlackBerry::Platform::LogLevelInfo, "LayerCompositingThread::getTransformedHolePunchRect() - drawRect=(x=%d,y=%d,width=%d,height=%d) clipRect=(x=%d,y=%d,width=%d,height=%d) clippedRect=(x=%d,y=%d,width=%d,height=%d).", drawRectInWebKitDocumentCoordination.x(), drawRectInWebKitDocumentCoordination.y(), drawRectInWebKitDocumentCoordination.width(), drawRectInWebKitDocumentCoordination.height(), m_holePunchClipRect.x(), m_holePunchClipRect.y(), m_holePunchClipRect.width(), m_holePunchClipRect.height(), drawRect.x(), drawRect.y(), drawRect.width(), drawRect.height()); #endif return getTransformedRect(m_bounds, drawRect, m_drawTransform); }
/** Forward action to MediaPlayer. */ void ViewPlaylistsMediaPlayerControl::togglePlayback() { mediaPlayer()->togglePlayback(); }
/** Forward action to MediaPlayer. */ void ViewPlaylistsMediaPlayerControl::stop() { mediaPlayer()->stop(); }
/** Forward action to MediaPlayer. */ void ViewPlaylistsMediaPlayerControl::skipForward() { if (mediaPlayer()) { mediaPlayer()->skipForward(); } }