LCOV - code coverage report
Current view: top level - avmedia/source/framework - soundhandler.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 1 5 20.0 %
Date: 2015-06-13 12:38:46 Functions: 2 4 50.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_AVMEDIA_SOURCE_FRAMEWORK_SOUNDHANDLER_HXX
      21             : #define INCLUDED_AVMEDIA_SOURCE_FRAMEWORK_SOUNDHANDLER_HXX
      22             : 
      23             : #include <com/sun/star/lang/XTypeProvider.hpp>
      24             : #include <com/sun/star/frame/XNotifyingDispatch.hpp>
      25             : #include <com/sun/star/frame/XStatusListener.hpp>
      26             : #include <com/sun/star/frame/XFrame.hpp>
      27             : #include <com/sun/star/document/XExtendedFilterDetection.hpp>
      28             : #include <com/sun/star/media/XPlayer.hpp>
      29             : #include <com/sun/star/beans/PropertyValue.hpp>
      30             : #include <com/sun/star/util/URL.hpp>
      31             : 
      32             : #include <com/sun/star/lang/XServiceInfo.hpp>
      33             : #include <com/sun/star/lang/XSingleServiceFactory.hpp>
      34             : 
      35             : #include <cppuhelper/weak.hxx>
      36             : 
      37             : #include <vcl/timer.hxx>
      38             : #include <vcl/idle.hxx>
      39             : #include <tools/link.hxx>
      40             : #include <avmedia/mediawindow.hxx>
      41             : #include <osl/mutex.hxx>
      42             : 
      43             : namespace avmedia{
      44             : 
      45           4 : struct ThreadHelpBase
      46             : {
      47             :     public:
      48             :         mutable ::osl::Mutex m_aLock;
      49             : };
      50             : 
      51             : /*-************************************************************************************************************
      52             :     @short          handler to detect and play sounds ("wav" and "au" only!)
      53             :     @descr          Register this implementation as a content handler to detect and/or play wav- and au-sounds.
      54             :                     It doesn't depend from the target platform. But one instance of this class
      55             :                     can play one sound at the same time only. Means every new dispatch request will stop the
      56             :                     might still running one. So we support one operation/one URL/one listener at the same time
      57             :                     only.
      58             : 
      59             :     @devstatus      ready
      60             :     @threadsafe     yes
      61             : *//*-*************************************************************************************************************/
      62             : class SoundHandler  :   // interfaces
      63             :                         public  css::lang::XTypeProvider
      64             :                     ,   public  css::lang::XServiceInfo
      65             :                     ,   public  css::frame::XNotifyingDispatch // => XDispatch
      66             :                     ,   public  css::document::XExtendedFilterDetection
      67             :                         // baseclasses
      68             :                         // Order is necessary for right initialization!
      69             :                     ,   private ThreadHelpBase
      70             :                     ,   public  ::cppu::OWeakObject
      71             : {
      72             :     // public methods
      73             :     public:
      74             : 
      75             :         // constructor / destructor
      76             :                  SoundHandler();
      77             :         virtual ~SoundHandler(                                                                        );
      78             : 
      79             :         //  XInterface, XTypeProvider, XServiceInfo
      80             :         virtual css::uno::Any  SAL_CALL queryInterface( const css::uno::Type& aType   ) throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
      81             :         virtual void SAL_CALL acquire() throw() SAL_OVERRIDE;
      82             :         virtual void SAL_CALL release() throw() SAL_OVERRIDE;
      83             :         virtual css::uno::Sequence< css::uno::Type >  SAL_CALL getTypes () throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
      84             :         virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
      85             : 
      86             :     /* interface XServiceInfo */
      87             :        virtual OUString                                               SAL_CALL getImplementationName              (                                                                               ) throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
      88             :        virtual sal_Bool                                               SAL_CALL supportsService                    ( const OUString&                                               sServiceName    ) throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
      89             :        virtual css::uno::Sequence< OUString >                         SAL_CALL getSupportedServiceNames           (                                                                               ) throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
      90             : 
      91             :         //  XNotifyingDispatch
      92             :         virtual void SAL_CALL dispatchWithNotification(const css::util::URL&                                             aURL      ,
      93             :                                                        const css::uno::Sequence< css::beans::PropertyValue >&            lArguments,
      94             :                                                        const css::uno::Reference< css::frame::XDispatchResultListener >& xListener ) throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      95             : 
      96             :         //  XDispatch
      97             :         virtual void SAL_CALL dispatch              (   const   css::util::URL&                                     aURL        ,
      98             :                                                         const   css::uno::Sequence< css::beans::PropertyValue >&    lArguments  ) throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
      99             :         // not supported !
     100           0 :         virtual void SAL_CALL addStatusListener     (   const   css::uno::Reference< css::frame::XStatusListener >& /*xListener*/   ,
     101           0 :                                                         const   css::util::URL&                                     /*aURL*/        ) throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE {};
     102           0 :         virtual void SAL_CALL removeStatusListener  (   const   css::uno::Reference< css::frame::XStatusListener >& /*xListener*/   ,
     103           0 :                                                         const   css::util::URL&                                     /*aURL*/        ) throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE {};
     104             : 
     105             :         //  XExtendedFilterDetection
     106             :         virtual OUString SAL_CALL detect           (           css::uno::Sequence< css::beans::PropertyValue >&    lDescriptor ) throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     107             : 
     108             :     //  protected methods
     109             :     protected:
     110             : 
     111             :     //  private methods
     112             :     private:
     113             :         DECL_LINK_TYPED( implts_PlayerNotify, Idle*, void );
     114             : 
     115             :     //  variables
     116             :     //  (should be private everyway!)
     117             :     private:
     118             : 
     119             :         bool m_bError;
     120             :         css::uno::Reference< css::uno::XInterface >                m_xSelfHold         ;   // we must protect us against dying during async(!) dispatch() call!
     121             :         css::uno::Reference< css::media::XPlayer >                 m_xPlayer           ;   // uses avmedia player to play sounds...
     122             : 
     123             :         css::uno::Reference< css::frame::XDispatchResultListener > m_xListener         ;
     124             :         Idle m_aUpdateIdle;
     125             : 
     126             : };      //  class SoundHandler
     127             : 
     128             : }       //  namespace avmedia
     129             : 
     130             : #endif // INCLUDED_AVMEDIA_SOURCE_FRAMEWORK_SOUNDHANDLER_HXX
     131             : 
     132             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11