Permalink
Browse files

TV: Add a new playback debugging OSD window.

- to display the window, you'll need to bind a key to the new DEBUGOSD
action.
- currently only displays filename and new ringbuffer monitoring data
but I'll extend to add other video/audio information.
- only currently themed for default-wide. default to follow.
  • Loading branch information...
1 parent 031b9a4 commit fce407c746f16bdb41fbb1fa2f4388bb693f4255 Mark Kendall committed Jun 3, 2011
@@ -292,11 +292,11 @@ void OSD::HideAll(bool keepsubs, MythScreenType* except)
void OSD::LoadWindows(void)
{
- static const char* default_windows[6] = {
+ static const char* default_windows[7] = {
"osd_message", "osd_input", "program_info", "browse_info", "osd_status",
- "osd_program_editor"};
+ "osd_program_editor", "osd_debug"};
- for (int i = 0; i < 6; i++)
+ for (int i = 0; i < 7; i++)
{
const char* window = default_windows[i];
MythOSDWindow *win = new MythOSDWindow(NULL, window, true);
@@ -75,4 +75,7 @@
/* Visualisations */
#define ACTION_TOGGLEVISUALISATION "TOGGLEVISUALISATION"
+/* OSD playback information screen */
+#define ACTION_TOGGLEOSDDEBUG "DEBUGOSD"
+
#endif // TV_ACTIONS_H
@@ -730,6 +730,10 @@ void TV::InitKeys(void)
REG_KEY("TV Playback", ACTION_TOGGLEVISUALISATION,
QT_TRANSLATE_NOOP("MythControls", "Toggle audio visualisation"), "");
+ /* OSD playback information screen */
+ REG_KEY("TV Playback", ACTION_TOGGLEOSDDEBUG,
+ QT_TRANSLATE_NOOP("MythControls", "Toggle OSD playback information"), "");
+
/*
keys already used:
@@ -849,6 +853,7 @@ TV::TV(void)
switchToInputTimerId(0), ccInputTimerId(0),
asInputTimerId(0), queueInputTimerId(0),
browseTimerId(0), updateOSDPosTimerId(0),
+ updateOSDDebugTimerId(0),
endOfPlaybackTimerId(0), embedCheckTimerId(0),
endOfRecPromptTimerId(0), videoExitDialogTimerId(0),
pseudoChangeChanTimerId(0), speedChangeTimerId(0),
@@ -2604,6 +2609,30 @@ void TV::timerEvent(QTimerEvent *te)
if (handled)
return;
+ if (timer_id == updateOSDDebugTimerId)
+ {
+ bool update = false;
+ PlayerContext *actx = GetPlayerReadLock(-1, __FILE__, __LINE__);
+ OSD *osd = GetOSDLock(actx);
+ if (osd && osd->IsWindowVisible("osd_debug") &&
+ (StateIsLiveTV(actx->GetState()) ||
+ StateIsPlaying(actx->GetState())))
+ {
+ update = true;
+ }
+ else
+ {
+ QMutexLocker locker(&timerIdLock);
+ KillTimer(updateOSDDebugTimerId);
+ updateOSDDebugTimerId = 0;
+ actx->buffer->EnableBitrateMonitor(false);
+ }
+ ReturnOSDLock(actx, osd);
+ if (update)
+ UpdateOSDDebug(actx);
+ ReturnPlayerLock(actx);
+ handled = true;
+ }
if (timer_id == updateOSDPosTimerId)
{
PlayerContext *actx = GetPlayerReadLock(-1, __FILE__, __LINE__);
@@ -2619,6 +2648,8 @@ void TV::timerEvent(QTimerEvent *te)
osd->SetValues("osd_status", info.values, kOSDTimeout_Ignore);
}
}
+ else
+ SetUpdateOSDPosition(false);
ReturnOSDLock(actx, osd);
ReturnPlayerLock(actx);
handled = true;
@@ -3951,6 +3982,8 @@ bool TV::ActiveHandleAction(PlayerContext *ctx,
else
ToggleOSD(ctx, true);
}
+ else if (has_action(ACTION_TOGGLEOSDDEBUG, actions))
+ ToggleOSDDebug(ctx);
else if (!isDVDStill && SeekHandleAction(ctx, actions, isDVD))
{
}
@@ -6863,6 +6896,42 @@ void TV::ToggleOSD(PlayerContext *ctx, bool includeStatusOSD)
}
}
+void TV::ToggleOSDDebug(PlayerContext *ctx)
+{
+ bool show = false;
+ OSD *osd = GetOSDLock(ctx);
+ if (osd && osd->IsWindowVisible("osd_debug"))
+ {
+ ctx->buffer->EnableBitrateMonitor(false);
+ osd->HideWindow("osd_debug");
+ }
+ else if (osd)
+ {
+ ctx->buffer->EnableBitrateMonitor(true);
+ InfoMap infoMap;
+ infoMap.insert("filename", ctx->buffer->GetFilename());
+ osd->ResetWindow("osd_debug");
+ osd->SetText("osd_debug", infoMap, kOSDTimeout_None);
+
+ QMutexLocker locker(&timerIdLock);
+ if (!updateOSDDebugTimerId)
+ updateOSDDebugTimerId = StartTimer(250, __LINE__);
+ }
+ ReturnOSDLock(ctx, osd);
+}
+
+void TV::UpdateOSDDebug(const PlayerContext *ctx)
+{
+ InfoMap infoMap;
+ infoMap.insert("decoderrate", ctx->buffer->GetDecoderRate());
+ infoMap.insert("storagerate", ctx->buffer->GetStorageRate());
+ infoMap.insert("bufferavail", ctx->buffer->GetAvailableBuffer());
+ OSD *osd = GetOSDLock(ctx);
+ if (osd)
+ osd->SetText("osd_debug", infoMap, kOSDTimeout_None);
+ ReturnOSDLock(ctx, osd);
+}
+
/** \fn TV::UpdateOSDProgInfo(const PlayerContext*, const char *whichInfo)
* \brief Update and display the passed OSD set with programinfo
*/
@@ -440,6 +440,8 @@ class MTV_PUBLIC TV : public QObject
bool ClearOSD(const PlayerContext*);
void ToggleOSD(PlayerContext*, bool includeStatusOSD);
+ void ToggleOSDDebug(PlayerContext*);
+ void UpdateOSDDebug(const PlayerContext *ctx);
void UpdateOSDProgInfo(const PlayerContext*, const char *whichInfo);
void UpdateOSDStatus(const PlayerContext *ctx, QString title, QString desc,
QString value, int type, QString units,
@@ -808,6 +810,7 @@ class MTV_PUBLIC TV : public QObject
volatile int queueInputTimerId;
volatile int browseTimerId;
volatile int updateOSDPosTimerId;
+ volatile int updateOSDDebugTimerId;
volatile int endOfPlaybackTimerId;
volatile int embedCheckTimerId;
volatile int endOfRecPromptTimerId;
@@ -1,6 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE mythuitheme SYSTEM "http://www.mythtv.org/schema/mythuitheme.dtd">
<mythuitheme>
+ <window name="osd_debug">
+ <fontdef name="medium" face="DejaVu Sans">
+ <pixelsize>16</pixelsize>
+ <color>#FFFFFF</color>
+ </fontdef>
+ <area>50,50,800,105</area>
+ <shape name="background">
+ <area>0,0,100%,100%</area>
+ <fill color="#000000" alpha="200" />
+ </shape>
+ <textarea name="file">
+ <font>medium</font>
+ <area>5,5,180,25</area>
+ <align>right,vcenter</align>
+ <value>Filename :</value>
+ </textarea>
+ <textarea name="filename">
+ <font>medium</font>
+ <area>190,5,605,25</area>
+ <align>left,vcenter</align>
+ </textarea>
+ <textarea name="storage">
+ <font>medium</font>
+ <area>5,30,180,25</area>
+ <align>right,vcenter</align>
+ <value>Storage to Buffer :</value>
+ </textarea>
+ <textarea name="storagerate">
+ <font>medium</font>
+ <area>190,30,605,25</area>
+ <align>left,vcenter</align>
+ </textarea>
+ <textarea name="decoder">
+ <font>medium</font>
+ <area>5,55,180,25</area>
+ <align>right,vcenter</align>
+ <value>Buffer to Decoder :</value>
+ </textarea>
+ <textarea name="decoderrate">
+ <font>medium</font>
+ <area>190,55,605,25</area>
+ <align>left,vcenter</align>
+ </textarea>
+ <textarea name="buffer">
+ <font>medium</font>
+ <area>5,80,180,25</area>
+ <align>right,vcenter</align>
+ <value>Available Buffer :</value>
+ </textarea>
+ <textarea name="bufferavail">
+ <font>medium</font>
+ <area>190,80,605,25</area>
+ <align>left,vcenter</align>
+ </textarea>
+ </window>
+
<window name="osd_message">
<fontdef name="medium" face="DejaVu Sans">
<pixelsize>26</pixelsize>

0 comments on commit fce407c

Please sign in to comment.