From a3f7550b3103ebb67b06c99f2c360fb9cdc37a78 Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Tue, 6 Sep 2005 20:42:14 +0000 Subject: [PATCH] DEV var in Makefile Widescreen ability FTA channels only patch from davep --- Makefile | 21 +++++---- audio.cc | 2 + audio.h | 2 + command.cc | 50 ++++++++++++++++++++-- player.h | 6 ++- playerradio.cc | 2 +- playervideo.cc | 2 + playervideo.h | 6 ++- vconnect.cc | 4 +- video.cc | 4 +- video.h | 7 ++- voptions.cc | 113 +++++++++++++++++++++++++++++++++++-------------- voptions.h | 2 +- vvideorec.cc | 2 + 14 files changed, 168 insertions(+), 55 deletions(-) diff --git a/Makefile b/Makefile index 7751a58..49e0e22 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,8 @@ STRIP = /opt/crosstool/powerpc-405-linux-gnu/gcc-2.95.3-glibc-2.2.5/bin/powerpc- CXX = $(CC) INCLUDES = -I../jpeg-6b -CXXFLAGS = -g -O0 -Wall -Woverloaded-virtual -Werror -D_GNU_SOURCE $(INCLUDES) +CXXFLAGS_DEV = -g -O0 -Wall -Woverloaded-virtual -Werror -DDEV -D_GNU_SOURCE $(INCLUDES) +CXXFLAGS_REL = -O3 -Wall -Woverloaded-virtual -Werror -D_GNU_SOURCE $(INCLUDES) LDFLAGS = -Wall -static LIBPATHS = @@ -21,15 +22,11 @@ OBJECTS = main.o command.o log.o remote.o led.o mtd.o video.o audio.o tcp.o dire .PHONY: clean fresh all install strip -default: vompclient -fresh: clean all -all: vompclient - -clean: - rm -f *.o deps vompclient *~ fonts/*.o fonts/*~ +default: dev +fresh: clean default vompclient: $(OBJECTS) - $(CC) $(LDFLAGS) $(LIBPATHS) -o vompclient $(OBJECTS) $(CROSSLIBS) $(LIBS) + $(CC) $(LDFLAGS) $(LIBPATHS) $(RELEASE) -o vompclient $(OBJECTS) $(CROSSLIBS) $(LIBS) strip: $(STRIP) vompclient @@ -38,10 +35,16 @@ install: rm -f /diskless/nfs/mvp/vompclient cp vompclient /diskless/nfs/mvp -release: CXXFLAGS := -O3 $(CXXFLAGS) +dev: CXXFLAGS := $(CXXFLAGS_DEV) +dev: vompclient + +release: CXXFLAGS := $(CXXFLAGS_REL) release: clean vompclient strip deps: Makefile $(CC) -MM $(INCLUDES) $(OBJECTS:%.o=%.cc) > deps -include deps + +clean: + rm -f *.o deps vompclient *~ fonts/*.o fonts/*~ diff --git a/audio.cc b/audio.cc index 174c577..25a270f 100644 --- a/audio.cc +++ b/audio.cc @@ -209,6 +209,7 @@ int Audio::setVolume(int volume) return 1; } +#ifdef DEV int Audio::test() { // ULLONG stc = 0; @@ -227,6 +228,7 @@ int Audio::test() } +#endif int Audio::volumeUp() { diff --git a/audio.h b/audio.h index 190513e..5b2877b 100644 --- a/audio.h +++ b/audio.h @@ -62,7 +62,9 @@ class Audio int toggleUserMute(); int systemMuteOn(); int systemMuteOff(); +#ifdef DEV int test(); +#endif int write(char *buf, int len); diff --git a/command.cc b/command.cc index 136b04f..4a6a6fb 100644 --- a/command.cc +++ b/command.cc @@ -195,11 +195,13 @@ void Command::handleCommand(int button) doStandby(); return; } +#ifdef DEV case Remote::RECORD: { Osd::getInstance()->screenShot("/out.jpg"); return; } +#endif } } @@ -241,10 +243,25 @@ void Command::doReboot() void Command::doJustConnected(VConnect* vconnect) { - VDR* vdr = VDR::getInstance(); + Video* video = Video::getInstance(); ViewMan* viewman = ViewMan::getInstance(); viewman->removeView(vconnect, 0, 1); + VInfo* vi = new VInfo(); + vi->setDimensions(400, 200); + if (video->getFormat() == Video::PAL) + vi->setScreenPos(170, 200); + else + vi->setScreenPos(160, 150); + + vi->setMainText("\n Connected, loading config"); + vi->draw(); + vi->show(); + viewman->add(vi); + + + VDR* vdr = VDR::getInstance(); + // Power off if first boot and config says so if (firstBoot) { @@ -310,12 +327,12 @@ void Command::doJustConnected(VConnect* vconnect) if (!strcasecmp(svideo, "Yes")) { logger->log("Command", Log::INFO, "Switching to S-Video as S-Video=%s", svideo); - Video::getInstance()->setConnection(Video::SVIDEO); + video->setConnection(Video::SVIDEO); } else { logger->log("Command", Log::INFO, "Leaving video output as S-Video=%s", svideo); - Video::getInstance()->setConnection(Video::COMPOSITERGB); + video->setConnection(Video::COMPOSITERGB); } } else @@ -350,8 +367,35 @@ void Command::doJustConnected(VConnect* vconnect) vdr->configSave("General", "Last Power State", "On"); + // Get TV aspect ratio + + char* aspect = vdr->configLoad("TV", "Aspect"); + + if (aspect) + { + if (!strcasecmp(aspect, "16:9")) + { + logger->log("Command", Log::INFO, "Switching to TV aspect 16:9"); + video->setAspectRatio(Video::ASPECT16X9); + } + else + { + logger->log("Command", Log::INFO, "Switching to TV aspect 4:3"); + video->setAspectRatio(Video::ASPECT4X3); + } + } + else + { + logger->log("Command", Log::INFO, "Config TV/Aspect type not found, going 4:3"); + video->setAspectRatio(Video::ASPECT4X3); + } + + video->reinit(); + // config done + viewman->removeView(vi); + VWelcome* vw = new VWelcome(); viewman->add(vw); viewman->redrawAll(); diff --git a/player.h b/player.h index 87711ce..2a8ac2d 100644 --- a/player.h +++ b/player.h @@ -42,10 +42,12 @@ class Player : public Thread, public Callback virtual void jumpToPercent(int percent)=0; virtual void skipForward(int seconds)=0; virtual void skipBackward(int seconds)=0; - virtual void test()=0; - virtual void test2()=0; virtual void setPosition(ULLONG position)=0; virtual void setLength(ULLONG length)=0; +#ifdef DEV + virtual void test()=0; + virtual void test2()=0; +#endif virtual void call()=0; // for callback interface virtual void threadMethod()=0; // for thread interface diff --git a/playerradio.cc b/playerradio.cc index 666872a..db0918e 100644 --- a/playerradio.cc +++ b/playerradio.cc @@ -130,7 +130,7 @@ int PlayerRadio::play() // ------------------------ This one doesn't work, but it should, and would allow for prebuffering. */ - audio->test(); +// audio->test(); threadStart(); sleep(6); diff --git a/playervideo.cc b/playervideo.cc index 78620ae..49a8276 100644 --- a/playervideo.cc +++ b/playervideo.cc @@ -251,6 +251,7 @@ void PlayerVideo::togglePause() } } +#ifdef DEV void PlayerVideo::test() { Log::getInstance()->log("Player", Log::DEBUG, "PLAYER TEST"); @@ -279,6 +280,7 @@ void PlayerVideo::test2() // video->test2(); } +#endif void PlayerVideo::setPosition(ULLONG position) { diff --git a/playervideo.h b/playervideo.h index 96ad61c..4b777e1 100644 --- a/playervideo.h +++ b/playervideo.h @@ -53,11 +53,13 @@ class PlayerVideo : public Player void jumpToPercent(int percent); void skipForward(int seconds); void skipBackward(int seconds); - void test(); - void test2(); void call(); // for callback interface void setPosition(ULLONG position); void setLength(ULLONG length); +#ifdef DEV + void test(); + void test2(); +#endif void threadMethod(); void threadPostStopCleanup(); diff --git a/vconnect.cc b/vconnect.cc index e8eaeff..75a5292 100644 --- a/vconnect.cc +++ b/vconnect.cc @@ -115,9 +115,9 @@ void VConnect::threadMethod() if (success) { - setMainText("\n Connected"); + // setMainText("\n Connected"); ts.tv_sec = 0; - ts.tv_nsec = 500000000; + ts.tv_nsec = 000000000; } else { diff --git a/video.cc b/video.cc index bd31e90..576c554 100644 --- a/video.cc +++ b/video.cc @@ -162,6 +162,7 @@ int Video::setMode(UCHAR tmode) return 1; } +#ifdef DEV int Video::test() { return 0; @@ -178,8 +179,7 @@ int Video::test2() { return 0; } - - +#endif int Video::signalOff() { diff --git a/video.h b/video.h index f5d822b..29aa1a1 100644 --- a/video.h +++ b/video.h @@ -81,8 +81,6 @@ class Video int setConnection(UCHAR connection); int setAspectRatio(UCHAR aspectRatio); int setMode(UCHAR mode); - int test(); - int test2(); int setSource(); int setPosition(int x, int y); int sync(); @@ -97,6 +95,11 @@ class Video int signalOn(); int signalOff(); +#ifdef DEV + int test(); + int test2(); +#endif + int attachFrameBuffer(); // What does this do? int getFD(); diff --git a/voptions.cc b/voptions.cc index 78520c4..c7a6bb3 100644 --- a/voptions.cc +++ b/voptions.cc @@ -22,15 +22,15 @@ VOptions::VOptions() { - setDimensions(460, 190); + setDimensions(500, 250); if (Video::getInstance()->getFormat() == Video::PAL) { - setScreenPos(140, 170); + setScreenPos(120, 140); } else { - setScreenPos(130, 140); + setScreenPos(110, 110); } setBackgroundColour(Colour::VIEWBACKGROUND); @@ -40,22 +40,31 @@ VOptions::VOptions() int fontHeight = surface->getFontHeight(); - optionBox[0].setScreenPos(screenX + 290, screenY + 45); + optionBox[0].setScreenPos(screenX + 330, screenY + 45); optionBox[0].setDimensions(150, fontHeight); optionBox[0].addOption("Old"); optionBox[0].addOption("New"); - optionBox[1].setScreenPos(screenX + 290, screenY + 75); + optionBox[1].setScreenPos(screenX + 330, screenY + 75); optionBox[1].setDimensions(150, fontHeight); optionBox[1].addOption("RGB+composite"); optionBox[1].addOption("S-Video"); - optionBox[2].setScreenPos(screenX + 290, screenY + 105); + optionBox[2].setScreenPos(screenX + 330, screenY + 105); optionBox[2].setDimensions(150, fontHeight); - optionBox[2].addOption("On"); - optionBox[2].addOption("Off"); - optionBox[2].addOption("Last state"); + optionBox[2].addOption("4:3"); + optionBox[2].addOption("16:9"); + optionBox[3].setScreenPos(screenX + 330, screenY + 135); + optionBox[3].setDimensions(150, fontHeight); + optionBox[3].addOption("On"); + optionBox[3].addOption("Off"); + optionBox[3].addOption("Last state"); + + optionBox[4].setScreenPos(screenX + 330, screenY + 165); + optionBox[4].setDimensions(150, fontHeight); + optionBox[4].addOption("All"); + optionBox[4].addOption("FTA only"); char* config; vdr = VDR::getInstance(); @@ -90,29 +99,55 @@ VOptions::VOptions() optionBox[1].setSelected("RGB+composite"); } + config = vdr->configLoad("TV", "Aspect"); + if (!config) + { + optionBox[2].setSelected("4:3"); + } + else if (!strcasecmp(config, "16:9")) + { + optionBox[2].setSelected("16:9"); + } + else + { + optionBox[2].setSelected("4:3"); + } config = vdr->configLoad("General", "Power After Boot"); if (!config) { - optionBox[2].setSelected("On"); + optionBox[3].setSelected("On"); } else if (!strcasecmp(config, "On")) // just for completeness { - optionBox[2].setSelected("On"); + optionBox[3].setSelected("On"); } else if (!strcasecmp(config, "Off")) { - optionBox[2].setSelected("Off"); + optionBox[3].setSelected("Off"); } else if (!strcasecmp(config, "Last state")) { - optionBox[2].setSelected("Last state"); + optionBox[3].setSelected("Last state"); } else { - optionBox[2].setSelected("On"); + optionBox[3].setSelected("On"); } + config = vdr->configLoad("General", "Channels"); + if (!config) + { + optionBox[4].setSelected("All"); + } + else if (!strcasecmp(config, "FTA only")) + { + optionBox[4].setSelected("FTA only"); + } + else + { + optionBox[4].setSelected("All"); + } selectedOption = 0; optionBox[0].setActive(1); @@ -131,9 +166,11 @@ void VOptions::draw() drawText("Remote control type", 10, 45, Colour::LIGHTTEXT); drawText("TV connection type", 10, 75, Colour::LIGHTTEXT); - drawText("Power state after bootup", 10, 105, 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("Press back to exit, <, > or [ok] to change", 10, 160, Colour::LIGHTTEXT); + drawText("Press back to exit, <, > or [ok] to change", 10, 220, Colour::LIGHTTEXT); for (UINT i = 0; i < numOptions; i++) { @@ -143,10 +180,10 @@ void VOptions::draw() ws.nextSymbol = WSymbol::LEFTARROW; ws.nextColour = cl; - ws.setScreenPos(screenX + 272, screenY + 47 + (i * 30)); + ws.setScreenPos(screenX + 312, screenY + 47 + (i * 30)); ws.draw(); ws.nextSymbol = WSymbol::RIGHTARROW; - ws.setScreenPos(screenX + 442, screenY + 47 + (i * 30)); + ws.setScreenPos(screenX + 482, screenY + 47 + (i * 30)); ws.draw(); optionBox[i].draw(); optionBox[i].show(); @@ -220,27 +257,41 @@ void VOptions::doSave() { char* remoteType = optionBox[0].getSelected(); vdr->configSave("General", "Remote type", remoteType); + + char* tvconnection = optionBox[1].getSelected(); + if (!strcmp(tvconnection, "S-Video")) + vdr->configSave("TV", "S-Video", "Yes"); + else + vdr->configSave("TV", "S-Video", "No"); + + char* aspect = optionBox[2].getSelected(); + vdr->configSave("TV", "Aspect", aspect); + + char* powerState = optionBox[3].getSelected(); + vdr->configSave("General", "Power After Boot", powerState); + + char* channels = optionBox[4].getSelected(); + vdr->configSave("General", "Channels", channels); + + // Apply changes + if (!strcmp(remoteType, "New")) - { Remote::getInstance()->setRemoteType(Remote::NEWREMOTE); - } else - { Remote::getInstance()->setRemoteType(Remote::OLDREMOTE); - } - char* tvconnection = optionBox[1].getSelected(); + if (!strcmp(tvconnection, "S-Video")) - { - vdr->configSave("TV", "S-Video", "Yes"); Video::getInstance()->setConnection(Video::SVIDEO); - } else - { - vdr->configSave("TV", "S-Video", "No"); Video::getInstance()->setConnection(Video::COMPOSITERGB); - } - char* powerState = optionBox[2].getSelected(); - vdr->configSave("General", "Power After Boot", powerState); + printf("here\n"); + + if (!strcmp(aspect, "16:9")) + Video::getInstance()->setAspectRatio(Video::ASPECT16X9); + else + Video::getInstance()->setAspectRatio(Video::ASPECT4X3); + + Video::getInstance()->reinit(); } diff --git a/voptions.h b/voptions.h index 2ae5c1f..b0d8a34 100644 --- a/voptions.h +++ b/voptions.h @@ -42,7 +42,7 @@ class VOptions : public View private: void doSave(); - const static UINT numOptions = 3; + const static UINT numOptions = 5; UINT selectedOption; WOptionBox optionBox[numOptions]; VDR* vdr; diff --git a/vvideorec.cc b/vvideorec.cc index 2d3d3f4..cdc7577 100644 --- a/vvideorec.cc +++ b/vvideorec.cc @@ -107,6 +107,7 @@ int VVideoRec::handleCommand(int command) // return 2; // } +#ifdef DEV case Remote::RED: { player->test(); @@ -117,6 +118,7 @@ int VVideoRec::handleCommand(int command) player->test2(); return 2; } +#endif case Remote::ZERO: player->jumpToPercent(0); return 2; case Remote::ONE: player->jumpToPercent(10); return 2; -- 2.39.2