diff options
author | Minh Ngo <nlminhtl@gmail.com> | 2013-09-15 19:41:54 +0300 |
---|---|---|
committer | Minh Ngo <nlminhtl@gmail.com> | 2013-09-15 19:42:29 +0300 |
commit | fdd3f483ccafd23603252e133d643141bc17ce65 (patch) | |
tree | 7d63a58e5891595f038b6a50662395e2a0475508 /avmedia/source/vlc | |
parent | e62092da17170faa93b61a3a2d7a7ce4b29cc1fc (diff) |
Avmedia/VLC: Zooming 1:2, 2:1, 1:1
Doesn't work nice yet :)
Change-Id: I0fbdaea1cc64a94a9b63975b8b24c8d7e6251f6f
Diffstat (limited to 'avmedia/source/vlc')
-rw-r--r-- | avmedia/source/vlc/vlcplayer.cxx | 16 | ||||
-rw-r--r-- | avmedia/source/vlc/vlcplayer.hxx | 4 | ||||
-rw-r--r-- | avmedia/source/vlc/vlcwindow.cxx | 21 | ||||
-rw-r--r-- | avmedia/source/vlc/wrapper/Player.cxx | 28 | ||||
-rw-r--r-- | avmedia/source/vlc/wrapper/Player.hxx | 5 |
5 files changed, 69 insertions, 5 deletions
diff --git a/avmedia/source/vlc/vlcplayer.cxx b/avmedia/source/vlc/vlcplayer.cxx index cdabc30b5eeb..4a454d8f33ae 100644 --- a/avmedia/source/vlc/vlcplayer.cxx +++ b/avmedia/source/vlc/vlcplayer.cxx @@ -37,6 +37,16 @@ VLCPlayer::VLCPlayer( const rtl::OUString& url, mPlayer.setMouseHandling( false ); } +unsigned VLCPlayer::getWidth() const +{ + return mPlayer.getWidth(); +} + +unsigned VLCPlayer::getHeight() const +{ + return mPlayer.getHeight(); +} + void SAL_CALL VLCPlayer::start() throw ( ::com::sun::star::uno::RuntimeException ) { ::osl::MutexGuard aGuard(m_aMutex); @@ -61,6 +71,12 @@ double SAL_CALL VLCPlayer::getDuration() throw ( ::com::sun::star::uno::RuntimeE return static_cast<double>( mMedia.getDuration() ) / MS_IN_SEC; } +void SAL_CALL VLCPlayer::setScale( float factor ) +{ + ::osl::MutexGuard aGuard(m_aMutex); + mPlayer.setScale( factor ); +} + void SAL_CALL VLCPlayer::setMediaTime( double fTime ) throw ( ::com::sun::star::uno::RuntimeException ) { ::osl::MutexGuard aGuard(m_aMutex); diff --git a/avmedia/source/vlc/vlcplayer.hxx b/avmedia/source/vlc/vlcplayer.hxx index bb37f8ae5215..cbc009ca15f6 100644 --- a/avmedia/source/vlc/vlcplayer.hxx +++ b/avmedia/source/vlc/vlcplayer.hxx @@ -57,6 +57,10 @@ public: wrapper::Instance& instance, wrapper::EventHandler& eh ); + unsigned getWidth() const; + unsigned getHeight() const; + + void SAL_CALL setScale( float factor ); void SAL_CALL setWindowID( const intptr_t windowID ); void SAL_CALL start() throw ( ::com::sun::star::uno::RuntimeException ); diff --git a/avmedia/source/vlc/vlcwindow.cxx b/avmedia/source/vlc/vlcwindow.cxx index aab1ea8c5e48..073fc225a2e6 100644 --- a/avmedia/source/vlc/vlcwindow.cxx +++ b/avmedia/source/vlc/vlcwindow.cxx @@ -41,6 +41,21 @@ void SAL_CALL VLCWindow::update() throw (css::uno::RuntimeException) meZoomLevel = eZoomLevel; } + switch ( static_cast<int>( eZoomLevel ) ) + { + case media::ZoomLevel_ORIGINAL: + mPlayer.setScale( 1.0 ); + break; + case media::ZoomLevel_FIT_TO_WINDOW: + break; + case media::ZoomLevel_ZOOM_1_TO_2: + mPlayer.setScale( 0.5 ); + break; + case media::ZoomLevel_ZOOM_2_TO_1: + mPlayer.setScale( 2.0 ); + break; + } + bRet = true; } @@ -87,7 +102,7 @@ void SAL_CALL VLCWindow::removeEventListener( const uno::Reference< lang::XEvent { } -void SAL_CALL VLCWindow::setPosSize( sal_Int32, sal_Int32, sal_Int32, sal_Int32, sal_Int16 ) +void SAL_CALL VLCWindow::setPosSize( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, sal_Int16 Flags ) throw (uno::RuntimeException) { } @@ -98,8 +113,8 @@ awt::Rectangle SAL_CALL VLCWindow::getPosSize() awt::Rectangle aRet; aRet.X = aRet.Y = 0; - aRet.Width = 320; - aRet.Height = 240; + aRet.Width = mPlayer.getWidth(); + aRet.Height = mPlayer.getHeight(); return aRet; } diff --git a/avmedia/source/vlc/wrapper/Player.cxx b/avmedia/source/vlc/wrapper/Player.cxx index e5d4f64d7bec..0b56e9201bba 100644 --- a/avmedia/source/vlc/wrapper/Player.cxx +++ b/avmedia/source/vlc/wrapper/Player.cxx @@ -46,7 +46,10 @@ namespace #error unknown OS #endif unsigned ( *libvlc_media_player_has_vout ) ( libvlc_media_player_t *p_mi ); - void ( *libvlc_video_set_mouse_input ) ( libvlc_media_player_t *p_mi, unsigned on); + void ( *libvlc_video_set_mouse_input ) ( libvlc_media_player_t *p_mi, unsigned on ); + void ( *libvlc_video_set_scale ) ( libvlc_media_player_t *p_mi, float f_factor ); + int ( *libvlc_video_get_size ) ( libvlc_media_player_t *p_mi, unsigned num, + unsigned *px, unsigned *py ); } namespace avmedia @@ -82,7 +85,9 @@ namespace wrapper #endif SYM_MAP( libvlc_media_player_has_vout ), SYM_MAP( libvlc_video_set_mouse_input ), - SYM_MAP( libvlc_media_player_retain ) + SYM_MAP( libvlc_media_player_retain ), + SYM_MAP( libvlc_video_set_scale ), + SYM_MAP( libvlc_video_get_size ) }; return InitApiMap( VLC_PLAYER_API ); @@ -138,6 +143,25 @@ namespace wrapper return ( time == -1 ? 0 : time ); } + void Player::setScale( float factor ) + { + libvlc_video_set_scale( mPlayer, factor ); + } + + unsigned Player::getWidth() const + { + unsigned width, height; + libvlc_video_get_size( mPlayer, 0, &width, &height ); + return width; + } + + unsigned Player::getHeight() const + { + unsigned width, height; + libvlc_video_get_size( mPlayer, 0, &width, &height ); + return height; + } + void Player::setMouseHandling(bool flag) { libvlc_video_set_mouse_input( mPlayer, flag ); diff --git a/avmedia/source/vlc/wrapper/Player.hxx b/avmedia/source/vlc/wrapper/Player.hxx index fa387cbc1e83..7aa8147978ac 100644 --- a/avmedia/source/vlc/wrapper/Player.hxx +++ b/avmedia/source/vlc/wrapper/Player.hxx @@ -57,6 +57,11 @@ namespace wrapper bool hasVout() const; + void setScale( float factor ); + + unsigned getWidth() const; + unsigned getHeight() const; + inline operator libvlc_media_player_t*() { return mPlayer; |