Merge pull request #54 from REELcoder/master

Fix PiP window size handling
This commit is contained in:
jojo61 2020-05-04 08:37:09 +02:00 committed by GitHub
commit 3578e3212d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1326,6 +1326,7 @@ static VideoStream MyVideoStream[1]; ///< normal video stream
#ifdef USE_PIP #ifdef USE_PIP
static VideoStream PipVideoStream[1]; ///< pip video stream static VideoStream PipVideoStream[1]; ///< pip video stream
static int PiPActive = 0, mwx, mwy, mww, mwh; ///< main window frame for PiP
#endif #endif
#ifdef DEBUG #ifdef DEBUG
@ -3396,6 +3397,10 @@ void GetStats(int *missed, int *duped, int *dropped, int *counter, float *framet
*/ */
void ScaleVideo(int x, int y, int width, int height) void ScaleVideo(int x, int y, int width, int height)
{ {
if (PiPActive && !(x & y & width & height)) {
Info("[softhddev]%s: fullscreen with PiP active.\n", __FUNCTION__);
x = mwx; y = mwy; width = mww; height = mwh;
}
if (MyVideoStream->HwDecoder) { if (MyVideoStream->HwDecoder) {
VideoSetOutputPosition(MyVideoStream->HwDecoder, x, y, width, height); VideoSetOutputPosition(MyVideoStream->HwDecoder, x, y, width, height);
} }
@ -3454,6 +3459,8 @@ void PipStart(int x, int y, int width, int height, int pip_x, int pip_y, int pip
VideoStreamOpen(PipVideoStream); VideoStreamOpen(PipVideoStream);
} }
PipSetPosition(x, y, width, height, pip_x, pip_y, pip_width, pip_height); PipSetPosition(x, y, width, height, pip_x, pip_y, pip_width, pip_height);
mwx = x; mwy = y; mww = width; mwh = height;
PiPActive = 1;
} }
/** /**
@ -3467,6 +3474,8 @@ void PipStop(void)
return; return;
} }
PiPActive = 0;
mwx = 0; mwy = 0; mww = 0; mwh = 0;
ScaleVideo(0, 0, 0, 0); ScaleVideo(0, 0, 0, 0);
PipVideoStream->Close = 1; PipVideoStream->Close = 1;