Commit 87464208 authored by Martin Finkel's avatar Martin Finkel

Add net40 target support

parent 354da4c5
......@@ -5,8 +5,8 @@
<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard1.1'">
<DefineConstants>$(DefineConstants);NETSTANDARD1_1</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework.StartsWith('net4'))">
<DefineConstants>$(DefineConstants);XAML;DESKTOP</DefineConstants>
<PropertyGroup Condition="'$(TargetFramework)' == 'net40'">
<DefineConstants>$(DefineConstants);NET40</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'uap10.0.16299'">
<DefineConstants>$(DefineConstants);NETFX_CORE;XAML;WINDOWS_UWP;WINDOWS</DefineConstants>
......
......@@ -4,7 +4,7 @@
<Summary>.NET bindings for LibVLC</Summary>
<Description>.NET bindings for LibVLC</Description>
<PackageTags>libvlc native xamarin .net video audio media mediaplayer</PackageTags>
<TargetFrameworks>netstandard2.0;netstandard1.1;MonoAndroid81;Xamarin.iOS10;Xamarin.Mac20</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netstandard1.1;MonoAndroid81;Xamarin.iOS10;Xamarin.Mac20;net40</TargetFrameworks>
<RootNamespace>LibVLCSharp</RootNamespace>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
......@@ -22,7 +22,9 @@
<DefineConstants>$(DefineConstants);UNITY_ANDROID</DefineConstants>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" Version="4.3.0" />
<PackageReference Condition="'$(TargetFramework)' != 'net40'"
Include="System.Runtime.InteropServices.RuntimeInformation"
Version="4.3.0" />
<Compile Include="Shared\**\*.cs" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.StartsWith('MonoAndroid'))">
......
......@@ -573,7 +573,7 @@ namespace LibVLCSharp.Shared
{
var arrayResultPtr = IntPtr.Zero;
var count = Native.LibVLCMediaDiscovererListGet(NativeReference, category, ref arrayResultPtr);
#if NETSTANDARD1_1
#if NETSTANDARD1_1 || NET40
if (count == 0) return new MediaDiscoverer.Description[0];
#else
if (count == 0) return Array.Empty<MediaDiscoverer.Description>();
......@@ -646,7 +646,7 @@ namespace LibVLCSharp.Shared
updateProgress(dlg, position, text);
}
};
_dialogCbsPtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(DialogCallbacks)));
Marshal.StructureToPtr(dialogCbs, _dialogCbsPtr, true);
Native.LibVLCDialogSetCallbacks(NativeReference, _dialogCbsPtr, IntPtr.Zero);
......@@ -722,7 +722,11 @@ namespace LibVLCSharp.Shared
GetLogContext(ctx, out var module, out var file, out var line);
// Do the notification on another thread, so that VLC is not interrupted by the logging
#if NET40
Task.Factory.StartNew(() => _log?.Invoke(NativeReference, new LogEventArgs(level, formattedDecodedMessage, module, file, line)));
#else
Task.Run(() => _log?.Invoke(NativeReference, new LogEventArgs(level, formattedDecodedMessage, module, file, line)));
#endif
}
/// <summary>
......
......@@ -13,7 +13,7 @@ namespace LibVLCSharp.Shared
var nativeRef = getRef();
if (nativeRef == IntPtr.Zero)
{
#if NETSTANDARD1_1
#if NETSTANDARD1_1 || NET40
return new TU[0];
#else
return Array.Empty<TU>();
......@@ -56,7 +56,7 @@ namespace LibVLCSharp.Shared
public static T PtrToStructure<T>(IntPtr ptr)
{
#if NETSTANDARD1_1
#if NETSTANDARD1_1 || NET40
return (T)Marshal.PtrToStructure(ptr, typeof(T));
#else
return Marshal.PtrToStructure<T>(ptr);
......
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