[vlc-devel] libvlc Issues and Questions

mlist at marxbitware.com mlist at marxbitware.com
Sun Jun 15 17:27:37 CEST 2008

I will reply to everyone in this single email.

Quoting Rov Juvano <rovjuvano at users.sourceforge.net>:

> On Sun, Jun 15, 2008 at 07:59:56PM +1000, mlist at marxbitware.com wrote:
>> 4.  Getting Current Position
>> libvlc_media_player_get_position returns 0.
> It's just passing along the information.  Something lower
> down is returning 0. demuxer? decoder?  To see what objects
> are used, increase the verosbity with libvlc_set_log_verbosity
> or if you can compile against the source, include vlc_object.h
> and use vlc_object_dump( p_libvlc ).
>> 5.  Getting the length of currently playing media
>> There doesn't appear to be a media_player function for this.
> What about libvlc_media_player_get_length or libvlc_media_get_duration?

I just spotted that in my code.  I have it on my TODO list.

>> 6.  Media_player Navigation
>> Unable to locate Next, Previous, etc.  Is there a different
>> interface???  I've seen set_chapter() and and audio_set_track(), must
>> these be used instead?
> libvlc_media_list_player_next

Ok, so I must setup a media_list first.  That seems straightforward enough.

>> 8.  Stop does not function as expected
>> In previous versions of the libvlc API, calling the stop function
>> would return the output window to its previous state.
>> libvlc_media_player_stop has the effect of leaving the loaded media in
>> the window frozen at the point when it was called.
> Same here.

Good to know I'm not alone. :)

>> 9. libvlc_release()
>> Calling this results in an exception being generated.  It states that
>> libvlc was asked to quit in an unexpected fashion.
> Are you attaching events?

Not at this stage.

> For me, glibc reports "double free or corruption" in    
> libvlc_event_manager_release
> Valgrind gives:
> ==3836== Invalid free() / delete / delete[]
> ==3836==    at 0x402265C: free (vg_replace_malloc.c:323)
> ==3836==    by 0x4646649: libvlc_event_manager_release (event.c:107)
> ==3836==    by 0x4649B47: libvlc_media_player_release (media_player.c:494)
> ==3836==  Address 0x7b888b0 is 0 bytes inside a block of size 16 free'd
> ==3836==    at 0x402265C: free (vg_replace_malloc.c:323)
> ==3836==    by 0x4646619: libvlc_event_manager_release (event.c:104)
> ==3836==    by 0x4649B47: libvlc_media_player_release (media_player.c:494)
> If I detach the events before releasing, all is well.

Even without events, it crashes saying it quit in an unexpected
manner.  I'm thinking that it may be to do with the vout issue...media
and window not being released on stop.

Quoting Pierre d'Herbemont <pdherbemont at free.fr>:

> On Jun 15, 2008, at 3:33 PM, mlist at marxbitware.com wrote:
>>           //Set the output Window and play (Commented out for test   
>>  purposes - throws an exception)
>> //libvlc_media_player.video_set_parent(libvlc_core.Handle, hDT, ref  
>>   ex);
> Could you try with libvlc_media_player.set_drawable(hDT, ref ex )?

I have tested it with two different nightly builds...

vlc-0.9.0-git-20080609-0004-win32 (Creates a new window, does not bind
to given handle)

vlc-0.9.0-git-20080615-0148-win32 (Crashes - "Attempted to read or
write protected memory. This is often an
indication that other memory is corrupt.")

I have seen this error a few times.  Its a null reference exception,
in other words the object has not been created.  In previous cases, it
was due to some form of lag resulting in the calling statement being
executed before resources were allocated.  This was a multithreaded

In this case, it looks like the object is not being created at all.  I
base this on the fact that when I suspend my code, then restart it,
the object is still not present.

> What exception do we have here? The ideal would be to have a backtrace
> of libvlc... Else, I can't really help, given that there is nothing
> obvious.

The object is trying to pass variables to a location that has yet to
be allocated.

>> Its only the recent builds (last few days) that cause these issues   
>>  and the stack traces show the problems are not in my code.
> Whereas a stack trace doesn't indicate for sure where the problem can
> be from, it's could definitely be libvlc's fault. There are quite a few
> commits that could be responsible of that regression too.

I can eliminate my code from the line of inquiry...it doesn't do much
and exceptions would be caught by my debugger.  Once it is passed to
libvlc, that's when the issue occurs.  I can see no other DLLs in the
stack trace.

> Yet, Jean-Paul did report success using libvlc_video_set_parent() in
> the activeX bindings on Windows... (Is it still true?)
> Pierre.


Below is the stack trace.  I've stepped through the code and any
attempt to execute libvlc_set_parent() results in a crash.  Looking at
my code, this is executed right after

I've checked and the handle from libvlc_media_player_new_from_media()
is created.  Perhaps this function, or its memory locations are

System.AccessViolationException was unhandled
    Message="Attempted to read or write protected memory. This is often
an indication that other memory is corrupt."
Marx_libvlc_wrapper.Marx_libvlc_media_player.libvlc_video_set_parent(Marx_libvlc_core_handle libvlc_core_handle, IntPtr Hwnd,  
Marx_libvlc_wrapper.Marx_libvlc_media_player.video_set_parent(Marx_libvlc_core_handle libvlc_core_handle, IntPtr hDT, libvlc_exception_struct& ex) in  
         at MarxVLC.Form1.button1_Click(Object sender, EventArgs e) in
         at System.Windows.Forms.Control.OnClick(EventArgs e)
         at System.Windows.Forms.Button.OnClick(EventArgs e)
         at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
         at System.Windows.Forms.Control.WmMouseUp(Message& m,
MouseButtons button, Int32 clicks)
         at System.Windows.Forms.Control.WndProc(Message& m)
         at System.Windows.Forms.ButtonBase.WndProc(Message& m)
         at System.Windows.Forms.Button.WndProc(Message& m)
System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
         at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr
hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
         at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason,  
reason, ApplicationContext context)
reason, ApplicationContext context)
         at System.Windows.Forms.Application.Run(Form mainForm)
         at MarxVLC.Program.Main() in
         at System.AppDomain._nExecuteAssembly(Assembly assembly,  
String[] args)
         at System.AppDomain.ExecuteAssembly(String assemblyFile,
Evidence assemblySecurity, String[] args)
         at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
         at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
         at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
         at System.Threading.ThreadHelper.ThreadStart()

----- End forwarded message -----

More information about the vlc-devel mailing list