Commit 907f225a authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

Remove version guards

Since this branch is now targetting 3.0 only
parent 26d0573a
......@@ -794,11 +794,7 @@ HRESULT VLCPlugin::onInPlaceDeactivate(void)
{
if( m_player.mlp().isPlaying() )
{
#if LIBVLC_VERSION_INT >= LIBVLC_VERSION(4, 0, 0, 0)
m_player.mlp().stopAsync();
#else
m_player.mlp().stop();
#endif
}
_WindowsManager.DestroyWindows();
......@@ -861,11 +857,7 @@ void VLCPlugin::setTime(int seconds)
if( seconds != _i_time )
{
setStartTime(_i_time);
#if LIBVLC_VERSION_INT >= LIBVLC_VERSION(4, 0, 0, 0)
m_player.get_mp().setTime( _i_time, true );
#else
m_player.get_mp().setTime( _i_time );
#endif
}
}
......@@ -1351,7 +1343,6 @@ void VLCPlugin::fireOnMediaPlayerVoutEvent(int count)
vlcConnectionPointContainer->fireEvent(DISPID_MediaPlayerVoutEvent, &params);
}
#if LIBVLC_VERSION_INT >= LIBVLC_VERSION(2, 2, 2, 0)
void VLCPlugin::fireOnMediaPlayerMutedEvent()
{
DISPPARAMS dispparamsNoArgs = {NULL, NULL, 0, 0};
......@@ -1376,9 +1367,7 @@ void VLCPlugin::fireOnMediaPlayerAudioVolumeEvent(float volume)
params.cNamedArgs = 0;
vlcConnectionPointContainer->fireEvent(DISPID_MediaPlayerAudioVolumeEvent, &params);
}
#endif
#if LIBVLC_VERSION_INT >= LIBVLC_VERSION(3, 0, 0, 0)
void VLCPlugin::fireOnMediaPlayerChapterChangedEvent(int chapter)
{
DISPPARAMS params;
......@@ -1391,7 +1380,6 @@ void VLCPlugin::fireOnMediaPlayerChapterChangedEvent(int chapter)
params.cNamedArgs = 0;
vlcConnectionPointContainer->fireEvent(DISPID_MediaPlayerChapterChangedEvent, &params);
}
#endif
/* */
......@@ -1457,15 +1445,12 @@ void VLCPlugin::player_register_events()
em.onLengthChanged( [this]( int64_t length ) {
fireOnMediaPlayerLengthChangedEvent( length );
});
#if LIBVLC_VERSION_INT >= LIBVLC_VERSION(3, 0, 0, 0)
em.onChapterChanged( [this]( int chapter ) {
fireOnMediaPlayerChapterChangedEvent( chapter );
});
#endif
em.onVout( [this]( int count ) {
fireOnMediaPlayerVoutEvent( count );
});
#if LIBVLC_VERSION_INT >= LIBVLC_VERSION(2, 2, 2, 0)
em.onMuted( [this] {
fireOnMediaPlayerMutedEvent();
});
......@@ -1475,7 +1460,6 @@ void VLCPlugin::player_register_events()
em.onAudioVolume( [this]( float volume ) {
fireOnMediaPlayerAudioVolumeEvent( volume );
});
#endif
}
#undef B
......@@ -264,16 +264,12 @@ public:
void fireOnMediaPlayerMediaChangedEvent();
void fireOnMediaPlayerTitleChangedEvent(int title);
void fireOnMediaPlayerLengthChangedEvent(long length);
#if LIBVLC_VERSION_INT >= LIBVLC_VERSION(3, 0, 0, 0)
void fireOnMediaPlayerChapterChangedEvent(int chapter);
#endif
void fireOnMediaPlayerVoutEvent(int count);
#if LIBVLC_VERSION_INT >= LIBVLC_VERSION(2, 2, 2, 0)
void fireOnMediaPlayerMutedEvent();
void fireOnMediaPlayerUnmutedEvent();
void fireOnMediaPlayerAudioVolumeEvent(float volume);
#endif
void fireClickEvent();
void fireDblClickEvent();
......
......@@ -562,12 +562,7 @@ STDMETHODIMP VLCAudio::toggleMute()
STDMETHODIMP VLCDeinterlace::disable()
{
#if LIBVLC_VERSION_INT >= LIBVLC_VERSION(4, 0, 0, 0)
_plug->get_player().get_mp().setDeinterlace( VLC::MediaPlayer::DeinterlaceState::Disabled,
std::string() );
#else
_plug->get_player().get_mp().setDeinterlace( "" );
#endif
return S_OK;
}
......@@ -576,12 +571,7 @@ STDMETHODIMP VLCDeinterlace::enable(BSTR mode)
char *psz_mode = CStrFromBSTR(CP_UTF8, mode);
if ( psz_mode == nullptr )
return E_OUTOFMEMORY;
#if LIBVLC_VERSION_INT >= LIBVLC_VERSION(4, 0, 0, 0)
_plug->get_player().get_mp().setDeinterlace( VLC::MediaPlayer::DeinterlaceState::Enabled,
psz_mode );
#else
_plug->get_player().get_mp().setDeinterlace( psz_mode );
#endif
CoTaskMemFree(psz_mode);
return S_OK;
}
......@@ -734,11 +724,7 @@ STDMETHODIMP VLCInput::get_position(double* position)
STDMETHODIMP VLCInput::put_position(double position)
{
#if LIBVLC_VERSION_INT >= LIBVLC_VERSION(4, 0, 0, 0)
_plug->get_player().get_mp().setPosition( static_cast<float>(position), true );
#else
_plug->get_player().get_mp().setPosition( static_cast<float>(position) );
#endif
return S_OK;
}
......@@ -755,11 +741,7 @@ STDMETHODIMP VLCInput::get_time(double* time)
STDMETHODIMP VLCInput::put_time(double time)
{
#if LIBVLC_VERSION_INT >= LIBVLC_VERSION(4, 0, 0, 0)
_plug->get_player().get_mp().setTime(static_cast<libvlc_time_t>(time), true);
#else
_plug->get_player().get_mp().setTime(static_cast<libvlc_time_t>(time));
#endif
return S_OK;
}
......@@ -888,14 +870,10 @@ STDMETHODIMP VLCMarquee::get_text(BSTR *val)
if( NULL == val )
return E_POINTER;
#if LIBVLC_VERSION_INT < LIBVLC_VERSION(4, 0, 0, 0)
auto str = _plug->get_player().get_mp().marqueeString( libvlc_marquee_Text );
if( !str.empty() )
*val = BSTRFromCStr( CP_UTF8, str.c_str() );
return S_OK;
#else
return E_INVALIDARG;
#endif
}
STDMETHODIMP VLCMarquee::put_text(BSTR val)
......@@ -1083,11 +1061,7 @@ STDMETHODIMP VLCPlaylist::togglePause()
STDMETHODIMP VLCPlaylist::stop()
{
#if LIBVLC_VERSION_INT >= LIBVLC_VERSION(4, 0, 0, 0)
_plug->get_player().mlp().stopAsync();
#else
_plug->get_player().mlp().stop();
#endif
return S_OK;
}
......@@ -1570,15 +1544,11 @@ STDMETHODIMP VLCVideo::toggleFullscreen()
STDMETHODIMP VLCVideo::toggleTeletext()
{
#if LIBVLC_VERSION_INT >= LIBVLC_VERSION(3, 0, 0, 0)
if( _plug->get_player().get_mp().teletext() == 0 )
_plug->get_player().get_mp().setTeletext( 100 );
else
_plug->get_player().get_mp().setTeletext( 0 );
return S_OK;
#else
_plug->get_player().get_mp().toggleTeletext();
#endif
}
STDMETHODIMP VLCVideo::get_track(long* track)
......
......@@ -111,7 +111,6 @@ int vlc_player::preparse_item_sync(unsigned int idx, int options, unsigned int t
return -1;
auto em = media->eventManager();
#if LIBVLC_VERSION_INT >= LIBVLC_VERSION(3, 0, 0, 0)
# if defined(_WIN32)
HANDLE barrier = CreateEvent(nullptr, true, false, nullptr);
if ( barrier == nullptr )
......@@ -152,13 +151,6 @@ int vlc_player::preparse_item_sync(unsigned int idx, int options, unsigned int t
retval = future.get();
event->unregister();
# endif
#else
media->parse();
if ( media->isParsed() )
retval = 4; /* int( VLC::Media::ParsedStatus::Done ); */
else
retval = 2; /* int( VLC::Media::ParsedStatus::Failed ); */
#endif
return retval;
}
......
......@@ -426,7 +426,6 @@ void VLCControlsWnd::RegisterToVLCEvents()
PostMessage(hVideoPosScroll, (UINT) PBM_SETPOS, (WPARAM)0, 0);
});
#if LIBVLC_VERSION_INT >= LIBVLC_VERSION(2, 2, 2, 0)
VP()->get_mp().eventManager().onAudioVolume([this](float vol) {
UpdateVolumeSlider( roundf(vol * 100) );
});
......@@ -438,7 +437,6 @@ void VLCControlsWnd::RegisterToVLCEvents()
VP()->get_mp().eventManager().onUnmuted([this] {
UpdateMuteButton(false);
});
#endif
}
void VLCControlsWnd::NeedShowControls()
......@@ -460,11 +458,7 @@ void VLCControlsWnd::NeedHideControls()
void VLCControlsWnd::SetVideoPos(float Pos) //0-start, 1-end
{
if( VP() ){
#if LIBVLC_VERSION_INT >= LIBVLC_VERSION(4, 0, 0, 0)
VP()->get_mp().setPosition( Pos, true );
#else
VP()->get_mp().setPosition( Pos );
#endif
if( VP()->get_mp().length() > 0 )
PostMessage(hVideoPosScroll, (UINT)PBM_SETPOS, (WPARAM) (Pos * 1000), 0);
......
......@@ -536,11 +536,7 @@ LibvlcInputNPObject::setProperty(int index, const NPVariant &value)
return INVOKERESULT_INVALID_VALUE;
}
#if LIBVLC_VERSION_INT >= LIBVLC_VERSION(4, 0, 0, 0)
mp.setPosition( v, true );
#else
mp.setPosition( v );
#endif
return INVOKERESULT_NO_ERROR;
}
case ID_input_time:
......@@ -550,11 +546,7 @@ LibvlcInputNPObject::setProperty(int index, const NPVariant &value)
return INVOKERESULT_INVALID_VALUE;
}
#if LIBVLC_VERSION_INT >= LIBVLC_VERSION(4, 0, 0, 0)
mp.setTime( v, true );
#else
mp.setTime( v );
#endif
return INVOKERESULT_NO_ERROR;
}
case ID_input_rate:
......@@ -1011,11 +1003,7 @@ LibvlcPlaylistNPObject::invoke(int index, const NPVariant *args,
case ID_playlist_stop:
if( argCount == 0 )
{
#if LIBVLC_VERSION_INT >= LIBVLC_VERSION(4, 0, 0, 0)
p_plugin->player().mlp().stopAsync();
#else
p_plugin->player().mlp().stop();
#endif
return INVOKERESULT_NO_ERROR;
}
return INVOKERESULT_NO_SUCH_METHOD;
......@@ -1588,14 +1576,10 @@ LibvlcVideoNPObject::invoke(int index, const NPVariant *args,
{
if( argCount == 0 )
{
#if LIBVLC_VERSION_INT >= LIBVLC_VERSION(3, 0, 0, 0)
if ( p_plugin->getMD().teletext() == 0 )
p_plugin->getMD().setTeletext( 100 );
else
p_plugin->getMD().setTeletext( 0 );
#else
p_plugin->getMD().toggleTeletext();
#endif
return INVOKERESULT_NO_ERROR;
}
return INVOKERESULT_NO_SUCH_METHOD;
......@@ -1694,11 +1678,9 @@ LibvlcMarqueeNPObject::getProperty(int index, npapi::OutVariant& result)
result = position_bynumber( mp.marqueeInt( libvlc_marquee_Position ) );
return INVOKERESULT_NO_ERROR;
#if LIBVLC_VERSION_INT < LIBVLC_VERSION(4, 0, 0, 0)
case ID_marquee_text:
result = mp.marqueeString( libvlc_marquee_Text );
return INVOKERESULT_NO_ERROR;
#endif
}
return INVOKERESULT_GENERIC_ERROR;
}
......@@ -1995,12 +1977,7 @@ LibvlcDeinterlaceNPObject::invoke(int index, const NPVariant *args,
switch( index )
{
case ID_deint_disable:
#if LIBVLC_VERSION_INT >= LIBVLC_VERSION(4, 0, 0, 0)
mp.setDeinterlace( VLC::MediaPlayer::DeinterlaceState::Disabled,
std::string() );
#else
mp.setDeinterlace( std::string() );
#endif
break;
case ID_deint_enable:
......@@ -2011,11 +1988,7 @@ LibvlcDeinterlaceNPObject::invoke(int index, const NPVariant *args,
if ( !v.is<const char*>() )
return INVOKERESULT_INVALID_VALUE;
#if LIBVLC_VERSION_INT >= LIBVLC_VERSION(4, 0, 0, 0)
mp.setDeinterlace( VLC::MediaPlayer::DeinterlaceState::Enabled, v );
#else
mp.setDeinterlace( v );
#endif
break;
}
default:
......
......@@ -373,16 +373,12 @@ static struct vlcevents_t {
{ "MediaPlayerSeekableChanged", libvlc_MediaPlayerSeekableChanged },
{ "MediaPlayerPausableChanged", libvlc_MediaPlayerPausableChanged },
{ "MediaPlayerTitleChanged", libvlc_MediaPlayerTitleChanged },
#if LIBVLC_VERSION_INT >= LIBVLC_VERSION(3, 0, 0, 0)
{ "MediaPlayerChapterChanged", libvlc_MediaPlayerChapterChanged },
#endif
{ "MediaPlayerLengthChanged", libvlc_MediaPlayerLengthChanged },
{ "MediaPlayerVout", libvlc_MediaPlayerVout },
#if LIBVLC_VERSION_INT >= LIBVLC_VERSION(2, 2, 2, 0)
{ "MediaPlayerMuted", libvlc_MediaPlayerMuted },
{ "MediaPlayerUnmuted", libvlc_MediaPlayerUnmuted },
{ "MediaPlayerAudioVolume", libvlc_MediaPlayerAudioVolume },
#endif
};
void VlcPluginBase::subscribe(const char* eventName, npapi::Variant listener)
......@@ -447,18 +443,15 @@ void VlcPluginBase::subscribe(const char* eventName, npapi::Variant listener)
case libvlc_MediaPlayerTitleChanged:
e = player().get_mp().eventManager().onTitleChanged( std::move( closure ) );
break;
#if LIBVLC_VERSION_INT >= LIBVLC_VERSION(3, 0, 0, 0)
case libvlc_MediaPlayerChapterChanged:
e = player().get_mp().eventManager().onChapterChanged( std::move( closure ) );
break;
#endif
case libvlc_MediaPlayerLengthChanged:
e = player().get_mp().eventManager().onLengthChanged( std::move( closure ) );
break;
case libvlc_MediaPlayerVout:
e = player().get_mp().eventManager().onVout( std::move( closure ) );
break;
#if LIBVLC_VERSION_INT >= LIBVLC_VERSION(2, 2, 2, 0)
case libvlc_MediaPlayerMuted:
e = player().get_mp().eventManager().onMuted( std::move( closure ) );
break;
......@@ -468,7 +461,6 @@ void VlcPluginBase::subscribe(const char* eventName, npapi::Variant listener)
case libvlc_MediaPlayerAudioVolume:
e = player().get_mp().eventManager().onAudioVolume( std::move( closure ) );
break;
#endif
default:
break;
}
......@@ -665,11 +657,7 @@ void VlcPluginBase::control_handler(vlc_toolbar_clicked_t clicked)
case clicked_Stop:
{
#if LIBVLC_VERSION_INT >= LIBVLC_VERSION(4, 0, 0, 0)
player().get_mp().stopAsync();
#else
player().get_mp().stop();
#endif
}
break;
......
......@@ -326,11 +326,7 @@ gboolean VlcPluginGtk::update_time_slider(gpointer user_data)
static bool time_slider_handler(GtkRange*, GtkScrollType, gdouble value, gpointer user_data)
{
VlcPluginGtk *plugin = (VlcPluginGtk *) user_data;
#if LIBVLC_VERSION_INT >= LIBVLC_VERSION(4, 0, 0, 0)
plugin->getMD().setPosition( value / 100.0, true );
#else
plugin->getMD().setPosition( value / 100.0 );
#endif
return false;
}
......
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