diff options
author | Minh Ngo <nlminhtl@gmail.com> | 2013-06-24 23:08:15 +0300 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2013-07-26 10:50:19 +0100 |
commit | 49e622c5cadbd42ee85311d7f2a35dd8880f538e (patch) | |
tree | 6e3a3a356bc145c424642415c81226b6bd88f0c1 /avmedia | |
parent | 51d7b654a556db96a2870918bc51a348f1b32260 (diff) |
Lockguards for threadsafe. VLCWindow class templates.
Change-Id: I3e56f1752ebb101f05a231007ffce5cc5b9c97d2
Diffstat (limited to 'avmedia')
-rw-r--r-- | avmedia/source/vlc/vlcplayer.cxx | 16 | ||||
-rw-r--r-- | avmedia/source/vlc/vlcwindow.cpp | 42 | ||||
-rw-r--r-- | avmedia/source/vlc/vlcwindow.hxx | 44 |
3 files changed, 101 insertions, 1 deletions
diff --git a/avmedia/source/vlc/vlcplayer.cxx b/avmedia/source/vlc/vlcplayer.cxx index b308636e83f9..24375ad7d362 100644 --- a/avmedia/source/vlc/vlcplayer.cxx +++ b/avmedia/source/vlc/vlcplayer.cxx @@ -1,4 +1,5 @@ #include "vlcplayer.hxx" +#include "vlcwindow.hxx" using namespace ::com::sun::star; @@ -21,37 +22,44 @@ VLCPlayer::VLCPlayer() void SAL_CALL VLCPlayer::start() { + ::osl::MutexGuard aGuard(m_aMutex); libvlc_media_player_play( mPlayer.get() ); } void SAL_CALL VLCPlayer::stop() { + ::osl::MutexGuard aGuard(m_aMutex); libvlc_media_player_stop( mPlayer.get() ); } ::sal_Bool SAL_CALL VLCPlayer::isPlaying() { + ::osl::MutexGuard aGuard(m_aMutex); return (libvlc_media_player_is_playing( mPlayer.get() ) == 1); } double SAL_CALL VLCPlayer::getDuration() { + ::osl::MutexGuard aGuard(m_aMutex); libvlc_media_t* media = libvlc_media_player_get_media( mPlayer.get() ); return libvlc_media_get_duration( media ); } void SAL_CALL VLCPlayer::setMediaTime( double fTime ) { + ::osl::MutexGuard aGuard(m_aMutex); libvlc_media_player_set_time( mPlayer.get(), fTime ); } double SAL_CALL VLCPlayer::getMediaTime() { + ::osl::MutexGuard aGuard(m_aMutex); return libvlc_media_player_get_time( mPlayer.get() ); } double SAL_CALL VLCPlayer::getRate() { + ::osl::MutexGuard aGuard(m_aMutex); return libvlc_media_player_get_rate( mPlayer.get() ); } @@ -66,21 +74,25 @@ void SAL_CALL VLCPlayer::setPlaybackLoop( ::sal_Bool bSet ) void SAL_CALL VLCPlayer::setVolumeDB( ::sal_Int16 nDB ) { + ::osl::MutexGuard aGuard(m_aMutex); libvlc_audio_set_volume( mPlayer.get(), nDB ); } ::sal_Int16 SAL_CALL VLCPlayer::getVolumeDB() { + ::osl::MutexGuard aGuard(m_aMutex); return libvlc_audio_get_volume( mPlayer.get() ); } void SAL_CALL VLCPlayer::setMute( ::sal_Bool bSet ) { + ::osl::MutexGuard aGuard(m_aMutex); libvlc_audio_set_mute( mPlayer.get(), bSet ); } ::sal_Bool SAL_CALL VLCPlayer::isMute() { + ::osl::MutexGuard aGuard(m_aMutex); return libvlc_audio_get_mute( mPlayer.get() ); } @@ -91,10 +103,12 @@ css::awt::Size SAL_CALL VLCPlayer::getPreferredPlayerWindowSize() uno::Reference< css::media::XPlayerWindow > SAL_CALL VLCPlayer::createPlayerWindow( const uno::Sequence< uno::Any >& aArguments ) { - return uno::Reference< css::media::XPlayerWindow >(); + ::osl::MutexGuard aGuard(m_aMutex); + return uno::Reference< css::media::XPlayerWindow >(new VLCWindow()); } uno::Reference< css::media::XFrameGrabber > SAL_CALL VLCPlayer::createFrameGrabber() { + ::osl::MutexGuard aGuard(m_aMutex); return uno::Reference< css::media::XFrameGrabber >(); } diff --git a/avmedia/source/vlc/vlcwindow.cpp b/avmedia/source/vlc/vlcwindow.cpp new file mode 100644 index 000000000000..77656eb9ac60 --- /dev/null +++ b/avmedia/source/vlc/vlcwindow.cpp @@ -0,0 +1,42 @@ +#include "vlcwindow.hxx" + +using namespace ::com::sun::star; + +namespace avmedia { +namespace vlc { + +void SAL_CALL VLCWindow::pdate() +{ +} + +::sal_Bool SAL_CALL VLCWindow::setZoomLevel( css::media::ZoomLevel ZoomLevel ) +{ + return false; +} + +css::media::ZoomLevel SAL_CALL VLCWindow::getZoomLevel() +{ + return css::media::ZoomLevel_NOT_AVAILABLE; +} + +void SAL_CALL VLCWindow::setPointerType( ::sal_Int32 SystemPointerType ) +{ +} + +::rtl::OUString SAL_CALL VLCWindow::getImplementationName() +{ + return ::rtl::OUString(); +} + +::sal_Bool SAL_CALL VLCWindow::supportsService( const ::rtl::OUString& ServiceName ) +{ + return false; +} + +::uno::Sequence< ::rtl::OUString > SAL_CALL VLCWindow::getSupportedServiceNames() +{ + return ::uno::Sequence< ::rtl::OUString >(); +} + +} +}
\ No newline at end of file diff --git a/avmedia/source/vlc/vlcwindow.hxx b/avmedia/source/vlc/vlcwindow.hxx new file mode 100644 index 000000000000..3c4afcb22a25 --- /dev/null +++ b/avmedia/source/vlc/vlcwindow.hxx @@ -0,0 +1,44 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _VLCWINDOW_HXX +#define _VLCWINDOW_HXX + +#include "vlccommon.hxx" + +namespace avmedia { +namespace vlc { + +class VLCWindow : public ::cppu::WeakImplHelper2 < ::com::sun::star::media::XPlayerWindow, + ::com::sun::star::lang::XServiceInfo > +{ +public: + void SAL_CALL update(); + ::sal_Bool SAL_CALL setZoomLevel( css::media::ZoomLevel ZoomLevel ); + css::media::ZoomLevel SAL_CALL getZoomLevel(); + void SAL_CALL setPointerType( ::sal_Int32 SystemPointerType ); + + ::rtl::OUString SAL_CALL getImplementationName(); + ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ); + ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(); +}; + +} +} + +#endif // _VLCWINDOW_HXX |