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

cppcx: Remove Media::parse() and introduce Media::parseWithOptionAsync

parent 1b103e12
......@@ -88,14 +88,22 @@ namespace libVLCX
return m_media.duration();
}
void Media::parse()
void Media::parseWithOptions(ParseFlags flags, int timeoutMs)
{
m_media.parse();
m_media.parseWithOptions(static_cast<VLC::Media::ParseFlags>( flags ), timeoutMs);
}
void Media::parseWithOptions(ParseFlags flags, int timeoutMs)
IAsyncOperation<ParsedStatus>^ Media::parseWithOptionsAsync(ParseFlags flags, int timeoutMs)
{
m_media.parseWithOptions(static_cast<VLC::Media::ParseFlags>( flags ), timeoutMs);
return concurrency::create_async([=](concurrency::cancellation_token ct) {
auto res = std::make_shared<Concurrency::task_completion_event<ParsedStatus>>();
m_media.eventManager().onParsedChanged([res](VLC::Media::ParsedStatus status) {
res->set(static_cast<ParsedStatus>(status));
});
if (m_media.parseWithOptions(static_cast<VLC::Media::ParseFlags>(flags), timeoutMs) == false)
res->set(ParsedStatus::Failed);
return concurrency::create_task(*res, ct);
});
}
ParsedStatus Media::parsedStatus()
......
......@@ -26,6 +26,9 @@
#include <collection.h>
#include <vlcpp/vlc.hpp>
#include <ppltasks.h>
using namespace Windows::Foundation;
namespace libVLCX
{
ref class MediaEventManager;
......@@ -256,20 +259,6 @@ namespace libVLCX
*/
libvlc_time_t duration();
/**
* Parse a media.
*
* This fetches (local) meta data and tracks information. The method is
* synchronous.
*
* \see Media::parseAsync()
*
* \see Media::meta()
*
* \see Media::tracksInfo()
*/
void parse();
/**
* Parse a media.
*
......@@ -290,6 +279,8 @@ namespace libVLCX
*/
void Media::parseWithOptions(ParseFlags flags, int timeoutMs);
IAsyncOperation<ParsedStatus>^ parseWithOptionsAsync(ParseFlags flags, int timeoutMs);
ParsedStatus parsedStatus();
/**
......
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