LibVLC.NET in GTK #
ich benutzeLibVLC.NET Wrapper in GTK #. Und ich habe bereits ein Video mit diesem Beispiel abgespielt:
LibVLCLibrary library = LibVLCLibrary.Load(null);
IntPtr inst, mp, m;
inst = library.libvlc_new(); // Load the VLC engine
m = library.libvlc_media_new_location(inst, "path/to/your/file"); // Create a new item
mp = library.libvlc_media_player_new_from_media(m); // Create a media player playing environement
library.libvlc_media_release(m); // No need to keep the media now
library.libvlc_media_player_play(mp); // play the media_player
Thread.Sleep(10000); // Let it play a bit
library.libvlc_media_player_stop(mp); // Stop playing
library.libvlc_media_player_release(mp); // Free the media_player
library.libvlc_release(inst);
LibVLCLibrary.Free(library);
Aber das Video, das in einem anderen neuen Fenster spielt, jetzt muss ich Fenster oder (besser) Behälter in GTK # einstellen, das Video spielt. Wie soll ich das machen?
Aktualisieren: Ich habe diese Funktion in LibVLC.NET gefunden:
//==========================================================================
// void libvlc_video_set_format_callbacks (libvlc_media_player_t *mp, libvlc_video_format_cb setup, libvlc_video_cleanup_cb cleanup)
//==========================================================================
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate uint libvlc_video_format_cb(ref IntPtr opaque, ref uint chroma, ref uint width, ref uint height, ref uint pitches, ref uint lines);
//==========================================================================
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void libvlc_video_cleanup_cb(IntPtr opaque);
//==========================================================================
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate void libvlc_video_set_format_callbacks_signature(IntPtr mp, libvlc_video_format_cb setup, libvlc_video_cleanup_cb cleanup);
//==========================================================================
private readonly libvlc_video_set_format_callbacks_signature m_libvlc_video_set_format_callbacks;
//==========================================================================
public void libvlc_video_set_format_callbacks(IntPtr mp, libvlc_video_format_cb setup, libvlc_video_cleanup_cb cleanup)
{
VerifyAccess();
m_libvlc_video_set_format_callbacks(mp, setup, cleanup);
}
/*
void libvlc_media_player_set_nsobject (libvlc_media_player_t *p_mi, void *drawable)
void * libvlc_media_player_get_nsobject (libvlc_media_player_t *p_mi)
void libvlc_media_player_set_agl (libvlc_media_player_t *p_mi, uint32_t drawable)
uint32_t libvlc_media_player_get_agl (libvlc_media_player_t *p_mi)
void libvlc_media_player_set_xwindow (libvlc_media_player_t *p_mi, uint32_t drawable)
uint32_t libvlc_media_player_get_xwindow (libvlc_media_player_t *p_mi)
void libvlc_media_player_set_hwnd (libvlc_media_player_t *p_mi, void *drawable)
void * libvlc_media_player_get_hwnd (libvlc_media_player_t *p_mi)
*/
In den Kommentaren wird libvlc_media_player_set_hwnd () erwähnt. Kann diese Funktion sie irgendwie ersetzen oder Zugriff auf dieselben Möglichkeiten wie libvlc_media_player_set_hwnd () gewähren?