libvlc_new always return null in vlc 2.1.3

坚强是说给别人听的谎言 提交于 2019-12-20 06:51:52

问题


libvlc_new always return null. I have copied libvlc.dll and libvlccore.dll in debug folder of my solution directory.

We have also tried calling libvlc_new(0,null) and set the environment variable "VLC_PLUGIN_PATH " to plugins directory, with same result.

Any pointer what is going wrong/ or what is the best way to access libVlc API programmitically in .net environment.

PLEASE FIND CODE SNIPPET BELOW deveopled in C#, VS2010.

IntPtr instance, player ;
string[] args = new string[] {
"-I", "dummy", "--ignore-config",
@"--plugin-path=D:\plugins",
"--vout-filter=deinterlace", "--deinterlace-mode=blend"
};
instance = LibVlc.libvlc_new(args.length, args);
IntPtr media = LibVlc.libvlc_media_new_location(instance, @"rtsp://username assword@IP_address/path");
player = LibVlc.libvlc_media_player_new_from_media(media);
LibVlc.libvlc_media_player_set_hwnd(player, panel1.Handle);
LibVlc.libvlc_media_player_play(player);

we have done P/Invoke for corresponding library calls as:

[DllImport("D:\\myvlc\\myvlc\\bin\\Debug\\libvlc", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr libvlc_new(int argc, [MarshalAs(UnmanagedType.LPArray,
ArraySubType = UnmanagedType.LPStr)] string[] argv);

[DllImport("D:\\myvlc\\myvlc\\bin\\Debug\\libvlc", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr libvlc_media_new_location(IntPtr p_instance,
[MarshalAs(UnmanagedType.LPStr)] string psz_mrl);

[DllImport("D:\\myvlc\\myvlc\\bin\\Debug\\libvlc", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr libvlc_media_player_new_from_media(IntPtr media);

[DllImport("D:\\myvlc\\myvlc\\bin\\Debug\\libvlc", CallingConvention = CallingConvention.Cdecl)]
public static extern void libvlc_media_player_set_hwnd(IntPtr player, IntPtr drawable);

[DllImport("D:\\myvlc\\myvlc\\bin\\Debug\\libvlc", CallingConvention = CallingConvention.Cdecl)]
public static extern void libvlc_media_player_play(IntPtr player);

回答1:


The param --plugin-path" was ignored.

By copying the whole plugin directory works with 2.1.3.




回答2:


Found solution, all you need to do is to copy plugins folder to the debug directory of your visual studio solution folder. Hope this would save some time for others trying the same thing. I have been trying this for almost 1 day.



来源:https://stackoverflow.com/questions/22965654/libvlc-new-always-return-null-in-vlc-2-1-3

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!