libvlc_new always return null in vlc 2.1.3

This forum is about all development around libVLC.
Lokesh
New Cone
New Cone
Posts: 6
Joined: 07 Apr 2014 14:43

libvlc_new always return null in vlc 2.1.3

Postby Lokesh » 09 Apr 2014 16:20

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:password@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);


But it always return null for libvlc_new call. 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, but it returned NULL only.

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

Boehmi
New Cone
New Cone
Posts: 2
Joined: 09 Apr 2014 11:25

Re: libvlc_new always return null in vlc 2.1.3

Postby Boehmi » 10 Apr 2014 09:37

I started with libVLC recently and do my call like this in C++:

libvlc_instance_t * inst = libvlc_new(0,NULL);

Try initializing your instance like this, maybe it'll work.

RSATom
Big Cone-huna
Big Cone-huna
Posts: 513
Joined: 24 Nov 2011 06:55
Operating System: Windows/Linux/OsX
Location: Russia, Tomsk

Re: libvlc_new always return null in vlc 2.1.3

Postby RSATom » 10 Apr 2014 11:13

Just as Idea - maybe you build your project for x64 platform ( or AnyCpu on x64 OS ), but use x86 libvlc build.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 38 guests