Belini Posted April 14, 2023 Share Posted April 14, 2023 (edited) Estou tentando esticar a tela do vídeo usando o UDF libvlc.au3 feito por @Genius257 e postado aqui https://www.autoitscript.com/forum/topic/185420-libvlc/ mas não consigo alterar o formato do vídeo para preencher a tela inteira, alguém sabe qual comando devo usar no libvlc.au3 para fazer o que preciso? test: https://mega.nz/file/oZtRmKhY#P_-Emf9I8fW5xyKIW9d--rhgJuT46zzt6RK9_gpEEXo Edited April 27, 2023 by Belini My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ Link to comment Share on other sites More sharing options...
genius257 Posted April 14, 2023 Share Posted April 14, 2023 Hi @Belini You seem to need some api calls not yet implemented in my libVLC wrapper library. (here) Specifically: libvlc_video_set_crop_ratio, libvlc_video_set_crop_window and/or libvlc_video_set_crop_border 2 notes to your original post: Please write in english? if you @ me correctly, i will get a notification of being mentioned in your post, and can respond sooner My highlighted topics: AutoIt Package Manager, AutoItObject Pure AutoIt, AutoIt extension for Visual Studio Code Github: AutoIt HTTP Server, AutoIt HTML Parser Link to comment Share on other sites More sharing options...
Belini Posted April 15, 2023 Author Share Posted April 15, 2023 (edited) @genius257 sorry for posting in my language because my automatic page translator was the one who made it go back to my language when I posted and I didn't realize it because it was in English when I created the topic and as for the functions I think what I need would not be to cut the video but yes fill the whole screen using libvlc_video_set_aspect_ratio() or maybe libvlc_video_set_scale but() I did several tests and I couldn't pass the right parameters using DllCall() Edited April 15, 2023 by Belini genius257 1 My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ Link to comment Share on other sites More sharing options...
Belini Posted April 15, 2023 Author Share Posted April 15, 2023 (edited) I found a place that talks about the libvlc_video_set_aspect_ratio() function https://cpp.hotexamples.com/site/file?hash=0xfd1b4e42ef6f77a17bd30057efc6288450f20538a13304e6a37ef1135ee591c1&fullName=kaffeine-master/src/vlcmediawidget.cpp&project=hiroshiyui/kaffeine even seeing the code I couldn't get the commands right void VlcMediaWidget::setAspectRatio(MediaWidget::AspectRatio aspectRatio) { // "", "1:1", "4:3", "5:4", 16:9", "16:10", "221:100", "235:100", "239:100" const char *vlcAspectRatio = ""; int vlcScaleFactor = 1; switch (aspectRatio) { case MediaWidget::AspectRatioAuto: break; case MediaWidget::AspectRatio4_3: vlcAspectRatio = "4:3"; break; case MediaWidget::AspectRatio16_9: vlcAspectRatio = "16:9"; break; case MediaWidget::AspectRatioWidget: // zero = adjust video to window vlcScaleFactor = 0; break; } libvlc_video_set_aspect_ratio(vlcMediaPlayer, vlcAspectRatio); libvlc_video_set_scale(vlcMediaPlayer, vlcScaleFactor); } My unsuccessful attempt: ( https://videolan.videolan.me/vlc/group__libvlc__video.html#ga07d2e26cfe070757339ba03927afec8a ) libvlc_video_set_aspect_ratio($hLibVLC_dll, $mp, "4:3") Func libvlc_video_set_aspect_ratio($hLibVLC_dll, $mp, $asp_ratio) $aRet = DllCall($hLibVLC_dll, "void:cdecl", "", "handle", $mp, "uint", $asp_ratio) If @error <> 0 Then Return SetError(@error, @extended, 0) Return $aRet[0] EndFunc ;==>libvlc_video_set_aspect_ratio Edited April 15, 2023 by Belini My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ Link to comment Share on other sites More sharing options...
Zedna Posted April 15, 2023 Share Posted April 15, 2023 (edited) $asp_ratio is integer and not string so you can't use '4:3' as value. You should find declaration of possible values probably in vlcmediawidget.h or vlc.h void VlcMediaWidget::setAspectRatio(MediaWidget::AspectRatio aspectRatio) { // "", "1:1", "4:3", "5:4", 16:9", "16:10", "221:100", "235:100", "239:100" const char *vlcAspectRatio = ""; int vlcScaleFactor = 1; switch (aspectRatio) { case MediaWidget::AspectRatioAuto: break; case MediaWidget::AspectRatio4_3: vlcAspectRatio = "4:3"; break; case MediaWidget::AspectRatio16_9: vlcAspectRatio = "16:9"; break; case MediaWidget::AspectRatioWidget: // zero = adjust video to window vlcScaleFactor = 0; break; } libvlc_video_set_aspect_ratio(vlcMediaPlayer, vlcAspectRatio); libvlc_video_set_scale(vlcMediaPlayer, vlcScaleFactor); } Edited April 15, 2023 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Solution KaFu Posted April 15, 2023 Solution Share Posted April 15, 2023 This work for me. Sleep(1000) libvlc_video_set_aspect_ratio($hLibVLC_dll, $mp, "16:9") ConsoleWrite(@error & @tab & @extended & @crlf) Sleep(1000) libvlc_video_set_aspect_ratio($hLibVLC_dll, $mp, "4:3") ConsoleWrite(@error & @tab & @extended & @crlf) Sleep(1000) libvlc_video_set_aspect_ratio($hLibVLC_dll, $mp, "16:9") ConsoleWrite(@error & @tab & @extended & @crlf) Sleep(1000) libvlc_video_set_aspect_ratio($hLibVLC_dll, $mp, "1:1") ConsoleWrite(@error & @tab & @extended & @crlf) Sleep(1000) libvlc_video_set_aspect_ratio($hLibVLC_dll, $mp, "211:100") ConsoleWrite(@error & @tab & @extended & @crlf) Sleep(1000) libvlc_video_set_aspect_ratio($hLibVLC_dll, $mp, "") ConsoleWrite(@error & @tab & @extended & @crlf) Func libvlc_video_set_aspect_ratio($hLibVLC_dll, $mp, $asp_ratio) ; // "", "1:1", "4:3", "5:4", 16:9", "16:10", "221:100", "235:100", "239:100" ; https://python-forum.io/thread-17906.html Local $taiData = DllStructCreate("char[32]") DllStructSetData($taiData, 1, $asp_ratio) Local $aRet = DllCall($hLibVLC_dll, "none:cdecl", "libvlc_video_set_aspect_ratio", "handle", $mp, "ptr", DllStructGetPtr($taiData)) If @error <> 0 Then Return SetError(@error, @extended, 0) Return $aRet[0] EndFunc ;==>libvlc_video_set_aspect_ratio Belini 1 OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Belini Posted April 15, 2023 Author Share Posted April 15, 2023 @zedna the correct one then would be "float" or "double" I've tried these and nothing happens either. My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ Link to comment Share on other sites More sharing options...
Belini Posted April 15, 2023 Author Share Posted April 15, 2023 @Kafu worked perfectly, you really are the man, thanks for this solution. KaFu 1 My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ Link to comment Share on other sites More sharing options...
Belini Posted April 16, 2023 Author Share Posted April 16, 2023 (edited) @genius257 could you give me an example of how to open and play songs in two instances at the same time? Note: I tried here replicating the commands to create the second window and it even worked but it keeps crashing the first window I created my try: expandcollapse popup#include <WindowsConstants.au3> #include <Constants.au3> #include "LibVLC.au3" Global $mp_plo[3], $m_pl[3], $mp_em[3], $hand_vlc[3], $hVLC[3], $pEndReached[3], $hLibVLC_dll[3] global $Res_W_Current, $Res_H_Current, $pct_W, $pct_H, $ratio_maq $Res_W_Current = @DesktopWidth $Res_H_Current = @DesktopHeight ; ====================================================================================================================================== instance 1 $hand_vlc[1] = GUICreate("Video 1", $Res_W_Current, $Res_H_Current, 0, 0, $WS_POPUP) GUISetBkColor(0x000000) GUISetState(@SW_SHOW, $hand_vlc[1]) ; ====================================================================================================================================== instance 1 $pct_W = ($Res_W_Current * 30) / 100 $pct_H = ($Res_H_Current * 30) / 100 ; ====================================================================================================================================== instance 2 $hand_vlc[2] = GUICreate("Video 2", $Res_W_Current - $pct_W, $Res_H_Current - $pct_H, $pct_W / 2, $pct_H / 2, $WS_POPUP, $WS_EX_TOPMOST) GUISetBkColor(0x000000) GUISetState(@SW_hide, $hand_vlc[2]) ; ====================================================================================================================================== instance 2 $hLibVLC_dll[1] = DllOpen("libvlc.dll") If $hLibVLC_dll[1] = -1 Then Exit MsgBox(0, "", "Error open libvlc.dll!") $hVLC[1] = libvlc_new($hLibVLC_dll[1], 0, 0) $sFilePath = @ScriptDir & "\03205.mp4" Play_vlc($sFilePath, 1, 1, "16:9") sleep(2000) $hLibVLC_dll[2] = DllOpen("libvlc.dll") If $hLibVLC_dll[2] = -1 Then Exit MsgBox(0, "", "Error open libvlc.dll!") $hVLC[2] = libvlc_new($hLibVLC_dll[2], 0, 0) GUISetState(@SW_SHOW, $hand_vlc[2]) $sFilePath = @ScriptDir & "\03205.mp4" Play_vlc($sFilePath, 2, 0, "4:3") Sleep(10000) libvlc_media_player_stop($hLibVLC_dll[1], $mp_plo[1]);stop the video 1 libvlc_media_player_stop($hLibVLC_dll[2], $mp_plo[2]);stop the video 2 _CleanUp(1) _CleanUp(2) Exit While 1 Sleep(100) WEnd Func Play_vlc($sFilePath, $inst = 1, $mute = 0, $ratio_maq = "4:3") $m_pl[$inst] = libvlc_media_new_path($hLibVLC_dll[$inst], $hVLC[$inst], $sFilePath);path object $mp_plo[$inst] = libvlc_media_player_new_from_media($hLibVLC_dll[$inst], $m_pl[$inst]);player object libvlc_media_release($hLibVLC_dll[$inst], $m_pl[$inst]);release the path object. We're done with it. $mp_em[$inst] = libvlc_media_player_event_manager($hLibVLC_dll[$inst], $mp_plo[$inst]);player event manager $pEndReached[$inst] = DllCallbackRegister("_VLC_Event_EndReached", "none:cdecl", "handle;handle") libvlc_event_attach($hLibVLC_dll[$inst], $mp_em[$inst], $libvlc_MediaPlayerEndReached, DllCallbackGetPtr($pEndReached[$inst]), 0) libvlc_media_player_set_hwnd($hLibVLC_dll[$inst], $mp_plo[$inst], $hand_vlc[$inst]) libvlc_media_player_play($hLibVLC_dll[$inst], $mp_plo[$inst]) libvlc_video_set_aspect_ratio($hLibVLC_dll[$inst], $mp_plo[$inst], $ratio_maq) If $mute = 1 Then libvlc_audio_set_volume($hLibVLC_dll[$inst], $mp_plo[$inst], 0) Else libvlc_audio_set_volume($hLibVLC_dll[$inst], $mp_plo[$inst], 100) EndIf EndFunc ;==>Play_vlc Func libvlc_video_set_aspect_ratio($hLibVLC_dll, $mp, $asp_ratio); =============================================== Made for Kafú ; // "", "1:1", "4:3", "5:4", 16:9", "16:10", "221:100", "235:100", "239:100" ; https://python-forum.io/thread-17906.html Local $taiData = DllStructCreate("char[32]") DllStructSetData($taiData, 1, $asp_ratio) Local $aRet = DllCall($hLibVLC_dll, "none:cdecl", "libvlc_video_set_aspect_ratio", "handle", $mp, "ptr", DllStructGetPtr($taiData)) If @error <> 0 Then Return SetError(@error, @extended, 0) Return $aRet[0] EndFunc ;==>libvlc_video_set_aspect_ratio Func libvlc_audio_set_volume($hLibVLC_dll, $mp, $new_vol); ===================================================== Made for Belini Local $aRet = DllCall($hLibVLC_dll, "none:cdecl", "libvlc_audio_set_volume", "handle", $mp, "ptr", $new_vol) If @error <> 0 Then Return SetError(@error, @extended, 0) Return $aRet[0] EndFunc ;==>libvlc_audio_set_volume Func _CleanUp($inst = 1) libvlc_media_player_stop($hLibVLC_dll[$inst], $mp_plo[$inst]);stop the video libvlc_media_player_release($hLibVLC_dll[$inst], $mp_plo[$inst]) libvlc_release($hLibVLC_dll[$inst], $hVLC[$inst]) DllClose($hLibVLC_dll[$inst]) DllCallbackFree($pEndReached[$inst]) GUIDelete($hand_vlc[$inst]) Exit EndFunc ;==>_CleanUp Edited April 17, 2023 by Belini My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ Link to comment Share on other sites More sharing options...
genius257 Posted April 17, 2023 Share Posted April 17, 2023 Hi @Belini. Testing this code on my pc running win10 works okay-ish (still the occatinal thread issue caused crash) Are you using the libvlc.dll, libvlccore.dll and plugins folder from the examples at my repo, or have you extracted the files from a fresh vlc installation? If your answer is the latter, right click on the libvlc.dll, choose properties and under the details tab, tell me what version it says. The target libvlc version for my wrapper library is 2.2.4 My highlighted topics: AutoIt Package Manager, AutoItObject Pure AutoIt, AutoIt extension for Visual Studio Code Github: AutoIt HTTP Server, AutoIt HTML Parser Link to comment Share on other sites More sharing options...
Belini Posted April 17, 2023 Author Share Posted April 17, 2023 I'm using the lib dll that you sent and I've already seen that I'm going to have crashing problems even running just the example you sent because if I let several videos play in a row, it starts to slow down until it crashes, I think that libvlc_media_player_stop() is not cleaning everything it should or so you can't repeat all the commands when putting the next video, I'm doing tests here to try to find out the cause of the crashes. genius257 1 My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ Link to comment Share on other sites More sharing options...
Belini Posted April 22, 2023 Author Share Posted April 22, 2023 @genius257 I still haven't been able to solve the crash problem after I play several videos in a row, I really need to use your UDF to play videos in LibVlc, would you know how I can change the video without repeating all the commands until it plays? expandcollapse popup#include "LibVLC.au3" HotKeySet("{esc}", "_CleanUp") global $mp, $hLibVLC_dll, $hVLC, $pEndReached, $hWnd_gui, $var = 0 $hWnd_gui = GUICreate("AutoIt + VLC Example", @DesktopWidth, @DesktopHeight) GUISetBkColor(0x000000) GUISetState(@SW_SHOW, $hWnd_gui) $sFilePath = @ScriptDir & "\03205.mp4" $hLibVLC_dll = DllOpen("libvlc.dll") $hVLC = libvlc_new($hLibVLC_dll, 0, 0) While 1 $var += 1 MsgBox(4096, "INFO", "LOOP: " & $var, 1) ConsoleWrite("LOOP: " & $var & @crlf) Play($sFilePath) Sleep(10000) libvlc_media_player_stop($hLibVLC_dll, $mp) WEnd Func Play($sFilePath = ""); ========> I just managed to play a new video by repeating all these commands that after a while stop working $m = libvlc_media_new_path($hLibVLC_dll, $hVLC, $sFilePath);path object $mp = libvlc_media_player_new_from_media($hLibVLC_dll, $m);player object libvlc_media_release($hLibVLC_dll, $m);release the path object. We're done with it. $mp_em = libvlc_media_player_event_manager($hLibVLC_dll, $mp);player event manager $pEndReached = DllCallbackRegister("_VLC_Event_EndReached", "none:cdecl", "handle;handle") libvlc_event_attach($hLibVLC_dll, $mp_em, $libvlc_MediaPlayerEndReached, DllCallbackGetPtr($pEndReached), 0) libvlc_media_player_set_hwnd($hLibVLC_dll, $mp, $hWnd_gui) libvlc_media_player_play($hLibVLC_dll, $mp) EndFunc ;==>Play Func _CleanUp() libvlc_media_player_stop($hLibVLC_dll, $mp);stop the video libvlc_media_player_release($hLibVLC_dll, $mp) libvlc_release($hLibVLC_dll, $hVLC) DllClose($hLibVLC_dll) DllCallbackFree($pEndReached) GUIDelete($hWnd_gui) exit EndFunc ;==>_CleanUp I uploaded the files that I used in the test and if you can test and help me with this I will always be grateful to you https://mega.nz/file/oZtRmKhY#P_-Emf9I8fW5xyKIW9d--rhgJuT46zzt6RK9_gpEEXo My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ Link to comment Share on other sites More sharing options...
Belini Posted April 22, 2023 Author Share Posted April 22, 2023 Another moment that causes everything to crash is when you click with the mouse on top of the video that is playing, then the script crashes and needs to be closed forcibly by the task manager. My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ Link to comment Share on other sites More sharing options...
Danp2 Posted April 22, 2023 Share Posted April 22, 2023 There are some issues with this line -- $pEndReached = DllCallbackRegister("_VLC_Event_EndReached", "none:cdecl", "handle;handle") The function _VLC_Event_EndReached doesn't exist, so this command fails This callback should be registered once, so this needs to be moved outside of Play(). Belini 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Belini Posted April 22, 2023 Author Share Posted April 22, 2023 @Danp2 thanks for answering, I put back the _VLC_Event_EndReached function and removed it from the play function but nothing changed. expandcollapse popup#include "LibVLC.au3" HotKeySet("{esc}", "_CleanUp") global $mp, $hLibVLC_dll, $hVLC, $pEndReached, $hWnd_gui, $var = 0 $hWnd_gui = GUICreate("AutoIt + VLC Example", @DesktopWidth, @DesktopHeight) GUISetBkColor(0x000000) GUISetState(@SW_SHOW, $hWnd_gui) $sFilePath = @ScriptDir & "\03205.mp4" $hLibVLC_dll = DllOpen("libvlc.dll") $pEndReached = DllCallbackRegister("_VLC_Event_EndReached", "none:cdecl", "handle;handle") $hVLC = libvlc_new($hLibVLC_dll, 0, 0) While 1 $var += 1 MsgBox(4096, "INFO", "LOOP: " & $var, 1) ConsoleWrite("LOOP: " & $var & @crlf) Play($sFilePath) Sleep(10000) libvlc_media_player_stop($hLibVLC_dll, $mp) WEnd Func _VLC_Event_EndReached($event, $data); the event function ConsoleWrite("EndReached" & @CRLF) EndFunc ;==>_VLC_Event_EndReached Func Play($sFilePath = ""); ========> I just managed to play a new video by repeating all these commands that after a while stop working $m = libvlc_media_new_path($hLibVLC_dll, $hVLC, $sFilePath);path object $mp = libvlc_media_player_new_from_media($hLibVLC_dll, $m);player object libvlc_media_release($hLibVLC_dll, $m);release the path object. We're done with it. $mp_em = libvlc_media_player_event_manager($hLibVLC_dll, $mp);player event manager libvlc_event_attach($hLibVLC_dll, $mp_em, $libvlc_MediaPlayerEndReached, DllCallbackGetPtr($pEndReached), 0) libvlc_media_player_set_hwnd($hLibVLC_dll, $mp, $hWnd_gui) libvlc_media_player_play($hLibVLC_dll, $mp) EndFunc ;==>Play Func _CleanUp() libvlc_media_player_stop($hLibVLC_dll, $mp);stop the video libvlc_media_player_release($hLibVLC_dll, $mp) libvlc_release($hLibVLC_dll, $hVLC) DllClose($hLibVLC_dll) DllCallbackFree($pEndReached) GUIDelete($hWnd_gui) exit EndFunc ;==>_CleanUp My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ Link to comment Share on other sites More sharing options...
Danp2 Posted April 22, 2023 Share Posted April 22, 2023 Using ConsoleWrites, I can see that it hangs during the call to libvlc_media_player_stop. Also noted that the hanging ceased when I commented out the line with libvlc_media_player_set_hwnd. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Belini Posted April 22, 2023 Author Share Posted April 22, 2023 here also the freezing stopped when I commented the line you said but then it is using VLC (Direct3D output) and I need to open it embedded in the Autoit window to define size, position and also open without borders My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ Link to comment Share on other sites More sharing options...
genius257 Posted April 22, 2023 Share Posted April 22, 2023 I stopped developing the wrapper library, due to the same freezing issue. Found some forum posts on another forum suggesting some libvlc calls must be made on a thread, not handling the GUI loop. So if true, that leaves AutoIt solutions problematic. It might be solved in later versions, but that requires a rewrite of all dllcalls... My highlighted topics: AutoIt Package Manager, AutoItObject Pure AutoIt, AutoIt extension for Visual Studio Code Github: AutoIt HTTP Server, AutoIt HTML Parser Link to comment Share on other sites More sharing options...
Belini Posted April 22, 2023 Author Share Posted April 22, 2023 @genius257 so you think unfortunately I won't be able to use this LibVlc as it is today? The freezing problem stopped after I commented libvlc_media_player_set_hwnd() suggested by Danp2 but then I can't open the VLC window (Direct3D output) in the size I want and not even without the borders if there was a way to fix this even using VLC (Direct3D output) it would solve it for me. My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ Link to comment Share on other sites More sharing options...
genius257 Posted April 22, 2023 Share Posted April 22, 2023 @Belini, yes I'm afraid so. Here's a quote from my original libvlc thread: Quote Edit3 (12th April 2017): So I've uploaded the example on my Github repository with the files needed (except a video file) to run the example. Sometimes the example will freeze. I found a thread suggesting that calling libvlc_media_player_stop and related functions from the same thread with the window message handling, may result in the problem occurring. I have a possible solution, but am unable to currently test it, as some needed code is hiding in my unorganized mess of projects. Belini 1 My highlighted topics: AutoIt Package Manager, AutoItObject Pure AutoIt, AutoIt extension for Visual Studio Code Github: AutoIt HTTP Server, AutoIt HTML Parser Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now