// %BANNER_BEGIN% // --------------------------------------------------------------------- // %COPYRIGHT_BEGIN% // Copyright (c) (2018-2022) Magic Leap, Inc. All Rights Reserved. // Use of this file is governed by the Software License Agreement, located here: https://www.magicleap.com/software-license-agreement-ml2 // Terms and conditions applicable to third-party materials accompanying this distribution may also be found in the top-level NOTICE file appearing herein. // %COPYRIGHT_END% // --------------------------------------------------------------------- // %BANNER_END% namespace UnityEngine.XR.MagicLeap { using System; using System.Runtime.InteropServices; using UnityEngine.XR.MagicLeap.Native; /// /// MLWebRTC class contains the API to interface with the /// WebRTC C API. /// public partial class MLWebRTC { /// /// Class that represents a source used by the MLWebRTC API. /// public partial class AppDefinedSource { /// /// Native bindings for the MLWebRTC.AppDefinedVideoSource class. /// internal class NativeBindings { /// /// A delegate that describes the requirements of the OnSetEnabled callback. /// /// True if the source was enabled. /// Pointer to a context object. public delegate void OnSetEnabledDelegate([MarshalAs(UnmanagedType.I1)] bool enabled, IntPtr context); /// /// A delegate that describes the requirements of the OnDestroyed callback. /// /// Pointer to a context object. public delegate void OnDestroyedDelegate(IntPtr context); /// /// The native representation of the MLWebRTC data channel callback events. /// [StructLayout(LayoutKind.Sequential)] public struct MLWebRTCAppDefinedSourceEventCallbacks { /// /// Version of the struct. /// public uint Version; /// /// Version of the struct. /// public IntPtr Context; /// /// OnSetEnabled event. /// public OnSetEnabledDelegate OnSetEnabled; /// /// OnDestroyed event. /// public OnDestroyedDelegate OnDestroyed; /// /// Factory method used to create a new MLWebRTCAppDefinedVideoSourceEventCallbacks object. /// /// Pointer to the context object to use for the callbacks. /// An MLWebRTCAppDefinedVideoSourceEventCallbacks object with the given handle. public static MLWebRTCAppDefinedSourceEventCallbacks Create(IntPtr context, OnSetEnabledDelegate onSetEnabled, OnDestroyedDelegate onDestroyed) { MLWebRTCAppDefinedSourceEventCallbacks callbacks = new MLWebRTCAppDefinedSourceEventCallbacks { Version = 1, OnSetEnabled = onSetEnabled, OnDestroyed = onDestroyed, Context = context }; return callbacks; } } } } } }