Skip to content
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

Cross target NETSTANDARD2.0/NETCOREAPP2.0 #278

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Cross target NETSTANDARD2.0/NETCOREAPP2.0 #278

wants to merge 5 commits into from

Conversation

iamcarbon
Copy link

@iamcarbon iamcarbon commented Sep 29, 2017

This commit adds cross-targeting for NETCOREAPP2.0 & NETSTANDARD2.0.

In the process, I've bumped up the minimum framework target to NET451 (the default toolset installed with VS2017) and the framework version on all sample libraries.

Likely some things left to sort out, but hoping this is a good start to begin talking about NETSTANDARD support.

@filoe
Copy link
Owner

filoe commented Oct 1, 2017

Well, there are many windows dependencies like all the com objects, the calls to windows functions etc.
How would we deal with those dependencies?
Also I would like to keep it compatible with .net 3.5.
I have little to no experience to what it means to target netstandard. Maybe you can give me hint?

@iamcarbon
Copy link
Author

NETSTANDARD is just an abstraction that delegates down a native runtime (e.g. NET461, NETCOREAPP, or Mono). We can target NETSTANDARD and utilize either the full or core runtimes (2.0 has reached near parity) without regressing on Windows.

There's a bigger discussion on how to effectively target Linux & OSX -- and whether additional abstractions are needed to utilize different Media frameworks (CoreAudio, FFmpeg, and MediaFoundation) to support each.

Still fussing with NET35 but the tooling is still giving me trouble. Do we have any users depending on NET35? If we can bring up the target, we have a viable path to begin utilizing the wave of features coming in C# 7.2 (Instruction Primitives, span/memory, etc) that will allow us to Vectorize hot paths and reduce allocations across the entire codebase.

@filoe
Copy link
Owner

filoe commented Oct 1, 2017

Ok, so if we target netstandard, we would support different runtimes but still just the windows platform.
I've planed to support linux quite a while ago (see #94).
Whats still left is the support for resampler.
Of course we could use ffmpeg as resampler, but I don't like the idea of being dependend on ffmpeg for having a resampler.
I've planed to translate r8brain resampler to c# and use it within cscore (the author allows it). Unfortunatly, I had no time to translate it :-(.

To summerize it: We can add netstandard but if we want to target linux officially, there are some key components that have to be available. A resampler is one of them.

What are your thoughts on that?

@iamcarbon
Copy link
Author

Exactly.

What do you think of utilizing the Cockos re-sampler that was already ported to C# by NAudio (Ms-PL licensed).

https://github.com/naudio/NAudio/blob/master/NAudio/Dsp/WdlResampler.cs

@iamcarbon iamcarbon changed the title Cross target NETCOREAPP2.0 Cross target NETSTANDARD2.0/NETCOREAPP2.0 Oct 1, 2017
@iamcarbon
Copy link
Author

Let me know when we've created a new branch for this!

@filoe
Copy link
Owner

filoe commented Oct 13, 2017

Branch is available. Now we'll have to fill it ...

@iamcarbon
Copy link
Author

Great! I think the next step would be start the work on breaking out the Windows / COM logic into CSCore.Windows (CSCore.MediaFoundation would be a good name too) targeting NETFX and validating the postbuild IL rewrite step.

Let me know if you're able to start this work. That should uncover everything we need to make CSCore platform neutral.

@filoe filoe mentioned this pull request Oct 21, 2017
@filoe
Copy link
Owner

filoe commented Oct 22, 2017

I've just checked out a new branch: https://github.com/filoe/cscore/tree/netstandard
I've done some initial splitting of CSCore to CSCore.Windows.

Copy link

@limingming1234 limingming1234 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1

@vbisbest
Copy link

Does this branch work? I am trying to get CSAudio to compile for Windows IoT on Raspberry Pi

@StefH
Copy link

StefH commented Mar 3, 2019

@filoe
@MineCake147E
@iamcarbon
Any progress on this PR?

Because I also have some ideas on how to continue / start on this task.

  • CSCore.Abstractions --> this is the base project (.NET 4.5.1 + .NETStandard 2.0) which contains all abstractions like: (base)models, interfaces and constants. It should not contain real business logic like codecs.

  • CSCore.Codecs --> this is a (.NET 4.5.1 + .NETStandard 2.0) library which contains all native supported Codecs like AIIF / FLAC / RAW / WAV

  • CSCore.Windows.Abstractions --> this is a .NET 4.5.1library which contains abstractions like: (base)models, interfaces and constants based on Windows / MediaFoundation code. It should not contain real business logic like codecs.

  • CSCore.Windows.Codecs --> this is a (.NET 4.5.1) library which contains all windows supported Codecs.

  • For the Codecs projects --> we could even split these up into separate projects + libraries like CSCore.Codecs.MP3 & CSCore.Windows.Codecs.MP3 because in the future it could be that MP3 can be decoded using native code or windows / MediaFoundation code

  • I did not include FFMEG yet in my list because I don't know exactly yet how this fits...

@jtorjo
Copy link

jtorjo commented Dec 30, 2019

Does this work? Could I use this on UWP?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants