diff options
| author | Thomas Reufer <thomas@reufer.ch> | 2014-10-06 13:02:07 +0200 |
|---|---|---|
| committer | Thomas Reufer <thomas@reufer.ch> | 2014-10-06 13:02:07 +0200 |
| commit | aaacdf7c87413cb52fcdb70937bb25a243a085f2 (patch) | |
| tree | b0c9e950a20910624e8cf316a80fa8604208ab86 | |
| parent | 40033ad641925853ca993dca1db769d98a2aae51 (diff) | |
| download | vdr-plugin-rpihddevice-aaacdf7c87413cb52fcdb70937bb25a243a085f2.tar.gz vdr-plugin-rpihddevice-aaacdf7c87413cb52fcdb70937bb25a243a085f2.tar.bz2 | |
add setup options to control video mode and its behaviour on stream changes
| -rw-r--r-- | display.c | 77 | ||||
| -rw-r--r-- | display.h | 8 | ||||
| -rw-r--r-- | omxdevice.c | 8 | ||||
| -rw-r--r-- | po/de_DE.po | 14 | ||||
| -rw-r--r-- | po/fi_FI.po | 14 | ||||
| -rw-r--r-- | setup.c | 31 | ||||
| -rw-r--r-- | setup.h | 30 | ||||
| -rw-r--r-- | tools.h | 52 |
8 files changed, 208 insertions, 26 deletions
@@ -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 @@ -23,17 +23,19 @@ public: static cRpiVideoPort::ePort GetVideoPort(void); static bool IsProgressive(void); - static int Get(int &width, int &height, int &frameRate, bool &interlaced); - static int Set(int width, int height, int frameRate, bool interlaced); - static int Snapshot(unsigned char* frame, int width, int height); + static int SetVideoFormat(int width, int height, int frameRate, + bool interlaced); + protected: cRpiDisplay(int width, int height, int frameRate, cRpiVideoPort::ePort port); virtual ~cRpiDisplay(); + int Update(int width, int height, int frameRate, bool interlaced); + virtual int SetMode(int width, int height, int frameRate, bool interlaced) { return 0; } diff --git a/omxdevice.c b/omxdevice.c index c696f93..a1664da 100644 --- a/omxdevice.c +++ b/omxdevice.c @@ -619,6 +619,8 @@ void cOmxDevice::HandleStreamStart() ILOG("video stream started %dx%d@%d%s", width, height, frameRate, interlaced ? "i" : "p"); + + cRpiDisplay::SetVideoFormat(width, height, frameRate, interlaced); } void cOmxDevice::HandleVideoSetupChanged() @@ -640,6 +642,12 @@ void cOmxDevice::HandleVideoSetupChanged() m_omx->SetDisplayMode(true, true); break; } + + int width, height, frameRate; + bool interlaced; + + m_omx->GetVideoFormat(width, height, frameRate, interlaced); + cRpiDisplay::SetVideoFormat(width, height, frameRate, interlaced); } void cOmxDevice::FlushStreams(bool flushVideoRender) diff --git a/po/de_DE.po b/po/de_DE.po index 3e9795b..8a36fa8 100644 --- a/po/de_DE.po +++ b/po/de_DE.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: vdr-rpihddevice 0.0.4\n" "Report-Msgid-Bugs-To: <see README>\n" -"POT-Creation-Date: 2014-06-15 19:14+0200\n" +"POT-Creation-Date: 2014-10-05 23:08+0200\n" "PO-Revision-Date: 2013-10-14 13:36+0200\n" "Last-Translator: <thomas@reufer.ch>\n" "Language-Team: German <translation-team-de@lists.sourceforge.net>\n" @@ -23,6 +23,12 @@ msgstr "Videoformat nicht unterstützt!" msgid "HD output device for Raspberry Pi" msgstr "HD Ausgabegerät für Raspberry Pi" +msgid "Resolution" +msgstr "Auflösung" + +msgid "Frame Rate" +msgstr "Bildwiederholrate" + msgid "Video Framing" msgstr "Seitenverhältnis-Anpassung" @@ -49,3 +55,9 @@ msgstr "abschneiden" msgid "stretch" msgstr "dehnen" + +msgid "don't change" +msgstr "nicht ändern" + +msgid "follow video" +msgstr "wie Video" diff --git a/po/fi_FI.po b/po/fi_FI.po index 52a6902..76d63dc 100644 --- a/po/fi_FI.po +++ b/po/fi_FI.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: vdr-rpihddevice 0.0.8\n" "Report-Msgid-Bugs-To: <see README>\n" -"POT-Creation-Date: 2014-09-10 07:32+0200\n" +"POT-Creation-Date: 2014-10-06 12:59+0200\n" "PO-Revision-Date: 2014-03-22 03:22+0200\n" "Last-Translator: Rolf Ahrenberg\n" "Language-Team: Finnish <vdr@linuxtv.org>\n" @@ -22,6 +22,12 @@ msgstr "Kuvaformaatti ei ole tuettu!" msgid "HD output device for Raspberry Pi" msgstr "Raspberry Pi HD-ulostulolaite" +msgid "Resolution" +msgstr "" + +msgid "Frame Rate" +msgstr "" + msgid "Video Framing" msgstr "" @@ -48,3 +54,9 @@ msgstr "" msgid "stretch" msgstr "" + +msgid "don't change" +msgstr "" + +msgid "follow video" +msgstr "" @@ -57,6 +57,8 @@ protected: SetupStore("IgnoreAudioEDID", m_audio.ignoreEDID); SetupStore("VideoFraming", m_video.framing); + SetupStore("Resolution", m_video.resolution); + SetupStore("FrameRate", m_video.frameRate); cRpiSetup::GetInstance()->Set(m_audio, m_video); } @@ -68,8 +70,17 @@ private: int current = Current(); Clear(); + if (cRpiDisplay::GetVideoPort() == cRpiVideoPort::eHDMI) + { + Add(new cMenuEditStraItem( + tr("Resolution"), &m_video.resolution, 6, s_videoResolution)); + + Add(new cMenuEditStraItem( + tr("Frame Rate"), &m_video.frameRate, 9, s_videoFrameRate)); + } + Add(new cMenuEditStraItem( - tr("Video Framing"), &m_video.framing, 3, s_videoframing)); + tr("Video Framing"), &m_video.framing, 3, s_videoFraming)); Add(new cMenuEditStraItem( tr("Audio Port"), &m_audio.port, 2, s_audioport)); @@ -92,15 +103,25 @@ private: cRpiSetup::VideoParameters m_video; static const char *const s_audioport[2]; - static const char *const s_videoframing[3]; + static const char *const s_videoFraming[3]; + static const char *const s_videoResolution[6]; + static const char *const s_videoFrameRate[9]; }; const char *const cRpiSetupPage::s_audioport[] = { tr("analog"), tr("HDMI") }; -const char *const cRpiSetupPage::s_videoframing[] = +const char *const cRpiSetupPage::s_videoFraming[] = { tr("box"), tr("crop"), tr("stretch") }; +const char *const cRpiSetupPage::s_videoResolution[] = + { tr("don't change"), tr("follow video"), + "720x480", "720x576", "1280x720", "1920x1080" }; + +const char *const cRpiSetupPage::s_videoFrameRate[] = + { tr("don't change"), tr("follow video"), + "24p", "25p", "30p", "50i", "50p", "60i", "60p" }; + /* ------------------------------------------------------------------------- */ cRpiSetup* cRpiSetup::s_instance = 0; @@ -255,6 +276,10 @@ bool cRpiSetup::Parse(const char *name, const char *value) m_audio.ignoreEDID = atoi(value); else if (!strcasecmp(name, "VideoFraming")) m_video.framing = atoi(value); + else if (!strcasecmp(name, "Resolution")) + m_video.resolution = atoi(value); + else if (!strcasecmp(name, "FrameRate")) + m_video.frameRate = atoi(value); else return false; return true; @@ -35,12 +35,17 @@ public: struct VideoParameters { VideoParameters() : - framing(0) { } + framing(0), + resolution(0), + frameRate(0) { } int framing; + int resolution; + int frameRate; bool operator!=(const VideoParameters& a) { - return (a.framing != framing); + return (a.framing != framing) || (a.resolution != resolution) || + (a.frameRate != frameRate); } }; @@ -62,6 +67,27 @@ public: cVideoFraming::eStretch; } + static cVideoResolution::eResolution GetVideoResolution(void) { + return GetInstance()->m_video.resolution == 1 ? cVideoResolution::eFollowVideo : + GetInstance()->m_video.resolution == 2 ? cVideoResolution::e480 : + GetInstance()->m_video.resolution == 3 ? cVideoResolution::e576 : + GetInstance()->m_video.resolution == 4 ? cVideoResolution::e720 : + GetInstance()->m_video.resolution == 5 ? cVideoResolution::e1080 : + cVideoResolution::eDontChange; + } + + static cVideoFrameRate::eFrameRate GetVideoFrameRate(void) { + return GetInstance()->m_video.frameRate == 1 ? cVideoFrameRate::eFollowVideo : + GetInstance()->m_video.frameRate == 2 ? cVideoFrameRate::e24p : + GetInstance()->m_video.frameRate == 3 ? cVideoFrameRate::e25p : + GetInstance()->m_video.frameRate == 4 ? cVideoFrameRate::e30p : + GetInstance()->m_video.frameRate == 5 ? cVideoFrameRate::e50i : + GetInstance()->m_video.frameRate == 6 ? cVideoFrameRate::e50p : + GetInstance()->m_video.frameRate == 7 ? cVideoFrameRate::e60i : + GetInstance()->m_video.frameRate == 8 ? cVideoFrameRate::e60p : + cVideoFrameRate::eDontChange; + } + static bool IsAudioFormatSupported(cAudioCodec::eCodec codec, int channels, int samplingRate); @@ -17,6 +17,58 @@ #define DBG(a...) void() #endif +class cVideoResolution +{ +public: + + enum eResolution { + eDontChange = 0, + eFollowVideo, + e480, + e576, + e720, + e1080 + }; + + static const char* Str(eResolution resolution) { + return (resolution == eDontChange) ? "don't change" : + (resolution == eFollowVideo) ? "follow video" : + (resolution == e480) ? "480" : + (resolution == e576) ? "576" : + (resolution == e720) ? "720" : + (resolution == e1080) ? "1080" : "unknown"; + } +}; + +class cVideoFrameRate +{ +public: + + enum eFrameRate { + eDontChange = 0, + eFollowVideo, + e24p, + e25p, + e30p, + e50i, + e50p, + e60i, + e60p + }; + + static const char* Str(eFrameRate frameRate) { + return (frameRate == eDontChange) ? "don't change" : + (frameRate == eFollowVideo) ? "follow video" : + (frameRate == e24p) ? "p24" : + (frameRate == e25p) ? "p25" : + (frameRate == e30p) ? "p30" : + (frameRate == e50i) ? "i50" : + (frameRate == e50p) ? "p50" : + (frameRate == e60i) ? "i60" : + (frameRate == e60p) ? "p60" : "unknown"; + } +}; + class cVideoFraming { public: |
