From dd2b8e5cc972ea1266c5bc35cdd553e6738ceb3c Mon Sep 17 00:00:00 2001 From: n-tiz <3192885+n-tiz@users.noreply.github.com> Date: Tue, 15 Apr 2025 14:10:37 +0200 Subject: [PATCH] Add multi-targeting support for .NET Framework 4.8 and .NET 8/9 - Updated the WPF MediaKit project and test application to target .NET Framework 4.8 along with .NET 8 and 9. - Added conditional references for DirectShowLib NuGet package based on the target framework (DirectShowLib for .NET Framework, DirectShowLib.Net for .NET 8/9). - Implemented #if preprocessor directive in DvdPlayer to handle code differences between the two packages (DirectShowLib and DirectShowLib.Net). --- Source/DirectShow/MediaPlayers/DvdPlayer.cs | 7 +- Source/WPF MediaKit.csproj | 140 ++++++++++---------- Test Application/Test Application.csproj | 66 ++++----- 3 files changed, 105 insertions(+), 108 deletions(-) diff --git a/Source/DirectShow/MediaPlayers/DvdPlayer.cs b/Source/DirectShow/MediaPlayers/DvdPlayer.cs index cad7d1f..67a16ce 100644 --- a/Source/DirectShow/MediaPlayers/DvdPlayer.cs +++ b/Source/DirectShow/MediaPlayers/DvdPlayer.cs @@ -679,8 +679,11 @@ private void BuildGraph() } /* This will be the audio stream pin */ - if (mediaType.subType == MediaSubType.Audio.DolbyAc3 || - mediaType.subType == MediaSubType.Mpeg2Audio) +#if NET48 + if (mediaType.subType == MediaSubType.DolbyAC3 || mediaType.subType == MediaSubType.Mpeg2Audio) +#elif NET8_0 || NET9_0 + if (mediaType.subType == MediaSubType.Audio.DolbyAc3 || mediaType.subType == MediaSubType.Mpeg2Audio) +#endif { /* Keep the ref and we'll work with it later */ dvdAudioPin = dvdNavPin; diff --git a/Source/WPF MediaKit.csproj b/Source/WPF MediaKit.csproj index 3b8f888..e10cde6 100644 --- a/Source/WPF MediaKit.csproj +++ b/Source/WPF MediaKit.csproj @@ -1,79 +1,73 @@  - - net8.0-windows;net9.0-windows - Library - WPFMediaKit - WPFMediaKit - false - true - true - true - true + + net48;net8.0-windows;net9.0-windows + Library + WPFMediaKit + WPFMediaKit + false + true + true + true + true + 3.0.1 + 3.0.1 + - 3.0.1 - 3.0.1 + + WPFMediaKit + 3.0.1 + WPF MediaKit Team + WPF MediaKit Team + README.md + https://github.com/Sascha-L/WPF-MediaKit/blob/master/License.txt + https://github.com/Sascha-L/WPF-MediaKit + false + A library to quickly build DirectShow and MediaFoundation media player controls in WPF. The kit comes with a MediaElement replacement, a VideoCaptureElement for web cams and a DVDPlayerElement that plays DVDs and supports interactive menus. + Added .NET 8 & .NET 9 compatibility and fixed DirectShowLib. + Copyright © 2015-2025 by WPF MediaKit Team + wpf video directshow evr dvd player media MediaFoundation + + + true + default + + + true + + + + + + + + - - - - WPFMediaKit - 3.0.1 - WPF MediaKit Team - WPF MediaKit Team - README.md - https://github.com/Sascha-L/WPF-MediaKit/blob/master/License.txt - https://github.com/Sascha-L/WPF-MediaKit - false - A library to quickly build DirectShow and MediaFoundation media player controls in WPF. The kit comes with a MediaElement replacement, a VideoCaptureElement for web cams and a DVDPlayerElement that plays DVDs and supports interactive menus. - Added .NET 8 & .NET 9 compatibility, removed .NET Framework compatibility. Fixed DirectShowLib. If you are still using .NET Framework, please use Version 2.3.0 of WPF MediaKit! - Copyright © 2015-2025 by WPF MediaKit Team - wpf video directshow evr dvd player media MediaFoundation - - - - - - true - default - - - true - - - - - - - - - - - - - - - - - - False - - - - False - - - - - - - - False - - - - False - - + + + + + + + + + + + + + False + + + False + + + + + False + + + False + + \ No newline at end of file diff --git a/Test Application/Test Application.csproj b/Test Application/Test Application.csproj index 9e1632e..0701465 100644 --- a/Test Application/Test Application.csproj +++ b/Test Application/Test Application.csproj @@ -1,37 +1,37 @@  - - net9.0-windows - WinExe - Test_Application - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - false - true - false - true - true - - - - - - - + + net48;net8.0-windows;net9.0-windows + WinExe + Test_Application + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true + false + true + true + + + + + + + - - - - + + + + \ No newline at end of file