mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-10 08:38:20 +00:00
[client] initial support for compressed frames
This commit is contained in:
parent
b5f2092e9c
commit
c239306d82
@ -63,13 +63,21 @@ typedef struct LG_RendererParams
|
||||
}
|
||||
LG_RendererParams;
|
||||
|
||||
typedef enum LG_RendererComp
|
||||
{
|
||||
LG_COMPRESSION_NONE,
|
||||
LG_COMPRESSION_H264
|
||||
}
|
||||
LG_RendererComp;
|
||||
|
||||
typedef struct LG_RendererFormat
|
||||
{
|
||||
unsigned int width; // image width
|
||||
unsigned int height; // image height
|
||||
unsigned int stride; // scanline width
|
||||
unsigned int pitch; // scanline bytes
|
||||
unsigned int bpp; // bits per pixel
|
||||
LG_RendererComp comp; // compression format
|
||||
unsigned int width; // image width
|
||||
unsigned int height; // image height
|
||||
unsigned int stride; // scanline width (zero if compresed)
|
||||
unsigned int pitch; // scanline bytes (or compressed size)
|
||||
unsigned int bpp; // bits per pixel (zero if compressed)
|
||||
}
|
||||
LG_RendererFormat;
|
||||
|
||||
|
@ -309,7 +309,6 @@ int frameThread(void * unused)
|
||||
header.detail.frame.type >= FRAME_TYPE_MAX ||
|
||||
header.detail.frame.width == 0 ||
|
||||
header.detail.frame.height == 0 ||
|
||||
header.detail.frame.stride == 0 ||
|
||||
header.detail.frame.pitch == 0 ||
|
||||
header.detail.frame.dataPos == 0 ||
|
||||
header.detail.frame.dataPos > state.shmSize ||
|
||||
@ -329,11 +328,13 @@ int frameThread(void * unused)
|
||||
switch(header.detail.frame.type)
|
||||
{
|
||||
case FRAME_TYPE_ARGB:
|
||||
lgrFormat.bpp = 32;
|
||||
lgrFormat.comp = LG_COMPRESSION_NONE;
|
||||
lgrFormat.bpp = 32;
|
||||
break;
|
||||
|
||||
case FRAME_TYPE_RGB:
|
||||
lgrFormat.bpp = 24;
|
||||
case FRAME_TYPE_H264:
|
||||
lgrFormat.comp = LG_COMPRESSION_H264;
|
||||
lgrFormat.bpp = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -265,7 +265,13 @@ bool opengl_on_frame_event(void * opaque, const LG_RendererFormat format, const
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!this->configured || memcmp(&this->format, &format, sizeof(LG_RendererFormat)) != 0)
|
||||
if (!this->configured ||
|
||||
this->format.comp != format.comp ||
|
||||
this->format.width != format.width ||
|
||||
this->format.height != format.height ||
|
||||
this->format.stride != format.stride ||
|
||||
this->format.bpp != format.bpp
|
||||
)
|
||||
{
|
||||
memcpy(&this->format, &format, sizeof(LG_RendererFormat));
|
||||
this->reconfigure = true;
|
||||
@ -543,14 +549,20 @@ static bool configure(struct Inst * this, SDL_Window *window)
|
||||
return false;
|
||||
}
|
||||
|
||||
// assume 24 and 32 bit formats are RGB and RGBA
|
||||
switch(this->format.bpp)
|
||||
switch(this->format.comp)
|
||||
{
|
||||
case 24:
|
||||
this->intFormat = GL_RGB8;
|
||||
this->vboFormat = GL_BGR;
|
||||
case LG_COMPRESSION_NONE:
|
||||
break;
|
||||
|
||||
case LG_COMPRESSION_H264:
|
||||
DEBUG_INFO("h264 not supported yet");
|
||||
LG_UNLOCK(this->formatLock);
|
||||
return false;
|
||||
}
|
||||
|
||||
// assume 32 bit formats are BGRA
|
||||
switch(this->format.bpp)
|
||||
{
|
||||
case 32:
|
||||
this->intFormat = GL_RGBA8;
|
||||
this->vboFormat = GL_BGRA;
|
||||
|
Loading…
Reference in New Issue
Block a user