Kaydet (Commit) 2eea82e0 authored tarafından Radek Doulik's avatar Radek Doulik

avmedia-source-gstreamer-*.diff: gstreamer - implementation

üst 6305b54d
2006-09-22 Radek Doulik <rodo@novell.com>
* gstplayer.cxx (processSyncMessage): remember GstXOverlay
(processMessage): explicit expose when we reach paused state -
this mean that now once stream is loaded/video inserted, the 1st
frame is rendered
(setMediaTime): if not playing set PAUSED state again, seems like
seek is changing state to PLAYING. this fixes problem when stop
seeked to begin and started playing again
2006-09-21 Radek Doulik <rodo@novell.com>
* gstplayer.cxx (processSyncMessage): when error occurs, set the
condition so that OOo does'n waste time waiting for us to finish
reaching PAUSED state
2006-09-19 Radek Doulik <rodo@novell.com>
* gstplayer.cxx (processSyncMessage): set condition even if we
weren't able to get video size - might be audio only stream
(getPreferredPlayerWindowSize): init size to 0, 0 - in case we
don't have video size, it will fallback to system media window
content (some icon)
2006-08-31 Radek Doulik <rodo@novell.com>
* gstplayer.cxx (processSyncMessage): when we get to paused state,
get stream-info from playbin and look for video size. set
condition when done
(Player): added width, height, size condition
(preparePlaybin): new helper method, extracted from create
method. use fake video sink in the beggining so that we don't get
xwindow-id message too early
(getPreferredPlayerWindowSize): wait for size condition to be sure
we know video size (if possible). reset video sink to default one
(NULL) and set state to READY and immediatelly to PAUSE so that
the default sink is relinked
2006-08-16 Radek Doulik <rodo@novell.com>
* gstplayer.cxx (create): set state to PAUSED so that we can query
duration ASAP
(processMessage): watch for state changed and query duration when
going to PAUSED state
2006-08-15 Radek Doulik <rodo@novell.com>
* makefile.mk: require gstreamer-plugins-base-0.10 and link with
gst interfaces library
* gstwindow.cxx: make it build
* gstplayer.cxx: removed WINNT ifdefs (relict from time when I
thought Cedric develops on win architecture)
(gst_pipeline_bus_callback): added sync handler for setting
xwindow id to to video sink
(processSyncMessage): new metrhod, process message from sync
handler
(create): set playbin state to READY so that playback start is
faster
(createPlayerWindow): implemented, we pass xwindow id in 3rd
argument
2006-08-04 Radek Doulik <rodo@novell.com>
* gstplayer.cxx (create): add bus watch, watch for EOS in
processMessage method (called from watch callback)
2006-08-02 Radek Doulik <rodo@novell.com>
* gstplayer.cxx: test for mpPlaybin != NULL before using it,
initialize it in constructor to NULL and also reset it to NULL
after unrefing
(getDuration): check for sucessful query and the right format
(getMediaTime): ditto,
(setMediaTime): implemented
2006-08-01 Radek Doulik <rodo@novell.com>
* gstwindow.hxx: removed mpWndClass for now, so that the rest
compiles
* gstuno.cxx (component_getFactory): s/DirectX/GStreamer so that
component is loaded
* gstplayer.cxx (Player::Player): do not create gerror object, it
is noit needed, free the error object only if created during
initialization of gstremer
(Player::create, start, stop): use g_main_loop only on windows
(create): fixed ascURL declaration, added rtl namespace prefix
(setMute): set mbMuted
(setVolumeDB): convert avmedia volume to gstreamer volume, added
missing NULL to the end of g_object_set call
(getVolumeDB): convert gstreamer volume back to avmedia volume
* gstplayer.hxx: keep g_main_loop only on win platform. make
mnUnmutedVolume double, moved mbInitialized to the end to quiet
compiler warning
* gstcommon.hxx: removed wrong #include <rtl/ustring>
* renamed source files, prefixed the names with gst so that obj
file names do not clash with xine object files
* makefile.mk: changed PRJNAME and TARGET to reflect
gstreamer. enabled build on unix as well. removed win library
references. removed source files which are not yet ported from
SLOFILES list.
2006-08-31 Radek Doulik <rodo@novell.com>
* imported initial sources from Cedric Bosdonnat
\ No newline at end of file
component_getImplementationEnvironment
component_writeInfo
component_getFactory
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2010 Novell, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* 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
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
#ifndef _GSTCOMMON_HXX
#define _GSTCOMMON_HXX
#include <gst/gst.h>
#ifndef _OSL_MUTEX_HXX_
#include <osl/mutex.hxx>
#endif
#ifndef _DEBUG_HXX
#include <tools/debug.hxx>
#endif
#ifndef _STREAM_HXX
#include <tools/stream.hxx>
#endif
#ifndef _STRING_HXX
#include <tools/string.hxx>
#endif
#ifndef _URLOBJ_HXX
#include <tools/urlobj.hxx>
#endif
#ifndef _CPPUHELPER_IMPLBASE1_HXX_
#include <cppuhelper/implbase1.hxx>
#endif
#ifndef _CPPUHELPER_IMPLBASE2_HXX_
#include <cppuhelper/implbase2.hxx>
#endif
#ifndef _CPPUHELPER_WEAK_HXX_
#include <cppuhelper/weak.hxx>
#endif
#ifndef _CPPUHELPER_FACTORY_HXX_
#include <cppuhelper/factory.hxx>
#endif
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/uno/RuntimeException.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/registry/XRegistryKey.hpp>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/awt/Rectangle.hpp>
#include <com/sun/star/awt/KeyModifier.hpp>
#include <com/sun/star/awt/MouseButton.hpp>
#include <com/sun/star/media/XManager.hpp>
#define WM_GRAPHNOTIFY (WM_USER + 567)
#endif // _GSTCOMMOM_HXX
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2010 Novell, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* 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
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
#include <tools/prewin.h>
#include <windows.h>
#include <objbase.h>
#include <strmif.h>
#include <Amvideo.h>
#include <Qedit.h>
#include <uuids.h>
#include <tools/postwin.h>
#include "framegrabber.hxx"
#include "player.hxx"
#include <tools/stream.hxx>
#include <vcl/graph.hxx>
#include <unotools/localfilehelper.hxx>
#define AVMEDIA_GST_FRAMEGRABBER_IMPLEMENTATIONNAME "com.sun.star.comp.avmedia.FrameGrabber_GStreamer"
#define AVMEDIA_GST_FRAMEGRABBER_SERVICENAME "com.sun.star.media.FrameGrabber_GStreamer"
using namespace ::com::sun::star;
namespace avmedia { namespace gstreamer {
// ----------------
// - FrameGrabber -
// ----------------
FrameGrabber::FrameGrabber( const uno::Reference< lang::XMultiServiceFactory >& rxMgr ) :
mxMgr( rxMgr )
{
::CoInitialize( NULL );
}
// ------------------------------------------------------------------------------
FrameGrabber::~FrameGrabber()
{
::CoUninitialize();
}
// ------------------------------------------------------------------------------
IMediaDet* FrameGrabber::implCreateMediaDet( const ::rtl::OUString& rURL ) const
{
IMediaDet* pDet = NULL;
if( SUCCEEDED( CoCreateInstance( CLSID_MediaDet, NULL, CLSCTX_INPROC_SERVER, IID_IMediaDet, (void**) &pDet ) ) )
{
String aLocalStr;
if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( rURL, aLocalStr ) && aLocalStr.Len() )
{
if( !SUCCEEDED( pDet->put_Filename( ::SysAllocString( aLocalStr.GetBuffer() ) ) ) )
{
pDet->Release();
pDet = NULL;
}
}
}
return pDet;
}
// ------------------------------------------------------------------------------
bool FrameGrabber::create( const ::rtl::OUString& rURL )
{
// just check if a MediaDet interface can be created with the given URL
IMediaDet* pDet = implCreateMediaDet( rURL );
if( pDet )
{
maURL = rURL;
pDet->Release();
pDet = NULL;
}
else
maURL = ::rtl::OUString();
return( maURL.getLength() > 0 );
}
// ------------------------------------------------------------------------------
uno::Reference< graphic::XGraphic > SAL_CALL FrameGrabber::grabFrame( double fMediaTime )
throw (uno::RuntimeException)
{
uno::Reference< graphic::XGraphic > xRet;
IMediaDet* pDet = implCreateMediaDet( maURL );
if( pDet )
{
double fLength;
long nStreamCount;
bool bFound = false;
if( SUCCEEDED( pDet->get_OutputStreams( &nStreamCount ) ) )
{
for( long n = 0; ( n < nStreamCount ) && !bFound; ++n )
{
GUID aMajorType;
if( SUCCEEDED( pDet->put_CurrentStream( n ) ) &&
SUCCEEDED( pDet->get_StreamType( &aMajorType ) ) &&
( aMajorType == MEDIATYPE_Video ) )
{
bFound = true;
}
}
}
if( bFound &&
( S_OK == pDet->get_StreamLength( &fLength ) ) &&
( fLength > 0.0 ) && ( fMediaTime >= 0.0 ) && ( fMediaTime <= fLength ) )
{
AM_MEDIA_TYPE aMediaType;
long nWidth = 0, nHeight = 0, nSize = 0;
if( SUCCEEDED( pDet->get_StreamMediaType( &aMediaType ) ) )
{
if( ( aMediaType.formattype == FORMAT_VideoInfo ) &&
( aMediaType.cbFormat >= sizeof( VIDEOINFOHEADER ) ) )
{
VIDEOINFOHEADER* pVih = reinterpret_cast< VIDEOINFOHEADER* >( aMediaType.pbFormat );
nWidth = pVih->bmiHeader.biWidth;
nHeight = pVih->bmiHeader.biHeight;
if( nHeight < 0 )
nHeight *= -1;
}
if( aMediaType.cbFormat != 0 )
{
::CoTaskMemFree( (PVOID) aMediaType.pbFormat );
aMediaType.cbFormat = 0;
aMediaType.pbFormat = NULL;
}
if( aMediaType.pUnk != NULL )
{
aMediaType.pUnk->Release();
aMediaType.pUnk = NULL;
}
}
if( ( nWidth > 0 ) && ( nHeight > 0 ) &&
SUCCEEDED( pDet->GetBitmapBits( 0, &nSize, NULL, nWidth, nHeight ) ) &&
( nSize > 0 ) )
{
char* pBuffer = new char[ nSize ];
try
{
if( SUCCEEDED( pDet->GetBitmapBits( fMediaTime, NULL, pBuffer, nWidth, nHeight ) ) )
{
SvMemoryStream aMemStm( pBuffer, nSize, STREAM_READ | STREAM_WRITE );
Bitmap aBmp;
if( aBmp.Read( aMemStm, false ) && !aBmp.IsEmpty() )
{
const Graphic aGraphic( aBmp );
xRet = aGraphic.GetXGraphic();
}
}
}
catch( ... )
{
}
delete [] pBuffer;
}
}
pDet->Release();
}
return xRet;
}
// ------------------------------------------------------------------------------
::rtl::OUString SAL_CALL FrameGrabber::getImplementationName( )
throw (uno::RuntimeException)
{
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_GST_FRAMEGRABBER_IMPLEMENTATIONNAME ) );
}
// ------------------------------------------------------------------------------
sal_Bool SAL_CALL FrameGrabber::supportsService( const ::rtl::OUString& ServiceName )
throw (uno::RuntimeException)
{
return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( AVMEDIA_GST_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_GST_FRAMEGRABBER_SERVICENAME ) );
return aRet;
}
} // namespace gstreamer
} // namespace avmedia
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2010 Novell, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* 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
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
#ifndef _FRAMEGRABBER_HXX
#define _FRAMEGRABBER_HXX
#include "gstcommon.hxx"
#ifndef _COM_SUN_STAR_MEDIA_XFRAMEGRABBER_HDL_
#include "com/sun/star/media/XFrameGrabber.hdl"
#endif
namespace avmedia { namespace gstreamer {
// ----------------
// - FrameGrabber -
// ----------------
class FrameGrabber : public ::cppu::WeakImplHelper2 < ::com::sun::star::media::XFrameGrabber,
::com::sun::star::lang::XServiceInfo >
{
public:
FrameGrabber( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxMgr );
~FrameGrabber();
bool create( const ::rtl::OUString& rURL );
// 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);
private:
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMgr;
::rtl::OUString maURL;
};
} // namespace gstreamer
} // namespace avmedia
#endif // _FRAMEGRABBER_HXX
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2010 Novell, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* 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
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
#include "gstmanager.hxx"
#include "gstplayer.hxx"
#include <tools/urlobj.hxx>
#define AVMEDIA_GST_MANAGER_IMPLEMENTATIONNAME "com.sun.star.comp.avmedia.Manager_GStreamer"
#define AVMEDIA_GST_MANAGER_SERVICENAME "com.sun.star.media.Manager"
#if DEBUG
#define DBG OSL_TRACE
#else
#define DBG(...)
#endif
using namespace ::com::sun::star;
namespace avmedia { namespace gstreamer {
// ----------------
// - Manager -
// ----------------
Manager::Manager( const uno::Reference< lang::XMultiServiceFactory >& rxMgr ) :
mxMgr( rxMgr )
{
DBG( "avmediagst: Manager::Manager" );
}
// ------------------------------------------------------------------------------
Manager::~Manager()
{
}
// ------------------------------------------------------------------------------
uno::Reference< media::XPlayer > SAL_CALL Manager::createPlayer( const ::rtl::OUString& rURL )
throw (uno::RuntimeException)
{
Player* pPlayer( new Player( mxMgr ) );
uno::Reference< media::XPlayer > xRet( pPlayer );
const INetURLObject aURL( rURL );
DBG( "avmediagst: Manager::createPlayer" );
if( !pPlayer->create( aURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ) ) )
xRet = uno::Reference< media::XPlayer >();
return xRet;
}
// ------------------------------------------------------------------------------
::rtl::OUString SAL_CALL Manager::getImplementationName( )
throw (uno::RuntimeException)
{
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_GST_MANAGER_IMPLEMENTATIONNAME ) );
}
// ------------------------------------------------------------------------------
sal_Bool SAL_CALL Manager::supportsService( const ::rtl::OUString& ServiceName )
throw (uno::RuntimeException)
{
return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( AVMEDIA_GST_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_GST_MANAGER_SERVICENAME ) );
return aRet;
}
} // namespace gstreamer
} // namespace avmedia
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2010 Novell, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* 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
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
#ifndef _MANAGER_HXX
#define _MANAGER_HXX
#include "gstcommon.hxx"
#ifndef _COM_SUN_STAR_MEDIA_XMANAGER_HDL_
#include "com/sun/star/media/XManager.hdl"
#endif
// -----------
// - Manager -
// -----------
namespace avmedia { namespace gstreamer {
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 gstreamer
} // namespace avmedia
#endif // _MANAGER_HXX
This diff is collapsed.
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2010 Novell, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* 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
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
#ifndef _PLAYER_HXX
#define _PLAYER_HXX
#include <osl/conditn.h>
#include "gstcommon.hxx"
#ifndef _COM_SUN_STAR_MEDIA_XPLAYER_HDL_
#include "com/sun/star/media/XPlayer.hdl"
#endif
typedef struct _GstXOverlay GstXOverlay;
namespace avmedia { namespace gstreamer {
// ----------
// - Player -
// ----------
class Player : public ::cppu::WeakImplHelper2< ::com::sun::star::media::XPlayer,
::com::sun::star::lang::XServiceInfo >
{
public:
Player( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxMgr );
~Player();
void preparePlaybin( const ::rtl::OUString& rURL, bool bFakeVideo );
bool create( const ::rtl::OUString& rURL );
void processMessage( GstMessage *message );
GstBusSyncReply processSyncMessage( GstMessage *message );
// 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);
// 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;
::rtl::OUString maURL;
// Add elements and pipeline here
GstElement* mpPlaybin; // the playbin is also a pipeline
sal_Bool mbFakeVideo;
gdouble mnUnmutedVolume;
sal_Bool mbMuted;
sal_Bool mbLooping;
sal_Bool mbInitialized;
long mnWindowID;
GstXOverlay* mpXOverlay;
gint64 mnDuration;
int mnWidth;
int mnHeight;
oslCondition maSizeCondition;
};
} // namespace gstreamer
} // namespace avmedia
#endif // _PLAYER_HXX
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2010 Novell, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* 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
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
#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::gstreamer::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( "/com.sun.star.comp.media.Manager_GStreamer/UNO/SERVICES/com.sun.star.media.Manager_GStreamer" ) ) );
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, "com.sun.star.comp.media.Manager_GStreamer" ) == 0 )
{
const ::rtl::OUString aServiceName( ::rtl::OUString::createFromAscii( "com.sun.star.media.Manager_GStreamer" ) );
xFactory = uno::Reference< lang::XSingleServiceFactory >( ::cppu::createSingleFactory(
reinterpret_cast< lang::XMultiServiceFactory* >( pServiceManager ),
::rtl::OUString::createFromAscii( "com.sun.star.comp.media.Manager_GStreamer" ),
create_MediaPlayer, uno::Sequence< ::rtl::OUString >( &aServiceName, 1 ) ) );
}
if( xFactory.is() )
{
xFactory->acquire();
pRet = xFactory.get();
}
return pRet;
}
This diff is collapsed.
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2010 Novell, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* 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
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
#ifndef _WINDOW_HXX
#define _WINDOW_HXX
#include "gstcommon.hxx"
#include <cppuhelper/interfacecontainer.h>
#ifndef _COM_SUN_STAR_MEDIA_XPLAYERWINDOW_HDL_
#include "com/sun/star/media/XPlayerWindow.hdl"
#endif
namespace avmedia { namespace gstreamer {
// ---------------
// - Window -
// ---------------
class Player;
class Window : public ::cppu::WeakImplHelper2 < ::com::sun::star::media::XPlayerWindow,
::com::sun::star::lang::XServiceInfo >
{
public:
Window( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxMgr,
Player& rPlayer );
~Window();
bool create( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments );
void processGraphEvent();
void updatePointer();
// 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);
private:
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMgr;
::osl::Mutex maMutex;
::cppu::OMultiTypeInterfaceContainerHelper maListeners;
::com::sun::star::media::ZoomLevel meZoomLevel;
Player& mrPlayer;
int mnPointerType;
void ImplLayoutVideoWindow();
};
} // namespace gstreamer
} // namespace avmedia
#endif // _WINDOW_HXX
#*************************************************************************
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# Copyright 2010 Novell, Inc.
#
# OpenOffice.org - a multi-platform office productivity suite
#
# 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
# <http://www.openoffice.org/license.html>
# for a copy of the LGPLv3 License.
#
#*************************************************************************
PRJ=..$/..
PRJNAME=avmedia
TARGET=avmediagst
# --- Settings ----------------------------------
.INCLUDE : settings.mk
.IF "$(ENABLE_GSTREAMER)" == "TRUE"
.IF "$(verbose)"!="" || "$(VERBOSE)"!=""
CDEFS+= -DVERBOSE
.ENDIF
PKGCONFIG_MODULES=gstreamer-0.10, gstreamer-plugins-base-0.10
.INCLUDE: pkg_config.mk
PKGCONFIG_LIBS+=-lgstinterfaces-0.10
# --- Files ----------------------------------
.IF "$(GUI)" == "UNX" || "$(GUI)" == "WNT"
.IF "$(GUI)" == "WNT"
CDEFS+= -DWINNT
.ENDIF
SLOFILES= \
$(SLO)$/gstuno.obj \
$(SLO)$/gstmanager.obj \
$(SLO)$/gstplayer.obj \
$(SLO)$/gstwindow.obj
EXCEPTIONSFILES= \
$(SLO)$/gstuno.obj \
SHL1TARGET=$(TARGET)
SHL1STDLIBS= $(CPPULIB) $(SALLIB) $(COMPHELPERLIB) $(CPPUHELPERLIB) $(PKGCONFIG_LIBS) $(TOOLSLIB)
SHL1IMPLIB=i$(TARGET)
SHL1LIBS=$(SLB)$/$(TARGET).lib
SHL1DEF=$(MISC)$/$(SHL1TARGET).def
DEF1NAME=$(SHL1TARGET)
DEF1EXPORTFILE=exports.dxp
.ENDIF
.ENDIF
.INCLUDE : target.mk
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment