summaryrefslogtreecommitdiff
path: root/display.c
diff options
context:
space:
mode:
authorThomas Reufer <thomas@reufer.ch>2014-10-06 13:02:07 +0200
committerThomas Reufer <thomas@reufer.ch>2014-10-06 13:02:07 +0200
commitaaacdf7c87413cb52fcdb70937bb25a243a085f2 (patch)
treeb0c9e950a20910624e8cf316a80fa8604208ab86 /display.c
parent40033ad641925853ca993dca1db769d98a2aae51 (diff)
downloadvdr-plugin-rpihddevice-aaacdf7c87413cb52fcdb70937bb25a243a085f2.tar.gz
vdr-plugin-rpihddevice-aaacdf7c87413cb52fcdb70937bb25a243a085f2.tar.bz2
add setup options to control video mode and its behaviour on stream changes
Diffstat (limited to 'display.c')
-rw-r--r--display.c77
1 files changed, 61 insertions, 16 deletions
diff --git a/display.c b/display.c
index 95692ac..9c3c513 100644
--- a/display.c
+++ b/display.c
@@ -6,6 +6,7 @@
#include "display.h"
#include "tools.h"
+#include "setup.h"
#include <vdr/tools.h>
@@ -94,25 +95,12 @@ int cRpiDisplay::GetSize(int &width, int &height, double &aspect)
return -1;
}
-int cRpiDisplay::Get(int &width, int &height, int &frameRate, bool &interlaced)
-{
- cRpiDisplay* instance = GetInstance();
- if (instance)
- {
- width = instance->m_width;
- height = instance->m_height;
- frameRate = instance->m_frameRate;
- interlaced = instance->m_interlaced;
- return 0;
- }
- return -1;
-}
-
-int cRpiDisplay::Set(int width, int height, int frameRate, bool interlaced)
+int cRpiDisplay::SetVideoFormat(int width, int height, int frameRate,
+ bool interlaced)
{
cRpiDisplay* instance = GetInstance();
if (instance)
- return instance->SetMode(width, height, frameRate, interlaced);
+ return instance->Update(width, height, frameRate, interlaced);
return -1;
}
@@ -163,6 +151,63 @@ int cRpiDisplay::Snapshot(unsigned char* frame, int width, int height)
return -1;
}
+int cRpiDisplay::Update(int width, int height, int frameRate, bool interlaced)
+{
+ if (cRpiSetup::GetVideoResolution() == cVideoResolution::eDontChange &&
+ cRpiSetup::GetVideoFrameRate() == cVideoFrameRate::eDontChange)
+ return 0;
+
+ int newWidth = m_width;
+ int newHeight = m_height;
+ int newFrameRate = m_frameRate;
+ bool newInterlaced = m_interlaced;
+
+ switch (cRpiSetup::GetVideoResolution())
+ {
+ case cVideoResolution::e480: newWidth = 720; newHeight = 480; break;
+ case cVideoResolution::e576: newWidth = 720; newHeight = 576; break;
+ case cVideoResolution::e720: newWidth = 1280; newHeight = 720; break;
+ case cVideoResolution::e1080: newWidth = 1920; newHeight = 1080; break;
+
+ case cVideoResolution::eFollowVideo:
+ if (width && height)
+ {
+ newWidth = width;
+ newHeight = height;
+ }
+ break;
+
+ default:
+ case cVideoResolution::eDontChange:
+ break;
+ }
+
+ switch (cRpiSetup::GetVideoFrameRate())
+ {
+ case cVideoFrameRate::e24p: newFrameRate = 24; newInterlaced = false; break;
+ case cVideoFrameRate::e25p: newFrameRate = 25; newInterlaced = false; break;
+ case cVideoFrameRate::e30p: newFrameRate = 30; newInterlaced = false; break;
+ case cVideoFrameRate::e50i: newFrameRate = 50; newInterlaced = true; break;
+ case cVideoFrameRate::e50p: newFrameRate = 50; newInterlaced = false; break;
+ case cVideoFrameRate::e60i: newFrameRate = 60; newInterlaced = true; break;
+ case cVideoFrameRate::e60p: newFrameRate = 60; newInterlaced = false; break;
+
+ case cVideoFrameRate::eFollowVideo:
+ if (frameRate)
+ {
+ newFrameRate = frameRate;
+ newInterlaced = interlaced;
+ }
+ break;
+
+ default:
+ case cVideoFrameRate::eDontChange:
+ break;
+ }
+
+ return SetMode(newWidth, newHeight, newFrameRate, newInterlaced);
+}
+
/* ------------------------------------------------------------------------- */
#define HDMI_MAX_MODES 64