summaryrefslogtreecommitdiff
path: root/setup-image.c
diff options
context:
space:
mode:
authorAndreas Brachold <vdr07@deltab.de>2005-07-28 15:41:43 +0000
committerAndreas Brachold <vdr07@deltab.de>2005-07-28 15:41:43 +0000
commit8c5bda0e344a1389cad91eef9f7e00b069ffa933 (patch)
tree305b438e155a7d69697e099a2ddbbea4b87d9eeb /setup-image.c
parent57ff8fb8eb79adfebfaf43c884eac70e3ffb2b2c (diff)
downloadvdr-plugin-image-8c5bda0e344a1389cad91eef9f7e00b069ffa933.tar.gz
vdr-plugin-image-8c5bda0e344a1389cad91eef9f7e00b069ffa933.tar.bz2
- add option for border of underscan
- rename setup variables to hungarian notation
Diffstat (limited to 'setup-image.c')
-rw-r--r--setup-image.c125
1 files changed, 89 insertions, 36 deletions
diff --git a/setup-image.c b/setup-image.c
index 8cf05d0..4f523b1 100644
--- a/setup-image.c
+++ b/setup-image.c
@@ -1,8 +1,8 @@
/*
* Image plugin to VDR (C++)
*
- * (C) 2004 Andreas Brachold <vdr04-at-deltab.de>
- * (C) 2003 Kai Tobias Burwieck <kai-at-burwieck.net>
+ * (C) 2004-2005 Andreas Brachold <vdr04-at-deltab.de>
+ * based on (C) 2003 Kai Tobias Burwieck <kai-at-burwieck.net>
*
* based on MP3/MPlayer plugin to VDR (C++)
* (C) 2001,2002 Stefan Huelswitt <huels-at-iname.com>
@@ -37,44 +37,62 @@ cImageSetup ImageSetup;
const int cImageSetup::m_cSSMin = 2;
const int cImageSetup::m_cSSMax = 300;
+
+const int cImageSetup::m_cnMinBorderHeight = 0;
+const int cImageSetup::m_cnMaxBorderHeight = 480/2; //(Half NTSC)
+
+const int cImageSetup::m_cnMinBorderWidth = 0;
+const int cImageSetup::m_cnMaxBorderWidth = 720/2; //(Half NTSC/PAL)
+
// --- cImageSetup -----------------------------------------------------------
cImageSetup::cImageSetup(void)
{
- SlideShow = 0;
- SSsec = 10;
- strncpy(TempDir, "/tmp/image", sizeof(TempDir));
+ m_bSlideShow = 0;
+ m_nSSsec = 10;
+ strncpy(m_szTempDir, "/tmp/image", sizeof(m_szTempDir));
#if VDRVERSNUM < 10307
- ShowDate = 1;
+ m_bShowDate = 1;
#endif
- AutoRepeat = 0;
- ShowNumbers = 1;
+ m_bAutoRepeat = 0;
+ m_bShowNumbers = 1;
#if VDRVERSNUM >= 10308
m_bLiveAudio = 0;
#endif
m_bHousekeeping = 1;
+
+ m_nBorderHeight = 16;
+ m_nBorderWidth = 16;
}
+#define ParseInteger(szTitle,nValue,nMin,nMax) \
+ if(!strcasecmp(szName, szTitle)) \
+ { \
+ nValue = atoi(szValue); \
+ if(nValue < nMin) nValue = nMin; \
+ if(nValue > nMax) nValue = nMax; \
+ }
+
+
bool cImageSetup::SetupParse(const char *szName, const char *szValue)
{
- if(!strcasecmp(szName, "SlideShow")) SlideShow = atoi(szValue);
- else if(!strcasecmp(szName, "SSsec"))
- {
- SSsec = atoi(szValue);
- if(SSsec < m_cSSMin) SSsec = cImageSetup::m_cSSMin;
- if(SSsec > m_cSSMax) SSsec = cImageSetup::m_cSSMax;
- }
- else if(!strcasecmp(szName, "TempDir")) strn0cpy(TempDir,szValue,sizeof(TempDir));
+ ParseInteger("SlideShow", m_bSlideShow,0,1)
+ else ParseInteger("SSsec", m_nSSsec,m_cSSMin,m_cSSMax)
+ else ParseInteger("BorderHeight", m_nBorderHeight,m_cnMinBorderHeight,m_cnMaxBorderHeight)
+ else ParseInteger("BorderWidth", m_nBorderWidth,m_cnMinBorderWidth,m_cnMaxBorderWidth)
#if VDRVERSNUM < 10307
- else if(!strcasecmp(szName, "ShowDate")) ShowDate = atoi(szValue);
+ else ParseInteger("ShowDate", m_bShowDate,0,1)
#endif
- else if(!strcasecmp(szName, "AutoRepeat")) AutoRepeat = atoi(szValue);
- else if(!strcasecmp(szName, "ShowNumbers")) ShowNumbers = atoi(szValue);
+ else ParseInteger("AutoRepeat", m_bAutoRepeat,0,1)
+ else ParseInteger("ShowNumbers", m_bShowNumbers,0,1)
#if VDRVERSNUM >= 10308
- else if(!strcasecmp(szName, "LiveAudio")) m_bLiveAudio = atoi(szValue);
+ else ParseInteger("LiveAudio", m_bLiveAudio,0,1)
#endif
- else if(!strcasecmp(szName, "Housekeeping")) m_bHousekeeping = atoi(szValue);
+ else ParseInteger("Housekeeping", m_bHousekeeping,0,1)
+ else if(!strcasecmp(szName, "TempDir")) {
+ strn0cpy(m_szTempDir,szValue,sizeof(m_szTempDir));
+ }
else return false;
return true;
}
@@ -83,36 +101,71 @@ bool cImageSetup::SetupParse(const char *szName, const char *szValue)
void cMenuSetupImage::Store(void)
{
ImageSetup = m_tmpSetup;
- SetupStore("SlideShow", ImageSetup.SlideShow);
- SetupStore("SSsec", ImageSetup.SSsec);
- SetupStore("TempDir", ImageSetup.TempDir);
+ SetupStore("SlideShow", ImageSetup.m_bSlideShow);
+ SetupStore("SSsec", ImageSetup.m_nSSsec);
+ SetupStore("TempDir", ImageSetup.m_szTempDir);
#if VDRVERSNUM < 10307
- SetupStore("ShowDate", ImageSetup.ShowDate);
+ SetupStore("ShowDate", ImageSetup.m_bShowDate);
#endif
- SetupStore("AutoRepeat", ImageSetup.AutoRepeat);
- SetupStore("ShowNumbers", ImageSetup.ShowNumbers);
+ SetupStore("AutoRepeat", ImageSetup.m_bAutoRepeat);
+ SetupStore("ShowNumbers", ImageSetup.m_bShowNumbers);
#if VDRVERSNUM >= 10308
SetupStore("LiveAudio", ImageSetup.m_bLiveAudio);
#endif
SetupStore("Housekeeping", ImageSetup.m_bHousekeeping);
+ SetupStore("BorderHeight", ImageSetup.m_nBorderHeight);
+ SetupStore("BorderWidth", ImageSetup.m_nBorderWidth);
}
cMenuSetupImage::cMenuSetupImage(void)
: m_tmpSetup(ImageSetup)
{
SetSection(tr("Image"));
- Add(new cMenuEditBoolItem(tr("SlideShow ?"), &m_tmpSetup.SlideShow, tr("no"), tr("yes")));
- Add(new cMenuEditIntItem (tr("Slide duration (sec)"), &m_tmpSetup.SSsec, cImageSetup::m_cSSMin, cImageSetup::m_cSSMax));
- Add(new cMenuEditBoolItem(tr("Repeat SlideShow"), &m_tmpSetup.AutoRepeat, tr("no"), tr("yes")));
+
+ Add(new cMenuEditBoolItem(tr("SlideShow ?"),
+ &m_tmpSetup.m_bSlideShow,
+ tr("no"), tr("yes")));
+
+ Add(new cMenuEditIntItem (tr("Slide duration (sec)"),
+ &m_tmpSetup.m_nSSsec,
+ cImageSetup::m_cSSMin, cImageSetup::m_cSSMax));
+
+ Add(new cMenuEditBoolItem(tr("Repeat SlideShow"),
+ &m_tmpSetup.m_bAutoRepeat,
+ tr("no"), tr("yes")));
+
#if VDRVERSNUM < 10307
- Add(new cMenuEditBoolItem(tr("Show Filedate on OSD"), &m_tmpSetup.ShowDate, tr("no"), tr("yes")));
+ Add(new cMenuEditBoolItem(tr("Show Filedate on OSD"),
+ &m_tmpSetup.m_bShowDate,
+ tr("no"), tr("yes")));
#endif
- Add(new cMenuEditBoolItem(tr("Show Numbers on index image"), &m_tmpSetup.ShowNumbers, tr("no"), tr("yes")));
+
+ Add(new cMenuEditBoolItem(tr("Show Numbers on index image"),
+ &m_tmpSetup.m_bShowNumbers,
+ tr("no"), tr("yes")));
+
#if VDRVERSNUM >= 10308
- Add(new cMenuEditBoolItem(tr("Live Audio from primary Device"), &m_tmpSetup.m_bLiveAudio, tr("no"), tr("yes")));
+ Add(new cMenuEditBoolItem(tr("Live Audio from primary Device"),
+ &m_tmpSetup.m_bLiveAudio,
+ tr("no"), tr("yes")));
#endif
- Add(new cMenuEditStrItem (tr("Directory with temporary files"), m_tmpSetup.TempDir,sizeof(m_tmpSetup.TempDir), "abcdefghijklmopqrstuvwxyz/-"));
- Add(new cMenuEditBoolItem(tr("Remove temporary files"), &m_tmpSetup.m_bHousekeeping, tr("no"), tr("yes")));
+
+ Add(new cMenuEditStrItem (tr("Directory with temporary files"),
+ m_tmpSetup.m_szTempDir,sizeof(m_tmpSetup.m_szTempDir),
+ "abcdefghijklmopqrstuvwxyz/-"));
+
+ Add(new cMenuEditBoolItem(tr("Remove temporary files"),
+ &m_tmpSetup.m_bHousekeeping,
+ tr("no"), tr("yes")));
+
+ Add(new cMenuEditIntItem (tr("Border for Underscan (Height)"),
+ &m_tmpSetup.m_nBorderHeight,
+ cImageSetup::m_cnMinBorderHeight, cImageSetup::m_cnMaxBorderHeight));
+
+ Add(new cMenuEditIntItem (tr("Border for Underscan (Width)"),
+ &m_tmpSetup.m_nBorderWidth,
+ cImageSetup::m_cnMinBorderWidth, cImageSetup::m_cnMaxBorderWidth));
+
}
@@ -128,7 +181,7 @@ void cImageSetup::SetEnv(void) const
} nEnvironTable [] =
{
{"ASPECT_RATIO",Setup.VideoFormat?"16:9":"4:3"}, // Get from DVB-Setup
- {"CONVERT_TEMPDIR",TempDir},
+ {"CONVERT_TEMPDIR",m_szTempDir},
};
for(i=0;i < sizeof(nEnvironTable)/sizeof(*nEnvironTable);++i)