1
0
mirror of https://github.com/jojo61/vdr-plugin-softhdcuvid.git synced 2023-10-10 13:37:41 +02:00

more Frame Statistik

This commit is contained in:
jojo61 2018-10-07 13:31:52 +02:00
parent 6f892bb8d1
commit 98af2bb7bf
5 changed files with 108 additions and 139 deletions

View File

@ -959,9 +959,7 @@ inline cOsdItem *cMenuSetupSoft::CollapsedItem(const char *label, int &flag,
{ {
cOsdItem *item; cOsdItem *item;
item = item = new cMenuEditBoolItem(cString::sprintf("* %s", label), &flag,msg ? msg : tr("show"), tr("hide"));
new cMenuEditBoolItem(cString::sprintf("* %s", label), &flag,
msg ? msg : tr("show"), tr("hide"));
return item; return item;
} }
@ -1011,10 +1009,8 @@ void cMenuSetupSoft::Create(void)
Add(CollapsedItem(tr("General"), General)); Add(CollapsedItem(tr("General"), General));
if (General) { if (General) {
Add(new cMenuEditBoolItem(tr("Make primary device"), &MakePrimary, Add(new cMenuEditBoolItem(tr("Make primary device"), &MakePrimary, trVDR("no"), trVDR("yes")));
trVDR("no"), trVDR("yes"))); Add(new cMenuEditBoolItem(tr("Hide main menu entry"),&HideMainMenuEntry, trVDR("no"), trVDR("yes")));
Add(new cMenuEditBoolItem(tr("Hide main menu entry"),
&HideMainMenuEntry, trVDR("no"), trVDR("yes")));
// //
// osd // osd
// //
@ -1030,12 +1026,9 @@ void cMenuSetupSoft::Create(void)
// suspend // suspend
// //
Add(SeparatorItem(tr("Suspend"))); Add(SeparatorItem(tr("Suspend")));
Add(new cMenuEditBoolItem(tr("Detach from main menu entry"), Add(new cMenuEditBoolItem(tr("Detach from main menu entry"),&DetachFromMainMenu, trVDR("no"), trVDR("yes")));
&DetachFromMainMenu, trVDR("no"), trVDR("yes"))); Add(new cMenuEditBoolItem(tr("Suspend closes video+audio"), &SuspendClose, trVDR("no"), trVDR("yes")));
Add(new cMenuEditBoolItem(tr("Suspend closes video+audio"), Add(new cMenuEditBoolItem(tr("Suspend stops x11"), &SuspendX11, trVDR("no"), trVDR("yes")));
&SuspendClose, trVDR("no"), trVDR("yes")));
Add(new cMenuEditBoolItem(tr("Suspend stops x11"), &SuspendX11,
trVDR("no"), trVDR("yes")));
} }
// //
// video // video
@ -1113,12 +1106,9 @@ void cMenuSetupSoft::Create(void)
// auto-crop // auto-crop
// //
Add(SeparatorItem(tr("Auto-crop"))); Add(SeparatorItem(tr("Auto-crop")));
Add(new cMenuEditIntItem(tr("Autocrop interval (frames)"), Add(new cMenuEditIntItem(tr("Autocrop interval (frames)"), &AutoCropInterval, 0, 200, tr("off")));
&AutoCropInterval, 0, 200, tr("off"))); Add(new cMenuEditIntItem(tr("Autocrop delay (n * interval)"), &AutoCropDelay, 0, 200));
Add(new cMenuEditIntItem(tr("Autocrop delay (n * interval)"), Add(new cMenuEditIntItem(tr("Autocrop tolerance (pixel)"), &AutoCropTolerance, 0, 32));
&AutoCropDelay, 0, 200));
Add(new cMenuEditIntItem(tr("Autocrop tolerance (pixel)"),
&AutoCropTolerance, 0, 32));
} }
// //
// audio // audio
@ -1126,36 +1116,21 @@ void cMenuSetupSoft::Create(void)
Add(CollapsedItem(tr("Audio"), Audio)); Add(CollapsedItem(tr("Audio"), Audio));
if (Audio) { if (Audio) {
Add(new cMenuEditIntItem(tr("Audio/Video delay (ms)"), &AudioDelay, Add(new cMenuEditIntItem(tr("Audio/Video delay (ms)"), &AudioDelay, -1000, 1000));
-1000, 1000)); Add(new cMenuEditStraItem(tr("Audio drift correction"), &AudioDrift, 4, audiodrift));
Add(new cMenuEditStraItem(tr("Audio drift correction"), &AudioDrift, 4, Add(new cMenuEditBoolItem(tr("Pass-through default"), &AudioPassthroughDefault, trVDR("off"), trVDR("on")));
audiodrift)); Add(new cMenuEditBoolItem(tr("\040\040PCM pass-through"), &AudioPassthroughPCM, trVDR("no"), trVDR("yes")));
Add(new cMenuEditBoolItem(tr("Pass-through default"), Add(new cMenuEditBoolItem(tr("\040\040AC-3 pass-through"),&AudioPassthroughAC3, trVDR("no"), trVDR("yes")));
&AudioPassthroughDefault, trVDR("off"), trVDR("on"))); Add(new cMenuEditBoolItem(tr("\040\040E-AC-3 pass-through"),&AudioPassthroughEAC3, trVDR("no"), trVDR("yes")));
Add(new cMenuEditBoolItem(tr("\040\040PCM pass-through"), Add(new cMenuEditBoolItem(tr("Enable (E-)AC-3 (decoder) downmix"), &AudioDownmix, trVDR("no"), trVDR("yes")));
&AudioPassthroughPCM, trVDR("no"), trVDR("yes"))); Add(new cMenuEditBoolItem(tr("Volume control"), &AudioSoftvol,tr("Hardware"), tr("Software")));
Add(new cMenuEditBoolItem(tr("\040\040AC-3 pass-through"), Add(new cMenuEditBoolItem(tr("Enable normalize volume"),&AudioNormalize, trVDR("no"), trVDR("yes")));
&AudioPassthroughAC3, trVDR("no"), trVDR("yes"))); Add(new cMenuEditIntItem(tr(" Max normalize factor (/1000)"),&AudioMaxNormalize, 0, 10000));
Add(new cMenuEditBoolItem(tr("\040\040E-AC-3 pass-through"), Add(new cMenuEditBoolItem(tr("Enable volume compression"), &AudioCompression, trVDR("no"), trVDR("yes")));
&AudioPassthroughEAC3, trVDR("no"), trVDR("yes"))); Add(new cMenuEditIntItem(tr(" Max compression factor (/1000)"),&AudioMaxCompression, 0, 10000));
Add(new cMenuEditBoolItem(tr("Enable (E-)AC-3 (decoder) downmix"), Add(new cMenuEditIntItem(tr("Reduce stereo volume (/1000)"),&AudioStereoDescent, 0, 1000));
&AudioDownmix, trVDR("no"), trVDR("yes"))); Add(new cMenuEditIntItem(tr("Audio buffer size (ms)"),&AudioBufferTime, 0, 1000));
Add(new cMenuEditBoolItem(tr("Volume control"), &AudioSoftvol, Add(new cMenuEditBoolItem(tr("Enable automatic AES"), &AudioAutoAES,trVDR("no"), trVDR("yes")));
tr("Hardware"), tr("Software")));
Add(new cMenuEditBoolItem(tr("Enable normalize volume"),
&AudioNormalize, trVDR("no"), trVDR("yes")));
Add(new cMenuEditIntItem(tr(" Max normalize factor (/1000)"),
&AudioMaxNormalize, 0, 10000));
Add(new cMenuEditBoolItem(tr("Enable volume compression"),
&AudioCompression, trVDR("no"), trVDR("yes")));
Add(new cMenuEditIntItem(tr(" Max compression factor (/1000)"),
&AudioMaxCompression, 0, 10000));
Add(new cMenuEditIntItem(tr("Reduce stereo volume (/1000)"),
&AudioStereoDescent, 0, 1000));
Add(new cMenuEditIntItem(tr("Audio buffer size (ms)"),
&AudioBufferTime, 0, 1000));
Add(new cMenuEditBoolItem(tr("Enable automatic AES"), &AudioAutoAES,
trVDR("no"), trVDR("yes")));
} }
#ifdef USE_PIP #ifdef USE_PIP
// //
@ -1170,26 +1145,16 @@ void cMenuSetupSoft::Create(void)
Add(new cMenuEditIntItem(tr("Pip Height (%)"), &PipHeight, 0, 100)); Add(new cMenuEditIntItem(tr("Pip Height (%)"), &PipHeight, 0, 100));
Add(new cMenuEditIntItem(tr("Video X (%)"), &PipVideoX, 0, 100)); Add(new cMenuEditIntItem(tr("Video X (%)"), &PipVideoX, 0, 100));
Add(new cMenuEditIntItem(tr("Video Y (%)"), &PipVideoY, 0, 100)); Add(new cMenuEditIntItem(tr("Video Y (%)"), &PipVideoY, 0, 100));
Add(new cMenuEditIntItem(tr("Video Width (%)"), &PipVideoWidth, 0, Add(new cMenuEditIntItem(tr("Video Width (%)"), &PipVideoWidth, 0,100));
100)); Add(new cMenuEditIntItem(tr("Video Height (%)"), &PipVideoHeight, 0,100));
Add(new cMenuEditIntItem(tr("Video Height (%)"), &PipVideoHeight, 0, Add(new cMenuEditIntItem(tr("Alternative Pip X (%)"), &PipAltX, 0,100));
100)); Add(new cMenuEditIntItem(tr("Alternative Pip Y (%)"), &PipAltY, 0,100));
Add(new cMenuEditIntItem(tr("Alternative Pip X (%)"), &PipAltX, 0, Add(new cMenuEditIntItem(tr("Alternative Pip Width (%)"), &PipAltWidth, 0, 100));
100)); Add(new cMenuEditIntItem(tr("Alternative Pip Height (%)"),&PipAltHeight, 0, 100));
Add(new cMenuEditIntItem(tr("Alternative Pip Y (%)"), &PipAltY, 0, Add(new cMenuEditIntItem(tr("Alternative Video X (%)"), &PipAltVideoX,0, 100));
100)); Add(new cMenuEditIntItem(tr("Alternative Video Y (%)"), &PipAltVideoY,0, 100));
Add(new cMenuEditIntItem(tr("Alternative Pip Width (%)"), &PipAltWidth, Add(new cMenuEditIntItem(tr("Alternative Video Width (%)"), &PipAltVideoWidth, 0, 100));
0, 100)); Add(new cMenuEditIntItem(tr("Alternative Video Height (%)"),&PipAltVideoHeight, 0, 100));
Add(new cMenuEditIntItem(tr("Alternative Pip Height (%)"),
&PipAltHeight, 0, 100));
Add(new cMenuEditIntItem(tr("Alternative Video X (%)"), &PipAltVideoX,
0, 100));
Add(new cMenuEditIntItem(tr("Alternative Video Y (%)"), &PipAltVideoY,
0, 100));
Add(new cMenuEditIntItem(tr("Alternative Video Width (%)"),
&PipAltVideoWidth, 0, 100));
Add(new cMenuEditIntItem(tr("Alternative Video Height (%)"),
&PipAltVideoHeight, 0, 100));
} }
#endif #endif
@ -2072,6 +2037,7 @@ void cSoftHdMenu::Create(void)
int duped; int duped;
int dropped; int dropped;
int counter; int counter;
float frametime;
current = Current(); // get current menu item index current = Current(); // get current menu item index
Clear(); // clear the menu Clear(); // clear the menu
@ -2106,12 +2072,9 @@ void cSoftHdMenu::Create(void)
#endif #endif
Add(new cOsdItem(NULL, osUnknown, false)); Add(new cOsdItem(NULL, osUnknown, false));
Add(new cOsdItem(NULL, osUnknown, false)); Add(new cOsdItem(NULL, osUnknown, false));
GetStats(&missed, &duped, &dropped, &counter); GetStats(&missed, &duped, &dropped, &counter, &frametime);
Add(new Add(new cOsdItem(cString::sprintf(tr(" Frames missed(%d) duped(%d) dropped(%d) total(%d)"), missed, duped, dropped, counter), osUnknown, false));
cOsdItem(cString::sprintf(tr Add(new cOsdItem(cString::sprintf(tr(" Frame Process time %2.2fms"), frametime), osUnknown, false));
(" Frames missed(%d) duped(%d) dropped(%d) total(%d)"), missed,
duped, dropped, counter), osUnknown, false));
SetCurrent(Get(current)); // restore selected menu entry SetCurrent(Get(current)); // restore selected menu entry
Display(); // display build menu Display(); // display build menu
} }

View File

@ -3403,15 +3403,15 @@ void Resume(void)
** @param[out] dropped dropped frames ** @param[out] dropped dropped frames
** @param[out] count number of decoded frames ** @param[out] count number of decoded frames
*/ */
void GetStats(int *missed, int *duped, int *dropped, int *counter) void GetStats(int *missed, int *duped, int *dropped, int *counter, float *frametime)
{ {
*missed = 0; *missed = 0;
*duped = 0; *duped = 0;
*dropped = 0; *dropped = 0;
*counter = 0; *counter = 0;
*frametime = 0.0f;
if (MyVideoStream->HwDecoder) { if (MyVideoStream->HwDecoder) {
VideoGetStats(MyVideoStream->HwDecoder, missed, duped, dropped, VideoGetStats(MyVideoStream->HwDecoder, missed, duped, dropped, counter, frametime);
counter);
} }
} }

View File

@ -98,7 +98,7 @@ extern "C"
extern void Resume(void); extern void Resume(void);
/// Get decoder statistics /// Get decoder statistics
extern void GetStats(int *, int *, int *, int *); extern void GetStats(int *, int *, int *, int *, float *);
/// C plugin scale video /// C plugin scale video
extern void ScaleVideo(int, int, int, int); extern void ScaleVideo(int, int, int, int);

22
video.c
View File

@ -279,7 +279,7 @@ typedef struct _video_module_
void (*const ResetStart) (const VideoHwDecoder *); void (*const ResetStart) (const VideoHwDecoder *);
void (*const SetTrickSpeed) (const VideoHwDecoder *, int); void (*const SetTrickSpeed) (const VideoHwDecoder *, int);
uint8_t *(*const GrabOutput)(int *, int *, int *); uint8_t *(*const GrabOutput)(int *, int *, int *);
void (*const GetStats) (VideoHwDecoder *, int *, int *, int *, int *); void (*const GetStats) (VideoHwDecoder *, int *, int *, int *, int *, float *);
void (*const SetBackground) (uint32_t); void (*const SetBackground) (uint32_t);
void (*const SetVideoMode) (void); void (*const SetVideoMode) (void);
void (*const ResetAutoCrop) (void); void (*const ResetAutoCrop) (void);
@ -1624,6 +1624,7 @@ typedef struct _cuvid_decoder_
int FramesDropped; ///< number of frames dropped int FramesDropped; ///< number of frames dropped
int FrameCounter; ///< number of frames decoded int FrameCounter; ///< number of frames decoded
int FramesDisplayed; ///< number of frames displayed int FramesDisplayed; ///< number of frames displayed
float Frameproc; /// Time to process frame
} CuvidDecoder; } CuvidDecoder;
static CuvidDecoder *CuvidDecoders[2]; ///< open decoder streams static CuvidDecoder *CuvidDecoders[2]; ///< open decoder streams
@ -3062,15 +3063,18 @@ static void CuvidDisplayFrame(void)
{ {
uint64_t first_time, diff, akt_time; uint64_t first_time, diff, akt_time;
static uint64_t last_time; static uint64_t last_time = 0;
int i; int i;
static unsigned int Count; static unsigned int Count;
int filled; int filled;
CuvidDecoder *decoder; CuvidDecoder *decoder;
// glXMakeCurrent(XlibDisplay, VideoWindow, GlxSharedContext);
glXMakeCurrent(XlibDisplay, VideoWindow, GlxContext); glXMakeCurrent(XlibDisplay, VideoWindow, GlxContext);
CuvidDecoders[0]->Frameproc = (float)(GetusTicks()-last_time)/1000000.0;
// printf("Time used %2.2f\n",CuvidDecoders[0]->Frameproc);
glXWaitVideoSyncSGI (2, (Count + 1) % 2, &Count); // wait for previous frame to swap glXWaitVideoSyncSGI (2, (Count + 1) % 2, &Count); // wait for previous frame to swap
last_time = GetusTicks();
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
// //
// Render videos into output // Render videos into output
@ -3100,6 +3104,7 @@ static void CuvidDisplayFrame(void)
} }
} }
// //
// add osd to surface // add osd to surface
// //
if (OsdShown) { if (OsdShown) {
@ -3219,12 +3224,13 @@ static void CuvidSetTrickSpeed(CuvidDecoder * decoder, int speed)
/// @param[out] count number of decoded frames /// @param[out] count number of decoded frames
/// ///
void CuvidGetStats(CuvidDecoder * decoder, int *missed, int *duped, void CuvidGetStats(CuvidDecoder * decoder, int *missed, int *duped,
int *dropped, int *counter) int *dropped, int *counter, float *frametime)
{ {
*missed = decoder->FramesMissed; *missed = decoder->FramesMissed;
*duped = decoder->FramesDuped; *duped = decoder->FramesDuped;
*dropped = decoder->FramesDropped; *dropped = decoder->FramesDropped;
*counter = decoder->FrameCounter; *counter = decoder->FrameCounter;
*frametime = decoder->Frameproc;
} }
/// ///
@ -3612,7 +3618,7 @@ static const VideoModule CuvidModule = {
.SetTrickSpeed = (void (*const) (const VideoHwDecoder *, int))CuvidSetTrickSpeed, .SetTrickSpeed = (void (*const) (const VideoHwDecoder *, int))CuvidSetTrickSpeed,
.GrabOutput = CuvidGrabOutputSurface, .GrabOutput = CuvidGrabOutputSurface,
.GetStats = (void (*const) (VideoHwDecoder *, int *, int *, int *, .GetStats = (void (*const) (VideoHwDecoder *, int *, int *, int *,
int *))CuvidGetStats, int *, float *))CuvidGetStats,
.SetBackground = CuvidSetBackground, .SetBackground = CuvidSetBackground,
.SetVideoMode = CuvidSetVideoMode, .SetVideoMode = CuvidSetVideoMode,
// .ResetAutoCrop = CuvidResetAutoCrop, // .ResetAutoCrop = CuvidResetAutoCrop,
@ -3783,7 +3789,7 @@ static const VideoModule NoopModule = {
(void (*const) (const VideoHwDecoder *, int))NoopSetTrickSpeed, (void (*const) (const VideoHwDecoder *, int))NoopSetTrickSpeed,
.GrabOutput = NoopGrabOutputSurface, .GrabOutput = NoopGrabOutputSurface,
.GetStats = (void (*const) (VideoHwDecoder *, int *, int *, int *, .GetStats = (void (*const) (VideoHwDecoder *, int *, int *, int *,
int *))NoopGetStats, int *, float *))NoopGetStats,
#endif #endif
.SetBackground = NoopSetBackground, .SetBackground = NoopSetBackground,
.SetVideoMode = NoopVoid, .SetVideoMode = NoopVoid,
@ -4625,9 +4631,9 @@ uint8_t *VideoGrabService(int *size, int *width, int *height)
/// @param[out] count number of decoded frames /// @param[out] count number of decoded frames
/// ///
void VideoGetStats(VideoHwDecoder * hw_decoder, int *missed, int *duped, void VideoGetStats(VideoHwDecoder * hw_decoder, int *missed, int *duped,
int *dropped, int *counter) int *dropped, int *counter, float *frametime)
{ {
VideoUsedModule->GetStats(hw_decoder, missed, duped, dropped, counter); VideoUsedModule->GetStats(hw_decoder, missed, duped, dropped, counter, frametime);
} }
/// ///

View File

@ -210,7 +210,7 @@ extern uint8_t *VideoGrab(int *, int *, int *, int);
extern uint8_t *VideoGrabService(int *, int *, int *); extern uint8_t *VideoGrabService(int *, int *, int *);
/// Get decoder statistics. /// Get decoder statistics.
extern void VideoGetStats(VideoHwDecoder *, int *, int *, int *, int *); extern void VideoGetStats(VideoHwDecoder *, int *, int *, int *, int *, float *);
/// Get video stream size /// Get video stream size
extern void VideoGetVideoSize(VideoHwDecoder *, int *, int *, int *, int *); extern void VideoGetVideoSize(VideoHwDecoder *, int *, int *, int *, int *);