[vlc-devel] libvlc Issues and Questions

mlist at marxbitware.com mlist at marxbitware.com
Sun Jun 15 15:41:51 CEST 2008


I released a full sample of the wrapper yesterday on the forum.  A
backtrace only goes as far as my .NET code, I'm following the stack to
identify the problem because I'm using compiled DLLs from the nightly
build.

Here is a link to the forum thread:

http://forum.videolan.org/viewtopic.php?f=14&t=47385


Here is a link to VS2005 solution I included in the thread, download
it an uncomment the cdda string to replicate:

http://www.2shared.com/file/3435685/4dd1ef7b/Marx_libvlc_wrapper.html


The calling code looks like this:

Program.cs (Marx_libvlc_wrapper_test)

              string link = "cdda://E:";


              IntPtr hDT = Win32.GetDesktopWindowHandle();
              string[] argv = new string[] { "-I", "dummy",  
"--ignore-config" };
              libvlc_exception_struct ex = new libvlc_exception_struct();

              //Create new libvlc instance, media instance from file
and media player instance from media
              Marx_libvlc_exception exClass = new  
Marx_libvlc_exception(ref ex);
              Marx_libvlc_core libvlc_core = new  
Marx_libvlc_core(argv, ref ex);
              Marx_libvlc_media libvlc_media = new
Marx_libvlc_media(libvlc_core.Handle, link, ref ex);
              Marx_libvlc_media_player libvlc_media_player = new
Marx_libvlc_media_player(libvlc_media.Handle, ref ex);

              //Dispose of media Handle and force garbage collection
              libvlc_media.Handle.Dispose();
              GC.Collect();
              libvlc_media = null;

              //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);
              libvlc_media_player.play(ref ex);

              //Wait for input (play for a while)
              Console.ReadKey();

This is passed to a class from the wrapper.  I include both functions here:

Marx_libvlc_media_player (Marx_libvlc_wrapper)


          public void video_set_parent(Marx_libvlc_core_handle
libvlc_core_handle, IntPtr hDT, ref libvlc_exception_struct ex)
          {
              libvlc_video_set_parent(libvlc_core_handle, hDT, ref ex);
          }

          public int will_play(ref libvlc_exception_struct ex)
          {
              return
libvlc_media_player_will_play(libvlc_media_player_handle, ref ex);
          }


This is then passed to InterOp:

[DllImport("libvlc")]
private static extern int
libvlc_video_set_parent(Marx_libvlc_core_handle libvlc_core_handle,
IntPtr Hwnd, ref libvlc_exception_struct ex);


[DllImport("libvlc")]
private static extern void
libvlc_media_player_play(Marx_libvlc_media_player_handle
libvlc_media_player_handle, ref libvlc_exception_struct ex);


As I mentioned, there are no coding issues in the wrapper and it works
fine with vlc-0.9.0-git-20080609-0004-win32.

Its only the recent builds (last few days) that cause these issues and
the stack traces show the problems are not in my code.




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


>>
>>>> 2.  CDDA / DVDSimple / VCD
>>>>
>>>> In the latest builds none of these work (eg. "CDDA://E:", etc).  In
>>>> fact, in last nights build attempting to load any media results in
>>>> an
>>>> exception in both libvlc_video_set_parent and
>>>> libvlc_media_player_set_drawable.
>>>
>>> No idea.
>>>
>>
>> I'll stick to last night's build.  When calling
>> libvlc_media_player_play, to play a CD (cdda://E:) it triggers an
>> error.  I can trace the issue to libcdda_plugin.dll and an unhandled
>> exception.
>>
>> As for libvlc_video_set_parent, this was working on the nightly build
>> done on the 9th, now it results in the following error:
>>
>> "Attempted to read or write protected memory. This is often an
>> indication that other memory is corrupt."
>>
>> I checked all the inputs and they're fine and switching back to a
>> earlier build corrects the issue.
>
> Do you have a backtrace? I did change a bit the code. Also, a full
> code sample would be nice.
>
>>>> 3.  Setting the Output Window
>>>>
>>>> libvlc_media_player_set_drawable does not function.
>>>
>>> What version are you using? The good thing would be to provide a
>>> sample code. It is highly probable that your video_output does not
>>> support reading the "drawable" variable. We could look forward to fix
>>> that.
>>>
>>
>> I'm just wrapping the API.  It calls this:
>>
>> libvlc_media_player_set_drawable(libvlc_media_player_handle,
>> window_handle, ref ex);
>>
>> The drawable variable is passed as an IntPtr (just an Int).
>
> That would be nice to have a *full* (but small) C or .NET program that
> exhibit how you proceed.
>
>>>> 5.  Getting the length of currently playing media
>>>>
>>>> There doesn't appear to be a media_player function for this.
>>>
>>> I think there is a libvlc_media function.
>>>
>
> libvlc_media_player_get_length()
>
>>
>>>> 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?
>>>
>>> There is no next, previous because it is not a media_list_player.
>>> However with input that do provide menus and track, such as a dvd you
>>> should be able to use set_chapter(), etc.
>>>
>>
>> Ok, that makes sense.  I notice that VLC has the ability to populate
>> playlists with the contents of a CD or DVD.  Is this just a matter of
>> using the API, or do I need to write my own code?
>
> You should be able to use the media_list API for that.
>
>>>> 7.  Visualisations
>>>>
>>>> Unable to locate functions to enable this when playing a stream or
>>>> mp3.
>>>
>>> Unfortunately there isn't, appart if you pass the right vlc args to
>>> libvlc or to libvlc_media_add_option.
>>>
>>
>> Do you have the options, or where I can find a list???
>
> vlc --long-help or something like that.
>
>>>> 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.
>>>>
>>
>> I'm assuming this is the vout issue that you mentioned.
>
> Well, I have no idea here.  You'll have to digg a bit.
>
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> http://mailman.videolan.org/listinfo/vlc-devel
>




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





More information about the vlc-devel mailing list