summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohns <johns98@gmx.net>2012-07-02 17:05:36 +0200
committerJohns <johns98@gmx.net>2012-07-02 17:05:36 +0200
commit696bb8e934bc8bd9c73df4f954d74e926dbeeadb (patch)
tree35d340f22d74958fd6108efa9837ccf14db11ca6
parent3bb7782d404a09b66afd712bb562c6a3833bebf8 (diff)
downloadvdr-plugin-softhddevice-696bb8e934bc8bd9c73df4f954d74e926dbeeadb.tar.gz
vdr-plugin-softhddevice-696bb8e934bc8bd9c73df4f954d74e926dbeeadb.tar.bz2
Display frame statistics in plugin menu.
-rw-r--r--ChangeLog1
-rw-r--r--softhddev.c19
-rw-r--r--softhddev.h3
-rw-r--r--softhddevice.cpp45
-rw-r--r--video.c31
-rw-r--r--video.h3
6 files changed, 94 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index e093beb..1948e42 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,7 @@ User johns
Date:
Release Version 0.5.1
+ Display frame statistics in plugin menu.
Fix bug: 100% CPU use during playback.
Fix bug: audio use 100% CPU during pause.
Guard audio skip against old PTS values.
diff --git a/softhddev.c b/softhddev.c
index 57858ed..849835e 100644
--- a/softhddev.c
+++ b/softhddev.c
@@ -2689,3 +2689,22 @@ void Resume(void)
pthread_mutex_unlock(&SuspendLockMutex);
}
+
+/*
+** Get decoder statistics.
+**
+** @param[out] missed missed frames
+** @param[out] duped duped frames
+** @param[out] dropped dropped frames
+** @param[out] count number of decoded frames
+*/
+void GetStats(int *missed, int *duped, int *dropped, int *counter)
+{
+ *missed = 0;
+ *duped = 0;
+ *dropped = 0;
+ *counter = 0;
+ if (MyHwDecoder) {
+ VideoGetStats(MyHwDecoder, missed, duped, dropped, counter);
+ }
+}
diff --git a/softhddev.h b/softhddev.h
index 77181c7..66b0b5a 100644
--- a/softhddev.h
+++ b/softhddev.h
@@ -90,6 +90,9 @@ extern "C"
extern void Suspend(int, int, int);
/// Resume plugin
extern void Resume(void);
+
+ /// Get decoder statistics
+ extern void GetStats(int *, int *, int *, int *);
#ifdef __cplusplus
}
#endif
diff --git a/softhddevice.cpp b/softhddevice.cpp
index a11e989..023d036 100644
--- a/softhddevice.cpp
+++ b/softhddevice.cpp
@@ -648,7 +648,7 @@ void cMenuSetupSoft::Create(void)
//
Add(CollapsedItem(tr("Video"), Video));
if (Video) {
-#if 0 // disabled, not working as expected
+#if 0 // disabled, not working as expected
Add(new cMenuEditBoolItem(trVDR("Setup.DVB$Video format"),
&VideoFormat, "4:3", "16:9"));
if (VideoFormat) {
@@ -921,9 +921,9 @@ void cMenuSetupSoft::Store(void)
//SetupStore("VideoFormat", Setup.VideoFormat);
if (Setup.VideoDisplayFormat != VideoDisplayFormat) {
Setup.VideoDisplayFormat = VideoDisplayFormat;
- cDevice::
- PrimaryDevice()->SetVideoDisplayFormat(eVideoDisplayFormat
- (Setup.VideoDisplayFormat));
+ cDevice::PrimaryDevice()->
+ SetVideoDisplayFormat(eVideoDisplayFormat(Setup.
+ VideoDisplayFormat));
}
//SetupStore("VideoDisplayFormat", Setup.VideoDisplayFormat);
@@ -1102,8 +1102,10 @@ cSoftHdControl::~cSoftHdControl()
*/
class cSoftHdMenu:public cOsdMenu
{
+ private:
int HotkeyState; ///< current hot-key state
int HotkeyCode; ///< current hot-key code
+ void Create(void); ///< create plugin main menu
public:
cSoftHdMenu(const char *, int = 0, int = 0, int = 0, int = 0, int = 0);
virtual ~ cSoftHdMenu();
@@ -1111,6 +1113,33 @@ class cSoftHdMenu:public cOsdMenu
};
/**
+** Create main menu.
+*/
+void cSoftHdMenu::Create(void)
+{
+ int current;
+ int missed;
+ int duped;
+ int dropped;
+ int counter;
+
+ current = Current(); // get current menu item index
+ Clear(); // clear the menu
+
+ SetHasHotkeys();
+ Add(new cOsdItem(hk(tr("Suspend SoftHdDevice")), osUser1));
+ Add(new cOsdItem(NULL, osUnknown, false));
+ Add(new cOsdItem(NULL, osUnknown, false));
+ GetStats(&missed, &duped, &dropped, &counter);
+ Add(new cOsdItem(cString::
+ sprintf(tr(" Frames missed(%d) duped(%d) dropped(%d) total(%d)"),
+ missed, duped, dropped, counter), osUnknown, false));
+
+ SetCurrent(Get(current)); // restore selected menu entry
+ Display(); // display build menu
+}
+
+/**
** Soft device menu constructor.
*/
cSoftHdMenu::cSoftHdMenu(const char *title, int c0, int c1, int c2, int c3,
@@ -1119,8 +1148,7 @@ cSoftHdMenu::cSoftHdMenu(const char *title, int c0, int c1, int c2, int c3,
{
HotkeyState = 0;
- SetHasHotkeys();
- Add(new cOsdItem(hk(tr("Suspend SoftHdDevice")), osUser1));
+ Create();
}
/**
@@ -1288,6 +1316,7 @@ eOSState cSoftHdMenu::ProcessKey(eKeys key)
}
return osEnd;
default:
+ Create();
break;
}
return state;
@@ -1581,8 +1610,8 @@ bool cSoftHdDevice::Flush(int timeout_ms)
** Sets the video display format to the given one (only useful if this
** device has an MPEG decoder).
*/
-void cSoftHdDevice:: SetVideoDisplayFormat(eVideoDisplayFormat
- video_display_format)
+void cSoftHdDevice::
+SetVideoDisplayFormat(eVideoDisplayFormat video_display_format)
{
static int last = -1;
diff --git a/video.c b/video.c
index 4ae0f07..48543de 100644
--- a/video.c
+++ b/video.c
@@ -9642,6 +9642,37 @@ uint8_t *VideoGrabService(int *size, int *width, int *height)
return NULL;
}
+///
+/// Get decoder statistics.
+///
+/// @param hw_decoder video hardware decoder
+/// @param[out] missed missed frames
+/// @param[out] duped duped frames
+/// @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)
+{
+ // FIXME: test to check if working, than make module function
+#ifdef USE_VDPAU
+ if (VideoUsedModule == &VdpauModule) {
+ *missed = hw_decoder->Vdpau.FramesMissed;
+ *duped = hw_decoder->Vdpau.FramesDuped;
+ *dropped = hw_decoder->Vdpau.FramesDropped;
+ *counter = hw_decoder->Vdpau.FrameCounter;
+ }
+#endif
+#ifdef USE_VAPI
+ if (VideoUsedModule == &VaapiModule) {
+ *missed = hw_decoder->Vaapi.FramesMissed;
+ *duped = hw_decoder->Vaapi.FramesDuped;
+ *dropped = hw_decoder->Vaapi.FramesDropped;
+ *counter = hw_decoder->Vaapi.FrameCounter;
+ }
+#endif
+}
+
#ifdef USE_SCREENSAVER
//----------------------------------------------------------------------------
diff --git a/video.h b/video.h
index 3b5bbaa..9624e2d 100644
--- a/video.h
+++ b/video.h
@@ -174,6 +174,9 @@ extern uint8_t *VideoGrab(int *, int *, int *, int);
/// Grab screen raw.
extern uint8_t *VideoGrabService(int *, int *, int *);
+ /// Get decoder statistics.
+extern void VideoGetStats(VideoHwDecoder *, int *, int *, int *, int *);
+
extern void VideoOsdInit(void); ///< Setup osd.
extern void VideoOsdExit(void); ///< Cleanup osd.