From 7ce842b989853b0c2fa6ee9a8819ccddb018b543 Mon Sep 17 00:00:00 2001 From: jojo61 Date: Sun, 2 Feb 2020 13:26:51 +0100 Subject: [PATCH] More info in Menue --- softhdcuvid.cpp | 28 ++++++++++++++++++++++++++-- softhddev.c | 8 ++++++-- softhddev.h | 2 +- video.c | 16 ++++++++++------ video.h | 2 +- 5 files changed, 44 insertions(+), 12 deletions(-) diff --git a/softhdcuvid.cpp b/softhdcuvid.cpp index 519195c..59c2838 100644 --- a/softhdcuvid.cpp +++ b/softhdcuvid.cpp @@ -2153,6 +2153,10 @@ void cSoftHdMenu::Create(void) int dropped; int counter; float frametime; + int width,height; + int color; + int eotf; + char *colorstr, *eotfstr; current = Current(); // get current menu item index Clear(); // clear the menu @@ -2187,10 +2191,30 @@ void cSoftHdMenu::Create(void) #endif Add(new cOsdItem(NULL, osUnknown, false)); Add(new cOsdItem(NULL, osUnknown, false)); - GetStats(&missed, &duped, &dropped, &counter, &frametime); + GetStats(&missed, &duped, &dropped, &counter, &frametime, &width, &height, &color,&eotf); + switch (color) { + case AVCOL_SPC_RGB: + colorstr = strdup("BT 601"); + eotfstr = strdup("BT 1886"); + break; + case AVCOL_SPC_BT709: + case AVCOL_SPC_UNSPECIFIED: // comes with UHD + colorstr = strdup("BT 709"); + eotfstr = strdup("BT 1886"); + break; + case AVCOL_SPC_BT2020_NCL: + colorstr = strdup("BT 2020"); + eotfstr = strdup("HDR-HLG"); + break; + default: // fallback + colorstr = strdup("Fallback BT 709"); + eotfstr = strdup("BT 1886"); + break; + } Add(new cOsdItem(cString::sprintf(tr(" Frames missed(%d) duped(%d) dropped(%d) total(%d)"), missed, duped, dropped, counter), osUnknown, false)); - Add(new cOsdItem(cString::sprintf(tr(" Frame Process time %2.2fms"), frametime), osUnknown, false)); + Add(new cOsdItem(cString::sprintf(tr(" Video %dx%d Color: %s Gamma: %s"), width, height, colorstr, eotfstr), osUnknown, false)); + // Add(new cOsdItem(cString::sprintf(tr(" Frame Process time %2.2fms"), frametime), osUnknown, false)); SetCurrent(Get(current)); // restore selected menu entry Display(); // display build menu } diff --git a/softhddev.c b/softhddev.c index 59eee92..7f61a51 100644 --- a/softhddev.c +++ b/softhddev.c @@ -3370,15 +3370,19 @@ void Resume(void) ** @param[out] dropped dropped frames ** @param[out] count number of decoded frames */ -void GetStats(int *missed, int *duped, int *dropped, int *counter, float *frametime) +void GetStats(int *missed, int *duped, int *dropped, int *counter, float *frametime, int *width, int *height, int *color, int *eotf) { *missed = 0; *duped = 0; *dropped = 0; *counter = 0; *frametime = 0.0f; + *width = 0; + *height = 0; + *color = NULL; + *eotf = NULL; if (MyVideoStream->HwDecoder) { - VideoGetStats(MyVideoStream->HwDecoder, missed, duped, dropped, counter, frametime); + VideoGetStats(MyVideoStream->HwDecoder, missed, duped, dropped, counter, frametime, width, height, color, eotf); } } diff --git a/softhddev.h b/softhddev.h index 9b2bb63..154212a 100644 --- a/softhddev.h +++ b/softhddev.h @@ -96,7 +96,7 @@ extern "C" extern void Resume(void); /// Get decoder statistics - extern void GetStats(int *, int *, int *, int *, float *); + extern void GetStats(int *, int *, int *, int *, float *, int *, int *, int *, int *); /// C plugin scale video extern void ScaleVideo(int, int, int, int); diff --git a/video.c b/video.c index aab061f..f56e0fd 100644 --- a/video.c +++ b/video.c @@ -297,7 +297,7 @@ typedef struct _video_module_ void (*const ResetStart)(const VideoHwDecoder *); void (*const SetTrickSpeed)(const VideoHwDecoder *, int); uint8_t *(*const GrabOutput)(int *, int *, int *, int); - void (*const GetStats)(VideoHwDecoder *, int *, int *, int *, int *, float *); + void (*const GetStats)(VideoHwDecoder *, int *, int *, int *, int *, float *, int *, int *, int *, int *); void (*const SetBackground)(uint32_t); void (*const SetVideoMode)(void); @@ -4254,13 +4254,17 @@ static void CuvidSetTrickSpeed(CuvidDecoder * decoder, int speed) /// @param[out] dropped dropped frames /// @param[out] count number of decoded frames /// -void CuvidGetStats(CuvidDecoder * decoder, int *missed, int *duped, int *dropped, int *counter, float *frametime) +void CuvidGetStats(CuvidDecoder * decoder, int *missed, int *duped, int *dropped, int *counter, float *frametime, int *width, int *height, int *color, int * eotf) { *missed = decoder->FramesMissed; *duped = decoder->FramesDuped; *dropped = decoder->FramesDropped; *counter = decoder->FrameCounter; *frametime = decoder->Frameproc; + *width = decoder->InputWidth; + *height = decoder->InputHeight; + *color = decoder->ColorSpace; + *eotf = 0; } /// @@ -4651,7 +4655,7 @@ static const VideoModule CuvidModule = { .SetTrickSpeed = (void (*const)(const VideoHwDecoder *, int))CuvidSetTrickSpeed, .GrabOutput = CuvidGrabOutputSurface, .GetStats = (void (*const)(VideoHwDecoder *, int *, int *, int *, - int *, float *))CuvidGetStats, + int *, float *, int *, int *, int * , int *))CuvidGetStats, .SetBackground = CuvidSetBackground, .SetVideoMode = CuvidSetVideoMode, @@ -4819,7 +4823,7 @@ static const VideoModule NoopModule = { .SetTrickSpeed =(void (*const)(const VideoHwDecoder *, int))NoopSetTrickSpeed, .GrabOutput = NoopGrabOutputSurface, .GetStats = (void (*const)(VideoHwDecoder *, int *, int *, int *, - int *, float *))NoopGetStats, + int *, float *, int *, int *, int * , int *))NoopGetStats, #endif .SetBackground = NoopSetBackground, .SetVideoMode = NoopVoid, @@ -5846,9 +5850,9 @@ uint8_t *VideoGrabService(int *size, int *width, int *height) /// @param[out] dropped dropped frames /// @param[out] count number of decoded frames /// -void VideoGetStats(VideoHwDecoder * hw_decoder, int *missed, int *duped, int *dropped, int *counter, float *frametime) +void VideoGetStats(VideoHwDecoder * hw_decoder, int *missed, int *duped, int *dropped, int *counter, float *frametime, int *width, int *height, int *color, int *eotf) { - VideoUsedModule->GetStats(hw_decoder, missed, duped, dropped, counter, frametime); + VideoUsedModule->GetStats(hw_decoder, missed, duped, dropped, counter, frametime, width, height , color, eotf); } /// diff --git a/video.h b/video.h index 84a81c1..7e39d4d 100644 --- a/video.h +++ b/video.h @@ -219,7 +219,7 @@ extern uint8_t *VideoGrab(int *, int *, int *, int); extern uint8_t *VideoGrabService(int *, int *, int *); /// Get decoder statistics. -extern void VideoGetStats(VideoHwDecoder *, int *, int *, int *, int *, float *); +extern void VideoGetStats(VideoHwDecoder *, int *, int *, int *, int *, float *, int *, int *, int *, int *); /// Get video stream size extern void VideoGetVideoSize(VideoHwDecoder *, int *, int *, int *, int *);