-
Notifications
You must be signed in to change notification settings - Fork 461
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
Linux and OSX Support #94
Comments
Using ffmpeg as decoder on non-windows platforms, was on my todo list for months. I've just had a quick look at it. Unfortunately it is quite hard to implement seeking. Also, we would have to check the license of ffmpeg. I'm not sure whether it is compatible with the ms-pl or mit license. I've added a few extra points to your progress list above. |
FFmpeg is licensed under LGPL which is compatible with MS-PL and MIT. If we don't distribute FFmpeg with CSCore and rely on a system installation of ffmpeg, then calling PInvoke on the system installation of FFmepg is the same as dynamically linking to it, which means the FFmpeg license shouldn't have any effect. I think CSCore would fall under this section of the LGPL license (found here):
I'm not a lawyer though, so I could be wrong. Thanks for the added progress points. |
I have made some progress with decoding compressed audio on OSX using MacCore, a project that binds Apple's Objective-C API to C#. I just need to clean up the code and implement an IWaveSource decoder. The resulting MacCore binary is quite big (~8 MB), so to avoid redistributing the binary on every platform I thought it might be a good idea to have a separate OSX dll: This way all the OSX dependent code could be kept separate from the main CSCore dll. |
Would you still need a reference on the MacCore assemblies? Or would you put all OSX relevant code into the CSCore.OSX project? |
At the moment the OSX specific code references the MacCore assemblies, however it should be possible to just pull the relevant code from MacCore directly into CSCore, since it only uses a small section of the library. If that's possible than maybe there's no point having a separate CSCore.OSX.dll, and we can have it in the main project directly? |
Well, if we could include it directly it would be perfect. But we could start with using MacCore assemblies as seperate files. What would you say? |
I think that's a good idea. I should have the OSX code working soon, I'll put it in a CSCore.OSX project for now, and we can always combine them later. |
I have implemented a CoreAudio IWaveSource which works perfectly with the OpenAL output! Note the audio is a little choppy because I'm running OSX in a VM. |
Wow thats awesome! |
Just merged your openal pull request into the openal branch. I've fixed already a few bugs. I've also created a new linux branch, containing the CSCore.Linux project which contains links to the main CSCore project: http://fs5.directupload.net/images/160528/9brj96dh.png |
I had a look at the linux branch, nice job! Thanks for catching those bugs in the OpenAL implementation I also edited the checklist to reflect the OSX implementation status |
Hi @filoe, just an update on the OSX implementation. I've written a post-build step that merges I feel like it's a good idea to keep What are your thoughts on merging my branch I don't know if you'd prefer to merge your |
Hello @opcon, since I don't want to include linux and osx support in 1.2 release, I would prefer to not merge the extra branches to master. Is it possible to seperate OpenAL from linux/osx? Regards |
Yeah I can do that, the actual commits themselves are separate so I can just pick the OpenAL ones. I'll cherry pick them on to your current OpenAL branch and then submit a new pull request? |
That would be great. I would like to seperate OpenAL from linux/osx/... development. |
In order to pass the unit tests and make it possible to play audio on multiple devices at once, I've did some major changes to the AL implementation. |
Thank you for your effort, that's a massive rewrite!! It looks good! Yeah, Windows doesn't have the greatest OpenAL support. I agree that the main use for OpenAL is to support Mac and Linux, Windows users have other options. I found a spelling mistake in ALSoundOut, CheckForDisposed() line 613:
Additionally it appears that restarting a stopped source does not work unless I call I couldn't find a fix in the quick time I looked at it, but it's not a drastic bug since calling Thank you again for your rewrite! |
Thanks for reporting that bug. Did not recognice that. Gonna have a look at it.
|
…undOut playback can be restarted without reinitializing. #94
…undOut playback can be restarted without reinitializing. filoe#94
…undOut playback can be restarted without reinitializing. filoe#94
Is the linux branch functional?, I'm finding this kinda ambiguous. |
#115 Support for .Net core? |
The linux branch is currently functional but not with all features (see http://fs5.directupload.net/images/160528/9brj96dh.png). Therefor it is currently not released. |
Thanks for the information, how do I download/use it though?, I'm new to Github. EDIT: the linux branch I mean, I probably should have specified. |
After some time, there is finally some kind of progress: |
Wonderful news! I can test the ffmpeg output on OSX in the next couple of days and let you know how it goes. Would you be happy to include the OSX output in the same release as the ffmpeg support? If so, I'll create a pull request with my OSX code. In addition I changed the CodecFactory class to allow adding additional decoders to it at runtime, as well as coding some checks to prevent loading Windows APIs on Linux/OSX. I'll create a separate pull request for these. |
Would be great if you could test it on OSX. |
Hi, I'm on macOS Sierra, and I'm having difficulty using the filoe/cscore git master version of CSCore.Ffmpeg. I have it compiled successfully using Visual Studio for Mac beta, and I'm trying to use Mono 4.8 (part of .NET Core SDK from Microsoft) to run it. The problem I'm having is related to DLL mapping. I see the Interop classes try to load the following: So I wrote a
Unfortunately, even after setting the env var I get a Any tips? EDIT: Right after posting this, I had the genius idea of renaming
...At least it's actually trying to find the lib I specified in the .config file! Now to hack on it until it works. |
My previous problem was that the .NET Core SDK ships a 32-bit version of Mono, and homebrew installs a 64-bit version of ffmpeg. Argh! So I used homebrew's 64-bit Mono instead. Now a trivial 1-line test program hangs indefinitely.
this line in
"DUMMY-FILENAME" doesn't sound good; that looks like the code isn't complete. The FFmpeg libavformat docs don't say anything about "if you pass DUMMY-FILENAME, blah blah will happen". This is on macOS with 64-bit ffmpeg 3.2.2 and 64-bit mono 4.6.2 and git master CSCore. |
The ffmpeg component was never tested on mac. I currently don't even have mac build of ffmpeg. |
"Support for channel-conversion based on a channel matrix" is done. |
How did you get the visualization sample working?, trying to play a wav file just makes the program shut down. Compiling has no errors of any kind either. EDIT: The xterm window displays a message when the shutdown happens, but for some reason I can't copy it, it does mention |
@filoe The MacOS implementation is complete (for decoding audio files at least). I need to go through and clean up/produce an OSX branch suitable for merging, I still haven't had time to do that unfortunately. Hopefully I'll get to it in a week or so. What's the status on merging your OpenAL branch into master? Also I have made a few changes to the way CodecFactory works in my branch which makes supported codec detection for the current platform easier, I'll create a separate pull request for those and we can discuss those changes separately. |
Does anyone know how to get the winformsvisualization sample working on Linux?, I'm getting |
Does your system has openal installed. Which system are you using?
… Am 25.01.2017 um 17:03 schrieb VortexGator ***@***.***>:
Does anyone know how to get the winformsvisualization sample working on Linux?, I'm getting System.DllNotFoundException: libopenal.so.1, and I'm completely confused.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Openal doesn't come preinstalled as part of the OS?, well that explains it. I'm getting a different error now, yay!.
Not sure what you mean by system?. |
I am sorry. I ve meant, which operating system are you using?
… Am 25.01.2017 um 20:54 schrieb VortexGator ***@***.***>:
Openal doesn't come preinstalled as part of the OS?, well that explains it.
I'm getting a different error now, yay!.
shm_open() failed: No such file or directory
AL lib: (WW) alc_initconfig: Failed to initialize backend "pulse"
shm_open() failed: No such file or directory
ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Protocol error
Not sure what you mean by system?.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Xubuntu. |
Strange, when I restart the computer, it works temporarily, but later (few minutes) gives the error:
After some time. |
Is there some kind of stacktrace?
… Am 01.02.2017 um 15:14 schrieb VortexGator ***@***.***>:
Strange, when I restart the computer, it works temporarily, but later (few minutes) gives the error:
shm_open() failed: No such file or directory
AL lib: (WW) alc_initconfig: Failed to initialize backend "pulse"
shm_open() failed: No such file or directory
ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Protocol error
CSCore.SoundOut.AL.ALException: Could not open device "ALSA Default".
After some arbitrary amount of time.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Not sure what you mean?, like this?:
|
I've created an issue. But it will be quite hard to reproduce and find the error. See #210. |
…undOut playback can be restarted without reinitializing. filoe#94
Why don't you just directly use the ALSA API (libasound) to play a sound on Linux? Example playback program (in plain C): You could also use PulseAudio, but PulseAudio is just a sorry-construct ontop of ALSA, and not necessarely present on small distros, while ALSA is in the kernel. For iOS/Android, take a look at XamarinAudioManager OSX you seem to already have covered with CoreAudio, more or less. |
The point of an audio API like cscore is to abstract away platform differences, so the developer can release software for multiple platforms with only one audio playback implementation in their app. Furthermore, this can be an issue if, like you said, there’s more than one valid audio API for a given platform and you want to support each. Only supporting ALSA on Linux is a really bad idea because most desktop systems do use PulseAudio, and the shim that lets you play audio back to PulseAudio using the ALSA API is very inefficient, error-prone, and restricts you to a subset of the ALSA API. Accessing PulseAudio directly is so much better. There’s even more to it: on more than one occasion a platform owner has introduced a new audio API and officially deprecated an old one. If an application directly codes against a platform sound API, well, that’s a rewrite of their sound handling code to support the new API. If they use an abstraction later like cscore, the new API can be added as a backend to cscore and your app can bring in that support with minimal or no new code. Your comment sounds like an attempt to evade this real problem, which is strange since I would normally assume that someone contributing ideas to a sound abstraction layer would at least advance arguments acknowledging the reason for that abstraction layer to exist. Indeed, if every app developer just coded against ALSA directly, we could just delete this project from GitHub and move on. |
@allquixotic: Well, I think you misunderstood something there. |
There is no problem with supporting ALSA directly as playback interface. |
Progress
The text was updated successfully, but these errors were encountered: