mirror of
https://github.com/jojo61/vdr-plugin-softhdcuvid.git
synced 2023-10-10 13:37:41 +02:00
Aspect fix for SD and more mutex for OSD
This commit is contained in:
parent
cca1022528
commit
580ab6dc42
@ -672,7 +672,7 @@ void cOglVb::DrawArrays(int count) {
|
|||||||
glFlush();
|
glFlush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
/****************************************************************************************
|
/****************************************************************************************
|
||||||
* cOpenGLCmd
|
* cOpenGLCmd
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
@ -686,7 +686,7 @@ bool cOglCmdInitOutputFb::Execute(void) {
|
|||||||
oFb->Unbind();
|
oFb->Unbind();
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
//------------------ cOglCmdInitFb --------------------
|
//------------------ cOglCmdInitFb --------------------
|
||||||
cOglCmdInitFb::cOglCmdInitFb(cOglFb *fb, cCondWait *wait) : cOglCmd(fb) {
|
cOglCmdInitFb::cOglCmdInitFb(cOglFb *fb, cCondWait *wait) : cOglCmd(fb) {
|
||||||
this->wait = wait;
|
this->wait = wait;
|
||||||
@ -1649,13 +1649,18 @@ void cOglThread::DeleteVertexBuffers(void) {
|
|||||||
|
|
||||||
void cOglThread::Cleanup(void) {
|
void cOglThread::Cleanup(void) {
|
||||||
esyslog("[softhddev]OglThread cleanup\n");
|
esyslog("[softhddev]OglThread cleanup\n");
|
||||||
|
pthread_mutex_lock(&OSDMutex);
|
||||||
|
OsdClose();
|
||||||
|
|
||||||
DeleteVertexBuffers();
|
DeleteVertexBuffers();
|
||||||
// delete cOglOsd::oFb;
|
// delete cOglOsd::oFb;
|
||||||
|
|
||||||
cOglOsd::oFb = NULL;
|
cOglOsd::oFb = NULL;
|
||||||
DeleteShaders();
|
DeleteShaders();
|
||||||
// glVDPAUFiniNV();
|
// glVDPAUFiniNV();
|
||||||
cOglFont::Cleanup();
|
cOglFont::Cleanup();
|
||||||
// glutExit();
|
// glutExit();
|
||||||
|
pthread_mutex_unlock(&OSDMutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************************
|
/****************************************************************************************
|
||||||
@ -1921,7 +1926,7 @@ eOsdError cOglOsd::SetAreas(const tArea *Areas, int NumAreas) {
|
|||||||
|
|
||||||
//now we know the actuaL osd size, create double buffer frame buffer
|
//now we know the actuaL osd size, create double buffer frame buffer
|
||||||
if (bFb) {
|
if (bFb) {
|
||||||
oglThread->DoCmd(new cOglCmdDeleteFb(bFb));
|
oglThread->DoCmd(new cOglCmdDeleteFb(bFb));
|
||||||
DestroyPixmap(oglPixmaps[0]);
|
DestroyPixmap(oglPixmaps[0]);
|
||||||
}
|
}
|
||||||
bFb = new cOglFb(r.Width(), r.Height(), r.Width(), r.Height());
|
bFb = new cOglFb(r.Width(), r.Height(), r.Width(), r.Height());
|
||||||
@ -1995,6 +2000,8 @@ void cOglOsd::Flush(void) {
|
|||||||
//clear buffer
|
//clear buffer
|
||||||
//uint64_t start = cTimeMs::Now();
|
//uint64_t start = cTimeMs::Now();
|
||||||
//dsyslog("[softhddev]Start Flush at %" PRIu64 "", cTimeMs::Now());
|
//dsyslog("[softhddev]Start Flush at %" PRIu64 "", cTimeMs::Now());
|
||||||
|
|
||||||
|
pthread_mutex_lock(&OSDMutex);
|
||||||
oglThread->DoCmd(new cOglCmdFill(bFb, clrTransparent));
|
oglThread->DoCmd(new cOglCmdFill(bFb, clrTransparent));
|
||||||
|
|
||||||
//render pixmap textures blended to buffer
|
//render pixmap textures blended to buffer
|
||||||
@ -2015,6 +2022,7 @@ void cOglOsd::Flush(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ActivateOsd(bFb->texture,Left(), Top() , bFb->Width(), bFb->Height());
|
ActivateOsd(bFb->texture,Left(), Top() , bFb->Width(), bFb->Height());
|
||||||
|
pthread_mutex_unlock(&OSDMutex);
|
||||||
// oglThread->DoCmd(new cOglCmdCopyBufferToOutputFb(bFb, oFb, Left(), Top()));
|
// oglThread->DoCmd(new cOglCmdCopyBufferToOutputFb(bFb, oFb, Left(), Top()));
|
||||||
//dsyslog("[softhddev]End Flush at %" PRIu64 ", duration %d", cTimeMs::Now(), (int)(cTimeMs::Now()-start));
|
//dsyslog("[softhddev]End Flush at %" PRIu64 ", duration %d", cTimeMs::Now(), (int)(cTimeMs::Now()-start));
|
||||||
}
|
}
|
||||||
|
@ -44,8 +44,11 @@ extern "C"
|
|||||||
#include "audio.h"
|
#include "audio.h"
|
||||||
#include "video.h"
|
#include "video.h"
|
||||||
#include "codec.h"
|
#include "codec.h"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" pthread_mutex_t OSDMutex;
|
||||||
|
|
||||||
struct sOglImage {
|
struct sOglImage {
|
||||||
GLuint texture;
|
GLuint texture;
|
||||||
GLint width;
|
GLint width;
|
||||||
|
@ -315,18 +315,18 @@ void cSoftOsd::SetActive(bool on)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (Active() == on) {
|
if (Active() == on) {
|
||||||
return; // already active, no action
|
return; // already active, no action
|
||||||
}
|
}
|
||||||
cOsd::SetActive(on);
|
cOsd::SetActive(on);
|
||||||
|
|
||||||
if (on) {
|
if (on) {
|
||||||
Dirty = 1;
|
Dirty = 1;
|
||||||
// only flush here if there are already bitmaps
|
// only flush here if there are already bitmaps
|
||||||
if (GetBitmap(0)) {
|
if (GetBitmap(0)) {
|
||||||
Flush();
|
Flush();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
OsdClose();
|
OsdClose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -391,7 +391,7 @@ eOsdError cSoftOsd::SetAreas(const tArea * areas, int n)
|
|||||||
|
|
||||||
// clear old OSD, when new areas are set
|
// clear old OSD, when new areas are set
|
||||||
if (!IsTrueColor()) {
|
if (!IsTrueColor()) {
|
||||||
cBitmap *bitmap;
|
cBitmap *bitmap;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; (bitmap = GetBitmap(i)); i++) {
|
for (i = 0; (bitmap = GetBitmap(i)); i++) {
|
||||||
@ -399,8 +399,8 @@ eOsdError cSoftOsd::SetAreas(const tArea * areas, int n)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Active()) {
|
if (Active()) {
|
||||||
VideoOsdClear();
|
VideoOsdClear();
|
||||||
Dirty = 1;
|
Dirty = 1;
|
||||||
}
|
}
|
||||||
return cOsd::SetAreas(areas, n);
|
return cOsd::SetAreas(areas, n);
|
||||||
}
|
}
|
||||||
@ -1612,12 +1612,12 @@ eOSState cSoftHdControl::ProcessKey(eKeys key)
|
|||||||
{
|
{
|
||||||
if (SuspendMode == SUSPEND_NORMAL && (!ISMODELESSKEY(key)
|
if (SuspendMode == SUSPEND_NORMAL && (!ISMODELESSKEY(key)
|
||||||
|| key == kMenu || key == kBack || key == kStop)) {
|
|| key == kMenu || key == kBack || key == kStop)) {
|
||||||
delete Player;
|
delete Player;
|
||||||
|
|
||||||
Player = NULL;
|
Player = NULL;
|
||||||
Resume();
|
Resume();
|
||||||
SuspendMode = NOT_SUSPENDED;
|
SuspendMode = NOT_SUSPENDED;
|
||||||
return osEnd;
|
return osEnd;
|
||||||
}
|
}
|
||||||
return osContinue;
|
return osContinue;
|
||||||
}
|
}
|
||||||
@ -1640,8 +1640,8 @@ cSoftHdControl::~cSoftHdControl()
|
|||||||
Player = NULL;
|
Player = NULL;
|
||||||
// loose control resume
|
// loose control resume
|
||||||
if (SuspendMode == SUSPEND_NORMAL) {
|
if (SuspendMode == SUSPEND_NORMAL) {
|
||||||
Resume();
|
Resume();
|
||||||
SuspendMode = NOT_SUSPENDED;
|
SuspendMode = NOT_SUSPENDED;
|
||||||
}
|
}
|
||||||
|
|
||||||
dsyslog("[softhddev]%s: dummy player stopped\n", __FUNCTION__);
|
dsyslog("[softhddev]%s: dummy player stopped\n", __FUNCTION__);
|
||||||
@ -3104,14 +3104,14 @@ void cPluginSoftHdDevice::Housekeeping(void)
|
|||||||
// check if user is inactive, automatic enter suspend mode
|
// check if user is inactive, automatic enter suspend mode
|
||||||
// FIXME: cControl prevents shutdown, disable this until fixed
|
// FIXME: cControl prevents shutdown, disable this until fixed
|
||||||
if (0 && SuspendMode == NOT_SUSPENDED && ShutdownHandler.IsUserInactive()) {
|
if (0 && SuspendMode == NOT_SUSPENDED && ShutdownHandler.IsUserInactive()) {
|
||||||
// don't overwrite already suspended suspend mode
|
// don't overwrite already suspended suspend mode
|
||||||
cControl::Launch(new cSoftHdControl);
|
cControl::Launch(new cSoftHdControl);
|
||||||
cControl::Attach();
|
cControl::Attach();
|
||||||
Suspend(ConfigSuspendClose, ConfigSuspendClose, ConfigSuspendX11);
|
Suspend(ConfigSuspendClose, ConfigSuspendClose, ConfigSuspendX11);
|
||||||
SuspendMode = SUSPEND_NORMAL;
|
SuspendMode = SUSPEND_NORMAL;
|
||||||
#ifdef USE_OPENGLOSD
|
#ifdef USE_OPENGLOSD
|
||||||
dsyslog("[softhddev]stopping Ogl Thread Housekeeping");
|
dsyslog("[softhddev]stopping Ogl Thread Housekeeping");
|
||||||
cSoftOsdProvider::StopOpenGlThread();
|
cSoftOsdProvider::StopOpenGlThread();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
50
softhddev.c
50
softhddev.c
@ -1556,7 +1556,7 @@ static void VideoMpegEnqueue(VideoStream * stream, int64_t pts, int64_t dts,
|
|||||||
#endif
|
#endif
|
||||||
if (!p[0] || p[0] == 0xb3) {
|
if (!p[0] || p[0] == 0xb3) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "last: %d start\n", stream->StartCodeState);
|
printf("last: %d start aspect %02x\n", stream->StartCodeState,p[4]);
|
||||||
#endif
|
#endif
|
||||||
stream->PacketRb[stream->PacketWrite].stream_index -= 3;
|
stream->PacketRb[stream->PacketWrite].stream_index -= 3;
|
||||||
VideoNextPacket(stream, AV_CODEC_ID_MPEG2VIDEO);
|
VideoNextPacket(stream, AV_CODEC_ID_MPEG2VIDEO);
|
||||||
@ -1566,6 +1566,7 @@ static void VideoMpegEnqueue(VideoStream * stream, int64_t pts, int64_t dts,
|
|||||||
n--;
|
n--;
|
||||||
pts = AV_NOPTS_VALUE;
|
pts = AV_NOPTS_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 2: // 0x00 0x00 seen
|
case 2: // 0x00 0x00 seen
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -1573,7 +1574,7 @@ static void VideoMpegEnqueue(VideoStream * stream, int64_t pts, int64_t dts,
|
|||||||
#endif
|
#endif
|
||||||
if (p[0] == 0x01 && (!p[1] || p[1] == 0xb3)) {
|
if (p[0] == 0x01 && (!p[1] || p[1] == 0xb3)) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "last: %d start\n", stream->StartCodeState);
|
printf( "last: %d start aspect %02x\n", stream->StartCodeState,p[5]);
|
||||||
#endif
|
#endif
|
||||||
stream->PacketRb[stream->PacketWrite].stream_index -= 2;
|
stream->PacketRb[stream->PacketWrite].stream_index -= 2;
|
||||||
VideoNextPacket(stream, AV_CODEC_ID_MPEG2VIDEO);
|
VideoNextPacket(stream, AV_CODEC_ID_MPEG2VIDEO);
|
||||||
@ -1590,7 +1591,7 @@ static void VideoMpegEnqueue(VideoStream * stream, int64_t pts, int64_t dts,
|
|||||||
#endif
|
#endif
|
||||||
if (!p[0] && p[1] == 0x01 && (!p[2] || p[2] == 0xb3)) {
|
if (!p[0] && p[1] == 0x01 && (!p[2] || p[2] == 0xb3)) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "last: %d start\n", stream->StartCodeState);
|
printf( "last: %d start aspect %02x\n", stream->StartCodeState,p[6]);
|
||||||
#endif
|
#endif
|
||||||
stream->PacketRb[stream->PacketWrite].stream_index -= 1;
|
stream->PacketRb[stream->PacketWrite].stream_index -= 1;
|
||||||
VideoNextPacket(stream, AV_CODEC_ID_MPEG2VIDEO);
|
VideoNextPacket(stream, AV_CODEC_ID_MPEG2VIDEO);
|
||||||
@ -1614,10 +1615,10 @@ static void VideoMpegEnqueue(VideoStream * stream, int64_t pts, int64_t dts,
|
|||||||
// FIXME: not perfect, must split at 0xb3 also
|
// FIXME: not perfect, must split at 0xb3 also
|
||||||
if (!p[0] && !p[1] && p[2] == 0x01 && !p[3]) {
|
if (!p[0] && !p[1] && p[2] == 0x01 && !p[3]) {
|
||||||
if (first) {
|
if (first) {
|
||||||
first = 0;
|
first = 0;
|
||||||
n -= 4;
|
n -= 4;
|
||||||
p += 4;
|
p += 4;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// packet has already an picture header
|
// packet has already an picture header
|
||||||
/*
|
/*
|
||||||
@ -1639,6 +1640,9 @@ static void VideoMpegEnqueue(VideoStream * stream, int64_t pts, int64_t dts,
|
|||||||
p += 4;
|
p += 4;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (!p[0] && !p[1] && p[2] == 0x01 && p[3] == 0xb3) {
|
||||||
|
// printf("aspectratio %02x\n",p[7]>>4);
|
||||||
|
}
|
||||||
--n;
|
--n;
|
||||||
++p;
|
++p;
|
||||||
}
|
}
|
||||||
@ -1647,17 +1651,17 @@ static void VideoMpegEnqueue(VideoStream * stream, int64_t pts, int64_t dts,
|
|||||||
switch (n) { // handle packet border start code
|
switch (n) { // handle packet border start code
|
||||||
case 3:
|
case 3:
|
||||||
if (!p[0] && !p[1] && p[2] == 0x01) {
|
if (!p[0] && !p[1] && p[2] == 0x01) {
|
||||||
stream->StartCodeState = 3;
|
stream->StartCodeState = 3;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if (!p[0] && !p[1]) {
|
if (!p[0] && !p[1]) {
|
||||||
stream->StartCodeState = 2;
|
stream->StartCodeState = 2;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (!p[0]) {
|
if (!p[0]) {
|
||||||
stream->StartCodeState = 1;
|
stream->StartCodeState = 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
@ -1756,9 +1760,9 @@ static void VideoStreamOpen(VideoStream * stream)
|
|||||||
stream->CodecID = AV_CODEC_ID_NONE;
|
stream->CodecID = AV_CODEC_ID_NONE;
|
||||||
stream->LastCodecID = AV_CODEC_ID_NONE;
|
stream->LastCodecID = AV_CODEC_ID_NONE;
|
||||||
if ((stream->HwDecoder = VideoNewHwDecoder(stream))) {
|
if ((stream->HwDecoder = VideoNewHwDecoder(stream))) {
|
||||||
stream->Decoder = CodecVideoNewDecoder(stream->HwDecoder);
|
stream->Decoder = CodecVideoNewDecoder(stream->HwDecoder);
|
||||||
VideoPacketInit(stream);
|
VideoPacketInit(stream);
|
||||||
stream->SkipStream = 0;
|
stream->SkipStream = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3321,7 +3325,7 @@ void Suspend(int video, int audio, int dox11)
|
|||||||
{
|
{
|
||||||
pthread_mutex_lock(&SuspendLockMutex);
|
pthread_mutex_lock(&SuspendLockMutex);
|
||||||
if (MyVideoStream->SkipStream && SkipAudio) { // already suspended
|
if (MyVideoStream->SkipStream && SkipAudio) { // already suspended
|
||||||
pthread_mutex_unlock(&SuspendLockMutex);
|
pthread_mutex_unlock(&SuspendLockMutex);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3337,17 +3341,17 @@ void Suspend(int video, int audio, int dox11)
|
|||||||
SkipAudio = 1;
|
SkipAudio = 1;
|
||||||
|
|
||||||
if (audio) {
|
if (audio) {
|
||||||
AudioExit();
|
AudioExit();
|
||||||
if (MyAudioDecoder) {
|
if (MyAudioDecoder) {
|
||||||
CodecAudioClose(MyAudioDecoder);
|
CodecAudioClose(MyAudioDecoder);
|
||||||
CodecAudioDelDecoder(MyAudioDecoder);
|
CodecAudioDelDecoder(MyAudioDecoder);
|
||||||
MyAudioDecoder = NULL;
|
MyAudioDecoder = NULL;
|
||||||
}
|
}
|
||||||
NewAudioStream = 0;
|
NewAudioStream = 0;
|
||||||
av_free_packet(AudioAvPkt);
|
av_free_packet(AudioAvPkt);
|
||||||
}
|
}
|
||||||
if (video) {
|
if (video) {
|
||||||
StopVideo();
|
StopVideo();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dox11) {
|
if (dox11) {
|
||||||
|
60
video.c
60
video.c
@ -416,7 +416,7 @@ static pthread_t VideoThread; ///< video decode thread
|
|||||||
static pthread_cond_t VideoWakeupCond; ///< wakeup condition variable
|
static pthread_cond_t VideoWakeupCond; ///< wakeup condition variable
|
||||||
static pthread_mutex_t VideoMutex; ///< video condition mutex
|
static pthread_mutex_t VideoMutex; ///< video condition mutex
|
||||||
static pthread_mutex_t VideoLockMutex; ///< video lock mutex
|
static pthread_mutex_t VideoLockMutex; ///< video lock mutex
|
||||||
|
pthread_mutex_t OSDMutex; ///< OSD update mutex
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_VIDEO_THREAD2
|
#ifdef USE_VIDEO_THREAD2
|
||||||
@ -601,9 +601,7 @@ static void VideoUpdateOutput(AVRational input_aspect_ratio, int input_width,
|
|||||||
tmp_ratio.num = 4;
|
tmp_ratio.num = 4;
|
||||||
tmp_ratio.den = 3;
|
tmp_ratio.den = 3;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "ratio: %d:%d %d:%d\n", input_aspect_ratio.num,
|
Debug(4, "ratio: %d:%d %d:%d\n", input_aspect_ratio.num, input_aspect_ratio.den, display_aspect_ratio.num, display_aspect_ratio.den);
|
||||||
input_aspect_ratio.den, display_aspect_ratio.num,
|
|
||||||
display_aspect_ratio.den);
|
|
||||||
#endif
|
#endif
|
||||||
if (!av_cmp_q(input_aspect_ratio, tmp_ratio)) {
|
if (!av_cmp_q(input_aspect_ratio, tmp_ratio)) {
|
||||||
switch (Video4to3ZoomMode) {
|
switch (Video4to3ZoomMode) {
|
||||||
@ -635,12 +633,7 @@ static void VideoUpdateOutput(AVRational input_aspect_ratio, int input_width,
|
|||||||
*output_y = video_y;
|
*output_y = video_y;
|
||||||
*output_width = (video_height * display_aspect_ratio.num + display_aspect_ratio.den -1 ) / display_aspect_ratio.den;
|
*output_width = (video_height * display_aspect_ratio.num + display_aspect_ratio.den -1 ) / display_aspect_ratio.den;
|
||||||
*output_height = (video_width * display_aspect_ratio.den + display_aspect_ratio.num -1 ) / display_aspect_ratio.num;
|
*output_height = (video_width * display_aspect_ratio.den + display_aspect_ratio.num -1 ) / display_aspect_ratio.num;
|
||||||
// JOJO hier stimmt was nicht
|
// JOJO
|
||||||
#if DEBUG
|
|
||||||
*output_width = video_width;
|
|
||||||
*output_height = video_height;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (*output_width > video_width) {
|
if (*output_width > video_width) {
|
||||||
*output_width = video_width;
|
*output_width = video_width;
|
||||||
*output_y += (video_height - *output_height) / 2;
|
*output_y += (video_height - *output_height) / 2;
|
||||||
@ -988,14 +981,17 @@ static void GlxOsdClear(void)
|
|||||||
{
|
{
|
||||||
void *texbuf;
|
void *texbuf;
|
||||||
|
|
||||||
|
#ifdef USE_OPENGLOSD
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (!GlxEnabled) {
|
if (!GlxEnabled) {
|
||||||
Debug(3, "video/glx: %s called without glx enabled\n", __FUNCTION__);
|
Debug(3, "video/glx: %s called without glx enabled\n", __FUNCTION__);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug(3, "video/glx: osd context %p <-> %p\n", glXGetCurrentContext(),
|
Debug(3, "video/glx: osd context %p <-> %p\n", glXGetCurrentContext(), GlxContext);
|
||||||
GlxContext);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// FIXME: any opengl function to clear an area?
|
// FIXME: any opengl function to clear an area?
|
||||||
@ -1011,7 +1007,6 @@ static void GlxOsdClear(void)
|
|||||||
texbuf = calloc(OsdWidth * OsdHeight, 4);
|
texbuf = calloc(OsdWidth * OsdHeight, 4);
|
||||||
GlxUploadOsdTexture(0, 0, OsdWidth, OsdHeight, texbuf);
|
GlxUploadOsdTexture(0, 0, OsdWidth, OsdHeight, texbuf);
|
||||||
glXMakeCurrent(XlibDisplay, None, NULL);
|
glXMakeCurrent(XlibDisplay, None, NULL);
|
||||||
|
|
||||||
free(texbuf);
|
free(texbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1327,7 +1322,6 @@ static void GlxExit(void)
|
|||||||
}
|
}
|
||||||
if (GlxSharedContext) {
|
if (GlxSharedContext) {
|
||||||
glXDestroyContext(XlibDisplay, GlxSharedContext);
|
glXDestroyContext(XlibDisplay, GlxSharedContext);
|
||||||
GlxSharedContext=0;
|
|
||||||
}
|
}
|
||||||
if (GlxContext) {
|
if (GlxContext) {
|
||||||
glXDestroyContext(XlibDisplay, GlxContext);
|
glXDestroyContext(XlibDisplay, GlxContext);
|
||||||
@ -1998,6 +1992,7 @@ Debug(3,"cuvid del hw decoder\n");
|
|||||||
decoder->cuda_ctx = NULL;
|
decoder->cuda_ctx = NULL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
glXMakeCurrent(XlibDisplay, None, NULL);
|
||||||
for (i = 0; i < CuvidDecoderN; ++i) {
|
for (i = 0; i < CuvidDecoderN; ++i) {
|
||||||
if (CuvidDecoders[i] == decoder) {
|
if (CuvidDecoders[i] == decoder) {
|
||||||
CuvidDecoders[i] = NULL;
|
CuvidDecoders[i] = NULL;
|
||||||
@ -2819,7 +2814,7 @@ static void CuvidRenderFrame(CuvidDecoder * decoder,
|
|||||||
int surface;
|
int surface;
|
||||||
VideoDecoder *ist = video_ctx->opaque;
|
VideoDecoder *ist = video_ctx->opaque;
|
||||||
|
|
||||||
#if 0
|
|
||||||
// update aspect ratio changes
|
// update aspect ratio changes
|
||||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(53,60,100)
|
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(53,60,100)
|
||||||
if (decoder->InputWidth && decoder->InputHeight
|
if (decoder->InputWidth && decoder->InputHeight
|
||||||
@ -2827,6 +2822,7 @@ static void CuvidRenderFrame(CuvidDecoder * decoder,
|
|||||||
Debug(3, "video/vdpau: aspect ratio changed\n");
|
Debug(3, "video/vdpau: aspect ratio changed\n");
|
||||||
|
|
||||||
decoder->InputAspect = frame->sample_aspect_ratio;
|
decoder->InputAspect = frame->sample_aspect_ratio;
|
||||||
|
printf("new aspect %d:%d\n",frame->sample_aspect_ratio.num,frame->sample_aspect_ratio.den);
|
||||||
CuvidUpdateOutput(decoder);
|
CuvidUpdateOutput(decoder);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
@ -2838,7 +2834,7 @@ static void CuvidRenderFrame(CuvidDecoder * decoder,
|
|||||||
CuvidUpdateOutput(decoder);
|
CuvidUpdateOutput(decoder);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check image, format, size
|
// Check image, format, size
|
||||||
@ -3145,17 +3141,20 @@ static void CuvidDisplayFrame(void)
|
|||||||
//
|
//
|
||||||
// add osd to surface
|
// add osd to surface
|
||||||
//
|
//
|
||||||
if (OsdShown) {
|
if (OsdShown) {
|
||||||
#ifndef USE_OPENGLOSD
|
#ifndef USE_OPENGLOSD
|
||||||
glXMakeCurrent(XlibDisplay, VideoWindow, GlxThreadContext);
|
glXMakeCurrent(XlibDisplay, VideoWindow, GlxThreadContext);
|
||||||
GlxRenderTexture(OsdGlTextures[OsdIndex], 0,0, VideoWindowWidth, VideoWindowHeight);
|
GlxRenderTexture(OsdGlTextures[OsdIndex], 0,0, VideoWindowWidth, VideoWindowHeight);
|
||||||
#else
|
#else
|
||||||
|
pthread_mutex_lock(&OSDMutex);
|
||||||
glXMakeCurrent(XlibDisplay, VideoWindow, GlxContext );
|
glXMakeCurrent(XlibDisplay, VideoWindow, GlxContext );
|
||||||
GlxRenderTexture(OSDtexture, OSDx, OSDy, OSDxsize, OSDysize);
|
GlxRenderTexture(OSDtexture, OSDx, OSDy, OSDxsize, OSDysize);
|
||||||
|
pthread_mutex_unlock(&OSDMutex);
|
||||||
#endif
|
#endif
|
||||||
glXMakeCurrent(XlibDisplay, VideoWindow, GlxSharedContext);
|
glXMakeCurrent(XlibDisplay, VideoWindow, GlxSharedContext);
|
||||||
// FIXME: toggle osd
|
|
||||||
}
|
}
|
||||||
|
|
||||||
glXGetVideoSyncSGI (&Count); // get current frame
|
glXGetVideoSyncSGI (&Count); // get current frame
|
||||||
glXSwapBuffers(XlibDisplay, VideoWindow);
|
glXSwapBuffers(XlibDisplay, VideoWindow);
|
||||||
|
|
||||||
@ -4238,6 +4237,7 @@ static void VideoThreadInit(void)
|
|||||||
|
|
||||||
pthread_mutex_init(&VideoMutex, NULL);
|
pthread_mutex_init(&VideoMutex, NULL);
|
||||||
pthread_mutex_init(&VideoLockMutex, NULL);
|
pthread_mutex_init(&VideoLockMutex, NULL);
|
||||||
|
pthread_mutex_init(&OSDMutex, NULL);
|
||||||
pthread_cond_init(&VideoWakeupCond, NULL);
|
pthread_cond_init(&VideoWakeupCond, NULL);
|
||||||
pthread_create(&VideoThread, NULL, VideoDisplayHandlerThread, NULL);
|
pthread_create(&VideoThread, NULL, VideoDisplayHandlerThread, NULL);
|
||||||
}
|
}
|
||||||
@ -4264,6 +4264,7 @@ static void VideoThreadExit(void)
|
|||||||
pthread_cond_destroy(&VideoWakeupCond);
|
pthread_cond_destroy(&VideoWakeupCond);
|
||||||
pthread_mutex_destroy(&VideoLockMutex);
|
pthread_mutex_destroy(&VideoLockMutex);
|
||||||
pthread_mutex_destroy(&VideoMutex);
|
pthread_mutex_destroy(&VideoMutex);
|
||||||
|
pthread_mutex_destroy(&OSDMutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -4686,12 +4687,12 @@ void VideoGetVideoSize(VideoHwDecoder * hw_decoder, int *width, int *height,
|
|||||||
// FIXME: test to check if working, than make module function
|
// FIXME: test to check if working, than make module function
|
||||||
|
|
||||||
if (VideoUsedModule == &CuvidModule) {
|
if (VideoUsedModule == &CuvidModule) {
|
||||||
*width = hw_decoder->Cuvid.InputWidth;
|
*width = hw_decoder->Cuvid.InputWidth;
|
||||||
*height = hw_decoder->Cuvid.InputHeight;
|
*height = hw_decoder->Cuvid.InputHeight;
|
||||||
av_reduce(aspect_num, aspect_den,
|
av_reduce(aspect_num, aspect_den,
|
||||||
hw_decoder->Cuvid.InputWidth * hw_decoder->Cuvid.InputAspect.num,
|
hw_decoder->Cuvid.InputWidth * hw_decoder->Cuvid.InputAspect.num,
|
||||||
hw_decoder->Cuvid.InputHeight * hw_decoder->Cuvid.InputAspect.den,
|
hw_decoder->Cuvid.InputHeight * hw_decoder->Cuvid.InputAspect.den,
|
||||||
1024 * 1024);
|
1024 * 1024);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -4881,7 +4882,7 @@ static void VideoCreateWindow(xcb_window_t parent, xcb_visualid_t visual,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// FIXME: size hints
|
// FIXME: size hints
|
||||||
#if 0
|
|
||||||
// register interest in the delete window message
|
// register interest in the delete window message
|
||||||
if ((reply =
|
if ((reply =
|
||||||
xcb_intern_atom_reply(Connection, xcb_intern_atom(Connection, 0, sizeof("WM_DELETE_WINDOW") - 1, "WM_DELETE_WINDOW"),NULL))) {
|
xcb_intern_atom_reply(Connection, xcb_intern_atom(Connection, 0, sizeof("WM_DELETE_WINDOW") - 1, "WM_DELETE_WINDOW"),NULL))) {
|
||||||
@ -4898,7 +4899,7 @@ static void VideoCreateWindow(xcb_window_t parent, xcb_visualid_t visual,
|
|||||||
free(reply);
|
free(reply);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
//
|
//
|
||||||
// prepare fullscreen.
|
// prepare fullscreen.
|
||||||
//
|
//
|
||||||
@ -5611,7 +5612,7 @@ void VideoExit(void)
|
|||||||
// FIXME: cleanup.
|
// FIXME: cleanup.
|
||||||
//
|
//
|
||||||
//RandrExit();
|
//RandrExit();
|
||||||
|
pthread_mutex_lock(&OSDMutex);
|
||||||
//
|
//
|
||||||
// X11/xcb cleanup
|
// X11/xcb cleanup
|
||||||
//
|
//
|
||||||
@ -5638,6 +5639,7 @@ void VideoExit(void)
|
|||||||
}
|
}
|
||||||
XlibDisplay = NULL;
|
XlibDisplay = NULL;
|
||||||
Connection = 0;
|
Connection = 0;
|
||||||
|
pthread_mutex_unlock(&OSDMutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user