summaryrefslogtreecommitdiff
path: root/avmedia
diff options
context:
space:
mode:
authorMinh Ngo <nlminhtl@gmail.com>2013-09-20 00:54:21 +0300
committerMinh Ngo <nlminhtl@gmail.com>2013-09-20 00:56:13 +0300
commitf22464dfb133936668173befb157394eaff2d142 (patch)
tree792e2e92d62cad714b1cf66db83d72b2fd2fba3b /avmedia
parent15924193558ae7f0e04d5bb1ea8ab94517c5a9ce (diff)
Avmedia/VLC: Fixing zooming.
Will resize depended on the frame size now. Change-Id: I3dbd0982f4442e9c643121af3cdfc2b0cdfe33a2
Diffstat (limited to 'avmedia')
-rw-r--r--avmedia/source/vlc/vlcplayer.cxx6
-rw-r--r--avmedia/source/vlc/vlcplayer.hxx1
-rw-r--r--avmedia/source/vlc/vlcwindow.cxx9
-rw-r--r--avmedia/source/vlc/wrapper/Player.cxx7
-rw-r--r--avmedia/source/vlc/wrapper/Player.hxx1
5 files changed, 19 insertions, 5 deletions
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<int>( 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, &currentWidth, &currentHeight );
+ if ( currentWidth != 0 )
+ setScale( static_cast<float>( 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;