1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef _PLAYER_HXX 25 #define _PLAYER_HXX 26 27 #include "wincommon.hxx" 28 29 #include "com/sun/star/media/XPlayer.hdl" 30 31 #include <cppuhelper/compbase2.hxx> 32 #include <cppuhelper/basemutex.hxx> 33 34 struct IGraphBuilder; 35 struct IBaseFilter; 36 struct IMediaControl; 37 struct IMediaEventEx; 38 struct IMediaSeeking; 39 struct IMediaPosition; 40 struct IBasicAudio; 41 struct IBasicVideo; 42 struct IVideoWindow; 43 struct IDDrawExclModeVideo; 44 struct IDirectDraw; 45 struct IDirectDrawSurface; 46 47 namespace avmedia { namespace win { 48 49 // ---------- 50 // - Player - 51 // ---------- 52 typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::media::XPlayer, 53 ::com::sun::star::lang::XServiceInfo > Player_BASE; 54 55 class Player : public cppu::BaseMutex, 56 public Player_BASE 57 { 58 public: 59 60 Player( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxMgr ); 61 ~Player(); 62 63 bool create( const ::rtl::OUString& rURL ); 64 65 void setNotifyWnd( int nNotifyWnd ); 66 void setDDrawParams( IDirectDraw* pDDraw, IDirectDrawSurface* pDDrawSurface ); 67 long processEvent(); 68 69 const IVideoWindow* getVideoWindow() const; 70 71 // XPlayer 72 virtual void SAL_CALL start( ) throw (::com::sun::star::uno::RuntimeException); 73 virtual void SAL_CALL stop( ) throw (::com::sun::star::uno::RuntimeException); 74 virtual sal_Bool SAL_CALL isPlaying( ) throw (::com::sun::star::uno::RuntimeException); 75 virtual double SAL_CALL getDuration( ) throw (::com::sun::star::uno::RuntimeException); 76 virtual void SAL_CALL setMediaTime( double fTime ) throw (::com::sun::star::uno::RuntimeException); 77 virtual double SAL_CALL getMediaTime( ) throw (::com::sun::star::uno::RuntimeException); 78 virtual void SAL_CALL setStopTime( double fTime ) throw (::com::sun::star::uno::RuntimeException); 79 virtual double SAL_CALL getStopTime( ) throw (::com::sun::star::uno::RuntimeException); 80 virtual void SAL_CALL setRate( double fRate ) throw (::com::sun::star::uno::RuntimeException); 81 virtual double SAL_CALL getRate( ) throw (::com::sun::star::uno::RuntimeException); 82 virtual void SAL_CALL setPlaybackLoop( sal_Bool bSet ) throw (::com::sun::star::uno::RuntimeException); 83 virtual sal_Bool SAL_CALL isPlaybackLoop( ) throw (::com::sun::star::uno::RuntimeException); 84 virtual void SAL_CALL setMute( sal_Bool bSet ) throw (::com::sun::star::uno::RuntimeException); 85 virtual sal_Bool SAL_CALL isMute( ) throw (::com::sun::star::uno::RuntimeException); 86 virtual void SAL_CALL setVolumeDB( sal_Int16 nVolumeDB ) throw (::com::sun::star::uno::RuntimeException); 87 virtual sal_Int16 SAL_CALL getVolumeDB( ) throw (::com::sun::star::uno::RuntimeException); 88 virtual ::com::sun::star::awt::Size SAL_CALL getPreferredPlayerWindowSize( ) throw (::com::sun::star::uno::RuntimeException); 89 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); 90 virtual ::com::sun::star::uno::Reference< ::com::sun::star::media::XFrameGrabber > SAL_CALL createFrameGrabber( ) throw (::com::sun::star::uno::RuntimeException); 91 92 // XServiceInfo 93 virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); 94 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); 95 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException); 96 97 // ::cppu::OComponentHelper 98 virtual void SAL_CALL disposing(void); 99 100 private: 101 102 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMgr; 103 104 ::rtl::OUString maURL; 105 IGraphBuilder* mpGB; 106 IBaseFilter* mpOMF; 107 IMediaControl* mpMC; 108 IMediaEventEx* mpME; 109 IMediaSeeking* mpMS; 110 IMediaPosition* mpMP; 111 IBasicAudio* mpBA; 112 IBasicVideo* mpBV; 113 IVideoWindow* mpVW; 114 IDDrawExclModeVideo* mpEV; 115 long mnUnmutedVolume; 116 int mnFrameWnd; 117 118 sal_Bool mbMuted; 119 sal_Bool mbLooping; 120 sal_Bool mbAddWindow; 121 122 void ImplLayoutVideoWindow(); 123 }; 124 125 } // namespace win 126 } // namespace avmedia 127 128 #endif // _PLAYER_HXX 129