Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Other surface options #43

Open
katajakasa opened this issue Aug 2, 2018 · 5 comments
Open

Other surface options #43

katajakasa opened this issue Aug 2, 2018 · 5 comments
Milestone

Comments

@katajakasa
Copy link
Owner

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:

  • SDL_Surface or custom bitmap surface
  • OpenGL Texture
  • Direct3D Texture
  • Vulkan ?
@katajakasa katajakasa added this to the 2.0.0 milestone Aug 2, 2018
@ebachard
Copy link

ebachard commented Aug 2, 2018

Exactly what I was looking for 👍

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 ocornut/imgui#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

@ebachard
Copy link

ebachard commented Aug 4, 2018

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).

@katajakasa
Copy link
Owner Author

In addition to these changes, also need to change subtitle texture stuff.

@ebachard
Copy link

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.

@ebachard
Copy link

FYI, one other case (works well so far) : https://github.com/mattbeghin/FFmpegHapGlPlayer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants