mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-12-23 05:53:40 +00:00
[decoders] change the API to allow more flexability in the future
This commit is contained in:
parent
332d53e016
commit
3a2d612b41
@ -39,7 +39,7 @@ static LG_OutFormat lgd_null_get_out_format (void * opaque);
|
||||
static unsigned int lgd_null_get_frame_pitch (void * opaque);
|
||||
static unsigned int lgd_null_get_frame_stride(void * opaque);
|
||||
static bool lgd_null_decode (void * opaque, const uint8_t * src, size_t srcSize);
|
||||
static bool lgd_null_get_buffer (void * opaque, uint8_t * dst, size_t dstSize);
|
||||
static const uint8_t * lgd_null_get_buffer (void * opaque);
|
||||
|
||||
static bool lgd_null_create(void ** opaque)
|
||||
{
|
||||
@ -96,14 +96,13 @@ static bool lgd_null_decode(void * opaque, const uint8_t * src, size_t srcSize)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool lgd_null_get_buffer(void * opaque, uint8_t * dst, size_t dstSize)
|
||||
static const uint8_t * lgd_null_get_buffer(void * opaque)
|
||||
{
|
||||
struct Inst * this = (struct Inst *)opaque;
|
||||
if (!this->src)
|
||||
return false;
|
||||
return NULL;
|
||||
|
||||
memcpySSE(dst, this->src, dstSize);
|
||||
return true;
|
||||
return this->src;
|
||||
}
|
||||
|
||||
const LG_Decoder LGD_NULL =
|
||||
|
@ -42,7 +42,7 @@ typedef LG_OutFormat (* LG_DecoderGetOutFormat )(void * opaque);
|
||||
typedef unsigned int (* LG_DecoderGetFramePitch )(void * opaque);
|
||||
typedef unsigned int (* LG_DecoderGetFrameStride)(void * opaque);
|
||||
typedef bool (* LG_DecoderDecode )(void * opaque, const uint8_t * src, size_t srcSize);
|
||||
typedef bool (* LG_DecoderGetBuffer )(void * opaque, uint8_t * dst, size_t dstSize);
|
||||
typedef const uint8_t * (* LG_DecoderGetBuffer )(void * opaque);
|
||||
|
||||
typedef bool (* LG_DecoderInitGLTexture )(void * opaque, GLenum target, GLuint texture, void ** ref);
|
||||
typedef void (* LG_DecoderFreeGLTexture )(void * opaque, void * ref);
|
||||
|
@ -1070,17 +1070,16 @@ static bool draw_frame(struct Inst * this)
|
||||
this->fences[this->texIndex] = NULL;
|
||||
}
|
||||
|
||||
if (!this->decoder->get_buffer(
|
||||
this->decoderData,
|
||||
this->texPixels[this->texIndex],
|
||||
this->texSize
|
||||
))
|
||||
const uint8_t * data = this->decoder->get_buffer(this->decoderData);
|
||||
if (!data)
|
||||
{
|
||||
LG_UNLOCK(this->formatLock);
|
||||
DEBUG_ERROR("Failed to get the buffer from the decoder");
|
||||
return false;
|
||||
}
|
||||
|
||||
memcpySSE(this->texPixels[this->texIndex], data, this->texSize);
|
||||
|
||||
if (this->amdPinnedMemSupport)
|
||||
this->fences[this->texIndex] = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user