Kaydet (Commit) f22464df authored tarafından Minh Ngo's avatar Minh Ngo

Avmedia/VLC: Fixing zooming.

Will resize depended on the frame size now.

Change-Id: I3dbd0982f4442e9c643121af3cdfc2b0cdfe33a2
üst 15924193
...@@ -194,6 +194,12 @@ void SAL_CALL VLCPlayer::setWindowID( const intptr_t windowID ) ...@@ -194,6 +194,12 @@ void SAL_CALL VLCPlayer::setWindowID( const intptr_t windowID )
mPlayer.setWindow( 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 ) uno::Reference< css::media::XPlayerWindow > SAL_CALL VLCPlayer::createPlayerWindow( const uno::Sequence< uno::Any >& aArguments )
throw ( ::com::sun::star::uno::RuntimeException ) throw ( ::com::sun::star::uno::RuntimeException )
{ {
......
...@@ -57,6 +57,7 @@ public: ...@@ -57,6 +57,7 @@ public:
wrapper::Instance& instance, wrapper::Instance& instance,
wrapper::EventHandler& eh ); wrapper::EventHandler& eh );
void setVideoSize( unsigned width, unsigned height );
unsigned getWidth() const; unsigned getWidth() const;
unsigned getHeight() const; unsigned getHeight() const;
......
...@@ -44,15 +44,14 @@ void SAL_CALL VLCWindow::update() throw (css::uno::RuntimeException) ...@@ -44,15 +44,14 @@ void SAL_CALL VLCWindow::update() throw (css::uno::RuntimeException)
switch ( static_cast<int>( eZoomLevel ) ) switch ( static_cast<int>( eZoomLevel ) )
{ {
case media::ZoomLevel_ORIGINAL: case media::ZoomLevel_ORIGINAL:
mPlayer.setScale( 1.0 ); case media::ZoomLevel_FIT_TO_WINDOW_FIXED_ASPECT:
break; mPlayer.setVideoSize( mSize.Width, mSize.Height );
case media::ZoomLevel_FIT_TO_WINDOW:
break; break;
case media::ZoomLevel_ZOOM_1_TO_2: case media::ZoomLevel_ZOOM_1_TO_2:
mPlayer.setScale( 0.5 ); mPlayer.setVideoSize( mSize.Width / 2, mSize.Height / 2 );
break; break;
case media::ZoomLevel_ZOOM_2_TO_1: case media::ZoomLevel_ZOOM_2_TO_1:
mPlayer.setScale( 2.0 ); mPlayer.setVideoSize( mSize.Width * 2, mSize.Height * 2 );
break; break;
} }
......
...@@ -197,6 +197,13 @@ namespace wrapper ...@@ -197,6 +197,13 @@ namespace wrapper
return libvlc_audio_get_mute( mPlayer ); 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 ) void Player::setWindow( intptr_t id )
{ {
......
...@@ -58,6 +58,7 @@ namespace wrapper ...@@ -58,6 +58,7 @@ namespace wrapper
bool hasVout() const; bool hasVout() const;
void setScale( float factor ); void setScale( float factor );
void setVideoSize( unsigned width, unsigned height );
unsigned getWidth() const; unsigned getWidth() const;
unsigned getHeight() const; unsigned getHeight() const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment