VideoLan.Interop a .Net libvlc 0.9.x wrapper

This forum is about all development around libVLC.
Kairos
Blank Cone
Blank Cone
Posts: 45
Joined: 01 Mar 2008 01:49
Operating System: Windows
Location: Scottsdale, Az
Contact:

Re: VideoLan.Interop a .Net libvlc 0.9.x wrapper

Postby Kairos » 05 Jun 2009 23:13

Just for an update. I'm unable to track down the important memory leaks and bugs in the current version. I suspect many of the problems are from VLC 0.9 itself. For that reason, I'm abandoning the 0.9 version and moving to 1.0. I'm working on updating the code to work with 1.0. There is new functionality, new events, and If I find the time I'll finish the VLM stuff too.

I'm also considering removing the MediaListPlayer from this wrapper. The MediaListPlayer has never worked and I've heard very few complaints about it. IMO the playlist functionality should be written by you guys, not vlc. That is why I've never really concentrated on the MediaList, MediaLibrary, or MediaDiscoverer classes.

Kairos
Blank Cone
Blank Cone
Posts: 45
Joined: 01 Mar 2008 01:49
Operating System: Windows
Location: Scottsdale, Az
Contact:

Re: VideoLan.Interop a .Net libvlc 0.9.x wrapper

Postby Kairos » 05 Jun 2009 23:16

Oh, and as a reply to peoples questions on streaming... the answer is I really don't know. I've never tried to use my wrapper for streaming purposes. If you are having problems figuring out the command line options, it might be better to ask those questions in a more general forum.

sonamsingh19
New Cone
New Cone
Posts: 1
Joined: 19 Jun 2009 19:59

Re: VideoLan.Interop a .Net libvlc 0.9.x wrapper

Postby sonamsingh19 » 19 Jun 2009 20:15

Hiii guys,I don't know how many of u have got around this issue.
In ym case
I have a tabcontrol
the main tab/front window has a windowsformshost with a child as panel.the second tabitem is a list of items that i can use to playt things from.
In the constructor of my windows ,i set the handle of vlcmediaplayer class before vlcmediaplayer class is used inside another library to load and then play songs.
Now the issue,
when i play the video first time from second tab item ,its going cool.if i switch to the list of videos on second tab item again after seeing video and play any item,
I get a blue screen of death.
I handled a HadnleDestroyed even also with a debug.assert statement to see if its destroyed but i think its not as its not called.
FYI,Between any succesive calls i have set almost 800 millisecnds time explictily.
Also,
I keep things like windowsformshost,videopanel,VideoLanClient instance and VlcMediaPlayer instance within GC.KeepAlive() to prevent premature cleanup of these.

I have used VideoLanClient as VideoLanClient vlc=new VideoLanClient();
I am using plugins fro vlc 0.9.9.
Any idea whats causing that BSOD.Plz help me. .Its now occuring faster .earlier it was occuring after 10-12 video plays..
But u can say thats my problem..
Although,I haven't tried,ut i think it BSOD won't be there in Windows forms.
windowsformshost has something to do probably..Just my brain...
Whatever u feel,plz say,it might solve my problem.

socialjazz
Blank Cone
Blank Cone
Posts: 17
Joined: 19 May 2009 09:14

Re: VideoLan.Interop a .Net libvlc 0.9.x wrapper

Postby socialjazz » 20 Jun 2009 08:11

I'm trying to play a stream through this wrapper using the following

Code: Select all

VlcMedia desc = Vlc.NewMedia(filename); VlcPlayer.Load(desc); desc.Dispose(); VlcPlayer.Play();
if I pass the actual stream URL, the stream plays. ie the following works:

Code: Select all

string filename = "mms://wmlive-acl.bbc.co.uk/wms/bbc_ami/radio1/radio1_bb_live_eq1_sl0?BBC-UID=945a3082dec341e5dda25cfd113eaa3e1c94c2be00d0e1f4a42fa936cf8ec007&SSO2-UID="
but if I pass a playlist file the stream doesn't play. The same is true for winamp m3u files.

Code: Select all

string filename=http://www.bbc.co.uk/radio1/wm_asx/aod/radio1.asx
Both links play in a normal VLC instance.

What do I need to prepare the stream for playback?

Cheers

have anyone manage to solve this problem yet? I like this wrapper alot and it also works on 1.0.0
The only thing thatis bugging me is the inability to play online playlist

socialjazz
Blank Cone
Blank Cone
Posts: 17
Joined: 19 May 2009 09:14

Re: VideoLan.Interop a .Net libvlc 0.9.x wrapper

Postby socialjazz » 20 Jun 2009 08:14

Hiii guys,I don't know how many of u have got around this issue.
In ym case
I have a tabcontrol
the main tab/front window has a windowsformshost with a child as panel.the second tabitem is a list of items that i can use to playt things from.
In the constructor of my windows ,i set the handle of vlcmediaplayer class before vlcmediaplayer class is used inside another library to load and then play songs.
Now the issue,
when i play the video first time from second tab item ,its going cool.if i switch to the list of videos on second tab item again after seeing video and play any item,
I get a blue screen of death.
I handled a HadnleDestroyed even also with a debug.assert statement to see if its destroyed but i think its not as its not called.
FYI,Between any succesive calls i have set almost 800 millisecnds time explictily.
Also,
I keep things like windowsformshost,videopanel,VideoLanClient instance and VlcMediaPlayer instance within GC.KeepAlive() to prevent premature cleanup of these.

I have used VideoLanClient as VideoLanClient vlc=new VideoLanClient();
I am using plugins fro vlc 0.9.9.
Any idea whats causing that BSOD.Plz help me. .Its now occuring faster .earlier it was occuring after 10-12 video plays..
But u can say thats my problem..
Although,I haven't tried,ut i think it BSOD won't be there in Windows forms.
windowsformshost has something to do probably..Just my brain...
Whatever u feel,plz say,it might solve my problem.
use 1.0.0RC3 instead, and the BSOD will be gone

Mongrel
Blank Cone
Blank Cone
Posts: 11
Joined: 12 Jul 2009 11:35

Re: VideoLan.Interop a .Net libvlc 0.9.x wrapper

Postby Mongrel » 12 Jul 2009 11:48

I've been using VideoLAN.Interop.dll for quite some time now and I like it, but I just can't get it to work with 1.0.0.

The last thing I tried was to use the code drop from meedios' repository, because it contains a version specifically for 1.0.0. The code was updated 2 days ago, but still crashes on my computer. I tried the "VlcMediaPlayer.Sample" player, but that one doesn't work either (btw, you need to change the project configuration to "x86" from "Any CPU" to make it work on 64bit computers).

I'd love to use the new features of 1.0.0, can anyone help me? Or is simply not working yet?

Edit: Ok, nevermind. I found out why it's not working. The "lua" subdirectory is now also required to be inside my apps execuable directly. Previously, only the "plugins" directory was neccessary.

Edit 2: Well, not really. It's still not working on my own app correctly. The "vmem" module seems to be broken, but even without that, I can only use it reliably once out of ten times or so. The other times it just goes into an endless loop. Hm.

Kairos
Blank Cone
Blank Cone
Posts: 45
Joined: 01 Mar 2008 01:49
Operating System: Windows
Location: Scottsdale, Az
Contact:

Re: VideoLan.Interop a .Net libvlc 0.9.x wrapper

Postby Kairos » 14 Jul 2009 01:50

I'm still working on the 1.0.0 version of this library. I've only ported some of the new functions and tested nothing. I stopped working on it a couple days ago because the the sample app would crash just like you mentioned and I did not have the time to diagnose the problem. So now that I know its the lua directory, I'll get back to working on it again.

Kairos
Blank Cone
Blank Cone
Posts: 45
Joined: 01 Mar 2008 01:49
Operating System: Windows
Location: Scottsdale, Az
Contact:

Re: VideoLan.Interop a .Net libvlc 0.9.x wrapper

Postby Kairos » 15 Jul 2009 18:18

I see the crashing problem now. Every video I play crashes after a few seconds. I'll have to implement VLC's log so I can see what is crashing windows.

Beardless2
Cone that earned his stripes
Cone that earned his stripes
Posts: 125
Joined: 02 Feb 2007 09:53

Re: VideoLan.Interop a .Net libvlc 0.9.x wrapper

Postby Beardless2 » 16 Jul 2009 13:13

can you guys get it to work with officail v1.0.0? i have problems with it but the nightly builds are fine?

Mongrel
Blank Cone
Blank Cone
Posts: 11
Joined: 12 Jul 2009 11:35

Re: VideoLan.Interop a .Net libvlc 0.9.x wrapper

Postby Mongrel » 18 Jul 2009 13:08

I just wrote a simple 100% native player using one of the tutorials in the wiki and even that one crashes after the first frame. Can anyone confirm that libvlc is actually working right now? I'm using Windows 7 64bit, but I also tried this in a virtual machine with Windows XP 32 with the same result. The normal VLC player works fine.

XilasZ
Developer
Developer
Posts: 189
Joined: 16 Jun 2009 20:35

Re: VideoLan.Interop a .Net libvlc 0.9.x wrapper

Postby XilasZ » 18 Jul 2009 15:40

A few month ago, I made a player to watch tv from my internet provider, but it can also be used to watch any stream or file. It's full WPF (.Net 3.5), use libvlc through kairos' wrapper.
I updated it to reflect changes between libvlc 0.9 and 1.0. Everything i use is working fine. It works on XP, Vista, and Win7 without issues.

Mongrel
Blank Cone
Blank Cone
Posts: 11
Joined: 12 Jul 2009 11:35

Re: VideoLan.Interop a .Net libvlc 0.9.x wrapper

Postby Mongrel » 18 Jul 2009 19:57

A few month ago, I made a player to watch tv from my internet provider, but it can also be used to watch any stream or file. It's full WPF (.Net 3.5), use libvlc through kairos' wrapper.
I updated it to reflect changes between libvlc 0.9 and 1.0. Everything i use is working fine. It works on XP, Vista, and Win7 without issues.
Strange. For me, it doesn't work at all. Which version of 1.0 are you using?

Some testing has revealed that I can play OGG and WAV files just fine, while MP3s and videos crash. When the debugger is attached I can see, that all plugins get loaded, so the plugin directory should be set correctly.

XilasZ
Developer
Developer
Posts: 189
Joined: 16 Jun 2009 20:35

Re: VideoLan.Interop a .Net libvlc 0.9.x wrapper

Postby XilasZ » 19 Jul 2009 11:09

I use the official release. But it also worked with 1.0.0 rc3 and rc4 (after modifying the wrapper to reflect changes in libvlc).

Maybe it's just that the tutorials that you used are outdated.

Mongrel
Blank Cone
Blank Cone
Posts: 11
Joined: 12 Jul 2009 11:35

Re: VideoLan.Interop a .Net libvlc 0.9.x wrapper

Postby Mongrel » 19 Jul 2009 13:14

I use the official release. But it also worked with 1.0.0 rc3 and rc4 (after modifying the wrapper to reflect changes in libvlc).

Maybe it's just that the tutorials that you used are outdated.
That's possible, when you play an MP3 what initialization steps do you do?

Mine are the following:

client options:
"-I", "dummy",
"--ignore-config",
"--plugin-path=[...]"

- libvlc_new
- libvlc_media_new
- libvlc_media_player_new_from_media
- libvlc_media_player_play
- Sleep(15000) // just for testing
- libvlc_media_player_stop
- libvlc_media_player_release
- libvlc_release

The crash happens in the Sleep, but that's probably just a threading issue.

XilasZ
Developer
Developer
Posts: 189
Joined: 16 Jun 2009 20:35

Re: VideoLan.Interop a .Net libvlc 0.9.x wrapper

Postby XilasZ » 19 Jul 2009 21:01

try to remove "--plugin-path", i noticed that since 1.0, libvlc crash with that option. just let the plugin folder with libvlc (the same way they are in vlc).

Anyway, here the steps when i use with libvlc, and the main options. I think there's nothing wrong in your steps, it should work. mine is different because the media player is created only once, and medias are created and attached to it when changing channels.

Main options :
"--no-one-instance"
"--no-loop"
"--no-drop-late-frames"
"--disable-screensaver"
"--no-video-title-show"
"--overlay"
"--vout=directx"

libvlc_new
libvlc_media_player_new
libvlc_media_player_set_hwnd
libvlc_media_new
libvlc_media_player_set_media
libvlc_media_release
libvlc_media_player_play
...
libvlc_media_player_stop
libvlc_media_player_release
libvlc_release

lopez.tuparles
New Cone
New Cone
Posts: 6
Joined: 21 Dec 2008 20:25

Re: VideoLan.Interop a .Net libvlc 0.9.x wrapper

Postby lopez.tuparles » 20 Jul 2009 15:10

Hi,
As i undestand Vlc APi can't read playlist Stream. Is there a way to extract a list of Stream from a playlist with the API.
Thanks in advance.

if I pass the actual stream URL, the stream plays. ie the following works:
Code: Select all
string filename = "mms://wmlive-acl.bbc.co.uk/wms/bbc_ami/radio1/radio1_bb_live_eq1_sl0?BBC-UID=945a3082dec341e5dda25cfd113eaa3e1c94c2be00d0e1f4a42fa936cf8ec007&SSO2-UID="
but if I pass a playlist file the stream doesn't play. The same is true for winamp m3u files.
Code: Select all
string filename=http://www.bbc.co.uk/radio1/wm_asx/aod/radio1.asx
Both links play in a normal VLC instance.
What do I need to prepare the stream for playback?
Cheers
have anyone manage to solve this problem yet? I like this wrapper alot and it also works on 1.0.0
The only thing thatis bugging me is the inability to play online playlist

XilasZ
Developer
Developer
Posts: 189
Joined: 16 Jun 2009 20:35

Re: VideoLan.Interop a .Net libvlc 0.9.x wrapper

Postby XilasZ » 20 Jul 2009 15:51

Hi,
As i undestand Vlc APi can't read playlist Stream. Is there a way to extract a list of Stream from a playlist with the API.
Thanks in advance.
i don't use them, but maybe the functions named libvlc_media_list_* can do it. Try the VlcMediaList class, maybe it works (i didn't try them)

Kairos
Blank Cone
Blank Cone
Posts: 45
Joined: 01 Mar 2008 01:49
Operating System: Windows
Location: Scottsdale, Az
Contact:

Re: VideoLan.Interop a .Net libvlc 0.9.x wrapper

Postby Kairos » 21 Jul 2009 03:54

try to remove "--plugin-path", i noticed that since 1.0, libvlc crash with that option. just let the plugin folder with libvlc (the same way they are in vlc)
I was having the same problem where vlc would crash in the first few seconds of playing any file. Although I don't understand why, removing the plugin-path worked for me.

tamiro44
Cone that earned his stripes
Cone that earned his stripes
Posts: 131
Joined: 15 Feb 2009 15:21

Re: VideoLan.Interop a .Net libvlc 0.9.x wrapper

Postby tamiro44 » 21 Jul 2009 07:58

Hi,
How can you force your player to adjust the movie resolution?
After the player handle passed to the form, it won't change automatically.
Can i find out from API the movie's resolution?

Tamir.

Mongrel
Blank Cone
Blank Cone
Posts: 11
Joined: 12 Jul 2009 11:35

Re: VideoLan.Interop a .Net libvlc 0.9.x wrapper

Postby Mongrel » 21 Jul 2009 14:43

try to remove "--plugin-path", i noticed that since 1.0, libvlc crash with that option. just let the plugin folder with libvlc (the same way they are in vlc)
I was having the same problem where vlc would crash in the first few seconds of playing any file. Although I don't understand why, removing the plugin-path worked for me.
I'll try it this evening.

Edit: Jup, that's it. No more crashes.
Thanks Xilas!

Kairos
Blank Cone
Blank Cone
Posts: 45
Joined: 01 Mar 2008 01:49
Operating System: Windows
Location: Scottsdale, Az
Contact:

Re: VideoLan.Interop a .Net libvlc 0.9.x wrapper

Postby Kairos » 22 Jul 2009 08:35

Just a warning, I've started adding in the new 1.0.0 functionality into this wrapper. So if your going to use the 1.0.0 branch on my svn then just be aware its still in development.

shultas
New Cone
New Cone
Posts: 1
Joined: 24 Jul 2009 17:37

Re: VideoLan.Interop a .Net libvlc 0.9.x wrapper

Postby shultas » 24 Jul 2009 23:57

Hi There-

First off, awesome job on this wrapper! I spent days trying to figure out how to play a MPEG-4 file (I'm a newb, I suck at this point), but about 10 minutes getting it to work with your library, so thank you!

I have a question. I have adapted it to work with two video windows side by side for an application I am trying to write. Basically lets the user load two files and play them back at the same time so they can analyze them side by side. It works pretty good for the most part. On occasion if I call things such as "VlcPlayer.WillPlay" (if a video is loaded or not loaded) it will crash the app and tell me something about it couldn't read protected memory. Those little kinks I can work out, but there is one thing I just cannot figure out.

I have two instances of the VideoLanClient and VlcMediaPlayer, one for each Panel/Video Window. The Player.Mute = true, and = false does not work properly all the time for me. I have two buttons on my form, all they do is "VlcPlayerLeftWindow.Audio.Mute = !VlcPlayerLeftWindow.Audio.Mute". I press play, the videos begin to play, and I press the mute button. Sometimes it works, sometimes it does not. I've found that if you click like a mad man in different combinations, it will get it to start working again. The other issue that I am having ... I only want audio from the first VlcPlayer to be heard. I have a Play button. On the play button it calls VlcPlayerLeftWindow.Play(); then VlcPlayerRightWindow.Play(); If I set VlcPlayerRightWindow.Audio.Mute = true in this code event, the audio mutes for both players. However, if I put a Thread.Sleep(1000) in there, causing the program to wait for a second after the video starts playing, and then call Mute, it will mute only that one channel (most of the time). I cannot figure out what I am doing wrong, any help would be appreciated.

Here's what I've done:

VlcLeftWindow = new VideoLanClient();
VlcRightWindow = new VideoLanClient();
VlcPlayerLeftWindow = VlcLeftWindow.NewMediaPlayer(panelVideoLeftWindow.Handle);
VlcPlayerRightWindow = VlcRightWindow.NewMediaPlayer(panelVideoRightWindow.Handle);

-- Load Click Code, Left Window--
if (OpenFile.ShowDialog() == DialogResult.OK)
{
VlcMedia desc = VlcLeftWindow.NewMedia(OpenFile.FileName);
VlcPlayerLeftWindow.Load(desc);
desc.Dispose();
}

-- Load Click Code, Right Window--
if (OpenFile.ShowDialog() == DialogResult.OK)
{
VlcMedia desc = VlcRightWindow.NewMedia(OpenFile.FileName);
VlcPlayerRightWindow.Load(desc);
desc.Dispose();
}


-- Play Click Code ---
// if ( (VlcPlayerLeftWindow.WillPlay) && (VlcPlayerRightWindow.WillPlay)) // Took this line out, because it crashes the program when a file is not loaded.

VlcPlayerLeftWindow.Play();
VlcPlayerRightWindow.Play();
VlcPlayerRightWindow.Audio.Mute = true; // This causes audio from VlcPlayerLeftWindow AND VlcPlayerRightWindow to mute
// Thread.Sleep(1000);
// VlcPlayerRightWindow.Audio.Mute = true; // This sometimes works and will only mute the right window's associated audio

-- Mute Click Code, Left --
VlcPlayerLeftWindow.Audio.Mute = !VlcPlayerLeftWindow.Audio.Mute; // Sometimes works, sometimes it doesn't

--Mute Click Code, Right --
VlcPlayerRightWindow.Audio.Mute = !VlcPlayerRightWindow.Audio.Mute; // Sometimes works, sometimes it doesn't

EDIT: I also tried all of this by using only one VideoLanClient and still cannot get the audio to mute and unmute reliably.

Kairos
Blank Cone
Blank Cone
Posts: 45
Joined: 01 Mar 2008 01:49
Operating System: Windows
Location: Scottsdale, Az
Contact:

Re: VideoLan.Interop a .Net libvlc 0.9.x wrapper

Postby Kairos » 26 Jul 2009 19:39

Wow, a lot of problems. Your first problem is something I find out only after creating VideoLan.Interop, you can only create a single VideoLanClient object. Essentially the second object overwirites the first object and is the cause of the unexpected results. This could be the cause of many of the other problems like reading protected memory. To use multiple players, create a single VideoLanClient, and use that same object to create 2 VlcMediaPlayers.

Your second problem stems from the first problem. If you look at my code I sometimes call methods with p_media_player (pointer to a media player object) and other times p_instance (pointer to the vlc instance). When a method uses p_media_player, that method is specific to the media player you call it from. When a method uses p_instance then that method is global among all media player instances. Mute is one of those methods that uses p_instance, so it should mute all media players. Calling it twice like in your code should actually mute it first, then unmute it the second time.

ekennedy
Blank Cone
Blank Cone
Posts: 38
Joined: 18 Sep 2008 22:05
VLC version: 1.0
Operating System: Windows
Location: Texas

Re: VideoLan.Interop a .Net libvlc 0.9.x wrapper

Postby ekennedy » 28 Jul 2009 16:00

I just wrote a simple 100% native player using one of the tutorials in the wiki and even that one crashes after the first frame. Can anyone confirm that libvlc is actually working right now? I'm using Windows 7 64bit, but I also tried this in a virtual machine with Windows XP 32 with the same result. The normal VLC player works fine.
I built a wrapper using MFC (I can here the howling already!) and it's not crashing on WinXP or Vista 64-bit. I haven't tried Win7 yet. I'm planning on posting a sample somewhere soon.

I created a lib file from libvlc.dll then created a wrapper.

ed

Mongrel
Blank Cone
Blank Cone
Posts: 11
Joined: 12 Jul 2009 11:35

Re: VideoLan.Interop a .Net libvlc 0.9.x wrapper

Postby Mongrel » 28 Jul 2009 17:11

I just wrote a simple 100% native player using one of the tutorials in the wiki and even that one crashes after the first frame. Can anyone confirm that libvlc is actually working right now? I'm using Windows 7 64bit, but I also tried this in a virtual machine with Windows XP 32 with the same result. The normal VLC player works fine.
I built a wrapper using MFC (I can here the howling already!) and it's not crashing on WinXP or Vista 64-bit. I haven't tried Win7 yet. I'm planning on posting a sample somewhere soon.

I created a lib file from libvlc.dll then created a wrapper.

ed
The issue with the crashes has been resolved already. Adding the "plugin-path" option to libvlc makes it really unstable. Removing it is the way to go.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 4 guests