From: Chris Tallon Date: Wed, 20 Jul 2005 00:02:02 +0000 (+0000) Subject: NTSC support, needs testing X-Git-Tag: r0-0-4~2 X-Git-Url: https://git.vomp.tv/gitweb/?a=commitdiff_plain;h=057ab40acd37de4dd92253f4643792fc1d8cad50;p=vompclient.git NTSC support, needs testing --- diff --git a/Makefile b/Makefile index 21f0214..e58d89f 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ CC = /opt/crosstool/powerpc-405-linux-gnu/gcc-2.95.3-glibc-2.2.5/bin/powerpc-405-linux-gnu-g++ STRIP = /opt/crosstool/powerpc-405-linux-gnu/gcc-2.95.3-glibc-2.2.5/bin/powerpc-405-linux-gnu-strip + CXX = $(CC) INCLUDES = -I../jpeg-6b CXXFLAGS = -Wall -Woverloaded-virtual -Werror $(INCLUDES) diff --git a/command.cc b/command.cc index fe7bd6c..7c4285d 100644 --- a/command.cc +++ b/command.cc @@ -78,6 +78,8 @@ void Command::run() mainPid = getpid(); + UCHAR screenSize = Osd::getInstance()->getScreenSize(); + // moved from startup because surface delete doesn't work // just in case @@ -86,7 +88,7 @@ void Command::run() // Blue background View* v = new View(); - v->setDimensions(SCREENHEIGHT, SCREENWIDTH); + v->setDimensions(Osd::getInstance()->getScreenHeight(), Osd::getInstance()->getScreenWidth()); v->setBackgroundColour(Colour::VIDEOBLUE); v->draw(); v->show(); @@ -95,7 +97,16 @@ void Command::run() // Wallpaper VWallpaper* w = new VWallpaper(); - w->init("/wallpaper.jpg"); + if (screenSize == Osd::PAL) + { + Log::getInstance()->log("Command", Log::DEBUG, "PAL wallpaper selected"); + w->init("/wallpaperPAL.jpg"); + } + else + { + Log::getInstance()->log("Command", Log::DEBUG, "NTSC wallpaper selected"); + w->init("/wallpaperNTSC.jpg"); + } w->draw(); w->show(); viewman->add(w); @@ -276,7 +287,14 @@ void Command::broadcastForServers() { VInfo* viewWait = new VInfo(); viewWait->setDimensions(200, 400); - viewWait->setScreenPos(170, 200); + if (Osd::getInstance()->getScreenSize() == Osd::PAL) + { + viewWait->setScreenPos(170, 200); + } + else + { + viewWait->setScreenPos(160, 150); + } viewWait->setMainText("\n Locating server"); viewWait->draw(); viewWait->show(); @@ -301,7 +319,14 @@ int Command::connectToServer(int vectorIndex) VInfo* viewWait = new VInfo(); viewWait->setDimensions(200, 400); - viewWait->setScreenPos(170, 200); + if (Osd::getInstance()->getScreenSize() == Osd::PAL) + { + viewWait->setScreenPos(170, 200); + } + else + { + viewWait->setScreenPos(160, 150); + } viewWait->setMainText("\n Connecting to VDR"); viewWait->draw(); viewWait->show(); diff --git a/command.h b/command.h index c7a0b56..8e907f6 100644 --- a/command.h +++ b/command.h @@ -49,6 +49,7 @@ #include "vwelcome.h" #include "vmute.h" #include "colour.h" +#include "osd.h" class Command : public MessageQueue { diff --git a/defines.h b/defines.h index 9d750fb..0d6f880 100644 --- a/defines.h +++ b/defines.h @@ -31,8 +31,8 @@ typedef unsigned long long ULLONG; //#define SCREENHEIGHT 576 //#define SCREENHEIGHT 480 -extern int SCREENWIDTH; -extern int SCREENHEIGHT; +//extern int SCREENWIDTH; +//extern int SCREENHEIGHT; ULLONG htonll(ULLONG a); ULLONG ntohll(ULLONG a); diff --git a/main.cc b/main.cc index 57625f3..4bd36b6 100644 --- a/main.cc +++ b/main.cc @@ -212,10 +212,13 @@ int main(int argc, char** argv) videoFormat = Video::NTSC; videoConnection = Video::COMPOSITE; logger->log("Core", Log::INFO, "MTD gave us no help. Guessing NTSC."); - } - success = osd->init("/dev/stbgfx", SCREENHEIGHT, SCREENWIDTH, 1); + // temp hack - simulate ntsc on pal +// SCREENHEIGHT = 480; +// videoFormat = Video::NTSC; + + success = osd->init("/dev/stbgfx", SCREENHEIGHT, SCREENWIDTH, videoFormat, 1); if (success) { logger->log("Core", Log::INFO, "OSD module initialised"); diff --git a/osd.cc b/osd.cc index d325301..5040dbf 100644 --- a/osd.cc +++ b/osd.cc @@ -60,7 +60,12 @@ int Osd::getScreenWidth() return width; } -int Osd::init(char* device, int height, int width, int doubleBuffering) +int Osd::getScreenSize() +{ + return screenSize; +} + +int Osd::init(char* device, int height, int width, UCHAR tscreenSize, int doubleBuffering) { if (initted) return 0; @@ -75,6 +80,7 @@ int Osd::init(char* device, int height, int width, int doubleBuffering) this->height = height; this->width = width; + screenSize = tscreenSize; Surface::initConversionTables(); diff --git a/osd.h b/osd.h index 1c11504..04cc8a0 100644 --- a/osd.h +++ b/osd.h @@ -36,15 +36,20 @@ class Osd ~Osd(); static Osd* getInstance(); - int init(char* device, int height, int width, int doubleBuffering); + int init(char* device, int height, int width, UCHAR tscreenSize, int doubleBuffering); int shutdown(); int getFD(); int getScreenHeight(); int getScreenWidth(); + int getScreenSize(); void screenShot(char* fileName); + // Video formats - AV_SET_VID_DISP_FMT // here, video, everywhere! + const static UCHAR NTSC = 0; + const static UCHAR PAL = 1; + private: static Osd* instance; int initted; @@ -55,7 +60,7 @@ class Osd int fdOsd; int width; int height; - + UCHAR screenSize; }; #endif diff --git a/other/wallpaper.jpg b/other/wallpaper.jpg deleted file mode 100644 index ed56138..0000000 Binary files a/other/wallpaper.jpg and /dev/null differ diff --git a/other/wallpaperNTSC.jpg b/other/wallpaperNTSC.jpg new file mode 100644 index 0000000..5df6cbe Binary files /dev/null and b/other/wallpaperNTSC.jpg differ diff --git a/other/wallpaperPAL.jpg b/other/wallpaperPAL.jpg new file mode 100644 index 0000000..ed56138 Binary files /dev/null and b/other/wallpaperPAL.jpg differ diff --git a/tcp.cc b/tcp.cc index ef78c96..0546d6d 100644 --- a/tcp.cc +++ b/tcp.cc @@ -144,12 +144,14 @@ int TCP::isConnected() return connected; } -int TCP::sendPacket(void* buf, size_t count) +int TCP::sendPacket(void* bufR, size_t count) { size_t bytes_sent = 0; int this_write; int temp_write; + unsigned char* buf = (unsigned char*)bufR; + while (bytes_sent < count) { do @@ -164,7 +166,7 @@ int TCP::sendPacket(void* buf, size_t count) return(this_write); } bytes_sent += this_write; - (unsigned char*)buf += this_write; + buf += this_write; } return(count); } diff --git a/vchannellist.cc b/vchannellist.cc index 67291f5..3550e14 100644 --- a/vchannellist.cc +++ b/vchannellist.cc @@ -22,7 +22,15 @@ VChannelList::VChannelList(ULONG type) { - setScreenPos(80, 70); + if (Osd::getInstance()->getScreenSize() == Osd::PAL) + { + setScreenPos(80, 70); + } + else + { + setScreenPos(70, 35); + } + setDimensions(420, 570); setBackgroundColour(Colour::VIEWBACKGROUND); diff --git a/vlivebanner.cc b/vlivebanner.cc index 871001d..b50ca90 100644 --- a/vlivebanner.cc +++ b/vlivebanner.cc @@ -22,7 +22,15 @@ VLiveBanner::VLiveBanner() { - setScreenPos(130, 370); + if (Osd::getInstance()->getScreenSize() == Osd::PAL) + { + setScreenPos(130, 370); + } + else + { + setScreenPos(120, 320); + } + setDimensions(120, 500); setBackgroundColour(Colour::VIEWBACKGROUND); diff --git a/vlivebanner.h b/vlivebanner.h index b0701db..9055589 100644 --- a/vlivebanner.h +++ b/vlivebanner.h @@ -29,6 +29,7 @@ #include "vdr.h" #include "wselectlist.h" #include "colour.h" +#include "osd.h" class VLiveBanner : public View { diff --git a/vmute.cc b/vmute.cc index 3adc881..4233a9e 100644 --- a/vmute.cc +++ b/vmute.cc @@ -24,8 +24,16 @@ VMute::VMute() { isMuted = Audio::getInstance()->toggleUserMute(); + if (Osd::getInstance()->getScreenSize() == Osd::PAL) + { + setScreenPos(600, 500); + } + else + { + setScreenPos(590, 400); + } + setDimensions(40, 40); - setScreenPos(600, 500); setBackgroundColour(Colour::VIEWBACKGROUND); } diff --git a/vmute.h b/vmute.h index 60ef05e..c89d324 100644 --- a/vmute.h +++ b/vmute.h @@ -28,6 +28,7 @@ #include "audio.h" #include "wsymbol.h" #include "colour.h" +#include "osd.h" class VMute : public View { diff --git a/vrecordinglist.cc b/vrecordinglist.cc index 05d82a9..6eb572d 100644 --- a/vrecordinglist.cc +++ b/vrecordinglist.cc @@ -22,7 +22,15 @@ VRecordingList::VRecordingList() { - setScreenPos(80, 70); + if (Osd::getInstance()->getScreenSize() == Osd::PAL) + { + setScreenPos(80, 70); + } + else + { + setScreenPos(70, 35); + } + setDimensions(420, 570); setBackgroundColour(Colour::VIEWBACKGROUND); diff --git a/vrecordingmenu.cc b/vrecordingmenu.cc index 8e1d703..63c402e 100644 --- a/vrecordingmenu.cc +++ b/vrecordingmenu.cc @@ -24,7 +24,15 @@ VRecordingMenu::VRecordingMenu() { rec = NULL; - setScreenPos(260, 190); + if (Osd::getInstance()->getScreenSize() == Osd::PAL) + { + setScreenPos(260, 190); + } + else + { + setScreenPos(250, 160); + } + setDimensions(140, 200); setBackgroundColour(Colour::VIEWBACKGROUND); @@ -109,7 +117,14 @@ int VRecordingMenu::handleCommand(int command) vi->setExitable(); if (summary) vi->setMainText(summary); else vi->setMainText("Summary unavailable"); - vi->setScreenPos(120, 130); + if (Osd::getInstance()->getScreenSize() == Osd::PAL) + { + vi->setScreenPos(120, 130); + } + else + { + vi->setScreenPos(110, 90); + } vi->setDimensions(300, 490); ViewMan::getInstance()->addNoLock(vi); @@ -131,7 +146,14 @@ int VRecordingMenu::handleCommand(int command) v->setTitleText("Delete recording"); v->setMainText("Are you sure you want to delete this recording?"); v->setDefault(VQuestion::NO); - v->setScreenPos(230, 160); + if (Osd::getInstance()->getScreenSize() == Osd::PAL) + { + v->setScreenPos(230, 160); + } + else + { + v->setScreenPos(220, 140); + } v->setDimensions(180, 260); ViewMan::getInstance()->addNoLock(v); diff --git a/vrecordingmenu.h b/vrecordingmenu.h index b21bd5a..816b1da 100644 --- a/vrecordingmenu.h +++ b/vrecordingmenu.h @@ -34,6 +34,7 @@ #include "vinfo.h" #include "vdr.h" #include "colour.h" +#include "osd.h" class VRecordingList; diff --git a/vserverselect.cc b/vserverselect.cc index 0953541..ddc140a 100644 --- a/vserverselect.cc +++ b/vserverselect.cc @@ -28,8 +28,15 @@ VServerSelect::VServerSelect(std::vector* serverIPs, int* tselectServer) // anyway, now it doesn't use a object wide reference. selectServer = tselectServer; + if (Osd::getInstance()->getScreenSize() == Osd::PAL) + { + setScreenPos(220, 200); + } + else + { + setScreenPos(210, 150); + } setDimensions(200, 300); - setScreenPos(220, 200); setBackgroundColour(Colour::VIEWBACKGROUND); setTitleBarOn(1); setTitleBarColour(Colour::TITLEBARBACKGROUND); diff --git a/vserverselect.h b/vserverselect.h index 6655360..423b3bb 100644 --- a/vserverselect.h +++ b/vserverselect.h @@ -30,6 +30,7 @@ #include "remote.h" #include "wselectlist.h" #include "colour.h" +#include "osd.h" class VServerSelect : public View { diff --git a/vvideolive.cc b/vvideolive.cc index 25b672f..431c48d 100644 --- a/vvideolive.cc +++ b/vvideolive.cc @@ -28,7 +28,7 @@ VVideoLive::VVideoLive(List* tchanList) chanList = tchanList; currentChannel = 0; - setDimensions(SCREENHEIGHT, SCREENWIDTH); + setDimensions(Osd::getInstance()->getScreenHeight(), Osd::getInstance()->getScreenWidth()); Colour transparent(0, 0, 0, 0); setBackgroundColour(transparent); } diff --git a/vvideolive.h b/vvideolive.h index 838d805..925650d 100644 --- a/vvideolive.h +++ b/vvideolive.h @@ -32,6 +32,7 @@ #include "viewman.h" #include "vchannelselect.h" #include "colour.h" +#include "osd.h" class VVideoLive : public View { diff --git a/vvideorec.cc b/vvideorec.cc index 793e481..70707e9 100644 --- a/vvideorec.cc +++ b/vvideorec.cc @@ -28,7 +28,7 @@ VVideoRec::VVideoRec(Recording* rec) myRec = rec; - setDimensions(SCREENHEIGHT, SCREENWIDTH); + setDimensions(Osd::getInstance()->getScreenHeight(), Osd::getInstance()->getScreenWidth()); Colour transparent(0, 0, 0, 0); setBackgroundColour(transparent); } diff --git a/vvideorec.h b/vvideorec.h index 872a18e..c1d2632 100644 --- a/vvideorec.h +++ b/vvideorec.h @@ -29,6 +29,7 @@ #include "recording.h" #include "command.h" #include "colour.h" +#include "osd.h" class VVideoRec : public View { diff --git a/vvolume.cc b/vvolume.cc index 348bf27..6408dc5 100644 --- a/vvolume.cc +++ b/vvolume.cc @@ -24,8 +24,16 @@ VVolume::VVolume() { displayVolume = Audio::getInstance()->getVolume(); + if (Osd::getInstance()->getScreenSize() == Osd::PAL) + { + setScreenPos(100, 499); + } + else + { + setScreenPos(90, 400); + } + setDimensions(31, 227); - setScreenPos(100, 499); setBackgroundColour(Colour::VIEWBACKGROUND); } @@ -36,7 +44,7 @@ void VVolume::draw() WSymbol* w = new WSymbol; w->nextSymbol = WSymbol::VOLUME2; - w->setScreenPos(103, 509); + w->setScreenPos(screenX + 3, screenY + 10); w->draw(); int i = 0; @@ -44,14 +52,14 @@ void VVolume::draw() for(; i < displayVolume; i++) { w->nextSymbol = WSymbol::VOLBAR; - w->setScreenPos(140 + (i * 9), 502); + w->setScreenPos(screenX + 40 + (i * 9), screenY + 3); w->draw(); } for(; i < 20; i++) { w->nextSymbol = WSymbol::VOLDOT; - w->setScreenPos(140 + (i * 9), 512); + w->setScreenPos(screenX + 40 + (i * 9), screenY + 13); w->draw(); } diff --git a/vvolume.h b/vvolume.h index 068f483..380dca4 100644 --- a/vvolume.h +++ b/vvolume.h @@ -28,6 +28,7 @@ #include "audio.h" #include "wsymbol.h" #include "colour.h" +#include "osd.h" class VVolume : public View { diff --git a/vwelcome.cc b/vwelcome.cc index 2a950b6..1cd1031 100644 --- a/vwelcome.cc +++ b/vwelcome.cc @@ -23,7 +23,15 @@ VWelcome::VWelcome() { setDimensions(190, 460); - setScreenPos(140, 170); + + if (Osd::getInstance()->getScreenSize() == Osd::PAL) + { + setScreenPos(140, 170); + } + else + { + setScreenPos(130, 140); + } setBackgroundColour(Colour::VIEWBACKGROUND); setTitleBarOn(1); @@ -185,7 +193,14 @@ void VWelcome::doRecordingsList() VInfo* viewWait = new VInfo(); viewWait->setDimensions(190, 460); - viewWait->setScreenPos(140, 170); + if (Osd::getInstance()->getScreenSize() == Osd::PAL) + { + viewWait->setScreenPos(140, 170); + } + else + { + viewWait->setScreenPos(130, 140); + } viewWait->setMainText("\n Downloading recordings list"); viewWait->draw(); viewWait->show(); diff --git a/vwelcome.h b/vwelcome.h index 86ed434..417a169 100644 --- a/vwelcome.h +++ b/vwelcome.h @@ -36,6 +36,7 @@ #include "command.h" #include "message.h" #include "colour.h" +#include "osd.h" class VWelcome : public View {