Commit 11a11b73 authored by Martin Finkel's avatar Martin Finkel

Removed unused watchOS and netcoreapp2.0 from build props

libvlc loading improvements. Still need to fix netstandard1.1 build
expose libvlc view handle for mac/linux for net40
parent 2180533d
<Project>
<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<DefineConstants>$(DefineConstants);PORTABLE;MODERN_DESKTOP</DefineConstants>
<DefineConstants>$(DefineConstants);PORTABLE;NETSTANDARD2_0</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard1.1'">
<DefineConstants>$(DefineConstants);NETSTANDARD1_1</DefineConstants>
......@@ -22,13 +22,7 @@
<PropertyGroup Condition="'$(TargetFramework)' == 'Xamarin.TVOS10'">
<DefineConstants>$(DefineConstants);MONO;COCOA</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'Xamarin.WatchOS10'">
<DefineConstants>$(DefineConstants);MONO;COCOA</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework.StartsWith('MonoAndroid'))">
<DefineConstants>$(DefineConstants);MONO;ANDROID</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp2.0'">
<DefineConstants>$(DefineConstants);NETCORE;MODERN_DESKTOP</DefineConstants>
</PropertyGroup>
</Project>
\ No newline at end of file
......@@ -28,10 +28,10 @@ namespace LibVLCSharp.Shared
public static void Initialize()
{
#if MODERN_DESKTOP
InitializeDesktop();
#elif ANDROID
#if ANDROID
InitializeAndroid();
#else
InitializeDesktop();
#endif
}
......@@ -43,7 +43,7 @@ namespace LibVLCSharp.Shared
throw new VLCException("failed to initialize libvlc with JniOnLoad " +
$"{nameof(JniRuntime.CurrentRuntime.InvocationPointer)}: {JniRuntime.CurrentRuntime.InvocationPointer}");
}
#elif MODERN_DESKTOP
#endif
//TODO: Add Unload library func using handles
static void InitializeDesktop()
{
......@@ -52,9 +52,9 @@ namespace LibVLCSharp.Shared
if (appExecutionDirectory == null)
throw new NullReferenceException(nameof(appExecutionDirectory));
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
if (IsWindows)
{
var arch = Environment.Is64BitProcess ? ArchitectureNames.Win64 : ArchitectureNames.Win86;
var arch = IsX64BitProcess ? ArchitectureNames.Win64 : ArchitectureNames.Win86;
var librariesFolder = Path.Combine(appExecutionDirectory, Constants.LibrariesRepositoryFolderName, arch);
......@@ -87,7 +87,31 @@ namespace LibVLCSharp.Shared
return Native.LoadLibrary(libraryPath);// TODO: cross-platform load
}
static bool IsWindows
{
get
{
#if NET40
return Environment.OSVersion.Platform != PlatformID.MacOSX
&& Environment.OSVersion.Platform != PlatformID.Unix;
#else
return RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
#endif
}
}
static bool IsX64BitProcess
{
get
{
#if NET40
return Environment.Is64BitProcess;
#else
return RuntimeInformation.OSArchitecture == Architecture.X64;
#endif
}
}
}
internal static class Constants
......
......@@ -131,8 +131,8 @@ namespace LibVLCSharp.Shared
{
fileHandle = Native.fopenMac(filename);
}
#endif
return fileHandle != IntPtr.Zero;
#endif
}
/// <summary>
......
......@@ -64,7 +64,8 @@ namespace LibVLCSharp.Shared
[DllImport(Constants.LibraryName, CallingConvention = CallingConvention.Cdecl,
EntryPoint = "libvlc_media_player_stop")]
internal static extern void LibVLCMediaPlayerStop(IntPtr mediaPlayer);
#if COCOA
#if COCOA || NET40
[DllImport(Constants.LibraryName, CallingConvention = CallingConvention.Cdecl,
EntryPoint = "libvlc_media_player_set_nsobject")]
internal static extern void LibVLCMediaPlayerSetNsobject(IntPtr mediaPlayer, IntPtr drawable);
......@@ -82,7 +83,7 @@ namespace LibVLCSharp.Shared
EntryPoint = "libvlc_media_player_get_xwindow")]
internal static extern uint LibVLCMediaPlayerGetXwindow(IntPtr mediaPlayer);
#if MODERN_DESKTOP || NET40
#if NETSTANDARD2_0 || NET40
[DllImport(Constants.LibraryName, CallingConvention = CallingConvention.Cdecl,
EntryPoint = "libvlc_media_player_set_hwnd")]
internal static extern void LibVLCMediaPlayerSetHwnd(IntPtr mediaPlayer, IntPtr drawable);
......@@ -728,7 +729,7 @@ namespace LibVLCSharp.Shared
/// </summary>
public void Stop() => Native.LibVLCMediaPlayerStop(NativeReference);
#if COCOA
#if COCOA || NET40
/// <summary>
/// Get the NSView handler previously set
/// return the NSView handler or 0 if none where set
......@@ -753,6 +754,8 @@ namespace LibVLCSharp.Shared
set => Native.LibVLCMediaPlayerSetNsobject(NativeReference, value);
}
#endif
#if NETSTANDARD2_0 || NET40
/// <summary>
/// Set an X Window System drawable where the media player should render its video output.
/// The call takes effect when the playback starts. If it is already started, it might need to be stopped before changes apply.
......@@ -773,7 +776,6 @@ namespace LibVLCSharp.Shared
set => Native.LibVLCMediaPlayerSetXwindow(NativeReference, value);
}
#if MODERN_DESKTOP || NET40
/// <summary>
/// Set a Win32/Win64 API window handle (HWND) where the media player
/// should render its video output. If LibVLC was built without
......
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