d3cod3 / Mosaic

Mosaic, an openFrameworks based Visual Patching Creative-Coding Platform
https://mosaic.d3cod3.org
Other
421 stars 23 forks source link

Symlink support #44

Closed RKelln closed 3 years ago

RKelln commented 3 years ago

This project looks perfect for my current project, thanks for making this. I couldn't get the flatpack to work on Ubuntu 18.04 but I installed using the linux installer script, everything worked great and I was able to start Mosiac, but ran into an issue that I'm hoping is easy to fix.

Tried to import some videos and files and discovered that the file dialog doesn't see symlinks (and all my documents are symlinked to my home directory). I tried dragging and dropping and that also only worked for files not in symlinked directories. Is there an easy way to add support for symlinks?

Thanks!

d3cod3 commented 3 years ago

Hi, thanks for your interest in this project! About the symlink issue, i can't get to it right now, but i can point you where to check if it's an easy fix, the files regarding the file browser are here: https://github.com/d3cod3/ofxVisualProgramming/tree/master/src/core/FileBrowser

Specifically you'll need to look at this file: https://github.com/d3cod3/ofxVisualProgramming/blob/master/src/core/FileBrowser/ImGuiFileBrowser.cpp

at this method here: https://github.com/d3cod3/ofxVisualProgramming/blob/7328c8605d1474cd5831e811537a1f138315d91f/src/core/FileBrowser/ImGuiFileBrowser.cpp#L789

the onNavigationButtonClick , where the filepath is stored on click, so basically what need to be implemented is:

1 - detect if we clicked on a file or on a symlink 2 - if we clicked on a file, just do what is it doing now 3 - if we clicked on a symlink, store the filepath pointing to, not the path of the symlink

I think the lines where to apply this fix are here:

https://github.com/d3cod3/ofxVisualProgramming/blob/7328c8605d1474cd5831e811537a1f138315d91f/src/core/FileBrowser/ImGuiFileBrowser.cpp#L814

and here

https://github.com/d3cod3/ofxVisualProgramming/blob/7328c8605d1474cd5831e811537a1f138315d91f/src/core/FileBrowser/ImGuiFileBrowser.cpp#L817

Let me know if you find a solution, in the meantime i will check it too, as soon as possible.

Daandelange commented 3 years ago

Hey, thanks for testing Mosaic, I hope you find your way in Mosaic. :)

I think there's 2 aspects to this issue:

RKelln commented 3 years ago

Thanks for the quick replies. I should have time to take a look this weekend and I can test out functionality by just making non-symlinked copies of assets in the meantime. I'm on Ubuntu 18.04, let me test drag n drop again. You were dropping to the assets manager? ... OK, weird, tried a different mp4 file and it did appear (yay!) and I hit play (on the video in the asset manager) then got:

*** buffer overflow detected ***: ./Mosaic terminated
Aborted (core dumped)

So I tried another and it worked! Worse bug report ever. Let me see if I can put together some test cases and submit some actionable reports this weekend.

d3cod3 commented 3 years ago

You can just drop it anywhere on the patch canvas.

About the errors, not every video codec is supported by Mosaic, for more info you'll need to check openFrameworks, about video codec compatibility and stuff, as the Mosaic video player use the internal OF video player mechanism.

Daandelange commented 3 years ago

It could be nice to reference crashing video formats. At least Mosaic should not crash when loading a wrong codec.

d3cod3 commented 3 years ago

I've checked that possibility ( not crashing with wrong codec ), but it will need to modify the OF ofVideoPlayer core code, so alter the OF source. Specifically, OF is using gstreamer on linux ( libgstreamer1.0-dev ), avfoundation on osx and directshow on windows For what i've tested, video exports on on system usually don't work on another, even using the same codecs, defintely the issue needs some more looking into it.

d3cod3 commented 3 years ago

Ok, halway to a new standard for Mosaic video players, i've just added ofxHapPlayer to ofxVisualProgramming and Mosaic, and modified the video player object in order to work with that. The Hap codec is cross-compatible osx/linux/windows and we are finally free of the frequent issues ofVideoPlayer/OF related.

I've just tested it on osx and it work perfect! Now it's linux turn, i'm on it.

More info about Hap codec:

https://hap.video/using-hap.html

https://github.com/Vidvox/hap-in-avfoundation/releases

So, starting from Mosaic 0.5.0, if everything works in linux and windows too, this will be the standard encoding to work with, for video files. No more codecs incompatibilities, no more strange issues, same video file, will work on every Mosaic compatible OS.

More news soon

Daandelange commented 3 years ago

Awesome, good job ! HAP can be lossless or compressed, plus multi-platform support makes it perfect :)

d3cod3 commented 3 years ago

Linux ( just tested ubuntu/debian for now ) compiling and working perfectly with HAP player!!!

so great news, now it's time for windows, finger crossed.

d3cod3 commented 3 years ago

Bad news for now on windows, i have not been able to compile ofxHapPlayer addon on qtcreator/msys2 on windows 10, so i'm working on getting a Mosaic solution for visual studio, definitely i think it will be for the best, considering a lot of current issues on windows, it will probably solve some of them.

So i'm closing this for now, as generally speaking the video player / codecs issue is not just solved but considerably enhanced now with the hap addon ( just need to solve it on the windows side... )