mirror of
				https://projects.vdr-developer.org/git/vdr-plugin-softhddevice.git
				synced 2023-10-10 17:16:51 +00:00 
			
		
		
		
	Display frame statistics in plugin menu.
This commit is contained in:
		| @@ -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. | ||||
|   | ||||
							
								
								
									
										19
									
								
								softhddev.c
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								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); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -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,14 +1102,43 @@ 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(); | ||||
|     virtual eOSState ProcessKey(eKeys); | ||||
| }; | ||||
|  | ||||
| /** | ||||
| **	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. | ||||
| */ | ||||
| @@ -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; | ||||
|  | ||||
|   | ||||
							
								
								
									
										31
									
								
								video.c
									
									
									
									
									
								
							
							
						
						
									
										31
									
								
								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 | ||||
|  | ||||
| //---------------------------------------------------------------------------- | ||||
|   | ||||
							
								
								
									
										3
									
								
								video.h
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								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. | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user