summaryrefslogtreecommitdiff
path: root/avmedia
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2013-11-18 16:01:12 +0100
committerStephan Bergmann <sbergman@redhat.com>2013-11-18 17:02:17 +0100
commit6f405e15ec889c09052048b43753bb6a6210d605 (patch)
tree3cc7d2e0c6d20dc071175d112b52015ad53d9fa0 /avmedia
parentc37d7f0d50efbcf1c4ea25c54e7280b2989c35f7 (diff)
Fold MediaWindowBaseImpl into MediaWindowImpl
Change-Id: Ie6366d8b1facb39a5f44279f0c49a229b019bcaa
Diffstat (limited to 'avmedia')
-rw-r--r--avmedia/Library_avmedia.mk1
-rw-r--r--avmedia/source/viewer/mediawindow_impl.cxx301
-rw-r--r--avmedia/source/viewer/mediawindow_impl.hxx68
-rw-r--r--avmedia/source/viewer/mediawindowbase_impl.cxx412
-rw-r--r--avmedia/source/viewer/mediawindowbase_impl.hxx121
5 files changed, 359 insertions, 544 deletions
diff --git a/avmedia/Library_avmedia.mk b/avmedia/Library_avmedia.mk
index eb87e6ce2f80..3c723f19e0e7 100644
--- a/avmedia/Library_avmedia.mk
+++ b/avmedia/Library_avmedia.mk
@@ -49,7 +49,6 @@ $(eval $(call gb_Library_add_exception_objects,avmedia,\
avmedia/source/framework/mediatoolbox \
avmedia/source/framework/soundhandler \
avmedia/source/viewer/mediaevent_impl \
- avmedia/source/viewer/mediawindowbase_impl \
avmedia/source/viewer/mediawindow \
avmedia/source/viewer/mediawindow_impl \
))
diff --git a/avmedia/source/viewer/mediawindow_impl.cxx b/avmedia/source/viewer/mediawindow_impl.cxx
index 32ad2de9a9e3..aa402b3dee86 100644
--- a/avmedia/source/viewer/mediawindow_impl.cxx
+++ b/avmedia/source/viewer/mediawindow_impl.cxx
@@ -25,11 +25,15 @@
#include <algorithm>
#include <cmath>
+
+#include <comphelper/processfactory.hxx>
#include <osl/mutex.hxx>
+#include <tools/urlobj.hxx>
#include <vcl/svapp.hxx>
#include <com/sun/star/awt/SystemPointer.hpp>
#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/media/XManager.hpp>
using namespace ::com::sun::star;
@@ -148,9 +152,9 @@ void MediaChildWindow::Command( const CommandEvent& rCEvt )
MediaWindowImpl::MediaWindowImpl( Window* pParent, MediaWindow* pMediaWindow, bool bInternalMediaControl ) :
Control( pParent ),
- MediaWindowBaseImpl( pMediaWindow ),
DropTargetHelper( this ),
DragSourceHelper( this ),
+ mpMediaWindow( pMediaWindow ),
mxEventsIf( static_cast< ::cppu::OWeakObject* >( mpEvents = new MediaEventListenersImpl( maChildWindow ) ) ),
maChildWindow( this ),
mpMediaWindowControl( bInternalMediaControl ? new MediaWindowControl( this ) : NULL ),
@@ -198,10 +202,301 @@ void MediaWindowImpl::cleanUp()
setPlayerWindow( NULL );
}
- MediaWindowBaseImpl::cleanUp();
+ uno::Reference< lang::XComponent > xComponent( mxPlayer, uno::UNO_QUERY );
+ if( xComponent.is() ) // this stops the player
+ xComponent->dispose();
+
+ mxPlayer.clear();
+
+ mpMediaWindow = NULL;
}
-// ---------------------------------------------------------------------
+uno::Reference< media::XPlayer > MediaWindowImpl::createPlayer( const OUString& rURL )
+{
+ uno::Reference< media::XPlayer > xPlayer;
+ uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
+
+ static const char * aServiceManagers[] = {
+ AVMEDIA_MANAGER_SERVICE_PREFERRED,
+ AVMEDIA_MANAGER_SERVICE_NAME,
+// a fallback path just for gstreamer which has
+// two significant versions deployed at once ...
+#ifdef AVMEDIA_MANAGER_SERVICE_NAME_OLD
+ AVMEDIA_MANAGER_SERVICE_NAME_OLD
+#endif
+ };
+
+ for( sal_uInt32 i = 0; !xPlayer.is() && i < SAL_N_ELEMENTS( aServiceManagers ); ++i )
+ {
+ const OUString aServiceName( aServiceManagers[ i ],
+ strlen( aServiceManagers[ i ] ),
+ RTL_TEXTENCODING_ASCII_US );
+
+ try {
+ uno::Reference< media::XManager > xManager (
+ xContext->getServiceManager()->createInstanceWithContext(aServiceName, xContext),
+ uno::UNO_QUERY );
+ if( xManager.is() )
+ xPlayer = uno::Reference< media::XPlayer >( xManager->createPlayer( rURL ),
+ uno::UNO_QUERY );
+ else
+ SAL_WARN( "avmedia",
+ "failed to create media player service " << aServiceName );
+ } catch ( const uno::Exception &e ) {
+ SAL_WARN( "avmedia",
+ "couldn't create media player " AVMEDIA_MANAGER_SERVICE_NAME
+ ", exception '" << e.Message << '\'');
+ }
+ }
+
+ return xPlayer;
+}
+
+void MediaWindowImpl::setURL( const OUString& rURL,
+ OUString const& rTempURL)
+{
+ if( rURL != getURL() )
+ {
+ if( mxPlayer.is() )
+ mxPlayer->stop();
+
+ if( mxPlayerWindow.is() )
+ {
+ mxPlayerWindow->setVisible( false );
+ mxPlayerWindow.clear();
+ }
+
+ mxPlayer.clear();
+ mTempFileURL = OUString();
+
+ if (!rTempURL.isEmpty())
+ {
+ maFileURL = rURL;
+ mTempFileURL = rTempURL;
+ }
+ else
+ {
+ INetURLObject aURL( rURL );
+
+ if (aURL.GetProtocol() != INET_PROT_NOT_VALID)
+ maFileURL = aURL.GetMainURL(INetURLObject::DECODE_UNAMBIGUOUS);
+ else
+ maFileURL = rURL;
+ }
+
+ mxPlayer = createPlayer(
+ (!mTempFileURL.isEmpty()) ? mTempFileURL : maFileURL );
+ onURLChanged();
+ }
+}
+
+const OUString& MediaWindowImpl::getURL() const
+{
+ return maFileURL;
+}
+
+bool MediaWindowImpl::isValid() const
+{
+ return( getPlayer().is() );
+}
+
+Size MediaWindowImpl::getPreferredSize() const
+{
+ Size aRet;
+
+ if( mxPlayer.is() )
+ {
+ awt::Size aPrefSize( mxPlayer->getPreferredPlayerWindowSize() );
+
+ aRet.Width() = aPrefSize.Width;
+ aRet.Height() = aPrefSize.Height;
+ }
+
+ return aRet;
+}
+
+bool MediaWindowImpl::start()
+{
+ return( mxPlayer.is() ? ( mxPlayer->start(), true ) : false );
+}
+
+void MediaWindowImpl::updateMediaItem( MediaItem& rItem ) const
+{
+ if( isPlaying() )
+ rItem.setState( ( getRate() > 1.0 ) ? MEDIASTATE_PLAYFFW : MEDIASTATE_PLAY );
+ else
+ rItem.setState( ( 0.0 == getMediaTime() ) ? MEDIASTATE_STOP : MEDIASTATE_PAUSE );
+
+ rItem.setDuration( getDuration() );
+ rItem.setTime( getMediaTime() );
+ rItem.setLoop( isPlaybackLoop() );
+ rItem.setMute( isMute() );
+ rItem.setVolumeDB( getVolumeDB() );
+ rItem.setZoom( getZoom() );
+ rItem.setURL( getURL(), &mTempFileURL );
+}
+
+void MediaWindowImpl::executeMediaItem( const MediaItem& rItem )
+{
+ const sal_uInt32 nMaskSet = rItem.getMaskSet();
+
+ // set URL first
+ if( nMaskSet & AVMEDIA_SETMASK_URL )
+ setURL( rItem.getURL(), rItem.getTempURL() );
+
+ // set different states next
+ if( nMaskSet & AVMEDIA_SETMASK_TIME )
+ setMediaTime( ::std::min( rItem.getTime(), getDuration() ) );
+
+ if( nMaskSet & AVMEDIA_SETMASK_LOOP )
+ setPlaybackLoop( rItem.isLoop() );
+
+ if( nMaskSet & AVMEDIA_SETMASK_MUTE )
+ setMute( rItem.isMute() );
+
+ if( nMaskSet & AVMEDIA_SETMASK_VOLUMEDB )
+ setVolumeDB( rItem.getVolumeDB() );
+
+ if( nMaskSet & AVMEDIA_SETMASK_ZOOM )
+ setZoom( rItem.getZoom() );
+
+ // set play state at last
+ if( nMaskSet & AVMEDIA_SETMASK_STATE )
+ {
+ switch( rItem.getState() )
+ {
+ case( MEDIASTATE_PLAY ):
+ case( MEDIASTATE_PLAYFFW ):
+ {
+
+ if( !isPlaying() )
+ start();
+ }
+ break;
+
+ case( MEDIASTATE_PAUSE ):
+ {
+ if( isPlaying() )
+ stop();
+ }
+ break;
+
+ case( MEDIASTATE_STOP ):
+ {
+ if( isPlaying() )
+ {
+ setMediaTime( 0.0 );
+ stop();
+ setMediaTime( 0.0 );
+ }
+ }
+ break;
+ }
+ }
+}
+
+bool MediaWindowImpl::setZoom( ::com::sun::star::media::ZoomLevel eLevel )
+{
+ return( mxPlayerWindow.is() ? mxPlayerWindow->setZoomLevel( eLevel ) : false );
+}
+
+::com::sun::star::media::ZoomLevel MediaWindowImpl::getZoom() const
+{
+ return( mxPlayerWindow.is() ? mxPlayerWindow->getZoomLevel() : media::ZoomLevel_NOT_AVAILABLE );
+}
+
+void MediaWindowImpl::stop()
+{
+ if( mxPlayer.is() )
+ mxPlayer->stop();
+}
+
+bool MediaWindowImpl::isPlaying() const
+{
+ return( mxPlayer.is() && mxPlayer->isPlaying() );
+}
+
+double MediaWindowImpl::getDuration() const
+{
+ return( mxPlayer.is() ? mxPlayer->getDuration() : 0.0 );
+}
+
+void MediaWindowImpl::setMediaTime( double fTime )
+{
+ if( mxPlayer.is() )
+ mxPlayer->setMediaTime( fTime );
+}
+
+double MediaWindowImpl::getMediaTime() const
+{
+ return( mxPlayer.is() ? mxPlayer->getMediaTime() : 0.0 );
+}
+
+double MediaWindowImpl::getRate() const
+{
+ return( mxPlayer.is() ? mxPlayer->getRate() : 0.0 );
+}
+
+void MediaWindowImpl::setPlaybackLoop( bool bSet )
+{
+ if( mxPlayer.is() )
+ mxPlayer->setPlaybackLoop( bSet );
+}
+
+bool MediaWindowImpl::isPlaybackLoop() const
+{
+ return( mxPlayer.is() ? mxPlayer->isPlaybackLoop() : false );
+}
+
+void MediaWindowImpl::setMute( bool bSet )
+{
+ if( mxPlayer.is() )
+ mxPlayer->setMute( bSet );
+}
+
+bool MediaWindowImpl::isMute() const
+{
+ return( mxPlayer.is() ? mxPlayer->isMute() : false );
+}
+
+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() )
+ {
+ bStop ? mxPlayer->stop() : mxPlayer->start();
+ }
+}
+
+MediaWindow* MediaWindowImpl::getMediaWindow() const
+{
+ return mpMediaWindow;
+}
+
+uno::Reference< media::XPlayer > MediaWindowImpl::getPlayer() const
+{
+ return mxPlayer;
+}
+
+void MediaWindowImpl::setPlayerWindow( const uno::Reference< media::XPlayerWindow >& rxPlayerWindow )
+{
+ mxPlayerWindow = rxPlayerWindow;
+}
+
+uno::Reference< media::XPlayerWindow > MediaWindowImpl::getPlayerWindow() const
+{
+ return mxPlayerWindow;
+}
void MediaWindowImpl::onURLChanged()
{
diff --git a/avmedia/source/viewer/mediawindow_impl.hxx b/avmedia/source/viewer/mediawindow_impl.hxx
index fe793170a010..9c9d8142fcdf 100644
--- a/avmedia/source/viewer/mediawindow_impl.hxx
+++ b/avmedia/source/viewer/mediawindow_impl.hxx
@@ -23,13 +23,18 @@
#include <svtools/transfer.hxx>
#include <vcl/syschild.hxx>
-#include "mediawindowbase_impl.hxx"
#include "mediacontrol.hxx"
+namespace com { namespace sun { namespace star { namespace media {
+ class XPlayer;
+ class XPlayerWindow;
+} } } }
class BitmapEx;
namespace avmedia
{
+ class MediaWindow;
+
namespace priv
{
// ----------------------
@@ -77,7 +82,6 @@ namespace avmedia
class MediaEventListenersImpl;
class MediaWindowImpl : public Control,
- public MediaWindowBaseImpl,
public DropTargetHelper,
public DragSourceHelper
@@ -87,16 +91,28 @@ namespace avmedia
MediaWindowImpl( Window* parent, MediaWindow* pMediaWindow, bool bInternalMediaControl );
virtual ~MediaWindowImpl();
- virtual void cleanUp();
- virtual void onURLChanged();
+ void cleanUp();
- public:
+ static ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > createPlayer( const OUString& rURL );
+
+ void setURL( const OUString& rURL, OUString const& rTempURL );
+
+ const OUString& getURL() const;
+
+ bool isValid() const;
+
+ Size getPreferredSize() const;
+
+ bool start();
+
+ void updateMediaItem( MediaItem& rItem ) const;
+ void executeMediaItem( const MediaItem& rItem );
void setPosSize( const Rectangle& rRect );
void setPointer( const Pointer& rPointer );
- protected:
+ private:
// Window
virtual void MouseMove( const MouseEvent& rMEvt );
@@ -117,7 +133,45 @@ namespace avmedia
// DragSourceHelper
virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel );
- private:
+ bool setZoom( ::com::sun::star::media::ZoomLevel eLevel );
+ ::com::sun::star::media::ZoomLevel getZoom() const;
+
+ void stop();
+
+ bool isPlaying() const;
+
+ double getDuration() const;
+
+ void setMediaTime( double fTime );
+ double getMediaTime() const;
+
+ double getRate() 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 );
+
+ MediaWindow* getMediaWindow() const;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > getPlayer() const;
+
+ void setPlayerWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayerWindow >& rxPlayerWindow );
+ ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayerWindow > getPlayerWindow() const;
+
+ void onURLChanged();
+
+ OUString maFileURL;
+ OUString mTempFileURL;
+ ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > mxPlayer;
+ ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayerWindow > mxPlayerWindow;
+ MediaWindow* mpMediaWindow;
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxEventsIf;
MediaEventListenersImpl* mpEvents;
diff --git a/avmedia/source/viewer/mediawindowbase_impl.cxx b/avmedia/source/viewer/mediawindowbase_impl.cxx
deleted file mode 100644
index e8b4e896753e..000000000000
--- a/avmedia/source/viewer/mediawindowbase_impl.cxx
+++ /dev/null
@@ -1,412 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include "mediawindowbase_impl.hxx"
-#include <avmedia/mediaitem.hxx>
-#include "mediamisc.hxx"
-#include "mediawindow.hrc"
-#include <rtl/ustring.hxx>
-#include <tools/urlobj.hxx>
-#include <comphelper/processfactory.hxx>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/lang/XComponent.hpp>
-#include <com/sun/star/media/XManager.hpp>
-
-using namespace ::com::sun::star;
-
-namespace avmedia { namespace priv {
-
-// -----------------------
-// - MediaWindowBaseImpl -
-// -----------------------
-
-
-MediaWindowBaseImpl::MediaWindowBaseImpl( MediaWindow* pMediaWindow )
- : mpMediaWindow( pMediaWindow )
-{
-}
-
-// ---------------------------------------------------------------------
-
-MediaWindowBaseImpl::~MediaWindowBaseImpl()
-{
-}
-
-// -------------------------------------------------------------------------
-
-uno::Reference< media::XPlayer > MediaWindowBaseImpl::createPlayer( const OUString& rURL )
-{
- uno::Reference< media::XPlayer > xPlayer;
- uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
-
- static const char * aServiceManagers[] = {
- AVMEDIA_MANAGER_SERVICE_PREFERRED,
- AVMEDIA_MANAGER_SERVICE_NAME,
-// a fallback path just for gstreamer which has
-// two significant versions deployed at once ...
-#ifdef AVMEDIA_MANAGER_SERVICE_NAME_OLD
- AVMEDIA_MANAGER_SERVICE_NAME_OLD
-#endif
- };
-
- for( sal_uInt32 i = 0; !xPlayer.is() && i < SAL_N_ELEMENTS( aServiceManagers ); ++i )
- {
- const OUString aServiceName( aServiceManagers[ i ],
- strlen( aServiceManagers[ i ] ),
- RTL_TEXTENCODING_ASCII_US );
-
- try {
- uno::Reference< media::XManager > xManager (
- xContext->getServiceManager()->createInstanceWithContext(aServiceName, xContext),
- uno::UNO_QUERY );
- if( xManager.is() )
- xPlayer = uno::Reference< media::XPlayer >( xManager->createPlayer( rURL ),
- uno::UNO_QUERY );
- else
- SAL_WARN( "avmedia",
- "failed to create media player service " << aServiceName );
- } catch ( const uno::Exception &e ) {
- SAL_WARN( "avmedia",
- "couldn't create media player " AVMEDIA_MANAGER_SERVICE_NAME
- ", exception '" << e.Message << '\'');
- }
- }
-
- return xPlayer;
-}
-
-void MediaWindowBaseImpl::setURL( const OUString& rURL,
- OUString const& rTempURL)
-{
- if( rURL != getURL() )
- {
- if( mxPlayer.is() )
- mxPlayer->stop();
-
- if( mxPlayerWindow.is() )
- {
- mxPlayerWindow->setVisible( false );
- mxPlayerWindow.clear();
- }
-
- mxPlayer.clear();
- mTempFileURL = OUString();
-
- if (!rTempURL.isEmpty())
- {
- maFileURL = rURL;
- mTempFileURL = rTempURL;
- }
- else
- {
- INetURLObject aURL( rURL );
-
- if (aURL.GetProtocol() != INET_PROT_NOT_VALID)
- maFileURL = aURL.GetMainURL(INetURLObject::DECODE_UNAMBIGUOUS);
- else
- maFileURL = rURL;
- }
-
- mxPlayer = createPlayer(
- (!mTempFileURL.isEmpty()) ? mTempFileURL : maFileURL );
- onURLChanged();
- }
-}
-
-// ---------------------------------------------------------------------
-
-void MediaWindowBaseImpl::onURLChanged()
-{
-}
-
-// ---------------------------------------------------------------------
-
-const OUString& MediaWindowBaseImpl::getURL() const
-{
- return maFileURL;
-}
-
-// ---------------------------------------------------------------------
-
-bool MediaWindowBaseImpl::isValid() const
-{
- return( getPlayer().is() );
-}
-
-// ---------------------------------------------------------------------
-
-void MediaWindowBaseImpl::stopPlayingInternal( bool bStop )
-{
- if( isPlaying() )
- {
- bStop ? mxPlayer->stop() : mxPlayer->start();
- }
-}
-
-// ---------------------------------------------------------------------
-
-MediaWindow* MediaWindowBaseImpl::getMediaWindow() const
-{
- return mpMediaWindow;
-}
-
-// ---------------------------------------------------------------------
-
-uno::Reference< media::XPlayer > MediaWindowBaseImpl::getPlayer() const
-{
- return mxPlayer;
-}
-
-// ---------------------------------------------------------------------
-
-uno::Reference< media::XPlayerWindow > MediaWindowBaseImpl::getPlayerWindow() const
-{
- return mxPlayerWindow;
-}
-
-// ---------------------------------------------------------------------
-
-void MediaWindowBaseImpl::setPlayerWindow( const uno::Reference< media::XPlayerWindow >& rxPlayerWindow )
-{
- mxPlayerWindow = rxPlayerWindow;
-}
-
-// ---------------------------------------------------------------------
-
-void MediaWindowBaseImpl::cleanUp()
-{
- uno::Reference< lang::XComponent > xComponent( mxPlayer, uno::UNO_QUERY );
- if( xComponent.is() ) // this stops the player
- xComponent->dispose();
-
- mxPlayer.clear();
-
- mpMediaWindow = NULL;
-}
-
-// ---------------------------------------------------------------------
-
-Size MediaWindowBaseImpl::getPreferredSize() const
-{
- Size aRet;
-
- if( mxPlayer.is() )
- {
- awt::Size aPrefSize( mxPlayer->getPreferredPlayerWindowSize() );
-
- aRet.Width() = aPrefSize.Width;
- aRet.Height() = aPrefSize.Height;
- }
-
- return aRet;
-}
-
-// ---------------------------------------------------------------------
-
-bool MediaWindowBaseImpl::setZoom( ::com::sun::star::media::ZoomLevel eLevel )
-{
- return( mxPlayerWindow.is() ? mxPlayerWindow->setZoomLevel( eLevel ) : false );
-}
-
-// -------------------------------------------------------------------------
-
-::com::sun::star::media::ZoomLevel MediaWindowBaseImpl::getZoom() const
-{
- return( mxPlayerWindow.is() ? mxPlayerWindow->getZoomLevel() : media::ZoomLevel_NOT_AVAILABLE );
-}
-
-// ---------------------------------------------------------------------
-
-bool MediaWindowBaseImpl::start()
-{
- return( mxPlayer.is() ? ( mxPlayer->start(), true ) : false );
-}
-
-// ---------------------------------------------------------------------
-
-void MediaWindowBaseImpl::stop()
-{
- if( mxPlayer.is() )
- mxPlayer->stop();
-}
-
-// ---------------------------------------------------------------------
-
-bool MediaWindowBaseImpl::isPlaying() const
-{
- return( mxPlayer.is() && mxPlayer->isPlaying() );
-}
-
-// ---------------------------------------------------------------------
-
-double MediaWindowBaseImpl::getDuration() const
-{
- return( mxPlayer.is() ? mxPlayer->getDuration() : 0.0 );
-}
-
-// ---------------------------------------------------------------------
-
-void MediaWindowBaseImpl::setMediaTime( double fTime )
-{
- if( mxPlayer.is() )
- mxPlayer->setMediaTime( fTime );
-}
-
-// ---------------------------------------------------------------------
-
-double MediaWindowBaseImpl::getMediaTime() const
-{
- return( mxPlayer.is() ? mxPlayer->getMediaTime() : 0.0 );
-}
-
-// ---------------------------------------------------------------------
-
-double MediaWindowBaseImpl::getRate() const
-{
- return( mxPlayer.is() ? mxPlayer->getRate() : 0.0 );
-}
-
-// ---------------------------------------------------------------------
-
-void MediaWindowBaseImpl::setPlaybackLoop( bool bSet )
-{
- if( mxPlayer.is() )
- mxPlayer->setPlaybackLoop( bSet );
-}
-
-// ---------------------------------------------------------------------
-
-bool MediaWindowBaseImpl::isPlaybackLoop() const
-{
- return( mxPlayer.is() ? mxPlayer->isPlaybackLoop() : false );
-}
-
-// ---------------------------------------------------------------------
-
-void MediaWindowBaseImpl::setMute( bool bSet )
-{
- if( mxPlayer.is() )
- mxPlayer->setMute( bSet );
-}
-
-// ---------------------------------------------------------------------
-
-bool MediaWindowBaseImpl::isMute() const
-{
- return( mxPlayer.is() ? mxPlayer->isMute() : false );
-}
-
-// ---------------------------------------------------------------------
-
-void MediaWindowBaseImpl::setVolumeDB( sal_Int16 nVolumeDB )
-{
- if( mxPlayer.is() )
- mxPlayer->setVolumeDB( nVolumeDB );
-}
-
-// ---------------------------------------------------------------------
-
-sal_Int16 MediaWindowBaseImpl::getVolumeDB() const
-{
- return( mxPlayer.is() ? mxPlayer->getVolumeDB() : 0 );
-}
-
-// -------------------------------------------------------------------------
-
-void MediaWindowBaseImpl::updateMediaItem( MediaItem& rItem ) const
-{
- if( isPlaying() )
- rItem.setState( ( getRate() > 1.0 ) ? MEDIASTATE_PLAYFFW : MEDIASTATE_PLAY );
- else
- rItem.setState( ( 0.0 == getMediaTime() ) ? MEDIASTATE_STOP : MEDIASTATE_PAUSE );
-
- rItem.setDuration( getDuration() );
- rItem.setTime( getMediaTime() );
- rItem.setLoop( isPlaybackLoop() );
- rItem.setMute( isMute() );
- rItem.setVolumeDB( getVolumeDB() );
- rItem.setZoom( getZoom() );
- rItem.setURL( getURL(), &mTempFileURL );
-}
-
-// -------------------------------------------------------------------------
-
-void MediaWindowBaseImpl::executeMediaItem( const MediaItem& rItem )
-{
- const sal_uInt32 nMaskSet = rItem.getMaskSet();
-
- // set URL first
- if( nMaskSet & AVMEDIA_SETMASK_URL )
- setURL( rItem.getURL(), rItem.getTempURL() );
-
- // set different states next
- if( nMaskSet & AVMEDIA_SETMASK_TIME )
- setMediaTime( ::std::min( rItem.getTime(), getDuration() ) );
-
- if( nMaskSet & AVMEDIA_SETMASK_LOOP )
- setPlaybackLoop( rItem.isLoop() );
-
- if( nMaskSet & AVMEDIA_SETMASK_MUTE )
- setMute( rItem.isMute() );
-
- if( nMaskSet & AVMEDIA_SETMASK_VOLUMEDB )
- setVolumeDB( rItem.getVolumeDB() );
-
- if( nMaskSet & AVMEDIA_SETMASK_ZOOM )
- setZoom( rItem.getZoom() );
-
- // set play state at last
- if( nMaskSet & AVMEDIA_SETMASK_STATE )
- {
- switch( rItem.getState() )
- {
- case( MEDIASTATE_PLAY ):
- case( MEDIASTATE_PLAYFFW ):
- {
-
- if( !isPlaying() )
- start();
- }
- break;
-
- case( MEDIASTATE_PAUSE ):
- {
- if( isPlaying() )
- stop();
- }
- break;
-
- case( MEDIASTATE_STOP ):
- {
- if( isPlaying() )
- {
- setMediaTime( 0.0 );
- stop();
- setMediaTime( 0.0 );
- }
- }
- break;
- }
- }
-}
-
-} // namespace priv
-} // namespace avemdia
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/avmedia/source/viewer/mediawindowbase_impl.hxx b/avmedia/source/viewer/mediawindowbase_impl.hxx
deleted file mode 100644
index a13136cc4034..000000000000
--- a/avmedia/source/viewer/mediawindowbase_impl.hxx
+++ /dev/null
@@ -1,121 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef AVMEDIA_MEDIAWINDOWBASE_IMPL_HXX
-#define AVMEDIA_MEDIAWINDOWBASE_IMPL_HXX
-
-#include <avmedia/mediawindow.hxx>
-
-#include <com/sun/star/media/XPlayer.hpp>
-#include <com/sun/star/media/XPlayerWindow.hpp>
-
-
-namespace avmedia
-{
- namespace priv
- {
- // --------------
- // - UpdateMode -
- // --------------
-
- enum UpdateMode
- {
- UPDATEMODE_SYNC_STATUSBAR = 0,
- UPDATEMODE_SYNC_PLAYER = 1,
- UPDATEMODE_SYNC_NONE = 2
- };
-
- // -----------------------
- // - MediaWindowBaseImpl -
- // -----------------------
-
- class MediaWindowBaseImpl
- {
- public:
-
- MediaWindowBaseImpl( MediaWindow* pMediaWindow );
- virtual ~MediaWindowBaseImpl();
-
- virtual void cleanUp();
- virtual void onURLChanged();
-
- static ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > createPlayer( const OUString& rURL );
-
- void setURL( const OUString& rURL, OUString const& rTempURL );
-
- const OUString& getURL() const;
-
- bool isValid() const;
-
- Size getPreferredSize() const;
-
- bool setZoom( ::com::sun::star::media::ZoomLevel eLevel );
- ::com::sun::star::media::ZoomLevel getZoom() const;
-
- bool start();
- void stop();
-
- bool isPlaying() const;
-
- double getDuration() const;
-
- void setMediaTime( double fTime );
- double getMediaTime() const;
-
- double getRate() const;
-
- void setPlaybackLoop( bool bSet );
- bool isPlaybackLoop() const;
-
- void setFixedAspectRatio( bool bSet );
- bool isFixedAspectRatio() const;
-
- void setMute( bool bSet );
- bool isMute() const;
-
- void setVolumeDB( sal_Int16 nVolumeDB );
- sal_Int16 getVolumeDB() const;
-
- void updateMediaItem( MediaItem& rItem ) const;
- void executeMediaItem( const MediaItem& rItem );
-
- protected:
-
- void stopPlayingInternal( bool );
-
- MediaWindow* getMediaWindow() const;
-
- ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > getPlayer() const;
-
- void setPlayerWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayerWindow >& rxPlayerWindow );
- ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayerWindow > getPlayerWindow() const;
-
- private:
- OUString maFileURL;
- OUString mTempFileURL;
- ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > mxPlayer;
- ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayerWindow > mxPlayerWindow;
- MediaWindow* mpMediaWindow;
- };
- }
-}
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */