summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Reufer <thomas@reufer.ch>2014-06-15 20:21:27 +0200
committerThomas Reufer <thomas@reufer.ch>2014-06-15 20:21:27 +0200
commit94b323fdb19a7f5b57a67aa3f814350f4c78ff90 (patch)
tree9f94dce7b27a1e7c4684e0b5a7909ba401902a4b
parent4ea708c5af163339a5dd1565687d9815f1a2bb84 (diff)
downloadvdr-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--HISTORY1
-rw-r--r--omx.c5
-rw-r--r--omxdevice.c29
-rw-r--r--omxdevice.h1
-rw-r--r--po/de_DE.po14
-rw-r--r--setup.c30
-rw-r--r--setup.h13
-rw-r--r--tools.h17
8 files changed, 84 insertions, 26 deletions
diff --git a/HISTORY b/HISTORY
index 1923d4e..9b09060 100644
--- a/HISTORY
+++ b/HISTORY
@@ -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
diff --git a/omx.c b/omx.c
index c74f217..ccfeec8 100644
--- a/omx.c
+++ b/omx.c
@@ -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, &region) != 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"
diff --git a/setup.c b/setup.c
index 008cbaf..ceeac39 100644
--- a/setup.c
+++ b/setup.c
@@ -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);
+ }
}
diff --git a/setup.h b/setup.h
index ab701bd..146fe53 100644
--- a/setup.h
+++ b/setup.h
@@ -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);
diff --git a/tools.h b/tools.h
index 293731e..320ab48 100644
--- a/tools.h
+++ b/tools.h
@@ -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: