Skip to content

Commit

Permalink
[what] 支持渲染 NV12
Browse files Browse the repository at this point in the history
  • Loading branch information
HR1025 committed Sep 20, 2024
1 parent 6987627 commit 1862dfd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Core
12 changes: 12 additions & 0 deletions source/DisplaySDL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,18 @@ void DisplaySDL::UpdateWindow(const uint32_t* frameBuffer, PixelsInfo info)
SDL_UpdateTexture(_texture, NULL, reinterpret_cast<const void*>(frameBuffer), sizeof(uint32_t)*_windowWidth);
break;
}
case PixelFormat::NV12:
{
SDL_Rect rect;
{
rect.x = 0;
rect.y = 0;
rect.w = info.width;
rect.h = info.height;
}
SDL_UpdateNVTexture(_texture, &rect, (uint8_t*)frameBuffer, info.width, (uint8_t*)frameBuffer + info.width * info.height, info.width);
break;
}
case PixelFormat::YUV420P:
{
uint8_t* yData = (uint8_t*)frameBuffer;
Expand Down

0 comments on commit 1862dfd

Please sign in to comment.