问题
since I'm currently working on a gstreamer binding for my project and got the information, that gstreamer-sharp 0.99.x is only working with glib-sharp 2.99.x, I thought it a good idea to create a test project. So I downloaded the addin for monodevelop named "GTK# 3 Simple Project Template" and compiled it -> worked. Now I added the gstreamer-sharp 0.99 dll I compiled before and added the following code:
Gst.Application.Init();
Element music = Parse.Launch("playbin uri=\"file:////media/Auslagerung/DJ/IDs/android.mp3\"");
music.SetState(Gst.State.Playing);
I get the following exception, when I play this code:
Marshaling clicked signal
Exception in Gtk# callback delegate
Note: Applications can use GLib.ExceptionManager.UnhandledException to handle the exception.
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: An exception was thrown by the type initializer for Gst.Pipeline ---> System.DllNotFoundException: libgstreamersharpglue-1.0.0.dll
at (wrapper managed-to-native) Gst.Pipeline:gstsharp_gst_pipeline_get_fixed_clock_offset ()
at Gst.Pipeline..cctor () [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod,object,object[],System.Exception&)
at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00002] in /builddir/build/BUILD/mono-3.4.0/mcs/class/corlib/System.Reflection/MonoMethod.cs:537
--- End of inner exception stack trace ---
at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00013] in /builddir/build/BUILD/mono-3.4.0/mcs/class/corlib/System.Reflection/MonoMethod.cs:543
at System.Reflection.MonoCMethod.DoInvoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x000a5] in /builddir/build/BUILD/mono-3.4.0/mcs/class/corlib/System.Reflection/MonoMethod.cs:528
at System.Reflection.MonoCMethod.Invoke (BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in /builddir/build/BUILD/mono-3.4.0/mcs/class/corlib/System.Reflection/MonoMethod.cs:556
at System.Activator.CreateInstance (System.Type type, BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[] args, System.Globalization.CultureInfo culture, System.Object[] activationAttributes) [0x00174] in /builddir/build/BUILD/mono-3.4.0/mcs/class/corlib/System/Activator.cs:301
at System.Activator.CreateInstance (System.Type type, BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[] args, System.Globalization.CultureInfo culture) [0x00000] in /builddir/build/BUILD/mono-3.4.0/mcs/class/corlib/System/Activator.cs:238
at GLib.ObjectManager.CreateObject (IntPtr raw) [0x00000] in <filename unknown>:0
at GLib.Object.GetObject (IntPtr o, Boolean owned_ref) [0x00000] in <filename unknown>:0
at GLib.Object.GetObject (IntPtr o) [0x00000] in <filename unknown>:0
at Gst.Parse.Launch (System.String pipeline_description) [0x00000] in <filename unknown>:0
at MainWindow.onButtonClick (System.Object sender, System.EventArgs a) [0x00039] in /media/Auslagerung/tmp/Gtk3-Sharp-Test/Gtk3-Sharp-Test/MainWindow.cs:25
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00054] in /builddir/build/BUILD/mono-3.4.0/mcs/class/corlib/System.Reflection/MonoMethod.cs:230
--- End of inner exception stack trace ---
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00069] in /builddir/build/BUILD/mono-3.4.0/mcs/class/corlib/System.Reflection/MonoMethod.cs:238
at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in /builddir/build/BUILD/mono-3.4.0/mcs/class/corlib/System.Reflection/MethodBase.cs:114
at System.Delegate.DynamicInvokeImpl (System.Object[] args) [0x000cf] in /builddir/build/BUILD/mono-3.4.0/mcs/class/corlib/System/Delegate.cs:424
at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x00018] in /builddir/build/BUILD/mono-3.4.0/mcs/class/corlib/System/MulticastDelegate.cs:70
at System.Delegate.DynamicInvoke (System.Object[] args) [0x00000] in /builddir/build/BUILD/mono-3.4.0/mcs/class/corlib/System/Delegate.cs:398
at GLib.Signal.ClosureInvokedCB (System.Object o, GLib.ClosureInvokedArgs args) [0x00000] in <filename unknown>:0
at GLib.SignalClosure.Invoke (GLib.ClosureInvokedArgs args) [0x00000] in <filename unknown>:0
at GLib.SignalClosure.MarshalCallback (IntPtr raw_closure, IntPtr return_val, UInt32 n_param_vals, IntPtr param_values, IntPtr invocation_hint, IntPtr marshal_data) [0x00000] in <filename unknown>:0
at GLib.ExceptionManager.RaiseUnhandledException(System.Exception e, Boolean is_terminal)
at GLib.SignalClosure.MarshalCallback(IntPtr raw_closure, IntPtr return_val, UInt32 n_param_vals, IntPtr param_values, IntPtr invocation_hint, IntPtr marshal_data)
at Gtk.Application.gtk_main()
at Gtk.Application.Run()
at Gtk3SharpTest.MainClass.Main(System.String[] args) in /media/Auslagerung/tmp/Gtk3-Sharp-Test/Gtk3-Sharp-Test/Program.cs:line 14
Unhandled Exception:
System.TypeInitializationException: An exception was thrown by the type initializer for Gst.Pipeline ---> System.DllNotFoundException: libgstreamersharpglue-1.0.0.dll
at (wrapper managed-to-native) Gst.Pipeline:gstsharp_gst_pipeline_get_fixed_clock_offset ()
at Gst.Pipeline..cctor () [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod,object,object[],System.Exception&)
at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00002] in /builddir/build/BUILD/mono-3.4.0/mcs/class/corlib/System.Reflection/MonoMethod.cs:537
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: An exception was thrown by the type initializer for Gst.Pipeline ---> System.DllNotFoundException: libgstreamersharpglue-1.0.0.dll
at (wrapper managed-to-native) Gst.Pipeline:gstsharp_gst_pipeline_get_fixed_clock_offset ()
at Gst.Pipeline..cctor () [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod,object,object[],System.Exception&)
at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00002] in /builddir/build/BUILD/mono-3.4.0/mcs/class/corlib/System.Reflection/MonoMethod.cs:537
Anyone can help me, where I can find the dll? Or did I miss something in building?!
Thanks in advance.
回答1:
You don't have libgstreamerglue-1.0.0 in your Output directory.
回答2:
libgstreamersharpglue.so is located in a directory so far unknown to ldconfig.
I'm using ubuntu 15.04. Open a command line and do the following:
ldconfig -p | grep libgstreamersharpglue -> no output means it is not in ldconfig's cache
locate gstreamer | grep glue (be sure to have done sudo updatedb) -> if this doesn't produce output you don't have all the needed packages installed
if the file is somewhere on your system it will be in the resulting list:
for me it's /usr/lib/cli/gstreamer-sharp-0.9/libgstreamersharpglue-0.10.so
You need to make ldconfig use the /usr/lib/cli/gstreamer-sharp-0.9 directory.
OR: add the directory as a line directly to /etc/ld.so.conf
OR: drop a .conf file in /etc/ld.so.conf.d and add the directory to that file
on my system I did the latter: /etc/ld.so.conf.d/cli.conf
with two records in it /usr/lib/cli
/usr/lib/cli/gstreamer-sharp-0.9
now rebuild ldconfig's cache
sudo ldconfig
to test if it was succesful:
ldconfig -p | grep gstreamersharpglue -> you should get output from this
Retry running your application
来源:https://stackoverflow.com/questions/23495828/gstreamer-sharp-running-on-linux