SuRGeoNix / Flyleaf

Media Player .NET Library for WinUI 3/ WPF/WinForms (based on FFmpeg/DirectX)
GNU Lesser General Public License v3.0
715 stars 101 forks source link

Remove Speed Limitation for Reverse Playback #496

Closed proudust closed 1 month ago

proudust commented 2 months ago

I wanted to play a video in reverse at 2x speed using this library, but it didn't work. After reading the code, I found that the following code imposes a restriction that prevents reverse playback at speeds greater than 1x. https://github.com/SuRGeoNix/Flyleaf/blob/3cc9b47be28d61962d0c53e451e4020420cf5980/FlyleafLib/MediaPlayer/Player.cs#L269-L270

I tried removing || (newValue > 1 && ReversePlayback) from the code above, and it worked fine for reverse playback at speeds greater than 2x. What is the intention behind this restriction? If there are no specific issues, I would appreciate it if this limitation could be removed.

SuRGeoNix commented 2 months ago

@proudust Good question, I think the main idea was to avoid burning the GPU as for each prev frame re-decodes the whole GOP until the specified frame. Really bad for performance, I will review this in the next update.