I try to get a better integrated video player work...
# compose-desktop
t
I try to get a better integrated video player working for CfD. I put together a prototype using the bytedeco ffmpeg-platform bindings. For every frame i do copy the image data into the jvm memory and then copying it into a skia image. For low resolutions (1920x1080) and fps (60) this works fine but when it comes to 4K than i think this memory copy thing gets the bottleneck. Maybe some one can help or direct me in a way to improve the performance here.
The bottleneck code is here: https://github.com/timo-drick/cfd_video/blob/eb702eb260c68aba685b6e12e7e331681314622e/Compose%20for%20Desktop%20Video%20Player/playerFFMPEG/src/main/kotlin/de/appsonair/cppffmpeg/kffmpeg.kt#L299 As you can see i use sws_scale to convert the video image into an image format that can be directly displayed by skia. Then line 309 i copy the image data to a jvm bytearray and line 311 copy this array into the skia bitmap memory. It would be cool if it is possible to upload the image into a bitmap shader and then use it in a sksl shaders. But not sure if this is possible. Or maybe it would be faster to not copy it first into a jvm array. But directly into the skia bitmap memory.