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

Avmedia/VLC: Zooming 1:2, 2:1, 1:1

Doesn't work nice yet :)

Change-Id: I0fbdaea1cc64a94a9b63975b8b24c8d7e6251f6f
üst e62092da
......@@ -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);
......
......@@ -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 );
......
......@@ -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;
}
......
......@@ -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 );
......
......@@ -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;
......
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