Ce sujet est résolu.
1 | |||||||
Auteur | Messages | ||||||
---|---|---|---|---|---|---|---|
valaquarus | #1 Posté le 14/8/2024 à 16:47:14 | ||||||
-- Unus Ex Altera -- | Bonjour, Que faut il déclarer pour obtenir les informations de position pour que le slider soit en phase avec le déplacement dans le film?
Système d'exploitation : KDE neon 6.0 ~ Version Gambas : 3.19.5 | ||||||
vuott | #2 Posté le 14/8/2024 à 18:43:21 | ||||||
Ne cedere ineluctabili possimus | ...la fonction externe "vlc_player_GetPosition()" ne serait plus appropriée ? ...mais que devrait faire ou représenter le "Slider" ? « Vita non suavis esse potest, nec Mors amara. » | ||||||
valaquarus | #3 Posté le 14/8/2024 à 19:22:21 | ||||||
-- Unus Ex Altera -- | Bonsoir Vuott, je viens juste de rentrer de la promenade de mon chien. le slider doit permettre de se déplacer dans le film. Comment déclare t on, ceci Private Extern vlc_player_GetPosition(p_mi As Pointer) As Integer ne fonctionne pas. j'ai fait ça qui ne veut pas fonctionner :
Système d'exploitation : KDE neon 6.0 ~ Version Gambas : 3.19.5 | ||||||
vuott | #4 Posté le 14/8/2024 à 21:15:29 | ||||||
Ne cedere ineluctabili possimus |
Bonsoir Valaquarus, Attention, la déclaration formelle de cette fonction externe est la suivante : static void vlc_player_SetPosition (vlc_player_t *player, double position) ...ce qui, en Gambas, devient :
« Vita non suavis esse potest, nec Mors amara. » | ||||||
vuott | #5 Posté le 14/8/2024 à 21:45:27 | ||||||
Ne cedere ineluctabili possimus | uhmmm... j'ai fait un test, et j'ai reçu un avertissement comme quoi la fonction externe 'vlc_player_SetPosition()' n'est pas présente dans la bibliothèque de libvlc.so.5.6.1 « Vita non suavis esse potest, nec Mors amara. » | ||||||
vuott | #6 Posté le 14/8/2024 à 21:57:56 | ||||||
Ne cedere ineluctabili possimus | J'ai cette fonction externe: "libvlc_media_player_set_position()". « Vita non suavis esse potest, nec Mors amara. » | ||||||
vuott | #7 Posté le 14/8/2024 à 22:42:34 | ||||||
Ne cedere ineluctabili possimus | La fonction "libvlc_media_player_set_position()", cependant, ne fonctionne pas pour moi, et j'ai appris sur le web que d'autres programmeurs se plaignaient de problèmes avec cette fonction de libvlc. Il faut donc utiliser la fonction externe « libvlc_media_player_set_time(libvlc_media_player_t *p_mi, libvlc_time_t i_time) », qui sera déclarée de manière formelle dans Gambas :
Vous trouverez ci-dessous un exemple de ce que vous souhaitez réaliser avec le « Slider »: ---------[codex]--------- Private inst As Pointer Private mp As Pointer Private m As Pointer Library "libvlc:5" Private Enum libvlc_NothingSpecial = 0, libvlc_Opening, libvlc_Buffering, libvlc_Playing, libvlc_Paused, libvlc_Stopped, libvlc_Ended, libvlc_Error ' libvlc_instance_t * libvlc_new (int argc, const char *const *argv) ' Create And initialize a libvlc instance. Private Extern libvlc_new(argc As Integer, argv As String[]) As Pointer ' libvlc_media_t * libvlc_media_new_path (libvlc_instance_t *p_instance, const char *path) ' Create a media for a certain file path. Private Extern libvlc_media_new_path(p_instance As Pointer, path As String) As Pointer ' libvlc_media_player_t * libvlc_media_player_new_from_media (libvlc_media_t *p_md) ' Create a Media Player object from a Media. Private Extern libvlc_media_player_new_from_media(p_md As Pointer) As Pointer ' void libvlc_media_player_set_xwindow (libvlc_media_player_t *p_mi, uint32_t drawable) ' Set an X Window System drawable where the media player should render its video output. Private Extern libvlc_media_player_set_xwindow(p_mi As Pointer, drawable As Integer) ' int libvlc_media_player_play (libvlc_media_player_t * p_mi) ' Play the video file. Private Extern libvlc_media_player_play(p_mi As Pointer) As Integer ' void libvlc_media_player_stop (libvlc_media_player_t * p_mi) ' Stop the video file Private Extern libvlc_media_player_stop(p_mi As Pointer) ' libvlc_time_t libvlc_media_player_get_length(libvlc_media_player_t *, libvlc_exception_t *) ' Get the current movie length (in ms). Private Extern libvlc_media_player_get_length(p_mi As Pointer, l_ex As Pointer) As Integer ' libvlc_time_t libvlc_media_player_get_time(libvlc_media_player_t * p_mi) ' Get the current movie time (in ms). Private Extern libvlc_media_player_get_time(p_mi As Pointer) As Integer ' libvlc_state_t libvlc_media_player_get_state(libvlc_media_player_t *p_mi) ' Get current movie state. Private Extern libvlc_media_player_get_state(p_mi As Pointer) As Integer ' void libvlc_media_player_pause (libvlc_media_player_t *p_mi) ' Toggle pause. Private Extern libvlc_media_player_pause(p_mi As Pointer) ' void libvlc_media_player_set_time (libvlc_media_player_t *p_mi, libvlc_time_t i_time) ' Set the movie time (in ms). Private Extern libvlc_media_player_set_time(player As Pointer, i_time As Long) ' void libvlc_media_player_release (libvlc_media_player_t * p_mi) ' Release a media_player after use Decrement the reference count of a media player object. Private Extern libvlc_media_player_release(p_mi As Pointer) ' void libvlc_media_release (libvlc_media_t *p_md) ' Decrement the reference count of a media descriptor object. Private Extern libvlc_media_release(p_md As Pointer) ' libvlc_release (libvlc_instance_t * p_instance) ' Decrement the reference count of a libvlc instance, and destroy it if it reaches zero. Private Extern libvlc_release(p_instance As Pointer) Public Sub Form_Open() With Slider1 .MaxValue = 100 .MinValue = 0 .Value = 0 End With End Public Sub Button1_Click() Slider1.Value = 0 inst = libvlc_new(0, Null) m = libvlc_media_new_path(inst, "/chemin/du/fichier/vidéo") mp = libvlc_media_player_new_from_media(m) libvlc_media_player_set_xwindow(mp, DrawingArea1.Id) libvlc_media_player_play(mp) Repeat Wait 0.01 Until libvlc_media_player_get_length(mp, 0) > 0.0 Repeat Me.Title = "Durée: " & Str(Time(0, 0, 0, libvlc_media_player_get_length(mp, 0))) & " - " & Str(Time(0, 0, 0, libvlc_media_player_get_time(mp))) ProgressBar1.Value = libvlc_media_player_get_time(mp) / libvlc_media_player_get_length(mp, 0) Wait 0.01 Until libvlc_media_player_get_state(mp) > libvlc_Paused Claudit() End Public Sub Button2_Click() libvlc_media_player_stop(mp) DrawingArea1.Clear End Private Procedure Claudit() libvlc_media_player_release(mp) libvlc_media_release(m) libvlc_release(inst) End Public Sub ToggleButton1_Click() libvlc_media_player_pause(mp) End Public Sub Slider1_Change() libvlc_media_player_set_time(mp, (Slider1.Value * libvlc_media_player_get_length(mp, 0)) / 100) End ---------[/codex]--------- « Vita non suavis esse potest, nec Mors amara. » | ||||||
valaquarus | #8 Posté le 15/8/2024 à 08:28:58 | ||||||
-- Unus Ex Altera -- | Bonjour Vuott, Ça marche effectivement avec ces deux fonctions :
et
Encore une réussite à mettre à votre compte et un grand merci. J'ai rassemblé mes deux tests Gstreamer et VLC en un seul logiciel qui semble vouloir bien fonctionner. Je continue à le tester et le mettrai sur la forge dès que j'aurais fini la partie Aide qui n'est pas encore bien développée. Omicron Kappa, my Dear one. Un petit ajout car tout n'est pas rose et j'ai ces erreurs gênantes dans la console que je n'avais pas : [000072ecc18b0cc0] main decoder error: Timestamp conversion failed for 230922449: no reference clock [000072ecc18b0cc0] main decoder error: Could not convert timestamp 0 for faad [000072ecc14a9dc0] main decoder error: Timestamp conversion failed for 230958334: no reference clock [000072ecc14a9dc0] main decoder error: Could not convert timestamp 0 for dav1d [000072ecc14a9dc0] main decoder error: buffer deadlock prevented [000072ecc18b0cc0] main decoder error: buffer deadlock prevented Il semble qu'il y ait un problème de clock qui fasse hoqueter la reproduction. Ciao Vuott. Correction faite, oublié ceci :
Système d'exploitation : KDE neon 6.0 ~ Version Gambas : 3.19.5 | ||||||
vuott | #9 Posté le 15/8/2024 à 15:05:10 | ||||||
Ne cedere ineluctabili possimus | j'ai complété mon code par l'utilisation d'un "ProgressBar". « Vita non suavis esse potest, nec Mors amara. » | ||||||
valaquarus | #10 Posté le 15/8/2024 à 15:59:45 | ||||||
-- Unus Ex Altera -- | Bonsoir Vuott, j'imagine que c'est pour remplacer le slider! Système d'exploitation : KDE neon 6.0 ~ Version Gambas : 3.19.5 | ||||||
vuott | #11 Posté le 15/8/2024 à 19:00:38 | ||||||
Ne cedere ineluctabili possimus | ...peut-être un Control plus cohérent dans ce cas. « Vita non suavis esse potest, nec Mors amara. » | ||||||
vuott | #12 Posté le 16/8/2024 à 01:51:09 | ||||||
Ne cedere ineluctabili possimus | j'imagine que c'est pour remplacer le slider! Uhmmmmm...... nam hunc codicem propono: ---------[codex]--------- Private inst As Pointer Private mp As Pointer Private m As Pointer Private bo As Boolean Library "libvlc:5" Private Enum libvlc_NothingSpecial = 0, libvlc_Opening, libvlc_Buffering, libvlc_Playing, libvlc_Paused, libvlc_Stopped, libvlc_Ended, libvlc_Error ' libvlc_instance_t * libvlc_new (int argc, const char *const *argv) ' Create And initialize a libvlc instance. Private Extern libvlc_new(argc As Integer, argv As String[]) As Pointer ' libvlc_media_t * libvlc_media_new_path (libvlc_instance_t *p_instance, const char *path) ' Create a media for a certain file path. Private Extern libvlc_media_new_path(p_instance As Pointer, path As String) As Pointer ' libvlc_media_player_t * libvlc_media_player_new_from_media (libvlc_media_t *p_md) ' Create a Media Player object from a Media. Private Extern libvlc_media_player_new_from_media(p_md As Pointer) As Pointer ' void libvlc_media_player_set_xwindow (libvlc_media_player_t *p_mi, uint32_t drawable) ' Set an X Window System drawable where the media player should render its video output. Private Extern libvlc_media_player_set_xwindow(p_mi As Pointer, drawable As Integer) ' int libvlc_media_player_play (libvlc_media_player_t * p_mi) ' Play the video file. Private Extern libvlc_media_player_play(p_mi As Pointer) As Integer ' void libvlc_media_player_stop (libvlc_media_player_t * p_mi) ' Stop the video file Private Extern libvlc_media_player_stop(p_mi As Pointer) ' libvlc_time_t libvlc_media_player_get_length(libvlc_media_player_t *, libvlc_exception_t *) ' Get the current movie length (in ms). Private Extern libvlc_media_player_get_length(p_mi As Pointer, l_ex As Pointer) As Integer ' libvlc_time_t libvlc_media_player_get_time(libvlc_media_player_t * p_mi) ' Get the current movie time (in ms). Private Extern libvlc_media_player_get_time(p_mi As Pointer) As Integer ' libvlc_state_t libvlc_media_player_get_state(libvlc_media_player_t *p_mi) ' Get current movie state. Private Extern libvlc_media_player_get_state(p_mi As Pointer) As Integer ' void libvlc_media_player_pause (libvlc_media_player_t *p_mi) ' Toggle pause. Private Extern libvlc_media_player_pause(p_mi As Pointer) ' void libvlc_media_player_set_time (libvlc_media_player_t *p_mi, libvlc_time_t i_time) ' Set the movie time (in ms). Private Extern libvlc_media_player_set_time(player As Pointer, i_time As Long) ' void libvlc_media_player_release (libvlc_media_player_t * p_mi) ' Release a media_player after use Decrement the reference count of a media player object. Private Extern libvlc_media_player_release(p_mi As Pointer) ' void libvlc_media_release (libvlc_media_t *p_md) ' Decrement the reference count of a media descriptor object. Private Extern libvlc_media_release(p_md As Pointer) ' libvlc_release (libvlc_instance_t * p_instance) ' Decrement the reference count of a libvlc instance, and destroy it if it reaches zero. Private Extern libvlc_release(p_instance As Pointer) Public Sub Form_Open() With Slider1 .MaxValue = 100 .MinValue = 0 .Value = 0 End With End Public Sub Button1_Click() Slider1.Value = 0 inst = libvlc_new(0, Null) m = libvlc_media_new_path(inst, "/chemin/du/fichier/vidéo") mp = libvlc_media_player_new_from_media(m) libvlc_media_player_set_xwindow(mp, DrawingArea1.Id) libvlc_media_player_play(mp) Repeat Wait 0.01 Until libvlc_media_player_get_length(mp, 0) > 0.0 Repeat Me.Title = "Durée: " & Str(Time(0, 0, 0, libvlc_media_player_get_length(mp, 0))) & " - " & Str(Time(0, 0, 0, libvlc_media_player_get_time(mp))) ProgressBar1.Value = libvlc_media_player_get_time(mp) / libvlc_media_player_get_length(mp, 0) If Not bo Then Slider1.Value = ProgressBar1.Value * 100 Wait 0.01 Until libvlc_media_player_get_state(mp) > libvlc_Paused Claudit() End Public Sub Button2_Click() libvlc_media_player_stop(mp) DrawingArea1.Clear End Private Procedure Claudit() libvlc_media_player_release(mp) libvlc_media_release(m) libvlc_release(inst) End Public Sub ToggleButton1_Click() libvlc_media_player_pause(mp) End Public Sub Slider1_MouseDown() bo = True End Public Sub Slider1_MouseUp() bo = False libvlc_media_player_set_time(mp, (Slider1.Value * libvlc_media_player_get_length(mp, 0)) / 100) End ---------[/codex]--------- « Vita non suavis esse potest, nec Mors amara. » | ||||||
valaquarus | #13 Posté le 16/8/2024 à 14:19:57 | ||||||
-- Unus Ex Altera -- | Voici le code avec le défilement du slider en lecture de vidéos, internet comme locales.
J'avoue que je n'aime pas les progressBar mais ce n'est pas important. Système d'exploitation : KDE neon 6.0 ~ Version Gambas : 3.19.5 | ||||||
1 |