visualizations with libvlc.dll and .Net Interface

All you've ever wanted to know about the ActiveX, Mozilla plugins, the web interface and various PHP extensions
lazaruz
Blank Cone
Blank Cone
Posts: 16
Joined: 01 May 2007 09:48

visualizations with libvlc.dll and .Net Interface

Postby lazaruz » 10 May 2007 09:08

Anyone got the visualizations to work with Tappens .Net Interface?

If I run a usual command-line with VLC it works fine:

Code: Select all

vlc test.mp3 --audio-visual=goom
But I can't get it going with Tappens .Net Interface, I tried this when loading the file:

Code: Select all

vlcUserControl1.AddAndPlay(filename, "audio-visual=goom");
And I tried this when the file was playing:

Code: Select all

vlcUserControl1.SetConfigVariable("audio-visual", "goom");
None of these are working, is it possible to run visualizations with the .NET Interface?

Goatee01
New Cone
New Cone
Posts: 3
Joined: 21 Apr 2007 07:38

Postby Goatee01 » 20 May 2007 13:10

I don't know if this will work for Tappens .NET Interface but try putting a colon (:) or double-dash(--) in front of the option.

Code: Select all

vlcUserControl1.AddAndPlay(filename, ":audio-visual=goom");
or

Code: Select all

vlcUserControl1.AddAndPlay(filename, "--audio-visual=goom");
I have been trying something similar using ActiveX control v2 with the playlist.add method with no luck so far. Only option I've managed to get working is the no-audio one.

There seems to be little support from people in forums unfortunately, people who have worked things out don't seem to be helping others and developers are far too busy (only usually 1 developer)

lazaruz
Blank Cone
Blank Cone
Posts: 16
Joined: 01 May 2007 09:48

Postby lazaruz » 20 May 2007 18:02

Nope, that didn't help

I'll keep trying...

sukhjinder
New Cone
New Cone
Posts: 6
Joined: 03 Aug 2007 14:40

Re: visualizations with libvlc.dll and .Net Interface

Postby sukhjinder » 09 Aug 2007 14:07

Please reply to this thread if you are able to get the Visualization working. My Requirements are also similar

Thanks

dionoea
Cone Master
Cone Master
Posts: 5157
Joined: 03 Dec 2003 23:09
Location: Paris, France

Re:

Postby dionoea » 09 Aug 2007 19:04

This should work: (I've never used the external VLC api so I could be wrong)

Code: Select all

vlcUserControl1.AddAndPlay(filename <some concatenation operator> " :audio-visual=goom");
Antoine Cellerier
dionoea
(Please do not use private messages for support questions)

ror27
New Cone
New Cone
Posts: 6
Joined: 11 Aug 2007 05:02
Operating System: Windows/GentooLinux
Contact:

Re: visualizations with libvlc.dll and .Net Interface

Postby ror27 » 11 Aug 2007 05:53

Hi there,

There's a slight bug in NativeLibVlc.cs - if you update the two functions as in the following:

Code: Select all

public VlcError GetConfigVariable(String name, out String value) { value = null; using (VlcObject vlc = new VlcObject(this.vlcHandle, ObjectType.VLC_OBJECT_VLC)) { if (IntPtr.Zero == vlc.SubObject) { return VlcError.NoObj; } IntPtr p_item = config_FindConfig(vlc.SubObject, name); if (IntPtr.Zero == p_item) { return VlcError.NoVar; } try { module_config_t mod = (module_config_t)Marshal.PtrToStructure(p_item, typeof(module_config_t)); switch (mod.i_type) { case CONFIG_ITEM.CONFIG_ITEM_BOOL: { bool result = (__config_GetInt(vlc.SubObject, name) == 0); value = result.ToString(); } break; case CONFIG_ITEM.CONFIG_ITEM_INTEGER: { int intResult = __config_GetInt(vlc.SubObject, name); value = intResult.ToString(); } break; case CONFIG_ITEM.CONFIG_ITEM_FLOAT: { float floatResult = __config_GetFloat(vlc.SubObject, name); value = floatResult.ToString(); } break; case CONFIG_ITEM.CONFIG_ITEM_DIRECTORY: case CONFIG_ITEM.CONFIG_ITEM_FILE: case CONFIG_ITEM.CONFIG_ITEM_MODULE: case CONFIG_ITEM.CONFIG_ITEM_STRING: value = __config_GetPsz(vlc.SubObject, name); break; default: return VlcError.BadVar; } } catch (Exception e) { this.lastErrorMessage = e.Message; return VlcError.Exception; } } return VlcError.Success; } public VlcError SetConfigVariable(String name, String value) { using (VlcObject vlc = new VlcObject(this.vlcHandle, ObjectType.VLC_OBJECT_VLC)) { if (IntPtr.Zero == vlc.SubObject) { return VlcError.NoObj; } IntPtr p_item = config_FindConfig(vlc.SubObject, name); if (IntPtr.Zero == p_item) { return VlcError.NoVar; } try { module_config_t mod = (module_config_t)Marshal.PtrToStructure(p_item, typeof(module_config_t)); switch (mod.i_type) { case CONFIG_ITEM.CONFIG_ITEM_BOOL: { bool boolResult; if (Boolean.TryParse(value, out boolResult)) { __config_PutInt(vlc.SubObject, name, boolResult ? 1 : 0); } else { return VlcError.BadVar; } } break; case CONFIG_ITEM.CONFIG_ITEM_INTEGER: { int intResult; if (Int32.TryParse(value, out intResult)) { __config_PutInt(vlc.SubObject, name, intResult); } else { return VlcError.BadVar; } } break; case CONFIG_ITEM.CONFIG_ITEM_FLOAT: { float floatResult; if (Single.TryParse(value, out floatResult)) { __config_PutFloat(vlc.SubObject, name, floatResult); } else { return VlcError.BadVar; } } break; case CONFIG_ITEM.CONFIG_ITEM_DIRECTORY: case CONFIG_ITEM.CONFIG_ITEM_FILE: case CONFIG_ITEM.CONFIG_ITEM_MODULE: case CONFIG_ITEM.CONFIG_ITEM_STRING: __config_PutPsz(vlc.SubObject, name, value); break; default: return VlcError.BadVar; } } catch (Exception e) { this.lastErrorMessage = e.Message; return VlcError.Exception; } } return VlcError.Success; }
Then something like:

Code: Select all

vlcUserControl1.AddToPlayList("C:\something.mp3", "", "".Split('\n')); vlcUserControl1.SetConfigVariable("audio-visual", "goom"); vlcUserControl1.Play();
Should work.

sukhjinder
New Cone
New Cone
Posts: 6
Joined: 03 Aug 2007 14:40

Re: visualizations with libvlc.dll and .Net Interface

Postby sukhjinder » 11 Aug 2007 17:07

Thanks Man. The thing works. Now I know where to look forward. The visualisation code you provided works just after adding some track to playlist and then calling it before calling play. I tried to set the config variable much After the playback has begun. As expected nothing happened. I guess it only works if I set the variables before playing the media. Now there has to be some way to do that even after the playback has begun. One solution which comes to my mind is that we can save the current playing status then Pause/Stop the playback, set the cariable and then Resume the Playback. I think it should work. Your Ideas/thoughts. I'll try it and post if successfull.

Thanks Everybody...

ror27
New Cone
New Cone
Posts: 6
Joined: 11 Aug 2007 05:02
Operating System: Windows/GentooLinux
Contact:

Re: visualizations with libvlc.dll and .Net Interface

Postby ror27 » 12 Aug 2007 03:41

I thought as much, in fact I wanted the ability to be able to change the active Visualization halfway through - seems a reasonable enough idea.

However after much experimentation it appears that once the Visualization plugin is loaded, it is loaded apparently and can't be changed regardless of what state you put the control into.

No matter I thought, I'd save the current play state - including position - destroy the control and create a new one, setting the visualization then restoring the state.

Nice theory. However upon running the code I was immediately greeted with one of Redmond's finest bluescreens. Double-checked everything, yes I was properly disposing everything and giving it all time to cleanup. After settling in for a reluctant minidump analysis session, it appears for strange reasons relating to the Interop library that all sorts of weird garbage collecting race conditions conspire to cause simultaneous allocation and deallocation of the video buffer in the same thread, causing my graphics driver (nVidia Forceware) to get confused and keel over.

Basically creating a new control is not the way to go. There does appear to be a proper way of dynamically signalling VLC to reload the visualization plugin, which evidently the VLC Player itself uses to allow the user to change the Visualization midway through, but there's nothing obvious exposed through libvlc.

Even if someone does clarify the above, or an obscure bug is fixed, I am of the opinion that for a given media file (and thus instance of VLC) the content will either be with or without video. Hence you will either want or won't want a visualization - i.e. set or don't set a visualization at the start and leave it that way, who would want to use anything other than goom anyway?

renancardfg
New Cone
New Cone
Posts: 1
Joined: 17 May 2011 19:11

Re: visualizations with libvlc.dll and .Net Interface

Postby renancardfg » 17 May 2011 19:19

Nope, that didn't help


Return to “Web and scripting”

Who is online

Users browsing this forum: No registered users and 15 guests