Commit 2c5c784f authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

Add C++/CX bindings

parent 9ebf5a0e
......@@ -242,16 +242,16 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="..\libvlcpp\cppcx\DialogCX.hpp" />
<ClInclude Include="..\libvlcpp\cppcx\EqualizerCX.hpp" />
<ClInclude Include="..\libvlcpp\cppcx\EventManagerCX.hpp" />
<ClInclude Include="..\libvlcpp\cppcx\InstanceCX.hpp" />
<ClInclude Include="..\libvlcpp\cppcx\MediaCX.hpp" />
<ClInclude Include="..\libvlcpp\cppcx\MediaDiscovererCX.hpp" />
<ClInclude Include="..\libvlcpp\cppcx\MediaListCX.hpp" />
<ClInclude Include="..\libvlcpp\cppcx\MediaPlayerCX.hpp" />
<ClInclude Include="..\libvlcpp\cppcx\PlatformHelpers.hpp" />
<ClInclude Include="..\libvlcpp\cppcx\StructuresCX.hpp" />
<ClInclude Include="..\libvlcppcx\DialogCX.hpp" />
<ClInclude Include="..\libvlcppcx\EqualizerCX.hpp" />
<ClInclude Include="..\libvlcppcx\EventManagerCX.hpp" />
<ClInclude Include="..\libvlcppcx\InstanceCX.hpp" />
<ClInclude Include="..\libvlcppcx\MediaCX.hpp" />
<ClInclude Include="..\libvlcppcx\MediaDiscovererCX.hpp" />
<ClInclude Include="..\libvlcppcx\MediaListCX.hpp" />
<ClInclude Include="..\libvlcppcx\MediaPlayerCX.hpp" />
<ClInclude Include="..\libvlcppcx\PlatformHelpers.hpp" />
<ClInclude Include="..\libvlcppcx\StructuresCX.hpp" />
<ClInclude Include="..\libvlcpp\vlcpp\common.hpp" />
<ClInclude Include="..\libvlcpp\vlcpp\Dialog.hpp" />
<ClInclude Include="..\libvlcpp\vlcpp\Equalizer.hpp" />
......@@ -272,16 +272,16 @@
<ClInclude Include="pch.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\libvlcpp\cppcx\DialogCX.cpp" />
<ClCompile Include="..\libvlcpp\cppcx\EqualizerCX.cpp" />
<ClCompile Include="..\libvlcpp\cppcx\EventManagerCX.cpp" />
<ClCompile Include="..\libvlcpp\cppcx\InstanceCX.cpp" />
<ClCompile Include="..\libvlcpp\cppcx\MediaCX.cpp" />
<ClCompile Include="..\libvlcpp\cppcx\MediaDiscovererCX.cpp" />
<ClCompile Include="..\libvlcpp\cppcx\MediaListCX.cpp" />
<ClCompile Include="..\libvlcpp\cppcx\MediaPlayerCX.cpp" />
<ClCompile Include="..\libvlcpp\cppcx\PlatformHelpers.cpp" />
<ClCompile Include="..\libvlcpp\cppcx\StructuresCX.cpp" />
<ClCompile Include="..\libvlcppcx\DialogCX.cpp" />
<ClCompile Include="..\libvlcppcx\EqualizerCX.cpp" />
<ClCompile Include="..\libvlcppcx\EventManagerCX.cpp" />
<ClCompile Include="..\libvlcppcx\InstanceCX.cpp" />
<ClCompile Include="..\libvlcppcx\MediaCX.cpp" />
<ClCompile Include="..\libvlcppcx\MediaDiscovererCX.cpp" />
<ClCompile Include="..\libvlcppcx\MediaListCX.cpp" />
<ClCompile Include="..\libvlcppcx\MediaPlayerCX.cpp" />
<ClCompile Include="..\libvlcppcx\PlatformHelpers.cpp" />
<ClCompile Include="..\libvlcppcx\StructuresCX.cpp" />
<ClCompile Include="..\libVLCX\DirectXManager.cpp" />
<ClCompile Include="..\libVLCX\MMDeviceLocator.cpp" />
<ClCompile Include="..\libVLCX\Thumbnailer.cpp" />
......
......@@ -8,45 +8,45 @@
<Filter Include="libvlcpp">
<UniqueIdentifier>{e8e74e09-b896-4519-9fb9-1c29a35b1810}</UniqueIdentifier>
</Filter>
<Filter Include="libvlcpp\cppcx">
<UniqueIdentifier>{765e3acc-7024-47b8-b1de-ee8ca1e9e420}</UniqueIdentifier>
<Filter Include="libvlcppcx">
<UniqueIdentifier>{553d4421-fe5f-48d3-9baf-917f636a5db0}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="pch.cpp" />
<ClCompile Include="..\libvlcpp\cppcx\DialogCX.cpp">
<Filter>libvlcpp\cppcx</Filter>
<ClCompile Include="..\libVLCX\DirectXManager.cpp" />
<ClCompile Include="..\libVLCX\MMDeviceLocator.cpp" />
<ClCompile Include="..\libVLCX\Thumbnailer.cpp" />
<ClCompile Include="..\libvlcppcx\DialogCX.cpp">
<Filter>libvlcppcx</Filter>
</ClCompile>
<ClCompile Include="..\libvlcpp\cppcx\EqualizerCX.cpp">
<Filter>libvlcpp\cppcx</Filter>
<ClCompile Include="..\libvlcppcx\EqualizerCX.cpp">
<Filter>libvlcppcx</Filter>
</ClCompile>
<ClCompile Include="..\libvlcpp\cppcx\EventManagerCX.cpp">
<Filter>libvlcpp\cppcx</Filter>
<ClCompile Include="..\libvlcppcx\EventManagerCX.cpp">
<Filter>libvlcppcx</Filter>
</ClCompile>
<ClCompile Include="..\libvlcpp\cppcx\InstanceCX.cpp">
<Filter>libvlcpp\cppcx</Filter>
<ClCompile Include="..\libvlcppcx\InstanceCX.cpp">
<Filter>libvlcppcx</Filter>
</ClCompile>
<ClCompile Include="..\libvlcpp\cppcx\MediaCX.cpp">
<Filter>libvlcpp\cppcx</Filter>
<ClCompile Include="..\libvlcppcx\MediaCX.cpp">
<Filter>libvlcppcx</Filter>
</ClCompile>
<ClCompile Include="..\libvlcpp\cppcx\MediaDiscovererCX.cpp">
<Filter>libvlcpp\cppcx</Filter>
<ClCompile Include="..\libvlcppcx\MediaDiscovererCX.cpp">
<Filter>libvlcppcx</Filter>
</ClCompile>
<ClCompile Include="..\libvlcpp\cppcx\MediaListCX.cpp">
<Filter>libvlcpp\cppcx</Filter>
<ClCompile Include="..\libvlcppcx\MediaListCX.cpp">
<Filter>libvlcppcx</Filter>
</ClCompile>
<ClCompile Include="..\libvlcpp\cppcx\MediaPlayerCX.cpp">
<Filter>libvlcpp\cppcx</Filter>
<ClCompile Include="..\libvlcppcx\MediaPlayerCX.cpp">
<Filter>libvlcppcx</Filter>
</ClCompile>
<ClCompile Include="..\libvlcpp\cppcx\PlatformHelpers.cpp">
<Filter>libvlcpp\cppcx</Filter>
<ClCompile Include="..\libvlcppcx\StructuresCX.cpp">
<Filter>libvlcppcx</Filter>
</ClCompile>
<ClCompile Include="..\libvlcpp\cppcx\StructuresCX.cpp">
<Filter>libvlcpp\cppcx</Filter>
<ClCompile Include="..\libvlcppcx\PlatformHelpers.cpp">
<Filter>libvlcppcx</Filter>
</ClCompile>
<ClCompile Include="..\libVLCX\DirectXManager.cpp" />
<ClCompile Include="..\libVLCX\MMDeviceLocator.cpp" />
<ClCompile Include="..\libVLCX\Thumbnailer.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="pch.h" />
......@@ -92,38 +92,38 @@
<ClInclude Include="..\libvlcpp\vlcpp\structures.hpp">
<Filter>libvlcpp</Filter>
</ClInclude>
<ClInclude Include="..\libvlcpp\cppcx\DialogCX.hpp">
<Filter>libvlcpp\cppcx</Filter>
<ClInclude Include="..\libVLCX\DirectXManager.h" />
<ClInclude Include="..\libVLCX\MMDeviceLocator.h" />
<ClInclude Include="..\libVLCX\Thumbnailer.h" />
<ClInclude Include="..\libvlcppcx\DialogCX.hpp">
<Filter>libvlcppcx</Filter>
</ClInclude>
<ClInclude Include="..\libvlcpp\cppcx\EqualizerCX.hpp">
<Filter>libvlcpp\cppcx</Filter>
<ClInclude Include="..\libvlcppcx\EqualizerCX.hpp">
<Filter>libvlcppcx</Filter>
</ClInclude>
<ClInclude Include="..\libvlcpp\cppcx\EventManagerCX.hpp">
<Filter>libvlcpp\cppcx</Filter>
<ClInclude Include="..\libvlcppcx\EventManagerCX.hpp">
<Filter>libvlcppcx</Filter>
</ClInclude>
<ClInclude Include="..\libvlcpp\cppcx\InstanceCX.hpp">
<Filter>libvlcpp\cppcx</Filter>
<ClInclude Include="..\libvlcppcx\InstanceCX.hpp">
<Filter>libvlcppcx</Filter>
</ClInclude>
<ClInclude Include="..\libvlcpp\cppcx\MediaCX.hpp">
<Filter>libvlcpp\cppcx</Filter>
<ClInclude Include="..\libvlcppcx\MediaCX.hpp">
<Filter>libvlcppcx</Filter>
</ClInclude>
<ClInclude Include="..\libvlcpp\cppcx\MediaDiscovererCX.hpp">
<Filter>libvlcpp\cppcx</Filter>
<ClInclude Include="..\libvlcppcx\MediaDiscovererCX.hpp">
<Filter>libvlcppcx</Filter>
</ClInclude>
<ClInclude Include="..\libvlcpp\cppcx\MediaListCX.hpp">
<Filter>libvlcpp\cppcx</Filter>
<ClInclude Include="..\libvlcppcx\MediaListCX.hpp">
<Filter>libvlcppcx</Filter>
</ClInclude>
<ClInclude Include="..\libvlcpp\cppcx\MediaPlayerCX.hpp">
<Filter>libvlcpp\cppcx</Filter>
<ClInclude Include="..\libvlcppcx\MediaPlayerCX.hpp">
<Filter>libvlcppcx</Filter>
</ClInclude>
<ClInclude Include="..\libvlcpp\cppcx\PlatformHelpers.hpp">
<Filter>libvlcpp\cppcx</Filter>
<ClInclude Include="..\libvlcppcx\StructuresCX.hpp">
<Filter>libvlcppcx</Filter>
</ClInclude>
<ClInclude Include="..\libvlcpp\cppcx\StructuresCX.hpp">
<Filter>libvlcpp\cppcx</Filter>
<ClInclude Include="..\libvlcppcx\PlatformHelpers.hpp">
<Filter>libvlcppcx</Filter>
</ClInclude>
<ClInclude Include="..\libVLCX\DirectXManager.h" />
<ClInclude Include="..\libVLCX\MMDeviceLocator.h" />
<ClInclude Include="..\libVLCX\Thumbnailer.h" />
</ItemGroup>
</Project>
\ No newline at end of file
Subproject commit dc88b2169270fd35f9540848323950a561f85074
Subproject commit f3db79357c242b86030c94af4a8b8af0d6a0a9ba
/*****************************************************************************
* DialogCX.cpp: libvlcpp dialog API
*****************************************************************************
* Copyright © 2016 VLC authors and VideoLAN
*
* Authors: Bastien Penavayre <bastienPenava@gmail.com>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include "InstanceCX.hpp"
libVLCX::Dialog::Dialog(VLC::Dialog &&other) : _dialog(std::move(other))
{
}
bool libVLCX::Dialog::postLogin(Platform::String^ username, Platform::String^ password, bool store)
{
return _dialog.postLogin(FromPlatformString(username), FromPlatformString(password), store);
}
bool libVLCX::Dialog::postAction(int actionIndex)
{
return _dialog.postAction(actionIndex);
}
bool libVLCX::Dialog::dismiss()
{
return _dialog.dismiss();
}
\ No newline at end of file
/*****************************************************************************
* DialogCX.hpp: libvlcpp dialog API
*****************************************************************************
* Copyright © 2016 VLC authors and VideoLAN
*
* Authors: Bastien Penavayre <bastienPenava@gmail.com>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#pragma once
namespace libVLCX
{
public ref class Dialog sealed
{
VLC::Dialog _dialog;
friend ref class Instance;
/**
* The standard constructor.
*
* Used only by setDialogHandlers in Instance.hpp.
* \param other native C++ instance of Dialog
*/
Dialog(VLC::Dialog &&other);
public:
/**
* Post a login answer.
*
* After this call, the instance won't be valid anymore
*
* \param username valid non-empty string
* \param password valid string
* \param store if true stores the credentials
* \return true if success, false otherwise
*/
bool postLogin(Platform::String^ username, Platform::String^ password, bool store);
/**
* Post a question answer.
*
* After this call, this instance won't be valid anymore
*
* \see QuestionCb
* \param actionIndex 1 for action1, 2 for action2
* \return true on success, false otherwise
*/
bool postAction(int actionIndex);
/**
* Dismiss a dialog.
*
* After this call, this instance won't be valid anymore
*
* \see CancelCb
*/
bool dismiss();
};
}
\ No newline at end of file
/*****************************************************************************
* EqualizerCX.cpp: Equalizer API
*****************************************************************************
* Copyright © 2015 libvlcpp authors & VideoLAN
*
* Authors: Hugo Beauzée-Luyssen <hugo@beauzee.fr>
* Bastien Penavayre <bastienPenava@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include "EqualizerCX.hpp"
#include "Helpers.h"
namespace libVLCX
{
Equalizer::Equalizer()
{
}
Equalizer::Equalizer(unsigned int index)
: m_eq(index)
{
}
int Equalizer::setPreamp(float preamp)
{
return m_eq.setPreamp(preamp);
}
float Equalizer::preamp()
{
return m_eq.preamp();
}
int Equalizer::setAmp(float amp, unsigned int band)
{
return m_eq.setAmp(amp, band);
}
float Equalizer::amp(unsigned int band)
{
return m_eq.amp(band);
}
unsigned int Equalizer::presetCount()
{
return VLC::Equalizer::presetCount();
}
Platform::String^ Equalizer::presetName(unsigned index)
{
return ToPlatformString(VLC::Equalizer::presetName(index));
}
unsigned int Equalizer::bandCount()
{
return VLC::Equalizer::bandCount();
}
float Equalizer::bandFrequency(unsigned int index)
{
return VLC::Equalizer::bandFrequency(index);
}
}
/*****************************************************************************
* EqualizerCX.hpp: Equalizer API
*****************************************************************************
* Copyright © 2015 libvlcpp authors & VideoLAN
*
* Authors: Hugo Beauzée-Luyssen <hugo@beauzee.fr>
* Bastien Penavayre <bastienPenava@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#pragma once
#include "vlcpp\Equalizer.hpp"
namespace libVLCX
{
public ref class Equalizer sealed
{
internal:
VLC::Equalizer m_eq;
public:
/**
* Create a new default equalizer, with all frequency values zeroed.
*
* The new equalizer can subsequently be applied to a media player by invoking
* libvlc_media_player_set_equalizer().
*
* \throw std::runtime_error when equalizer creation fails
*
* \version LibVLC 2.2.0 or later
*/
Equalizer();
/**
* Create a new equalizer, with initial frequency values copied from an existing
* preset.
*
* The new equalizer can subsequently be applied to a media player by invoking
* libvlc_media_player_set_equalizer().
*
* \param index index of the preset, counting from zero
*
* \throw std::runtime_error when equalizer creation fails
*
* \version LibVLC 2.2.0 or later
*/
Equalizer(unsigned int index);
/**
* Set a new pre-amplification value for an equalizer.
*
* The new equalizer settings are subsequently applied to a media player by invoking
* MediaPlayer::setEqualizer().
*
* The supplied amplification value will be clamped to the -20.0 to +20.0 range.
*
* \param preamp preamp value (-20.0 to 20.0 Hz)
* \return zero on success, -1 on error
* \version LibVLC 2.2.0 or later
*/
int setPreamp(float preamp);
/**
* Get the current pre-amplification value from an equalizer.
*
* \return preamp value (Hz)
* \version LibVLC 2.2.0 or later
*/
float preamp();
/**
* Set a new amplification value for a particular equalizer frequency band.
*
* The new equalizer settings are subsequently applied to a media player by invoking
* MediaPlayer::setEqualizer().
*
* The supplied amplification value will be clamped to the -20.0 to +20.0 range.
*
* \param amp amplification value (-20.0 to 20.0 Hz)
* \param band index, counting from zero, of the frequency band to set
* \return zero on success, -1 on error
* \version LibVLC 2.2.0 or later
*/
int setAmp(float amp, unsigned int band);
/**
* Get the amplification value for a particular equalizer frequency band.
*
* \param u_band index, counting from zero, of the frequency band to get
* \return amplification value (Hz); NaN if there is no such frequency band
* \version LibVLC 2.2.0 or later
*/
float amp(unsigned int band);
/**
* Get the number of equalizer presets.
*
* \return number of presets
* \version LibVLC 2.2.0 or later
*/
static unsigned int presetCount();
/**
* Get the name of a particular equalizer preset.
*
* This name can be used, for example, to prepare a preset label or menu in a user
* interface.
*
* \param index index of the preset, counting from zero
* \return preset name, or empty string if there is no such preset
* \version LibVLC 2.2.0 or later
*/
static Platform::String^ presetName(unsigned index);
/**
* Get the number of distinct frequency bands for an equalizer.
*
* \return number of frequency bands
* \version LibVLC 2.2.0 or later
*/
static unsigned int bandCount();
/**
* Get a particular equalizer band frequency.
*
* This value can be used, for example, to create a label for an equalizer band control
* in a user interface.
*
* \param index index of the band, counting from zero
* \return equalizer band frequency (Hz), or -1 if there is no such band
* \version LibVLC 2.2.0 or later
*/
static float bandFrequency(unsigned int index);
};
}
/*****************************************************************************
* EventManagerCX.cpp: EventManager API
*****************************************************************************
* Copyright © 2014 the VideoLAN team
*
* Authors: Hugo Beauzée-Luyssen <hugo@beauzee.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include "EventManagerCX.hpp"
#include "MediaCX.hpp"
#include <vlcpp/vlc.hpp>
namespace libVLCX
{
MediaPlayerEventManager::MediaPlayerEventManager(VLC::MediaPlayerEventManager& em)
: m_em(em)
{
}
MediaEventManager::MediaEventManager(VLC::MediaEventManager& em)
: m_em(em)
{
}
MediaListEventManager::MediaListEventManager(VLC::MediaListEventManager& em)
: m_em(em)
{
}
void EventRemover::removeToken(std::vector<VLC::EventManager::RegisteredEvent>& events, Windows::Foundation::EventRegistrationToken token)
{
auto h = (VLC::EventManager::RegisteredEvent)token.Value;
auto it = std::find(begin(events), end(events), h);
assert(it != end(events));
(*it)->unregister();
events.erase(it);
}
}
/*****************************************************************************
* EventManagerCX.hpp: EventManager API
*****************************************************************************
* Copyright © 2014 the VideoLAN team
*
* Authors: Hugo Beauzée-Luyssen <hugo@beauzee.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#pragma once
#include <vlcpp/vlc.hpp>
#include "StructuresCX.hpp"
#include "MediaCX.hpp"
#include <memory>
namespace libVLCX
{
ref class Media;
public delegate void MediaChanged(Media^);
public delegate void NothingSpecial();
public delegate void Opening();
public delegate void Buffering(float);
public delegate void Playing();
public delegate void Paused();
public delegate void Stopped();
public delegate void Forward();
public delegate void Backward();
public delegate void EndReached();
public delegate void EncounteredError();
public delegate void TimeChanged(libvlc_time_t);
public delegate void PositionChanged(float);
public delegate void SeekableChanged(bool);
public delegate void PausableChanged(bool);
public delegate void TitleChanged(int);
public delegate void SnapshotTaken(Platform::String^);
public delegate void LengthChanged(libvlc_time_t);
public delegate void Vout(int);
public delegate void ScrambledChanged(int);
public delegate void ESAdded(TrackType, int);
public delegate void ESDeleted(TrackType, int);
public delegate void ESSelected(TrackType, int);
public delegate void MediaListItemAdded(Media^, int);
public delegate void MediaListWillAddItem(Media^, int);
public delegate void MediaListItemDeleted(Media^, int);
public delegate void MediaListWillDeleteItem(Media^, int);
public delegate void ParsedChanged(ParsedStatus);
ref class EventManager;
private ref class EventRemover sealed
{
internal:
static void removeToken(std::vector<VLC::EventManager::RegisteredEvent>& events, Windows::Foundation::EventRegistrationToken token);
};
public ref class MediaPlayerEventManager sealed
{
private:
std::vector<VLC::EventManager::RegisteredEvent> m_events;
public:
event MediaChanged^ OnMediaChanged
{
Windows::Foundation::EventRegistrationToken add(MediaChanged^ handler)
{
auto h = m_em.onMediaChanged([handler](VLC::MediaPtr media) {
handler(ref new Media(*media.get()));
});
m_events.push_back(h);
return Windows::Foundation::EventRegistrationToken{ (int64) h };
}
void remove(Windows::Foundation::EventRegistrationToken token)
{
EventRemover::removeToken(m_events, token);
}
}
event Opening^ OnOpening
{
Windows::Foundation::EventRegistrationToken add(Opening^ handler)
{
auto h = m_em.onOpening([handler]() {
handler();
});
m_events.push_back(h);
return Windows::Foundation::EventRegistrationToken{ (int64) h };
}
void remove(Windows::Foundation::EventRegistrationToken token)
{
EventRemover::removeToken(m_events, token);
}
}
event Buffering^ OnBuffering
{
Windows::Foundation::EventRegistrationToken add(Buffering^ handler)
{
auto h = m_em.onBuffering([handler](float b) {
handler(b);
});
m_events.push_back(h);
return Windows::Foundation::EventRegistrationToken{ (int64) h };
}
void remove(Windows::Foundation::EventRegistrationToken token)
{
EventRemover::removeToken(m_events, token);
}
}
event Playing^ OnPlaying
{
Windows::Foundation::EventRegistrationToken add(Playing^ handler)
{
auto h = m_em.onPlaying([handler]() {
handler();
});