From 11f9d59e0250ee5cf46500f5dea4323bac9f6ad9 Mon Sep 17 00:00:00 2001 From: Minh Ngo Date: Sat, 29 Jun 2013 22:23:50 +0300 Subject: Frame grabber interface. Adding service/implementation names. Change-Id: I5bb36f6108a3ac1a36867e41e3148e3431ff8ff4 --- avmedia/Library_avmediavlc.mk | 1 + avmedia/source/vlc/vlcframegrabber.cxx | 37 +++++++++++++++++ avmedia/source/vlc/vlcframegrabber.hxx | 48 ++++++++++++++++++++++ avmedia/source/vlc/vlcplayer.cxx | 18 +++++--- avmedia/source/vlc/vlcplayer.hxx | 2 +- avmedia/source/vlc/vlcwindow.cxx | 75 +++++++++++++++++++++++----------- avmedia/source/vlc/vlcwindow.hxx | 5 ++- 7 files changed, 155 insertions(+), 31 deletions(-) create mode 100644 avmedia/source/vlc/vlcframegrabber.cxx create mode 100644 avmedia/source/vlc/vlcframegrabber.hxx diff --git a/avmedia/Library_avmediavlc.mk b/avmedia/Library_avmediavlc.mk index ced6c4190ae2..06fb035aab74 100644 --- a/avmedia/Library_avmediavlc.mk +++ b/avmedia/Library_avmediavlc.mk @@ -43,6 +43,7 @@ $(eval $(call gb_Library_add_exception_objects,avmediavlc,\ avmedia/source/vlc/vlcplayer \ avmedia/source/vlc/vlcuno \ avmedia/source/vlc/vlcwindow \ + avmedia/source/vlc/vlcframegrabber \ )) # vim: set noet sw=4 ts=4: diff --git a/avmedia/source/vlc/vlcframegrabber.cxx b/avmedia/source/vlc/vlcframegrabber.cxx new file mode 100644 index 000000000000..6e8ab1338ee0 --- /dev/null +++ b/avmedia/source/vlc/vlcframegrabber.cxx @@ -0,0 +1,37 @@ +#include "vlcframegrabber.hxx" + +using namespace ::com::sun::star; + +namespace avmedia { +namespace vlc { + +const ::rtl::OUString AVMEDIA_VLC_GRABBER_IMPLEMENTATIONNAME = "com.sun.star.comp.avmedia.VLCFrameGrabber_VLC"; +const ::rtl::OUString AVMEDIA_VLC_GRABBER_SERVICENAME = "com.sun.star.media.VLCFrameGrabber_VLC"; + +SAL_CALL VLCFrameGrabber::VLCFrameGrabber() +{ +} + +::uno::Reference< css::graphic::XGraphic > SAL_CALL VLCFrameGrabber::grabFrame( double fMediaTime ) +{ +} + +::rtl::OUString SAL_CALL VLCFrameGrabber::getImplementationName() +{ + return AVMEDIA_VLC_GRABBER_IMPLEMENTATIONNAME; +} + +::sal_Bool SAL_CALL VLCFrameGrabber::supportsService( const ::rtl::OUString& serviceName ) +{ + return AVMEDIA_VLC_GRABBER_SERVICENAME == serviceName; +} + +::uno::Sequence< ::rtl::OUString > SAL_CALL VLCFrameGrabber::getSupportedServiceNames() +{ + ::uno::Sequence< OUString > aRet(1); + aRet[0] = AVMEDIA_VLC_GRABBER_SERVICENAME; + return aRet; +} + +} +} \ No newline at end of file diff --git a/avmedia/source/vlc/vlcframegrabber.hxx b/avmedia/source/vlc/vlcframegrabber.hxx new file mode 100644 index 000000000000..0e88d5dca198 --- /dev/null +++ b/avmedia/source/vlc/vlcframegrabber.hxx @@ -0,0 +1,48 @@ +/* -*- 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 _VLCFRAMEGRABBER_HXX +#define _VLCFRAMEGRABBER_HXX + +#include "vlccommon.hxx" +#include +#include + +namespace avmedia { +namespace vlc { + +typedef ::cppu::WeakImplHelper2< ::com::sun::star::media::XFrameGrabber, + ::com::sun::star::lang::XServiceInfo > FrameGrabber_BASE; + +class VLCFrameGrabber : public FrameGrabber_BASE +{ +public: + SAL_CALL VLCFrameGrabber(); + + ::com::sun::star::uno::Reference< css::graphic::XGraphic > SAL_CALL grabFrame( double fMediaTime ); + + ::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 // _VLCFRAMEGRABBER_HXX \ No newline at end of file diff --git a/avmedia/source/vlc/vlcplayer.cxx b/avmedia/source/vlc/vlcplayer.cxx index 647ec67dbb27..fb1ad0135d1e 100644 --- a/avmedia/source/vlc/vlcplayer.cxx +++ b/avmedia/source/vlc/vlcplayer.cxx @@ -1,11 +1,15 @@ #include "vlcplayer.hxx" #include "vlcwindow.hxx" +#include "vlcframegrabber.hxx" using namespace ::com::sun::star; namespace avmedia { namespace vlc { +const ::rtl::OUString AVMEDIA_VLC_PLAYER_IMPLEMENTATIONNAME = "com.sun.star.comp.avmedia.Player_VLC"; +const ::rtl::OUString AVMEDIA_VLC_PLAYER_SERVICENAME = "com.sun.star.media.Player_VLC"; + const char * const VLC_ARGS[] = { "-I", "dummy", @@ -105,28 +109,30 @@ css::awt::Size SAL_CALL VLCPlayer::getPreferredPlayerWindowSize() uno::Reference< css::media::XPlayerWindow > SAL_CALL VLCPlayer::createPlayerWindow( const uno::Sequence< uno::Any >& aArguments ) { ::osl::MutexGuard aGuard(m_aMutex); - return uno::Reference< css::media::XPlayerWindow >(new VLCWindow()); + return uno::Reference< css::media::XPlayerWindow >(new VLCWindow( *this )); } uno::Reference< css::media::XFrameGrabber > SAL_CALL VLCPlayer::createFrameGrabber() { ::osl::MutexGuard aGuard(m_aMutex); - return uno::Reference< css::media::XFrameGrabber >(); + return uno::Reference< css::media::XFrameGrabber >(new VLCFrameGrabber()); } ::rtl::OUString SAL_CALL VLCPlayer::getImplementationName() { - return ::rtl::OUString(); + return AVMEDIA_VLC_PLAYER_IMPLEMENTATIONNAME; } -::sal_Bool SAL_CALL VLCPlayer::supportsService( const ::rtl::OUString& ServiceName ) +::sal_Bool SAL_CALL VLCPlayer::supportsService( const ::rtl::OUString& serviceName ) { - return false; + return serviceName == AVMEDIA_VLC_PLAYER_SERVICENAME; } ::uno::Sequence< ::rtl::OUString > SAL_CALL VLCPlayer::getSupportedServiceNames() { - return ::uno::Sequence< ::rtl::OUString >(); + uno::Sequence< OUString > aRet(1); + aRet[0] = AVMEDIA_VLC_PLAYER_SERVICENAME; + return aRet; } } diff --git a/avmedia/source/vlc/vlcplayer.hxx b/avmedia/source/vlc/vlcplayer.hxx index da1673a96eb9..d1e551154f93 100644 --- a/avmedia/source/vlc/vlcplayer.hxx +++ b/avmedia/source/vlc/vlcplayer.hxx @@ -60,7 +60,7 @@ public: ::com::sun::star::uno::Reference< css::media::XFrameGrabber > SAL_CALL createFrameGrabber(); ::rtl::OUString SAL_CALL getImplementationName(); - ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ); + ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& serviceName ); ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(); }; diff --git a/avmedia/source/vlc/vlcwindow.cxx b/avmedia/source/vlc/vlcwindow.cxx index 67501faa0c2c..19f3791ceac5 100644 --- a/avmedia/source/vlc/vlcwindow.cxx +++ b/avmedia/source/vlc/vlcwindow.cxx @@ -5,6 +5,14 @@ using namespace ::com::sun::star; namespace avmedia { namespace vlc { +const ::rtl::OUString AVMEDIA_VLC_WINDOW_IMPLEMENTATIONNAME = "com.sun.star.comp.avmedia.Window_VLC"; +const ::rtl::OUString AVMEDIA_VLC_WINDOW_SERVICENAME = "com.sun.star.media.Window_VLC"; + +SAL_CALL VLCWindow::VLCWindow(VLCPlayer& player) + : mPlayer( player ) +{ +} + void SAL_CALL VLCWindow::update() { } @@ -25,96 +33,117 @@ void SAL_CALL VLCWindow::setPointerType( ::sal_Int32 SystemPointerType ) ::rtl::OUString SAL_CALL VLCWindow::getImplementationName() { - return ::rtl::OUString(); + return AVMEDIA_VLC_WINDOW_IMPLEMENTATIONNAME; } -::sal_Bool SAL_CALL VLCWindow::supportsService( const ::rtl::OUString& ServiceName ) +::sal_Bool SAL_CALL VLCWindow::supportsService( const ::rtl::OUString& serviceName ) { - return false; + return serviceName == AVMEDIA_VLC_WINDOW_SERVICENAME; } uno::Sequence< ::rtl::OUString > SAL_CALL VLCWindow::getSupportedServiceNames() { - return uno::Sequence< ::rtl::OUString >(); + uno::Sequence< OUString > aRet(1); + aRet[0] = AVMEDIA_VLC_WINDOW_SERVICENAME; + return aRet; } void SAL_CALL VLCWindow::dispose() throw (uno::RuntimeException) { } -void SAL_CALL VLCWindow::addEventListener( const uno::Reference< lang::XEventListener >& xListener ) throw (uno::RuntimeException) +void SAL_CALL VLCWindow::addEventListener( const uno::Reference< lang::XEventListener >& xListener ) + throw (uno::RuntimeException) { } -void SAL_CALL VLCWindow::removeEventListener( const uno::Reference< lang::XEventListener >& xListener ) throw (uno::RuntimeException) +void SAL_CALL VLCWindow::removeEventListener( const uno::Reference< lang::XEventListener >& xListener ) + throw (uno::RuntimeException) { } -void SAL_CALL VLCWindow::setPosSize( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, sal_Int16 Flags ) throw (uno::RuntimeException) +void SAL_CALL VLCWindow::setPosSize( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, sal_Int16 Flags ) + throw (uno::RuntimeException) { } -awt::Rectangle SAL_CALL VLCWindow::getPosSize() throw (uno::RuntimeException) +awt::Rectangle SAL_CALL VLCWindow::getPosSize() + throw (uno::RuntimeException) { } -void SAL_CALL VLCWindow::setVisible( sal_Bool Visible ) throw (uno::RuntimeException) +void SAL_CALL VLCWindow::setVisible( sal_Bool Visible ) + throw (uno::RuntimeException) { } -void SAL_CALL VLCWindow::setEnable( sal_Bool Enable ) throw (uno::RuntimeException) +void SAL_CALL VLCWindow::setEnable( sal_Bool Enable ) + throw (uno::RuntimeException) { } -void SAL_CALL VLCWindow::setFocus() throw (uno::RuntimeException) +void SAL_CALL VLCWindow::setFocus() + throw (uno::RuntimeException) { } -void SAL_CALL VLCWindow::addWindowListener( const uno::Reference< awt::XWindowListener >& xListener ) throw (uno::RuntimeException) +void SAL_CALL VLCWindow::addWindowListener( const uno::Reference< awt::XWindowListener >& xListener ) + throw (uno::RuntimeException) { } -void SAL_CALL VLCWindow::removeWindowListener( const uno::Reference< awt::XWindowListener >& xListener ) throw (uno::RuntimeException) +void SAL_CALL VLCWindow::removeWindowListener( const uno::Reference< awt::XWindowListener >& xListener ) + throw (uno::RuntimeException) { } -void SAL_CALL VLCWindow::addFocusListener( const uno::Reference< awt::XFocusListener >& xListener ) throw (uno::RuntimeException) +void SAL_CALL VLCWindow::addFocusListener( const uno::Reference< awt::XFocusListener >& xListener ) + throw (uno::RuntimeException) { } -void SAL_CALL VLCWindow::removeFocusListener( const uno::Reference< awt::XFocusListener >& xListener ) throw (uno::RuntimeException) +void SAL_CALL VLCWindow::removeFocusListener( const uno::Reference< awt::XFocusListener >& xListener ) + throw (uno::RuntimeException) { } -void SAL_CALL VLCWindow::addKeyListener( const uno::Reference< awt::XKeyListener >& xListener ) throw (uno::RuntimeException) +void SAL_CALL VLCWindow::addKeyListener( const uno::Reference< awt::XKeyListener >& xListener ) + throw (uno::RuntimeException) { } -void SAL_CALL VLCWindow::removeKeyListener( const uno::Reference< awt::XKeyListener >& xListener ) throw (uno::RuntimeException) +void SAL_CALL VLCWindow::removeKeyListener( const uno::Reference< awt::XKeyListener >& xListener ) + throw (uno::RuntimeException) { } -void SAL_CALL VLCWindow::addMouseListener( const uno::Reference< awt::XMouseListener >& xListener ) throw (uno::RuntimeException) +void SAL_CALL VLCWindow::addMouseListener( const uno::Reference< awt::XMouseListener >& xListener ) + throw (uno::RuntimeException) { } -void SAL_CALL VLCWindow::removeMouseListener( const uno::Reference< awt::XMouseListener >& xListener ) throw (uno::RuntimeException) +void SAL_CALL VLCWindow::removeMouseListener( const uno::Reference< awt::XMouseListener >& xListener ) + throw (uno::RuntimeException) { } -void SAL_CALL VLCWindow::addMouseMotionListener( const uno::Reference< awt::XMouseMotionListener >& xListener ) throw (uno::RuntimeException) +void SAL_CALL VLCWindow::addMouseMotionListener( const uno::Reference< awt::XMouseMotionListener >& xListener ) + throw (uno::RuntimeException) { } -void SAL_CALL VLCWindow::removeMouseMotionListener( const uno::Reference< awt::XMouseMotionListener >& xListener ) throw (uno::RuntimeException) +void SAL_CALL VLCWindow::removeMouseMotionListener( const uno::Reference< awt::XMouseMotionListener >& xListener ) + throw (uno::RuntimeException) { } -void SAL_CALL VLCWindow::addPaintListener( const uno::Reference< awt::XPaintListener >& xListener ) throw (uno::RuntimeException) +void SAL_CALL VLCWindow::addPaintListener( const uno::Reference< awt::XPaintListener >& xListener ) + throw (uno::RuntimeException) { } -void SAL_CALL VLCWindow::removePaintListener( const uno::Reference< awt::XPaintListener >& xListener ) throw (uno::RuntimeException) +void SAL_CALL VLCWindow::removePaintListener( const uno::Reference< awt::XPaintListener >& xListener ) + throw (uno::RuntimeException) { } diff --git a/avmedia/source/vlc/vlcwindow.hxx b/avmedia/source/vlc/vlcwindow.hxx index 7b055352e9a0..3449e2c0210a 100644 --- a/avmedia/source/vlc/vlcwindow.hxx +++ b/avmedia/source/vlc/vlcwindow.hxx @@ -23,18 +23,21 @@ namespace avmedia { namespace vlc { +class VLCPlayer; class VLCWindow : public ::cppu::WeakImplHelper2 < ::com::sun::star::media::XPlayerWindow, ::com::sun::star::lang::XServiceInfo > { + VLCPlayer& mPlayer; public: + SAL_CALL VLCWindow(VLCPlayer& player); 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 ); + ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& serviceName ); ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(); void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException); -- cgit v1.2.3