2008-11-09 12:43:27 +01:00
|
|
|
/*
|
2015-03-07 21:32:58 +01:00
|
|
|
* symbol.c: Frontend Status Monitor plugin for the Video Disk Recorder
|
2008-11-09 12:43:27 +01:00
|
|
|
*
|
|
|
|
* See the README file for copyright information and how to reach the author.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2011-04-20 16:41:17 +02:00
|
|
|
#include <vdr/device.h>
|
2015-03-07 21:32:58 +01:00
|
|
|
|
2015-03-07 21:09:18 +01:00
|
|
|
#include "log.h"
|
2015-03-07 21:32:58 +01:00
|
|
|
#include "tools.h"
|
|
|
|
#include "symbol.h"
|
2008-11-09 12:43:27 +01:00
|
|
|
|
|
|
|
#include "symbols/stereo.xpm"
|
|
|
|
#include "symbols/monoleft.xpm"
|
|
|
|
#include "symbols/monoright.xpm"
|
|
|
|
#include "symbols/dolbydigital.xpm"
|
|
|
|
#include "symbols/dolbydigital20.xpm"
|
|
|
|
#include "symbols/dolbydigital51.xpm"
|
|
|
|
#include "symbols/mpeg2.xpm"
|
|
|
|
#include "symbols/h264.xpm"
|
2017-01-05 16:55:53 +01:00
|
|
|
#include "symbols/h265.xpm"
|
2008-11-09 12:43:27 +01:00
|
|
|
#include "symbols/ntsc.xpm"
|
|
|
|
#include "symbols/pal.xpm"
|
2008-11-09 13:35:12 +01:00
|
|
|
#include "symbols/encrypted.xpm"
|
2008-11-09 12:43:27 +01:00
|
|
|
#include "symbols/svdrp.xpm"
|
|
|
|
#include "symbols/lock.xpm"
|
|
|
|
#include "symbols/signal.xpm"
|
|
|
|
#include "symbols/carrier.xpm"
|
|
|
|
#include "symbols/viterbi.xpm"
|
|
|
|
#include "symbols/sync.xpm"
|
|
|
|
#include "symbols/ar11.xpm"
|
|
|
|
#include "symbols/ar169.xpm"
|
|
|
|
#include "symbols/ar2211.xpm"
|
|
|
|
#include "symbols/ar43.xpm"
|
|
|
|
#include "symbols/device.xpm"
|
|
|
|
#include "symbols/zero.xpm"
|
|
|
|
#include "symbols/one.xpm"
|
|
|
|
#include "symbols/two.xpm"
|
|
|
|
#include "symbols/three.xpm"
|
|
|
|
#include "symbols/four.xpm"
|
|
|
|
#include "symbols/five.xpm"
|
|
|
|
#include "symbols/six.xpm"
|
|
|
|
#include "symbols/seven.xpm"
|
2009-09-02 14:58:30 +02:00
|
|
|
#include "symbols/eight.xpm"
|
2017-02-24 19:49:44 +01:00
|
|
|
#include "symbols/format2160.xpm"
|
|
|
|
#include "symbols/format2160i.xpm"
|
|
|
|
#include "symbols/format2160p.xpm"
|
2009-09-02 14:58:30 +02:00
|
|
|
#include "symbols/format1080.xpm"
|
2011-11-27 01:09:27 +01:00
|
|
|
#include "symbols/format1080i.xpm"
|
|
|
|
#include "symbols/format1080p.xpm"
|
2009-09-02 14:58:30 +02:00
|
|
|
#include "symbols/format720.xpm"
|
2011-11-27 01:09:27 +01:00
|
|
|
#include "symbols/format720i.xpm"
|
|
|
|
#include "symbols/format720p.xpm"
|
2009-09-02 14:58:30 +02:00
|
|
|
#include "symbols/format576.xpm"
|
2011-11-27 01:09:27 +01:00
|
|
|
#include "symbols/format576i.xpm"
|
|
|
|
#include "symbols/format576p.xpm"
|
2009-09-02 14:58:30 +02:00
|
|
|
#include "symbols/format480.xpm"
|
2011-11-27 01:09:27 +01:00
|
|
|
#include "symbols/format480i.xpm"
|
|
|
|
#include "symbols/format480p.xpm"
|
2008-11-09 12:43:27 +01:00
|
|
|
|
2014-01-02 20:33:34 +01:00
|
|
|
static cBitmap bmOnePixel(1, 1, 1);
|
2011-04-20 16:41:17 +02:00
|
|
|
static cBitmap bmStereo(stereo_xpm);
|
|
|
|
static cBitmap bmMonoLeft(monoleft_xpm);
|
|
|
|
static cBitmap bmMonoRight(monoright_xpm);
|
|
|
|
static cBitmap bmDolbyDigital(dolbydigital_xpm);
|
|
|
|
static cBitmap bmDolbyDigital20(dolbydigital20_xpm);
|
|
|
|
static cBitmap bmDolbyDigital51(dolbydigital51_xpm);
|
|
|
|
static cBitmap bmMpeg2(mpeg2_xpm);
|
|
|
|
static cBitmap bmH264(h264_xpm);
|
2017-01-05 16:55:53 +01:00
|
|
|
static cBitmap bmH265(h265_xpm);
|
2011-04-20 16:41:17 +02:00
|
|
|
static cBitmap bmPal(pal_xpm);
|
|
|
|
static cBitmap bmNtsc(ntsc_xpm);
|
|
|
|
static cBitmap bmEncrypted(encrypted_xpm);
|
|
|
|
static cBitmap bmSvdrp(svdrp_xpm);
|
|
|
|
static cBitmap bmLock(lock_xpm);
|
|
|
|
static cBitmap bmSignal(signal_xpm);
|
|
|
|
static cBitmap bmCarrier(carrier_xpm);
|
|
|
|
static cBitmap bmViterbi(viterbi_xpm);
|
|
|
|
static cBitmap bmSync(sync_xpm);
|
|
|
|
static cBitmap bmAspectRatio11(ar11_xpm);
|
|
|
|
static cBitmap bmAspectRatio169(ar169_xpm);
|
|
|
|
static cBitmap bmAspectRatio2211(ar2211_xpm);
|
|
|
|
static cBitmap bmAspectRatio43(ar43_xpm);
|
|
|
|
static cBitmap bmDevice(device_xpm);
|
|
|
|
static cBitmap bmZero(zero_xpm);
|
|
|
|
static cBitmap bmOne(one_xpm);
|
|
|
|
static cBitmap bmTwo(two_xpm);
|
|
|
|
static cBitmap bmThree(three_xpm);
|
|
|
|
static cBitmap bmFour(four_xpm);
|
|
|
|
static cBitmap bmFive(five_xpm);
|
|
|
|
static cBitmap bmSix(six_xpm);
|
|
|
|
static cBitmap bmSeven(seven_xpm);
|
|
|
|
static cBitmap bmEight(eight_xpm);
|
2017-02-24 19:49:44 +01:00
|
|
|
static cBitmap bmFormat2160(format2160_xpm);
|
|
|
|
static cBitmap bmFormat2160i(format2160i_xpm);
|
|
|
|
static cBitmap bmFormat2160p(format2160p_xpm);
|
2011-04-20 16:41:17 +02:00
|
|
|
static cBitmap bmFormat1080(format1080_xpm);
|
2011-11-27 01:09:27 +01:00
|
|
|
static cBitmap bmFormat1080i(format1080i_xpm);
|
|
|
|
static cBitmap bmFormat1080p(format1080p_xpm);
|
2011-04-20 16:41:17 +02:00
|
|
|
static cBitmap bmFormat720(format720_xpm);
|
2011-11-27 01:09:27 +01:00
|
|
|
static cBitmap bmFormat720i(format720i_xpm);
|
|
|
|
static cBitmap bmFormat720p(format720p_xpm);
|
2011-04-20 16:41:17 +02:00
|
|
|
static cBitmap bmFormat576(format576_xpm);
|
2011-11-27 01:09:27 +01:00
|
|
|
static cBitmap bmFormat576i(format576i_xpm);
|
|
|
|
static cBitmap bmFormat576p(format576p_xpm);
|
2011-04-20 16:41:17 +02:00
|
|
|
static cBitmap bmFormat480(format480_xpm);
|
2011-11-27 01:09:27 +01:00
|
|
|
static cBitmap bmFormat480i(format480i_xpm);
|
|
|
|
static cBitmap bmFormat480p(format480p_xpm);
|
2011-04-20 16:41:17 +02:00
|
|
|
|
|
|
|
cFemonSymbolCache femonSymbols;
|
|
|
|
|
|
|
|
cFemonSymbolCache::cFemonSymbolCache()
|
|
|
|
: xFactorM(1.0),
|
|
|
|
yFactorM(1.0),
|
|
|
|
antiAliasM(false)
|
2008-11-09 12:43:27 +01:00
|
|
|
{
|
2011-04-20 16:41:17 +02:00
|
|
|
Populate();
|
|
|
|
}
|
|
|
|
|
|
|
|
cFemonSymbolCache::~cFemonSymbolCache()
|
|
|
|
{
|
|
|
|
Flush();
|
|
|
|
}
|
|
|
|
|
|
|
|
void cFemonSymbolCache::Refresh()
|
|
|
|
{
|
|
|
|
int width, height;
|
|
|
|
double aspect, xfactor, yfactor;
|
|
|
|
cDevice::PrimaryDevice()->GetOsdSize(width, height, aspect);
|
2015-03-07 21:09:18 +01:00
|
|
|
debug1("%s width=%d height=%d", __PRETTY_FUNCTION__, width, height);
|
2011-04-20 16:41:17 +02:00
|
|
|
xfactor = (double)width / DEFAULT_WIDTH;
|
|
|
|
yfactor = (double)height / DEFAULT_HEIGHT;
|
|
|
|
if (!DoubleEqual(xfactor, xFactorM) || !DoubleEqual(yfactor, yFactorM)) {
|
|
|
|
xFactorM = xfactor;
|
|
|
|
yFactorM = yfactor;
|
|
|
|
Populate();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool cFemonSymbolCache::Populate(void)
|
|
|
|
{
|
2015-03-07 21:09:18 +01:00
|
|
|
debug1("%s xFactor=%.02f yFactor=%.02f", __PRETTY_FUNCTION__, xFactorM, yFactorM);
|
2011-04-20 16:41:17 +02:00
|
|
|
if (!DoubleEqual(0.0, xFactorM) || !DoubleEqual(0.0, yFactorM)) {
|
|
|
|
Flush();
|
|
|
|
|
2011-04-21 09:59:40 +02:00
|
|
|
// pushing order must follow the enumeration - keep original proportions except for frontend status ones
|
2014-01-06 21:36:54 +01:00
|
|
|
cacheM.Append(bmOnePixel.Scaled(yFactorM, yFactorM, antiAliasM)); // SYMBOL_ONEPIXEL
|
|
|
|
cacheM.Append(bmStereo.Scaled(yFactorM, yFactorM, antiAliasM)); // SYMBOL_STEREO
|
|
|
|
cacheM.Append(bmMonoLeft.Scaled(yFactorM, yFactorM, antiAliasM)); // SYMBOL_MONO_LEFT
|
|
|
|
cacheM.Append(bmMonoRight.Scaled(yFactorM, yFactorM, antiAliasM)); // SYMBOL_MONO_RIGHT
|
|
|
|
cacheM.Append(bmDolbyDigital.Scaled(yFactorM, yFactorM, antiAliasM)); // SYMBOL_DD
|
|
|
|
cacheM.Append(bmDolbyDigital20.Scaled(yFactorM, yFactorM, antiAliasM)); // SYMBOL_DD20
|
|
|
|
cacheM.Append(bmDolbyDigital51.Scaled(yFactorM, yFactorM, antiAliasM)); // SYMBOL_DD51
|
|
|
|
cacheM.Append(bmMpeg2.Scaled(yFactorM, yFactorM, antiAliasM)); // SYMBOL_MPEG2
|
|
|
|
cacheM.Append(bmH264.Scaled(yFactorM, yFactorM, antiAliasM)); // SYMBOL_H264
|
2017-01-05 16:55:53 +01:00
|
|
|
cacheM.Append(bmH265.Scaled(yFactorM, yFactorM, antiAliasM)); // SYMBOL_H265
|
2014-01-06 21:36:54 +01:00
|
|
|
cacheM.Append(bmPal.Scaled(yFactorM, yFactorM, antiAliasM)); // SYMBOL_PAL
|
|
|
|
cacheM.Append(bmNtsc.Scaled(yFactorM, yFactorM, antiAliasM)); // SYMBOL_NTSC
|
|
|
|
cacheM.Append(bmEncrypted.Scaled(yFactorM, yFactorM, antiAliasM)); // SYMBOL_ENCRYPTED
|
|
|
|
cacheM.Append(bmSvdrp.Scaled(yFactorM, yFactorM, antiAliasM)); // SYMBOL_SVDRP
|
|
|
|
cacheM.Append(bmLock.Scaled(xFactorM, yFactorM, antiAliasM)); // SYMBOL_LOCK
|
|
|
|
cacheM.Append(bmSignal.Scaled(xFactorM, yFactorM, antiAliasM)); // SYMBOL_SIGNAL
|
|
|
|
cacheM.Append(bmCarrier.Scaled(xFactorM, yFactorM, antiAliasM)); // SYMBOL_CARRIER
|
|
|
|
cacheM.Append(bmViterbi.Scaled(xFactorM, yFactorM, antiAliasM)); // SYMBOL_VITERBI
|
|
|
|
cacheM.Append(bmSync.Scaled(xFactorM, yFactorM, antiAliasM)); // SYMBOL_SYNC
|
|
|
|
cacheM.Append(bmAspectRatio11.Scaled(yFactorM, yFactorM, antiAliasM)); // SYMBOL_AR_1_1
|
|
|
|
cacheM.Append(bmAspectRatio169.Scaled(yFactorM, yFactorM, antiAliasM)); // SYMBOL_AR_16_9
|
2011-04-21 09:59:40 +02:00
|
|
|
cacheM.Append(bmAspectRatio2211.Scaled(yFactorM, yFactorM, antiAliasM)); // SYMBOL_AR_2_21_1
|
2014-01-06 21:36:54 +01:00
|
|
|
cacheM.Append(bmAspectRatio43.Scaled(yFactorM, yFactorM, antiAliasM)); // SYMBOL_AR_4_3
|
|
|
|
cacheM.Append(bmDevice.Scaled(yFactorM, yFactorM, antiAliasM)); // SYMBOL_DEVICE
|
|
|
|
cacheM.Append(bmZero.Scaled(yFactorM, yFactorM, antiAliasM)); // SYMBOL_ZERO
|
|
|
|
cacheM.Append(bmOne.Scaled(yFactorM, yFactorM, antiAliasM)); // SYMBOL_ONE
|
|
|
|
cacheM.Append(bmTwo.Scaled(yFactorM, yFactorM, antiAliasM)); // SYMBOL_TWO
|
|
|
|
cacheM.Append(bmThree.Scaled(yFactorM, yFactorM, antiAliasM)); // SYMBOL_THREE
|
|
|
|
cacheM.Append(bmFour.Scaled(yFactorM, yFactorM, antiAliasM)); // SYMBOL_FOUR
|
|
|
|
cacheM.Append(bmFive.Scaled(yFactorM, yFactorM, antiAliasM)); // SYMBOL_FIVE
|
|
|
|
cacheM.Append(bmSix.Scaled(yFactorM, yFactorM, antiAliasM)); // SYMBOL_SIX
|
|
|
|
cacheM.Append(bmSeven.Scaled(yFactorM, yFactorM, antiAliasM)); // SYMBOL_SEVEN
|
|
|
|
cacheM.Append(bmEight.Scaled(yFactorM, yFactorM, antiAliasM)); // SYMBOL_EIGHT
|
2017-02-24 19:49:44 +01:00
|
|
|
cacheM.Append(bmFormat2160.Scaled(yFactorM, yFactorM, antiAliasM)); // SYMBOL_FORMAT_2160
|
|
|
|
cacheM.Append(bmFormat2160i.Scaled(yFactorM, yFactorM, antiAliasM)); // SYMBOL_FORMAT_2160i
|
|
|
|
cacheM.Append(bmFormat2160p.Scaled(yFactorM, yFactorM, antiAliasM)); // SYMBOL_FORMAT_2160p
|
2014-01-06 21:36:54 +01:00
|
|
|
cacheM.Append(bmFormat1080.Scaled(yFactorM, yFactorM, antiAliasM)); // SYMBOL_FORMAT_1080
|
|
|
|
cacheM.Append(bmFormat1080i.Scaled(yFactorM, yFactorM, antiAliasM)); // SYMBOL_FORMAT_1080i
|
|
|
|
cacheM.Append(bmFormat1080p.Scaled(yFactorM, yFactorM, antiAliasM)); // SYMBOL_FORMAT_1080p
|
|
|
|
cacheM.Append(bmFormat720.Scaled(yFactorM, yFactorM, antiAliasM)); // SYMBOL_FORMAT_720
|
|
|
|
cacheM.Append(bmFormat720i.Scaled(yFactorM, yFactorM, antiAliasM)); // SYMBOL_FORMAT_720i
|
|
|
|
cacheM.Append(bmFormat720p.Scaled(yFactorM, yFactorM, antiAliasM)); // SYMBOL_FORMAT_720p
|
|
|
|
cacheM.Append(bmFormat576.Scaled(yFactorM, yFactorM, antiAliasM)); // SYMBOL_FORMAT_576
|
|
|
|
cacheM.Append(bmFormat576i.Scaled(yFactorM, yFactorM, antiAliasM)); // SYMBOL_FORMAT_576i
|
|
|
|
cacheM.Append(bmFormat576p.Scaled(yFactorM, yFactorM, antiAliasM)); // SYMBOL_FORMAT_576p
|
|
|
|
cacheM.Append(bmFormat480.Scaled(yFactorM, yFactorM, antiAliasM)); // SYMBOL_FORMAT_480
|
|
|
|
cacheM.Append(bmFormat480i.Scaled(yFactorM, yFactorM, antiAliasM)); // SYMBOL_FORMAT_480i
|
|
|
|
cacheM.Append(bmFormat480p.Scaled(yFactorM, yFactorM, antiAliasM)); // SYMBOL_FORMAT_480p
|
2011-04-20 16:41:17 +02:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool cFemonSymbolCache::Flush(void)
|
|
|
|
{
|
2015-03-07 21:09:18 +01:00
|
|
|
debug1("%s", __PRETTY_FUNCTION__);
|
2011-04-20 17:09:31 +02:00
|
|
|
for (int i = 0; i < cacheM.Size(); ++i) {
|
|
|
|
cBitmap *bmp = cacheM[i];
|
|
|
|
DELETENULL(bmp);
|
|
|
|
}
|
|
|
|
cacheM.Clear();
|
2011-04-20 16:41:17 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2011-04-20 17:09:31 +02:00
|
|
|
cBitmap& cFemonSymbolCache::Get(eSymbols symbolP)
|
2011-04-20 16:41:17 +02:00
|
|
|
{
|
2017-01-05 14:38:42 +01:00
|
|
|
cBitmap *bitmapM = &bmOnePixel;
|
2011-04-20 16:41:17 +02:00
|
|
|
|
2011-04-20 17:09:31 +02:00
|
|
|
if (symbolP < cacheM.Size())
|
2011-04-20 16:41:17 +02:00
|
|
|
bitmapM = cacheM[symbolP];
|
2011-04-20 17:09:31 +02:00
|
|
|
else
|
2015-03-07 21:09:18 +01:00
|
|
|
error("%s (%d) Invalid symbol", __PRETTY_FUNCTION__, symbolP);
|
2011-04-20 16:41:17 +02:00
|
|
|
|
|
|
|
return *bitmapM;
|
|
|
|
}
|