From f22464dfb133936668173befb157394eaff2d142 Mon Sep 17 00:00:00 2001 From: Minh Ngo Date: Fri, 20 Sep 2013 00:54:21 +0300 Subject: Avmedia/VLC: Fixing zooming. Will resize depended on the frame size now. Change-Id: I3dbd0982f4442e9c643121af3cdfc2b0cdfe33a2 --- avmedia/source/vlc/vlcplayer.cxx | 6 ++++++ avmedia/source/vlc/vlcplayer.hxx | 1 + avmedia/source/vlc/vlcwindow.cxx | 9 ++++----- avmedia/source/vlc/wrapper/Player.cxx | 7 +++++++ avmedia/source/vlc/wrapper/Player.hxx | 1 + 5 files changed, 19 insertions(+), 5 deletions(-) (limited to 'avmedia/source/vlc') diff --git a/avmedia/source/vlc/vlcplayer.cxx b/avmedia/source/vlc/vlcplayer.cxx index 4a454d8f33ae..be863335bd98 100644 --- a/avmedia/source/vlc/vlcplayer.cxx +++ b/avmedia/source/vlc/vlcplayer.cxx @@ -194,6 +194,12 @@ void SAL_CALL VLCPlayer::setWindowID( const intptr_t windowID ) mPlayer.setWindow( windowID ); } +void VLCPlayer::setVideoSize( unsigned width, unsigned height ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + mPlayer.setVideoSize( width, height ); +} + uno::Reference< css::media::XPlayerWindow > SAL_CALL VLCPlayer::createPlayerWindow( const uno::Sequence< uno::Any >& aArguments ) throw ( ::com::sun::star::uno::RuntimeException ) { diff --git a/avmedia/source/vlc/vlcplayer.hxx b/avmedia/source/vlc/vlcplayer.hxx index cbc009ca15f6..94c9751599ac 100644 --- a/avmedia/source/vlc/vlcplayer.hxx +++ b/avmedia/source/vlc/vlcplayer.hxx @@ -57,6 +57,7 @@ public: wrapper::Instance& instance, wrapper::EventHandler& eh ); + void setVideoSize( unsigned width, unsigned height ); unsigned getWidth() const; unsigned getHeight() const; diff --git a/avmedia/source/vlc/vlcwindow.cxx b/avmedia/source/vlc/vlcwindow.cxx index d00db28024cc..cded4db20ed3 100644 --- a/avmedia/source/vlc/vlcwindow.cxx +++ b/avmedia/source/vlc/vlcwindow.cxx @@ -44,15 +44,14 @@ void SAL_CALL VLCWindow::update() throw (css::uno::RuntimeException) switch ( static_cast( eZoomLevel ) ) { case media::ZoomLevel_ORIGINAL: - mPlayer.setScale( 1.0 ); - break; - case media::ZoomLevel_FIT_TO_WINDOW: + case media::ZoomLevel_FIT_TO_WINDOW_FIXED_ASPECT: + mPlayer.setVideoSize( mSize.Width, mSize.Height ); break; case media::ZoomLevel_ZOOM_1_TO_2: - mPlayer.setScale( 0.5 ); + mPlayer.setVideoSize( mSize.Width / 2, mSize.Height / 2 ); break; case media::ZoomLevel_ZOOM_2_TO_1: - mPlayer.setScale( 2.0 ); + mPlayer.setVideoSize( mSize.Width * 2, mSize.Height * 2 ); break; } diff --git a/avmedia/source/vlc/wrapper/Player.cxx b/avmedia/source/vlc/wrapper/Player.cxx index 08e37d512763..92348e28760b 100644 --- a/avmedia/source/vlc/wrapper/Player.cxx +++ b/avmedia/source/vlc/wrapper/Player.cxx @@ -197,6 +197,13 @@ namespace wrapper return libvlc_audio_get_mute( mPlayer ); } + void Player::setVideoSize( unsigned width, unsigned ) + { + unsigned currentWidth, currentHeight; + libvlc_video_get_size( mPlayer, 0, ¤tWidth, ¤tHeight ); + if ( currentWidth != 0 ) + setScale( static_cast( width ) / currentWidth ); + } void Player::setWindow( intptr_t id ) { diff --git a/avmedia/source/vlc/wrapper/Player.hxx b/avmedia/source/vlc/wrapper/Player.hxx index 7aa8147978ac..05101977ef03 100644 --- a/avmedia/source/vlc/wrapper/Player.hxx +++ b/avmedia/source/vlc/wrapper/Player.hxx @@ -58,6 +58,7 @@ namespace wrapper bool hasVout() const; void setScale( float factor ); + void setVideoSize( unsigned width, unsigned height ); unsigned getWidth() const; unsigned getHeight() const; -- cgit