[Libreoffice-commits] core.git: 3 commits - avmedia/source
Minh Ngo
nlminhtl at gmail.com
Thu Sep 19 14:58:49 PDT 2013
avmedia/source/vlc/vlcplayer.cxx | 6 ++++++
avmedia/source/vlc/vlcplayer.hxx | 1 +
avmedia/source/vlc/vlcwindow.cxx | 23 ++++++++++-------------
avmedia/source/vlc/vlcwindow.hxx | 1 +
avmedia/source/vlc/wrapper/Player.cxx | 11 +++++++++--
avmedia/source/vlc/wrapper/Player.hxx | 1 +
6 files changed, 28 insertions(+), 15 deletions(-)
New commits:
commit f22464dfb133936668173befb157394eaff2d142
Author: Minh Ngo <nlminhtl at gmail.com>
Date: Fri Sep 20 00:54:21 2013 +0300
Avmedia/VLC: Fixing zooming.
Will resize depended on the frame size now.
Change-Id: I3dbd0982f4442e9c643121af3cdfc2b0cdfe33a2
diff --git a/avmedia/source/vlc/vlcplayer.cxx b/avmedia/source/vlc/vlcplayer.cxx
index 4a454d8..be86333 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 cbc009c..94c9751 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 d00db28..cded4db 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 08e37d5..92348e2 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<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 7aa8147..0510197 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;
commit 15924193558ae7f0e04d5bb1ea8ab94517c5a9ce
Author: Minh Ngo <nlminhtl at gmail.com>
Date: Fri Sep 20 00:03:36 2013 +0300
Avmedia/VLC: Storing a frame size in the window class
Change-Id: I28f5c74313fcd6dae368c5fa9e7d299ad0ad1d0b
diff --git a/avmedia/source/vlc/vlcwindow.cxx b/avmedia/source/vlc/vlcwindow.cxx
index 8ef99b3..d00db28 100644
--- a/avmedia/source/vlc/vlcwindow.cxx
+++ b/avmedia/source/vlc/vlcwindow.cxx
@@ -102,21 +102,19 @@ void SAL_CALL VLCWindow::removeEventListener( const uno::Reference< lang::XEvent
{
}
-void SAL_CALL VLCWindow::setPosSize( sal_Int32 /* X */, sal_Int32 /* Y */, sal_Int32 /* Width */, sal_Int32 /* Height */, sal_Int16 /* Flags */ )
+void SAL_CALL VLCWindow::setPosSize( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, sal_Int16 /* Flags */ )
throw (uno::RuntimeException)
{
+ mSize.X = X;
+ mSize.Y = Y;
+ mSize.Width = Width;
+ mSize.Height = Height;
}
awt::Rectangle SAL_CALL VLCWindow::getPosSize()
throw (uno::RuntimeException)
{
- awt::Rectangle aRet;
-
- aRet.X = aRet.Y = 0;
- aRet.Width = mPlayer.getWidth();
- aRet.Height = mPlayer.getHeight();
-
- return aRet;
+ return mSize;
}
void SAL_CALL VLCWindow::setVisible( sal_Bool )
diff --git a/avmedia/source/vlc/vlcwindow.hxx b/avmedia/source/vlc/vlcwindow.hxx
index 1eb05c9..022a1b5 100644
--- a/avmedia/source/vlc/vlcwindow.hxx
+++ b/avmedia/source/vlc/vlcwindow.hxx
@@ -31,6 +31,7 @@ class VLCWindow : public ::cppu::WeakImplHelper2 < ::com::sun::star::media::XPla
VLCPlayer& mPlayer;
const intptr_t mPrevWinID;
::com::sun::star::media::ZoomLevel meZoomLevel;
+ ::com::sun::star::awt::Rectangle mSize;
public:
VLCWindow( VLCPlayer& player, const intptr_t prevWinID );
virtual ~VLCWindow();
commit 77af2e7d7524737aaafda1424c9344fd7e6d660a
Author: Minh Ngo <nlminhtl at gmail.com>
Date: Thu Sep 19 23:59:01 2013 +0300
Avmedia/VLC: Minor code formatting fix
Change-Id: Ia143d4ae8d452fd6bebb817acab7192481a1068a
diff --git a/avmedia/source/vlc/wrapper/Player.cxx b/avmedia/source/vlc/wrapper/Player.cxx
index 0b56e92..08e37d5 100644
--- a/avmedia/source/vlc/wrapper/Player.cxx
+++ b/avmedia/source/vlc/wrapper/Player.cxx
@@ -93,7 +93,7 @@ namespace wrapper
return InitApiMap( VLC_PLAYER_API );
}
- Player::Player(Media& media)
+ Player::Player( Media& media )
: mPlayer( libvlc_media_player_new_from_media( media ) )
{
}
@@ -209,7 +209,7 @@ namespace wrapper
#endif
}
- bool Player::takeSnapshot(const rtl::OUString& file)
+ bool Player::takeSnapshot( const rtl::OUString& file )
{
rtl::OString dest;
file.convertToString( &dest, RTL_TEXTENCODING_UTF8, 0 );
More information about the Libreoffice-commits
mailing list