I want to display videos to a video playback card , if the pixel format is RGBA/BGRA I can write video data to card buffer because it is so easy, but if pixel format is YUV422/YUV420 it is not easy (at least to me) and I don't know how can write 3 Y,U,V data buffers to ONE buffer of playback card. I googled , but could not find my answer.
Please look at the following my code snippet and comments :
if(f== SDL_PIXELFORMAT_BGRA32)
{
ret = SDL_UpdateTexture(*tex, NULL, frame->data[0], frame->linesize[0]); //the SDL display video perfectly
if (myCardBuffer)
{
int straid = frame->linesize[0] * frame->height;
memcpy(myCardBuffer, frame->data[0], straid); //card frame is bmdFormat8BitBGRA and works perfectly
}
}
else if (f == SDL_PIXELFORMAT_IYUV) // Planar mode: Y + U + V (3 planes)
{
ret = SDL_UpdateYUVTexture(*tex, NULL,
frame->data[0], frame->linesize[0],frame->data[1], frame->linesize[1], frame->data[2], frame->linesize[2]);//the SDL display video perfectly
if (myCardBuffer)
{
//card frame is bmdFormat8BitYUV but I dont know how to write 3 Y,U,V data buffers to it
}
}
and this is information about the pixel format of the card :
Question : How to write a YUV422/YUV420 video data (Y,U,V buffers) to the buffer of the card?
