I’m using gstreamer to show video content on an SDL based application.
However I don’t know how to call SDL_UpdateTexture. On windows it behaves quite well however on my embeded device it is giving me segmentation fault.
I think it could be pitch calculation. What is the correct pitch calculation for NV12?
I’m getting the data from gstreamer like this:
GstBuffer *buffer = gst_sample_get_buffer(sample);
// Get the buffer data
GstMapInfo info;
gst_buffer_map(buffer, &info, GST_MAP_READ);
I’m creating the texture like this:
SDL_Texture *texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_NV12, SDL_TEXTUREACCESS_STREAMING, SCREEN_WIDTH, SCREEN_HEIGHT);
Later on I call SDL_updateTexture:
SDL_UpdateTexture(texture, NULL, info.data, SCREEN_WIDTH * 2);
It is really strange, because on Windows I works even if I set the pitch as SCREEN_WIDTH or SCREEN_WIDTH * 4 or SCREEN_WIDTH / 2
:-/
Thank you