grimfang4 / sdl-gpu

A library for high-performance, modern 2D graphics with SDL written in C.
MIT License
1.19k stars 123 forks source link

Example rendering ffmpeg decoded frames with sdl_gpu? #227

Open wn2000 opened 2 years ago

wn2000 commented 2 years ago

There's an example code here that uses SDL_UpdateYUVTexture to render video frames generated by ffmpeg. But there's no example doing the same using SDL_GPU.

I tried GPU_UpdateImageBytes. Although it generally works (having an issue where video becomes grayscale), the performance feels slower than using SDL_UpdateYUVTexture. I got frame skips and sound stopped playing after a while for a 720p video. Same video plays fine on my platform with SDL_UpdateYUVTexture.

One thing I noticed is that, with SDL_CreateTexture, I can specify a STREAMING flag. But there's no place to do that with GPU_CreateImage. Could that be the reason for the difference in performance?

Appreciate any help on this. Basically I want a comparable example as done in the test code but using sdl_gpu.