Open katajakasa opened 6 years ago
Exactly what I was looking for :+1:
I only know OpenGL case, but the issue is caused by the fact that SDL Textures need a renderer. A well known issue is that this renderer, does not work very well with other OpenGL contexts (to illustrate, see https://github.com/ocornut/imgui/issues/935 ).
Provide as SDL Surface, or simple bitmap could be very helpfull too, and lead to an easy use (e.g. using FBO, or PBO).
For other cases, like Direct3D or Vulkan, I don't know, but I can imagine this could be interesting too.
Just in case, some links I found in meantime:
Last but not least, a completely orthogonal approach :
If I find something interesting, I'll keep you informed.
HTH
After reading more deeply the code, in include/kitchensink/kitplayer.h, we have GetPlayerVideoData() function :
KIT_API int Kit_GetPlayerVideoData(Kit_Player *player, SDL_Texture *texture);
/*
* @param player Player instance
* @param texture A previously allocated texture
* @return 0 on success, 1 on error
*/
What about:
rename
Kit_GetPlayerVideoData(Kit_Player *player, SDL_Texture *texture)
in
Kit_GetPlayerVideoSDLData (Kit_Player *player, SDL_Texture *texture)
create, with the following prototypes :
Kit_GetPlayerVideoOpenGLData (Kit_Player *player, glTexture2D *texture)
Kit_GetPlayerVideoDirect3DData (Kit_Player player, Direct3DTexture texture)
Kit_GetPlayerVideoCustomData (Kit_Player player, custom_on_the_fly texture_like)
- and maybe other prototypes following the same schema ?
Or maybe the GetVideoData is enough, and instantiate a texture could be done after, using another method/function ?
As previously explained, your kit works extremely well, but the SDL2 renderer is not an option for me.
FYI, I'll try to implement the Kit_GetPlayerVideoOpenGLData (Kit_Player *player, glTexture2D *texture), and I'll keep you informed if I'm doing progress (or not).
In addition to these changes, also need to change subtitle texture stuff.
FYI, I'm testing : Kit_GetPlayerVideoOpenCVData (see : https://github.com/ebachard/SDL_kitchensink/blob/master/src/internal/video/kitvideo.c ).
I'm still stuck with a mysterious buffer update or visibility issue (some lock somewhere, and the frame is not updated), but I think this could be usefull too. At least me, because I'm very interested to decode frames and turn them into OpenCV Mat. Too bad the SDL2 renderer cannot be mixed safely with OpenGL context.
FYI, one other case (works well so far) : https://github.com/mattbeghin/FFmpegHapGlPlayer
This was originally part of v1 plans, but moved to v2 now.
SDL_Texture is basically a wrapper for OpenGL/Direct3D textures. It might be a good idea to let the library decode directly on those (In addition to / instead of) SDL_Textures.
Consider: