How to Update RGB Frame into Texture in SDL2.0

I am working with android, i received data of yuv420p format from the file through ffmpeg.

I tried Converting the frame into RGB, and i dont know how to update the texture? When i had YUV format, i used SDL_UpdateYUVTexture.
Do we have any API similarly to RGB format Updation ?

Kindly suggest.

Tried SDL_UpdateTexture ?

HI AlexRou,

SDL_UpdateTexture needs SDL_Surface, what i have as a data is in the YUYV format raw data received from ffmpeg. Given a RGB24 format raw buffer, i want to update or lock/unlock
texture.

You don’t need a surface at all.

You make a texture with SDL_CreateTexture

Then update it with SDL_UpdateTexture and pass in the raw pixel data in the format you used in SDL_CreateTexture

Thanks Alex, i will try to do the same.

Hi,

I am tring to render the frame that have received from ffmpeg into texture with the help of SDL_UpdateYUVTexture.

The interesting part is that it get rendered in HTC, Motorola properly, but in SAMSUNG GALAXY S3, the whole image is in pink color.

what could be an issue ?

Looks like simple issue : http://openxcom.org/forum/index.php?topic=1864.60

keestu wrote:

Hi,

I am tring to render the frame that have received from ffmpeg into texture with the help of SDL_UpdateYUVTexture.

The interesting part is that it get rendered in HTC, Motorola properly, but in SAMSUNG GALAXY S3, the whole image is in pink color.

what could be an issue ?

Looks like simple issue : http://openxcom.org/forum/index.php?topic=1864.60

Try rendering a test image in YUV and RGB and see if it works, if yes then something is wrong with the data from ffmpeg if no then something is wrong with rendering YUV so you might want to try something else or make your own renderer using OpenGL ES.

Thanks for the reply alex.

In case if the error is with ffmpeg frame, then it would have made the same pink color image in other mobiles as well. Interesting part is it worke even in SAMSUNG DUEOS, but the issue is with SAMSUNG GALAXY S3

keestu wrote:

Thanks for the reply alex.

In case if the error is with ffmpeg frame, then it would have made the same pink color image in other mobiles as well. Interesting part is it worke even in SAMSUNG DUEOS, but the issue is with SAMSUNG GALAXY S3

Well given the differences in hardware/android version it could go either way soo after testing at least you know where to look at.

Alex i found the solution for the previous problem. It is all about changing the setting in the samsumg galaxy 3.

Settings -> More -> Developers Option -> "Check " disable Hardware Overlays.

keestu wrote:

Alex i found the solution for the previous problem. It is all about changing the setting in the samsumg galaxy 3.

Settings -> More -> Developers Option -> "Check " disable Hardware Overlays.

Thats not really a solution, you can’t expect all your users to do that just to run your application/game

You need to convert data received from ffmpeg.
HW decoders return diffirent formats.conert ir to YUV before sending ro SDL renderer.
Use swscale.