From 50c6c0aaebeda0f131e35da61729479180184192 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Fri, 4 Jun 2010 13:46:22 +0200 Subject: changehid: #i111874# remove SmartId, make HID of type rtl::OString, fill in dummies for all explicit help ids --- avmedia/source/framework/mediacontrol.cxx | 36 ++++++++++++++++++++---------- avmedia/source/framework/mediaplayer.cxx | 3 ++- avmedia/source/viewer/mediawindow_impl.cxx | 3 ++- 3 files changed, 28 insertions(+), 14 deletions(-) (limited to 'avmedia') diff --git a/avmedia/source/framework/mediacontrol.cxx b/avmedia/source/framework/mediacontrol.cxx index a71b5268abd7..781f2b7d290d 100644 --- a/avmedia/source/framework/mediacontrol.cxx +++ b/avmedia/source/framework/mediacontrol.cxx @@ -94,10 +94,12 @@ MediaControl::MediaControl( Window* pParent, MediaControlStyle eControlStyle ) : maPlayToolBox.InsertItem( AVMEDIA_TOOLBOXITEM_OPEN, implGetImage( AVMEDIA_IMG_OPEN ), String( AVMEDIA_RESID( AVMEDIA_STR_OPEN ) ) ); - maPlayToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_OPEN, HID_AVMEDIA_TOOLBOXITEM_OPEN ); + // FIXME: HELPID + maPlayToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_OPEN, ""/*HID_AVMEDIA_TOOLBOXITEM_OPEN*/ ); maPlayToolBox.InsertItem( AVMEDIA_TOOLBOXITEM_INSERT, implGetImage( AVMEDIA_IMG_INSERT ), String( AVMEDIA_RESID( AVMEDIA_STR_INSERT ) ) ); - maPlayToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_INSERT, HID_AVMEDIA_TOOLBOXITEM_INSERT ); + // FIXME: HELPID + maPlayToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_INSERT, ""/*HID_AVMEDIA_TOOLBOXITEM_INSERT*/ ); maPlayToolBox.InsertSeparator(); } @@ -117,18 +119,22 @@ MediaControl::MediaControl( Window* pParent, MediaControlStyle eControlStyle ) : } maPlayToolBox.InsertItem( AVMEDIA_TOOLBOXITEM_PLAY, implGetImage( AVMEDIA_IMG_PLAY ), String( AVMEDIA_RESID( AVMEDIA_STR_PLAY ) ), TIB_CHECKABLE ); - maPlayToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_PLAY, HID_AVMEDIA_TOOLBOXITEM_PLAY ); + // FIXME: HELPID + maPlayToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_PLAY, ""/*HID_AVMEDIA_TOOLBOXITEM_PLAY*/ ); maPlayToolBox.InsertItem( AVMEDIA_TOOLBOXITEM_PAUSE, implGetImage( AVMEDIA_IMG_PAUSE ), String( AVMEDIA_RESID( AVMEDIA_STR_PAUSE ) ), TIB_CHECKABLE ); - maPlayToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_PAUSE, HID_AVMEDIA_TOOLBOXITEM_PAUSE ); + // FIXME: HELPID + maPlayToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_PAUSE, ""/*HID_AVMEDIA_TOOLBOXITEM_PAUSE*/ ); maPlayToolBox.InsertItem( AVMEDIA_TOOLBOXITEM_STOP, implGetImage( AVMEDIA_IMG_STOP ), String( AVMEDIA_RESID( AVMEDIA_STR_STOP ) ), TIB_CHECKABLE ); - maPlayToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_STOP, HID_AVMEDIA_TOOLBOXITEM_STOP ); + // FIXME: HELPID + maPlayToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_STOP, ""/*HID_AVMEDIA_TOOLBOXITEM_STOP*/ ); maPlayToolBox.InsertSeparator(); maPlayToolBox.InsertItem( AVMEDIA_TOOLBOXITEM_LOOP, implGetImage( AVMEDIA_IMG_ENDLESS ), String( AVMEDIA_RESID( AVMEDIA_STR_ENDLESS ) ) ); - maPlayToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_LOOP, HID_AVMEDIA_TOOLBOXITEM_LOOP ); + // FIXME: HELPID + maPlayToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_LOOP, ""/*HID_AVMEDIA_TOOLBOXITEM_LOOP*/ ); if( MEDIACONTROLSTYLE_SINGLELINE == meControlStyle ) maPlayToolBox.InsertSeparator(); @@ -141,7 +147,8 @@ MediaControl::MediaControl( Window* pParent, MediaControlStyle eControlStyle ) : maTimeSlider.SetSlideHdl( LINK( this, MediaControl, implTimeHdl ) ); maTimeSlider.SetEndSlideHdl( LINK( this, MediaControl, implTimeEndHdl ) ); maTimeSlider.SetRange( Range( 0, AVMEDIA_TIME_RANGE ) ); - maTimeSlider.SetHelpId( HID_AVMEDIA_TIMESLIDER ); + // FIXME: HELPID + maTimeSlider.SetHelpId( ""/*HID_AVMEDIA_TIMESLIDER*/ ); maTimeSlider.SetUpdateMode( true ); maTimeSlider.SetSizePixel( Size( 128, maPlayToolBox.GetSizePixel().Height() ) ); maTimeSlider.Show(); @@ -151,7 +158,8 @@ MediaControl::MediaControl( Window* pParent, MediaControlStyle eControlStyle ) : maTimeEdit.SetUpdateMode( true ); maTimeEdit.SetSizePixel( Size( maTimeEdit.GetTextWidth( aTimeText ) + 8, maPlayToolBox.GetSizePixel().Height() ) ); maTimeEdit.SetControlBackground( Application::GetSettings().GetStyleSettings().GetWindowColor() ); - maTimeEdit.SetHelpId( HID_AVMEDIA_TIMEEDIT ); + // FIXME: HELPID + maTimeEdit.SetHelpId( ""/*HID_AVMEDIA_TIMEEDIT*/ ); maTimeEdit.Disable(); maTimeEdit.Show(); maMinSize.Width() += maTimeEdit.GetSizePixel().Width(); @@ -160,7 +168,8 @@ MediaControl::MediaControl( Window* pParent, MediaControlStyle eControlStyle ) : maMuteToolBox.InsertSeparator(); maMuteToolBox.InsertItem( AVMEDIA_TOOLBOXITEM_MUTE, implGetImage( AVMEDIA_IMG_MUTE ), String( AVMEDIA_RESID( AVMEDIA_STR_MUTE ) ) ); - maMuteToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_MUTE, HID_AVMEDIA_TOOLBOXITEM_MUTE ); + // FIXME: HELPID + maMuteToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_MUTE, ""/*HID_AVMEDIA_TOOLBOXITEM_MUTE*/ ); maMuteToolBox.SetSelectHdl( LINK( this, MediaControl, implSelectHdl ) ); maMuteToolBox.SetSizePixel( maMuteToolBox.CalcWindowSizePixel() ); @@ -171,7 +180,8 @@ MediaControl::MediaControl( Window* pParent, MediaControlStyle eControlStyle ) : maVolumeSlider.SetEndSlideHdl( LINK( this, MediaControl, implVolumeEndHdl ) ); maVolumeSlider.SetRange( Range( AVMEDIA_DB_RANGE, 0 ) ); maVolumeSlider.SetUpdateMode( true ); - maVolumeSlider.SetHelpId( HID_AVMEDIA_VOLUMESLIDER ); + // FIXME: HELPID + maVolumeSlider.SetHelpId( ""/*HID_AVMEDIA_VOLUMESLIDER*/ ); maVolumeSlider.SetSizePixel( Size( 48, maPlayToolBox.GetSizePixel().Height() ) ); maVolumeSlider.Show(); maMinSize.Width() += maVolumeSlider.GetSizePixel().Width(); @@ -182,10 +192,12 @@ MediaControl::MediaControl( Window* pParent, MediaControlStyle eControlStyle ) : mpZoomListBox->InsertEntry( String( AVMEDIA_RESID( AVMEDIA_STR_ZOOM_200 ) ), AVMEDIA_ZOOMLEVEL_200 ); mpZoomListBox->InsertEntry( String( AVMEDIA_RESID( AVMEDIA_STR_ZOOM_FIT ) ), AVMEDIA_ZOOMLEVEL_FIT ); mpZoomListBox->SetSelectHdl( LINK( this, MediaControl, implZoomSelectHdl ) ); - mpZoomListBox->SetHelpId( HID_AVMEDIA_ZOOMLISTBOX ); + // FIXME: HELPID + mpZoomListBox->SetHelpId( ""/*HID_AVMEDIA_ZOOMLISTBOX*/ ); maZoomToolBox.InsertItem( AVMEDIA_TOOLBOXITEM_ZOOM, String( AVMEDIA_RESID( AVMEDIA_STR_ZOOM ) ) ); - maZoomToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_ZOOM, HID_AVMEDIA_ZOOMLISTBOX ); + // FIXME: HELPID + maZoomToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_ZOOM, ""/*HID_AVMEDIA_ZOOMLISTBOX*/ ); maZoomToolBox.SetItemWindow( AVMEDIA_TOOLBOXITEM_ZOOM, mpZoomListBox ); maZoomToolBox.SetSelectHdl( LINK( this, MediaControl, implSelectHdl ) ); diff --git a/avmedia/source/framework/mediaplayer.cxx b/avmedia/source/framework/mediaplayer.cxx index caab783c6a7c..c66f88817fe3 100644 --- a/avmedia/source/framework/mediaplayer.cxx +++ b/avmedia/source/framework/mediaplayer.cxx @@ -124,7 +124,8 @@ void MediaFloater::ToggleFloatingMode() Window* pWindow = mpMediaWindow->getWindow(); if( pWindow ) - pWindow->SetHelpId( HID_AVMEDIA_PLAYERWINDOW ); + // FIXME: HELPID + pWindow->SetHelpId( ""/*HID_AVMEDIA_PLAYERWINDOW*/ ); mpMediaWindow->show(); } diff --git a/avmedia/source/viewer/mediawindow_impl.cxx b/avmedia/source/viewer/mediawindow_impl.cxx index 553eea6196c1..14d174beec80 100644 --- a/avmedia/source/viewer/mediawindow_impl.cxx +++ b/avmedia/source/viewer/mediawindow_impl.cxx @@ -179,7 +179,8 @@ MediaWindowImpl::MediaWindowImpl( Window* pParent, MediaWindow* pMediaWindow, bo mpEmptyBmpEx( NULL ), mpAudioBmpEx( NULL ) { - maChildWindow.SetHelpId( HID_AVMEDIA_PLAYERWINDOW ); + // FIXME: HELPID + maChildWindow.SetHelpId( ""/*HID_AVMEDIA_PLAYERWINDOW*/ ); maChildWindow.Hide(); if( mpMediaWindowControl ) -- cgit From 18f021f924bddb5ad6f32f2d2bcfc42ae2b104df Mon Sep 17 00:00:00 2001 From: ka Date: Wed, 9 Jun 2010 07:07:59 +0200 Subject: avmedia101: added GStreamer backend for Unix --- avmedia/prj/build.lst | 4 +- avmedia/source/gstreamer/exports.dxp | 3 + avmedia/source/gstreamer/gstcommon.hxx | 71 ++ avmedia/source/gstreamer/gstframegrabber.cxx | 310 +++++++++ avmedia/source/gstreamer/gstframegrabber.hxx | 84 +++ avmedia/source/gstreamer/gstmanager.cxx | 88 +++ avmedia/source/gstreamer/gstmanager.hxx | 77 ++ avmedia/source/gstreamer/gstplayer.cxx | 929 +++++++++++++++++++++++++ avmedia/source/gstreamer/gstplayer.hxx | 224 ++++++ avmedia/source/gstreamer/gstuno.cxx | 109 +++ avmedia/source/gstreamer/gstwindow.cxx | 671 ++++++++++++++++++ avmedia/source/gstreamer/gstwindow.hxx | 200 ++++++ avmedia/source/gstreamer/makefile.mk | 75 ++ avmedia/source/inc/mediamisc.hxx | 9 +- avmedia/source/java/Manager.java | 2 +- avmedia/source/java/MediaUno.java | 2 +- avmedia/source/viewer/mediawindow.cxx | 42 +- avmedia/source/viewer/mediawindow_impl.cxx | 45 +- avmedia/source/viewer/mediawindow_impl.hxx | 9 +- avmedia/source/viewer/mediawindowbase_impl.cxx | 5 +- avmedia/source/win/winuno.cxx | 6 +- 21 files changed, 2900 insertions(+), 65 deletions(-) create mode 100644 avmedia/source/gstreamer/exports.dxp create mode 100644 avmedia/source/gstreamer/gstcommon.hxx create mode 100644 avmedia/source/gstreamer/gstframegrabber.cxx create mode 100644 avmedia/source/gstreamer/gstframegrabber.hxx create mode 100644 avmedia/source/gstreamer/gstmanager.cxx create mode 100644 avmedia/source/gstreamer/gstmanager.hxx create mode 100644 avmedia/source/gstreamer/gstplayer.cxx create mode 100644 avmedia/source/gstreamer/gstplayer.hxx create mode 100644 avmedia/source/gstreamer/gstuno.cxx create mode 100644 avmedia/source/gstreamer/gstwindow.cxx create mode 100644 avmedia/source/gstreamer/gstwindow.hxx create mode 100644 avmedia/source/gstreamer/makefile.mk (limited to 'avmedia') diff --git a/avmedia/prj/build.lst b/avmedia/prj/build.lst index 1ef04ca0f7d5..6651d9d74f8f 100644 --- a/avmedia/prj/build.lst +++ b/avmedia/prj/build.lst @@ -6,6 +6,6 @@ av avmedia\source\viewer nmake - all av_viewer NULL av avmedia\source\framework nmake - all av_framework NULL av avmedia\source\win nmake - all av_win NULL av avmedia\source\java nmake - all av_java NULL -av avmedia\source\xine nmake - all av_xine NULL av avmedia\source\quicktime nmake - all av_quicktime NULL -av avmedia\util nmake - all av_util av_viewer av_framework av_win av_java av_quicktime av_xine NULL +av avmedia\source\gstreamer nmake - all av_gstreamer NULL +av avmedia\util nmake - all av_util av_viewer av_framework av_win av_java av_quicktime av_gstreamer NULL diff --git a/avmedia/source/gstreamer/exports.dxp b/avmedia/source/gstreamer/exports.dxp new file mode 100644 index 000000000000..9630d7e06768 --- /dev/null +++ b/avmedia/source/gstreamer/exports.dxp @@ -0,0 +1,3 @@ +component_getImplementationEnvironment +component_writeInfo +component_getFactory diff --git a/avmedia/source/gstreamer/gstcommon.hxx b/avmedia/source/gstreamer/gstcommon.hxx new file mode 100644 index 000000000000..be8bf32bb436 --- /dev/null +++ b/avmedia/source/gstreamer/gstcommon.hxx @@ -0,0 +1,71 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: GSTREAMERcommon.hxx,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _GSTCOMMON_HXX +#define _GSTCOMMON_HXX + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#define AVMEDIA_GSTREAMER_MANAGER_IMPLEMENTATIONNAME "com.sun.star.comp.avmedia.Manager_GStreamer" +#define AVMEDIA_GSTREAMER_MANAGER_SERVICENAME "com.sun.star.media.Manager_GStreamer" + +#define AVMEDIA_GSTREAMER_PLAYER_IMPLEMENTATIONNAME "com.sun.star.comp.avmedia.Player_GStreamer" +#define AVMEDIA_GSTREAMER_PLAYER_SERVICENAME "com.sun.star.media.Player_GStreamer" + +#define AVMEDIA_GSTREAMER_WINDOW_IMPLEMENTATIONNAME "com.sun.star.comp.avmedia.Window_GStreamer" +#define AVMEDIA_GSTREAMER_WINDOW_SERVICENAME "com.sun.star.media.Window_GStreamer" + +#define AVMEDIA_GSTREAMER_FRAMEGRABBER_IMPLEMENTATIONNAME "com.sun.star.comp.avmedia.FrameGrabber_GStreamer" +#define AVMEDIA_GSTREAMER_FRAMEGRABBER_SERVICENAME "com.sun.star.media.FrameGrabber_GStreamer" + +#endif // _GSTCOMMOM_HXX diff --git a/avmedia/source/gstreamer/gstframegrabber.cxx b/avmedia/source/gstreamer/gstframegrabber.cxx new file mode 100644 index 000000000000..71e720987d52 --- /dev/null +++ b/avmedia/source/gstreamer/gstframegrabber.cxx @@ -0,0 +1,310 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: framegrabber.cxx,v $ + * $Revision: 1.7 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "gstframegrabber.hxx" +#include "gstplayer.hxx" + +#include +#include + +using namespace ::com::sun::star; + +namespace avmedia { namespace gst { + +const gulong GRAB_TIMEOUT = 10000000; + +// ---------------- +// - FrameGrabber - +// ---------------- + +FrameGrabber::FrameGrabber( GString* pURI ) : + Player( pURI ), + mpFrameMutex( g_mutex_new() ), + mpFrameCond( g_cond_new() ), + mpLastPixbuf( NULL ), + mbIsInGrabMode( false ) +{ +} + +// ------------------------------------------------------------------------------ + +FrameGrabber::~FrameGrabber() +{ + if( g_atomic_pointer_get( &mpPlayer ) ) + { + implQuitThread(); + } + + // thread has ended, so that no more synchronization is necessary + if( mpLastPixbuf ) + { + g_object_unref( mpLastPixbuf ); + mpLastPixbuf = NULL; + } + + g_cond_free( mpFrameCond ); + g_mutex_free( mpFrameMutex ); +} + +// ------------------------------------------------------------------------------ + +FrameGrabber* FrameGrabber::create( const GString* pURI ) +{ + FrameGrabber* pFrameGrabber = NULL; + + if( pURI && pURI->len ) + { + // safely initialize GLib threading framework + try + { + if( !g_thread_supported() ) + { + g_thread_init( NULL ); + } + } + catch( ... ) + {} + + if( g_thread_supported() ) + { + pFrameGrabber = new FrameGrabber( g_string_new( pURI->str ) ); + + // wait until thread signals that it has finished initialization + if( pFrameGrabber->mpThread ) + { + g_mutex_lock( pFrameGrabber->mpMutex ); + + while( !pFrameGrabber->implIsInitialized() ) + { + g_cond_wait( pFrameGrabber->mpCond, pFrameGrabber->mpMutex ); + } + + g_mutex_unlock( pFrameGrabber->mpMutex ); + } + + GstElement* pPixbufSink = gst_element_factory_make( "gdkpixbufsink", NULL ); + + // check if player pipeline and GdkPixbufSink could be initialized + if( !pFrameGrabber->mpPlayer || !pPixbufSink ) + { + delete pFrameGrabber; + pFrameGrabber = NULL; + } + else + { + g_object_set( pFrameGrabber->mpPlayer, "audio-sink", gst_element_factory_make( "fakesink", NULL ), NULL ); + g_object_set( pFrameGrabber->mpPlayer, "video-sink", pPixbufSink, NULL ); + } + } + } + + return( pFrameGrabber ); +} + +// ------------------------------------------------------------------------------ + +gboolean FrameGrabber::busCallback( GstBus* pBus, GstMessage* pMsg ) +{ + bool bDone = false; + + if( pMsg && pMsg->structure ) + { + GstStructure* pStruct = pMsg->structure; + const gchar* pStructName = gst_structure_get_name( pStruct ); + + if( ( ::std::string( pStructName ).find( "pixbuf" ) != ::std::string::npos ) && + gst_structure_has_field ( pStruct, "pixbuf") ) + { + bool bFrameGrabbed = false; + + g_mutex_lock( mpFrameMutex ); + + if( mbIsInGrabMode && ( getMediaTime() >= mfGrabTime ) ) + { + OSL_TRACE( "Grabbing frame at %fs", getMediaTime() ); + + if( mpLastPixbuf ) + { + g_object_unref( mpLastPixbuf ); + mpLastPixbuf = NULL; + } + + mpLastPixbuf = GDK_PIXBUF( g_value_dup_object( gst_structure_get_value( pStruct, "pixbuf" ) ) ); + bFrameGrabbed = true; + } + + g_mutex_unlock( mpFrameMutex ); + + if( bFrameGrabbed ) + { + g_cond_signal( mpFrameCond ); + } + + bDone = true; + } + } + + return( bDone || Player::busCallback( pBus, pMsg ) ); +} + +// ------------------------------------------------------------------------------ + +uno::Reference< graphic::XGraphic > SAL_CALL FrameGrabber::grabFrame( double fMediaTime ) + throw (uno::RuntimeException) +{ + uno::Reference< graphic::XGraphic > xRet; + + if( implInitPlayer() ) + { + OSL_TRACE( "Trying to grab frame at %fs", fMediaTime ); + + GTimeVal aTimeoutTime; + + g_get_current_time( &aTimeoutTime ); + g_time_val_add( &aTimeoutTime, GRAB_TIMEOUT ); + setMediaTime( fMediaTime ); + start(); + + if( isPlaying() ) + { + g_mutex_lock( mpFrameMutex ); + + mbIsInGrabMode = true; + mfGrabTime = fMediaTime; + g_cond_timed_wait( mpFrameCond, mpFrameMutex, &aTimeoutTime ); + mbIsInGrabMode = false; + + g_mutex_unlock( mpFrameMutex ); + + stop(); + } + + OSL_ENSURE( g_atomic_pointer_get( &mpLastPixbuf ), "FrameGrabber timed out without receiving a Pixbuf" ); + + if( g_atomic_pointer_get( &mpLastPixbuf ) ) + { + OSL_TRACE( "FrameGrabber received a GdkPixbuf"); + + g_mutex_lock( mpFrameMutex ); + + const int nWidth = gdk_pixbuf_get_width( mpLastPixbuf ); + const int nHeight = gdk_pixbuf_get_height( mpLastPixbuf ); + const int nChannels = gdk_pixbuf_get_n_channels( mpLastPixbuf ); + const guchar* pBuffer = gdk_pixbuf_get_pixels( mpLastPixbuf ); + + if( pBuffer && ( nWidth > 0 ) && ( nHeight > 0 ) ) + { + Bitmap aFrame( Size( nWidth, nHeight), 24 ); + bool bInit = false; + + if( ( gdk_pixbuf_get_colorspace( mpLastPixbuf ) == GDK_COLORSPACE_RGB ) && + ( nChannels >= 3 ) && ( nChannels <= 4 ) && + ( gdk_pixbuf_get_bits_per_sample( mpLastPixbuf ) == 8 ) ) + { + BitmapWriteAccess* pAcc = aFrame.AcquireWriteAccess(); + + if( pAcc ) + { + BitmapColor aPixel( 0, 0, 0 ); + const int nRowStride = gdk_pixbuf_get_rowstride( mpLastPixbuf ); + const bool bAlpha = ( nChannels == 4 ); + + for( int nRow = 0; nRow < nHeight; ++nRow ) + { + guchar* pCur = const_cast< guchar* >( pBuffer + nRow * nRowStride ); + + for( int nCol = 0; nCol < nWidth; ++nCol ) + { + aPixel.SetRed( *pCur++ ); + aPixel.SetGreen( *pCur++ ); + aPixel.SetBlue( *pCur++ ); + + // ignore alpha channel + if( bAlpha ) + { + ++pCur; + } + + pAcc->SetPixel( nRow, nCol, aPixel ); + } + } + + aFrame.ReleaseAccess( pAcc ); + bInit = true; + } + } + + if( !bInit ) + { + aFrame.Erase( Color( COL_BLACK ) ); + } + + xRet = Graphic( aFrame ).GetXGraphic(); + } + + g_object_unref( mpLastPixbuf ); + mpLastPixbuf = NULL; + + g_mutex_unlock( mpFrameMutex ); + } + } + + return xRet; +} + +// ------------------------------------------------------------------------------ + +::rtl::OUString SAL_CALL FrameGrabber::getImplementationName( ) + throw (uno::RuntimeException) +{ + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_GSTREAMER_FRAMEGRABBER_IMPLEMENTATIONNAME ) ); +} + +// ------------------------------------------------------------------------------ + +sal_Bool SAL_CALL FrameGrabber::supportsService( const ::rtl::OUString& ServiceName ) + throw (uno::RuntimeException) +{ + return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( AVMEDIA_GSTREAMER_FRAMEGRABBER_SERVICENAME ) ); +} + +// ------------------------------------------------------------------------------ + +uno::Sequence< ::rtl::OUString > SAL_CALL FrameGrabber::getSupportedServiceNames( ) + throw (uno::RuntimeException) +{ + uno::Sequence< ::rtl::OUString > aRet(1); + aRet[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( AVMEDIA_GSTREAMER_FRAMEGRABBER_SERVICENAME ) ); + + return aRet; +} + +} // namespace win +} // namespace avmedia diff --git a/avmedia/source/gstreamer/gstframegrabber.hxx b/avmedia/source/gstreamer/gstframegrabber.hxx new file mode 100644 index 000000000000..c9de03bfade9 --- /dev/null +++ b/avmedia/source/gstreamer/gstframegrabber.hxx @@ -0,0 +1,84 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: framegrabber.hxx,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _FRAMEGRABBER_HXX +#define _FRAMEGRABBER_HXX + +#include "gstplayer.hxx" +#include + +#ifndef _COM_SUN_STAR_MEDIA_XFRAMEGRABBER_HDL_ +#include "com/sun/star/media/XFrameGrabber.hdl" +#endif + +namespace avmedia { namespace gst { + +// ---------------- +// - FrameGrabber - +// ---------------- + +class FrameGrabber : public Player, + public ::cppu::WeakImplHelper2 < ::com::sun::star::media::XFrameGrabber, + ::com::sun::star::lang::XServiceInfo > +{ +public: + + // static create method instead of public Ctor + static FrameGrabber* create( const GString* pUri ); + + ~FrameGrabber(); + + // XFrameGrabber + virtual ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > SAL_CALL grabFrame( double fMediaTime ) throw (::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException); + +protected: FrameGrabber( GString* pURI = NULL ); + + virtual gboolean busCallback( GstBus* pBus, + GstMessage* pMsg ); + +private: FrameGrabber( const FrameGrabber& ); + FrameGrabber& operator=( const FrameGrabber& ); + + GMutex* mpFrameMutex; + GCond* mpFrameCond; + GdkPixbuf* mpLastPixbuf; + double mfGrabTime; + bool mbIsInGrabMode; +}; + +} // namespace gst +} // namespace avmedia + +#endif // _FRAMEGRABBER_HXX diff --git a/avmedia/source/gstreamer/gstmanager.cxx b/avmedia/source/gstreamer/gstmanager.cxx new file mode 100644 index 000000000000..f17199d36e27 --- /dev/null +++ b/avmedia/source/gstreamer/gstmanager.cxx @@ -0,0 +1,88 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: manager.cxx,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "gstmanager.hxx" +#include "gstplayer.hxx" + +using namespace ::com::sun::star; + +namespace avmedia +{ +namespace gst +{ +// ---------------- +// - Manager - +// ---------------- + +Manager::Manager( const uno::Reference< lang::XMultiServiceFactory >& rxMgr ) : + mxMgr( rxMgr ) +{} + +// ------------------------------------------------------------------------------ + +Manager::~Manager() +{} + +// ------------------------------------------------------------------------------ + +uno::Reference< media::XPlayer > SAL_CALL Manager::createPlayer( const ::rtl::OUString& rURL ) + throw( uno::RuntimeException ) +{ + return( ::avmedia::gst::Player::create( rURL ) ); +} + +// ------------------------------------------------------------------------------ + +::rtl::OUString SAL_CALL Manager::getImplementationName() + throw( uno::RuntimeException ) +{ + return( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_GSTREAMER_MANAGER_IMPLEMENTATIONNAME ) ) ); +} + +// ------------------------------------------------------------------------------ + +sal_Bool SAL_CALL Manager::supportsService( const ::rtl::OUString& ServiceName ) + throw( uno::RuntimeException ) +{ + return( ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( AVMEDIA_GSTREAMER_MANAGER_SERVICENAME ) ) ); +} + +// ------------------------------------------------------------------------------ + +uno::Sequence< ::rtl::OUString > SAL_CALL Manager::getSupportedServiceNames() + throw( uno::RuntimeException ) +{ + uno::Sequence< ::rtl::OUString > aRet( 1 ); + aRet[ 0 ] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_GSTREAMER_MANAGER_SERVICENAME ) ); + + return( aRet ); +} +} // namespace gst +} // namespace avmedia diff --git a/avmedia/source/gstreamer/gstmanager.hxx b/avmedia/source/gstreamer/gstmanager.hxx new file mode 100644 index 000000000000..38717952d071 --- /dev/null +++ b/avmedia/source/gstreamer/gstmanager.hxx @@ -0,0 +1,77 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: manager.hxx,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _GSTMANAGER_HXX +#define _GSTMANAGER_HXX + +#include "gstcommon.hxx" + +#ifndef _COM_SUN_STAR_MEDIA_XMANAGER_HDL_ +#include "com/sun/star/media/XManager.hdl" +#endif + +// ----------- +// - Manager - +// ----------- + +namespace avmedia +{ +namespace gst +{ +class Manager : public ::cppu::WeakImplHelper2< ::com::sun::star::media::XManager, + ::com::sun::star::lang::XServiceInfo > +{ +public: Manager( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxMgr ); + ~Manager(); + + // XManager + virtual ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > SAL_CALL createPlayer( + const ::rtl::OUString& aURL ) + throw( ::com::sun::star::uno::RuntimeException ); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw( ::com::sun::star::uno::RuntimeException ); + + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw( ::com::sun::star::uno::RuntimeException ); + + +private: + + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMgr; +}; +} // namespace gst +} // namespace avmedia + +#endif // _GSTMANAGER_HXX diff --git a/avmedia/source/gstreamer/gstplayer.cxx b/avmedia/source/gstreamer/gstplayer.cxx new file mode 100644 index 000000000000..e1a7ef566ee2 --- /dev/null +++ b/avmedia/source/gstreamer/gstplayer.cxx @@ -0,0 +1,929 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: player.cxx,v $ + * $Revision: 1.6 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "gstplayer.hxx" +#include "gstwindow.hxx" +#include "gstframegrabber.hxx" +#include +#include +#include +#include +#include +#include + +using namespace ::com::sun::star; + +namespace avmedia +{ +namespace gst +{ +const double NANO_TIME_FACTOR = 1000000000.0; + +const long VIDEO_DEFAULT_WIDTH = 256; +const long VIDEO_DEFAULT_HEIGHT = 192; + +// ---------------- +// - GstBusSource - +// ---------------- + +struct GstBusSource : public GSource +{ + GstBus* mpBus; + + GstBusSource() : + mpBus( NULL ) + {} + + ~GstBusSource() + {} +}; + +// --------------- +// - Player - +// --------------- +Player::Player( GString* pURI ) : + mpMutex( g_mutex_new() ), + mpCond( g_cond_new() ), + mpThread( NULL ), + mpContext( NULL ), + mpLoop( NULL ), + mpPlayer( NULL ), + mpURI( pURI ), + mpPlayerWindow( NULL ), + mnIsVideoSource( 0 ), + mnVideoWidth( 0 ), + mnVideoHeight( 0 ), + mnInitialized( 0 ), + mnVolumeDB( 0 ), + mnLooping( 0 ), + mnQuit( 0 ), + mnVideoWindowSet( 0 ) +{ + // initialize GStreamer framework only once + static bool bGstInitialized = false; + + if( !bGstInitialized ) + { + gst_init( NULL, NULL ); + bGstInitialized = true; + } + + if( pURI ) + { + OSL_TRACE( ">>> --------------------------------" ); + OSL_TRACE( ">>> Creating Player object with URL: %s", pURI->str ); + + mpThread = g_thread_create( Player::implThreadFunc, this, true, NULL ); + } +} + +// ------------------------------------------------------------------------------ + +Player::~Player() +{ + if( g_atomic_pointer_get( &mpPlayer ) ) + { + implQuitThread(); + } + + // cleanup + g_cond_free( mpCond ); + g_mutex_free( mpMutex ); + g_string_free( mpURI, false ); +} + +// ------------------------------------------------------------------------------ +Player* Player::create( const ::rtl::OUString& rURL ) +{ + Player* pPlayer = NULL; + + if( rURL.getLength() ) + { + // safely initialize GLib threading framework + try + { + if( !g_thread_supported() ) + { + g_thread_init( NULL ); + } + } + catch( ... ) + {} + + if( g_thread_supported() ) + { + const INetURLObject aURL( rURL ); + + if( aURL.GetProtocol() != INET_PROT_NOT_VALID ) + { + GString* pURI = g_string_new( ::rtl::OUStringToOString( + aURL.GetMainURL( INetURLObject::NO_DECODE ), + RTL_TEXTENCODING_UTF8 ).getStr() ); + + if( pURI->len ) + { + pPlayer = new Player( pURI ); + + // wait until thread signals that it has finished initialization + if( pPlayer->mpThread ) + { + g_mutex_lock( pPlayer->mpMutex ); + + while( !pPlayer->implIsInitialized() ) + { + g_cond_wait( pPlayer->mpCond, pPlayer->mpMutex ); + } + + g_mutex_unlock( pPlayer->mpMutex ); + } + + // check if player pipeline could be initialized + if( !pPlayer->mpPlayer ) + { + delete pPlayer; + pPlayer = NULL; + } + } + else + { + g_string_free( pURI, false ); + } + } + } + } + + return( pPlayer ); +} + +// ------------------------------------------------------------------------------ +void SAL_CALL Player::start() + throw( uno::RuntimeException ) +{ + if( implInitPlayer() && !isPlaying() ) + { + gst_element_set_state( mpPlayer, GST_STATE_PLAYING ); + } +} + +// ------------------------------------------------------------------------------ +void SAL_CALL Player::stop() + throw( uno::RuntimeException ) +{ + if( implInitPlayer() && isPlaying() ) + { + gst_element_set_state( mpPlayer, GST_STATE_PAUSED ); + } +} + +// ------------------------------------------------------------------------------ +sal_Bool SAL_CALL Player::isPlaying() + throw( uno::RuntimeException ) +{ + GstState aState = GST_STATE_NULL; + + if( mpPlayer ) + { + gst_element_get_state( mpPlayer, &aState, NULL, GST_CLOCK_TIME_NONE ); + } + + return( GST_STATE_PLAYING == aState ); +} + +// ------------------------------------------------------------------------------ +double SAL_CALL Player::getDuration() + throw( uno::RuntimeException ) +{ + gint64 nDuration = 0; + + if( implInitPlayer() ) + { + GstFormat aFormat = GST_FORMAT_TIME; + + if( !gst_element_query_duration( mpPlayer, &aFormat, &nDuration ) || + ( GST_FORMAT_TIME != aFormat ) || + ( nDuration < 0 ) ) + { + nDuration = 0; + } + } + + return( static_cast< double >( nDuration ) / NANO_TIME_FACTOR ); +} + +// ------------------------------------------------------------------------------ +void SAL_CALL Player::setMediaTime( double fTime ) + throw( uno::RuntimeException ) +{ + if( implInitPlayer() ) + { + fTime = ::std::min( ::std::max( fTime, 0.0 ), getDuration() ); + + gst_element_seek_simple( mpPlayer, GST_FORMAT_TIME, + (GstSeekFlags) ( GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT ), + static_cast< gint64 >( fTime * NANO_TIME_FACTOR ) ); + } +} + +// ------------------------------------------------------------------------------ +double SAL_CALL Player::getMediaTime() + throw( uno::RuntimeException ) +{ + double fRet = 0.0; + + if( implInitPlayer() ) + { + GstFormat aFormat = GST_FORMAT_TIME; + gint64 nCurTime = 0; + + if( gst_element_query_position( mpPlayer, &aFormat, &nCurTime ) && + ( GST_FORMAT_TIME == aFormat ) && + ( nCurTime >= 0 ) ) + { + fRet = static_cast< double >( nCurTime ) / NANO_TIME_FACTOR; + } + } + + return( fRet ); +} + +// ------------------------------------------------------------------------------ +void SAL_CALL Player::setStopTime( double /* fTime */ ) + throw( uno::RuntimeException ) +{ + if( implInitPlayer() ) + { + // TBD!!! + } +} + +// ------------------------------------------------------------------------------ +double SAL_CALL Player::getStopTime() + throw( uno::RuntimeException ) +{ + double fRet = 0.0; + + if( implInitPlayer() ) + { + // TBD!!! + fRet = getDuration(); + } + + return( fRet ); +} + +// ------------------------------------------------------------------------------ +void SAL_CALL Player::setRate( double /* fRate */ ) + throw( uno::RuntimeException ) +{ + if( implInitPlayer() ) + { + // TBD!!! + } +} + +// ------------------------------------------------------------------------------ +double SAL_CALL Player::getRate() + throw( uno::RuntimeException ) +{ + double fRet = 1.0; + + if( implInitPlayer() ) + { + // TBD!!!; + } + + return( fRet ); +} + +// ------------------------------------------------------------------------------ +void SAL_CALL Player::setPlaybackLoop( sal_Bool bSet ) + throw( uno::RuntimeException ) +{ + g_atomic_int_set( &mnLooping, bSet ? 1 : 0 ); +} + +// ------------------------------------------------------------------------------ +sal_Bool SAL_CALL Player::isPlaybackLoop() + throw( uno::RuntimeException ) +{ + return( g_atomic_int_get( &mnLooping ) > 0 ); +} + +// ------------------------------------------------------------------------------ +void SAL_CALL Player::setMute( sal_Bool bSet ) + throw( uno::RuntimeException ) +{ + if( implInitPlayer() && ( bSet != isMute() ) ) + { + if( bSet ) + { + g_object_set( mpPlayer, "volume", 0.0, NULL ); + } + else + { + setVolumeDB( mnVolumeDB ); + } + } +} + +// ------------------------------------------------------------------------------ +sal_Bool SAL_CALL Player::isMute() + throw( uno::RuntimeException ) +{ + gdouble fGstVolume = 1.0; + + if( implInitPlayer() ) + { + g_object_get( mpPlayer, "volume", &fGstVolume, NULL ); + } + + return( 0.0 == fGstVolume ); +} + +// ------------------------------------------------------------------------------ +void SAL_CALL Player::setVolumeDB( sal_Int16 nVolumeDB ) + throw( uno::RuntimeException ) +{ + g_atomic_int_set( &mnVolumeDB, nVolumeDB ); + + if( implInitPlayer() ) + { + // maximum gain for gstreamer volume is 10 + double fGstVolume = pow( 10.0, static_cast< double >( ::std::min( + nVolumeDB, static_cast< sal_Int16 >( 20 ) ) / 20.0 ) ); + + g_object_set( mpPlayer, "volume", fGstVolume, NULL ); + } +} + +// ------------------------------------------------------------------------------ +sal_Int16 SAL_CALL Player::getVolumeDB() + throw( uno::RuntimeException ) +{ + return( static_cast< sal_Int16 >( g_atomic_int_get( &mnVolumeDB ) ) ); +} + +// ------------------------------------------------------------------------------ +awt::Size SAL_CALL Player::getPreferredPlayerWindowSize() + throw( uno::RuntimeException ) +{ + awt::Size aSize( 0, 0 ); + + if( implInitPlayer() && ( g_atomic_int_get( &mnIsVideoSource ) > 0 ) ) + { + aSize.Width = g_atomic_int_get( &mnVideoWidth ); + aSize.Height = g_atomic_int_get( &mnVideoHeight ); + + // if we have a video source, but no size is given => use default size + if( ( aSize.Width <= 0 ) || ( aSize.Height <= 0 ) ) + { + aSize.Width = VIDEO_DEFAULT_WIDTH; + aSize.Height = VIDEO_DEFAULT_HEIGHT; + } + } + + OSL_TRACE( ">>> Requested preferred video size is: %d x %d pixel", aSize.Width, aSize.Height ); + + return( aSize ); +} + +// ------------------------------------------------------------------------------ +uno::Reference< ::media::XPlayerWindow > SAL_CALL Player::createPlayerWindow( + const uno::Sequence< uno::Any >& rArguments ) + throw( uno::RuntimeException ) +{ + uno::Reference< ::media::XPlayerWindow > xRet; + awt::Size aSize( getPreferredPlayerWindowSize() ); + + OSL_ENSURE( !g_atomic_pointer_get( &mpPlayerWindow ), "::avmedia::gst::Player already has a player window" ); + + if( ( aSize.Width > 0 ) && ( aSize.Height > 0 ) ) + { + Window* pPlayerWindow = new Window( *this ); + + xRet = pPlayerWindow; + + if( !pPlayerWindow->create( rArguments ) ) + { + xRet.clear(); + } + else + { + GstElement* pVideoSink = gst_element_factory_make( "xvimagesink", NULL ); + + if( !pVideoSink ) + { + pVideoSink = gst_element_factory_make( "ximagesink", NULL ); + } + + if( pVideoSink ) + { + GstState aOldState = GST_STATE_NULL; + + mpPlayerWindow = pPlayerWindow; + gst_element_get_state( mpPlayer, &aOldState, NULL, GST_CLOCK_TIME_NONE ); + gst_element_set_state( mpPlayer, GST_STATE_READY ); + g_object_set( mpPlayer, "video-sink", pVideoSink, NULL ); + gst_element_set_state( mpPlayer, aOldState ); + } + } + } + + return( xRet ); +} + +// ------------------------------------------------------------------------------ +uno::Reference< media::XFrameGrabber > SAL_CALL Player::createFrameGrabber() + throw( ::com::sun::star::uno::RuntimeException ) +{ + FrameGrabber* pFrameGrabber = NULL; + const awt::Size aPrefSize( getPreferredPlayerWindowSize() ); + + if( ( aPrefSize.Width > 0 ) && ( aPrefSize.Height > 0 ) ) + { + pFrameGrabber = FrameGrabber::create( mpURI ); + } + + return( pFrameGrabber ); +} + +// ------------------------------------------------------------------------------ +void SAL_CALL Player::dispose() + throw( uno::RuntimeException ) +{ + if( mpPlayer ) + { + stop(); + implQuitThread(); + } + + OSL_ASSERT( NULL == mpPlayer ); +} + +// ------------------------------------------------------------------------------ +void SAL_CALL Player::addEventListener( const uno::Reference< lang::XEventListener >& /*rxListener*/ ) + throw( uno::RuntimeException ) +{} + +// ------------------------------------------------------------------------------ +void SAL_CALL Player::removeEventListener( const uno::Reference< lang::XEventListener >& /*rxListener*/ ) + throw( uno::RuntimeException ) +{} + +// ------------------------------------------------------------------------------ +::rtl::OUString SAL_CALL Player::getImplementationName() + throw( uno::RuntimeException ) +{ + return( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_GSTREAMER_PLAYER_IMPLEMENTATIONNAME ) ) ); +} + +// ------------------------------------------------------------------------------ +sal_Bool SAL_CALL Player::supportsService( const ::rtl::OUString& ServiceName ) + throw( uno::RuntimeException ) +{ + return( ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( AVMEDIA_GSTREAMER_PLAYER_SERVICENAME ) ) ); +} + +// ------------------------------------------------------------------------------ +uno::Sequence< ::rtl::OUString > SAL_CALL Player::getSupportedServiceNames() + throw( uno::RuntimeException ) +{ + uno::Sequence< ::rtl::OUString > aRet( 1 ); + aRet[ 0 ] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_GSTREAMER_PLAYER_SERVICENAME ) ); + + return( aRet ); +} + +// ------------------------------------------------------------------------------ +void Player::implQuitThread() +{ + if( mpThread ) + { + // set quit flag to 1 so that the main loop will be quit in idle + // handler the next time it is called from the thread's main loop + g_atomic_int_add( &mnQuit, 1 ); + + // wait until loop and as such the thread has quit + g_thread_join( mpThread ); + mpThread = NULL; + } +} + +// ------------------------------------------------------------------------------ +bool Player::implInitPlayer() +{ + bool bRet = false; + + if( mpPlayer ) + { + GstState aState = GST_STATE_NULL; + + if( gst_element_get_state( mpPlayer, &aState, NULL, GST_CLOCK_TIME_NONE ) == GST_STATE_CHANGE_SUCCESS ) + { + bRet = ( GST_STATE_PAUSED == aState ) || ( GST_STATE_PLAYING == aState ); + + if( !bRet ) + { + gst_element_set_state( mpPlayer, GST_STATE_PAUSED ); + bRet = ( gst_element_get_state( mpPlayer, &aState, NULL, + GST_CLOCK_TIME_NONE ) == GST_STATE_CHANGE_SUCCESS ) && + ( GST_STATE_PAUSED == aState ); + } + } + } + + return( bRet ); +} + +// ------------------------------------------------------------------------------ +gboolean Player::implBusPrepare( GSource* pSource, + gint* pTimeout ) +{ + if( pTimeout ) + { + *pTimeout = 0; + } + + return( implBusCheck( pSource ) ); +} + +// ------------------------------------------------------------------------------ +gboolean Player::implBusCheck( GSource* pSource ) +{ + GstBusSource* pBusSource = static_cast< GstBusSource* >( pSource ); + + return( pBusSource && + GST_IS_BUS( pBusSource->mpBus ) && + gst_bus_have_pending( GST_BUS_CAST( pBusSource->mpBus ) ) ); +} + +// ------------------------------------------------------------------------------ +gboolean Player::implBusDispatch( GSource* pSource, + GSourceFunc /*aCallback*/, + gpointer pData ) +{ + GstBusSource* pBusSource = static_cast< GstBusSource* >( pSource ); + gboolean bRet = false; + + if( pData && pBusSource && GST_IS_BUS( pBusSource->mpBus ) ) + { + GstMessage* pMsg = gst_bus_pop( pBusSource->mpBus ); + + if( pMsg ) + { + bRet = static_cast< Player* >( pData )->busCallback( pBusSource->mpBus, pMsg ); + gst_message_unref( pMsg ); + } + } + + return( bRet ); +} + +// ------------------------------------------------------------------------------ +void Player::implBusFinalize( GSource* pSource ) +{ + GstBusSource* pBusSource = static_cast< GstBusSource* >( pSource ); + + if( pBusSource && pBusSource->mpBus ) + { + gst_object_unref( pBusSource->mpBus ); + pBusSource->mpBus = NULL; + } +} + +// ------------------------------------------------------------------------------ +gboolean Player::busCallback( GstBus* /*pBus*/, + GstMessage* pMsg ) +{ + if( pMsg && mpLoop ) + { + switch( GST_MESSAGE_TYPE( pMsg ) ) + { + case ( GST_MESSAGE_EOS ): + { + if( g_atomic_int_get( &mnLooping ) > 0 ) + { + setMediaTime( 0.0 ); + start(); + } + else + { + stop(); + } + } + break; + + case ( GST_MESSAGE_ERROR ): + { + gchar* pDebug; + GError* pErr; + + gst_message_parse_error( pMsg, &pErr, &pDebug ); + fprintf( stderr, "Error: %s\n", pErr->message ); + + g_free( pDebug ); + g_error_free( pErr ); + } + break; + + default: + { + break; + } + } + } + + return( true ); +} + +// ------------------------------------------------------------------------------ +gboolean Player::implIdleFunc( gpointer pData ) +{ + return( pData ? static_cast< Player* >( pData )->idle() : true ); +} + +// ------------------------------------------------------------------------------ +gpointer Player::implThreadFunc( gpointer pData ) +{ + return( pData ? static_cast< Player* >( pData )->run() : NULL ); +} + +// ------------------------------------------------------------------------------ +GstBusSyncReply Player::implHandleCreateWindowFunc( GstBus* pBus, + GstMessage* pMsg, + gpointer pData ) +{ + return( pData ? static_cast< Player* >( pData )->handleCreateWindow( pBus, pMsg ) : GST_BUS_PASS ); +} + +// ------------------------------------------------------------------------------ +void Player::implHandleNewElementFunc( GstBin* /* pBin */, + GstElement* pElement, + gpointer pData ) +{ + if( pElement ) + { +#ifdef DEBUG + gchar* pElementName = gst_element_get_name( pElement ); + + if( pElementName ) + { + OSL_TRACE( ">>> Bin has element: %s", pElementName ); + g_free( pElementName ); + } +#endif + + if( GST_IS_BIN( pElement ) ) + { + // set this handler in case we have a GstBin element + g_signal_connect( GST_BIN( pElement ), "element-added", + G_CALLBACK( Player::implHandleNewElementFunc ), pData ); + } + + // watch for all pads that are going to be added to this element; + g_signal_connect( pElement, "pad-added", + G_CALLBACK( Player::implHandleNewPadFunc ), pData ); + } +} + +// ------------------------------------------------------------------------------ +void Player::implHandleNewPadFunc( GstElement* pElement, + GstPad* pPad, + gpointer pData ) +{ + Player* pPlayer = static_cast< Player* >( pData ); + + if( pPlayer && pElement && pPad ) + { +#ifdef DEBUG + gchar* pElementName = gst_element_get_name( pElement ); + gchar* pPadName = gst_pad_get_name( pPad ); + + OSL_TRACE( ">>> Element %s has pad: %s", pElementName, pPadName ); + + g_free( pPadName ); + g_free( pElementName ); +#endif + + GstCaps* pCaps = gst_pad_get_caps( pPad ); + + // we are interested only in getting video properties + // width and height or if we have a video source at all + if( pCaps ) + { + for( gint i = 0, nSize = gst_caps_get_size( pCaps ); i < nSize; ++i ) + { + const GstStructure* pStruct = gst_caps_get_structure( pCaps, i ); + + if( pStruct ) + { + const gchar* pStructName = gst_structure_get_name( pStruct ); + +#ifdef DEBUG + OSL_TRACE( "\t>>> Pad has structure: %s", pStructName ); + + for( gint n = 0, nFields = gst_structure_n_fields( pStruct ); n < nFields; ++n ) + { + OSL_TRACE( "\t\t>>> Structure has field: %s", gst_structure_nth_field_name( pStruct, n ) ); + } +#endif + + // just look for structures having 'video' in their names + if( ::std::string( pStructName ).find( "video" ) != ::std::string::npos ) + { + g_atomic_int_set( &pPlayer->mnIsVideoSource, 1 ); + + for( gint n = 0, nFields = gst_structure_n_fields( pStruct ); n < nFields; ++n ) + { + const gchar* pFieldName = gst_structure_nth_field_name( pStruct, n ); + gint nValue; + + if( ( ::std::string( pFieldName ).find( "width" ) != ::std::string::npos ) && + gst_structure_get_int( pStruct, pFieldName, &nValue ) ) + { + g_atomic_int_set( &pPlayer->mnVideoWidth, + ::std::max( (gint) g_atomic_int_get( + &pPlayer->mnVideoWidth ), nValue ) ); + } + else if( ( ::std::string( pFieldName ).find( "height" ) != ::std::string::npos ) && + gst_structure_get_int( pStruct, pFieldName, &nValue ) ) + { + g_atomic_int_set( &pPlayer->mnVideoHeight, + ::std::max( g_atomic_int_get( &pPlayer->mnVideoHeight ), nValue ) ); + } + } + } + } + } + + gst_caps_unref( pCaps ); + } + } +} + +// ------------------------------------------------------------------------------ +gboolean Player::idle() +{ + // test if main loop should quit and set flag mnQuit to 1 + bool bQuit = g_atomic_int_compare_and_exchange( &mnQuit, 1, 1 ); + + if( bQuit ) + { + // set mnQuit back to 0 to avoid mutiple g_main_loop_quit calls + // in case Player::idle() is called again later; + // the flag should have been set only once within Ctor called from + // the application thread + g_atomic_int_add( &mnQuit, -1 ); + g_main_loop_quit( mpLoop ); + } + + // don't eat up all cpu time + usleep( 1000 ); + + return( true ); +} + +// ------------------------------------------------------------------------------ +gpointer Player::run() +{ + static GSourceFuncs aSourceFuncs = + { + Player::implBusPrepare, + Player::implBusCheck, + Player::implBusDispatch, + Player::implBusFinalize, + NULL, + NULL + }; + + if( NULL != ( mpPlayer = gst_element_factory_make( "playbin", NULL ) ) ) + { + // initialization + // no mutex necessary since initialization + // is synchronous until loop is started + mpContext = g_main_context_new(); + mpLoop = g_main_loop_new( mpContext, false ); + + // add idle callback + GSource* pIdleSource = g_idle_source_new(); + g_source_set_callback( pIdleSource, Player::implIdleFunc, this, NULL ); + g_source_attach( pIdleSource, mpContext ); + + // add bus callback + GSource* pBusSource = g_source_new( &aSourceFuncs, sizeof( GstBusSource ) ); + static_cast< GstBusSource* >( pBusSource )->mpBus = gst_pipeline_get_bus( GST_PIPELINE( mpPlayer ) ); + g_source_set_callback( pBusSource, NULL, this, NULL ); + g_source_attach( pBusSource, mpContext ); + + // add bus sync handler to intercept video window creation for setting our own window + gst_bus_set_sync_handler( static_cast< GstBusSource* >( pBusSource )->mpBus, + Player::implHandleCreateWindowFunc, this ); + + // watch for all elements (and pads) that will be added to the playbin, + // in order to retrieve properties like video width and height + g_signal_connect( GST_BIN( mpPlayer ), "element-added", + G_CALLBACK( Player::implHandleNewElementFunc ), this ); + + // set source URI for player + g_object_set( mpPlayer, "uri", mpURI->str, NULL ); + + // set video fake sink first, since we only create a player without window here + // and don't want to have the gstreamer default window appearing + g_object_set( mpPlayer, "video-sink", gst_element_factory_make( "fakesink", NULL ), NULL ); + + // set state of player to READY or destroy object in case of FAILURE + if( gst_element_set_state( mpPlayer, GST_STATE_READY ) == GST_STATE_CHANGE_FAILURE ) + { + gst_object_unref( mpPlayer ); + mpPlayer = NULL; + } + + g_atomic_int_add( &mnInitialized, 1 ); + g_cond_signal( mpCond ); + + // run the main loop + g_main_loop_run( mpLoop ); + + // clenanup + // no mutex necessary since other thread joined us (this thread) + // after setting the quit flag + if( mpPlayer ) + { + gst_element_set_state( mpPlayer, GST_STATE_NULL ); + gst_object_unref( mpPlayer ); + mpPlayer = NULL; + } + + g_main_loop_unref( mpLoop ); + mpLoop = NULL; + + g_source_destroy( pBusSource ); + g_source_unref( pBusSource ); + + g_source_destroy( pIdleSource ); + g_source_unref( pIdleSource ); + + g_main_context_unref( mpContext ); + mpContext = NULL; + } + else + { + g_atomic_int_add( &mnInitialized, 1 ); + g_cond_signal( mpCond ); + } + + return( NULL ); +} + +// ------------------------------------------------------------------------------ +GstBusSyncReply Player::handleCreateWindow( GstBus* /* pBus */, + GstMessage* pMsg ) +{ + GstBusSyncReply eRet = GST_BUS_PASS; + + if( pMsg && + ( GST_MESSAGE_TYPE( pMsg ) == GST_MESSAGE_ELEMENT ) && + gst_structure_has_name( pMsg->structure, "prepare-xwindow-id" ) && + g_atomic_pointer_get( &mpPlayerWindow ) ) + { + OSL_TRACE( ">>> Got Request to create XOverlay" ); + + gst_x_overlay_set_xwindow_id( GST_X_OVERLAY( GST_MESSAGE_SRC( pMsg ) ), + static_cast< Window* >( g_atomic_pointer_get( + &mpPlayerWindow ) )->getXWindowHandle() ); + + gst_message_unref( pMsg ); + eRet = GST_BUS_DROP; + } + + return( eRet ); +} +} // namespace gst +} // namespace avmedia diff --git a/avmedia/source/gstreamer/gstplayer.hxx b/avmedia/source/gstreamer/gstplayer.hxx new file mode 100644 index 000000000000..c8cf6d558994 --- /dev/null +++ b/avmedia/source/gstreamer/gstplayer.hxx @@ -0,0 +1,224 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: player.hxx,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _GSTPLAYER_HXX +#define _GSTPLAYER_HXX + +#include "gstcommon.hxx" +#include +#include + +#include "com/sun/star/media/XPlayer.hdl" + +namespace avmedia +{ +namespace gst +{ +class Window; + +// --------------- +// - Player_Impl - +// --------------- + +class Player : public ::cppu::WeakImplHelper3< ::com::sun::star::media::XPlayer, + ::com::sun::star::lang::XComponent, + ::com::sun::star::lang::XServiceInfo > +{ +public: + + // static create method instead of public Ctor + static Player* create( const ::rtl::OUString& rURL ); + + ~Player(); + + // XPlayer + virtual void SAL_CALL start() + throw( ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL stop() + throw( ::com::sun::star::uno::RuntimeException ); + + virtual sal_Bool SAL_CALL isPlaying() + throw( ::com::sun::star::uno::RuntimeException ); + + virtual double SAL_CALL getDuration() + throw( ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL setMediaTime( double fTime ) + throw( ::com::sun::star::uno::RuntimeException ); + + virtual double SAL_CALL getMediaTime() + throw( ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL setStopTime( double fTime ) + throw( ::com::sun::star::uno::RuntimeException ); + + virtual double SAL_CALL getStopTime() + throw( ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL setRate( double fRate ) + throw( ::com::sun::star::uno::RuntimeException ); + + virtual double SAL_CALL getRate() + throw( ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL setPlaybackLoop( sal_Bool bSet ) + throw( ::com::sun::star::uno::RuntimeException ); + + virtual sal_Bool SAL_CALL isPlaybackLoop() + throw( ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL setMute( sal_Bool bSet ) + throw( ::com::sun::star::uno::RuntimeException ); + + virtual sal_Bool SAL_CALL isMute() + throw( ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL setVolumeDB( sal_Int16 nVolumeDB ) + throw( ::com::sun::star::uno::RuntimeException ); + + virtual sal_Int16 SAL_CALL getVolumeDB() + throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::awt::Size SAL_CALL getPreferredPlayerWindowSize() + throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayerWindow > SAL_CALL createPlayerWindow( + const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) + throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::media::XFrameGrabber > SAL_CALL createFrameGrabber() + throw( ::com::sun::star::uno::RuntimeException ); + + // XComponent + virtual void SAL_CALL dispose() + throw( ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL addEventListener( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) + throw( ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL removeEventListener( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) + throw( ::com::sun::star::uno::RuntimeException ); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw( ::com::sun::star::uno::RuntimeException ); + + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw( ::com::sun::star::uno::RuntimeException ); + + +protected: Player( GString* pURI = NULL ); + + virtual gboolean busCallback( GstBus* pBus, + GstMessage* pMsg ); + + virtual gboolean idle(); + + virtual gpointer run(); + + virtual GstBusSyncReply handleCreateWindow( GstBus* pBus, + GstMessage* pMsg ); + + void implQuitThread(); + + bool implInitPlayer(); + + bool implIsInitialized() const + { + return( g_atomic_int_get( &mnInitialized ) > 0 ); + } + + +private: Player( const Player& ) {} + + Player & operator=( const Player& ) + { + return( *this ); + } + + static gboolean implBusPrepare( GSource* pSource, + gint* pTimeout ); + + static gboolean implBusCheck( GSource* pSource ); + + static gboolean implBusDispatch( GSource* pSource, + GSourceFunc aCallback, + gpointer pData ); + + static void implBusFinalize( GSource* pSource ); + + static gboolean implIdleFunc( gpointer pData ); + + static gpointer implThreadFunc( gpointer pData ); + + static GstBusSyncReply implHandleCreateWindowFunc( GstBus* pBus, + GstMessage* pMsg, + gpointer pDData ); + + static void implHandleNewElementFunc( GstBin* pBin, + GstElement* pElement, + gpointer pData ); + + static void implHandleNewPadFunc( GstElement* pElem, + GstPad* pPad, + gpointer pData ); + +protected: + + GMutex* mpMutex; + GCond* mpCond; + GThread* mpThread; + GMainContext* mpContext; + GMainLoop* mpLoop; + GstElement* mpPlayer; + GString* mpURI; + +private: + + ::avmedia::gst::Window* mpPlayerWindow; + volatile gint mnIsVideoSource; + volatile gint mnVideoWidth; + volatile gint mnVideoHeight; + volatile gint mnInitialized; + volatile gint mnVolumeDB; + volatile gint mnLooping; + volatile gint mnQuit; + volatile gint mnVideoWindowSet; +}; +} // namespace gst +} // namespace avmedia + +#endif // _GSTPLAYER_HXX diff --git a/avmedia/source/gstreamer/gstuno.cxx b/avmedia/source/gstreamer/gstuno.cxx new file mode 100644 index 000000000000..308b2b14672b --- /dev/null +++ b/avmedia/source/gstreamer/gstuno.cxx @@ -0,0 +1,109 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: xineuno.cxx,v $ + * $Revision: 1.6 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "gstcommon.hxx" +#include "gstmanager.hxx" + +using namespace ::com::sun::star; + +// ------------------- +// - factory methods - +// ------------------- + +static uno::Reference< uno::XInterface > SAL_CALL create_MediaPlayer( const uno::Reference< lang::XMultiServiceFactory >& rxFact ) +{ + return uno::Reference< uno::XInterface >( *new ::avmedia::gst::Manager( rxFact ) ); +} + +// ------------------------------------------ +// - component_getImplementationEnvironment - +// ------------------------------------------ + +extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ ) +{ + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; +} + +// ----------------------- +// - component_writeInfo - +// ----------------------- + +extern "C" sal_Bool SAL_CALL component_writeInfo( void* /* pServiceManager */, void* pRegistryKey ) +{ + sal_Bool bRet = sal_False; + + if( pRegistryKey ) + { + try + { + uno::Reference< registry::XRegistryKey > xNewKey1( + static_cast< registry::XRegistryKey* >( pRegistryKey )->createKey( + ::rtl::OUString::createFromAscii( + "/" AVMEDIA_GSTREAMER_MANAGER_IMPLEMENTATIONNAME "/UNO/SERVICES/" + AVMEDIA_GSTREAMER_MANAGER_SERVICENAME ) ) ); + + bRet = sal_True; + } + catch( registry::InvalidRegistryException& ) + { + OSL_ENSURE( sal_False, "### InvalidRegistryException!" ); + } + } + + return bRet; +} + +// ------------------------ +// - component_getFactory - +// ------------------------ + +extern "C" void* SAL_CALL component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* /* pRegistryKey */ ) +{ + uno::Reference< lang::XSingleServiceFactory > xFactory; + void* pRet = 0; + + if( rtl_str_compare( pImplName, AVMEDIA_GSTREAMER_MANAGER_IMPLEMENTATIONNAME ) == 0 ) + { + const ::rtl::OUString aServiceName( ::rtl::OUString::createFromAscii( AVMEDIA_GSTREAMER_MANAGER_SERVICENAME ) ); + + xFactory = uno::Reference< lang::XSingleServiceFactory >( ::cppu::createSingleFactory( + reinterpret_cast< lang::XMultiServiceFactory* >( pServiceManager ), + ::rtl::OUString::createFromAscii( AVMEDIA_GSTREAMER_MANAGER_IMPLEMENTATIONNAME ), + create_MediaPlayer, uno::Sequence< ::rtl::OUString >( &aServiceName, 1 ) ) ); + } + + if( xFactory.is() ) + { + xFactory->acquire(); + pRet = xFactory.get(); + } + + return pRet; +} diff --git a/avmedia/source/gstreamer/gstwindow.cxx b/avmedia/source/gstreamer/gstwindow.cxx new file mode 100644 index 000000000000..32552eb41b4c --- /dev/null +++ b/avmedia/source/gstreamer/gstwindow.cxx @@ -0,0 +1,671 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: window.cxx,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LG;;PLv3 License. + * + ************************************************************************/ + +#include +#include + +#include + +#include "gstwindow.hxx" +#include "gstplayer.hxx" +#include +#include + +using namespace ::com::sun::star; + +namespace avmedia +{ +namespace gst +{ +// --------------------- +// - PlayerChildWindow - +// --------------------- + +class PlayerChildWindow : public SystemChildWindow +{ +public: + + PlayerChildWindow( Window* pParent ); + ~PlayerChildWindow(); + +protected: + + virtual void MouseMove( const MouseEvent& rMEvt ); + virtual void MouseButtonDown( const MouseEvent& rMEvt ); + virtual void MouseButtonUp( const MouseEvent& rMEvt ); + virtual void KeyInput( const KeyEvent& rKEvt ); + virtual void KeyUp( const KeyEvent& rKEvt ); + virtual void Command( const CommandEvent& rCEvt ); +}; + +// --------------------------------------------------------------------- + +PlayerChildWindow::PlayerChildWindow( Window* pParent ) : + SystemChildWindow( pParent, WB_CLIPCHILDREN ) +{ +} + +// --------------------------------------------------------------------- + +PlayerChildWindow::~PlayerChildWindow() +{ +} + +// --------------------------------------------------------------------- + +void PlayerChildWindow::MouseMove( const MouseEvent& rMEvt ) +{ + const MouseEvent aTransformedEvent( GetParent()->ScreenToOutputPixel( OutputToScreenPixel( rMEvt.GetPosPixel() ) ), + rMEvt.GetClicks(), rMEvt.GetMode(), rMEvt.GetButtons(), rMEvt.GetModifier() ); + + SystemChildWindow::MouseMove( rMEvt ); + GetParent()->MouseMove( aTransformedEvent ); +} + +// --------------------------------------------------------------------- + +void PlayerChildWindow::MouseButtonDown( const MouseEvent& rMEvt ) +{ + const MouseEvent aTransformedEvent( GetParent()->ScreenToOutputPixel( OutputToScreenPixel( rMEvt.GetPosPixel() ) ), + rMEvt.GetClicks(), rMEvt.GetMode(), rMEvt.GetButtons(), rMEvt.GetModifier() ); + + SystemChildWindow::MouseButtonDown( rMEvt ); + GetParent()->MouseButtonDown( aTransformedEvent ); +} + +// --------------------------------------------------------------------- + +void PlayerChildWindow::MouseButtonUp( const MouseEvent& rMEvt ) +{ + const MouseEvent aTransformedEvent( GetParent()->ScreenToOutputPixel( OutputToScreenPixel( rMEvt.GetPosPixel() ) ), + rMEvt.GetClicks(), rMEvt.GetMode(), rMEvt.GetButtons(), rMEvt.GetModifier() ); + + SystemChildWindow::MouseButtonUp( rMEvt ); + GetParent()->MouseButtonUp( aTransformedEvent ); +} + +// --------------------------------------------------------------------- + +void PlayerChildWindow::KeyInput( const KeyEvent& rKEvt ) +{ + SystemChildWindow::KeyInput( rKEvt ); + GetParent()->KeyInput( rKEvt ); +} + +// --------------------------------------------------------------------- + +void PlayerChildWindow::KeyUp( const KeyEvent& rKEvt ) +{ + SystemChildWindow::KeyUp( rKEvt ); + GetParent()->KeyUp( rKEvt ); +} + +// --------------------------------------------------------------------- + +void PlayerChildWindow::Command( const CommandEvent& rCEvt ) +{ + const CommandEvent aTransformedEvent( GetParent()->ScreenToOutputPixel( OutputToScreenPixel( rCEvt.GetMousePosPixel() ) ), + rCEvt.GetCommand(), rCEvt.IsMouseEvent(), rCEvt.GetData() ); + + SystemChildWindow::Command( rCEvt ); + GetParent()->Command( aTransformedEvent ); +} + +// --------------- +// - Window - +// --------------- +Window::Window( ::avmedia::gst::Player& rPlayer ) : + maListeners( maMutex ), + maWindowRect( 0, 0, 0, 0 ), + mrPlayer( rPlayer ), + mpPlayerWindow( NULL ), + meZoomLevel( media::ZoomLevel_NOT_AVAILABLE ), + mnPointerType( awt::SystemPointer::ARROW ) +{} + +// ------------------------------------------------------------------------------ + +Window::~Window() +{ + dispose(); +} + +// ------------------------------------------------------------------------------ + +void Window::implLayoutVideoWindow() +{ + if( mpPlayerWindow && ( media::ZoomLevel_NOT_AVAILABLE != meZoomLevel ) ) + { + awt::Size aPrefSize( mrPlayer.getPreferredPlayerWindowSize() ); + awt::Rectangle aRect = getPosSize(); + int nW = aRect.Width, nH = aRect.Height; + int nVideoW = nW, nVideoH = nH; + int nX = 0, nY = 0, nWidth = 0, nHeight = 0; + bool bDone = false, bZoom = false; + + if( media::ZoomLevel_ORIGINAL == meZoomLevel ) + { + bZoom = true; + } + else if( media::ZoomLevel_ZOOM_1_TO_4 == meZoomLevel ) + { + aPrefSize.Width >>= 2; + aPrefSize.Height >>= 2; + bZoom = true; + } + else if( media::ZoomLevel_ZOOM_1_TO_2 == meZoomLevel ) + { + aPrefSize.Width >>= 1; + aPrefSize.Height >>= 1; + bZoom = true; + } + else if( media::ZoomLevel_ZOOM_2_TO_1 == meZoomLevel ) + { + aPrefSize.Width <<= 1; + aPrefSize.Height <<= 1; + bZoom = true; + } + else if( media::ZoomLevel_ZOOM_4_TO_1 == meZoomLevel ) + { + aPrefSize.Width <<= 2; + aPrefSize.Height <<= 2; + bZoom = true; + } + else if( media::ZoomLevel_FIT_TO_WINDOW == meZoomLevel ) + { + nWidth = nVideoW; + nHeight = nVideoH; + bDone = true; + } + + if( bZoom ) + { + if( ( aPrefSize.Width <= nVideoW ) && ( aPrefSize.Height <= nVideoH ) ) + { + nX = ( nVideoW - aPrefSize.Width ) >> 1; + nY = ( nVideoH - aPrefSize.Height ) >> 1; + nWidth = aPrefSize.Width; + nHeight = aPrefSize.Height; + bDone = true; + } + } + + if( !bDone ) + { + if( ( aPrefSize.Width > 0 ) && ( aPrefSize.Height > 0 ) && ( nVideoW > 0 ) && ( nVideoH > 0 ) ) + { + double fPrefWH = (double) aPrefSize.Width / aPrefSize.Height; + + if( fPrefWH < ( (double) nVideoW / nVideoH ) ) + { + nVideoW = (int) ( nVideoH * fPrefWH ); + } + else + { + nVideoH = (int) ( nVideoW / fPrefWH ); + } + + nX = ( nW - nVideoW ) >> 1; + nY = ( nH - nVideoH ) >> 1; + nWidth = nVideoW; + nHeight = nVideoH; + } + else + { + nX = nY = nWidth = nHeight = 0; + } + } + + mpPlayerWindow->SetPosSizePixel( Point( nX, nY ), Size( nWidth, nHeight ) ); + } +} + +// ------------------------------------------------------------------------------ + +bool Window::create( const uno::Sequence< uno::Any >& rArguments ) +{ + OSL_ASSERT( !mpPlayerWindow ); + OSL_ENSURE( rArguments.getLength() > 2, +"::avmedia::gst::Windiow::create: GStreamer backend needs \ +valid parent SystemChildWindow pointer (sal_IntPtr) as third Any \ +value in sequence of arguments" ); + + bool bRet = false; + + if( !mpPlayerWindow && ( rArguments.getLength() > 2 ) ) + { + SystemChildWindow* pParentWindow = NULL; + sal_IntPtr pIntPtr = NULL; + + // we are not interested in the first argument, which is a pure X11 window handle; + // this backend relies on a SystemChildWindow as parent for the PlayerWindow, given + // as third Sal_IntPtr value within the argument Sequence + rArguments[ 1 ] >>= maWindowRect; + + rArguments[ 2 ] >>= pIntPtr; + pParentWindow = reinterpret_cast< SystemChildWindow* >( pIntPtr ); + + if( pParentWindow ) + { + meZoomLevel = media::ZoomLevel_ORIGINAL; + + mpPlayerWindow = new PlayerChildWindow( pParentWindow ); + mpPlayerWindow->SetBackground( Color( COL_BLACK ) ); + mpPlayerWindow->SetPosSizePixel( Point( maWindowRect.X, maWindowRect.Y ), + Size( maWindowRect.Width, maWindowRect.Height ) ); + mpPlayerWindow->Show(); + + bRet = true; + } + } + + return( bRet ); +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::update() + throw( uno::RuntimeException ) +{ + if( mpPlayerWindow ) + { + mpPlayerWindow->Invalidate( INVALIDATE_UPDATE ); + mpPlayerWindow->Sync(); + } +} + +// ------------------------------------------------------------------------------ + +sal_Bool SAL_CALL Window::setZoomLevel( media::ZoomLevel eZoomLevel ) + throw(uno::RuntimeException) +{ + bool bRet = false; + + if( ( media::ZoomLevel_NOT_AVAILABLE != meZoomLevel ) && + ( media::ZoomLevel_NOT_AVAILABLE != eZoomLevel ) ) + { + if( eZoomLevel != meZoomLevel ) + { + meZoomLevel = eZoomLevel; + implLayoutVideoWindow(); + } + + bRet = true; + } + + return( bRet ); +} + +// ------------------------------------------------------------------------------ + +media::ZoomLevel SAL_CALL Window::getZoomLevel() + throw( uno::RuntimeException ) +{ + return( meZoomLevel ); +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::setPointerType( sal_Int32 nPointerType ) + throw( uno::RuntimeException ) +{ + if( mpPlayerWindow ) + { + Pointer ePointer = POINTER_ARROW; + + switch( nPointerType ) + { + case (awt::SystemPointer::CROSS) : + { + ePointer = POINTER_CROSS; + } + break; + + case (awt::SystemPointer::HAND) : + { + ePointer = POINTER_HAND; + } + break; + + case (awt::SystemPointer::MOVE) : + { + ePointer = POINTER_MOVE; + } + break; + + case (awt::SystemPointer::WAIT) : + { + ePointer = POINTER_WAIT; + } + break; + + default: + break; + } + + mpPlayerWindow->SetPointer( ePointer ); + } +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::setPosSize( sal_Int32 nX, + sal_Int32 nY, + sal_Int32 nWidth, + sal_Int32 nHeight, + sal_Int16 /* Flags */ ) + throw( uno::RuntimeException ) +{ + maWindowRect.X = nX; + maWindowRect.Y = nY; + maWindowRect.Width = nWidth; + maWindowRect.Height = nHeight; + + implLayoutVideoWindow(); +} + +// ------------------------------------------------------------------------------ + +awt::Rectangle SAL_CALL Window::getPosSize() + throw( uno::RuntimeException ) +{ + return( maWindowRect ); +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::setVisible( sal_Bool bVisible ) + throw( uno::RuntimeException ) +{ + if( mpPlayerWindow ) + { + bVisible ? mpPlayerWindow->Show() : mpPlayerWindow->Hide(); + } +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::setEnable( sal_Bool bEnable ) + throw( uno::RuntimeException ) +{ + if( mpPlayerWindow ) + { + mpPlayerWindow->Enable( bEnable ); + } +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::setFocus() + throw( uno::RuntimeException ) +{ + if( mpPlayerWindow ) + { + mpPlayerWindow->GrabFocus(); + } +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::addWindowListener( const uno::Reference< awt::XWindowListener >& xListener ) + throw( uno::RuntimeException ) +{ + maListeners.addInterface( getCppuType( &xListener ), xListener ); +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::removeWindowListener( const uno::Reference< awt::XWindowListener >& xListener ) + throw( uno::RuntimeException ) +{ + maListeners.removeInterface( getCppuType( &xListener ), xListener ); +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::addFocusListener( const uno::Reference< awt::XFocusListener >& xListener ) + throw( uno::RuntimeException ) +{ + maListeners.addInterface( getCppuType( &xListener ), xListener ); +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::removeFocusListener( const uno::Reference< awt::XFocusListener >& xListener ) + throw( uno::RuntimeException ) +{ + maListeners.removeInterface( getCppuType( &xListener ), xListener ); +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::addKeyListener( const uno::Reference< awt::XKeyListener >& xListener ) + throw( uno::RuntimeException ) +{ + maListeners.addInterface( getCppuType( &xListener ), xListener ); +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::removeKeyListener( const uno::Reference< awt::XKeyListener >& xListener ) + throw( uno::RuntimeException ) +{ + maListeners.removeInterface( getCppuType( &xListener ), xListener ); +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::addMouseListener( const uno::Reference< awt::XMouseListener >& xListener ) + throw( uno::RuntimeException ) +{ + maListeners.addInterface( getCppuType( &xListener ), xListener ); +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::removeMouseListener( const uno::Reference< awt::XMouseListener >& xListener ) + throw( uno::RuntimeException ) +{ + maListeners.removeInterface( getCppuType( &xListener ), xListener ); +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::addMouseMotionListener( const uno::Reference< awt::XMouseMotionListener >& xListener ) + throw( uno::RuntimeException ) +{ + maListeners.addInterface( getCppuType( &xListener ), xListener ); +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::removeMouseMotionListener( const uno::Reference< awt::XMouseMotionListener >& xListener ) + throw( uno::RuntimeException ) +{ + maListeners.removeInterface( getCppuType( &xListener ), xListener ); +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::addPaintListener( const uno::Reference< awt::XPaintListener >& xListener ) + throw( uno::RuntimeException ) +{ + maListeners.addInterface( getCppuType( &xListener ), xListener ); +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::removePaintListener( const uno::Reference< awt::XPaintListener >& xListener ) + throw( uno::RuntimeException ) +{ + maListeners.removeInterface( getCppuType( &xListener ), xListener ); +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::dispose() + throw( uno::RuntimeException ) +{ + delete mpPlayerWindow; + mpPlayerWindow = NULL; +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::addEventListener( const uno::Reference< lang::XEventListener >& xListener ) + throw( uno::RuntimeException ) +{ + maListeners.addInterface( getCppuType( &xListener ), xListener ); +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::removeEventListener( const uno::Reference< lang::XEventListener >& + xListener ) + throw( uno::RuntimeException ) +{ + maListeners.removeInterface( getCppuType( &xListener ), xListener ); +} + +// ------------------------------------------------------------------------------ + +void Window::fireMousePressedEvent( const ::com::sun::star::awt::MouseEvent& rEvt ) +{ + ::cppu::OInterfaceContainerHelper* pContainer = + maListeners.getContainer( getCppuType( ( uno::Reference< awt::XMouseListener >* ) 0 ) ); + + if( pContainer ) + { + ::cppu::OInterfaceIteratorHelper aIter( *pContainer ); + + while( aIter.hasMoreElements() ) + { + uno::Reference< awt::XMouseListener >( aIter.next(), + uno::UNO_QUERY )->mousePressed( rEvt ); + } + } +} + +// ----------------------------------------------------------------------------- + +void Window::fireMouseReleasedEvent( const ::com::sun::star::awt::MouseEvent& rEvt ) +{ + ::cppu::OInterfaceContainerHelper* pContainer = + maListeners.getContainer( getCppuType( ( uno::Reference< awt::XMouseListener >* ) 0 ) ); + + if( pContainer ) + { + ::cppu::OInterfaceIteratorHelper aIter( *pContainer ); + + while( aIter.hasMoreElements() ) + { + uno::Reference< awt::XMouseListener >( aIter.next(), + uno::UNO_QUERY )->mouseReleased( rEvt ); + } + } +} + +// ----------------------------------------------------------------------------- + +void Window::fireMouseMovedEvent( const ::com::sun::star::awt::MouseEvent& rEvt ) +{ + ::cppu::OInterfaceContainerHelper* pContainer = + maListeners.getContainer( getCppuType( ( uno::Reference< awt::XMouseMotionListener >* ) + 0 ) ); + + if( pContainer ) + { + ::cppu::OInterfaceIteratorHelper aIter( *pContainer ); + + while( aIter.hasMoreElements() ) + { + uno::Reference< awt::XMouseMotionListener >( aIter.next(), + uno::UNO_QUERY )->mouseMoved( rEvt ); + } + } +} + +// ----------------------------------------------------------------------------- + +void Window::fireSetFocusEvent( const ::com::sun::star::awt::FocusEvent& rEvt ) +{ + ::cppu::OInterfaceContainerHelper* pContainer = + maListeners.getContainer( getCppuType( ( uno::Reference< awt::XFocusListener >* ) 0 ) ); + + if( pContainer ) + { + ::cppu::OInterfaceIteratorHelper aIter( *pContainer ); + + while( aIter.hasMoreElements() ) + { + uno::Reference< awt::XFocusListener >( aIter.next(), + uno::UNO_QUERY )->focusGained( rEvt ); + } + } +} + +// ------------------------------------------------------------------------------ + +long Window::getXWindowHandle() const +{ + return( mpPlayerWindow ? mpPlayerWindow->GetSystemData()->aWindow : 0 ); +} + + +// ------------------------------------------------------------------------------ + +::rtl::OUString SAL_CALL Window::getImplementationName() + throw( uno::RuntimeException ) +{ + return( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + AVMEDIA_GSTREAMER_WINDOW_IMPLEMENTATIONNAME ) ) ); +} + +// ------------------------------------------------------------------------------ + +sal_Bool SAL_CALL Window::supportsService( const ::rtl::OUString& ServiceName ) + throw( uno::RuntimeException ) +{ + return( ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( + AVMEDIA_GSTREAMER_WINDOW_SERVICENAME ) ) ); +} + +// ------------------------------------------------------------------------------ + +uno::Sequence< ::rtl::OUString > SAL_CALL Window::getSupportedServiceNames() + throw( uno::RuntimeException ) +{ + uno::Sequence< ::rtl::OUString > aRet( 1 ); + aRet[ 0 ] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_GSTREAMER_WINDOW_SERVICENAME ) ); + + return( aRet ); +} +} // namespace gst +} // namespace avmedia diff --git a/avmedia/source/gstreamer/gstwindow.hxx b/avmedia/source/gstreamer/gstwindow.hxx new file mode 100644 index 000000000000..b8b51a8c7c9a --- /dev/null +++ b/avmedia/source/gstreamer/gstwindow.hxx @@ -0,0 +1,200 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: window.hxx,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _GSTWINDOW_HXX +#define _GSTWINDOW_HXX + +#include "gstcommon.hxx" +#include + +#ifndef _COM_SUN_STAR_MEDIA_XPLAYERWINDOW_HDL_ +#include "com/sun/star/media/XPlayerWindow.hdl" +#endif + +namespace avmedia +{ +namespace gst +{ + +class PlayerChildWindow; + +// --------------- +// - Window - +// --------------- + +class Player; + +class Window : public ::cppu::WeakImplHelper2< ::com::sun::star::media::XPlayerWindow, + ::com::sun::star::lang::XServiceInfo > +{ + friend class Player; + +public: Window( ::avmedia::gst::Player& rPlayer ); + ~Window(); + + bool create( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ); + + // XPlayerWindow + virtual void SAL_CALL update() + throw( ::com::sun::star::uno::RuntimeException ); + + virtual sal_Bool SAL_CALL setZoomLevel( ::com::sun::star::media::ZoomLevel ZoomLevel ) + throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::media::ZoomLevel SAL_CALL getZoomLevel() + throw( ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL setPointerType( sal_Int32 nPointerType ) + throw( ::com::sun::star::uno::RuntimeException ); + + // XWindow + virtual void SAL_CALL setPosSize( sal_Int32 X, + sal_Int32 Y, + sal_Int32 Width, + sal_Int32 Height, + sal_Int16 Flags ) + throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::awt::Rectangle SAL_CALL getPosSize() + throw( ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL setVisible( sal_Bool Visible ) + throw( ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL setEnable( sal_Bool Enable ) + throw( ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL setFocus() + throw( ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL addWindowListener( + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& xListener ) + throw( ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL removeWindowListener( + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& xListener ) + throw( ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL addFocusListener( + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) + throw( ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL removeFocusListener( + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) + throw( ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL addKeyListener( + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& xListener ) + throw( ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL removeKeyListener( + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& xListener ) + throw( ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL addMouseListener( + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& xListener ) + throw( ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL removeMouseListener( + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& xListener ) + throw( ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL addMouseMotionListener( + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& xListener ) + throw( ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL removeMouseMotionListener( + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& xListener ) + throw( ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL addPaintListener( + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& xListener ) + throw( ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL removePaintListener( + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& xListener ) + throw( ::com::sun::star::uno::RuntimeException ); + + // XComponent + virtual void SAL_CALL dispose() + throw( ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL addEventListener( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) + throw( ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL removeEventListener( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) + throw( ::com::sun::star::uno::RuntimeException ); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw( ::com::sun::star::uno::RuntimeException ); + + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw( ::com::sun::star::uno::RuntimeException ); + + +public: + + void fireMousePressedEvent( const ::com::sun::star::awt::MouseEvent& rEvt ); + + void fireMouseReleasedEvent( const ::com::sun::star::awt::MouseEvent& rEvt ); + + void fireMouseMovedEvent( const ::com::sun::star::awt::MouseEvent& rEvt ); + + void fireKeyPressedEvent( const ::com::sun::star::awt::KeyEvent& rEvt ); + + void fireKeyReleasedEvent( const ::com::sun::star::awt::KeyEvent& rEvt ); + + void fireSetFocusEvent( const ::com::sun::star::awt::FocusEvent& rEvt ); + +protected: + + long getXWindowHandle() const; + +private: + + ::osl::Mutex maMutex; + ::cppu::OMultiTypeInterfaceContainerHelper maListeners; + ::com::sun::star::awt::Rectangle maWindowRect; + Player& mrPlayer; + PlayerChildWindow* mpPlayerWindow; + ::com::sun::star::media::ZoomLevel meZoomLevel; + sal_Int32 mnPointerType; + + void implLayoutVideoWindow(); +}; +} // namespace gst +} // namespace avmedia + +#endif // _GSTWINDOW_HXX diff --git a/avmedia/source/gstreamer/makefile.mk b/avmedia/source/gstreamer/makefile.mk new file mode 100644 index 000000000000..1c2aa65811cf --- /dev/null +++ b/avmedia/source/gstreamer/makefile.mk @@ -0,0 +1,75 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.5 $ +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/.. +PRJNAME=avmediagst +TARGET=avmediagst + +# --- Settings ---------------------------------- + +.INCLUDE : settings.mk + +.IF "$(verbose)"!="" || "$(VERBOSE)"!="" +CDEFS+= -DVERBOSE +.ENDIF + +# --- Files ---------------------------------- + +.IF "$(GUI)" == "UNX" && "$(GUIBASE)"!="aqua" && "$(ENABLE_GSTREAMER)" != "" + +PKGCONFIG_MODULES=gtk+-2.0 gstreamer-0.10 gstreamer-interfaces-0.10 +.INCLUDE : pkg_config.mk + +SLOFILES= \ + $(SLO)$/gstuno.obj \ + $(SLO)$/gstmanager.obj \ + $(SLO)$/gstwindow.obj \ + $(SLO)$/gstplayer.obj \ + $(SLO)$/gstframegrabber.obj + +EXCEPTIONSFILES= \ + $(SLO)$/gstuno.obj \ + $(SLO)$/gstplayer.obj \ + $(SLO)$/gstframegrabber.obj + +SHL1TARGET=$(TARGET) +SHL1STDLIBS= $(CPPULIB) $(SALLIB) $(COMPHELPERLIB) $(CPPUHELPERLIB) $(TOOLSLIB) $(VCLLIB) +SHL1STDLIBS+=$(PKGCONFIG_LIBS) +SHL1IMPLIB=i$(TARGET) +SHL1LIBS=$(SLB)$/$(TARGET).lib +SHL1DEF=$(MISC)$/$(SHL1TARGET).def + +DEF1NAME=$(SHL1TARGET) +DEF1EXPORTFILE=exports.dxp + +.ENDIF + +.INCLUDE : target.mk diff --git a/avmedia/source/inc/mediamisc.hxx b/avmedia/source/inc/mediamisc.hxx index fd89e9d4abde..4d09192b3031 100644 --- a/avmedia/source/inc/mediamisc.hxx +++ b/avmedia/source/inc/mediamisc.hxx @@ -30,12 +30,15 @@ class ResMgr; #define AVMEDIA_RESID( nId ) ResId( nId, * ::avmedia::GetResMgr() ) #ifdef WNT -#define AVMEDIA_MANAGER_SERVICE_NAME "com.sun.star.media.Manager_DirectX" +#define AVMEDIA_MANAGER_SERVICE_NAME "com.sun.star.comp.avmedia.Manager_DirectX" +#define AVMEDIA_MANAGER_SERVICE_IS_JAVABASED sal_False #else #ifdef QUARTZ -#define AVMEDIA_MANAGER_SERVICE_NAME "com.sun.star.comp.avmedia.Manager_QuickTime" +#define AVMEDIA_MANAGER_SERVICE_NAME "com.sun.star.comp.avmedia.Manager_QuickTime" +#define AVMEDIA_MANAGER_SERVICE_IS_JAVABASED sal_False #else -#define AVMEDIA_MANAGER_SERVICE_NAME "com.sun.star.media.Manager_Java" +#define AVMEDIA_MANAGER_SERVICE_NAME "com.sun.star.comp.avmedia.Manager_GStreamer" +#define AVMEDIA_MANAGER_SERVICE_IS_JAVABASED sal_False #endif #endif diff --git a/avmedia/source/java/Manager.java b/avmedia/source/java/Manager.java index 47707478fd5b..2e8cf04fce4a 100644 --- a/avmedia/source/java/Manager.java +++ b/avmedia/source/java/Manager.java @@ -89,7 +89,7 @@ public class Manager implements com.sun.star.lang.XServiceInfo, // - XServiceInfo - // ---------------- - private static final String s_implName = "com.sun.star.comp.media.Manager_Java"; + private static final String s_implName = "com.sun.star.comp.avmedia.Manager_Java"; private static final String s_serviceName = "com.sun.star.media.Manager_Java"; public synchronized String getImplementationName() diff --git a/avmedia/source/java/MediaUno.java b/avmedia/source/java/MediaUno.java index ca7a164586d8..f4121950165f 100644 --- a/avmedia/source/java/MediaUno.java +++ b/avmedia/source/java/MediaUno.java @@ -34,7 +34,7 @@ import com.sun.star.lang.XInitialization; public class MediaUno { - private static final String s_implName = "com.sun.star.comp.media.Manager_Java"; + private static final String s_implName = "com.sun.star.comp.avmedia.Manager_Java"; private static final String s_serviceName = "com.sun.star.media.Manager_Java"; // ------------------------------------------------------------------------- diff --git a/avmedia/source/viewer/mediawindow.cxx b/avmedia/source/viewer/mediawindow.cxx index b2d1e5162cb5..fb781d70cfb6 100644 --- a/avmedia/source/viewer/mediawindow.cxx +++ b/avmedia/source/viewer/mediawindow.cxx @@ -162,7 +162,9 @@ Size MediaWindow::getPreferredSize() const void MediaWindow::setPosSize( const Rectangle& rNewRect ) { if( mpImpl ) + { mpImpl->setPosSize( rNewRect ); + } } // ------------------------------------------------------------------------- @@ -368,6 +370,7 @@ void MediaWindow::getMediaFilters( FilterNameVector& rFilterNameVector ) "AU Audio", "au", "AVI", "avi", "CD Audio", "cda", + "Matroska Media", "mkv", "MIDI Audio", "mid;midi", "MPEG Audio", "mp2;mp3;mpa", "MPEG Video", "mpg;mpeg;mpv;mp4", @@ -464,39 +467,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::createFromAscii( 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_impl.cxx b/avmedia/source/viewer/mediawindow_impl.cxx index 553eea6196c1..83bc9b458a8b 100644 --- a/avmedia/source/viewer/mediawindow_impl.cxx +++ b/avmedia/source/viewer/mediawindow_impl.cxx @@ -1,4 +1,4 @@ -/************************************************************************* +/************************************************************************ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -94,7 +94,7 @@ void MediaWindowControl::execute( const MediaItem& rItem ) // -------------------- MediaChildWindow::MediaChildWindow( Window* pParent ) : - JavaChildWindow( pParent, WB_CLIPCHILDREN ) + SystemChildWindow( pParent, WB_CLIPCHILDREN ) { } @@ -111,7 +111,7 @@ void MediaChildWindow::MouseMove( const MouseEvent& rMEvt ) const MouseEvent aTransformedEvent( GetParent()->ScreenToOutputPixel( OutputToScreenPixel( rMEvt.GetPosPixel() ) ), rMEvt.GetClicks(), rMEvt.GetMode(), rMEvt.GetButtons(), rMEvt.GetModifier() ); - JavaChildWindow::MouseMove( rMEvt ); + SystemChildWindow::MouseMove( rMEvt ); GetParent()->MouseMove( aTransformedEvent ); } @@ -122,7 +122,7 @@ void MediaChildWindow::MouseButtonDown( const MouseEvent& rMEvt ) const MouseEvent aTransformedEvent( GetParent()->ScreenToOutputPixel( OutputToScreenPixel( rMEvt.GetPosPixel() ) ), rMEvt.GetClicks(), rMEvt.GetMode(), rMEvt.GetButtons(), rMEvt.GetModifier() ); - JavaChildWindow::MouseButtonDown( rMEvt ); + SystemChildWindow::MouseButtonDown( rMEvt ); GetParent()->MouseButtonDown( aTransformedEvent ); } @@ -133,7 +133,7 @@ void MediaChildWindow::MouseButtonUp( const MouseEvent& rMEvt ) const MouseEvent aTransformedEvent( GetParent()->ScreenToOutputPixel( OutputToScreenPixel( rMEvt.GetPosPixel() ) ), rMEvt.GetClicks(), rMEvt.GetMode(), rMEvt.GetButtons(), rMEvt.GetModifier() ); - JavaChildWindow::MouseButtonUp( rMEvt ); + SystemChildWindow::MouseButtonUp( rMEvt ); GetParent()->MouseButtonUp( aTransformedEvent ); } @@ -141,7 +141,7 @@ void MediaChildWindow::MouseButtonUp( const MouseEvent& rMEvt ) void MediaChildWindow::KeyInput( const KeyEvent& rKEvt ) { - JavaChildWindow::KeyInput( rKEvt ); + SystemChildWindow::KeyInput( rKEvt ); GetParent()->KeyInput( rKEvt ); } @@ -149,7 +149,7 @@ void MediaChildWindow::KeyInput( const KeyEvent& rKEvt ) void MediaChildWindow::KeyUp( const KeyEvent& rKEvt ) { - JavaChildWindow::KeyUp( rKEvt ); + SystemChildWindow::KeyUp( rKEvt ); GetParent()->KeyUp( rKEvt ); } @@ -160,7 +160,7 @@ void MediaChildWindow::Command( const CommandEvent& rCEvt ) const CommandEvent aTransformedEvent( GetParent()->ScreenToOutputPixel( OutputToScreenPixel( rCEvt.GetMousePosPixel() ) ), rCEvt.GetCommand(), rCEvt.IsMouseEvent(), rCEvt.GetData() ); - JavaChildWindow::Command( rCEvt ); + SystemChildWindow::Command( rCEvt ); GetParent()->Command( aTransformedEvent ); } @@ -179,6 +179,7 @@ MediaWindowImpl::MediaWindowImpl( Window* pParent, MediaWindow* pMediaWindow, bo mpEmptyBmpEx( NULL ), mpAudioBmpEx( NULL ) { + maChildWindow.SetBackground( Color( COL_BLACK ) ); maChildWindow.SetHelpId( HID_AVMEDIA_PLAYERWINDOW ); maChildWindow.Hide(); @@ -229,19 +230,24 @@ void MediaWindowImpl::onURLChanged() { if( getPlayer().is() ) { - uno::Sequence< uno::Any > aArgs( 2 ); uno::Reference< media::XPlayerWindow > xPlayerWindow; const Point aPoint; const Size aSize( maChildWindow.GetSizePixel() ); - const sal_IntPtr nWndHandle = static_cast< sal_IntPtr >( maChildWindow.getParentWindowHandleForJava() ); - - aArgs[ 0 ] = uno::makeAny( nWndHandle ); - aArgs[ 1 ] = uno::makeAny( awt::Rectangle( aPoint.X(), aPoint.Y(), aSize.Width(), aSize.Height() ) ); + const sal_IntPtr nWndHandle = (sal_IntPtr) maChildWindow. + GetParentWindowHandle( AVMEDIA_MANAGER_SERVICE_IS_JAVABASED ); try { if( nWndHandle != 0 ) + { + uno::Sequence< uno::Any > aArgs( 3 ); + + aArgs[ 0 ] = uno::makeAny( nWndHandle ); + aArgs[ 1 ] = uno::makeAny( awt::Rectangle( aPoint.X(), aPoint.Y(), aSize.Width(), aSize.Height() ) ); + aArgs[ 2 ] = uno::makeAny( reinterpret_cast< sal_IntPtr >( &maChildWindow ) ); + xPlayerWindow = getPlayer()->createPlayerWindow( aArgs ); + } } catch( uno::RuntimeException ) { @@ -273,8 +279,6 @@ void MediaWindowImpl::onURLChanged() updateMediaItem( aItem ); mpMediaWindowControl->setState( aItem ); } - - Invalidate(); } // --------------------------------------------------------------------- @@ -291,7 +295,7 @@ void MediaWindowImpl::update() void MediaWindowImpl::setPosSize( const Rectangle& rRect ) { - SetPosSizePixel( rRect.Left(), rRect.Top(), rRect.GetWidth(), rRect.GetHeight() ); + SetPosSizePixel( rRect.TopLeft(), rRect.GetSize() ); } // --------------------------------------------------------------------- @@ -305,7 +309,6 @@ void MediaWindowImpl::setPointer( const Pointer& rPointer ) if( xPlayerWindow.is() ) { - long nPointer; switch( rPointer.GetStyle() ) @@ -355,10 +358,10 @@ void MediaWindowImpl::Resize() 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 ); } // --------------------------------------------------------------------- @@ -405,7 +408,7 @@ void MediaWindowImpl::Paint( const Rectangle& ) pLogo = mpEmptyBmpEx; } - else if ( !getPlayerWindow().is() ) + else if( !getPlayerWindow().is() ) { if( !mpAudioBmpEx ) mpAudioBmpEx = new BitmapEx( AVMEDIA_RESID( AVMEDIA_BMP_AUDIOLOGO ) ); @@ -446,8 +449,6 @@ void MediaWindowImpl::Paint( const Rectangle& ) 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 679b864af6b7..9008e499647d 100644 --- a/avmedia/source/viewer/mediawindow_impl.hxx +++ b/avmedia/source/viewer/mediawindow_impl.hxx @@ -2,10 +2,13 @@ * * 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 @@ -29,7 +32,7 @@ #define _AVMEDIA_MEDIAWINDOW_IMPL_HXX #include -#include +#include #include "mediawindowbase_impl.hxx" #include "mediacontrol.hxx" @@ -61,7 +64,7 @@ namespace avmedia // - MediaChildWindow - // -------------------- - class MediaChildWindow : public JavaChildWindow + class MediaChildWindow : public SystemChildWindow { public: diff --git a/avmedia/source/viewer/mediawindowbase_impl.cxx b/avmedia/source/viewer/mediawindowbase_impl.cxx index ea28121e3609..5412e7a5b804 100644 --- a/avmedia/source/viewer/mediawindowbase_impl.cxx +++ b/avmedia/source/viewer/mediawindowbase_impl.cxx @@ -143,10 +143,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/win/winuno.cxx b/avmedia/source/win/winuno.cxx index 4b06fd10727f..645871290413 100644 --- a/avmedia/source/win/winuno.cxx +++ b/avmedia/source/win/winuno.cxx @@ -62,7 +62,7 @@ extern "C" sal_Bool SAL_CALL component_writeInfo( void*, void* pRegistryKey ) { uno::Reference< registry::XRegistryKey > xNewKey1( static_cast< registry::XRegistryKey* >( pRegistryKey )->createKey( - ::rtl::OUString::createFromAscii( "/com.sun.star.comp.media.Manager_DirectX/UNO/SERVICES/com.sun.star.media.Manager_DirectX" ) ) ); + ::rtl::OUString::createFromAscii( "/com.sun.star.comp.avmedia.Manager_DirectX/UNO/SERVICES/com.sun.star.media.Manager_DirectX" ) ) ); bRet = sal_True; } @@ -84,13 +84,13 @@ extern "C" void* SAL_CALL component_getFactory( const sal_Char* pImplName, void* uno::Reference< lang::XSingleServiceFactory > xFactory; void* pRet = 0; - if( rtl_str_compare( pImplName, "com.sun.star.comp.media.Manager_DirectX" ) == 0 ) + if( rtl_str_compare( pImplName, "com.sun.star.comp.avmedia.Manager_DirectX" ) == 0 ) { const ::rtl::OUString aServiceName( ::rtl::OUString::createFromAscii( "com.sun.star.media.Manager_DirectX" ) ); xFactory = uno::Reference< lang::XSingleServiceFactory >( ::cppu::createSingleFactory( reinterpret_cast< lang::XMultiServiceFactory* >( pServiceManager ), - ::rtl::OUString::createFromAscii( "com.sun.star.comp.media.Manager_DirectX" ), + ::rtl::OUString::createFromAscii( "com.sun.star.comp.avmedia.Manager_DirectX" ), create_MediaPlayer, uno::Sequence< ::rtl::OUString >( &aServiceName, 1 ) ) ); } -- cgit From 4a9586e991cdec7564585070b90e1c6acbcecab1 Mon Sep 17 00:00:00 2001 From: ka Date: Wed, 9 Jun 2010 21:15:24 +0200 Subject: avmedia101: adjustments for new GStreamer build baseline --- avmedia/source/gstreamer/gstplayer.cxx | 26 +++++++++++--------- avmedia/source/gstreamer/gstplayer.hxx | 44 ++++++++++++++++++++++------------ 2 files changed, 44 insertions(+), 26 deletions(-) (limited to 'avmedia') diff --git a/avmedia/source/gstreamer/gstplayer.cxx b/avmedia/source/gstreamer/gstplayer.cxx index e1a7ef566ee2..e9fe02594b66 100644 --- a/avmedia/source/gstreamer/gstplayer.cxx +++ b/avmedia/source/gstreamer/gstplayer.cxx @@ -326,7 +326,10 @@ double SAL_CALL Player::getRate() void SAL_CALL Player::setPlaybackLoop( sal_Bool bSet ) throw( uno::RuntimeException ) { - g_atomic_int_set( &mnLooping, bSet ? 1 : 0 ); + if( bSet && !isPlaybackLoop() ) + g_atomic_int_inc( &mnLooping ); + else if( !bSet && isPlaybackLoop() ) + g_atomic_int_dec_and_test( &mnLooping ); } // ------------------------------------------------------------------------------ @@ -371,10 +374,12 @@ sal_Bool SAL_CALL Player::isMute() void SAL_CALL Player::setVolumeDB( sal_Int16 nVolumeDB ) throw( uno::RuntimeException ) { - g_atomic_int_set( &mnVolumeDB, nVolumeDB ); - if( implInitPlayer() ) { + g_mutex_lock( mpMutex ); + mnVolumeDB = nVolumeDB; + g_mutex_unlock( mpMutex ); + // maximum gain for gstreamer volume is 10 double fGstVolume = pow( 10.0, static_cast< double >( ::std::min( nVolumeDB, static_cast< sal_Int16 >( 20 ) ) / 20.0 ) ); @@ -528,7 +533,7 @@ void Player::implQuitThread() { // set quit flag to 1 so that the main loop will be quit in idle // handler the next time it is called from the thread's main loop - g_atomic_int_add( &mnQuit, 1 ); + g_atomic_int_inc( &mnQuit ); // wait until loop and as such the thread has quit g_thread_join( mpThread ); @@ -758,7 +763,7 @@ void Player::implHandleNewPadFunc( GstElement* pElement, // just look for structures having 'video' in their names if( ::std::string( pStructName ).find( "video" ) != ::std::string::npos ) { - g_atomic_int_set( &pPlayer->mnIsVideoSource, 1 ); + g_atomic_int_inc( &pPlayer->mnIsVideoSource ); for( gint n = 0, nFields = gst_structure_n_fields( pStruct ); n < nFields; ++n ) { @@ -768,15 +773,14 @@ void Player::implHandleNewPadFunc( GstElement* pElement, if( ( ::std::string( pFieldName ).find( "width" ) != ::std::string::npos ) && gst_structure_get_int( pStruct, pFieldName, &nValue ) ) { - g_atomic_int_set( &pPlayer->mnVideoWidth, - ::std::max( (gint) g_atomic_int_get( - &pPlayer->mnVideoWidth ), nValue ) ); + const gint nDiff = nValue - g_atomic_int_get( &pPlayer->mnVideoWidth ); + g_atomic_int_add( &pPlayer->mnVideoWidth, ::std::max( nDiff, 0 ) ); } else if( ( ::std::string( pFieldName ).find( "height" ) != ::std::string::npos ) && gst_structure_get_int( pStruct, pFieldName, &nValue ) ) { - g_atomic_int_set( &pPlayer->mnVideoHeight, - ::std::max( g_atomic_int_get( &pPlayer->mnVideoHeight ), nValue ) ); + const gint nDiff = nValue - g_atomic_int_get( &pPlayer->mnVideoHeight ); + g_atomic_int_add( &pPlayer->mnVideoHeight, ::std::max( nDiff, 0 ) ); } } } @@ -800,7 +804,7 @@ gboolean Player::idle() // in case Player::idle() is called again later; // the flag should have been set only once within Ctor called from // the application thread - g_atomic_int_add( &mnQuit, -1 ); + g_atomic_int_dec_and_test( &mnQuit ); g_main_loop_quit( mpLoop ); } diff --git a/avmedia/source/gstreamer/gstplayer.hxx b/avmedia/source/gstreamer/gstplayer.hxx index c8cf6d558994..b4e437c89a8c 100644 --- a/avmedia/source/gstreamer/gstplayer.hxx +++ b/avmedia/source/gstreamer/gstplayer.hxx @@ -33,8 +33,21 @@ #include "gstcommon.hxx" #include -#include +#include + +// necessary for older GLib versions +#ifndef G_GNUC_NULL_TERMINATED +#if __GNUC__ >= 4 +#define G_GNUC_NULL_TERMINATED __attribute__((__sentinel__)) +#else +#define G_GNUC_NULL_TERMINATED +#endif +#endif + +// necessary for older GLib versions +struct GOptionGroup; +#include #include "com/sun/star/media/XPlayer.hdl" namespace avmedia @@ -140,7 +153,9 @@ public: throw( ::com::sun::star::uno::RuntimeException ); -protected: Player( GString* pURI = NULL ); +protected: + + Player( GString* pURI = NULL ); virtual gboolean busCallback( GstBus* pBus, GstMessage* pMsg ); @@ -162,12 +177,11 @@ protected: Player( GString* pURI = NULL ); } -private: Player( const Player& ) {} +private: - Player & operator=( const Player& ) - { - return( *this ); - } + Player( const Player& ); + + Player& operator=( const Player& ); static gboolean implBusPrepare( GSource* pSource, gint* pTimeout ); @@ -209,14 +223,14 @@ protected: private: ::avmedia::gst::Window* mpPlayerWindow; - volatile gint mnIsVideoSource; - volatile gint mnVideoWidth; - volatile gint mnVideoHeight; - volatile gint mnInitialized; - volatile gint mnVolumeDB; - volatile gint mnLooping; - volatile gint mnQuit; - volatile gint mnVideoWindowSet; + gint mnIsVideoSource; + gint mnVideoWidth; + gint mnVideoHeight; + gint mnInitialized; + gint mnVolumeDB; + gint mnLooping; + gint mnQuit; + gint mnVideoWindowSet; }; } // namespace gst } // namespace avmedia -- cgit From 9d445eb695924d5f21357d15379efe575887bc76 Mon Sep 17 00:00:00 2001 From: ka Date: Thu, 10 Jun 2010 00:35:19 +0200 Subject: avmedia101: syntax and changed file headers --- avmedia/source/gstreamer/gstcommon.hxx | 5 +---- avmedia/source/gstreamer/gstframegrabber.cxx | 5 +---- avmedia/source/gstreamer/gstframegrabber.hxx | 5 +---- avmedia/source/gstreamer/gstmanager.cxx | 5 +---- avmedia/source/gstreamer/gstmanager.hxx | 5 +---- avmedia/source/gstreamer/gstplayer.cxx | 5 +---- avmedia/source/gstreamer/gstplayer.hxx | 11 ++++------- avmedia/source/gstreamer/gstuno.cxx | 5 +---- avmedia/source/gstreamer/gstwindow.cxx | 7 ++----- avmedia/source/gstreamer/gstwindow.hxx | 5 +---- avmedia/source/gstreamer/makefile.mk | 8 ++------ 11 files changed, 16 insertions(+), 50 deletions(-) (limited to 'avmedia') diff --git a/avmedia/source/gstreamer/gstcommon.hxx b/avmedia/source/gstreamer/gstcommon.hxx index be8bf32bb436..83bb818aefdc 100644 --- a/avmedia/source/gstreamer/gstcommon.hxx +++ b/avmedia/source/gstreamer/gstcommon.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: GSTREAMERcommon.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/avmedia/source/gstreamer/gstframegrabber.cxx b/avmedia/source/gstreamer/gstframegrabber.cxx index 71e720987d52..bd55e11f8afe 100644 --- a/avmedia/source/gstreamer/gstframegrabber.cxx +++ b/avmedia/source/gstreamer/gstframegrabber.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: framegrabber.cxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/avmedia/source/gstreamer/gstframegrabber.hxx b/avmedia/source/gstreamer/gstframegrabber.hxx index c9de03bfade9..9a7ec1b74102 100644 --- a/avmedia/source/gstreamer/gstframegrabber.hxx +++ b/avmedia/source/gstreamer/gstframegrabber.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: framegrabber.hxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/avmedia/source/gstreamer/gstmanager.cxx b/avmedia/source/gstreamer/gstmanager.cxx index f17199d36e27..61ee4ce22cd8 100644 --- a/avmedia/source/gstreamer/gstmanager.cxx +++ b/avmedia/source/gstreamer/gstmanager.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: manager.cxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/avmedia/source/gstreamer/gstmanager.hxx b/avmedia/source/gstreamer/gstmanager.hxx index 38717952d071..9f80e8c1a901 100644 --- a/avmedia/source/gstreamer/gstmanager.hxx +++ b/avmedia/source/gstreamer/gstmanager.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: manager.hxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/avmedia/source/gstreamer/gstplayer.cxx b/avmedia/source/gstreamer/gstplayer.cxx index e9fe02594b66..fe471a2c6fa2 100644 --- a/avmedia/source/gstreamer/gstplayer.cxx +++ b/avmedia/source/gstreamer/gstplayer.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: player.cxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/avmedia/source/gstreamer/gstplayer.hxx b/avmedia/source/gstreamer/gstplayer.hxx index b4e437c89a8c..2eca2b12a9a6 100644 --- a/avmedia/source/gstreamer/gstplayer.hxx +++ b/avmedia/source/gstreamer/gstplayer.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: player.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -35,7 +32,7 @@ #include #include -// necessary for older GLib versions +// necessary for mixed environments with GStreamer-0.10 and GLib versions < 2.8 #ifndef G_GNUC_NULL_TERMINATED #if __GNUC__ >= 4 #define G_GNUC_NULL_TERMINATED __attribute__((__sentinel__)) @@ -44,8 +41,8 @@ #endif #endif -// necessary for older GLib versions -struct GOptionGroup; +struct _GOptionGroup; +typedef struct _GOptionGroup GOptionGroup; #include #include "com/sun/star/media/XPlayer.hdl" diff --git a/avmedia/source/gstreamer/gstuno.cxx b/avmedia/source/gstreamer/gstuno.cxx index 308b2b14672b..adcda63fcd9c 100644 --- a/avmedia/source/gstreamer/gstuno.cxx +++ b/avmedia/source/gstreamer/gstuno.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: xineuno.cxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/avmedia/source/gstreamer/gstwindow.cxx b/avmedia/source/gstreamer/gstwindow.cxx index 32552eb41b4c..3b24e9974a3f 100644 --- a/avmedia/source/gstreamer/gstwindow.cxx +++ b/avmedia/source/gstreamer/gstwindow.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: window.cxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -24,7 +21,7 @@ * You should have received a copy of the GNU Lesser General Public License * version 3 along with OpenOffice.org. If not, see * - * for a copy of the LG;;PLv3 License. + * for a copy of the LGPLv3 License. * ************************************************************************/ diff --git a/avmedia/source/gstreamer/gstwindow.hxx b/avmedia/source/gstreamer/gstwindow.hxx index b8b51a8c7c9a..3a55fca9c8bf 100644 --- a/avmedia/source/gstreamer/gstwindow.hxx +++ b/avmedia/source/gstreamer/gstwindow.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: window.hxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/avmedia/source/gstreamer/makefile.mk b/avmedia/source/gstreamer/makefile.mk index 1c2aa65811cf..2f22c7333778 100644 --- a/avmedia/source/gstreamer/makefile.mk +++ b/avmedia/source/gstreamer/makefile.mk @@ -1,14 +1,10 @@ #************************************************************************* # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2008 by Sun Microsystems, Inc. # -# OpenOffice.org - a multi-platform office productivity suite -# -# $RCSfile: makefile.mk,v $ +# Copyright 2000, 2010 Oracle and/or its affiliates. # -# $Revision: 1.5 $ +# OpenOffice.org - a multi-platform office productivity suite # # This file is part of OpenOffice.org. # -- cgit From 5df6e57fdd735333425cda481798de5afa6a928a Mon Sep 17 00:00:00 2001 From: ka Date: Thu, 10 Jun 2010 14:05:44 +0200 Subject: avmedia101: added fallback to JMF backend for UNIX systems --- avmedia/source/inc/mediamisc.hxx | 27 ++++++++--- avmedia/source/java/PlayerWindow.java | 4 +- avmedia/source/java/avmedia.jar | Bin 16420 -> 16495 bytes avmedia/source/viewer/mediawindow.cxx | 7 ++- avmedia/source/viewer/mediawindow_impl.cxx | 8 ++-- avmedia/source/viewer/mediawindowbase_impl.cxx | 61 +++++++++++++++++++------ avmedia/source/viewer/mediawindowbase_impl.hxx | 5 +- 7 files changed, 83 insertions(+), 29 deletions(-) (limited to 'avmedia') diff --git a/avmedia/source/inc/mediamisc.hxx b/avmedia/source/inc/mediamisc.hxx index 4d09192b3031..f33bd46568c8 100644 --- a/avmedia/source/inc/mediamisc.hxx +++ b/avmedia/source/inc/mediamisc.hxx @@ -30,15 +30,30 @@ class ResMgr; #define AVMEDIA_RESID( nId ) ResId( nId, * ::avmedia::GetResMgr() ) #ifdef WNT -#define AVMEDIA_MANAGER_SERVICE_NAME "com.sun.star.comp.avmedia.Manager_DirectX" -#define AVMEDIA_MANAGER_SERVICE_IS_JAVABASED sal_False + +#define AVMEDIA_MANAGER_SERVICE_NAME "com.sun.star.comp.avmedia.Manager_DirectX" +#define AVMEDIA_MANAGER_SERVICE_IS_JAVABASED sal_False + +#define AVMEDIA_MANAGER_SERVICE_NAME_FALLBACK1 "" +#define AVMEDIA_MANAGER_SERVICE_IS_JAVABASED_FALLBACK1 sal_False + #else #ifdef QUARTZ -#define AVMEDIA_MANAGER_SERVICE_NAME "com.sun.star.comp.avmedia.Manager_QuickTime" -#define AVMEDIA_MANAGER_SERVICE_IS_JAVABASED sal_False + +#define AVMEDIA_MANAGER_SERVICE_NAME "com.sun.star.comp.avmedia.Manager_QuickTime" +#define AVMEDIA_MANAGER_SERVICE_IS_JAVABASED sal_False + +#define AVMEDIA_MANAGER_SERVICE_NAME_FALLBACK1 "" +#define AVMEDIA_MANAGER_SERVICE_IS_JAVABASED_FALLBACK1 sal_False + #else -#define AVMEDIA_MANAGER_SERVICE_NAME "com.sun.star.comp.avmedia.Manager_GStreamer" -#define AVMEDIA_MANAGER_SERVICE_IS_JAVABASED sal_False + +#define AVMEDIA_MANAGER_SERVICE_NAME "com.sun.star.comp.avmedia.Manager_GStreamer" +#define AVMEDIA_MANAGER_SERVICE_IS_JAVABASED sal_False + +#define AVMEDIA_MANAGER_SERVICE_NAME_FALLBACK1 "com.sun.star.comp.avmedia.Manager_Java" +#define AVMEDIA_MANAGER_SERVICE_IS_JAVABASED_FALLBACK1 sal_True + #endif #endif diff --git a/avmedia/source/java/PlayerWindow.java b/avmedia/source/java/PlayerWindow.java index 229c651d9f54..2229e4f1644b 100644 --- a/avmedia/source/java/PlayerWindow.java +++ b/avmedia/source/java/PlayerWindow.java @@ -67,9 +67,7 @@ public class PlayerWindow implements java.awt.event.KeyListener, maFrame = new WindowAdapter( AnyConverter.toInt( aArgs[ 0 ] ) ); maFrame.setPosSize( aBoundRect.X, aBoundRect.Y, aBoundRect.Width, aBoundRect.Height, (short) 0 ); - - if( aArgs.length > 2 ) - mbShowControls = AnyConverter.toBoolean( aArgs[ 2 ] ); + mbShowControls = false; java.awt.Panel aPanel = new java.awt.Panel( new java.awt.BorderLayout() ); diff --git a/avmedia/source/java/avmedia.jar b/avmedia/source/java/avmedia.jar index 55576baa5b34..3495d947bf71 100644 Binary files a/avmedia/source/java/avmedia.jar and b/avmedia/source/java/avmedia.jar differ diff --git a/avmedia/source/viewer/mediawindow.cxx b/avmedia/source/viewer/mediawindow.cxx index fb781d70cfb6..5005446633f4 100644 --- a/avmedia/source/viewer/mediawindow.cxx +++ b/avmedia/source/viewer/mediawindow.cxx @@ -469,8 +469,10 @@ bool MediaWindow::isMediaURL( const ::rtl::OUString& rURL, bool bDeep, Size* pPr { try { + sal_Bool bIsJavaBasedMediaWindow; uno::Reference< media::XPlayer > xPlayer( priv::MediaWindowImpl::createPlayer( - aURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ) ) ); + aURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ), + bIsJavaBasedMediaWindow ) ); if( xPlayer.is() ) { @@ -515,7 +517,8 @@ bool MediaWindow::isMediaURL( const ::rtl::OUString& rURL, bool bDeep, Size* pPr uno::Reference< media::XPlayer > MediaWindow::createPlayer( const ::rtl::OUString& rURL ) { - return priv::MediaWindowImpl::createPlayer( rURL ); + sal_Bool bJavaBased = sal_False; + return priv::MediaWindowImpl::createPlayer( rURL, bJavaBased ); } // ------------------------------------------------------------------------- diff --git a/avmedia/source/viewer/mediawindow_impl.cxx b/avmedia/source/viewer/mediawindow_impl.cxx index 83bc9b458a8b..15c830cb97a6 100644 --- a/avmedia/source/viewer/mediawindow_impl.cxx +++ b/avmedia/source/viewer/mediawindow_impl.cxx @@ -231,10 +231,10 @@ void MediaWindowImpl::onURLChanged() if( getPlayer().is() ) { uno::Reference< media::XPlayerWindow > xPlayerWindow; - const Point aPoint; - const Size aSize( maChildWindow.GetSizePixel() ); - const sal_IntPtr nWndHandle = (sal_IntPtr) maChildWindow. - GetParentWindowHandle( AVMEDIA_MANAGER_SERVICE_IS_JAVABASED ); + + const Point aPoint; + const Size aSize( maChildWindow.GetSizePixel() ); + const sal_IntPtr nWndHandle = (sal_IntPtr) maChildWindow.GetParentWindowHandle( isMediaWindowJavaBased() ); try { diff --git a/avmedia/source/viewer/mediawindowbase_impl.cxx b/avmedia/source/viewer/mediawindowbase_impl.cxx index 5412e7a5b804..a8ef536ac133 100644 --- a/avmedia/source/viewer/mediawindowbase_impl.cxx +++ b/avmedia/source/viewer/mediawindowbase_impl.cxx @@ -47,8 +47,18 @@ namespace avmedia { namespace priv { // - MediaWindowBaseImpl - // ----------------------- +struct ServiceManager +{ + const char* pServiceName; + sal_Bool bIsJavaBased; +}; + +// --------------------------------------------------------------------- + + MediaWindowBaseImpl::MediaWindowBaseImpl( MediaWindow* pMediaWindow ) : - mpMediaWindow( pMediaWindow ) + mpMediaWindow( pMediaWindow ), + mbIsMediaWindowJavaBased( sal_False ) { } @@ -61,28 +71,53 @@ MediaWindowBaseImpl::~MediaWindowBaseImpl() // ------------------------------------------------------------------------- -uno::Reference< media::XPlayer > MediaWindowBaseImpl::createPlayer( const ::rtl::OUString& rURL ) +uno::Reference< media::XPlayer > MediaWindowBaseImpl::createPlayer( const ::rtl::OUString& rURL, sal_Bool& rbJavaBased ) { uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); uno::Reference< media::XPlayer > xPlayer; + rbJavaBased = sal_False; + if( xFactory.is() ) { - try + static const ServiceManager aServiceManagers[] = { + { "AVMEDIA_MANAGER_SERVICE_NAME", AVMEDIA_MANAGER_SERVICE_IS_JAVABASED }, + { "AVMEDIA_MANAGER_SERVICE_NAME_FALLBACK1", AVMEDIA_MANAGER_SERVICE_IS_JAVABASED_FALLBACK1 } + }; + + uno::Reference< media::XManager > xManager; - uno::Reference< ::com::sun::star::media::XManager > xManager( - xFactory->createInstance( ::rtl::OUString::createFromAscii( AVMEDIA_MANAGER_SERVICE_NAME ) ), - uno::UNO_QUERY ); + for( sal_uInt32 i = 0; ( i < ( sizeof( aServiceManagers ) / sizeof( ServiceManager ) ) ) && !xManager.is(); ++i ) + { + const String aServiceName( aServiceManagers[ i ].pServiceName, RTL_TEXTENCODING_ASCII_US ); - if( xManager.is() ) + if( aServiceName.Len() ) { - xPlayer = uno::Reference< ::com::sun::star::media::XPlayer >( - xManager->createPlayer( rURL ), uno::UNO_QUERY ); + try + { + xManager = uno::Reference< media::XManager >( xFactory->createInstance( aServiceName ), + uno::UNO_QUERY ); + + if( xManager.is() ) + { + xPlayer = uno::Reference< media::XPlayer >( xManager->createPlayer( rURL ), + uno::UNO_QUERY ); + } + } + catch( ... ) + { + } + } + + if( !xPlayer.is() ) + { + xManager.clear(); + } + else + { + rbJavaBased = aServiceManagers[ i ].bIsJavaBased; } - } - catch( ... ) - { } } @@ -112,7 +147,7 @@ void MediaWindowBaseImpl::setURL( const ::rtl::OUString& rURL ) if( aURL.GetProtocol() != INET_PROT_NOT_VALID ) maFileURL = aURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ); - mxPlayer = createPlayer( maFileURL ); + mxPlayer = createPlayer( maFileURL, mbIsMediaWindowJavaBased ); onURLChanged(); } } diff --git a/avmedia/source/viewer/mediawindowbase_impl.hxx b/avmedia/source/viewer/mediawindowbase_impl.hxx index 0b0f160b6e3c..028b7c6ed079 100644 --- a/avmedia/source/viewer/mediawindowbase_impl.hxx +++ b/avmedia/source/viewer/mediawindowbase_impl.hxx @@ -61,7 +61,8 @@ 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, + sal_Bool& rbJavaBased ); public: @@ -112,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; @@ -124,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; }; } } -- cgit From b1c60fae23e95b7ffd399a8df45e78ee19d60fa0 Mon Sep 17 00:00:00 2001 From: ka Date: Thu, 10 Jun 2010 22:32:46 +0200 Subject: avmedia101: don't use obsolete third parameter anymore --- avmedia/source/java/Manager.java | 2 +- avmedia/source/java/MediaUno.java | 2 +- avmedia/source/java/avmedia.jar | Bin 16495 -> 15776 bytes 3 files changed, 2 insertions(+), 2 deletions(-) (limited to 'avmedia') diff --git a/avmedia/source/java/Manager.java b/avmedia/source/java/Manager.java index 2e8cf04fce4a..47707478fd5b 100644 --- a/avmedia/source/java/Manager.java +++ b/avmedia/source/java/Manager.java @@ -89,7 +89,7 @@ public class Manager implements com.sun.star.lang.XServiceInfo, // - XServiceInfo - // ---------------- - private static final String s_implName = "com.sun.star.comp.avmedia.Manager_Java"; + private static final String s_implName = "com.sun.star.comp.media.Manager_Java"; private static final String s_serviceName = "com.sun.star.media.Manager_Java"; public synchronized String getImplementationName() diff --git a/avmedia/source/java/MediaUno.java b/avmedia/source/java/MediaUno.java index f4121950165f..ca7a164586d8 100644 --- a/avmedia/source/java/MediaUno.java +++ b/avmedia/source/java/MediaUno.java @@ -34,7 +34,7 @@ import com.sun.star.lang.XInitialization; public class MediaUno { - private static final String s_implName = "com.sun.star.comp.avmedia.Manager_Java"; + private static final String s_implName = "com.sun.star.comp.media.Manager_Java"; private static final String s_serviceName = "com.sun.star.media.Manager_Java"; // ------------------------------------------------------------------------- diff --git a/avmedia/source/java/avmedia.jar b/avmedia/source/java/avmedia.jar index 3495d947bf71..85a98bbcf33c 100644 Binary files a/avmedia/source/java/avmedia.jar and b/avmedia/source/java/avmedia.jar differ -- cgit From c3655b7b8bbfe2b677c1e783d30801b965376beb Mon Sep 17 00:00:00 2001 From: ka Date: Thu, 10 Jun 2010 22:37:56 +0200 Subject: avmedia101: code cleanup --- avmedia/source/viewer/mediawindowbase_impl.cxx | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) (limited to 'avmedia') diff --git a/avmedia/source/viewer/mediawindowbase_impl.cxx b/avmedia/source/viewer/mediawindowbase_impl.cxx index a8ef536ac133..94a6c36ed064 100644 --- a/avmedia/source/viewer/mediawindowbase_impl.cxx +++ b/avmedia/source/viewer/mediawindowbase_impl.cxx @@ -82,27 +82,25 @@ uno::Reference< media::XPlayer > MediaWindowBaseImpl::createPlayer( const ::rtl: { static const ServiceManager aServiceManagers[] = { - { "AVMEDIA_MANAGER_SERVICE_NAME", AVMEDIA_MANAGER_SERVICE_IS_JAVABASED }, - { "AVMEDIA_MANAGER_SERVICE_NAME_FALLBACK1", AVMEDIA_MANAGER_SERVICE_IS_JAVABASED_FALLBACK1 } + { AVMEDIA_MANAGER_SERVICE_NAME, AVMEDIA_MANAGER_SERVICE_IS_JAVABASED }, + { AVMEDIA_MANAGER_SERVICE_NAME_FALLBACK1, AVMEDIA_MANAGER_SERVICE_IS_JAVABASED_FALLBACK1 } }; - uno::Reference< media::XManager > xManager; - - for( sal_uInt32 i = 0; ( i < ( sizeof( aServiceManagers ) / sizeof( ServiceManager ) ) ) && !xManager.is(); ++i ) + for( sal_uInt32 i = 0; !xPlayer.is() && ( i < ( sizeof( aServiceManagers ) / sizeof( ServiceManager ) ) ); ++i ) { const String aServiceName( aServiceManagers[ i ].pServiceName, RTL_TEXTENCODING_ASCII_US ); if( aServiceName.Len() ) { + OSL_TRACE( "Trying to create media manager service %s", aServiceManagers[ i ].pServiceName ); + try { - xManager = uno::Reference< media::XManager >( xFactory->createInstance( aServiceName ), - uno::UNO_QUERY ); + uno::Reference< media::XManager > xManager( xFactory->createInstance( aServiceName ), uno::UNO_QUERY ); if( xManager.is() ) { - xPlayer = uno::Reference< media::XPlayer >( xManager->createPlayer( rURL ), - uno::UNO_QUERY ); + xPlayer = uno::Reference< media::XPlayer >( xManager->createPlayer( rURL ), uno::UNO_QUERY ); } } catch( ... ) @@ -110,11 +108,7 @@ uno::Reference< media::XPlayer > MediaWindowBaseImpl::createPlayer( const ::rtl: } } - if( !xPlayer.is() ) - { - xManager.clear(); - } - else + if( xPlayer.is() ) { rbJavaBased = aServiceManagers[ i ].bIsJavaBased; } @@ -124,7 +118,6 @@ uno::Reference< media::XPlayer > MediaWindowBaseImpl::createPlayer( const ::rtl: return xPlayer; } - // --------------------------------------------------------------------- void MediaWindowBaseImpl::setURL( const ::rtl::OUString& rURL ) -- cgit From 1d10d008c5428bb8f24bbffedcf068ab656a967a Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Thu, 17 Jun 2010 21:10:41 +0200 Subject: #161254# adding timeout for get state to prevent freeze --- avmedia/source/gstreamer/gstplayer.cxx | 20 ++++++++++++++------ avmedia/source/gstreamer/gstplayer.hxx | 1 + 2 files changed, 15 insertions(+), 6 deletions(-) (limited to 'avmedia') diff --git a/avmedia/source/gstreamer/gstplayer.cxx b/avmedia/source/gstreamer/gstplayer.cxx index fe471a2c6fa2..edddf2755f93 100644 --- a/avmedia/source/gstreamer/gstplayer.cxx +++ b/avmedia/source/gstreamer/gstplayer.cxx @@ -35,6 +35,10 @@ #include #include + +// maximum timeout time in nanoseconds +#define GST_MAX_TIMEOUT 500000000 + using namespace ::com::sun::star; namespace avmedia @@ -81,7 +85,8 @@ Player::Player( GString* pURI ) : mnVolumeDB( 0 ), mnLooping( 0 ), mnQuit( 0 ), - mnVideoWindowSet( 0 ) + mnVideoWindowSet( 0 ), + mnInitFail( 0 ) { // initialize GStreamer framework only once static bool bGstInitialized = false; @@ -207,7 +212,7 @@ sal_Bool SAL_CALL Player::isPlaying() if( mpPlayer ) { - gst_element_get_state( mpPlayer, &aState, NULL, GST_CLOCK_TIME_NONE ); + gst_element_get_state( mpPlayer, &aState, NULL, GST_MAX_TIMEOUT ); } return( GST_STATE_PLAYING == aState ); @@ -450,7 +455,7 @@ uno::Reference< ::media::XPlayerWindow > SAL_CALL Player::createPlayerWindow( GstState aOldState = GST_STATE_NULL; mpPlayerWindow = pPlayerWindow; - gst_element_get_state( mpPlayer, &aOldState, NULL, GST_CLOCK_TIME_NONE ); + gst_element_get_state( mpPlayer, &aOldState, NULL, GST_MAX_TIMEOUT ); gst_element_set_state( mpPlayer, GST_STATE_READY ); g_object_set( mpPlayer, "video-sink", pVideoSink, NULL ); gst_element_set_state( mpPlayer, aOldState ); @@ -543,11 +548,11 @@ bool Player::implInitPlayer() { bool bRet = false; - if( mpPlayer ) + if( mpPlayer && (mnInitFail < 3) ) { GstState aState = GST_STATE_NULL; - if( gst_element_get_state( mpPlayer, &aState, NULL, GST_CLOCK_TIME_NONE ) == GST_STATE_CHANGE_SUCCESS ) + if( gst_element_get_state( mpPlayer, &aState, NULL, GST_MAX_TIMEOUT ) == GST_STATE_CHANGE_SUCCESS ) { bRet = ( GST_STATE_PAUSED == aState ) || ( GST_STATE_PLAYING == aState ); @@ -555,10 +560,13 @@ bool Player::implInitPlayer() { gst_element_set_state( mpPlayer, GST_STATE_PAUSED ); bRet = ( gst_element_get_state( mpPlayer, &aState, NULL, - GST_CLOCK_TIME_NONE ) == GST_STATE_CHANGE_SUCCESS ) && + GST_MAX_TIMEOUT ) == GST_STATE_CHANGE_SUCCESS ) && ( GST_STATE_PAUSED == aState ); } } + + if( ! bRet ) + mnInitFail++; } return( bRet ); diff --git a/avmedia/source/gstreamer/gstplayer.hxx b/avmedia/source/gstreamer/gstplayer.hxx index 2eca2b12a9a6..d751e381258d 100644 --- a/avmedia/source/gstreamer/gstplayer.hxx +++ b/avmedia/source/gstreamer/gstplayer.hxx @@ -228,6 +228,7 @@ private: gint mnLooping; gint mnQuit; gint mnVideoWindowSet; + gint mnInitFail; }; } // namespace gst } // namespace avmedia -- cgit From 4e0e548c67ab51940bb9d079b723c10b0944777b Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Wed, 23 Jun 2010 09:12:30 +0200 Subject: avmedia102: #161254# increase timeout so it works reliably --- avmedia/source/gstreamer/gstplayer.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'avmedia') diff --git a/avmedia/source/gstreamer/gstplayer.cxx b/avmedia/source/gstreamer/gstplayer.cxx index edddf2755f93..71ac656a7b2c 100644 --- a/avmedia/source/gstreamer/gstplayer.cxx +++ b/avmedia/source/gstreamer/gstplayer.cxx @@ -37,7 +37,7 @@ // maximum timeout time in nanoseconds -#define GST_MAX_TIMEOUT 500000000 +#define GST_MAX_TIMEOUT (2500 * GST_MSECOND) using namespace ::com::sun::star; -- cgit From 6a95ce1c7f61f5cd7684486937fc30f095ce2a29 Mon Sep 17 00:00:00 2001 From: ka Date: Wed, 7 Jul 2010 20:39:52 +0200 Subject: avmedia102: try use gconfvideosink at preferred video sink --- avmedia/source/framework/mediacontrol.cxx | 4 --- avmedia/source/gstreamer/gstplayer.cxx | 54 +++++++++++++++---------------- 2 files changed, 27 insertions(+), 31 deletions(-) (limited to 'avmedia') diff --git a/avmedia/source/framework/mediacontrol.cxx b/avmedia/source/framework/mediacontrol.cxx index a71b5268abd7..2eb18cb164d9 100644 --- a/avmedia/source/framework/mediacontrol.cxx +++ b/avmedia/source/framework/mediacontrol.cxx @@ -91,8 +91,6 @@ MediaControl::MediaControl( Window* pParent, MediaControlStyle eControlStyle ) : if( MEDIACONTROLSTYLE_SINGLELINE != meControlStyle ) { - - maPlayToolBox.InsertItem( AVMEDIA_TOOLBOXITEM_OPEN, implGetImage( AVMEDIA_IMG_OPEN ), String( AVMEDIA_RESID( AVMEDIA_STR_OPEN ) ) ); maPlayToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_OPEN, HID_AVMEDIA_TOOLBOXITEM_OPEN ); @@ -103,8 +101,6 @@ MediaControl::MediaControl( Window* pParent, MediaControlStyle eControlStyle ) : } else { - maTimeSlider.SetBackground(); - maVolumeSlider.SetBackground(); mpZoomListBox->SetBackground(); maZoomToolBox.SetBackground(); diff --git a/avmedia/source/gstreamer/gstplayer.cxx b/avmedia/source/gstreamer/gstplayer.cxx index 71ac656a7b2c..f082cfc5c513 100644 --- a/avmedia/source/gstreamer/gstplayer.cxx +++ b/avmedia/source/gstreamer/gstplayer.cxx @@ -279,49 +279,50 @@ double SAL_CALL Player::getMediaTime() void SAL_CALL Player::setStopTime( double /* fTime */ ) throw( uno::RuntimeException ) { + OSL_TRACE( "GStreamer method avmedia::gst::Player::setStopTime needs to be implemented" ); + + /* Currently no need for implementation since higher levels of code don't use this method at all + !!! TODO: needs to be implemented if this functionality is needed at a later point of time if( implInitPlayer() ) { - // TBD!!! } + + */ } // ------------------------------------------------------------------------------ double SAL_CALL Player::getStopTime() throw( uno::RuntimeException ) { - double fRet = 0.0; - - if( implInitPlayer() ) - { - // TBD!!! - fRet = getDuration(); - } + /* + Currently no need for implementation since higher levels of code don't set a stop time ATM + !!! TODO: needs to be fully implemented if this functionality is needed at a later point of time + */ - return( fRet ); + return( getDuration() ); } // ------------------------------------------------------------------------------ void SAL_CALL Player::setRate( double /* fRate */ ) throw( uno::RuntimeException ) { - if( implInitPlayer() ) - { - // TBD!!! - } + OSL_TRACE( "GStreamer method avmedia::gst::Player::setRate needs to be implemented" ); + + /* Currently no need for implementation since higher levels of code don't use this method at all + !!! TODO: needs to be implemented if this functionality is needed at a later point of time + */ } // ------------------------------------------------------------------------------ double SAL_CALL Player::getRate() throw( uno::RuntimeException ) { - double fRet = 1.0; - - if( implInitPlayer() ) - { - // TBD!!!; - } + /* + Currently no need for implementation since higher levels of code don't set a different rate than 1 ATM + !!! TODO: needs to be fully implemented if this functionality is needed at a later point of time + */ - return( fRet ); + return( 1.0 ); } // ------------------------------------------------------------------------------ @@ -443,14 +444,13 @@ uno::Reference< ::media::XPlayerWindow > SAL_CALL Player::createPlayerWindow( } else { - GstElement* pVideoSink = gst_element_factory_make( "xvimagesink", NULL ); - - if( !pVideoSink ) - { - pVideoSink = gst_element_factory_make( "ximagesink", NULL ); - } + // try to use gconf user configurable video sink first + GstElement* pVideoSink = gst_element_factory_make( "gconfvideosink", NULL ); - if( pVideoSink ) + if( ( NULL != pVideoSink ) || + ( NULL != ( pVideoSink = gst_element_factory_make( "autovideosink", NULL ) ) ) || + ( NULL != ( pVideoSink = gst_element_factory_make( "xvimagesink", NULL ) ) ) || + ( NULL != ( pVideoSink = gst_element_factory_make( "ximagesink", NULL ) ) ) ) { GstState aOldState = GST_STATE_NULL; -- cgit From f24b1da07ebfbc95e76af93fc9c7133f7d52daa5 Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Sat, 10 Jul 2010 18:21:24 +0200 Subject: CWS changehid: #i111874#: change code to support HelpIds as byte strings --- avmedia/inc/helpids.hrc | 24 ++++++++++---------- avmedia/source/framework/mediacontrol.cxx | 36 ++++++++++-------------------- avmedia/source/framework/mediaplayer.cxx | 3 +-- avmedia/source/viewer/mediawindow_impl.cxx | 3 +-- 4 files changed, 26 insertions(+), 40 deletions(-) (limited to 'avmedia') diff --git a/avmedia/inc/helpids.hrc b/avmedia/inc/helpids.hrc index 2d7ccd764762..902230466053 100644 --- a/avmedia/inc/helpids.hrc +++ b/avmedia/inc/helpids.hrc @@ -30,17 +30,17 @@ #include -#define HID_AVMEDIA_TOOLBOXITEM_PLAY (HID_AVMEDIA_START+0) -#define HID_AVMEDIA_TOOLBOXITEM_PAUSE (HID_AVMEDIA_START+1) -#define HID_AVMEDIA_TOOLBOXITEM_STOP (HID_AVMEDIA_START+2) -#define HID_AVMEDIA_TOOLBOXITEM_MUTE (HID_AVMEDIA_START+3) -#define HID_AVMEDIA_TOOLBOXITEM_LOOP (HID_AVMEDIA_START+4) -#define HID_AVMEDIA_TOOLBOXITEM_OPEN (HID_AVMEDIA_START+5) -#define HID_AVMEDIA_TOOLBOXITEM_INSERT (HID_AVMEDIA_START+6) -#define HID_AVMEDIA_ZOOMLISTBOX (HID_AVMEDIA_START+7) -#define HID_AVMEDIA_TIMESLIDER (HID_AVMEDIA_START+8) -#define HID_AVMEDIA_TIMEEDIT (HID_AVMEDIA_START+9) -#define HID_AVMEDIA_VOLUMESLIDER (HID_AVMEDIA_START+10) -#define HID_AVMEDIA_PLAYERWINDOW (HID_AVMEDIA_START+11) +#define HID_AVMEDIA_TOOLBOXITEM_PLAY "AVMEDIA_HID_AVMEDIA_TOOLBOXITEM_PLAY" +#define HID_AVMEDIA_TOOLBOXITEM_PAUSE "AVMEDIA_HID_AVMEDIA_TOOLBOXITEM_PAUSE" +#define HID_AVMEDIA_TOOLBOXITEM_STOP "AVMEDIA_HID_AVMEDIA_TOOLBOXITEM_STOP" +#define HID_AVMEDIA_TOOLBOXITEM_MUTE "AVMEDIA_HID_AVMEDIA_TOOLBOXITEM_MUTE" +#define HID_AVMEDIA_TOOLBOXITEM_LOOP "AVMEDIA_HID_AVMEDIA_TOOLBOXITEM_LOOP" +#define HID_AVMEDIA_TOOLBOXITEM_OPEN "AVMEDIA_HID_AVMEDIA_TOOLBOXITEM_OPEN" +#define HID_AVMEDIA_TOOLBOXITEM_INSERT "AVMEDIA_HID_AVMEDIA_TOOLBOXITEM_INSERT" +#define HID_AVMEDIA_ZOOMLISTBOX "AVMEDIA_HID_AVMEDIA_ZOOMLISTBOX" +#define HID_AVMEDIA_TIMESLIDER "AVMEDIA_HID_AVMEDIA_TIMESLIDER" +#define HID_AVMEDIA_TIMEEDIT "AVMEDIA_HID_AVMEDIA_TIMEEDIT" +#define HID_AVMEDIA_VOLUMESLIDER "AVMEDIA_HID_AVMEDIA_VOLUMESLIDER" +#define HID_AVMEDIA_PLAYERWINDOW "AVMEDIA_HID_AVMEDIA_PLAYERWINDOW" #endif // _AVMEDIA_HELPIDS_HRC diff --git a/avmedia/source/framework/mediacontrol.cxx b/avmedia/source/framework/mediacontrol.cxx index 781f2b7d290d..a71b5268abd7 100644 --- a/avmedia/source/framework/mediacontrol.cxx +++ b/avmedia/source/framework/mediacontrol.cxx @@ -94,12 +94,10 @@ MediaControl::MediaControl( Window* pParent, MediaControlStyle eControlStyle ) : maPlayToolBox.InsertItem( AVMEDIA_TOOLBOXITEM_OPEN, implGetImage( AVMEDIA_IMG_OPEN ), String( AVMEDIA_RESID( AVMEDIA_STR_OPEN ) ) ); - // FIXME: HELPID - maPlayToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_OPEN, ""/*HID_AVMEDIA_TOOLBOXITEM_OPEN*/ ); + maPlayToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_OPEN, HID_AVMEDIA_TOOLBOXITEM_OPEN ); maPlayToolBox.InsertItem( AVMEDIA_TOOLBOXITEM_INSERT, implGetImage( AVMEDIA_IMG_INSERT ), String( AVMEDIA_RESID( AVMEDIA_STR_INSERT ) ) ); - // FIXME: HELPID - maPlayToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_INSERT, ""/*HID_AVMEDIA_TOOLBOXITEM_INSERT*/ ); + maPlayToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_INSERT, HID_AVMEDIA_TOOLBOXITEM_INSERT ); maPlayToolBox.InsertSeparator(); } @@ -119,22 +117,18 @@ MediaControl::MediaControl( Window* pParent, MediaControlStyle eControlStyle ) : } maPlayToolBox.InsertItem( AVMEDIA_TOOLBOXITEM_PLAY, implGetImage( AVMEDIA_IMG_PLAY ), String( AVMEDIA_RESID( AVMEDIA_STR_PLAY ) ), TIB_CHECKABLE ); - // FIXME: HELPID - maPlayToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_PLAY, ""/*HID_AVMEDIA_TOOLBOXITEM_PLAY*/ ); + maPlayToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_PLAY, HID_AVMEDIA_TOOLBOXITEM_PLAY ); maPlayToolBox.InsertItem( AVMEDIA_TOOLBOXITEM_PAUSE, implGetImage( AVMEDIA_IMG_PAUSE ), String( AVMEDIA_RESID( AVMEDIA_STR_PAUSE ) ), TIB_CHECKABLE ); - // FIXME: HELPID - maPlayToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_PAUSE, ""/*HID_AVMEDIA_TOOLBOXITEM_PAUSE*/ ); + maPlayToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_PAUSE, HID_AVMEDIA_TOOLBOXITEM_PAUSE ); maPlayToolBox.InsertItem( AVMEDIA_TOOLBOXITEM_STOP, implGetImage( AVMEDIA_IMG_STOP ), String( AVMEDIA_RESID( AVMEDIA_STR_STOP ) ), TIB_CHECKABLE ); - // FIXME: HELPID - maPlayToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_STOP, ""/*HID_AVMEDIA_TOOLBOXITEM_STOP*/ ); + maPlayToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_STOP, HID_AVMEDIA_TOOLBOXITEM_STOP ); maPlayToolBox.InsertSeparator(); maPlayToolBox.InsertItem( AVMEDIA_TOOLBOXITEM_LOOP, implGetImage( AVMEDIA_IMG_ENDLESS ), String( AVMEDIA_RESID( AVMEDIA_STR_ENDLESS ) ) ); - // FIXME: HELPID - maPlayToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_LOOP, ""/*HID_AVMEDIA_TOOLBOXITEM_LOOP*/ ); + maPlayToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_LOOP, HID_AVMEDIA_TOOLBOXITEM_LOOP ); if( MEDIACONTROLSTYLE_SINGLELINE == meControlStyle ) maPlayToolBox.InsertSeparator(); @@ -147,8 +141,7 @@ MediaControl::MediaControl( Window* pParent, MediaControlStyle eControlStyle ) : maTimeSlider.SetSlideHdl( LINK( this, MediaControl, implTimeHdl ) ); maTimeSlider.SetEndSlideHdl( LINK( this, MediaControl, implTimeEndHdl ) ); maTimeSlider.SetRange( Range( 0, AVMEDIA_TIME_RANGE ) ); - // FIXME: HELPID - maTimeSlider.SetHelpId( ""/*HID_AVMEDIA_TIMESLIDER*/ ); + maTimeSlider.SetHelpId( HID_AVMEDIA_TIMESLIDER ); maTimeSlider.SetUpdateMode( true ); maTimeSlider.SetSizePixel( Size( 128, maPlayToolBox.GetSizePixel().Height() ) ); maTimeSlider.Show(); @@ -158,8 +151,7 @@ MediaControl::MediaControl( Window* pParent, MediaControlStyle eControlStyle ) : maTimeEdit.SetUpdateMode( true ); maTimeEdit.SetSizePixel( Size( maTimeEdit.GetTextWidth( aTimeText ) + 8, maPlayToolBox.GetSizePixel().Height() ) ); maTimeEdit.SetControlBackground( Application::GetSettings().GetStyleSettings().GetWindowColor() ); - // FIXME: HELPID - maTimeEdit.SetHelpId( ""/*HID_AVMEDIA_TIMEEDIT*/ ); + maTimeEdit.SetHelpId( HID_AVMEDIA_TIMEEDIT ); maTimeEdit.Disable(); maTimeEdit.Show(); maMinSize.Width() += maTimeEdit.GetSizePixel().Width(); @@ -168,8 +160,7 @@ MediaControl::MediaControl( Window* pParent, MediaControlStyle eControlStyle ) : maMuteToolBox.InsertSeparator(); maMuteToolBox.InsertItem( AVMEDIA_TOOLBOXITEM_MUTE, implGetImage( AVMEDIA_IMG_MUTE ), String( AVMEDIA_RESID( AVMEDIA_STR_MUTE ) ) ); - // FIXME: HELPID - maMuteToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_MUTE, ""/*HID_AVMEDIA_TOOLBOXITEM_MUTE*/ ); + maMuteToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_MUTE, HID_AVMEDIA_TOOLBOXITEM_MUTE ); maMuteToolBox.SetSelectHdl( LINK( this, MediaControl, implSelectHdl ) ); maMuteToolBox.SetSizePixel( maMuteToolBox.CalcWindowSizePixel() ); @@ -180,8 +171,7 @@ MediaControl::MediaControl( Window* pParent, MediaControlStyle eControlStyle ) : maVolumeSlider.SetEndSlideHdl( LINK( this, MediaControl, implVolumeEndHdl ) ); maVolumeSlider.SetRange( Range( AVMEDIA_DB_RANGE, 0 ) ); maVolumeSlider.SetUpdateMode( true ); - // FIXME: HELPID - maVolumeSlider.SetHelpId( ""/*HID_AVMEDIA_VOLUMESLIDER*/ ); + maVolumeSlider.SetHelpId( HID_AVMEDIA_VOLUMESLIDER ); maVolumeSlider.SetSizePixel( Size( 48, maPlayToolBox.GetSizePixel().Height() ) ); maVolumeSlider.Show(); maMinSize.Width() += maVolumeSlider.GetSizePixel().Width(); @@ -192,12 +182,10 @@ MediaControl::MediaControl( Window* pParent, MediaControlStyle eControlStyle ) : mpZoomListBox->InsertEntry( String( AVMEDIA_RESID( AVMEDIA_STR_ZOOM_200 ) ), AVMEDIA_ZOOMLEVEL_200 ); mpZoomListBox->InsertEntry( String( AVMEDIA_RESID( AVMEDIA_STR_ZOOM_FIT ) ), AVMEDIA_ZOOMLEVEL_FIT ); mpZoomListBox->SetSelectHdl( LINK( this, MediaControl, implZoomSelectHdl ) ); - // FIXME: HELPID - mpZoomListBox->SetHelpId( ""/*HID_AVMEDIA_ZOOMLISTBOX*/ ); + mpZoomListBox->SetHelpId( HID_AVMEDIA_ZOOMLISTBOX ); maZoomToolBox.InsertItem( AVMEDIA_TOOLBOXITEM_ZOOM, String( AVMEDIA_RESID( AVMEDIA_STR_ZOOM ) ) ); - // FIXME: HELPID - maZoomToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_ZOOM, ""/*HID_AVMEDIA_ZOOMLISTBOX*/ ); + maZoomToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_ZOOM, HID_AVMEDIA_ZOOMLISTBOX ); maZoomToolBox.SetItemWindow( AVMEDIA_TOOLBOXITEM_ZOOM, mpZoomListBox ); maZoomToolBox.SetSelectHdl( LINK( this, MediaControl, implSelectHdl ) ); diff --git a/avmedia/source/framework/mediaplayer.cxx b/avmedia/source/framework/mediaplayer.cxx index c66f88817fe3..caab783c6a7c 100644 --- a/avmedia/source/framework/mediaplayer.cxx +++ b/avmedia/source/framework/mediaplayer.cxx @@ -124,8 +124,7 @@ void MediaFloater::ToggleFloatingMode() Window* pWindow = mpMediaWindow->getWindow(); if( pWindow ) - // FIXME: HELPID - pWindow->SetHelpId( ""/*HID_AVMEDIA_PLAYERWINDOW*/ ); + pWindow->SetHelpId( HID_AVMEDIA_PLAYERWINDOW ); mpMediaWindow->show(); } diff --git a/avmedia/source/viewer/mediawindow_impl.cxx b/avmedia/source/viewer/mediawindow_impl.cxx index 14d174beec80..553eea6196c1 100644 --- a/avmedia/source/viewer/mediawindow_impl.cxx +++ b/avmedia/source/viewer/mediawindow_impl.cxx @@ -179,8 +179,7 @@ MediaWindowImpl::MediaWindowImpl( Window* pParent, MediaWindow* pMediaWindow, bo mpEmptyBmpEx( NULL ), mpAudioBmpEx( NULL ) { - // FIXME: HELPID - maChildWindow.SetHelpId( ""/*HID_AVMEDIA_PLAYERWINDOW*/ ); + maChildWindow.SetHelpId( HID_AVMEDIA_PLAYERWINDOW ); maChildWindow.Hide(); if( mpMediaWindowControl ) -- cgit From fc36d6a80a11f89c6a155f737e6a42665c039564 Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Mon, 19 Jul 2010 17:13:56 +0200 Subject: CWS changehid: #i111784#: use mhids.pl to generate conversion list for HIDs --- avmedia/inc/helpids.hrc | 2 -- 1 file changed, 2 deletions(-) (limited to 'avmedia') diff --git a/avmedia/inc/helpids.hrc b/avmedia/inc/helpids.hrc index 902230466053..4b1d2e04d628 100644 --- a/avmedia/inc/helpids.hrc +++ b/avmedia/inc/helpids.hrc @@ -28,8 +28,6 @@ #ifndef _AVMEDIA_HELPIDS_HRC #define _AVMEDIA_HELPIDS_HRC -#include - #define HID_AVMEDIA_TOOLBOXITEM_PLAY "AVMEDIA_HID_AVMEDIA_TOOLBOXITEM_PLAY" #define HID_AVMEDIA_TOOLBOXITEM_PAUSE "AVMEDIA_HID_AVMEDIA_TOOLBOXITEM_PAUSE" #define HID_AVMEDIA_TOOLBOXITEM_STOP "AVMEDIA_HID_AVMEDIA_TOOLBOXITEM_STOP" -- cgit From 5f31862d1d90a95359c1b41c4d379192cc6e00be Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Tue, 3 Aug 2010 12:19:44 +0100 Subject: cmcfixes77: #i113615# WaE fix NULL/0 --- avmedia/source/gstreamer/gstwindow.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'avmedia') diff --git a/avmedia/source/gstreamer/gstwindow.cxx b/avmedia/source/gstreamer/gstwindow.cxx index 3b24e9974a3f..12606ad5e88b 100644 --- a/avmedia/source/gstreamer/gstwindow.cxx +++ b/avmedia/source/gstreamer/gstwindow.cxx @@ -259,7 +259,7 @@ value in sequence of arguments" ); if( !mpPlayerWindow && ( rArguments.getLength() > 2 ) ) { SystemChildWindow* pParentWindow = NULL; - sal_IntPtr pIntPtr = NULL; + sal_IntPtr pIntPtr = 0; // we are not interested in the first argument, which is a pure X11 window handle; // this backend relies on a SystemChildWindow as parent for the PlayerWindow, given -- cgit From 9551bf5a1ee5c9275a26f8ec4021e0b7f5665176 Mon Sep 17 00:00:00 2001 From: sb Date: Fri, 10 Sep 2010 13:10:07 +0200 Subject: sb129: #i113189# change UNO components to use passive registration --- avmedia/prj/d.lst | 5 +++ avmedia/source/framework/soundhandler.cxx | 38 ---------------------- avmedia/source/gstreamer/avmediagst.component | 34 +++++++++++++++++++ avmedia/source/gstreamer/exports.dxp | 1 - avmedia/source/gstreamer/gstuno.cxx | 29 ----------------- avmedia/source/gstreamer/makefile.mk | 8 +++++ avmedia/source/java/MediaUno.java | 9 ----- avmedia/source/java/avmedia.jar.component | 34 +++++++++++++++++++ avmedia/source/java/makefile.mk | 8 +++++ .../source/quicktime/avmediaQuickTime.component | 34 +++++++++++++++++++ avmedia/source/quicktime/makefile.mk | 8 +++++ avmedia/source/quicktime/quicktimeuno.cxx | 29 ----------------- avmedia/source/win/avmediawin.component | 34 +++++++++++++++++++ avmedia/source/win/exports.dxp | 1 - avmedia/source/win/makefile.mk | 8 +++++ avmedia/source/win/winuno.cxx | 27 --------------- avmedia/source/xine/exports.dxp | 1 - avmedia/source/xine/xineuno.cxx | 29 ----------------- avmedia/util/avmedia.component | 34 +++++++++++++++++++ avmedia/util/makefile.mk | 8 +++++ 20 files changed, 215 insertions(+), 164 deletions(-) create mode 100644 avmedia/source/gstreamer/avmediagst.component create mode 100644 avmedia/source/java/avmedia.jar.component create mode 100644 avmedia/source/quicktime/avmediaQuickTime.component create mode 100644 avmedia/source/win/avmediawin.component create mode 100644 avmedia/util/avmedia.component (limited to 'avmedia') diff --git a/avmedia/prj/d.lst b/avmedia/prj/d.lst index c82db252aab8..eb140ed45770 100644 --- a/avmedia/prj/d.lst +++ b/avmedia/prj/d.lst @@ -16,3 +16,8 @@ mkdir: %_DEST%\inc%_EXT%\avmedia ..\inc\avmedia\mediatoolbox.hxx %_DEST%\inc%_EXT%\avmedia\mediatoolbox.hxx ..\%__SRC%\class\avmedia.jar %_DEST%\bin%_EXT%\avmedia.jar +..\%__SRC%\misc\avmedia.component %_DEST%\xml%_EXT%\avmedia.component +..\%__SRC%\misc\avmedia.jar.component %_DEST%\xml%_EXT%\avmedia.jar.component +..\%__SRC%\misc\avmediaQuickTime.component %_DEST%\xml%_EXT%\avmediaQuickTime.component +..\%__SRC%\misc\avmediagst.component %_DEST%\xml%_EXT%\avmediagst.component +..\%__SRC%\misc\avmediawin.component %_DEST%\xml%_EXT%\avmediawin.component diff --git a/avmedia/source/framework/soundhandler.cxx b/avmedia/source/framework/soundhandler.cxx index d24ae795fd76..a1fed18a0f68 100644 --- a/avmedia/source/framework/soundhandler.cxx +++ b/avmedia/source/framework/soundhandler.cxx @@ -497,44 +497,6 @@ extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -// ----------------------- -// - component_writeInfo - -// ----------------------- - -extern "C" sal_Bool SAL_CALL component_writeInfo( void* /*pServiceManager*/, void* pRegistryKey ) -{ - sal_Bool bRet = sal_False; - - if( pRegistryKey ) - { - try - { - rtl::OUString sKeyName = DECLARE_ASCII( "/" ); - sKeyName += avmedia::SoundHandler::impl_getStaticImplementationName(); - sKeyName += DECLARE_ASCII( "/UNO/SERVICES" ); - css::uno::Reference< css::registry::XRegistryKey > xNewKey( - static_cast< css::registry::XRegistryKey* >( pRegistryKey )->createKey(sKeyName)); - - if ( xNewKey.is() == sal_True ) - { - css::uno::Sequence< ::rtl::OUString > seqServiceNames = avmedia::SoundHandler::impl_getStaticSupportedServiceNames(); - const ::rtl::OUString* pArray = seqServiceNames.getArray(); - sal_Int32 nLength = seqServiceNames.getLength(); - for ( sal_Int32 nCounter = 0; nCounter < nLength; ++nCounter ) - xNewKey->createKey( pArray[nCounter] ); - } - - bRet = sal_True; - } - catch( css::registry::InvalidRegistryException& ) - { - OSL_ENSURE( sal_False, "### InvalidRegistryException!" ); - } - } - - return bRet; -} - // ------------------------ // - component_getFactory - // ------------------------ diff --git a/avmedia/source/gstreamer/avmediagst.component b/avmedia/source/gstreamer/avmediagst.component new file mode 100644 index 000000000000..75d39d275f5c --- /dev/null +++ b/avmedia/source/gstreamer/avmediagst.component @@ -0,0 +1,34 @@ + + + + + + + + diff --git a/avmedia/source/gstreamer/exports.dxp b/avmedia/source/gstreamer/exports.dxp index 9630d7e06768..f0e1c69934bc 100644 --- a/avmedia/source/gstreamer/exports.dxp +++ b/avmedia/source/gstreamer/exports.dxp @@ -1,3 +1,2 @@ component_getImplementationEnvironment -component_writeInfo component_getFactory diff --git a/avmedia/source/gstreamer/gstuno.cxx b/avmedia/source/gstreamer/gstuno.cxx index adcda63fcd9c..26d13ffc938b 100644 --- a/avmedia/source/gstreamer/gstuno.cxx +++ b/avmedia/source/gstreamer/gstuno.cxx @@ -48,35 +48,6 @@ extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -// ----------------------- -// - component_writeInfo - -// ----------------------- - -extern "C" sal_Bool SAL_CALL component_writeInfo( void* /* pServiceManager */, void* pRegistryKey ) -{ - sal_Bool bRet = sal_False; - - if( pRegistryKey ) - { - try - { - uno::Reference< registry::XRegistryKey > xNewKey1( - static_cast< registry::XRegistryKey* >( pRegistryKey )->createKey( - ::rtl::OUString::createFromAscii( - "/" AVMEDIA_GSTREAMER_MANAGER_IMPLEMENTATIONNAME "/UNO/SERVICES/" - AVMEDIA_GSTREAMER_MANAGER_SERVICENAME ) ) ); - - bRet = sal_True; - } - catch( registry::InvalidRegistryException& ) - { - OSL_ENSURE( sal_False, "### InvalidRegistryException!" ); - } - } - - return bRet; -} - // ------------------------ // - component_getFactory - // ------------------------ diff --git a/avmedia/source/gstreamer/makefile.mk b/avmedia/source/gstreamer/makefile.mk index 2f22c7333778..c648fcc77f89 100644 --- a/avmedia/source/gstreamer/makefile.mk +++ b/avmedia/source/gstreamer/makefile.mk @@ -69,3 +69,11 @@ DEF1EXPORTFILE=exports.dxp .ENDIF .INCLUDE : target.mk + +ALLTAR : $(MISC)/avmediagst.component + +$(MISC)/avmediagst.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + avmediagst.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt avmediagst.component diff --git a/avmedia/source/java/MediaUno.java b/avmedia/source/java/MediaUno.java index ca7a164586d8..3e4387840741 100644 --- a/avmedia/source/java/MediaUno.java +++ b/avmedia/source/java/MediaUno.java @@ -64,13 +64,4 @@ public class MediaUno return null; } - - // ------------------------------------------------------------------------- - - public static boolean __writeRegistryServiceInfo( - com.sun.star.registry.XRegistryKey regKey ) - { - return com.sun.star.comp.loader.FactoryHelper.writeRegistryServiceInfo( - s_implName, s_serviceName, regKey ); - } } diff --git a/avmedia/source/java/avmedia.jar.component b/avmedia/source/java/avmedia.jar.component new file mode 100644 index 000000000000..d7cc160bd7d0 --- /dev/null +++ b/avmedia/source/java/avmedia.jar.component @@ -0,0 +1,34 @@ + + + + + + + + diff --git a/avmedia/source/java/makefile.mk b/avmedia/source/java/makefile.mk index 37c53a721164..1fe771c117f2 100644 --- a/avmedia/source/java/makefile.mk +++ b/avmedia/source/java/makefile.mk @@ -59,3 +59,11 @@ CUSTOMMANIFESTFILE = manifest # --- Targets ------------------------------------------------------ .INCLUDE: target.mk + +ALLTAR : $(MISC)/avmedia.jar.component + +$(MISC)/avmedia.jar.component .ERRREMOVE : \ + $(SOLARENV)/bin/createcomponent.xslt avmedia.jar.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_JAVA)avmedia.jar' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt avmedia.jar.component diff --git a/avmedia/source/quicktime/avmediaQuickTime.component b/avmedia/source/quicktime/avmediaQuickTime.component new file mode 100644 index 000000000000..aa0251d74c9d --- /dev/null +++ b/avmedia/source/quicktime/avmediaQuickTime.component @@ -0,0 +1,34 @@ + + + + + + + + diff --git a/avmedia/source/quicktime/makefile.mk b/avmedia/source/quicktime/makefile.mk index f3c9f244f357..358fce491847 100644 --- a/avmedia/source/quicktime/makefile.mk +++ b/avmedia/source/quicktime/makefile.mk @@ -83,3 +83,11 @@ SHL1VERSIONMAP=$(SOLARENV)/src/component.map dummy: @echo " Nothing to build for GUIBASE=$(GUIBASE)" .ENDIF + +ALLTAR : $(MISC)/avmediaQuickTime.component + +$(MISC)/avmediaQuickTime.component .ERRREMOVE : \ + $(SOLARENV)/bin/createcomponent.xslt avmediaQuickTime.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt avmediaQuickTime.component diff --git a/avmedia/source/quicktime/quicktimeuno.cxx b/avmedia/source/quicktime/quicktimeuno.cxx index b2dee4d77838..9ecd77f4b9e0 100644 --- a/avmedia/source/quicktime/quicktimeuno.cxx +++ b/avmedia/source/quicktime/quicktimeuno.cxx @@ -48,35 +48,6 @@ extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -// ----------------------- -// - component_writeInfo - -// ----------------------- - -extern "C" sal_Bool SAL_CALL component_writeInfo( void* /* pServiceManager */, void* pRegistryKey ) -{ - sal_Bool bRet = sal_False; - - if( pRegistryKey ) - { - try - { - uno::Reference< registry::XRegistryKey > xNewKey1( - static_cast< registry::XRegistryKey* >( pRegistryKey )->createKey( - ::rtl::OUString::createFromAscii( - "/" AVMEDIA_QUICKTIME_MANAGER_IMPLEMENTATIONNAME "/UNO/SERVICES/" - AVMEDIA_QUICKTIME_MANAGER_SERVICENAME ) ) ); - - bRet = sal_True; - } - catch( registry::InvalidRegistryException& ) - { - OSL_ENSURE( sal_False, "### InvalidRegistryException!" ); - } - } - - return bRet; -} - // ------------------------ // - component_getFactory - // ------------------------ diff --git a/avmedia/source/win/avmediawin.component b/avmedia/source/win/avmediawin.component new file mode 100644 index 000000000000..c80c19bff0d9 --- /dev/null +++ b/avmedia/source/win/avmediawin.component @@ -0,0 +1,34 @@ + + + + + + + + diff --git a/avmedia/source/win/exports.dxp b/avmedia/source/win/exports.dxp index db9c0a52f288..926e49f5f1a5 100644 --- a/avmedia/source/win/exports.dxp +++ b/avmedia/source/win/exports.dxp @@ -1,4 +1,3 @@ component_getImplementationEnvironment -component_writeInfo component_getFactory diff --git a/avmedia/source/win/makefile.mk b/avmedia/source/win/makefile.mk index b70841e8bdf7..37db25b6a8b7 100644 --- a/avmedia/source/win/makefile.mk +++ b/avmedia/source/win/makefile.mk @@ -80,3 +80,11 @@ SHL1STDLIBS += dxguid.lib .ENDIF .INCLUDE : target.mk + +ALLTAR : $(MISC)/avmediawin.component + +$(MISC)/avmediawin.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + avmediawin.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt avmediawin.component diff --git a/avmedia/source/win/winuno.cxx b/avmedia/source/win/winuno.cxx index 645871290413..8b71f10b3f29 100644 --- a/avmedia/source/win/winuno.cxx +++ b/avmedia/source/win/winuno.cxx @@ -48,33 +48,6 @@ extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -// ----------------------- -// - component_writeInfo - -// ----------------------- - -extern "C" sal_Bool SAL_CALL component_writeInfo( void*, void* pRegistryKey ) -{ - sal_Bool bRet = sal_False; - - if( pRegistryKey ) - { - try - { - uno::Reference< registry::XRegistryKey > xNewKey1( - static_cast< registry::XRegistryKey* >( pRegistryKey )->createKey( - ::rtl::OUString::createFromAscii( "/com.sun.star.comp.avmedia.Manager_DirectX/UNO/SERVICES/com.sun.star.media.Manager_DirectX" ) ) ); - - bRet = sal_True; - } - catch( registry::InvalidRegistryException& ) - { - OSL_ENSURE( sal_False, "### InvalidRegistryException!" ); - } - } - - return bRet; -} - // ------------------------ // - component_getFactory - // ------------------------ diff --git a/avmedia/source/xine/exports.dxp b/avmedia/source/xine/exports.dxp index db9c0a52f288..926e49f5f1a5 100644 --- a/avmedia/source/xine/exports.dxp +++ b/avmedia/source/xine/exports.dxp @@ -1,4 +1,3 @@ component_getImplementationEnvironment -component_writeInfo component_getFactory diff --git a/avmedia/source/xine/xineuno.cxx b/avmedia/source/xine/xineuno.cxx index 4dc4f3f7e1dd..2efe57b2472c 100644 --- a/avmedia/source/xine/xineuno.cxx +++ b/avmedia/source/xine/xineuno.cxx @@ -48,35 +48,6 @@ extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -// ----------------------- -// - component_writeInfo - -// ----------------------- - -extern "C" sal_Bool SAL_CALL component_writeInfo( void* /* pServiceManager */, void* pRegistryKey ) -{ - sal_Bool bRet = sal_False; - - if( pRegistryKey ) - { - try - { - uno::Reference< registry::XRegistryKey > xNewKey1( - static_cast< registry::XRegistryKey* >( pRegistryKey )->createKey( - ::rtl::OUString::createFromAscii( - "/" AVMEDIA_XINE_MANAGER_IMPLEMENTATIONNAME "/UNO/SERVICES/" - AVMEDIA_XINE_MANAGER_SERVICENAME ) ) ); - - bRet = sal_True; - } - catch( registry::InvalidRegistryException& ) - { - OSL_ENSURE( sal_False, "### InvalidRegistryException!" ); - } - } - - return bRet; -} - // ------------------------ // - component_getFactory - // ------------------------ diff --git a/avmedia/util/avmedia.component b/avmedia/util/avmedia.component new file mode 100644 index 000000000000..fa01dc03eb9c --- /dev/null +++ b/avmedia/util/avmedia.component @@ -0,0 +1,34 @@ + + + + + + + + diff --git a/avmedia/util/makefile.mk b/avmedia/util/makefile.mk index b0d0a6816cf8..a0712204bec1 100644 --- a/avmedia/util/makefile.mk +++ b/avmedia/util/makefile.mk @@ -77,3 +77,11 @@ $(MISC)$/$(SHL1TARGET).flt: makefile.mk @echo LibMain>>$@ @echo CT>>$@ .ENDIF + +ALLTAR : $(MISC)/avmedia.component + +$(MISC)/avmedia.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + avmedia.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt avmedia.component -- cgit From 1885dddbdd2382f95aef15df15d4cd110f8d7854 Mon Sep 17 00:00:00 2001 From: sb Date: Fri, 22 Oct 2010 10:37:46 +0200 Subject: sb131: #i115124# $(XSLTPROC) implies LIBXSLT:libxslt --- avmedia/prj/build.lst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'avmedia') diff --git a/avmedia/prj/build.lst b/avmedia/prj/build.lst index 6651d9d74f8f..2348b606dcab 100644 --- a/avmedia/prj/build.lst +++ b/avmedia/prj/build.lst @@ -1,4 +1,4 @@ -av avmedia : l10n tools sfx2 NULL +av avmedia : l10n tools sfx2 LIBXSLT:libxslt NULL av avmedia usr1 - all av_mkout NULL av avmedia\prj get - all av_prj NULL av avmedia\inc get - all av_inv NULL -- cgit From 5d46e270c357034f81c91d787cf50dff586ee5a2 Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Thu, 13 Jan 2011 12:36:39 +0100 Subject: removetooltypes01: #i112600# remove tooltypes from avmedia --- avmedia/inc/avmedia/mediaitem.hxx | 6 +++--- avmedia/inc/avmedia/mediaplayer.hxx | 2 +- avmedia/inc/avmedia/mediatoolbox.hxx | 4 ++-- avmedia/source/framework/mediacontrol.cxx | 12 ++++++------ avmedia/source/framework/mediaitem.cxx | 8 ++++---- avmedia/source/framework/mediaplayer.cxx | 2 +- avmedia/source/framework/mediatoolbox.cxx | 4 ++-- avmedia/source/viewer/mediaevent_impl.cxx | 4 ++-- avmedia/source/win/interface.hxx | 6 +++--- 9 files changed, 24 insertions(+), 24 deletions(-) (limited to 'avmedia') diff --git a/avmedia/inc/avmedia/mediaitem.hxx b/avmedia/inc/avmedia/mediaitem.hxx index 5fe0fede94ff..60901a7245bd 100644 --- a/avmedia/inc/avmedia/mediaitem.hxx +++ b/avmedia/inc/avmedia/mediaitem.hxx @@ -71,7 +71,7 @@ class MediaItem : public SfxPoolItem public: TYPEINFO(); - MediaItem( USHORT nWhich = 0, sal_uInt32 nMaskSet = AVMEDIA_SETMASK_NONE ); + MediaItem( sal_uInt16 nWhich = 0, sal_uInt32 nMaskSet = AVMEDIA_SETMASK_NONE ); MediaItem( const MediaItem& rMediaItem ); virtual ~MediaItem(); @@ -82,8 +82,8 @@ public: SfxMapUnit ePresUnit, XubString& rText, const IntlWrapper *pIntl ) const; - virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const; - virtual BOOL PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ); + virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); void merge( const MediaItem& rMediaItem ); diff --git a/avmedia/inc/avmedia/mediaplayer.hxx b/avmedia/inc/avmedia/mediaplayer.hxx index ad60b1bdebf3..8d55ab5c401a 100644 --- a/avmedia/inc/avmedia/mediaplayer.hxx +++ b/avmedia/inc/avmedia/mediaplayer.hxx @@ -52,7 +52,7 @@ namespace avmedia class MediaPlayer : public SfxChildWindow { public: - MediaPlayer( Window*, USHORT, SfxBindings*, SfxChildWinInfo* ); + MediaPlayer( Window*, sal_uInt16, SfxBindings*, SfxChildWinInfo* ); ~MediaPlayer(); SFX_DECL_CHILDWINDOW( MediaPlayer ); diff --git a/avmedia/inc/avmedia/mediatoolbox.hxx b/avmedia/inc/avmedia/mediatoolbox.hxx index 890fffaf0340..2ae34dc0bd23 100644 --- a/avmedia/inc/avmedia/mediatoolbox.hxx +++ b/avmedia/inc/avmedia/mediatoolbox.hxx @@ -48,10 +48,10 @@ public: SFX_DECL_TOOLBOX_CONTROL(); - MediaToolBoxControl( USHORT nSlotId, USHORT nId, ToolBox& rTbX ); + MediaToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbX ); ~MediaToolBoxControl(); - virtual void StateChanged( USHORT nSID, SfxItemState eState, const SfxPoolItem* pState ); + virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ); virtual Window* CreateItemWindow( Window* pParent ); private: diff --git a/avmedia/source/framework/mediacontrol.cxx b/avmedia/source/framework/mediacontrol.cxx index 2eb18cb164d9..701b7c6cf238 100644 --- a/avmedia/source/framework/mediacontrol.cxx +++ b/avmedia/source/framework/mediacontrol.cxx @@ -86,7 +86,7 @@ MediaControl::MediaControl( Window* pParent, MediaControlStyle eControlStyle ) : const String aTimeText( RTL_CONSTASCII_USTRINGPARAM( " 00:00:00/00:00:00 " ) ); SetBackground(); - SetPaintTransparent( TRUE ); + SetPaintTransparent( sal_True ); SetParentClipMode( PARENTCLIPMODE_NOCLIP ); if( MEDIACONTROLSTYLE_SINGLELINE != meControlStyle ) @@ -104,11 +104,11 @@ MediaControl::MediaControl( Window* pParent, MediaControlStyle eControlStyle ) : mpZoomListBox->SetBackground(); maZoomToolBox.SetBackground(); - maZoomToolBox.SetPaintTransparent( TRUE ); + maZoomToolBox.SetPaintTransparent( sal_True ); maPlayToolBox.SetBackground(); - maPlayToolBox.SetPaintTransparent( TRUE ); + maPlayToolBox.SetPaintTransparent( sal_True ); maMuteToolBox.SetBackground(); - maMuteToolBox.SetPaintTransparent( TRUE ); + maMuteToolBox.SetPaintTransparent( sal_True ); } @@ -362,7 +362,7 @@ void MediaControl::implUpdateToolboxes() if( !mpZoomListBox->IsTravelSelect() && !mpZoomListBox->IsInDropDown() ) { - USHORT nSelectEntryPos ; + sal_uInt16 nSelectEntryPos ; switch( maItem.getZoom() ) { @@ -454,7 +454,7 @@ void MediaControl::implUpdateTimeField( double fCurTime ) Image MediaControl::implGetImage( sal_Int32 nImageId ) const { - return maImageList.GetImage( static_cast< USHORT >( nImageId ) ); + return maImageList.GetImage( static_cast< sal_uInt16 >( nImageId ) ); } // ------------------------------------------------------------------------------ diff --git a/avmedia/source/framework/mediaitem.cxx b/avmedia/source/framework/mediaitem.cxx index f9f85eb1ee66..f75fafa0509e 100644 --- a/avmedia/source/framework/mediaitem.cxx +++ b/avmedia/source/framework/mediaitem.cxx @@ -50,7 +50,7 @@ TYPEINIT1_AUTOFACTORY( MediaItem, ::SfxPoolItem ); // ------------------------------------------------------------------------------ -MediaItem::MediaItem( USHORT _nWhich, sal_uInt32 nMaskSet ) : +MediaItem::MediaItem( sal_uInt16 _nWhich, sal_uInt32 nMaskSet ) : SfxPoolItem( _nWhich ), mnMaskSet( nMaskSet ), meState( MEDIASTATE_STOP ), @@ -122,7 +122,7 @@ SfxItemPresentation MediaItem::GetPresentation( SfxItemPresentation, //------------------------------------------------------------------------ -BOOL MediaItem::QueryValue( com::sun::star::uno::Any& rVal, BYTE ) const +sal_Bool MediaItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 ) const { uno::Sequence< uno::Any > aSeq( 9 ); @@ -143,10 +143,10 @@ BOOL MediaItem::QueryValue( com::sun::star::uno::Any& rVal, BYTE ) const //------------------------------------------------------------------------ -BOOL MediaItem::PutValue( const com::sun::star::uno::Any& rVal, BYTE ) +sal_Bool MediaItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 ) { uno::Sequence< uno::Any > aSeq; - BOOL bRet = false; + sal_Bool bRet = false; if( ( rVal >>= aSeq ) && ( aSeq.getLength() == 9 ) ) { diff --git a/avmedia/source/framework/mediaplayer.cxx b/avmedia/source/framework/mediaplayer.cxx index caab783c6a7c..b476f9a2ef41 100644 --- a/avmedia/source/framework/mediaplayer.cxx +++ b/avmedia/source/framework/mediaplayer.cxx @@ -45,7 +45,7 @@ namespace avmedia // - MediaPlayer - // --------------- -MediaPlayer::MediaPlayer( Window* _pParent, USHORT nId, SfxBindings* _pBindings, SfxChildWinInfo* pInfo ) : +MediaPlayer::MediaPlayer( Window* _pParent, sal_uInt16 nId, SfxBindings* _pBindings, SfxChildWinInfo* pInfo ) : SfxChildWindow( _pParent, nId ) { pWindow = new MediaFloater( _pBindings, this, _pParent ); diff --git a/avmedia/source/framework/mediatoolbox.cxx b/avmedia/source/framework/mediatoolbox.cxx index 2da70b056bfc..74bacb3861f0 100644 --- a/avmedia/source/framework/mediatoolbox.cxx +++ b/avmedia/source/framework/mediatoolbox.cxx @@ -95,7 +95,7 @@ SFX_IMPL_TOOLBOX_CONTROL( ::avmedia::MediaToolBoxControl, ::avmedia::MediaItem ) // ----------------------------------------------------------------------------- -MediaToolBoxControl::MediaToolBoxControl( USHORT nSlotId, USHORT nId, ToolBox& rTbx ) : +MediaToolBoxControl::MediaToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) : SfxToolBoxControl( nSlotId, nId, rTbx ) { rTbx.Invalidate(); @@ -109,7 +109,7 @@ MediaToolBoxControl::~MediaToolBoxControl() // ----------------------------------------------------------------------------- -void MediaToolBoxControl::StateChanged( USHORT /* nSID */, SfxItemState eState, const SfxPoolItem* pState ) +void MediaToolBoxControl::StateChanged( sal_uInt16 /* nSID */, SfxItemState eState, const SfxPoolItem* pState ) { MediaToolBoxControl_Impl* pCtrl = static_cast< MediaToolBoxControl_Impl* >( GetToolBox().GetItemWindow( GetId() ) ); diff --git a/avmedia/source/viewer/mediaevent_impl.cxx b/avmedia/source/viewer/mediaevent_impl.cxx index cf86f54df8f9..72941cd6a78e 100644 --- a/avmedia/source/viewer/mediaevent_impl.cxx +++ b/avmedia/source/viewer/mediaevent_impl.cxx @@ -117,7 +117,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 ) | @@ -138,7 +138,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/win/interface.hxx b/avmedia/source/win/interface.hxx index a5928139e7a7..cf45bb40ab9a 100644 --- a/avmedia/source/win/interface.hxx +++ b/avmedia/source/win/interface.hxx @@ -90,7 +90,7 @@ public: IMediaSample *pSample) = 0; virtual HRESULT __stdcall BufferCB( double SampleTime, - WIN_BYTE *pBuffer, + BYTE *pBuffer, long BufferLen) = 0; }; @@ -103,13 +103,13 @@ ISampleGrabber : public IUnknown { public: virtual HRESULT __stdcall SetOneShot( - WIN_BOOL OneShot) = 0; + BOOL OneShot) = 0; virtual HRESULT __stdcall SetMediaType( const AM_MEDIA_TYPE *pType) = 0; virtual HRESULT __stdcall GetConnectedMediaType( AM_MEDIA_TYPE *pType) = 0; virtual HRESULT __stdcall SetBufferSamples( - WIN_BOOL BufferThem) = 0; + BOOL BufferThem) = 0; virtual HRESULT __stdcall GetCurrentBuffer( long *pBufferSize, long *pBuffer) = 0; -- cgit From 4fba42e5f98fcc0fa9addf41a793c1d7f11602c8 Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Tue, 22 Feb 2011 19:07:34 +0100 Subject: masterfix DEV300: #i10000# usage of L10N build_type --- avmedia/prj/build.lst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'avmedia') diff --git a/avmedia/prj/build.lst b/avmedia/prj/build.lst index 2348b606dcab..7d9343b916fd 100644 --- a/avmedia/prj/build.lst +++ b/avmedia/prj/build.lst @@ -1,4 +1,4 @@ -av avmedia : l10n tools sfx2 LIBXSLT:libxslt NULL +av avmedia : L10N:l10n tools sfx2 LIBXSLT:libxslt NULL av avmedia usr1 - all av_mkout NULL av avmedia\prj get - all av_prj NULL av avmedia\inc get - all av_inv NULL -- cgit