1
0
mirror of https://github.com/jojo61/vdr-plugin-softhdcuvid.git synced 2023-10-10 13:37:41 +02:00

Fixed OSD Size for skindesigner with UHD

Fixed corruption with fast Menue Switch
This commit is contained in:
jojo61 2019-11-11 17:45:59 +01:00
parent b883fa606b
commit 8838d4c754
2 changed files with 45 additions and 36 deletions

View File

@ -909,6 +909,7 @@ bool cOglCmdCopyBufferToOutputFb::Execute(void) {
#endif #endif
ActivateOsd(oFb->texture,x, y, fb->Width() ,fb->Height()); ActivateOsd(oFb->texture,x, y, fb->Width() ,fb->Height());
oFb->Unbind(); oFb->Unbind();
glFlush();
pthread_mutex_unlock(&OSDMutex); pthread_mutex_unlock(&OSDMutex);
return true; return true;

22
video.c
View File

@ -2860,7 +2860,7 @@ int get_RGB(CuvidDecoder * decoder)
if (OsdShown == 1) { if (OsdShown == 1) {
if (OSDtexture) if (OSDtexture)
glDeleteTextures(1,&OSDtexture); glDeleteTextures(1,&OSDtexture);
pthread_mutex_lock(&OSDMutex);
glGenTextures(1, &OSDtexture); glGenTextures(1, &OSDtexture);
glBindTexture(GL_TEXTURE_2D, OSDtexture); glBindTexture(GL_TEXTURE_2D, OSDtexture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, OSDxsize, OSDysize, 0, GL_RGBA, GL_UNSIGNED_BYTE, posd); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, OSDxsize, OSDysize, 0, GL_RGBA, GL_UNSIGNED_BYTE, posd);
@ -2868,6 +2868,7 @@ int get_RGB(CuvidDecoder * decoder)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
pthread_mutex_unlock(&OSDMutex);
OsdShown = 2; OsdShown = 2;
} }
@ -2888,11 +2889,11 @@ int get_RGB(CuvidDecoder * decoder)
glActiveTexture(GL_TEXTURE0); glActiveTexture(GL_TEXTURE0);
pthread_mutex_lock(&OSDMutex); // pthread_mutex_lock(&OSDMutex);
glBindTexture(GL_TEXTURE_2D, OSDtexture); glBindTexture(GL_TEXTURE_2D, OSDtexture);
glBindFramebuffer(GL_FRAMEBUFFER, fb); glBindFramebuffer(GL_FRAMEBUFFER, fb);
render_pass_quad(0, 0.0, 0.0); render_pass_quad(0, 0.0, 0.0);
pthread_mutex_unlock(&OSDMutex); // pthread_mutex_unlock(&OSDMutex);
glUseProgram(0); glUseProgram(0);
glActiveTexture(GL_TEXTURE0); glActiveTexture(GL_TEXTURE0);
@ -3877,11 +3878,12 @@ static void CuvidDisplayFrame(void)
if (OsdShown && valid_frame) { if (OsdShown && valid_frame) {
GLint texLoc; GLint texLoc;
int x,y,w,h;
glBindTexture(GL_TEXTURE_2D, 0); glBindTexture(GL_TEXTURE_2D, 0);
if (OsdShown == 1) { if (OsdShown == 1) {
if (OSDtexture) if (OSDtexture)
glDeleteTextures(1,&OSDtexture); glDeleteTextures(1,&OSDtexture);
pthread_mutex_lock(&OSDMutex);
glGenTextures(1, &OSDtexture); glGenTextures(1, &OSDtexture);
glBindTexture(GL_TEXTURE_2D, OSDtexture); glBindTexture(GL_TEXTURE_2D, OSDtexture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, OSDxsize, OSDysize, 0, GL_RGBA, GL_UNSIGNED_BYTE, posd); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, OSDxsize, OSDysize, 0, GL_RGBA, GL_UNSIGNED_BYTE, posd);
@ -3889,6 +3891,8 @@ static void CuvidDisplayFrame(void)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
glFlush();
pthread_mutex_unlock(&OSDMutex);
OsdShown = 2; OsdShown = 2;
} }
glBindTexture(GL_TEXTURE_2D, 0); glBindTexture(GL_TEXTURE_2D, 0);
@ -3897,7 +3901,11 @@ static void CuvidDisplayFrame(void)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
GlxCheck(); GlxCheck();
glViewport(OSDx,(VideoWindowHeight - OSDysize - OSDy) , OSDxsize, OSDysize); y = OSDy*VideoWindowHeight/OsdHeight;
x = OSDx*VideoWindowWidth/OsdWidth;
h = OSDysize*VideoWindowHeight/OsdHeight;
w = OSDxsize*VideoWindowWidth/OsdWidth;
glViewport(x,(VideoWindowHeight - h - y) , w, h);
if (gl_prog_osd == 0) if (gl_prog_osd == 0)
gl_prog_osd = sc_generate_osd(gl_prog_osd); // generate shader programm gl_prog_osd = sc_generate_osd(gl_prog_osd); // generate shader programm
@ -3908,10 +3916,10 @@ static void CuvidDisplayFrame(void)
glActiveTexture(GL_TEXTURE0); glActiveTexture(GL_TEXTURE0);
pthread_mutex_lock(&OSDMutex); // pthread_mutex_lock(&OSDMutex);
glBindTexture(GL_TEXTURE_2D, OSDtexture); glBindTexture(GL_TEXTURE_2D, OSDtexture);
render_pass_quad(1, 0, 0); render_pass_quad(1, 0, 0);
pthread_mutex_unlock(&OSDMutex); // pthread_mutex_unlock(&OSDMutex);
glUseProgram(0); glUseProgram(0);
glActiveTexture(GL_TEXTURE0); glActiveTexture(GL_TEXTURE0);