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

Remove C++/CX bindings

Those belong in the WinRT app
parent dc88b216
/*****************************************************************************
* 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();
});
m_events.push_back(h);
return Windows::Foundation::EventRegistrationToken{ (int64) h };
}
void remove(Windows::Foundation::EventRegistrationToken token)
{
EventRemover::removeToken(m_events, token);
}
}
event Paused^ OnPaused
{
Windows::Foundation::EventRegistrationToken add(Paused^ handler)
{
auto h = m_em.onPaused([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 Stopped^ OnStopped
{
Windows::Foundation::EventRegistrationToken add(Stopped^ handler)
{
auto h = m_em.onStopped([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 Forward^ OnForward
{
Windows::Foundation::EventRegistrationToken add(Forward^ handler)
{
auto h = m_em.onForward([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 Backward^ OnBackward
{
Windows::Foundation::EventRegistrationToken add(Backward^ handler)
{
auto h = m_em.onBackward([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 EndReached^ OnEndReached
{
Windows::Foundation::EventRegistrationToken add(EndReached^ handler)
{
auto h = m_em.onEndReached([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 EncounteredError^ OnEncounteredError
{
Windows::Foundation::EventRegistrationToken add(EncounteredError^ handler)
{
auto h = m_em.onEncounteredError([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 TimeChanged^ OnTimeChanged
{
Windows::Foundation::EventRegistrationToken add(TimeChanged^ handler)
{
auto h = m_em.onTimeChanged([handler](int64_t time) {
handler(time);
});
m_events.push_back(h);
return Windows::Foundation::EventRegistrationToken{ (int64) h };
}
void remove(Windows::Foundation::EventRegistrationToken token)
{
EventRemover::removeToken(m_events, token);
}
}
event PositionChanged^ OnPositionChanged
{
Windows::Foundation::EventRegistrationToken add(PositionChanged^ handler)
{
auto h = m_em.onPositionChanged([handler](float p) {
handler(p);
});
m_events.push_back(h);
return Windows::Foundation::EventRegistrationToken{ (int64) h };
}
void remove(Windows::Foundation::EventRegistrationToken token)
{
EventRemover::removeToken(m_events, token);
}
}
event SeekableChanged^ OnSeekableChanged
{
Windows::Foundation::EventRegistrationToken add(SeekableChanged^ handler)
{
auto h = m_em.onSeekableChanged([handler](bool 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 PausableChanged^ OnPausableChanged
{
Windows::Foundation::EventRegistrationToken add(PausableChanged^ handler)
{
auto h = m_em.onPausableChanged([handler](bool 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 TitleChanged^ OnTitleChanged
{
Windows::Foundation::EventRegistrationToken add(TitleChanged^ handler)
{
auto h = m_em.onTitleChanged([handler](int t) {
handler(t);
});
m_events.push_back(h);
return Windows::Foundation::EventRegistrationToken{ (int64) h };
}
void remove(Windows::Foundation::EventRegistrationToken token)
{
EventRemover::removeToken(m_events, token);
}
}
event SnapshotTaken^ OnSnapshotTaken
{
Windows::Foundation::EventRegistrationToken add(SnapshotTaken^ handler)
{
auto h = m_em.onSnapshotTaken([handler](const std::string& path) {
handler(ToPlatformString( path ) );
});
m_events.push_back(h);
return Windows::Foundation::EventRegistrationToken{ (int64) h };
}
void remove(Windows::Foundation::EventRegistrationToken token)