Skip to content

Robin/m71 dot net #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Apr 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 1 addition & 14 deletions idl/MediaElement.idl
Original file line number Diff line number Diff line change
Expand Up @@ -38,26 +38,13 @@ namespace org
/// <summary>
/// MediaSource represents an object holder for a platform specific media element.
/// </summary>
[special]
struct MediaElement
interface MediaElement
{
/// <summary>
/// Constructs a media element object.
/// </summary>
[constructor, delete]
void MediaElement();

/// <summary>
/// Constructs a media element object from a native media element type.
/// </summary>
[constructor, default, altname(MediaElementWithNativeQueue)]
void MediaElement(Any element);

/// <summary>
/// Gets the platform specific media element.
/// </summary>
[getter]
Any element;
};


Expand Down
3 changes: 3 additions & 0 deletions idl/VideoBuffers.idl
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ namespace org
VideoFrameNativeBuffer nativeFrame;
};

[disposable]
interface VideoFramePlanarYuvBuffer : VideoFrameBuffer
{
[constructor, default, delete]
Expand Down Expand Up @@ -155,6 +156,7 @@ namespace org
VideoData v;
};

[disposable]
interface VideoFramePlanarYuvaBuffer : VideoFramePlanarYuvBuffer
{
[constructor, default, delete]
Expand All @@ -171,6 +173,7 @@ namespace org
VideoData a;
};

[disposable]
interface VideoFrameNativeBuffer : VideoFrameBuffer
{
[constructor, default, delete]
Expand Down
10 changes: 2 additions & 8 deletions windows/wrapper/impl_org_webRtc_EventQueue.cpp
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@

#ifdef WINUWP

#ifdef __has_include
#if __has_include(<winrt/windows.ui.core.h>)
#include <winrt/windows.ui.core.h>
#endif //__has_include(<winrt/windows.ui.core.h>)
#endif //__has_include

#else

#include <zsLib/IMessageQueue.h>
#endif //WINUWP

#include "impl_org_webRtc_EventQueue.h"
#include "impl_org_webRtc_helpers.h"
Expand Down Expand Up @@ -92,7 +87,6 @@ wrapper::org::webRtc::EventQueuePtr wrapper::org::webRtc::EventQueue::getDefault
return result;
}

#ifdef WINUWP
#ifdef CPPWINRT_VERSION

wrapper::org::webRtc::EventQueuePtr wrapper::impl::org::webRtc::EventQueue::toWrapper(winrt::Windows::UI::Core::CoreDispatcher queue) noexcept
Expand All @@ -117,8 +111,6 @@ winrt::Windows::UI::Core::CoreDispatcher wrapper::impl::org::webRtc::EventQueue:

#endif // CPPWINRT_VERSION

#endif //WINUWP

wrapper::org::webRtc::EventQueuePtr wrapper::impl::org::webRtc::EventQueue::toWrapper(::zsLib::IMessageQueuePtr queue) noexcept
{
if (!queue)
Expand All @@ -136,7 +128,9 @@ ::zsLib::IMessageQueuePtr wrapper::impl::org::webRtc::EventQueue::toNative(wrapp
auto converted = ZS_DYNAMIC_PTR_CAST(WrapperImplType, queue);
if (!converted)
return {};
#ifdef CPPWINRT_VERSION
if (converted->dispatcher_)
return zsLib::IMessageQueueDispatcher::create(converted->dispatcher_);
#endif //CPPWINRT_VERSION
return converted->queue_;
}
10 changes: 0 additions & 10 deletions windows/wrapper/impl_org_webRtc_EventQueue.h
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@

#pragma once

#ifdef WINUWP

#ifdef __has_include
#if __has_include(<winrt/windows.ui.core.h>)
#include <winrt/windows.ui.core.h>
#endif //__has_include(<winrt/windows.ui.core.h>)
#endif //__has_include

#endif //WINUWP

#include "types.h"
#include "generated/org_webRtc_EventQueue.h"

Expand All @@ -27,22 +23,16 @@ namespace wrapper {

EventQueueWeakPtr thisWeak_;

#ifdef WINUWP
#ifdef CPPWINRT_VERSION
winrt::Windows::UI::Core::CoreDispatcher dispatcher_ {nullptr};
#endif // CPPWINRT_VERSION
#endif //WINUWP
zsLib::IMessageQueuePtr queue_;

EventQueue() noexcept;
virtual ~EventQueue() noexcept;

#ifdef WINUWP
#ifdef CPPWINRT_VERSION
ZS_NO_DISCARD() static wrapper::org::webRtc::EventQueuePtr toWrapper(winrt::Windows::UI::Core::CoreDispatcher queue) noexcept;
ZS_NO_DISCARD() static winrt::Windows::UI::Core::CoreDispatcher toNative_winrt(WrapperTypePtr queue) noexcept;
#endif // CPPWINRT_VERSION
#endif //WINUWP
ZS_NO_DISCARD() static wrapper::org::webRtc::EventQueuePtr toWrapper(::zsLib::IMessageQueuePtr queue) noexcept;
ZS_NO_DISCARD() static ::zsLib::IMessageQueuePtr toNative(WrapperTypePtr queue) noexcept;

Expand Down
98 changes: 24 additions & 74 deletions windows/wrapper/impl_org_webRtc_MediaElement.cpp
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@

#ifdef WINUWP

#ifdef __has_include
#if __has_include(<winrt/Windows.UI.Xaml.Controls.h>)
#include <winrt/Windows.UI.Xaml.Controls.h>
#endif //__has_include(<winrt/Windows.UI.Xaml.Controls.h>)
#endif //__has_include

#else

#ifndef WINUWP
#ifdef _WIN32
#include <WinSock2.h>
#include <Windows.h>
#endif //_WIN32

#endif //WINUWP
#endif //ndef WINUWP

#include "impl_org_webRtc_MediaElement.h"
#include "impl_org_webRtc_helpers.h"
Expand All @@ -40,35 +37,6 @@ using ::std::map;
ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::MediaElement::WrapperImplType, WrapperImplType);
ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType);

#ifdef WINUWP

#ifdef CPPWINRT_VERSION

namespace wrapper { namespace impl { namespace org { namespace webRtc {
ZS_DECLARE_STRUCT_PTR(MediaElementWrapperAnyCx);

struct MediaElementWrapperAnyWinrt : Any
{
winrt::Windows::UI::Xaml::Controls::MediaElement element_ {nullptr};
};
} } } }

#endif // CPPWINRT_VERSION

#else


namespace wrapper { namespace impl { namespace org { namespace webRtc {
ZS_DECLARE_STRUCT_PTR(MediaElementWrapperAny);

struct MediaElementWrapperAny : Any
{
HWND element_ {};
};
} } } }

#endif //WINUWP

//------------------------------------------------------------------------------
wrapper::impl::org::webRtc::MediaElement::MediaElement() noexcept
{
Expand All @@ -88,67 +56,49 @@ wrapper::impl::org::webRtc::MediaElement::~MediaElement() noexcept
thisWeak_.reset();
}

//------------------------------------------------------------------------------
void wrapper::impl::org::webRtc::MediaElement::wrapper_init_org_webRtc_MediaElement(AnyPtr element) noexcept
{
ZS_ASSERT(element);
element_ = element;
}

//------------------------------------------------------------------------------
AnyPtr wrapper::impl::org::webRtc::MediaElement::get_element() noexcept
{
return element_;
}


#ifdef WINUWP
#ifdef CPPWINRT_VERSION

wrapper::org::webRtc::MediaElementPtr wrapper::impl::org::webRtc::MediaElement::toWrapper(winrt::Windows::UI::Xaml::Controls::MediaElement const & element) noexcept
{
auto any{ make_shared<wrapper::impl::org::webRtc::MediaElementWrapperAnyWinrt>() };
any->element_ = element;
auto result = make_shared<WrapperImplType>();
result->thisWeak_ = result;
result->element_ = any;
result->elementXaml_ = element;
return result;
}

winrt::Windows::UI::Xaml::Controls::MediaElement wrapper::impl::org::webRtc::MediaElement::toNative_winrt(wrapper::org::webRtc::MediaElementPtr element) noexcept
winrt::Windows::UI::Xaml::Controls::MediaElement wrapper::impl::org::webRtc::MediaElement::toNative_winrt(wrapper::org::webRtc::MediaElementPtr wrapper) noexcept
{
if (!element)
return {nullptr};
AnyPtr any = element->get_element();
if (!any) return nullptr;
auto castedAny = ZS_DYNAMIC_PTR_CAST(wrapper::impl::org::webRtc::MediaElementWrapperAnyWinrt, any);
if (!castedAny)
return {nullptr};
return castedAny->element_;
if (!wrapper) return {nullptr};
auto converted = ZS_DYNAMIC_PTR_CAST(WrapperImplType, wrapper);
ZS_ASSERT(converted);
if (!converted) return {nullptr};
return converted->elementXaml_;
}

#endif // CPPWINRT_VERSION

#else
#ifndef WINUWP
#ifdef _WIN32

wrapper::org::webRtc::MediaElementPtr wrapper::impl::org::webRtc::MediaElement::toWrapper(HWND element) noexcept
{
auto any{ make_shared<wrapper::impl::org::webRtc::MediaElementWrapperAny>() };
any->element_ = element;
auto result = wrapper::org::webRtc::MediaElement::wrapper_create();
any->element_ = element;
if (NULL == element) return {};
auto result = std::make_shared<WrapperImplType>();
result->thisWeak_ = result;
result->elementHwnd_ = element;
return result;
}

HWND wrapper::impl::org::webRtc::MediaElement::toNative(wrapper::org::webRtc::MediaElementPtr element) noexcept
HWND wrapper::impl::org::webRtc::MediaElement::toNative(wrapper::org::webRtc::MediaElementPtr wrapper) noexcept
{
if (!element) return nullptr;
AnyPtr any = element->get_element();
if (!any) return nullptr;
auto castedAny = ZS_DYNAMIC_PTR_CAST(wrapper::impl::org::webRtc::MediaElementWrapperAny, any);
if (!castedAny) return nullptr;
return castedAny->element_;
if (!wrapper) return {};
auto converted = ZS_DYNAMIC_PTR_CAST(WrapperImplType, wrapper);
ZS_ASSERT(converted);
if (!converted) return {};
return converted->elementHwnd_;
}

#endif //WINUWP
#endif //_WIN32
#endif //ndef WINUWP

27 changes: 15 additions & 12 deletions windows/wrapper/impl_org_webRtc_MediaElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,30 @@ namespace wrapper {
AnyPtr element_{};
MediaElementWeakPtr thisWeak_;

MediaElement() noexcept;
virtual ~MediaElement() noexcept;

#ifdef CPPWINRT_VERSION
winrt::Windows::UI::Xaml::Controls::MediaElement elementXaml_ {nullptr};
#endif // CPPWINRT_VERSION

// methods MediaElement
void wrapper_init_org_webRtc_MediaElement(AnyPtr element) noexcept override;
#ifndef WINUWP
#ifdef _WIN32
HWND elementHwnd_{};
#endif //_WIN32
#endif //ndef WINUWP

// properties MediaElement
AnyPtr get_element() noexcept override;
MediaElement() noexcept;
virtual ~MediaElement() noexcept;

#ifdef WINUWP
#ifdef CPPWINRT_VERSION
ZS_NO_DISCARD() static wrapper::org::webRtc::MediaElementPtr toWrapper(winrt::Windows::UI::Xaml::Controls::MediaElement const & element) noexcept;
ZS_NO_DISCARD() static winrt::Windows::UI::Xaml::Controls::MediaElement toNative_winrt(wrapper::org::webRtc::MediaElementPtr element) noexcept;
ZS_NO_DISCARD() static winrt::Windows::UI::Xaml::Controls::MediaElement toNative_winrt(wrapper::org::webRtc::MediaElementPtr wrapper) noexcept;
#endif // CPPWINRT_VERSION
#else

#ifndef WINUWP
#ifdef _WIN32
ZS_NO_DISCARD() static wrapper::org::webRtc::MediaElementPtr toWrapper(HWND element) noexcept;
ZS_NO_DISCARD() static element toNative(wrapper::org::webRtc::MediaElementPtr element) noexcept;
ZS_NO_DISCARD() static HWND toNative(wrapper::org::webRtc::MediaElementPtr wrapper) noexcept;
#endif //_WIN32
#endif //WINUWP
#endif //ndef WINUWP

};

Expand Down
10 changes: 2 additions & 8 deletions windows/wrapper/impl_org_webRtc_MediaSample.cpp
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@

#ifdef WINUWP

#ifdef __has_include
#if __has_include(<winrt/base.h>)
#include <winrt/base.h>
#endif //__has_include(<winrt/base.h>)
#endif //__has_include

#else

#ifndef WINUWP
#ifdef _WIN32
#include <WinSock2.h>
#include <Windows.h>
#endif //_WIN32

#endif //WINUWP

#include "impl_org_webRtc_MediaSample.h"
Expand Down Expand Up @@ -59,7 +56,6 @@ wrapper::impl::org::webRtc::MediaSample::~MediaSample() noexcept
thisWeak_.reset();
}

#ifdef WINUWP
#ifdef CPPWINRT_VERSION
//------------------------------------------------------------------------------
void wrapper::impl::org::webRtc::MediaSample::wrapper_dispose() noexcept
Expand Down Expand Up @@ -87,5 +83,3 @@ winrt::com_ptr<IMFSample> wrapper::impl::org::webRtc::MediaSample::toNative(wrap
}

#endif // CPPWINRT_VERSION
#endif //WINUWP

5 changes: 1 addition & 4 deletions windows/wrapper/impl_org_webRtc_MediaSample.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,20 @@ namespace wrapper {

MediaSampleWeakPtr thisWeak_;
zsLib::Lock lock_;
#ifdef WINUWP

#ifdef CPPWINRT_VERSION
winrt::com_ptr<IMFSample> sample_;
#endif //CPPWINRT_VERSION
#endif //WINUWP

MediaSample() noexcept;
virtual ~MediaSample() noexcept;

void wrapper_dispose() noexcept override;

#ifdef WINUWP
#ifdef CPPWINRT_VERSION
ZS_NO_DISCARD() static wrapper::org::webRtc::MediaSamplePtr toWrapper(winrt::com_ptr<IMFSample> const & sample) noexcept;
ZS_NO_DISCARD() static winrt::com_ptr<IMFSample> toNative(wrapper::org::webRtc::MediaSamplePtr sample) noexcept;
#endif //CPPWINRT_VERSION
#endif //WINUWP

};

Expand Down
Loading