-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not Lock file #603
Comments
It depends on file types. The locking happens usually with multimedia files. macOS (and *nix OSs) can lock a file by the inode (which is the underlying unique file ID in the filesystem) so you can do whatever you want to the file (since the inode will never change), but I don't know how to do the same for Windows/NTFS. I will be happy if anyone can give a hint :) |
Thank you for the reply~! |
Is there maybe a way to destroy the loaded instance somehow after playback ends ? Or what happens when you select another file to play that back and unlock the previously previewed ? |
Currently the instance will be destroyed when you close the window or switch away to another file. We don't destroy it when playback ends, since the user may want to play it again.
The player destroys itself. So the file will be unlocked. |
maybe keep it when loop is enabled and destroy after play if not or would be rebuilding if someone wants to listen again be to much performance related ? |
even after closing the preview window the file stays locked for a second or two, this is pretty annoying when I have to delete the file after previewing as instead of just disappearing I see a confirmation dialog that doesnt allow to delete I dont have any hints to solve this problem but for what it's worth: this issue doesnt appear with windows previewer (the one that appears when you press ALT+P), in there you can even delete a file while it's playing, but I have no clue as to how this voodoo works Thanks for such an awesome software though :) |
The question is who (or what) locks the file. At first I thought it was MediaUriElement at ViewPanelXaml.cs line 128. So I cloned WPF Media Kit and run their "Test Application". Sure enough in their app file is NOT locked. File keeps playing even if user deletes it or renames it. I checked with an .mp3 file in both NTFS & FAT drives. So... back to QuickLook to see what's different. It turns out the offender is ViewPanelXaml.cs lines 62,63 *Notice: I did my test using my own file manager. For explorer it is pretty much the same, with the exception of renaming, because QuickLook picks up the key stroke on renaming and starts playing the file from the start(but the renaming operation goes through ) Now the question is what LAVFilterDirectory is for ? I did not had time to familiarize myself with QuickLook code base, but I did a search on the entire WPF Media Kit solution and did not find a single hit. Maybe WPF Media Kit is a newer version? I don't know That's my 2 cents on the subject. Hope it helps P.S. I just realize that "WPF Media Kit" is under QL-Win, I thought it was a completely other project |
@WilliamDrt See the I guess the system decoder does not lock the file, we can't use it since it supports only a few formats (5-10 types as I remembered). |
Ok i will have a look tomorrow, thank you for your input
😊
|
Ok I made it work Alternative I made a gist with the changes to 2 files Now a little bit of explanation of what is going on: So I ended up by creating a dedicated
File locks and then unlocks, user will not notice, this is even before we load the window Debug from Load looks like this: Debug from Unload looks like this: |
yes you clone it, make a change in the clone and then craete a pull request to merge your changes. That way others can easy see what has been changed. e.g: like here : |
@rabelux ok this is what I read in some articles. I only have a question. If I fork it first and then do all the other stuff when let's say a month passes and I want to do another fix how can I make the code to be current? I mean in one month code base might change a lot. How can my forked repo be in sync with the original? Maybe there's a method and this is a silly question, maybe my understanding about fork is complete wrong. I'm a bit confused about this, and I would like to learn and start right, so I can see some other issues on QL Ps this fix should also fix long path support for audio/video but I haven't tested yet |
I hope this answers your question: https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/syncing-a-fork And the pull request looks like this, showing you the diff and all commits: Note that switching direction is a little big bothersome and my solution is the following, where I am open for improvements: |
And to answer your other question: |
@rabelux thanks a lot, that cleared things in my head, thanks again |
I am on windows 10 x64 and I uninstalled the previous version and installed the msi from here. I haven't tried the store version yet. Will do later. The msi version locks the file tho |
@WilliamDrt how did you get that macOS like column view in explorer ? |
I just tested the msi version and is good.
Bottom line: we need more info from other users @daslicht I have no idea what is going on here, so I am just fishing:
Again I am just fishing here, have no idea what's going on @daslicht In my screenshot you're seeing Direttore File Manager, with DarkR theme. I am the author. If you want send me an email address, to send you a promo code. Having said that, Direttore right now has no keyboard support, an update should be up in a few days. |
nope, it also locks if i place a file at the root: c:\test.wav
I get that with any file, here lets take this as reference:
nope i don't even know what this is. Just tried the msstore version: renaming images (png) or mp4 seams to work. You tried it in MS Explorer ? |
@daslicht You tried it in MS Explorer ? - Yes |
It not only locks with del, but also with renaming the file, so no keystroke involved Hit spacebar to audition a wav sample. |
let me phrase it like this: Unfortunately, QL does not get focused on its own when loaded, user must click on QL window for QL to get focus. If user then click back on explorer (now explorer gets focused) then no file lock happens. @daslicht if you could confirm that for me, please.
I know this is not optimal, I just need to know what works and what not, to try fix it. |
Is it possible to due to the HasVideo logic in which the LavSplitterSource was locking the file but did not release it in time? |
@xupefei Yes, it releases the file as expected, ONLY if programs exchange focus. Funny thing is while debugging, VS would get focus on breakpoint, and during live testing I would always use my mouse to go from QL to explorer. This happens because RCW class are cached for perfomance reasons, so even if we're telling the damn thing to Marshal.ReleaseComObject(sourceFilter); it doesn't do so, until QL loses focus.
I have already tested 1 and it works, I will report back for 2 NOTICE: regardless of the final solution if user clicks spacebar->delete rapidly, depending of how many ms apart the clicks were, 1 of 3 things would happened:
|
yes that works |
OK N 2 was a waste of time, before I make a new pull request it would be nice if someone else tested this in msi version
Thanks |
I dont have that file at this location here but there: C:\Program Files\WindowsApps\21090PaddyXu.QuickLook_3.6.6.0_neutral__egxr34yet59cg\Package\QuickLook.Plugin\QuickLook.Plugin.VideoViewer But I cant delete it even after stopping Quicklook ? |
you have the store version, you need the msi instalation, which I know is what you had originally, but switched to store version for testing, now you'll have to switch again to test, this is all my fault, sorry, but I think we've got it right this time |
AWESOME ! It works ! |
Also confirming for Win 7, although there hasn't been an issue before. Renaming and deleting works with the released version and your edited .dll |
Thank you, guys! I have merged the PR from @WilliamDrt and will release an update soon. |
the app feels faster now, the locking seems to sustain if you switch fast between files 👌 |
Yeah because we have no control over the GC. What we can do is to "suggest" the system to release the lock asap. This is the point that C++ (or Rust, or any "native" language) becomes superior to C#. |
here he shows how fast audio playback can get : |
This can be a lot faster by avoiding the lock in the first place. I have a plan for this, but it 'll have to wait until next week, no time right now. |
When you audition a wave file and then try to move the folder it resides, we get the lock message. |
I'm having a similar problem however I can delete the file that was just played but I can't delete the folder in which it resides or even resided after I deleted the file! |
Hi,
it would be useful if quicklook would NOT lock the file. (as under macOS)
This is usefull when for example browsing wav samples and you lieke to rename or move them.
At the momnet we have to selecte another file first to be able to move or rename teh previous.
The text was updated successfully, but these errors were encountered: