Page 1 of 1

Multiple instances with vmem issue

Posted: 24 Nov 2008 20:16
by versor
Hi,

I'm trying to use libvlc as a frame server in my application. I use vmem to obtain frame data. LibVlc is initialized with something like this:

Code: Select all

argv = new string[]{ "--ignore-config", "--no-video-title-show", "--vout", "vmem", "--vmem-width", videoWidth.ToString(), "--vmem-height", videoHeight.ToString(), "--vmem-pitch", (videoWidth * BYTES_PER_PIXEL).ToString(), "--vmem-chroma", "RV32", "--vmem-lock", Marshal.GetFunctionPointerForDelegate(lock_delegate).ToInt64().ToString(), "--vmem-unlock", Marshal.GetFunctionPointerForDelegate(unlock_delegate).ToInt64().ToString() }; handle = libvlc_new(argv.Length, argv, exception);
When I'm using single instance, everything seems to be fine. However when i'm trying to make few instances of libvlc (making one after another instantly) all instances are using same callback address for vmem-lock and unlock.
In other words vmem is calling address of the function that it shouldn't be (one that is used with different libvlc instance).

Re: Multiple instances with vmem issue

Posted: 28 Nov 2008 17:38
by erwan10
I experienced the same problem. The thing is that options passed to a new instance overwrite options from an older instance. I suppose this is eligible as a bug.

Re: Multiple instances with vmem issue

Posted: 29 Nov 2008 13:31
by Jean-Baptiste Kempf
Possibly. VMEM is still very new.

Re: Multiple instances with vmem issue

Posted: 29 Nov 2008 13:50
by VLC_help
Someone send patches to mailing list related to this.
http://mailman.videolan.org/pipermail/v ... 53443.html

Re: Multiple instances with vmem issue

Posted: 03 Dec 2008 15:07
by versor
Indeed vmem options are overwritten. I resolved this by adding extra command line parameter that specifies a callback on vmem initialization. Then in this callback I set all the parameters instead of taking ones from command line.

I've looked into mailing list VLC_help suggested, but I still see problem with this solution. Generally we define video size before vmem initialization, so there is no way to use native video dimensions (because we don't know them before initialization).