mirror of
https://github.com/jojo61/vdr-plugin-softhdcuvid.git
synced 2023-10-10 13:37:41 +02:00
Fix epggrid scolling with tvguide
This commit is contained in:
parent
14ba527a45
commit
f756334187
@ -331,6 +331,7 @@ void cOglGlyph::LoadTexture(FT_BitmapGlyph ftGlyph) {
|
|||||||
extern "C" void GlxInitopengl();
|
extern "C" void GlxInitopengl();
|
||||||
extern "C" void GlxDrawopengl();
|
extern "C" void GlxDrawopengl();
|
||||||
extern "C" void GlxDestroy();
|
extern "C" void GlxDestroy();
|
||||||
|
extern "C" void makejpg(uint8_t *data, int width, int height);
|
||||||
/****************************************************************************************
|
/****************************************************************************************
|
||||||
* cOglFont
|
* cOglFont
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
@ -475,6 +476,7 @@ cOglFb::cOglFb(GLint width, GLint height, GLint viewPortWidth, GLint viewPortHei
|
|||||||
initiated = false;
|
initiated = false;
|
||||||
fb = 0;
|
fb = 0;
|
||||||
texture = 0;
|
texture = 0;
|
||||||
|
|
||||||
this->width = width;
|
this->width = width;
|
||||||
this->height = height;
|
this->height = height;
|
||||||
this->viewPortWidth = viewPortWidth;
|
this->viewPortWidth = viewPortWidth;
|
||||||
@ -495,7 +497,6 @@ cOglFb::~cOglFb(void) {
|
|||||||
|
|
||||||
bool cOglFb::Init(void) {
|
bool cOglFb::Init(void) {
|
||||||
initiated = true;
|
initiated = true;
|
||||||
|
|
||||||
glGenTextures(1, &texture);
|
glGenTextures(1, &texture);
|
||||||
glBindTexture(GL_TEXTURE_2D, texture);
|
glBindTexture(GL_TEXTURE_2D, texture);
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
||||||
@ -770,6 +771,7 @@ cOglCmdRenderFbToBufferFb::cOglCmdRenderFbToBufferFb(cOglFb *fb, cOglFb *buffer,
|
|||||||
this->drawPortX = (GLfloat)drawPortX;
|
this->drawPortX = (GLfloat)drawPortX;
|
||||||
this->drawPortY = (GLfloat)drawPortY;
|
this->drawPortY = (GLfloat)drawPortY;
|
||||||
this->transparency = transparency;
|
this->transparency = transparency;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cOglCmdRenderFbToBufferFb::Execute(void) {
|
bool cOglCmdRenderFbToBufferFb::Execute(void) {
|
||||||
@ -785,10 +787,10 @@ bool cOglCmdRenderFbToBufferFb::Execute(void) {
|
|||||||
GLfloat pageHeight = (GLfloat)fb->ViewportHeight() / (GLfloat)fb->Height();
|
GLfloat pageHeight = (GLfloat)fb->ViewportHeight() / (GLfloat)fb->Height();
|
||||||
texX1 = abs(drawPortX) / (GLfloat)fb->Width();
|
texX1 = abs(drawPortX) / (GLfloat)fb->Width();
|
||||||
texY1 = 1.0f - pageHeight - abs(drawPortY) / (GLfloat)fb->Height();
|
texY1 = 1.0f - pageHeight - abs(drawPortY) / (GLfloat)fb->Height();
|
||||||
texX2 = texX1 + (GLfloat)fb->ViewportWidth() / (GLfloat)fb->Width();
|
// texX2 = texX1 + (GLfloat)fb->ViewportWidth() / (GLfloat)fb->Width();
|
||||||
|
x2 = x + fb->Width();
|
||||||
texY2 = texY1 + pageHeight;
|
texY2 = texY1 + pageHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLfloat quadVertices[] = {
|
GLfloat quadVertices[] = {
|
||||||
// Pos // TexCoords
|
// Pos // TexCoords
|
||||||
x , y , texX1, texY2, //left top
|
x , y , texX1, texY2, //left top
|
||||||
@ -805,8 +807,10 @@ bool cOglCmdRenderFbToBufferFb::Execute(void) {
|
|||||||
VertexBuffers[vbTexture]->SetShaderProjectionMatrix(buffer->Width(), buffer->Height());
|
VertexBuffers[vbTexture]->SetShaderProjectionMatrix(buffer->Width(), buffer->Height());
|
||||||
|
|
||||||
buffer->Bind();
|
buffer->Bind();
|
||||||
|
|
||||||
if (!fb->BindTexture())
|
if (!fb->BindTexture())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
VertexBuffers[vbTexture]->Bind();
|
VertexBuffers[vbTexture]->Bind();
|
||||||
VertexBuffers[vbTexture]->SetVertexData(quadVertices);
|
VertexBuffers[vbTexture]->SetVertexData(quadVertices);
|
||||||
VertexBuffers[vbTexture]->DrawArrays();
|
VertexBuffers[vbTexture]->DrawArrays();
|
||||||
@ -829,14 +833,13 @@ bool cOglCmdCopyBufferToOutputFb::Execute(void) {
|
|||||||
|
|
||||||
pthread_mutex_lock(&OSDMutex);
|
pthread_mutex_lock(&OSDMutex);
|
||||||
fb->BindRead();
|
fb->BindRead();
|
||||||
oFb->BindWrite();
|
|
||||||
|
|
||||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||||
glPixelStorei(GL_PACK_ALIGNMENT, 1);
|
glPixelStorei(GL_PACK_ALIGNMENT, 1);
|
||||||
if (posd)
|
if (posd)
|
||||||
glReadPixels(0, 0 ,fb->Width(), fb->Height(),GL_RGBA,GL_UNSIGNED_BYTE,posd);
|
glReadPixels(0, 0 ,fb->Width(), fb->Height(),GL_RGBA,GL_UNSIGNED_BYTE,posd);
|
||||||
glFlush();
|
glFlush();
|
||||||
oFb->Unbind();
|
|
||||||
pthread_mutex_unlock(&OSDMutex);
|
pthread_mutex_unlock(&OSDMutex);
|
||||||
ActivateOsd(oFb->texture,x, y, fb->Width() ,fb->Height());
|
ActivateOsd(oFb->texture,x, y, fb->Width() ,fb->Height());
|
||||||
return true;
|
return true;
|
||||||
@ -1237,7 +1240,6 @@ bool cOglCmdDrawText::Execute(void) {
|
|||||||
if ( xGlyph > fb->Width() - 1 )
|
if ( xGlyph > fb->Width() - 1 )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, 0);
|
glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
VertexBuffers[vbText]->Unbind();
|
VertexBuffers[vbText]->Unbind();
|
||||||
fb->Unbind();
|
fb->Unbind();
|
||||||
@ -1264,7 +1266,7 @@ cOglCmdDrawImage::~cOglCmdDrawImage(void) {
|
|||||||
bool cOglCmdDrawImage::Execute(void) {
|
bool cOglCmdDrawImage::Execute(void) {
|
||||||
GLuint texture;
|
GLuint texture;
|
||||||
#ifdef USE_DRM
|
#ifdef USE_DRM
|
||||||
pthread_mutex_lock(&OSDMutex);
|
// pthread_mutex_lock(&OSDMutex);
|
||||||
GlxDrawopengl(); // here we need the Shared Context for upload
|
GlxDrawopengl(); // here we need the Shared Context for upload
|
||||||
GlxCheck();
|
GlxCheck();
|
||||||
#endif
|
#endif
|
||||||
@ -1290,7 +1292,7 @@ bool cOglCmdDrawImage::Execute(void) {
|
|||||||
#ifdef USE_DRM
|
#ifdef USE_DRM
|
||||||
GlxInitopengl(); // Reset Context
|
GlxInitopengl(); // Reset Context
|
||||||
GlxCheck();
|
GlxCheck();
|
||||||
pthread_mutex_unlock(&OSDMutex);
|
// pthread_mutex_unlock(&OSDMutex);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
GLfloat x1 = x; //left
|
GLfloat x1 = x; //left
|
||||||
@ -1382,7 +1384,7 @@ cOglCmdStoreImage::~cOglCmdStoreImage(void) {
|
|||||||
|
|
||||||
bool cOglCmdStoreImage::Execute(void) {
|
bool cOglCmdStoreImage::Execute(void) {
|
||||||
#ifdef USE_DRM
|
#ifdef USE_DRM
|
||||||
pthread_mutex_lock(&OSDMutex);
|
// pthread_mutex_lock(&OSDMutex);
|
||||||
GlxDrawopengl(); // here we need the Shared Context for upload
|
GlxDrawopengl(); // here we need the Shared Context for upload
|
||||||
GlxCheck();
|
GlxCheck();
|
||||||
#endif
|
#endif
|
||||||
@ -1408,7 +1410,7 @@ bool cOglCmdStoreImage::Execute(void) {
|
|||||||
#ifdef USE_DRM
|
#ifdef USE_DRM
|
||||||
GlxInitopengl(); // Reset Context
|
GlxInitopengl(); // Reset Context
|
||||||
GlxCheck();
|
GlxCheck();
|
||||||
pthread_mutex_lock(&OSDMutex);
|
// pthread_mutex_lock(&OSDMutex);
|
||||||
#endif
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1826,7 +1828,6 @@ void cOglPixmap::DrawImage(const cPoint &Point, const cImage &Image) {
|
|||||||
memcpy(argb, Image.Data(), sizeof(tColor) * Image.Width() * Image.Height());
|
memcpy(argb, Image.Data(), sizeof(tColor) * Image.Width() * Image.Height());
|
||||||
|
|
||||||
oglThread->DoCmd(new cOglCmdDrawImage(fb, argb, Image.Width(), Image.Height(), Point.X(), Point.Y()));
|
oglThread->DoCmd(new cOglCmdDrawImage(fb, argb, Image.Width(), Image.Height(), Point.X(), Point.Y()));
|
||||||
|
|
||||||
SetDirty();
|
SetDirty();
|
||||||
MarkDrawPortDirty(cRect(Point, cSize(Image.Width(), Image.Height())).Intersected(DrawPort().Size()));
|
MarkDrawPortDirty(cRect(Point, cSize(Image.Width(), Image.Height())).Intersected(DrawPort().Size()));
|
||||||
}
|
}
|
||||||
@ -1834,6 +1835,7 @@ void cOglPixmap::DrawImage(const cPoint &Point, const cImage &Image) {
|
|||||||
void cOglPixmap::DrawImage(const cPoint &Point, int ImageHandle) {
|
void cOglPixmap::DrawImage(const cPoint &Point, int ImageHandle) {
|
||||||
if (!oglThread->Active())
|
if (!oglThread->Active())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (ImageHandle < 0 && oglThread->GetImageRef(ImageHandle)) {
|
if (ImageHandle < 0 && oglThread->GetImageRef(ImageHandle)) {
|
||||||
sOglImage *img = oglThread->GetImageRef(ImageHandle);
|
sOglImage *img = oglThread->GetImageRef(ImageHandle);
|
||||||
oglThread->DoCmd(new cOglCmdDrawTexture(fb, img, Point.X(), Point.Y()));
|
oglThread->DoCmd(new cOglCmdDrawTexture(fb, img, Point.X(), Point.Y()));
|
||||||
@ -1874,6 +1876,7 @@ void cOglPixmap::DrawBitmap(const cPoint &Point, const cBitmap &Bitmap, tColor C
|
|||||||
(index == 0 ? ColorBg : index == 1 ? ColorFg :
|
(index == 0 ? ColorBg : index == 1 ? ColorFg :
|
||||||
Bitmap.Color(index)) : Bitmap.Color(index));
|
Bitmap.Color(index)) : Bitmap.Color(index));
|
||||||
}
|
}
|
||||||
|
|
||||||
oglThread->DoCmd(new cOglCmdDrawImage(fb, argb, Bitmap.Width(), Bitmap.Height(), Point.X(), Point.Y(), Overlay));
|
oglThread->DoCmd(new cOglCmdDrawImage(fb, argb, Bitmap.Width(), Bitmap.Height(), Point.X(), Point.Y(), Overlay));
|
||||||
SetDirty();
|
SetDirty();
|
||||||
MarkDrawPortDirty(cRect(Point, cSize(Bitmap.Width(), Bitmap.Height())).Intersected(DrawPort().Size()));
|
MarkDrawPortDirty(cRect(Point, cSize(Bitmap.Width(), Bitmap.Height())).Intersected(DrawPort().Size()));
|
||||||
@ -1892,7 +1895,6 @@ void cOglPixmap::DrawText(const cPoint &Point, const char *s, tColor ColorFg, tC
|
|||||||
Utf8ToArray(s, symbols, len + 1);
|
Utf8ToArray(s, symbols, len + 1);
|
||||||
else
|
else
|
||||||
symbols[0] = 0;
|
symbols[0] = 0;
|
||||||
|
|
||||||
int x = Point.X();
|
int x = Point.X();
|
||||||
int y = Point.Y();
|
int y = Point.Y();
|
||||||
int w = Font->Width(s);
|
int w = Font->Width(s);
|
||||||
@ -1995,7 +1997,7 @@ cOglOsd::cOglOsd(int Left, int Top, uint Level, std::shared_ptr<cOglThread> oglT
|
|||||||
int osdWidth = 0;
|
int osdWidth = 0;
|
||||||
int osdHeight = 0;
|
int osdHeight = 0;
|
||||||
|
|
||||||
pthread_mutex_lock(&OSDMutex);
|
// pthread_mutex_lock(&OSDMutex);
|
||||||
VideoGetOsdSize(&osdWidth, &osdHeight);
|
VideoGetOsdSize(&osdWidth, &osdHeight);
|
||||||
// osdWidth = 1920;
|
// osdWidth = 1920;
|
||||||
// osdHeight = 1080;
|
// osdHeight = 1080;
|
||||||
@ -2014,7 +2016,7 @@ cOglOsd::cOglOsd(int Left, int Top, uint Level, std::shared_ptr<cOglThread> oglT
|
|||||||
oglThread->DoCmd(new cOglCmdInitOutputFb(oFb));
|
oglThread->DoCmd(new cOglCmdInitOutputFb(oFb));
|
||||||
}
|
}
|
||||||
|
|
||||||
pthread_mutex_unlock(&OSDMutex);
|
// pthread_mutex_unlock(&OSDMutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
cOglOsd::~cOglOsd() {
|
cOglOsd::~cOglOsd() {
|
||||||
@ -2080,6 +2082,7 @@ void cOglOsd::DestroyPixmap(cPixmap *Pixmap) {
|
|||||||
return;
|
return;
|
||||||
if (!Pixmap)
|
if (!Pixmap)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
LOCK_PIXMAPS;
|
LOCK_PIXMAPS;
|
||||||
int start = 1;
|
int start = 1;
|
||||||
if (isSubtitleOsd)
|
if (isSubtitleOsd)
|
||||||
@ -2142,3 +2145,4 @@ void cOglOsd::DrawScaledBitmap(int x, int y, const cBitmap &Bitmap, double Facto
|
|||||||
int yNew = y - oglPixmaps[0]->ViewPort().Y();
|
int yNew = y - oglPixmaps[0]->ViewPort().Y();
|
||||||
oglPixmaps[0]->DrawBitmap(cPoint(x, yNew), Bitmap);
|
oglPixmaps[0]->DrawBitmap(cPoint(x, yNew), Bitmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
54
video.c
54
video.c
@ -2492,7 +2492,6 @@ void createTextureDst(CuvidDecoder * decoder, int anz, unsigned int size_x, unsi
|
|||||||
|
|
||||||
void generateVAAPIImage(CuvidDecoder * decoder, int index, const AVFrame * frame, int image_width, int image_height)
|
void generateVAAPIImage(CuvidDecoder * decoder, int index, const AVFrame * frame, int image_width, int image_height)
|
||||||
{
|
{
|
||||||
|
|
||||||
VAStatus status;
|
VAStatus status;
|
||||||
|
|
||||||
uint64_t first_time;
|
uint64_t first_time;
|
||||||
@ -3036,7 +3035,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);
|
// 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);
|
||||||
@ -3044,7 +3043,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);
|
// pthread_mutex_unlock(&OSDMutex);
|
||||||
OsdShown = 2;
|
OsdShown = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4370,7 +4369,7 @@ static void CuvidSyncDecoder(CuvidDecoder * decoder)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (abs(diff) > 5000 * 90) { // more than 5s
|
if (abs(diff) > 5000 * 90) { // more than 5s
|
||||||
err = CuvidMessage(2, "video: audio/video difference too big\n");
|
err = CuvidMessage(2, "video: audio/video difference too big %d\n",diff/90);
|
||||||
// decoder->SyncCounter = 1;
|
// decoder->SyncCounter = 1;
|
||||||
// usleep(10);
|
// usleep(10);
|
||||||
// goto out;
|
// goto out;
|
||||||
@ -6959,3 +6958,50 @@ void GlxDestroy() {
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if 0 // for debug only
|
||||||
|
#include <sys/stat.h>
|
||||||
|
extern uint8_t *CreateJpeg(uint8_t *, int *, int, int, int);
|
||||||
|
|
||||||
|
void makejpg(uint8_t *data, int width, int height) {
|
||||||
|
static int count=0;
|
||||||
|
int i,n=0,gpu=0;;
|
||||||
|
char buf[32],FileName[32];
|
||||||
|
uint8_t *rgb;
|
||||||
|
uint8_t *jpg_image;
|
||||||
|
int size,size1;
|
||||||
|
|
||||||
|
if (data == NULL) {
|
||||||
|
data = malloc(width*height*4);
|
||||||
|
gpu=1;
|
||||||
|
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||||
|
glPixelStorei(GL_PACK_ALIGNMENT, 1);
|
||||||
|
glReadPixels(0, 0, width, height, GL_BGRA, GL_UNSIGNED_BYTE, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// n = snprintf(buf, sizeof(buf), "P6\n%d\n%d\n255\n", width, height);
|
||||||
|
sprintf(FileName,"/tmp/test%d.jpg",count++);
|
||||||
|
|
||||||
|
rgb = malloc(width * height * 3 + n);
|
||||||
|
if (!rgb) {
|
||||||
|
printf("Unable to get RGB Memory \n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// memcpy(rgb, buf, n); // header
|
||||||
|
size = width * height * 4;
|
||||||
|
|
||||||
|
for (i = 0; i < size / 4; ++i) { // convert bgra -> rgb
|
||||||
|
rgb[n + i * 3 + 0] = data[i * 4 + 2];
|
||||||
|
rgb[n + i * 3 + 1] = data[i * 4 + 1];
|
||||||
|
rgb[n + i * 3 + 2] = data[i * 4 + 0];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gpu)
|
||||||
|
free(data);
|
||||||
|
|
||||||
|
jpg_image = CreateJpeg(rgb, &size1, 90, width, height);
|
||||||
|
int fd = open(FileName, O_WRONLY | O_CREAT | O_NOFOLLOW | O_TRUNC, DEFFILEMODE);
|
||||||
|
write(fd,jpg_image,size1);
|
||||||
|
close(fd);
|
||||||
|
free(rgb);
|
||||||
|
}
|
||||||
|
#endif
|
Loading…
Reference in New Issue
Block a user