diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2005-03-23 11:29:58 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2005-03-23 11:29:58 +0000 |
commit | 9246a11fb56dbc2a09d488390b76069ed852acd1 (patch) | |
tree | 3f3848daa249bba1fdfca20dad5d6b8a6bd16b7e /avmedia | |
parent | 79b87e7e43e771ac8e9a7898cfd8c38cff42b303 (diff) |
INTEGRATION: CWS jmf5 (1.2.6); FILE MERGED
2005/01/24 13:22:44 ka 1.2.6.5: syntax
2005/01/24 10:05:37 ka 1.2.6.4: #i37255#: adjust default frame time
2005/01/21 14:26:10 ka 1.2.6.3: #i37255#: use FrameGrabber
2005/01/20 15:20:03 ka 1.2.6.2: #i37255#: added FrameGrabber implementation
2004/12/23 15:15:15 ka 1.2.6.1: added FrameGrabber
Diffstat (limited to 'avmedia')
-rw-r--r-- | avmedia/source/viewer/mediawindow.cxx | 61 |
1 files changed, 54 insertions, 7 deletions
diff --git a/avmedia/source/viewer/mediawindow.cxx b/avmedia/source/viewer/mediawindow.cxx index d734a57c6792..7ec9b4355bce 100644 --- a/avmedia/source/viewer/mediawindow.cxx +++ b/avmedia/source/viewer/mediawindow.cxx @@ -2,9 +2,9 @@ * * $RCSfile: mediawindow.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: rt $ $Date: 2004-11-26 21:07:01 $ + * last change: $Author: vg $ $Date: 2005-03-23 12:29:58 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -80,6 +80,8 @@ #include <com/sun/star/media/XManager.hpp> #endif +#define AVMEDIA_FRAMEGRABBER_DEFAULTFRAME_MEDIATIME 3.0 + using namespace ::com::sun::star; namespace avmedia { @@ -425,7 +427,7 @@ void MediaWindow::getMediaFilters( FilterNameVector& rFilterNameVector ) bool MediaWindow::executeMediaURLDialog( Window* pParent, ::rtl::OUString& rURL, bool bInsertDialog ) { - ::sfx2::FileDialogHelper aDlg( ::sfx2::FILEOPEN_SIMPLE, 0 ); + ::sfx2::FileDialogHelper aDlg( ::sfx2::FILEOPEN_SIMPLE, 0 ); static const ::rtl::OUString aWildcard( RTL_CONSTASCII_USTRINGPARAM( "*." ) ); FilterNameVector aFilters; const ::rtl::OUString aSeparator( RTL_CONSTASCII_USTRINGPARAM( ";" ) ); @@ -521,10 +523,6 @@ bool MediaWindow::isMediaURL( const ::rtl::OUString& rURL, bool bDeep, Size* pPr { const awt::Size aAwtSize( xPlayer->getPreferredPlayerWindowSize() ); -#ifdef DEBUG - fprintf( stderr, "Media size: %d x %d\n", aAwtSize.Width, aAwtSize.Height ); -#endif - pPreferredSizePixel->Width() = aAwtSize.Width; pPreferredSizePixel->Height() = aAwtSize.Height; } @@ -564,4 +562,53 @@ uno::Reference< media::XPlayer > MediaWindow::createPlayer( const ::rtl::OUStrin return priv::MediaWindowImpl::createPlayer( rURL ); } +// ------------------------------------------------------------------------- + +uno::Reference< graphic::XGraphic > MediaWindow::grabFrame( const ::rtl::OUString& rURL, + bool bAllowToCreateReplacementGraphic, + double fMediaTime ) +{ + uno::Reference< media::XPlayer > xPlayer( createPlayer( rURL ) ); + uno::Reference< graphic::XGraphic > xRet; + ::std::auto_ptr< Graphic > apGraphic; + + if( xPlayer.is() ) + { + uno::Reference< media::XFrameGrabber > xGrabber( xPlayer->createFrameGrabber() ); + + if( xGrabber.is() ) + { + if( AVMEDIA_FRAMEGRABBER_DEFAULTFRAME == fMediaTime ) + fMediaTime = AVMEDIA_FRAMEGRABBER_DEFAULTFRAME_MEDIATIME; + + if( fMediaTime >= xPlayer->getDuration() ) + fMediaTime = ( xPlayer->getDuration() * 0.5 ); + + xRet = xGrabber->grabFrame( fMediaTime ); + } + + if( !xRet.is() && bAllowToCreateReplacementGraphic ) + { + awt::Size aPrefSize( xPlayer->getPreferredPlayerWindowSize() ); + + if( !aPrefSize.Width && !aPrefSize.Height ) + { + const BitmapEx aBmpEx( AVMEDIA_RESID( AVMEDIA_BMP_AUDIOLOGO ) ); + apGraphic.reset( new Graphic( aBmpEx ) ); + } + } + } + + if( !xRet.is() && !apGraphic.get() && bAllowToCreateReplacementGraphic ) + { + const BitmapEx aBmpEx( AVMEDIA_RESID( AVMEDIA_BMP_EMPTYLOGO ) ); + apGraphic.reset( new Graphic( aBmpEx ) ); + } + + if( apGraphic.get() ) + xRet = apGraphic->GetXGraphic(); + + return xRet; +} + } // namespace avemdia |