mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-08-04 01:34:13 +00:00
[all] added new format version field to frame header
This commit is contained in:
@@ -375,6 +375,10 @@ static int frameThread(void * unused)
|
||||
LGMP_STATUS status;
|
||||
PLGMPClientQueue queue;
|
||||
|
||||
uint32_t formatVer = 0;
|
||||
bool formatValid = false;
|
||||
LG_RendererFormat lgrFormat;
|
||||
|
||||
SDL_SetThreadPriority(SDL_THREAD_PRIORITY_HIGH);
|
||||
lgWaitEvent(e_startup, TIMEOUT_INFINITE);
|
||||
if (state.state != APP_STATE_RUNNING)
|
||||
@@ -421,56 +425,61 @@ static int frameThread(void * unused)
|
||||
|
||||
KVMFRFrame * frame = (KVMFRFrame *)msg.mem;
|
||||
|
||||
// setup the renderer format with the frame format details
|
||||
LG_RendererFormat lgrFormat;
|
||||
lgrFormat.type = frame->type;
|
||||
lgrFormat.width = frame->width;
|
||||
lgrFormat.height = frame->height;
|
||||
lgrFormat.stride = frame->stride;
|
||||
lgrFormat.pitch = frame->pitch;
|
||||
|
||||
size_t dataSize;
|
||||
bool error = false;
|
||||
switch(frame->type)
|
||||
if (!formatValid || frame->formatVer != formatVer)
|
||||
{
|
||||
case FRAME_TYPE_RGBA:
|
||||
case FRAME_TYPE_BGRA:
|
||||
case FRAME_TYPE_RGBA10:
|
||||
dataSize = lgrFormat.height * lgrFormat.pitch;
|
||||
lgrFormat.bpp = 32;
|
||||
break;
|
||||
// setup the renderer format with the frame format details
|
||||
lgrFormat.type = frame->type;
|
||||
lgrFormat.width = frame->width;
|
||||
lgrFormat.height = frame->height;
|
||||
lgrFormat.stride = frame->stride;
|
||||
lgrFormat.pitch = frame->pitch;
|
||||
|
||||
case FRAME_TYPE_RGBA16F:
|
||||
dataSize = lgrFormat.height * lgrFormat.pitch;
|
||||
lgrFormat.bpp = 64;
|
||||
break;
|
||||
size_t dataSize;
|
||||
bool error = false;
|
||||
switch(frame->type)
|
||||
{
|
||||
case FRAME_TYPE_RGBA:
|
||||
case FRAME_TYPE_BGRA:
|
||||
case FRAME_TYPE_RGBA10:
|
||||
dataSize = lgrFormat.height * lgrFormat.pitch;
|
||||
lgrFormat.bpp = 32;
|
||||
break;
|
||||
|
||||
case FRAME_TYPE_YUV420:
|
||||
dataSize = lgrFormat.height * lgrFormat.width;
|
||||
dataSize += (dataSize / 4) * 2;
|
||||
lgrFormat.bpp = 12;
|
||||
break;
|
||||
case FRAME_TYPE_RGBA16F:
|
||||
dataSize = lgrFormat.height * lgrFormat.pitch;
|
||||
lgrFormat.bpp = 64;
|
||||
break;
|
||||
|
||||
default:
|
||||
DEBUG_ERROR("Unsupported frameType");
|
||||
error = true;
|
||||
case FRAME_TYPE_YUV420:
|
||||
dataSize = lgrFormat.height * lgrFormat.width;
|
||||
dataSize += (dataSize / 4) * 2;
|
||||
lgrFormat.bpp = 12;
|
||||
break;
|
||||
|
||||
default:
|
||||
DEBUG_ERROR("Unsupported frameType");
|
||||
error = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (error)
|
||||
{
|
||||
lgmpClientMessageDone(queue);
|
||||
state.state = APP_STATE_SHUTDOWN;
|
||||
break;
|
||||
}
|
||||
|
||||
formatValid = true;
|
||||
formatVer = frame->formatVer;
|
||||
}
|
||||
|
||||
if (error)
|
||||
if (lgrFormat.width != state.srcSize.x || lgrFormat.height != state.srcSize.y)
|
||||
{
|
||||
lgmpClientMessageDone(queue);
|
||||
state.state = APP_STATE_SHUTDOWN;
|
||||
break;
|
||||
}
|
||||
|
||||
if (frame->width != state.srcSize.x || frame->height != state.srcSize.y)
|
||||
{
|
||||
state.srcSize.x = frame->width;
|
||||
state.srcSize.y = frame->height;
|
||||
state.srcSize.x = lgrFormat.width;
|
||||
state.srcSize.y = lgrFormat.height;
|
||||
state.haveSrcSize = true;
|
||||
if (params.autoResize)
|
||||
SDL_SetWindowSize(state.window, frame->width, frame->height);
|
||||
SDL_SetWindowSize(state.window, lgrFormat.width, lgrFormat.height);
|
||||
|
||||
updatePositionInfo();
|
||||
}
|
||||
|
Reference in New Issue
Block a user