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;

80
video.c
View File

@ -2855,27 +2855,28 @@ int get_RGB(CuvidDecoder * decoder)
glActiveTexture(GL_TEXTURE0); glActiveTexture(GL_TEXTURE0);
if (OsdShown && decoder->grab == 2) { if (OsdShown && decoder->grab == 2) {
int x,y,h,w; int x,y,h,w;
GLint texLoc; GLint texLoc;
if (OsdShown == 1) { if (OsdShown == 1) {
if (OSDtexture) if (OSDtexture)
glDeleteTextures(1,&OSDtexture); glDeleteTextures(1,&OSDtexture);
pthread_mutex_lock(&OSDMutex);
glGenTextures(1, &OSDtexture);
glBindTexture(GL_TEXTURE_2D, OSDtexture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, OSDxsize, OSDysize, 0, GL_RGBA, GL_UNSIGNED_BYTE, posd);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_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_T, GL_CLAMP_TO_BORDER);
pthread_mutex_unlock(&OSDMutex);
OsdShown = 2;
}
glGenTextures(1, &OSDtexture); y = OSDy*height/VideoWindowHeight;
glBindTexture(GL_TEXTURE_2D, OSDtexture); x = OSDx*width/VideoWindowWidth;
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, OSDxsize, OSDysize, 0, GL_RGBA, GL_UNSIGNED_BYTE, posd); h = OSDysize*height/VideoWindowHeight;
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); w = OSDxsize*width/VideoWindowWidth;
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glViewport(x,(height - h - y) , w, h);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
OsdShown = 2;
}
y = OSDy*height/VideoWindowHeight;
x = OSDx*width/VideoWindowWidth;
h = OSDysize*height/VideoWindowHeight;
w = OSDxsize*width/VideoWindowWidth;
glViewport(x,(height - h - y) , w, h);
glEnable(GL_BLEND); glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@ -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,27 +3878,34 @@ 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);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
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);
glEnable(GL_BLEND); glEnable(GL_BLEND);
GlxCheck(); GlxCheck();
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);