kingslay / KSPlayer

A video player for iOS、macOS、tvOS、visionOS , based on AVPlayer and FFmpeg, support the horizontal, vertical screen. support adjust volume, brightness and seek by slide, support subtitles.
GNU General Public License v3.0
886 stars 184 forks source link

KSOptions.yadifMode = 0/1 #646

Closed UnknownCoder807 closed 8 months ago

UnknownCoder807 commented 8 months ago

I would like to offer my users the option to change deinterlace filters in real time.

I offer yadif1x and yadif2x and I set it at playback with

KSOptions.yadifMode = 0 or KSOptions.yadifMode = 1

Is it possible to have this change happen in realtime, like changing the aspect ratio does?

thanks.

kingslay commented 8 months ago

KSOptions.yadifMode 不支持实时修改。但你可以实时修改videoFilters里面的filter。这样就可以实现实时效果了。

UnknownCoder807 commented 8 months ago

How can I do that inside a Button() ?

kingslay commented 8 months ago

if let index = videoFilters.firstIndex(where: { $0.hasPrefix("yadif=mode=")}) { videoFilters[index] = "yadif=mode=1:parity=-1:deint=1" }

UnknownCoder807 commented 8 months ago

Thanks, how do I access videoFilters? it's not found.

kingslay commented 8 months ago

通过ksoption

UnknownCoder807 commented 8 months ago

Thanks, that works.