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
// //
@ -1163,33 +1138,23 @@ void cMenuSetupSoft::Create(void)
// //
Add(CollapsedItem(tr("Picture-In-Picture"), Pip)); Add(CollapsedItem(tr("Picture-In-Picture"), Pip));
if (Pip) { if (Pip) {
// FIXME: predefined modes/custom mode // FIXME: predefined modes/custom mode
Add(new cMenuEditIntItem(tr("Pip X (%)"), &PipX, 0, 100)); Add(new cMenuEditIntItem(tr("Pip X (%)"), &PipX, 0, 100));
Add(new cMenuEditIntItem(tr("Pip Y (%)"), &PipY, 0, 100)); Add(new cMenuEditIntItem(tr("Pip Y (%)"), &PipY, 0, 100));
Add(new cMenuEditIntItem(tr("Pip Width (%)"), &PipWidth, 0, 100)); Add(new cMenuEditIntItem(tr("Pip Width (%)"), &PipWidth, 0, 100));
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
@ -1225,22 +1190,22 @@ eOSState cMenuSetupSoft::ProcessKey(eKeys key)
state = cMenuSetupPage::ProcessKey(key); state = cMenuSetupPage::ProcessKey(key);
if (key != kNone) { if (key != kNone) {
// update menu only, if something on the structure has changed // update menu only, if something on the structure has changed
// this is needed because VDR menus are evil slow // this is needed because VDR menus are evil slow
if (old_general != General || old_video != Video || old_audio != Audio if (old_general != General || old_video != Video || old_audio != Audio
#ifdef USE_PIP #ifdef USE_PIP
|| old_pip != Pip || old_pip != Pip
#endif #endif
|| old_osd_size != OsdSize) { || old_osd_size != OsdSize) {
Create(); // update menu Create(); // update menu
} else { } else {
for (i = 0; i < RESOLUTIONS; ++i) { for (i = 0; i < RESOLUTIONS; ++i) {
if (old_resolution_shown[i] != ResolutionShown[i]) { if (old_resolution_shown[i] != ResolutionShown[i]) {
Create(); // update menu Create(); // update menu
break; break;
}
}
} }
}
}
} }
return state; return state;
@ -1443,27 +1408,27 @@ void cMenuSetupSoft::Store(void)
VideoSetHue(ConfigVideoHue); VideoSetHue(ConfigVideoHue);
for (i = 0; i < RESOLUTIONS; ++i) { for (i = 0; i < RESOLUTIONS; ++i) {
char buf[128]; char buf[128];
snprintf(buf, sizeof(buf), "%s.%s", Resolution[i], "Scaling"); snprintf(buf, sizeof(buf), "%s.%s", Resolution[i], "Scaling");
SetupStore(buf, ConfigVideoScaling[i] = Scaling[i]); SetupStore(buf, ConfigVideoScaling[i] = Scaling[i]);
snprintf(buf, sizeof(buf), "%s.%s", Resolution[i], "Deinterlace"); snprintf(buf, sizeof(buf), "%s.%s", Resolution[i], "Deinterlace");
SetupStore(buf, ConfigVideoDeinterlace[i] = Deinterlace[i]); SetupStore(buf, ConfigVideoDeinterlace[i] = Deinterlace[i]);
snprintf(buf, sizeof(buf), "%s.%s", Resolution[i], snprintf(buf, sizeof(buf), "%s.%s", Resolution[i],
"SkipChromaDeinterlace"); "SkipChromaDeinterlace");
SetupStore(buf, ConfigVideoSkipChromaDeinterlace[i] = SetupStore(buf, ConfigVideoSkipChromaDeinterlace[i] =
SkipChromaDeinterlace[i]); SkipChromaDeinterlace[i]);
snprintf(buf, sizeof(buf), "%s.%s", Resolution[i], "InverseTelecine"); snprintf(buf, sizeof(buf), "%s.%s", Resolution[i], "InverseTelecine");
SetupStore(buf, ConfigVideoInverseTelecine[i] = InverseTelecine[i]); SetupStore(buf, ConfigVideoInverseTelecine[i] = InverseTelecine[i]);
snprintf(buf, sizeof(buf), "%s.%s", Resolution[i], "Denoise"); snprintf(buf, sizeof(buf), "%s.%s", Resolution[i], "Denoise");
SetupStore(buf, ConfigVideoDenoise[i] = Denoise[i]); SetupStore(buf, ConfigVideoDenoise[i] = Denoise[i]);
snprintf(buf, sizeof(buf), "%s.%s", Resolution[i], "Sharpen"); snprintf(buf, sizeof(buf), "%s.%s", Resolution[i], "Sharpen");
SetupStore(buf, ConfigVideoSharpen[i] = Sharpen[i]); SetupStore(buf, ConfigVideoSharpen[i] = Sharpen[i]);
snprintf(buf, sizeof(buf), "%s.%s", Resolution[i], "CutTopBottom"); snprintf(buf, sizeof(buf), "%s.%s", Resolution[i], "CutTopBottom");
SetupStore(buf, ConfigVideoCutTopBottom[i] = CutTopBottom[i]); SetupStore(buf, ConfigVideoCutTopBottom[i] = CutTopBottom[i]);
snprintf(buf, sizeof(buf), "%s.%s", Resolution[i], "CutLeftRight"); snprintf(buf, sizeof(buf), "%s.%s", Resolution[i], "CutLeftRight");
SetupStore(buf, ConfigVideoCutLeftRight[i] = CutLeftRight[i]); SetupStore(buf, ConfigVideoCutLeftRight[i] = CutLeftRight[i]);
} }
VideoSetScaling(ConfigVideoScaling); VideoSetScaling(ConfigVideoScaling);
VideoSetDeinterlace(ConfigVideoDeinterlace); VideoSetDeinterlace(ConfigVideoDeinterlace);
@ -1490,18 +1455,18 @@ void cMenuSetupSoft::Store(void)
// FIXME: can handle more audio state changes here // FIXME: can handle more audio state changes here
// downmix changed reset audio, to get change direct // downmix changed reset audio, to get change direct
if (ConfigAudioDownmix != AudioDownmix) { if (ConfigAudioDownmix != AudioDownmix) {
ResetChannelId(); ResetChannelId();
} }
ConfigAudioPassthrough = (AudioPassthroughPCM ? CodecPCM : 0) ConfigAudioPassthrough = (AudioPassthroughPCM ? CodecPCM : 0)
| (AudioPassthroughAC3 ? CodecAC3 : 0) | (AudioPassthroughAC3 ? CodecAC3 : 0)
| (AudioPassthroughEAC3 ? CodecEAC3 : 0); | (AudioPassthroughEAC3 ? CodecEAC3 : 0);
AudioPassthroughState = AudioPassthroughDefault; AudioPassthroughState = AudioPassthroughDefault;
if (AudioPassthroughState) { if (AudioPassthroughState) {
SetupStore("AudioPassthrough", ConfigAudioPassthrough); SetupStore("AudioPassthrough", ConfigAudioPassthrough);
CodecSetAudioPassthrough(ConfigAudioPassthrough); CodecSetAudioPassthrough(ConfigAudioPassthrough);
} else { } else {
SetupStore("AudioPassthrough", -ConfigAudioPassthrough); SetupStore("AudioPassthrough", -ConfigAudioPassthrough);
CodecSetAudioPassthrough(0); CodecSetAudioPassthrough(0);
} }
SetupStore("AudioDownmix", ConfigAudioDownmix = AudioDownmix); SetupStore("AudioDownmix", ConfigAudioDownmix = AudioDownmix);
CodecSetAudioDownmix(ConfigAudioDownmix); CodecSetAudioDownmix(ConfigAudioDownmix);
@ -1735,7 +1700,7 @@ void cSoftReceiver::Activate(bool on)
ConfigPipHeight ? (ConfigPipHeight * height) / 100 : height); ConfigPipHeight ? (ConfigPipHeight * height) / 100 : height);
} }
} else { } else {
PipStop(); PipStop();
} }
} }
@ -1923,13 +1888,13 @@ static void NewPip(int channel_nr)
static void TogglePip(void) static void TogglePip(void)
{ {
if (PipReceiver) { if (PipReceiver) {
int attached; int attached;
attached = PipReceiver->IsAttached(); attached = PipReceiver->IsAttached();
DelPip(); DelPip();
if (attached) { // turn off only if last PIP was on if (attached) { // turn off only if last PIP was on
return; return;
} }
} }
NewPip(PipChannelNr); NewPip(PipChannelNr);
} }
@ -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 *);