diff options
Diffstat (limited to 'avmedia/source/viewer')
-rwxr-xr-x[-rw-r--r--] | avmedia/source/viewer/makefile.mk | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | avmedia/source/viewer/mediaevent_impl.cxx | 4 | ||||
-rwxr-xr-x[-rw-r--r--] | avmedia/source/viewer/mediaevent_impl.hxx | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | avmedia/source/viewer/mediawindow.cxx | 42 | ||||
-rwxr-xr-x[-rw-r--r--] | avmedia/source/viewer/mediawindow.hrc | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | avmedia/source/viewer/mediawindow.src | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | avmedia/source/viewer/mediawindow_impl.cxx | 107 | ||||
-rwxr-xr-x[-rw-r--r--] | avmedia/source/viewer/mediawindow_impl.hxx | 45 | ||||
-rwxr-xr-x[-rw-r--r--] | avmedia/source/viewer/mediawindowbase_impl.cxx | 6 | ||||
-rwxr-xr-x[-rw-r--r--] | avmedia/source/viewer/mediawindowbase_impl.hxx | 4 |
10 files changed, 75 insertions, 133 deletions
diff --git a/avmedia/source/viewer/makefile.mk b/avmedia/source/viewer/makefile.mk index 7771d1eb05..7771d1eb05 100644..100755 --- a/avmedia/source/viewer/makefile.mk +++ b/avmedia/source/viewer/makefile.mk diff --git a/avmedia/source/viewer/mediaevent_impl.cxx b/avmedia/source/viewer/mediaevent_impl.cxx index 1d96dc9245..1bdca46406 100644..100755 --- a/avmedia/source/viewer/mediaevent_impl.cxx +++ b/avmedia/source/viewer/mediaevent_impl.cxx @@ -118,7 +118,7 @@ void SAL_CALL MediaEventListenersImpl::mousePressed( const ::com::sun::star::awt if( mpNotifyWindow ) { MouseEvent aVCLMouseEvt( Point( e.X, e.Y ), - sal::static_int_cast< USHORT >(e.ClickCount), + sal::static_int_cast< sal_uInt16 >(e.ClickCount), 0, ( ( e.Buttons & 1 ) ? MOUSE_LEFT : 0 ) | ( ( e.Buttons & 2 ) ? MOUSE_RIGHT : 0 ) | @@ -139,7 +139,7 @@ void SAL_CALL MediaEventListenersImpl::mouseReleased( const ::com::sun::star::aw if( mpNotifyWindow ) { MouseEvent aVCLMouseEvt( Point( e.X, e.Y ), - sal::static_int_cast< USHORT >(e.ClickCount), + sal::static_int_cast< sal_uInt16 >(e.ClickCount), 0, ( ( e.Buttons & 1 ) ? MOUSE_LEFT : 0 ) | ( ( e.Buttons & 2 ) ? MOUSE_RIGHT : 0 ) | diff --git a/avmedia/source/viewer/mediaevent_impl.hxx b/avmedia/source/viewer/mediaevent_impl.hxx index 7246eb7b36..7246eb7b36 100644..100755 --- a/avmedia/source/viewer/mediaevent_impl.hxx +++ b/avmedia/source/viewer/mediaevent_impl.hxx diff --git a/avmedia/source/viewer/mediawindow.cxx b/avmedia/source/viewer/mediawindow.cxx index 2e20eadb97..1bec5100c5 100644..100755 --- a/avmedia/source/viewer/mediawindow.cxx +++ b/avmedia/source/viewer/mediawindow.cxx @@ -163,7 +163,9 @@ Size MediaWindow::getPreferredSize() const void MediaWindow::setPosSize( const Rectangle& rNewRect ) { if( mpImpl ) + { mpImpl->setPosSize( rNewRect ); + } } // ------------------------------------------------------------------------- @@ -370,6 +372,7 @@ void MediaWindow::getMediaFilters( FilterNameVector& rFilterNameVector ) "AVI", "avi", "CD Audio", "cda", "FLAC Audio", "flac", + "Matroska Media", "mkv", "MIDI Audio", "mid;midi", "MPEG Audio", "mp2;mp3;mpa", "MPEG Video", "mpg;mpeg;mpv;mp4", @@ -466,39 +469,26 @@ bool MediaWindow::isMediaURL( const ::rtl::OUString& rURL, bool bDeep, Size* pPr { if( bDeep || pPreferredSizePixel ) { - uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); - - if( xFactory.is() ) + try { - try - { - fprintf(stderr, "-->%s uno reference \n\n",AVMEDIA_MANAGER_SERVICE_NAME); + uno::Reference< media::XPlayer > xPlayer( priv::MediaWindowImpl::createPlayer( + aURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ) ) ); - uno::Reference< ::com::sun::star::media::XManager > xManager( - xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_MANAGER_SERVICE_NAME )) ), - uno::UNO_QUERY ); + if( xPlayer.is() ) + { + bRet = true; - if( xManager.is() ) + if( pPreferredSizePixel ) { - uno::Reference< media::XPlayer > xPlayer( xManager->createPlayer( aURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ) ) ); - - if( xPlayer.is() ) - { - bRet = true; + const awt::Size aAwtSize( xPlayer->getPreferredPlayerWindowSize() ); - if( pPreferredSizePixel ) - { - const awt::Size aAwtSize( xPlayer->getPreferredPlayerWindowSize() ); - - pPreferredSizePixel->Width() = aAwtSize.Width; - pPreferredSizePixel->Height() = aAwtSize.Height; - } - } + pPreferredSizePixel->Width() = aAwtSize.Width; + pPreferredSizePixel->Height() = aAwtSize.Height; } } - catch( ... ) - { - } + } + catch( ... ) + { } } else diff --git a/avmedia/source/viewer/mediawindow.hrc b/avmedia/source/viewer/mediawindow.hrc index 988088e88b..988088e88b 100644..100755 --- a/avmedia/source/viewer/mediawindow.hrc +++ b/avmedia/source/viewer/mediawindow.hrc diff --git a/avmedia/source/viewer/mediawindow.src b/avmedia/source/viewer/mediawindow.src index 4cadd3fac8..4cadd3fac8 100644..100755 --- a/avmedia/source/viewer/mediawindow.src +++ b/avmedia/source/viewer/mediawindow.src diff --git a/avmedia/source/viewer/mediawindow_impl.cxx b/avmedia/source/viewer/mediawindow_impl.cxx index 3e4151037a..48cd33b078 100644..100755 --- a/avmedia/source/viewer/mediawindow_impl.cxx +++ b/avmedia/source/viewer/mediawindow_impl.cxx @@ -77,7 +77,7 @@ MediaWindowControl::~MediaWindowControl() void MediaWindowControl::update() { MediaItem aItem; - + static_cast< MediaWindowImpl* >( GetParent() )->updateMediaItem( aItem ); setState( aItem ); } @@ -94,11 +94,7 @@ void MediaWindowControl::execute( const MediaItem& rItem ) // -------------------- MediaChildWindow::MediaChildWindow( Window* pParent ) : -#ifdef GSTREAMER SystemChildWindow( pParent, WB_CLIPCHILDREN ) -#else - JavaChildWindow( pParent, WB_CLIPCHILDREN ) -#endif { } @@ -114,12 +110,8 @@ void MediaChildWindow::MouseMove( const MouseEvent& rMEvt ) { const MouseEvent aTransformedEvent( GetParent()->ScreenToOutputPixel( OutputToScreenPixel( rMEvt.GetPosPixel() ) ), rMEvt.GetClicks(), rMEvt.GetMode(), rMEvt.GetButtons(), rMEvt.GetModifier() ); - -#ifdef GSTREAMER + SystemChildWindow::MouseMove( rMEvt ); -#else - JavaChildWindow::MouseMove( rMEvt ); -#endif GetParent()->MouseMove( aTransformedEvent ); } @@ -129,12 +121,8 @@ void MediaChildWindow::MouseButtonDown( const MouseEvent& rMEvt ) { const MouseEvent aTransformedEvent( GetParent()->ScreenToOutputPixel( OutputToScreenPixel( rMEvt.GetPosPixel() ) ), rMEvt.GetClicks(), rMEvt.GetMode(), rMEvt.GetButtons(), rMEvt.GetModifier() ); - -#ifdef GSTREAMER + SystemChildWindow::MouseButtonDown( rMEvt ); -#else - JavaChildWindow::MouseButtonDown( rMEvt ); -#endif GetParent()->MouseButtonDown( aTransformedEvent ); } @@ -145,11 +133,7 @@ void MediaChildWindow::MouseButtonUp( const MouseEvent& rMEvt ) const MouseEvent aTransformedEvent( GetParent()->ScreenToOutputPixel( OutputToScreenPixel( rMEvt.GetPosPixel() ) ), rMEvt.GetClicks(), rMEvt.GetMode(), rMEvt.GetButtons(), rMEvt.GetModifier() ); -#ifdef GSTREAMER SystemChildWindow::MouseButtonUp( rMEvt ); -#else - JavaChildWindow::MouseButtonUp( rMEvt ); -#endif GetParent()->MouseButtonUp( aTransformedEvent ); } @@ -157,11 +141,7 @@ void MediaChildWindow::MouseButtonUp( const MouseEvent& rMEvt ) void MediaChildWindow::KeyInput( const KeyEvent& rKEvt ) { -#ifdef GSTREAMER SystemChildWindow::KeyInput( rKEvt ); -#else - JavaChildWindow::KeyInput( rKEvt ); -#endif GetParent()->KeyInput( rKEvt ); } @@ -169,11 +149,7 @@ void MediaChildWindow::KeyInput( const KeyEvent& rKEvt ) void MediaChildWindow::KeyUp( const KeyEvent& rKEvt ) { -#ifdef GSTREAMER SystemChildWindow::KeyUp( rKEvt ); -#else - JavaChildWindow::KeyUp( rKEvt ); -#endif GetParent()->KeyUp( rKEvt ); } @@ -183,12 +159,8 @@ void MediaChildWindow::Command( const CommandEvent& rCEvt ) { const CommandEvent aTransformedEvent( GetParent()->ScreenToOutputPixel( OutputToScreenPixel( rCEvt.GetMousePosPixel() ) ), rCEvt.GetCommand(), rCEvt.IsMouseEvent(), rCEvt.GetData() ); - -#ifdef GSTREAMER + SystemChildWindow::Command( rCEvt ); -#else - JavaChildWindow::Command( rCEvt ); -#endif GetParent()->Command( aTransformedEvent ); } @@ -207,9 +179,10 @@ MediaWindowImpl::MediaWindowImpl( Window* pParent, MediaWindow* pMediaWindow, bo mpEmptyBmpEx( NULL ), mpAudioBmpEx( NULL ) { + maChildWindow.SetBackground( Color( COL_BLACK ) ); maChildWindow.SetHelpId( HID_AVMEDIA_PLAYERWINDOW ); maChildWindow.Hide(); - + if( mpMediaWindowControl ) { mpMediaWindowControl->SetSizePixel( mpMediaWindowControl->getMinSizePixel() ); @@ -239,12 +212,12 @@ void MediaWindowImpl::cleanUp() xPlayerWindow->removeKeyListener( uno::Reference< awt::XKeyListener >( mxEventsIf, uno::UNO_QUERY ) ); xPlayerWindow->removeMouseListener( uno::Reference< awt::XMouseListener >( mxEventsIf, uno::UNO_QUERY ) ); xPlayerWindow->removeMouseMotionListener( uno::Reference< awt::XMouseMotionListener >( mxEventsIf, uno::UNO_QUERY ) ); - + uno::Reference< lang::XComponent > xComponent( xPlayerWindow, uno::UNO_QUERY ); - + if( xComponent.is() ) xComponent->dispose(); - + setPlayerWindow( NULL ); } @@ -261,28 +234,15 @@ void MediaWindowImpl::onURLChanged() uno::Reference< media::XPlayerWindow > xPlayerWindow; const Point aPoint; const Size aSize( maChildWindow.GetSizePixel() ); -#ifndef GSTREAMER - const sal_IntPtr nWndHandle = static_cast< sal_IntPtr >( maChildWindow.getParentWindowHandleForJava() ); -#else const sal_Int32 nWndHandle = 0; -#endif aArgs[ 0 ] = uno::makeAny( nWndHandle ); aArgs[ 1 ] = uno::makeAny( awt::Rectangle( aPoint.X(), aPoint.Y(), aSize.Width(), aSize.Height() ) ); -#ifdef GSTREAMER - const SystemEnvData *pSystemData = maChildWindow.GetSystemData(); - OSL_TRACE( "MediaWindowImpl::onURLChanged xwindow id: %ld", pSystemData->aWindow ); - aArgs[ 2 ] = uno::makeAny( pSystemData->aWindow ); -#endif - + aArgs[ 2 ] = uno::makeAny( reinterpret_cast< sal_IntPtr >( &maChildWindow ) ); + try { -#ifdef GSTREAMER - if( pSystemData->aWindow != 0 ) -#else - if( nWndHandle != 0 ) -#endif - xPlayerWindow = getPlayer()->createPlayerWindow( aArgs ); + xPlayerWindow = getPlayer()->createPlayerWindow( aArgs ); } catch( uno::RuntimeException ) { @@ -323,7 +283,7 @@ void MediaWindowImpl::onURLChanged() void MediaWindowImpl::update() { uno::Reference< media::XPlayerWindow > xPlayerWindow( getPlayerWindow() ); - + if( xPlayerWindow.is() ) xPlayerWindow->update(); } @@ -332,7 +292,7 @@ void MediaWindowImpl::update() void MediaWindowImpl::setPosSize( const Rectangle& rRect ) { - SetPosSizePixel( rRect.Left(), rRect.Top(), rRect.GetWidth(), rRect.GetHeight() ); + SetPosSizePixel( rRect.TopLeft(), rRect.GetSize() ); } // --------------------------------------------------------------------- @@ -340,25 +300,24 @@ void MediaWindowImpl::setPosSize( const Rectangle& rRect ) void MediaWindowImpl::setPointer( const Pointer& rPointer ) { uno::Reference< media::XPlayerWindow > xPlayerWindow( getPlayerWindow() ); - + SetPointer( rPointer ); maChildWindow.SetPointer( rPointer ); - + if( xPlayerWindow.is() ) { - long nPointer; - + switch( rPointer.GetStyle() ) { case( POINTER_CROSS ): nPointer = awt::SystemPointer::CROSS; break; case( POINTER_HAND ): nPointer = awt::SystemPointer::HAND; break; case( POINTER_MOVE ): nPointer = awt::SystemPointer::MOVE; break; case( POINTER_WAIT ): nPointer = awt::SystemPointer::WAIT; break; - + default: nPointer = awt::SystemPointer::ARROW; break; } - + xPlayerWindow->setPointerType( nPointer ); } } @@ -386,20 +345,20 @@ void MediaWindowImpl::Resize() const sal_Int32 nOffset( mpMediaWindowControl ? AVMEDIA_CONTROLOFFSET : 0 ); Size aPlayerWindowSize( aCurSize.Width() - ( nOffset << 1 ), aCurSize.Height() - ( nOffset << 1 ) ); - + if( mpMediaWindowControl ) { const sal_Int32 nControlHeight = mpMediaWindowControl->GetSizePixel().Height(); const sal_Int32 nControlY = ::std::max( aCurSize.Height() - nControlHeight - nOffset, 0L ); - + aPlayerWindowSize.Height() = ( nControlY - ( nOffset << 1 ) ); mpMediaWindowControl->SetPosSizePixel( Point( nOffset, nControlY ), Size( aCurSize.Width() - ( nOffset << 1 ), nControlHeight ) ); } - - maChildWindow.SetPosSizePixel( Point( nOffset, nOffset ), aPlayerWindowSize ); - + if( xPlayerWindow.is() ) xPlayerWindow->setPosSize( 0, 0, aPlayerWindowSize.Width(), aPlayerWindowSize.Height(), 0 ); + + maChildWindow.SetPosSizePixel( Point( nOffset, nOffset ), aPlayerWindowSize ); } // --------------------------------------------------------------------- @@ -438,25 +397,25 @@ void MediaWindowImpl::StateChanged( StateChangedType eType ) void MediaWindowImpl::Paint( const Rectangle& ) { BitmapEx* pLogo = NULL; - + if( !getPlayer().is() ) { if( !mpEmptyBmpEx ) mpEmptyBmpEx = new BitmapEx( AVMEDIA_RESID( AVMEDIA_BMP_EMPTYLOGO ) ); - + pLogo = mpEmptyBmpEx; } - else if ( !getPlayerWindow().is() ) + else if( !getPlayerWindow().is() ) { if( !mpAudioBmpEx ) mpAudioBmpEx = new BitmapEx( AVMEDIA_RESID( AVMEDIA_BMP_AUDIOLOGO ) ); - + pLogo = mpAudioBmpEx; } const Point aBasePos( maChildWindow.GetPosPixel() ); - const Rectangle aVideoRect( aBasePos, maChildWindow.GetSizePixel() ); - + const Rectangle aVideoRect( aBasePos, maChildWindow.GetSizePixel() ); + if( pLogo && !pLogo->IsEmpty() && ( aVideoRect.GetWidth() > 0 ) && ( aVideoRect.GetHeight() > 0 ) ) { Size aLogoSize( pLogo->GetSizePixel() ); @@ -465,7 +424,7 @@ void MediaWindowImpl::Paint( const Rectangle& ) SetLineColor( aBackgroundColor ); SetFillColor( aBackgroundColor ); DrawRect( aVideoRect ); - + if( ( aLogoSize.Width() > aVideoRect.GetWidth() || aLogoSize.Height() > aVideoRect.GetHeight() ) && ( aLogoSize.Height() > 0 ) ) { @@ -483,12 +442,10 @@ void MediaWindowImpl::Paint( const Rectangle& ) } } - DrawBitmapEx( Point( aBasePos.X() + ( ( aVideoRect.GetWidth() - aLogoSize.Width() ) >> 1 ), + DrawBitmapEx( Point( aBasePos.X() + ( ( aVideoRect.GetWidth() - aLogoSize.Width() ) >> 1 ), aBasePos.Y() + ( ( aVideoRect.GetHeight() - aLogoSize.Height() ) >> 1 ) ), aLogoSize, *pLogo ); } - - update(); } // --------------------------------------------------------------------- diff --git a/avmedia/source/viewer/mediawindow_impl.hxx b/avmedia/source/viewer/mediawindow_impl.hxx index c2dc310821..f8abda9bb7 100644..100755 --- a/avmedia/source/viewer/mediawindow_impl.hxx +++ b/avmedia/source/viewer/mediawindow_impl.hxx @@ -2,11 +2,14 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite * + * $RCSfile: mediawindow_impl.hxx,v $ + * $Revision: 1.3 $ + * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -30,11 +33,7 @@ #define _AVMEDIA_MEDIAWINDOW_IMPL_HXX #include <svtools/transfer.hxx> -#ifdef GSTREAMER #include <vcl/syschild.hxx> -#else -#include <vcl/javachild.hxx> -#endif #include "mediawindowbase_impl.hxx" #include "mediacontrol.hxx" @@ -48,16 +47,16 @@ namespace avmedia // ---------------------- // - MediaWindowControl - // ---------------------- - + class MediaWindowControl : public MediaControl { public: - + MediaWindowControl( Window* pParent ); ~MediaWindowControl(); - + protected: - + void update(); void execute( const MediaItem& rItem ); }; @@ -65,20 +64,16 @@ namespace avmedia // -------------------- // - MediaChildWindow - // -------------------- - -#ifdef GSTREAMER + class MediaChildWindow : public SystemChildWindow -#else - class MediaChildWindow : public JavaChildWindow -#endif { public: - + MediaChildWindow( Window* pParent ); ~MediaChildWindow(); - + protected: - + virtual void MouseMove( const MouseEvent& rMEvt ); virtual void MouseButtonDown( const MouseEvent& rMEvt ); virtual void MouseButtonUp( const MouseEvent& rMEvt ); @@ -86,7 +81,7 @@ namespace avmedia virtual void KeyUp( const KeyEvent& rKEvt ); virtual void Command( const CommandEvent& rCEvt ); }; - + // ------------------. // - MediaWindowImpl - // ------------------- @@ -97,7 +92,7 @@ namespace avmedia public MediaWindowBaseImpl, public DropTargetHelper, public DragSourceHelper - + { public: @@ -106,18 +101,18 @@ namespace avmedia virtual void cleanUp(); virtual void onURLChanged(); - + public: - + void update(); void setPosSize( const Rectangle& rRect ); - + void setPointer( const Pointer& rPointer ); const Pointer& getPointer() const; - + bool hasInternalMediaControl() const; - + protected: // Window diff --git a/avmedia/source/viewer/mediawindowbase_impl.cxx b/avmedia/source/viewer/mediawindowbase_impl.cxx index 24f6802aac..89928b27ed 100644..100755 --- a/avmedia/source/viewer/mediawindowbase_impl.cxx +++ b/avmedia/source/viewer/mediawindowbase_impl.cxx @@ -46,6 +46,7 @@ namespace avmedia { namespace priv { // - MediaWindowBaseImpl - // ----------------------- + MediaWindowBaseImpl::MediaWindowBaseImpl( MediaWindow* pMediaWindow ) : mpMediaWindow( pMediaWindow ) { @@ -141,10 +142,7 @@ void MediaWindowBaseImpl::stopPlayingInternal( bool bStop ) { if( isPlaying() ) { - if( bStop ) - mxPlayer->stop(); - else - mxPlayer->start(); + bStop ? mxPlayer->stop() : mxPlayer->start(); } } diff --git a/avmedia/source/viewer/mediawindowbase_impl.hxx b/avmedia/source/viewer/mediawindowbase_impl.hxx index 063665b97d..408528e209 100644..100755 --- a/avmedia/source/viewer/mediawindowbase_impl.hxx +++ b/avmedia/source/viewer/mediawindowbase_impl.hxx @@ -62,7 +62,7 @@ namespace avmedia virtual void cleanUp(); virtual void onURLChanged(); - static ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > createPlayer( const ::rtl::OUString& rURL ); + static ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > createPlayer( const ::rtl::OUString& rURL); public: @@ -113,6 +113,7 @@ namespace avmedia void stopPlayingInternal( bool ); MediaWindow* getMediaWindow() const; + inline sal_Bool isMediaWindowJavaBased() const { return( mbIsMediaWindowJavaBased ); } ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > getPlayer() const; @@ -125,6 +126,7 @@ namespace avmedia ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > mxPlayer; ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayerWindow > mxPlayerWindow; MediaWindow* mpMediaWindow; + sal_Bool mbIsMediaWindowJavaBased; }; } } |