Commit d5953934 authored by Bastien Penavayre's avatar Bastien Penavayre Committed by Hugo Beauzée-Luyssen

Adds Slave to Media for cppcx

Signed-off-by: 's avatarHugo Beauzée-Luyssen <hugo@beauzee.fr>
parent 776ecbca
......@@ -128,6 +128,21 @@ namespace libVLCX
{
}
bool addSlave(MediaSlave::Type type, unsigned priority, Platform::String^ uri)
{
m_media.addSlave(type, priority, FromPlatformString(uri));
}
void slavesClear()
{
m_media.slavesClear();
}
Platform::Foundation::Collections::IVector<MediaSlave^>^ slaves() const
{
return MarshallVector<MediaSlave, VLC::MediaSlave>(m_media.slaves());
}
} // namespace VLC
......@@ -309,6 +309,48 @@ namespace libVLCX
MediaType type();
/**
* Add a slave to the current media.
*
* A slave is an external input source that may contains an additional subtitle
* track (like a .srt) or an additional audio track (like a .ac3).
*
* \note This function must be called before the media is parsed (via parseWithOptions())
* or before the media is played (via MediaPlayer::play())
*
* \version LibVLC 3.0.0 and later.
*
* \param uri Uri of the slave (should contain a valid scheme).
* \param type subtitle or audio
* \param priority from 0 (low priority) to 4 (high priority)
*
* \return true on success, false on error.
*/
bool addSlave(MediaSlave::Type type, unsigned priority, Platform::String^ uri);
/**
* Clear all slaves previously added by addSlave() or
* internally.
*
* \version LibVLC 3.0.0 and later.
*/
void slavesClear();
/**
* Get a media descriptor's slaves in a vector
*
* The list will contain slaves parsed by VLC or previously added by
* addSlave(). The typical use case of this function is to save
* a list of slave in a database for a later use.
*
* \version LibVLC 3.0.0 and later.
*
* \see addSlave()
*
* \return a vector of MediaSlave
*/
Platform::Foundation::Collections::IVector<MediaSlave^>^ slaves() const;
private:
~Media(){}
......
......@@ -251,4 +251,25 @@ namespace libVLCX
m_startTime = desc.starttime();
m_name = ToPlatformString(desc.name().c_str());
}
MediaSlave::MediaSlave(const VLC::MediaSlave& slave) :
m_obj(slave)
{
m_uri = ToPlatformString(m_obj.uri());
}
Type MediaSlave::type() const
{
return (Type)m_obj.type();
}
unsigned MediaSlave::priority() const
{
return m_obj.priority();
}
Platform::String^ MediaSlave::uri() const
{
return m_uri;
}
}
......@@ -189,4 +189,28 @@ namespace libVLCX
int64_t m_duration;
int64_t m_startTime;
};
}
\ No newline at end of file
public ref class MediaSlave sealed
{
private:
VLC::MediaSlave m_obj;
Platform::String ^m_uri;
internal:
explicit MediaSlave(const VLC::MediaSlave& slave);
public:
public enum class Type
{
Subtitle = VLC::MediaSlave::Subtitle,
Audio = VLC::MediaSlave::Audio
}
Type type() const;
unsigned priority() const;
Platform::String^ uri() const;
};
}
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