[Libreoffice-commits] core.git: avmedia/source

Noel Grandin noel.grandin at collabora.co.uk
Wed Nov 2 07:13:43 UTC 2016


 avmedia/source/viewer/mediawindow_impl.cxx |   67 +++++------------------------
 avmedia/source/viewer/mediawindow_impl.hxx |   12 -----
 2 files changed, 12 insertions(+), 67 deletions(-)

New commits:
commit 2db81e733610331bc0f84d72f7e49db9af92949c
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Tue Nov 1 16:45:26 2016 +0200

    loplugin:expandablemethods in avmedia
    
    Change-Id: I215230d3b7e3649146083f00e7c10c03a4d3154e
    Reviewed-on: https://gerrit.libreoffice.org/30470
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    Tested-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/avmedia/source/viewer/mediawindow_impl.cxx b/avmedia/source/viewer/mediawindow_impl.cxx
index 1bd55af..d002801 100644
--- a/avmedia/source/viewer/mediawindow_impl.cxx
+++ b/avmedia/source/viewer/mediawindow_impl.cxx
@@ -334,10 +334,10 @@ void MediaWindowImpl::updateMediaItem( MediaItem& rItem ) const
 
     rItem.setDuration( getDuration() );
     rItem.setTime( getMediaTime() );
-    rItem.setLoop( isPlaybackLoop() );
-    rItem.setMute( isMute() );
-    rItem.setVolumeDB( getVolumeDB() );
-    rItem.setZoom( getZoom() );
+    rItem.setLoop( mxPlayer.is() && mxPlayer->isPlaybackLoop() );
+    rItem.setMute( mxPlayer.is() && mxPlayer->isMute() );
+    rItem.setVolumeDB( mxPlayer.is() ? mxPlayer->getVolumeDB() : 0 );
+    rItem.setZoom( mxPlayerWindow.is() ? mxPlayerWindow->getZoomLevel() : media::ZoomLevel_NOT_AVAILABLE );
     rItem.setURL( getURL(), mTempFileURL, maReferer );
 }
 
@@ -356,17 +356,17 @@ void MediaWindowImpl::executeMediaItem( const MediaItem& rItem )
     if (nMaskSet & AVMediaSetMask::TIME)
         setMediaTime(std::min(rItem.getTime(), getDuration()));
 
-    if (nMaskSet & AVMediaSetMask::LOOP)
-        setPlaybackLoop(rItem.isLoop());
+    if (nMaskSet & AVMediaSetMask::LOOP && mxPlayer.is() )
+        mxPlayer->setPlaybackLoop( rItem.isLoop() );
 
-    if (nMaskSet & AVMediaSetMask::MUTE)
-        setMute(rItem.isMute());
+    if (nMaskSet & AVMediaSetMask::MUTE && mxPlayer.is() )
+        mxPlayer->setMute( rItem.isMute() );
 
-    if (nMaskSet & AVMediaSetMask::VOLUMEDB)
-        setVolumeDB(rItem.getVolumeDB());
+    if (nMaskSet & AVMediaSetMask::VOLUMEDB && mxPlayer.is() )
+        mxPlayer->setVolumeDB( rItem.getVolumeDB() );
 
-    if (nMaskSet & AVMediaSetMask::ZOOM)
-        setZoom(rItem.getZoom());
+    if (nMaskSet & AVMediaSetMask::ZOOM && mxPlayerWindow.is() )
+        mxPlayerWindow->setZoomLevel( rItem.getZoom() );
 
     // set play state at last
     if (nMaskSet & AVMediaSetMask::STATE)
@@ -401,16 +401,6 @@ void MediaWindowImpl::executeMediaItem( const MediaItem& rItem )
     }
 }
 
-bool MediaWindowImpl::setZoom(css::media::ZoomLevel eLevel)
-{
-    return mxPlayerWindow.is() && mxPlayerWindow->setZoomLevel( eLevel );
-}
-
-css::media::ZoomLevel MediaWindowImpl::getZoom() const
-{
-    return( mxPlayerWindow.is() ? mxPlayerWindow->getZoomLevel() : media::ZoomLevel_NOT_AVAILABLE );
-}
-
 void MediaWindowImpl::stop()
 {
     if( mxPlayer.is() )
@@ -438,39 +428,6 @@ double MediaWindowImpl::getMediaTime() const
     return( mxPlayer.is() ? mxPlayer->getMediaTime() : 0.0 );
 }
 
-void MediaWindowImpl::setPlaybackLoop( bool bSet )
-{
-    if( mxPlayer.is() )
-        mxPlayer->setPlaybackLoop( bSet );
-}
-
-bool MediaWindowImpl::isPlaybackLoop() const
-{
-    return mxPlayer.is() && mxPlayer->isPlaybackLoop();
-}
-
-void MediaWindowImpl::setMute( bool bSet )
-{
-    if( mxPlayer.is() )
-        mxPlayer->setMute( bSet );
-}
-
-bool MediaWindowImpl::isMute() const
-{
-    return mxPlayer.is() && mxPlayer->isMute();
-}
-
-void MediaWindowImpl::setVolumeDB( sal_Int16 nVolumeDB )
-{
-    if( mxPlayer.is() )
-        mxPlayer->setVolumeDB( nVolumeDB );
-}
-
-sal_Int16 MediaWindowImpl::getVolumeDB() const
-{
-    return (mxPlayer.is() ? mxPlayer->getVolumeDB() : 0);
-}
-
 void MediaWindowImpl::stopPlayingInternal(bool bStop)
 {
     if (isPlaying())
diff --git a/avmedia/source/viewer/mediawindow_impl.hxx b/avmedia/source/viewer/mediawindow_impl.hxx
index 5438071..649a998 100644
--- a/avmedia/source/viewer/mediawindow_impl.hxx
+++ b/avmedia/source/viewer/mediawindow_impl.hxx
@@ -123,9 +123,6 @@ private:
     // DragSourceHelper
     virtual void    StartDrag( sal_Int8 nAction, const Point& rPosPixel ) override;
 
-    bool setZoom(css::media::ZoomLevel eLevel);
-    css::media::ZoomLevel getZoom() const;
-
     void stop();
 
     bool isPlaying() const;
@@ -135,15 +132,6 @@ private:
     void setMediaTime( double fTime );
     double getMediaTime() const;
 
-    void setPlaybackLoop( bool bSet );
-    bool isPlaybackLoop() const;
-
-    void setMute( bool bSet );
-    bool isMute() const;
-
-    void setVolumeDB( sal_Int16 nVolumeDB );
-    sal_Int16 getVolumeDB() const;
-
     void stopPlayingInternal( bool );
 
     void onURLChanged();


More information about the Libreoffice-commits mailing list