4

i'm developer of AudioCuesheetEditor, an application for editing audio cuesheets. The new Version should be able to play back sound, so I would like to use gstreamer as backend. I investigated a bit in gstreamer and found out, that I need to use version 1.x with gstreamer-sharp 0.99.x binding. No problem, downloaded gstreamer-sharp 0.99.0, opened the solution with monodevelop (on linux) or xamarin (on windows) and tried to build the dll, but that didn't work. I get the error "namespace Gst.GLib" not found.

I'm developing with xamarin/monodevelop and need to have a portable app (working with mono/.net).

Can anyone help me, get gstreamer-sharp build?

Thanks in advance!

Sven
  • 447
  • 1
  • 6
  • 22

2 Answers2

13

gstreamer-sharp is currently not supported on Windows, however you can compile the managed parts on linux and compile the glue on Windows using Visual Studio:

  1. Install gtk-sharp 3.0 from https://github.com/mono/gtk-sharp
  2. Compile gstreamer-sharp using ./autogen.sh && make
  3. Take the compiled glib-sharp and gstreamer-sharp binary and all .c files from sources/glue/
  4. Download and install gstreamer binaries from http://gstreamer.freedesktop.org/data/pkg/windows/1.2.2/ and install the development and binary packages for the architecture you want to compile for. You can use gstreamer 1.0 or 1.2.
  5. Use the Visual Studio template from the gstreamer-devel package and change the project type to library. Add the c files taken from the sources/glue folder and compile the glue library. The library should be called libgstreamersharpglue-1.0.0.dll
  6. Put the managed parts together with the native symbols.

EDIT: Compiling the glue is now easier on Windows! Someone set up a project which can compile the glue using Visual Studio on Windows. I have a fork which has binaries at https://github.com/xDarkice/libgstreamersharpglue

Stephan
  • 922
  • 6
  • 14
  • I was thinking of a late binding to gstreamer directly, would be more directly and I would have windows support. Why should I use the wrapper?! – Sven Feb 07 '14 at 14:09
  • 1
    I'm not sure what a late binding is, but binding gstreamer manually is much more work than compiling for windows. The managed parts will work perfectly on windows, it's just the glue which is not platform independant. And compiling the glue on windows is just setting up a small VC++ project. – Stephan Feb 08 '14 at 18:13
  • 2
    If you are just interested in binaries you could even go ahead and take the binaries from https://github.com/Vocaluxe/Vocaluxe/tree/develop/Output You can find everything in the x64 and x86 folders. – Stephan Feb 08 '14 at 18:14
  • Ok, thanks for your really good support ;). So I would download the glue and put it together with the gstreamer-sharp dll I need to compile on linux and then it works? I will try a bit ;). – Sven Feb 10 '14 at 12:41
  • 1
    You can even take the gstreamer-sharp.dll from there, basically that git repository has everything you need to get a basic setup running. I think the native dependencies are 1.0.11 – Stephan Feb 10 '14 at 22:00
  • I tried a bit around and now just have a problem with the dependencies. I linked gstreamer-sharp.dll into my project and it said, that I need to link the glib-sharp.dll in version 3.0 to my project. Since fedora doesn't have an rpm, I manually linked the glib-sharp.dll from the project, but now it says "The imported type `Glib.Value`is defined multiple times", since I doesn't have a gtk3-sharp.dll :(. How to solve this? – Sven Feb 13 '14 at 10:15
  • The glib-sharp.dll is within the repository as well – Stephan Feb 13 '14 at 11:06
  • I know, I already linked it manually to my project, but then the error above comes. Somewhere GLib is already defined, and I think it is in gtk-sharp2. – Sven Feb 13 '14 at 12:36
  • No gtk-sharp2 and gtk-sharp3 are parallel installable – Stephan Feb 13 '14 at 16:17
  • Ah ok, so I would need gtk-sharp3? Sorry, it is a bit complicated for me. I have tried to install gtk-sharp3 on fedora, but monodevelop didn't seem to notice it, since it displayed "Build for GTK-Sharp Version: 2.12" – Sven Feb 14 '14 at 19:14
  • gstreamer-sharp needs glib-sharp from gtk-sharp3, but you can use the compiled version from the repository in the link above. I am not sure what you want to archive. On linux it is easier to compile gstreamer-sharp yourself, just install gtk-sharp3 and run ./autogen.sh && make in your copy of gstreamer-sharp – Stephan Feb 17 '14 at 00:28
  • I want to achieve an audio backend for my project, which is platform independent and which can play *.mp3 && *.wav, also from a specified position and maybe later also do some recording. I have now tried to manually link the libraries, but now I get the following error: "libgstreamer-1.0-0.dll" not found. How do I say windows, that it is installed by gstreamer? – Sven Feb 18 '14 at 19:19
  • On windows you can use SetDllDirectory to scan for additional libraries at runtime. You will also need to use Registry.Scan to scan for the gstreamer libraries if your environment is not set up properly. – Stephan Feb 20 '14 at 02:05
  • Well I thought it is enough to ensure gstreamer is in path variable of windows, but that isn't the point. Is there a documentation, what I need for gstreamer-sharp to find gstreamer? I'm using mono, and there is not SetDllDirectory. – Sven Feb 20 '14 at 12:59
  • You probably need the dependencies in the path and the gstreamer environment variables set up. SetDllDirectory is a windows function which can be accessed using pinvoke. – Stephan Feb 21 '14 at 20:27
  • Well is there no documentation for windows? I searched for path and windows, but nothing helped. Also searched here http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/section-integration-win32.html#section-win32-install but that also didn't schow anything. I tried setting the path to "C:\Program Files (x86)\gstreamer\1.0\x86\bin" where the dll is located, but he still can not find it. Any idea? – Sven Feb 22 '14 at 13:28
  • If you cannot get the variables set up properly then it's the best to manually add them at runtime using SetDllDirectory and scan for the plugins manually using Registry.Scan. Gstreamer is still targeting linux as main target and the Windows platform is hardly maintained. At least they provide packages nowadays. – Stephan Feb 22 '14 at 23:35
  • I tried around a bit with SetDllDirectory("C:\\Program Files (x86)\\gstreamer\\1.0\\x86\\bin\\") and also with LoadLibrary("C:\\Program Files (x86)\\gstreamer\\1.0\\x86\\bin\\libgstreamer-1.0-0.dll") or setting the environment variable path Environment.SetEnvironmentVariable("PATH", Environment.GetEnvironmentVariable("PATH") + ";C:\\Program Files (x86)\\gstreamer\\1.0\\x86\\bin\\"), but nothing helps :(. – Sven Feb 25 '14 at 18:27
  • It just says "libgstreamer-1.0-0.dll" could not be found. Seems like gstreamer is nothing for my project, or any idea how to run on windows AND linux?! – Sven Feb 25 '14 at 18:28
  • Is there a mailing list for gstreamer-sharp? I can't be the only one, that wants to use gstreamer-sharp on windows?! – Sven Feb 27 '14 at 09:20
  • 1
    Please check https://github.com/Vocaluxe/Vocaluxe/blob/develop/Vocaluxe/Lib/Sound/CGstreamerSharpAudio.cs – Stephan Feb 28 '14 at 12:38
  • That helps me a bit, I could now get beyond the dll not found problematic. But now I get an System.AccessViolationException at reg.ScanPath("C:\\Program Files (x86)\\gstreamer\\1.0\\x86\\lib\\gstreamer-1.0"); Any ideas, why this happens?! – Sven Mar 02 '14 at 14:27
  • Access rights are restricted for the program files folder on windows by default, try inluding from a different folder. – Stephan Mar 02 '14 at 16:43
  • I also get this exception, when I try to load it from "d:\tmp\gstreamer-1.0", so I would say, there is another error. – Sven Mar 04 '14 at 10:36
  • Try putting everything from bin and lib together in a folder and use ScanPath and SetDllDirectory to that folder. – Stephan Mar 06 '14 at 11:46
  • Ok, when I try this, I get the following exception "GLib.GException: no element "playbin" ---> System.Exception: --- End of inner exception stack trace --- at bei Gst.Parse.Launch(String pipeline_description) at bei MainWindow..ctor(Program _objProgram) in e:\Projekte\Audio Cuesheet Editor (Windows)\src\AudioCuesheetEditor\MainWindow.cs:Zeile 100. ... ". This also happens when running "gst-inspect playbin" from e:\tmp\bin, but if I run "gst-inspect playbin" from c:\programme(x86)\gstreamer\x86\bin it says everything is perfect :(. – Sven Mar 06 '14 at 17:47
  • No idea, what could help? I'm really frustrated, and think it is only a little bit more to do. – Sven Mar 11 '14 at 14:20
  • 1
    Well, I'm not sure what the AccessViolationException is causing, the only thing I could advice is downloading Vocaluxe, compile it and check if you run into an AccessViolationException as well. – Stephan Mar 11 '14 at 20:00
  • I tried a little bit around, and found something realy interesting. I just started a Testproject with Xamarin, just a little GTK Project. If I use SetDllDirectory("C:\\Program Files (x86)\\gstreamer\\1.0\\x86\\bin"); before Application.Init() (no Link to gstreamer or glib.dll) and run the code for FileChooserDialog, I also get an System.AccessViolationException. Seems like something is wrong with gstreamer?! – Sven Mar 13 '14 at 08:24
  • I have now filled a bug at bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=726496 – Sven Mar 17 '14 at 09:27
  • I see you build Vocaluxe with Visual Studio, I'm building with xamarin (on windows) or monodevelop (on linux). Might that be some problem, that there are different compilers working?! – Sven Mar 27 '14 at 09:17
  • Could you try to build http://sourceforge.net/p/audiocuesheet/code/HEAD/tree/ on your system? I'm just a bit fascinated, how it works on your system and on mine I get the Exceptions above?! – Sven Mar 30 '14 at 12:27
  • Registry.ScanPath internally uses GLib.Marshaller.StringToPtrGStrdup. Try calling that function to check if it crashes. – Stephan Apr 02 '14 at 02:53
  • Tried it, and it works. I also tried it with gstreamer x64 bindings, but then the dll calls fails with BadImageException, which is an indicator for wrong platform dll. – Sven Apr 02 '14 at 12:42
  • I could build Vocaluxe now and as I debugged, I could see, that gstreamer backend is used. But why does it fail on a testprogram? – Sven Apr 09 '14 at 07:14
  • I'm not sure, Vocaluxe uses separate configurations for x64 and x86, maybe compile in x86 mode? – Stephan Apr 09 '14 at 17:45
  • I just got it. My error was, that I didn't run "Gst.Application.Init()" before "reg.ScanPath()". – Sven Apr 10 '14 at 11:58
  • @Darkice Can I use gstreamer-sharp on Mac OS, iOS and Android? – konstantin_doncov Jun 30 '14 at 10:29
  • gstreamer-sharp works on Mac OS, though iOS and Android using Xamarin is not supported at the moment, but support is going to be added for these platforms at some point. – Stephan Jul 03 '14 at 14:54
  • @Darkice Sorry for the dead link! I'm just getting a lot of systematic errors when trying to compile gtk-Sharp in mingw, so I need a faster response or more detailed description in order to sort out this problem (Google only helps in the solving specific errors, not for understanding what to do in certain situations). if it is possible, could you give me your email or skype? Thanks! – konstantin_doncov Jul 05 '14 at 01:21
  • @Darkice hello! Please check my [question about gstreamer-sharp](http://stackoverflow.com/questions/35122259/gstreamer-sharp-for-android), thanks! – konstantin_doncov Feb 01 '16 at 02:45
2

gstreamer-sharp uses autotools for its build system, you cannot build it with an IDE. Please do the autotools dance:

./autogen.sh --prefix=/the/prefix/where/you/want/to/install
make
sudo make install
knocte
  • 16,941
  • 11
  • 79
  • 125
  • Thanks for your help, but I need to use IDE, for packaging,etc. Why is there an solution, when the IDE is not supported? – Sven Feb 05 '14 at 12:52
  • 3
    you can still use the IDE for your application, but to get the binaries of gstreamer-sharp you need to use autotools. If you don't like this situation, then we welcome your help, we accept patches (I'm a gstreamer-sharp developer myself) – knocte Feb 05 '14 at 12:53
  • I would like to help, but don't know how? Also there is the problem, that autotools is not available on windows, and I'm also building windows builds, since the application is a multiplattform solution. – Sven Feb 05 '14 at 12:55
  • 1
    gstreamer-sharp is not yet compatible with windows, we need help there as well (if you lack the know-how to help us, you can always hire us as contractors). thanks – knocte Feb 05 '14 at 13:01
  • Well, is gstreamer-sharp-0.9.0 compatible with windows? I know, that this is not supported anymore, but I just need a backend for crossplattform playback, maybe recording. Also, how does the Banshee project handle this, since there is a windows port available?! – Sven Feb 05 '14 at 13:06
  • 1
    I guess you mean v0.10, not v0.9, which is the version that maps to gstreamer0.10. Banshee's latest windows binaries only use gstreamer-sharp0.10. We haven't released yet a version that works with gstreamer-sharp0.99.0, it's the default backend only in the master branch. We calculate that we will have Windows compatibility in Banshee with GStreamerSharp1.0 when we release Banshee 3.0, but we don't know when that will happen. Again, volunteers welcome. – knocte Feb 05 '14 at 13:21
  • Ok, I see. So, if I understand everything correctly, where is currently no windows support for gstreamer (and gstreamer-sharp), correct? – Sven Feb 06 '14 at 09:43
  • 1
    there is windows support for gstreamer but we haven't worked on windows support for gstreamer-sharp yet – knocte Feb 06 '14 at 10:12
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/46941/discussion-between-sven-and-knocte) – Sven Feb 06 '14 at 14:26