diff options
| author | Thomas Reufer <thomas@reufer.ch> | 2014-06-15 20:21:27 +0200 |
|---|---|---|
| committer | Thomas Reufer <thomas@reufer.ch> | 2014-06-15 20:21:27 +0200 |
| commit | 94b323fdb19a7f5b57a67aa3f814350f4c78ff90 (patch) | |
| tree | 9f94dce7b27a1e7c4684e0b5a7909ba401902a4b | |
| parent | 4ea708c5af163339a5dd1565687d9815f1a2bb84 (diff) | |
| download | vdr-plugin-rpihddevice-94b323fdb19a7f5b57a67aa3f814350f4c78ff90.tar.gz vdr-plugin-rpihddevice-94b323fdb19a7f5b57a67aa3f814350f4c78ff90.tar.bz2 | |
add setup option for video framing mode in case of incompatible aspect ratio
| -rw-r--r-- | HISTORY | 1 | ||||
| -rw-r--r-- | omx.c | 5 | ||||
| -rw-r--r-- | omxdevice.c | 29 | ||||
| -rw-r--r-- | omxdevice.h | 1 | ||||
| -rw-r--r-- | po/de_DE.po | 14 | ||||
| -rw-r--r-- | setup.c | 30 | ||||
| -rw-r--r-- | setup.h | 13 | ||||
| -rw-r--r-- | tools.h | 17 |
8 files changed, 84 insertions, 26 deletions
@@ -2,6 +2,7 @@ VDR Plugin 'rpihddevice' Revision History ----------------------------------------- - new: + - setup option for video framing mode in case of incompatible aspect ratio - redirect ffmpeg messages to plugin/VDR logs - added cppcheck as Makefile target (suggested by Rolf Ahrenberg) - reworked setup parameter handling @@ -1064,7 +1064,7 @@ void cOmx::GetVideoSize(int &width, int &height, bool &interlaced) interlaced = m_videoInterlaced; } -void cOmx::SetDisplayMode(bool letterbox, bool noaspect) +void cOmx::SetDisplayMode(bool fill, bool noaspect) { OMX_CONFIG_DISPLAYREGIONTYPE region; OMX_INIT_STRUCT(region); @@ -1073,8 +1073,7 @@ void cOmx::SetDisplayMode(bool letterbox, bool noaspect) (OMX_DISPLAY_SET_MODE | OMX_DISPLAY_SET_NOASPECT); region.noaspect = noaspect ? OMX_TRUE : OMX_FALSE; - region.mode = letterbox ? - OMX_DISPLAY_MODE_LETTERBOX : OMX_DISPLAY_MODE_FILL; + region.mode = fill ? OMX_DISPLAY_MODE_FILL : OMX_DISPLAY_MODE_LETTERBOX; if (OMX_SetConfig(ILC_GET_HANDLE(m_comp[eVideoRender]), OMX_IndexConfigDisplayRegion, ®ion) != OMX_ErrorNone) diff --git a/omxdevice.c b/omxdevice.c index 69b77dd..6ccb113 100644 --- a/omxdevice.c +++ b/omxdevice.c @@ -80,6 +80,7 @@ int cOmxDevice::Init(void) m_omx->SetEndOfStreamCallback(&OnEndOfStream, this); cRpiSetup::SetVideoSetupChangedCallback(&OnVideoSetupChanged, this); + HandleVideoSetupChanged(); return 0; } @@ -117,18 +118,6 @@ void cOmxDevice::GetVideoSize(int &Width, int &Height, double &VideoAspect) VideoAspect = 1.0; } -void cOmxDevice::SetVideoDisplayFormat(eVideoDisplayFormat VideoDisplayFormat) -{ - DBG("SetVideoDisplayFormat(%s)", - VideoDisplayFormat == vdfPanAndScan ? "PanAndScan" : - VideoDisplayFormat == vdfLetterBox ? "LetterBox" : - VideoDisplayFormat == vdfCenterCutOut ? "CenterCutOut" : "undefined"); - - m_omx->SetDisplayMode(VideoDisplayFormat == vdfLetterBox, false); - - cDevice::SetVideoDisplayFormat(VideoDisplayFormat); -} - void cOmxDevice::ScaleVideo(const cRect &Rect) { DBG("ScaleVideo(%d, %d, %d, %d)", @@ -571,6 +560,22 @@ void cOmxDevice::HandleEndOfStream() void cOmxDevice::HandleVideoSetupChanged() { DBG("HandleVideoSettingsChanged()"); + + switch (cRpiSetup::GetVideoFraming()) + { + default: + case cVideoFraming::eFrame: + m_omx->SetDisplayMode(false, false); + break; + + case cVideoFraming::eCut: + m_omx->SetDisplayMode(true, false); + break; + + case cVideoFraming::eStretch: + m_omx->SetDisplayMode(true, true); + break; + } } void cOmxDevice::FlushStreams(bool flushVideoRender) diff --git a/omxdevice.h b/omxdevice.h index 42a097b..ea5f68f 100644 --- a/omxdevice.h +++ b/omxdevice.h @@ -32,7 +32,6 @@ public: virtual void GetOsdSize(int &Width, int &Height, double &PixelAspect); virtual void GetVideoSize(int &Width, int &Height, double &VideoAspect); - virtual void SetVideoDisplayFormat(eVideoDisplayFormat VideoDisplayFormat); virtual cRect CanScaleVideo(const cRect &Rect, int Alignment = taCenter) { return Rect; } diff --git a/po/de_DE.po b/po/de_DE.po index 76b4b03..8b2ceef 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-04-22 21:38+0200\n" +"POT-Creation-Date: 2014-06-15 19:14+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,9 @@ msgstr "Videoformat nicht unterstützt!" msgid "HD output device for Raspberry Pi" msgstr "HD Ausgabegerät für Raspberry Pi" +msgid "Video Framing" +msgstr "Seitenverhältnis-Anpassung" + msgid "Audio Port" msgstr "Audioanschluss" @@ -37,3 +40,12 @@ msgstr "analog" msgid "HDMI" msgstr "HDMI" + +msgid "frame" +msgstr "schwarze Balken" + +msgid "cut" +msgstr "abschneiden" + +msgid "stretch" +msgstr "dehnen" @@ -71,6 +71,8 @@ protected: SetupStore("PassThrough", m_audio.passthrough); SetupStore("IgnoreAudioEDID", m_audio.ignoreEDID); + SetupStore("VideoFraming", m_video.framing); + cRpiSetup::GetInstance()->Set(m_audio, m_video); } @@ -82,6 +84,9 @@ private: Clear(); Add(new cMenuEditStraItem( + tr("Video Framing"), &m_video.framing, 3, s_videoframing)); + + Add(new cMenuEditStraItem( tr("Audio Port"), &m_audio.port, 2, s_audioport)); if (m_audio.port == 1) @@ -102,11 +107,15 @@ private: cRpiSetup::VideoParameters m_video; static const char *const s_audioport[2]; + static const char *const s_videoframing[3]; }; const char *const cRpiSetupPage::s_audioport[] = { tr("analog"), tr("HDMI") }; +const char *const cRpiSetupPage::s_videoframing[] = + { tr("frame"), tr("cut"), tr("stretch") }; + bool cRpiSetup::HwInit(void) { cRpiSetup* instance = GetInstance(); @@ -230,6 +239,8 @@ bool cRpiSetup::Parse(const char *name, const char *value) m_audio.passthrough = atoi(value); else if (!strcasecmp(name, "IgnoreAudioEDID")) m_audio.ignoreEDID = atoi(value); + else if (!strcasecmp(name, "VideoFraming")) + m_video.framing = atoi(value); else return false; return true; @@ -237,12 +248,17 @@ bool cRpiSetup::Parse(const char *name, const char *value) void cRpiSetup::Set(AudioParameters audio, VideoParameters video) { - if (audio != m_audio && m_onAudioSetupChanged) - m_onAudioSetupChanged(m_onAudioSetupChangedData); - - if (video != m_video && m_onVideoSetupChanged) - m_onVideoSetupChanged(m_onVideoSetupChangedData); + if (audio != m_audio) + { + m_audio = audio; + if (m_onAudioSetupChanged) + m_onAudioSetupChanged(m_onAudioSetupChangedData); + } - m_audio = audio; - m_video = video; + if (video != m_video) + { + m_video = video; + if (m_onVideoSetupChanged) + m_onVideoSetupChanged(m_onVideoSetupChangedData); + } } @@ -34,10 +34,13 @@ public: struct VideoParameters { - VideoParameters() { } + VideoParameters() : + framing(0) { } + + int framing; bool operator!=(const VideoParameters& a) { - return true; + return (a.framing != framing); } }; @@ -53,6 +56,12 @@ public: static bool IgnoreAudioEDID(void) { return GetInstance()->m_audio.ignoreEDID; } + static cVideoFraming::eFraming GetVideoFraming(void) { + return GetInstance()->m_video.framing == 0 ? cVideoFraming::eFrame : + GetInstance()->m_video.framing == 1 ? cVideoFraming::eCut : + cVideoFraming::eStretch; + } + static bool IsAudioFormatSupported(cAudioCodec::eCodec codec, int channels, int samplingRate); @@ -17,6 +17,23 @@ #define DBG(a...) void() #endif +class cVideoFraming +{ +public: + + enum eFraming { + eFrame, + eCut, + eStretch + }; + + static const char* Str(eFraming framing) { + return (framing == eFrame) ? "frame" : + (framing == eCut) ? "cut" : + (framing == eStretch) ? "stretch" : "unknown"; + } +}; + class cAudioCodec { public: |
