viewman->removeView(v);
// Wallpaper
- VWallpaper* w = new VWallpaper();
+ wallpaper = new VWallpaper();
if (screenSize == Video::PAL)
{
logger->log("Command", Log::DEBUG, "PAL wallpaper selected");
- w->init("/wallpaperPAL.jpg");
+ wallpaper->init("/wallpaperPAL.jpg");
}
else
{
logger->log("Command", Log::DEBUG, "NTSC wallpaper selected");
- w->init("/wallpaperNTSC.jpg");
+ wallpaper->init("/wallpaperNTSC.jpg");
}
- w->draw();
- w->show();
- viewman->add(w);
+ wallpaper->draw();
+ wallpaper->show();
+ viewman->add(wallpaper);
VConnect* vconnect = new VConnect();
viewman->add(vconnect);
}
else
{
+ Video::getInstance()->signalOff();
viewman->removeAll();
+ wallpaper->show();
VDR::getInstance()->configSave("General", "Last Power State", "Off");
VDR::getInstance()->disconnect();
- Video::getInstance()->signalOff();
Led::getInstance()->off();
isStandby = 1;
}
VDR* vdr = VDR::getInstance();
+ char* config;
// Power off if first boot and config says so
if (firstBoot)
{
firstBoot = 0;
- char* powerAfterBoot = vdr->configLoad("General", "Power After Boot");
+ config = vdr->configLoad("General", "Power After Boot");
- if (powerAfterBoot)
+ if (config)
{
- if (!strcasecmp(powerAfterBoot, "On"))
+ if (!strcasecmp(config, "On"))
{
logger->log("Command", Log::INFO, "Config says Power After Boot = On");
}
- else if (!strcasecmp(powerAfterBoot, "Off"))
+ else if (!strcasecmp(config, "Off"))
{
logger->log("Command", Log::INFO, "Config says Power After Boot = Off");
doStandby();
+ delete[] config;
return; // quit here
}
- else if (!strcasecmp(powerAfterBoot, "Last state"))
+ else if (!strcasecmp(config, "Last state"))
{
char* lastPowerState = vdr->configLoad("General", "Last Power State");
if (lastPowerState)
{
logger->log("Command", Log::INFO, "Config says Last Power State = Off");
doStandby();
+ delete[] config;
return; // quit here
}
else
{
logger->log("Command", Log::INFO, "Config/Power After Boot not understood");
}
+ delete[] config;
}
else
{
// Go S-Video if config says so
- char* svideo = vdr->configLoad("TV", "S-Video");
+ config = vdr->configLoad("TV", "S-Video");
- if (svideo)
+ if (config)
{
- if (!strcasecmp(svideo, "Yes"))
+ if (!strcasecmp(config, "Yes"))
{
- logger->log("Command", Log::INFO, "Switching to S-Video as S-Video=%s", svideo);
+ logger->log("Command", Log::INFO, "Switching to S-Video as S-Video=%s", config);
video->setConnection(Video::SVIDEO);
}
else
{
- logger->log("Command", Log::INFO, "Leaving video output as S-Video=%s", svideo);
+ logger->log("Command", Log::INFO, "Leaving video output as S-Video=%s", config);
video->setConnection(Video::COMPOSITERGB);
}
+ delete[] config;
}
else
{
// Set remote type
- char* remoteType = vdr->configLoad("General", "Remote type");
+ config = vdr->configLoad("General", "Remote type");
- if (remoteType)
+ if (config)
{
- if (!strcasecmp(remoteType, "New"))
+ if (!strcasecmp(config, "New"))
{
logger->log("Command", Log::INFO, "Switching to New remote type");
remote->setRemoteType(Remote::NEWREMOTE);
logger->log("Command", Log::INFO, "Switching to Old remote type");
remote->setRemoteType(Remote::OLDREMOTE);
}
+ delete[] config;
}
else
{
remote->setRemoteType(Remote::OLDREMOTE);
}
- // Save power state = on
-
- vdr->configSave("General", "Last Power State", "On");
-
// Get TV aspect ratio
- char* aspect = vdr->configLoad("TV", "Aspect");
-
- if (aspect)
+ config = vdr->configLoad("TV", "Aspect");
+ if (config)
{
- if (!strcasecmp(aspect, "16:9"))
+ if (!strcasecmp(config, "16:9"))
{
logger->log("Command", Log::INFO, "/// Switching to TV aspect 16:9");
video->setTVsize(Video::ASPECT16X9);
logger->log("Command", Log::INFO, "/// Switching to TV aspect 4:3");
video->setTVsize(Video::ASPECT4X3);
}
+ delete[] config;
}
else
{
video->setTVsize(Video::ASPECT4X3);
}
+ config = vdr->configLoad("TV", "Widemode");
+ if (config)
+ {
+ if (!strcasecmp(config, "Letterbox"))
+ {
+ logger->log("Command", Log::INFO, "Setting letterbox mode");
+ video->setMode(Video::LETTERBOX);
+ }
+ else
+ {
+ logger->log("Command", Log::INFO, "Setting chop-sides mode");
+ video->setMode(Video::NORMAL);
+ }
+ delete[] config;
+ }
+ else
+ {
+ logger->log("Command", Log::INFO, "Config TV/Widemode not found, Setting chop-sides mode");
+ video->setMode(Video::NORMAL);
+ }
+
// config done
+ // Save power state = on
+
+ vdr->configSave("General", "Last Power State", "On");
+
+
viewman->removeView(vi);
VWelcome* vw = new VWelcome();
Log* logger;
ViewMan* viewman;
Remote* remote;
+ VWallpaper* wallpaper;
void processMessage(Message* m);
};
{
if (!initted)
{
- if ( !videostream.init(demuxMemory) ||
- !audiostream.init(demuxMemory) ||
+ if ( !videostream.init(demuxMemoryV) ||
+ !audiostream.init(demuxMemoryA) ||
!(local_frame = (UCHAR *) malloc(0x10000)))
{
- printf("failed to initialize demuxer\n");
+ // printf("failed to initialize demuxer\n");
shutdown();
return 0;
}
void parse_video_details(UCHAR* buf, int len);
UCHAR* local_frame;
- static const int demuxMemory = 2097152;
+ static const int demuxMemoryV = 2097152;
+ static const int demuxMemoryA = 524288;
static const int Demuxer::FrameRates[9];
enum FRAMETYPE
setTVsize(ASPECT4X3);
+ if (format == PAL) setLetterboxBorder("38");
+ else setLetterboxBorder("31");
+
stop();
+
return 1;
}
+void Video::setLetterboxBorder(char* border)
+{
+ FILE* fdlbox = fopen("/proc/lbox_border", "w");
+ if (!fdlbox) return;
+ fputs(border, fdlbox);
+ fclose(fdlbox);
+}
+
int Video::setTVsize(UCHAR ttvsize)
{
tvsize = ttvsize;
// Set this again to the same as the tv screen size
if (!setAspectRatio(tvsize)) { shutdown(); return 0; }
+ // mode == LETTERBOX is invalid if the TV is widescreen
+ if (tvsize == ASPECT16X9) setMode(NORMAL);
+
return 1;
}
aspectRatio = taspectRatio;
if (ioctl(fdVideo, AV_SET_VID_RATIO, aspectRatio) != 0) return 0;
-// if (!setMode(mode)) return 0;
return 1;
}
{
if (!initted) return 0;
+ if ((tmode == LETTERBOX) && (tvsize == ASPECT16X9)) return 0; // invalid mode
+
if ((tmode != NORMAL) && (tmode != LETTERBOX) && (tmode != UNKNOWN2) && (tmode != QUARTER) && (tmode != EIGHTH)
&& (tmode != ZOOM) && (tmode != UNKNOWN6)) return 0;
mode = tmode;
if (ioctl(fdVideo, AV_SET_VID_MODE, mode) != 0) return 0;
-
-// int a = ioctl(fdVideo, AV_SET_VID_MODE, mode);
-// printf("Mode requested: %i, result: %i\n", mode, a);
-
return 1;
}
-#ifdef DEV
-int Video::test()
-{
- return 0;
-
-// ULLONG stc = 0;
-// return ioctl(fdVideo, AV_SET_VID_STC, &stc);
-/*
- // reset();
- return 1;
-*/
-}
-
-int Video::test2()
-{
- return 0;
-}
-#endif
-
int Video::signalOff()
{
if (ioctl(fdVideo, AV_SET_VID_DENC, 0) != 0) return 0;
{
if (!initted) return 0;
+// vid_pos_regs_t pos_d;
+// pos_d.x = x;
+// pos_d.y = y;
+
vid_pos_regs_t pos_d;
- pos_d.x = x;
- pos_d.y = y;
+ memset(&pos_d, 0, sizeof(pos_d));
+
+ pos_d.dest.y = y;
+ pos_d.dest.x = x;
/*
typedef struct {
int w;
return screenHeight;
}
-/*
UCHAR Video::getTVsize()
{
- return ;
+ return tvsize;
}
+
+#ifdef DEV
+int Video::test()
+{
+ return 0;
+
+// ULLONG stc = 0;
+// return ioctl(fdVideo, AV_SET_VID_STC, &stc);
+/*
+ // reset();
+ return 1;
*/
+}
+
+int Video::test2()
+{
+ return 0;
+}
+#endif
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
+#include <string.h>
#include "defines.h"
#include "stb.h"
Actual Source Aspect Aspect IOCTL Mode IOCTL MODE A MODE B
4:3 4:3 NORMAL fullframe43 fullframe43
- 4:3 16:9 NORMAL fullframe43 fullframe43
+ 4:3 16:9 NORMAL fullframe43 fullframe43 -- invalid?
4:3 4:3 LETTERBOX fullframe43 fullframe43
- 4:3 16:9 LETTERBOX fullframe43 fullframe43
+ 4:3 16:9 LETTERBOX fullframe43 fullframe43 -- invalid?
16:9 4:3 NORMAL chop sides fullframe169
16:9 16:9 NORMAL chop sides fullframe169
16:9 4:3 LETTERBOX letterbox letterbox
1. There are two chip modes - accessible by reopening the fd
2. The video chip knows the aspect ratio purely from the incoming MPEG
+ 3. MODE A is for 4:3 TVs, MODE B is for 16:9 TVs
To switch to MODE A, set the aspect ioctl to 4:3 and reopen the FD.
To switch to MODE B, set the aspect ioctl to 16:9 and reopen the FD.
int setFormat(UCHAR format);
int setConnection(UCHAR connection);
int setAspectRatio(UCHAR aspectRatio); // This one does the pin 8 scart widescreen switching
-// UCHAR getAspectRatio();
- int setTVsize(UCHAR size);
- int setDefaultAspect();
int setMode(UCHAR mode);
+ int setTVsize(UCHAR size); // Is the TV a widescreen?
+ int setDefaultAspect();
int setSource();
int setPosition(int x, int y);
int sync();
int blank();
int signalOn();
int signalOff();
+ int attachFrameBuffer(); // What does this do?
#ifdef DEV
int test();
int test2();
#endif
- int attachFrameBuffer(); // What does this do?
int getFD();
UCHAR getFormat();
UINT getScreenWidth();
UINT getScreenHeight();
+ UCHAR getTVsize();
private:
int checkSCART();
+ void setLetterboxBorder(char* border);
static Video* instance;
int initted;
optionBox[3].setSurface(surface);
optionBox[3].setSurfaceOffset(330, 135);
optionBox[3].setDimensions(150, fontHeight);
- optionBox[3].addOption("On");
- optionBox[3].addOption("Off");
- optionBox[3].addOption("Last state");
+ optionBox[3].addOption("Chop sides");
+ optionBox[3].addOption("Letterbox");
optionBox[4].setSurface(surface);
optionBox[4].setSurfaceOffset(330, 165);
optionBox[4].setDimensions(150, fontHeight);
- optionBox[4].addOption("All");
- optionBox[4].addOption("FTA only");
+ optionBox[4].addOption("On");
+ optionBox[4].addOption("Off");
+ optionBox[4].addOption("Last state");
+
+ optionBox[5].setSurface(surface);
+ optionBox[5].setSurfaceOffset(330, 195);
+ optionBox[5].setDimensions(150, fontHeight);
+ optionBox[5].addOption("All");
+ optionBox[5].addOption("FTA only");
char* config;
vdr = VDR::getInstance();
config = vdr->configLoad("General", "Remote type");
- if (!config)
- {
+ if (!config || strcasecmp(config, "New"))
optionBox[0].setSelected("Old");
- }
- else if (!strcasecmp(config, "New"))
- {
- optionBox[0].setSelected("New");
- }
else
- {
- optionBox[0].setSelected("Old");
- }
-
+ optionBox[0].setSelected("New");
+ if (config) delete[] config;
config = vdr->configLoad("TV", "S-Video");
- if (!config)
- {
+ if (!config || strcasecmp(config, "Yes"))
optionBox[1].setSelected("RGB+composite");
- }
- else if (!strcasecmp(config, "Yes"))
- {
- optionBox[1].setSelected("S-Video");
- }
else
- {
- optionBox[1].setSelected("RGB+composite");
- }
+ optionBox[1].setSelected("S-Video");
+ if (config) delete[] config;
config = vdr->configLoad("TV", "Aspect");
- if (!config)
- {
+ if (!config || strcasecmp(config, "16:9"))
optionBox[2].setSelected("4:3");
- }
- else if (!strcasecmp(config, "16:9"))
- {
+ else
optionBox[2].setSelected("16:9");
- }
+ if (config) delete[] config;
+
+ config = vdr->configLoad("TV", "Widemode");
+ if (!config || strcasecmp(config, "Letterbox"))
+ optionBox[3].setSelected("Chop sides");
else
- {
- optionBox[2].setSelected("4:3");
- }
+ optionBox[3].setSelected("Letterbox");
+ if (config) delete[] config;
config = vdr->configLoad("General", "Power After Boot");
if (!config)
- {
- optionBox[3].setSelected("On");
- }
- else if (!strcasecmp(config, "On")) // just for completeness
- {
- optionBox[3].setSelected("On");
- }
+ optionBox[4].setSelected("On");
else if (!strcasecmp(config, "Off"))
- {
- optionBox[3].setSelected("Off");
- }
+ optionBox[4].setSelected("Off");
else if (!strcasecmp(config, "Last state"))
- {
- optionBox[3].setSelected("Last state");
- }
+ optionBox[4].setSelected("Last state");
else
- {
- optionBox[3].setSelected("On");
- }
+ optionBox[4].setSelected("On");
+ if (config) delete[] config;
config = vdr->configLoad("General", "Channels");
- if (!config)
- {
- optionBox[4].setSelected("All");
- }
- else if (!strcasecmp(config, "FTA only"))
- {
- optionBox[4].setSelected("FTA only");
- }
+ if (!config || strcasecmp(config, "FTA only"))
+ optionBox[5].setSelected("All");
else
- {
- optionBox[4].setSelected("All");
- }
+ optionBox[5].setSelected("FTA only");
+ if (config) delete[] config;
selectedOption = 0;
optionBox[0].setActive(1);
drawText("Remote control type", 10, 45, Colour::LIGHTTEXT);
drawText("TV connection type", 10, 75, Colour::LIGHTTEXT);
drawText("TV aspect ratio", 10, 105, Colour::LIGHTTEXT);
- drawText("Power state after bootup", 10, 135, Colour::LIGHTTEXT);
- drawText("Display channels", 10, 165, Colour::LIGHTTEXT);
+ drawText("16:9 on 4:3 display mode", 10, 135, Colour::LIGHTTEXT);
+ drawText("Power state after bootup", 10, 165, Colour::LIGHTTEXT);
+ drawText("Display channels", 10, 195, Colour::LIGHTTEXT);
drawText("Press back to exit, <, > or [ok] to change", 10, 220, Colour::LIGHTTEXT);
char* aspect = optionBox[2].getSelected();
vdr->configSave("TV", "Aspect", aspect);
- char* powerState = optionBox[3].getSelected();
+ char* widemode = optionBox[3].getSelected();
+ vdr->configSave("TV", "Widemode", widemode);
+
+ char* powerState = optionBox[4].getSelected();
vdr->configSave("General", "Power After Boot", powerState);
- char* channels = optionBox[4].getSelected();
+ char* channels = optionBox[5].getSelected();
vdr->configSave("General", "Channels", channels);
// Apply changes
if (!strcmp(aspect, "16:9"))
{
- Log::getInstance()->log("Options", Log::DEBUG, "Setting letterbox");
+ Log::getInstance()->log("Options", Log::DEBUG, "Setting widescreen");
video->setTVsize(Video::ASPECT16X9);
}
else
{
- Log::getInstance()->log("Options", Log::DEBUG, "Setting normal");
+ Log::getInstance()->log("Options", Log::DEBUG, "Setting 4:3 screen");
video->setTVsize(Video::ASPECT4X3);
}
+
+ if (!strcmp(widemode, "Letterbox"))
+ {
+ Log::getInstance()->log("Options", Log::DEBUG, "Setting letterbox");
+ video->setMode(Video::LETTERBOX);
+ }
+ else
+ {
+ Log::getInstance()->log("Options", Log::DEBUG, "Setting chop-sides");
+ video->setMode(Video::NORMAL);
+ }
}
private:
void doSave();
- const static UINT numOptions = 5;
+ const static UINT numOptions = 6;
UINT selectedOption;
WOptionBox optionBox[numOptions];
VDR* vdr;
dir = *i;
if (dir->getNumRecordings() == 0)
{
- recDir->dirList.erase(i);
delete dir;
+ recDir->dirList.erase(i);
break;
}
}
saveTop = sl.getTopOption();
Log::getInstance()->log("VRecordingList", Log::DEBUG, "FOUND: %i %s %s", toDelete->index, toDelete->getProgName(), toDelete->fileName);
+ VDR* vdr = VDR::getInstance();
+ vdr->deleteRecording(toDelete->fileName);
+
+ delete toDelete;
+
for(RecordingList::iterator i = recDir->recList.begin(); i != recDir->recList.end(); i++)
{
if (*i == toDelete)
{
recDir->recList.erase(i);
- Log::getInstance()->log("VRecordingList", Log::DEBUG, "Removed from vector: %s %s", toDelete->getProgName(), toDelete->fileName);
break;
}
}
- VDR* vdr = VDR::getInstance();
- vdr->deleteRecording(toDelete->fileName);
-
- delete toDelete;
-
sl.clear();
setDir(recDir);
sl.hintSetCurrent(saveIndex);