[Gambas-user] Trying to use libmpv, but got Segmentation faults on exit
Koko
kokoko3k at ...626...
Fri Jan 16 12:58:21 CET 2015
Hi,
among other problems that i did not solved, but at least worked around,
there is one i cannot solve by myself, nor i know if it is a bug in gambas
or a mistake by myself.
libmpv is a library to access mpv mediaplayer, the library header is here:
https://raw.githubusercontent.com/mpv-player/mpv/master/libmpv/client.h
Basically, what i do is:
'============================================
' Gambas class file
Extern mpv_create() As Pointer In "libmpv:1"
Extern mpv_initialize(Pmpv_handle As Pointer) As Integer In "libmpv:1"
Extern mpv_detach_destroy(Pmpv_handle As Pointer) In "libmpv:1"
Extern mpv_terminate_destroy(Pmpv_handle As Pointer) In "libmpv:1"
Extern mpv_command_string(Pmpv_handle As Pointer, args As String) As Integer
In "libmpv:1"
Public Pmpv_handle As Pointer
Public Sub Form_Open()
Pmpv_handle = mpv_create()
mpv_initialize(Pmpv_handle)
Pmpv_handle = mpv_create()
mpv_initialize(Pmpv_handle)
mpv_command_string(Pmpv_handle, "loadfile /path/to/videofile.mkv")
End
Public Sub Button1_Click()
mpv_command_string(Pmpv_handle, "quit")
Wait 10
mpv_terminate_destroy(Pmpv_handle)
End
'============================================
That's it.
The program starts and begin playing the file.
As i push the button, it stops playing and the player window will close,
but as soon as i close the main form, the gambas interpreter shows a window
saying the program crashed wuth a segmentation fault.
This is the kernel message:
traps: gbx3[16400] general protection ip:7f17cdb9c824 sp:7fffff2682a0
error:0 in libpthread-2.20.so[7f17cdb93000+17000]
Thanks to anyone who can spot a light on this issue.
--
Antonio Orefice
More information about the User
mailing list