From 76b656915a8b4474c0f73bffc8e421c287998a34 Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Wed, 29 Jan 2020 15:23:52 +0000 Subject: [PATCH] WIP Code cleaning and reformatting Remove some ancient commented out log lines Implemented more brace-init Remove some old-style casts More GPL headers updated Split Message::parameter union into separate variables Rename parameter.num to parameter, parameter.handle to data Completed MessageQueue call changes --- audioplayer.cc | 6 +- boxstack.cc | 7 +- boxx.cc | 238 ++++++++++++++--------------- boxx.h | 13 +- channel.cc | 17 +-- channel.h | 23 ++- command.cc | 9 +- command.h | 24 +-- defines.h | 40 ++--- directory.cc | 11 +- directory.h | 9 +- dsock.cc | 10 +- dsock.h | 17 +-- message.cc | 11 +- message.h | 26 ++-- osdopenvg.cc | 11 +- osdwinvector.cc | 9 +- player.cc | 168 ++++++++++----------- player.h | 24 +-- playerliveradio.cc | 11 +- playerliveradio.h | 3 +- playerlivetv.cc | 16 +- playerlivetv.h | 3 +- playermedia.cc | 17 +-- playerradio.cc | 7 +- recman.cc | 9 +- recman.h | 13 +- recording.cc | 10 -- recording.h | 18 +-- region.cc | 30 ++-- region.h | 30 +++- teletextdecodervbiebu.cc | 13 +- udp.cc | 20 +-- udp.h | 9 +- vaudioselector.cc | 24 +-- vchannellist.cc | 12 +- vchannelselect.cc | 17 +-- vchannelselect.h | 3 +- vcolourtuner.cc | 4 +- vconnect.cc | 12 +- vconnect.h | 5 +- vdr.cc | 10 +- vdr.h | 17 +-- vepg.cc | 14 +- vepglistadvanced.cc | 25 ++- vepgsettimer.cc | 17 ++- vepgsummary.cc | 14 +- vmedialist.cc | 23 ++- vmediaview.cc | 22 +-- vmute.cc | 4 +- vopts.cc | 8 +- vpicturebanner.cc | 4 +- vquestion.cc | 12 +- vradiorec.cc | 17 ++- vrecmove.cc | 14 +- vrecording.cc | 39 +++-- vrecordinglist.cc | 10 +- vrecordingmenu.cc | 27 ++-- vrecordingmenu.h | 3 +- vserverselect.cc | 10 +- vsleeptimer.cc | 319 +++++++++++++++++++-------------------- vsleeptimer.h | 32 ++-- vtimeredit.cc | 13 +- vtimeredit.h | 3 +- vtimerlist.cc | 8 +- vvideolivetv.cc | 28 ++-- vvideomedia.cc | 26 ++-- vvideorec.cc | 29 ++-- vwelcome.cc | 4 +- winmain.cc | 20 ++- wremoteconfig.cc | 7 +- wwinaudiofilter.cc | 5 +- wwinmp3audiofilter.cc | 5 +- wwinvideofilter.cc | 5 +- wwinvideoh264filter.cc | 5 +- 75 files changed, 835 insertions(+), 923 deletions(-) diff --git a/audioplayer.cc b/audioplayer.cc index c1b2b30..eb48c2c 100644 --- a/audioplayer.cc +++ b/audioplayer.cc @@ -22,7 +22,7 @@ #include "demuxeraudio.h" #include "timers.h" #include "video.h" -#include "command.h" +#include "messagequeue.h" #include "i18n.h" #include "boxx.h" #include "log.h" @@ -295,8 +295,8 @@ void AudioPlayer::sendFrontendMessage(ULONG para) threadUnlock(); m->from = this; m->message = Message::PLAYER_EVENT; - m->parameter.num = para; - Command::getInstance()->postMessageFromOuterSpace(m); + m->parameter = para; + MessageQueue::getInstance()->postMessageFromOuterSpace(m); } //open a new file diff --git a/boxstack.cc b/boxstack.cc index 1776c61..1107f3d 100644 --- a/boxstack.cc +++ b/boxstack.cc @@ -21,6 +21,7 @@ #include "boxstack.h" #include "command.h" +#include "messagequeue.h" #include "remote.h" #include "log.h" @@ -168,7 +169,7 @@ int BoxStack::remove(Boxx* toDelete) Message* m = new Message(); m->to = Command::getInstance(); m->message = Message::LAST_VIEW_CLOSE; - Command::getInstance()->postMessageNoLock(m); + MessageQueue::getInstance()->postMessageNoLock(m); } if (!videoStack.empty() && videoStack.top().first==toDelete) { @@ -589,9 +590,9 @@ void BoxStack::processMessage(Message* m) remove((Boxx*)m->from); break; } - case Message::ADD_VIEW: // currently not used by anything but it might come in useful again + case Message::ADD_VIEW: { - Boxx* toAdd = (Boxx*)m->parameter.num; + Boxx* toAdd = (Boxx*)m->parameter; add(toAdd); toAdd->draw(); update(toAdd); diff --git a/boxx.cc b/boxx.cc index 21bdb9c..08e56d8 100644 --- a/boxx.cc +++ b/boxx.cc @@ -1,5 +1,5 @@ /* - Copyright 2007 Chris Tallon + Copyright 2007-2020 Chris Tallon This file is part of VOMP. @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with VOMP; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + along with VOMP. If not, see . */ #include @@ -27,26 +26,13 @@ #include "boxx.h" #include "surfacevector.h" + char Boxx::numBoxxes = 0; Boxx::Boxx() { - // I want a parent box or a surface. - parent = NULL; - surface = NULL; - - area.x = 0; - area.y = 0; - area.w = 0; - area.h = 0; - vdisplay.mode = None; - paraVSpace = 6; // default gap for drawPara - - backgroundColourSet = false; - visible = true; - numBoxxes++; Log::getInstance()->log("Boxx", Log::DEBUG, "Construct, now %u", numBoxxes); } @@ -57,24 +43,18 @@ Boxx::~Boxx() numBoxxes--; Log::getInstance()->log("Boxx", Log::DEBUG, "Destruct, now %u", numBoxxes); } -#include + void Boxx::draw() { - //Log::getInstance()->log("Boxx", Log::DEBUG, "Draw this %p surface %p", this, surface); if (backgroundColourSet) fillColour(backgroundColour); Boxx* currentBoxx; std::vector::iterator j; - //int count=0; for (j = children.begin(); j != children.end(); j++) { currentBoxx = *j; - //Log::getInstance()->log("Boxx", Log::DEBUG, "Draw child %d %d %s", count,currentBoxx,typeid(*currentBoxx).name()); if (currentBoxx->getVisible()) currentBoxx->draw(); - //Log::getInstance()->log("Boxx", Log::DEBUG, "Draw child %d %d end", count,currentBoxx); - // count++; } - // Log::getInstance()->log("Boxx", Log::DEBUG, "Draw this %p surface %p End", this, surface); } void Boxx::setSize(UINT w, UINT h) @@ -116,16 +96,14 @@ void Boxx::remove(Boxx* oldChild) void Boxx::removeVisibleChilds(Region & r) { - for(std::vector::iterator i = children.begin(); i != children.end(); i++) - { - if ((*i)->getVisible()) - { - Region temp=(*i)->getRegionR(); - if (r.intersects(temp)) { - r=r.subtract(temp); - } - } - } + for(std::vector::iterator i = children.begin(); i != children.end(); i++) + { + if ((*i)->getVisible()) + { + Region temp = (*i)->getRegionR(); + if (r.intersects(temp)) r = r.subtract(temp); + } + } } void Boxx::setParent(Boxx* newParent) @@ -141,12 +119,12 @@ void Boxx::setBackgroundColour(const DrawStyle& Tcolour) void Boxx::setVideoBackground() { - vdisplay.mode=Window; - vdisplay.fallbackMode=Fullscreen; - vdisplay.x=getScreenX(); - vdisplay.y=getScreenY(); - vdisplay.width=getWidth(); - vdisplay.height=getHeight(); + vdisplay.mode = Window; + vdisplay.fallbackMode = Fullscreen; + vdisplay.x = getScreenX(); + vdisplay.y = getScreenY(); + vdisplay.width = getWidth(); + vdisplay.height = getHeight(); } void Boxx::setVisible(bool isVisible) @@ -182,7 +160,6 @@ void Boxx::blt(Region& r) r.y -= area.y; surface->updateToScreen(r.x, r.y, r.w, r.h, area.x + r.x, area.y + r.y); - } int Boxx::getScreenX() @@ -264,14 +241,14 @@ void Boxx::getRootBoxRegion(Region* r) bool Boxx::getVideoDisplay(VideoDisplay &vd) { - for(std::vector::iterator i = children.begin(); i != children.end(); i++) - { - if ((*i)->getVideoDisplay(vd)) return true; - } + for(std::vector::iterator i = children.begin(); i != children.end(); i++) + { + if ((*i)->getVideoDisplay(vd)) return true; + } - if (vdisplay.mode==None) return false; - vd=vdisplay; - return true; + if (vdisplay.mode == None) return false; + vd = vdisplay; + return true; } // Level 1 drawing functions @@ -281,7 +258,7 @@ void Boxx::fillColour(const DrawStyle& colour) rectangle(0, 0, area.w, area.h, colour); } -int Boxx::drawPara(const char* text, int x, int y, const DrawStyle& colour,unsigned int skiplines) +int Boxx::drawPara(const char* text, int x, int y, const DrawStyle& colour, unsigned int skiplines) { char line[256]; int lineHeight = getFontHeight() + paraVSpace; @@ -306,18 +283,17 @@ int Boxx::drawPara(const char* text, int x, int y, const DrawStyle& colour,unsig ypos = y; Region tester; - bool haschildren = true; - if ( children.size() == 0) haschildren = false; - bool mchar=false; - Osd *osd=Osd::getInstance(); - if (osd->charSet()!=1) mchar=true; - OsdVector *osdv=dynamic_cast(osd); - float *charwidtharray=NULL; - if (osdv) charwidtharray=osdv->getCharWidthArray(); + if (children.size() == 0) haschildren = false; + bool mchar = false; + Osd *osd = Osd::getInstance(); + if (osd->charSet() != 1) mchar = true; + OsdVector *osdv = dynamic_cast(osd); + float *charwidtharray = NULL; + if (osdv) charwidtharray = osdv->getCharWidthArray(); mbstate_t state; - memset((void*)&state,0,sizeof(state)); + memset((void*)&state, 0, sizeof(state)); while(1) { @@ -337,14 +313,19 @@ int Boxx::drawPara(const char* text, int x, int y, const DrawStyle& colour,unsig int cur_length = 1; wchar_t cur_char; if (*(text + textPos) == '\0') break; - if (mchar) { - cur_length = mbrtowc(&cur_char, text + textPos, textLength-textPos, &state); - if (cur_length <= 0){ - cur_char='?'; - cur_length=1; - } - } else cur_char= *(text + textPos); - + if (mchar) + { + cur_length = mbrtowc(&cur_char, text + textPos, textLength-textPos, &state); + if (cur_length <= 0) + { + cur_char = '?'; + cur_length = 1; + } + } + else + { + cur_char = *(text + textPos); + } if (cur_char == '\0') break; @@ -354,13 +335,16 @@ int Boxx::drawPara(const char* text, int x, int y, const DrawStyle& colour,unsig printLine = 1; break; } - if (charwidtharray) { - thisCharWidth=charwidtharray[cur_char & 0xFF]; - if (cur_char && 0xFFFFFF00) thisCharWidth=osdv->getCharWidth(cur_char); - } else thisCharWidth = charWidth(cur_char); - - + if (charwidtharray) + { + thisCharWidth = charwidtharray[cur_char & 0xFF]; + if (cur_char && 0xFFFFFF00) thisCharWidth = osdv->getCharWidth(cur_char); + } + else + { + thisCharWidth = charWidth(cur_char); + } if ((lineWidth + thisCharWidth + x) > tester.w) @@ -378,13 +362,19 @@ int Boxx::drawPara(const char* text, int x, int y, const DrawStyle& colour,unsig while ((cur_char != ' ') && (linePos >= 0)) { textPos -= cur_length; - if (mchar) { - cur_length = mbrtowc(&cur_char, text + textPos, textLength-textPos, &state); - if (cur_length <= 0){ - cur_char='?'; - cur_length=1; - } - } else cur_char= *(text + textPos); + if (mchar) + { + cur_length = mbrtowc(&cur_char, text + textPos, textLength-textPos, &state); + if (cur_length <= 0) + { + cur_char='?'; + cur_length=1; + } + } + else + { + cur_char = *(text + textPos); + } linePos--; } // Now take the space we just found @@ -397,19 +387,23 @@ int Boxx::drawPara(const char* text, int x, int y, const DrawStyle& colour,unsig textPos += cur_length; } -// line[linePos++] = '\0'; +// line[linePos++] = '\0'; if (linePos >= 0) line[linePos++] = '\0'; //Here is the change if (printLine || (linePos > 1)) // if some text was put in line { - if (ypos <= (int)(area.h - lineHeight + paraVSpace)) { - if (drawLinePos >= 0) { - drawText(line, x, ypos, colour); - ypos += lineHeight; - } - } else { - leftlines++; - } + if (ypos <= (int)(area.h - lineHeight + paraVSpace)) + { + if (drawLinePos >= 0) + { + drawText(line, x, ypos, colour); + ypos += lineHeight; + } + } + else + { + leftlines++; + } drawLinePos++; } else @@ -489,9 +483,8 @@ void Boxx::drawPixel(UINT x, UINT y, const Colour& colour, bool fastdraw) void Boxx::drawTTChar(int ox, int oy,int x, int y, cTeletextChar c) { - if (parent) parent->drawTTChar(area.x + ox, area.y + oy, x,y,c); - else if (surface) surface->drawTTChar(ox, oy,x,y,c); - + if (parent) parent->drawTTChar(area.x + ox, area.y + oy, x,y,c); + else if (surface) surface->drawTTChar(ox, oy,x,y,c); } void Boxx::drawBitmap(UINT x, UINT y, const Bitmap& bm, const DisplayRegion & region) @@ -514,23 +507,23 @@ void Boxx::drawMonoBitmap(UCHAR*base, int dx, int dy, unsigned int height,unsign void Boxx::drawTVMedia(TVMediaInfo & tvmedia,float x, float y, float width, float height, Corner corner) { - if (parent) parent->drawTVMedia(tvmedia,area.x + x,area.y + y,width, height, corner); - else if (surface) { - SurfaceVector * surfacevector=dynamic_cast(surface); - if (surfacevector) surfacevector->drawTVMedia(tvmedia,x, y,width, height, corner); - else surface->fillblt((int)x, (int)y, (int)width, (int)height, DrawStyle::RED); // Signal that something went wrong - } - + if (parent) parent->drawTVMedia(tvmedia,area.x + x,area.y + y,width, height, corner); + else if (surface) + { + SurfaceVector* surfacevector = dynamic_cast(surface); + if (surfacevector) surfacevector->drawTVMedia(tvmedia, x, y, width, height, corner); + else surface->fillblt((int)x, (int)y, (int)width, (int)height, DrawStyle::RED); // Signal that something went wrong + } } void Boxx::drawClippingRectangle(float x, float y, float w, float h) { - if (parent) parent->drawClippingRectangle(area.x + x, area.y + y, w, h); - else if (surface) { - SurfaceVector * surfacevector=dynamic_cast(surface); - if (surfacevector) surfacevector->drawClippingRectangle(x, y, w, h); - - } + if (parent) parent->drawClippingRectangle(area.x + x, area.y + y, w, h); + else if (surface) + { + SurfaceVector* surfacevector = dynamic_cast(surface); + if (surfacevector) surfacevector->drawClippingRectangle(x, y, w, h); + } } int Boxx::getFontHeight() @@ -571,7 +564,6 @@ float Boxx::charWidth(wchar_t c) else return 16.; //? } - Surface* Boxx::getSurface() { if (parent) return parent->getSurface(); @@ -580,26 +572,26 @@ Surface* Boxx::getSurface() bool Boxx::mouseMove(int x, int y) { - if ((x >= (int)area.x) && (x<(int)area.x2()) - && (y >= (int)area.y) && (y < (int)area.y2())) - { - return true; - } - else - { - return false; - } + if ((x >= (int)area.x) && (x<(int)area.x2()) + && (y >= (int)area.y) && (y < (int)area.y2())) + { + return true; + } + else + { + return false; + } } bool Boxx::mouseLBDOWN(int x, int y) { - if ((x >= (int)area.x) && (x<(int)area.x2()) - && (y >= (int)area.y) && (y < (int)area.y2())) - { - return true; - } - else - { - return false; - } + if ((x >= (int)area.x) && (x<(int)area.x2()) + && (y >= (int)area.y) && (y < (int)area.y2())) + { + return true; + } + else + { + return false; + } } diff --git a/boxx.h b/boxx.h index 6041513..3c88049 100644 --- a/boxx.h +++ b/boxx.h @@ -140,7 +140,11 @@ class Boxx protected: //get the surface this box is drawing to Surface *getSurface(); - Boxx* parent; + + // I want a parent box or a surface. + Boxx* parent{}; + Surface* surface{}; + Region area; std::vector children; VideoDisplay vdisplay; @@ -150,14 +154,13 @@ class Boxx void removeVisibleChilds(Region & r); static const int paraMargin = 10; - UINT paraVSpace; + UINT paraVSpace{6}; // default gap for drawPara DrawStyle backgroundColour; - bool backgroundColourSet; - bool visible; + bool backgroundColourSet{}; + bool visible{true}; static char numBoxxes; - Surface* surface; }; #endif diff --git a/channel.cc b/channel.cc index 0754581..8cd2f90 100644 --- a/channel.cc +++ b/channel.cc @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with VOMP; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + along with VOMP. If not, see . */ #include "channel.h" @@ -26,26 +25,12 @@ Channel::Channel() { - number = 0; - type = 0; - name = NULL; - - index = -1; - vpid = 0; - tpid = 0; - numAPids = 0; - numDPids = 0; - numSPids = 0; - - vstreamtype=2; //Mpeg2 - } Channel::~Channel() { if (name) delete[] name; index = -1; // just in case - } void Channel::loadPids() diff --git a/channel.h b/channel.h index c6587fd..d6d3326 100644 --- a/channel.h +++ b/channel.h @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with VOMP; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + along with VOMP. If not, see . */ #ifndef CHANNEL_H @@ -47,21 +46,21 @@ class Channel void loadPids(); - ULONG number; - ULONG type; - UCHAR vstreamtype; - char* name; + int index{-1}; + ULONG number{}; + ULONG type{}; + UCHAR vstreamtype{2}; //Mpeg2 + char* name{}; - int index; - ULONG vpid; - ULONG numAPids; + ULONG vpid{}; + ULONG numAPids{}; APidList apids; - ULONG numDPids; + ULONG numDPids{}; APidList dpids; - ULONG numSPids; + ULONG numSPids{}; APidList spids; - ULONG tpid; + ULONG tpid{}; }; #endif diff --git a/command.cc b/command.cc index 34b95c1..7252599 100644 --- a/command.cc +++ b/command.cc @@ -302,7 +302,6 @@ void Command::postMessage(Message* m) // remote->getButtonPress to break // locking the mutex ensures that the master thread is waiting on getButtonPress - #ifndef WIN32 pthread_mutex_lock(&masterLock); #else @@ -457,7 +456,7 @@ void Command::processMessage(Message* m) } case Message::UDP_BUTTON: { - handleCommand(m->parameter.num); + handleCommand(m->parameter); break; } case Message::CHANGE_LANGUAGE: @@ -492,14 +491,14 @@ void Command::processMessage(Message* m) { //Log::getInstance()->log("Command", Log::DEBUG, "TVMedia NEW_PICTURE"); OsdVector* osdv = dynamic_cast(Osd::getInstance()); - if (osdv) osdv->informPicture(m->tag, m->parameter.handle); + if (osdv) osdv->informPicture(m->tag, reinterpret_cast(m->data)); break; } case Message::NEW_PICTURE_STATIC: { - //Log::getInstance()->log("Command", Log::DEBUG, "TVMedia NEW_PICTURE %x %x",m->tag,m->parameter.num); + //Log::getInstance()->log("Command", Log::DEBUG, "TVMedia NEW_PICTURE %x %x",m->tag,m->parameter); OsdVector* osdv = dynamic_cast(Osd::getInstance()); - if (osdv) osdv->informPicture(((unsigned long long)m->tag)<<32LL,m->parameter.handle); + if (osdv) osdv->informPicture(static_cast(m->tag) << 32LL, reinterpret_cast(m->data)); break; } } diff --git a/command.h b/command.h index 49bf40d..0d5dafb 100644 --- a/command.h +++ b/command.h @@ -49,10 +49,11 @@ class Log; class VInfo; class WJpeg; -struct ASLPref { - std::string langcode; - int audiopref; - int subtitlepref; +struct ASLPref +{ + std::string langcode; + int audiopref; + int subtitlepref; }; typedef std::vector ASLPrefList; @@ -78,9 +79,9 @@ class Command : public MessageQueue void setAdvMenus(bool adv) { advMenus = adv; }; bool isAdvMenus() { return advMenus; }; int getLangPref(bool subtitle,const char* langcode); - void setSubDefault(int subon) {subdefault=subon;}; - int getSubDefault() { return subdefault;}; - ASLPrefList &getASLList(){return langcodes;}; + void setSubDefault(int subon) { subdefault = subon; }; + int getSubDefault() { return subdefault; }; + ASLPrefList &getASLList() { return langcodes; }; private: void stop(); @@ -103,15 +104,16 @@ class Command : public MessageQueue HANDLE masterLock; HANDLE mainPid; //Window #endif + + Log* logger; + BoxStack* boxstack; + Remote* remote; + bool initted{}; bool irun{}; bool isStandby{}; bool firstBoot{true}; int signals{}; - - Log* logger; - BoxStack* boxstack; - Remote* remote; Boxx* wallpaper{}; WJpeg* wallpaper_pict{}; VInfo* connLost{}; diff --git a/defines.h b/defines.h index 16f14d4..a7b158e 100644 --- a/defines.h +++ b/defines.h @@ -107,31 +107,31 @@ int getClockRealTime(struct timespec *tp); // add here defines for plattform specific objects #ifdef VOMP_PLATFORM_RASPBERRY - #define Remote_TYPE RemoteLinux // Generic Remote under Linux (Konsole!, not X) will support in the end: - #define RemoteStartDev ""//No devices passed + #define Remote_TYPE RemoteLinux // Generic Remote under Linux (Konsole!, not X) will support in the end: + #define RemoteStartDev ""//No devices passed // Keyboard // remotes under /dev/event // HDMI CEC //lirc? - #define Led_TYPE LedRaspberry //this is device dependent - #define Osd_TYPE OsdOpenVG // This OpenGL ES 2.0, in the moment only for raspberry, but might be splitted for other devices - #define Audio_TYPE AudioOMX // This is Audio based on OpenMax and libav for decoding - #define Video_TYPE VideoOMX // This is Video based on OpenMax - - - - #define VPE_OMX_SUPPORT // Activate support for hardware codec using openmax il - #define VPE_OMX_H264_DECODER "OMX.broadcom.video_decode" - #define VPE_OMX_MPEG2_DECODER "OMX.broadcom.video_decode" - #define VPE_OMX_VIDEO_SCHED "OMX.broadcom.video_scheduler" - #define VPE_OMX_VIDEO_REND "OMX.broadcom.video_render" - #define VPE_OMX_VIDEO_DEINTERLACE "OMX.broadcom.image_fx" - #define VPE_OMX_CLOCK "OMX.broadcom.clock" - #define VPE_OMX_AUDIO_DECODER "OMX.broadcom.audio_decode" - #define VPE_OMX_AUDIO_REND "OMX.broadcom.audio_render" - #define VPE_OMX_IMAGE_DECODER "OMX.broadcom.image_decode" - #define VPE_OMX_EGL_REND "OMX.broadcom.egl_render" + #define Led_TYPE LedRaspberry //this is device dependent + #define Osd_TYPE OsdOpenVG // This OpenGL ES 2.0, in the moment only for raspberry, but might be splitted for other devices + #define Audio_TYPE AudioOMX // This is Audio based on OpenMax and libav for decoding + #define Video_TYPE VideoOMX // This is Video based on OpenMax + + + + #define VPE_OMX_SUPPORT // Activate support for hardware codec using openmax il + #define VPE_OMX_H264_DECODER "OMX.broadcom.video_decode" + #define VPE_OMX_MPEG2_DECODER "OMX.broadcom.video_decode" + #define VPE_OMX_VIDEO_SCHED "OMX.broadcom.video_scheduler" + #define VPE_OMX_VIDEO_REND "OMX.broadcom.video_render" + #define VPE_OMX_VIDEO_DEINTERLACE "OMX.broadcom.image_fx" + #define VPE_OMX_CLOCK "OMX.broadcom.clock" + #define VPE_OMX_AUDIO_DECODER "OMX.broadcom.audio_decode" + #define VPE_OMX_AUDIO_REND "OMX.broadcom.audio_render" + #define VPE_OMX_IMAGE_DECODER "OMX.broadcom.image_decode" + #define VPE_OMX_EGL_REND "OMX.broadcom.egl_render" //#define VPE_LIBAV_SUPPORT // #define VPE_LIBAV_MPEG2_TRANSCODING diff --git a/directory.cc b/directory.cc index 3c7eec3..9540b3e 100644 --- a/directory.cc +++ b/directory.cc @@ -1,5 +1,5 @@ /* - Copyright 2004-2005 Chris Tallon + Copyright 2004-2020 Chris Tallon This file is part of VOMP. @@ -14,27 +14,22 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with VOMP; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + along with VOMP. If not, see . */ #include "directory.h" Directory::Directory(const char* newName) { - index = -1; - name = new char[strlen(newName) + 1]; strcpy(name, newName); - - parent = NULL; } Directory::~Directory() { if (name) delete[] name; name = NULL; - index = -1; // just in case + index = -1; // just in case // FIXME remove this UINT i; for (i = 0; i < dirList.size(); i++) diff --git a/directory.h b/directory.h index b08018d..d4e62e1 100644 --- a/directory.h +++ b/directory.h @@ -1,5 +1,5 @@ /* - Copyright 2004-2005 Chris Tallon + Copyright 2004-2020 Chris Tallon This file is part of VOMP. @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with VOMP; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + along with VOMP. If not, see . */ #ifndef DIRECTORY_H @@ -46,9 +45,9 @@ class Directory char* name; - int index; + int index{-1}; - Directory* parent; + Directory* parent{}; DirectoryList dirList; RecordingList recList; diff --git a/dsock.cc b/dsock.cc index 3ad854e..ec793b5 100644 --- a/dsock.cc +++ b/dsock.cc @@ -131,14 +131,14 @@ unsigned char DatagramSocket::waitforMessage(unsigned char how) */ } -int DatagramSocket::getDataLength(void) const +UINT DatagramSocket::getDataLength(void) const { - return mlength; + return static_cast(mlength); } -char *DatagramSocket::getData(void) { return buf; } -char *DatagramSocket::getFromIPA(void) { return fromIPA; } -short DatagramSocket::getFromPort(void) const { return fromPort; } +const void* DatagramSocket::getData() const { return buf; } +const char* DatagramSocket::getFromIPA() const { return fromIPA; } +short DatagramSocket::getFromPort() const { return fromPort; } void DatagramSocket::send(const char *ipa, short port, char *message, int length) { diff --git a/dsock.h b/dsock.h index 6723260..1493889 100644 --- a/dsock.h +++ b/dsock.h @@ -1,5 +1,5 @@ /* - Copyright 2004-2005 Chris Tallon + Copyright 2004-2020 Chris Tallon This file is part of VOMP. @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with VOMP; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + along with VOMP. If not, see . */ #ifndef DSOCK_H @@ -52,12 +51,12 @@ class DatagramSocket int init(); void shutdown(); unsigned char waitforMessage(unsigned char); // int =0-block =1-new wait =2-continue wait - int getDataLength(void) const; - char *getData(void); // returns a pointer to the data - char *getFromIPA(void); // returns a pointer to from IP address - short getFromPort(void) const; - void send(const char *, short, char *, int); // send wants: IP Address ddn style, port, - // data, length of data + UINT getDataLength() const; + const void* getData() const; // returns a pointer to the data + const char* getFromIPA() const; // returns a pointer to from IP address + short getFromPort() const; + void send(const char *, short, char *, int); // send wants: IP Address ddn style, port, data, length of data + private: bool initted; ULONG getIPNumber(ULONG num); diff --git a/message.cc b/message.cc index 94c65f1..95f359a 100644 --- a/message.cc +++ b/message.cc @@ -1,5 +1,5 @@ /* - Copyright 2004-2005 Chris Tallon + Copyright 2004-2020 Chris Tallon This file is part of VOMP. @@ -14,18 +14,11 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with VOMP; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + along with VOMP. If not, see . */ #include "message.h" Message::Message() { - from = NULL; - to = NULL; - message = 0; - parameter.num = 0; - parameter.handle = 0; - tag = 0; } diff --git a/message.h b/message.h index ed903e5..d3d3b17 100644 --- a/message.h +++ b/message.h @@ -1,5 +1,5 @@ /* - Copyright 2004-2019 Chris Tallon + Copyright 2004-2020 Chris Tallon This file is part of VOMP. @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with VOMP; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + along with VOMP. If not, see . */ #ifndef MESSAGE_H @@ -23,7 +22,7 @@ #include -class Message; +//class Message; #include "defines.h" // Usage of messages is more dubious now that the single master mutex lock @@ -39,14 +38,12 @@ class Message public: Message(); - void* from; - void* to; - ULONG message; - union { - ULONG num; - VectorHandle handle; - } parameter; - ULONG tag; // use this for identifying which object / question is being replied to + void* from{}; + void* to{}; + ULONG message{}; + ULONG parameter{}; + ULONG tag{}; // use this for identifying which object / question is being replied to + void* data{}; // Use this for anything. Int, pointer, pointer to memory to be freed by the recipient, etc. const static ULONG QUESTION_YES = 1; const static ULONG CLOSE_ME = 2; @@ -61,7 +58,6 @@ class Message const static ULONG ADD_VIEW = 12; const static ULONG REDRAW_LANG = 14; const static ULONG EPG = 16; - //const static ULONG EPG_CLOSE = 17; // Not needed anymore const static ULONG CHANGED_OPTIONS = 18; const static ULONG CONNECTION_LOST = 19; const static ULONG MOVE_RECORDING = 20; @@ -86,3 +82,7 @@ class Message }; #endif + +// FIXME idea - instead of always having to specify a real pointer in the "to" variable (meaning clients may have to +// run Command::getInstance() for e.g.), how about having some constant values for well known targets. Then +// clients may not need the #include "command.h" diff --git a/osdopenvg.cc b/osdopenvg.cc index e511ebf..c1682a2 100644 --- a/osdopenvg.cc +++ b/osdopenvg.cc @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with VOMP; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + along with VOMP. If not, see . */ @@ -1230,7 +1229,7 @@ unsigned int OsdOpenVG::handleTask(OpenVGCommand& command) // We have a pictures! send a message to ourself, to switch to gui thread m->from=this; m->to=Command::getInstance(); - m->parameter.handle = handle; + m->data = reinterpret_cast(handle); if (!static_image) { m->message=Message::NEW_PICTURE; m->tag = info->lindex; @@ -1238,7 +1237,7 @@ unsigned int OsdOpenVG::handleTask(OpenVGCommand& command) m->message=Message::NEW_PICTURE_STATIC; m->tag = info->lindex>> 32LL; } - Command::getInstance()->postMessageFromOuterSpace(m); // inform command about new picture + MessageQueue::getInstance()->postMessageFromOuterSpace(m); // inform command about new picture delete info; @@ -1269,7 +1268,7 @@ unsigned int OsdOpenVG::handleTask(OpenVGCommand& command) Message* m = new Message(); m->from=this; m->to=Command::getInstance(); - m->parameter.handle = info->handle; + m->data = reinterpret_cast(info->handle); if (!static_image) { m->message=Message::NEW_PICTURE; m->tag = info->lindex; @@ -1277,7 +1276,7 @@ unsigned int OsdOpenVG::handleTask(OpenVGCommand& command) m->message=Message::NEW_PICTURE_STATIC; m->tag = info->lindex>> 32LL; } - Command::getInstance()->postMessageFromOuterSpace(m); // inform command about new picture + MessageQueue::getInstance()->postMessageFromOuterSpace(m); // inform command about new picture delete info; } break; diff --git a/osdwinvector.cc b/osdwinvector.cc index 75ae7dd..cc3bb09 100644 --- a/osdwinvector.cc +++ b/osdwinvector.cc @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with VOMP; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + along with VOMP. If not, see . */ @@ -25,7 +24,7 @@ #include "message.h" -#include "command.h" +#include "messagequeue.h" #include "teletxt/txtfont.h" @@ -1241,7 +1240,7 @@ void OsdWinVector::createPicture(struct PictureInfo& pict_inf) // We have a pictures! send a message to ourself, to switch to gui thread m->from = this; m->to = Command::getInstance(); - m->parameter.handle = pict_inf.reference; + m->data = pict_inf.reference; if (!static_image) { m->message = Message::NEW_PICTURE; m->tag = pict_inf.lindex; @@ -1250,7 +1249,7 @@ void OsdWinVector::createPicture(struct PictureInfo& pict_inf) m->message = Message::NEW_PICTURE_STATIC; m->tag = pict_inf.lindex >> 32LL; } - Command::getInstance()->postMessageFromOuterSpace(m); // inform command about new picture + MessageQueue::getInstance()->postMessageFromOuterSpace(m); // inform command about new picture } else { pict_inf.decoder->freeReference(pict_inf.reference); diff --git a/player.cc b/player.cc index f0fc4eb..e8a1323 100644 --- a/player.cc +++ b/player.cc @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with VOMP; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + along with VOMP. If not, see . */ #include "player.h" @@ -46,21 +45,7 @@ Player::Player(MessageQueue* tmessageQueue, void* tmessageReceiver, OSDReceiver* video = Video::getInstance(); logger = Log::getInstance(); vdr = VDR::getInstance(); - initted = false; - lengthBytes = 0; - lengthFrames = 0; - currentFrameNumber = 0; - state = S_STOP; - ifactor = 4; - is_pesrecording=true; - - subtitlesShowing = false; - videoStartup = false; - threadBuffer = NULL; - - blockSize = 100000; - startupBlockSize = 250000; video->turnVideoOn(); } @@ -69,7 +54,7 @@ Player::~Player() if (initted) shutdown(); } -int Player::init(bool p_isPesRecording,double framespersecond) +int Player::init(bool p_isPesRecording, double framespersecond) { if (initted) return 0; #ifndef WIN32 @@ -78,7 +63,7 @@ int Player::init(bool p_isPesRecording,double framespersecond) mutex=CreateMutex(NULL,FALSE,NULL); #endif is_pesrecording = p_isPesRecording; - fps=framespersecond; + fps = framespersecond; if (is_pesrecording) demuxer = new DemuxerVDR(); else @@ -90,14 +75,15 @@ int Player::init(bool p_isPesRecording,double framespersecond) teletext = new TeletextDecoderVBIEBU(); if (!teletext) return 0; teletext->setRecordigMode(true); - unsigned int demux_video_size=2097152; - unsigned int demux_audio_size=524288; - if (video->supportsh264()) { - demux_video_size*=5*2;//5; - + unsigned int demux_video_size = 2097152; + unsigned int demux_audio_size = 524288; + if (video->supportsh264()) + { + demux_video_size *= 5 * 2; } - if (audio->maysupportAc3()) { - //demux_audio_size*=2; + if (audio->maysupportAc3()) + { + //demux_audio_size*=2; } if (!demuxer->init(this, audio, video,teletext, demux_video_size,demux_audio_size,65536, framespersecond, subtitles)) @@ -115,11 +101,10 @@ int Player::init(bool p_isPesRecording,double framespersecond) video->blank(); audio->stop(); - if (Command::getInstance()->getSubDefault()) { - turnSubtitlesOn(true); - } else { - turnSubtitlesOn(false); - } + if (Command::getInstance()->getSubDefault()) + turnSubtitlesOn(true); + else + turnSubtitlesOn(false); initted = true; return 1; @@ -147,20 +132,19 @@ int Player::shutdown() void Player::setStartFrame(ULONG startFrame) { - ULONG nextiframeNumber; - ULONG iframeLength; - ULONG iframeNumber; - ULLONG filePos; - - // newFrame could be anywhere, go forwards to next I-Frame - if (!vdr->getNextIFrame(startFrame, 1, &filePos, &nextiframeNumber, &iframeLength)) return; + ULONG nextiframeNumber; + ULONG iframeLength; + ULONG iframeNumber; + ULLONG filePos; - // Now step back a GOP. This ensures we go to the greatest I-Frame equal to or less than the requested frame - vdr->getNextIFrame(nextiframeNumber, 0, &filePos, &iframeNumber, &iframeLength); + // newFrame could be anywhere, go forwards to next I-Frame + if (!vdr->getNextIFrame(startFrame, 1, &filePos, &nextiframeNumber, &iframeLength)) return; - logger->log("Player", Log::DEBUG, "setStartFrame %lu %lu %lu", startFrame, nextiframeNumber,iframeNumber); - currentFrameNumber = iframeNumber; + // Now step back a GOP. This ensures we go to the greatest I-Frame equal to or less than the requested frame + vdr->getNextIFrame(nextiframeNumber, 0, &filePos, &iframeNumber, &iframeLength); + logger->log("Player", Log::DEBUG, "setStartFrame %lu %lu %lu", startFrame, nextiframeNumber,iframeNumber); + currentFrameNumber = iframeNumber; } void Player::setLengthBytes(ULLONG length) @@ -214,45 +198,45 @@ bool* Player::getDemuxerSubtitleChannels() int Player::getCurrentAudioChannel() { - if (is_pesrecording) { - return demuxer->getselAudioChannel(); - } else { - return ((DemuxerTS*)demuxer)->getAID(); - } + if (is_pesrecording) + return demuxer->getselAudioChannel(); + else + return dynamic_cast(demuxer)->getAID(); } int Player::getCurrentSubtitleChannel() { - if (is_pesrecording) { - return demuxer->getselSubtitleChannel(); - } else { - return ((DemuxerTS*)demuxer)->getSubID(); - } + if (is_pesrecording) + return demuxer->getselSubtitleChannel(); + else + return dynamic_cast(demuxer)->getSubID(); } void Player::setSubtitleChannel(int newChannel) { - if (is_pesrecording) { - demuxer->setDVBSubtitleStream(newChannel); - } else { - ((DemuxerTS*)demuxer)->setSubID(newChannel); - } + if (is_pesrecording) + demuxer->setDVBSubtitleStream(newChannel); + else + dynamic_cast(demuxer)->setSubID(newChannel); } int *Player::getTeletxtSubtitlePages() { - return teletext->getSubtitlePages(); + return teletext->getSubtitlePages(); } void Player::setAudioChannel(int newChannel, int type, int streamtype) { - if (is_pesrecording) { - demuxer->setAudioStream(newChannel); - return; - } else { - ((DemuxerTS*)demuxer)->setAID(newChannel,type,streamtype,false); - return; - } + if (is_pesrecording) + { + demuxer->setAudioStream(newChannel); + return; + } + else + { + dynamic_cast(demuxer)->setAID(newChannel,type,streamtype,false); + return; + } } bool Player::toggleSubtitles() @@ -270,7 +254,8 @@ bool Player::toggleSubtitles() return subtitlesShowing; } -void Player::turnSubtitlesOn(bool ison) { +void Player::turnSubtitlesOn(bool ison) +{ if (ison) { subtitlesShowing = true; @@ -281,18 +266,20 @@ void Player::turnSubtitlesOn(bool ison) { subtitlesShowing = false; subtitles->hide(); } - } -void Player::tellSubtitlesOSDVisible(bool visible){ -subtitles->setOSDMenuVisibility(visible); +void Player::tellSubtitlesOSDVisible(bool visible) +{ + subtitles->setOSDMenuVisibility(visible); } -Channel * Player::getDemuxerChannel() { - if (!is_pesrecording) { - return ((DemuxerTS*) demuxer)->getChannelInfo(); - } - return NULL; //Should not happen! +Channel * Player::getDemuxerChannel() +{ + if (!is_pesrecording) + { + return dynamic_cast(demuxer)->getChannelInfo(); + } + return NULL; //Should not happen! } @@ -316,20 +303,19 @@ void Player::playpause() lock(); bool doUnlock = false; - if (state==S_PLAY) { - doUnlock=true; - switchState(S_PAUSE_P); - } else { - if (state == S_PAUSE_P) doUnlock = true; - switchState(S_PLAY); + if (state==S_PLAY) + { + doUnlock=true; + switchState(S_PAUSE_P); + } + else + { + if (state == S_PAUSE_P) doUnlock = true; + switchState(S_PLAY); } if (doUnlock) unLock(); - } - - - void Player::stop() { if (!initted) return; @@ -413,7 +399,7 @@ void Player::jumpToPercent(double percent) { lock(); logger->log("Player", Log::DEBUG, "JUMP TO %f%%", percent); - ULONG newFrame = (ULONG)(percent * lengthFrames / 100); + ULONG newFrame = static_cast(percent * lengthFrames / 100); switchState(S_JUMP, newFrame); // unLock(); - let thread unlock this } @@ -440,7 +426,7 @@ void Player::skipForward(int seconds) logger->log("Player", Log::DEBUG, "SKIP FORWARD %i SECONDS", seconds); ULONG newFrame = getCurrentFrameNum(); if (newFrame == 0) { unLock(); return; } // Current pos from demuxer is not valid - newFrame +=(ULONG) (((double)seconds) * fps); + newFrame += static_cast(static_cast(seconds) * fps); if (newFrame > lengthFrames) { switchState(S_PLAY); unLock(); } else switchState(S_JUMP, newFrame); // unLock(); - let thread unlock this @@ -452,7 +438,7 @@ void Player::skipBackward(int seconds) logger->log("Player", Log::DEBUG, "SKIP BACKWARD %i SECONDS", seconds); long newFrame = getCurrentFrameNum(); if (newFrame == 0) { unLock(); return; } // Current pos from demuxer is not valid - newFrame -= (ULONG) (((double)seconds) * fps); + newFrame -= static_cast(static_cast(seconds) * fps); if (newFrame < 0) newFrame = 0; switchState(S_JUMP, newFrame); // unLock(); - let thread unlock this @@ -988,7 +974,7 @@ void Player::doConnectionLost() m->to = messageReceiver; m->from = this; m->message = Message::PLAYER_EVENT; - m->parameter.num = Player::CONNECTION_LOST; + m->parameter = Player::CONNECTION_LOST; messageQueue->postMessage(m); } @@ -1017,7 +1003,7 @@ void Player::call(void* caller) m->from = this; m->to = messageReceiver; m->message = Message::PLAYER_EVENT; - m->parameter.num = Player::ASPECT43; + m->parameter = Player::ASPECT43; messageQueue->postMessageFromOuterSpace(m); } else if (dxCurrentAspect == Demuxer::ASPECT_16_9) @@ -1029,7 +1015,7 @@ void Player::call(void* caller) m->from = this; m->to = messageReceiver; m->message = Message::PLAYER_EVENT; - m->parameter.num = Player::ASPECT169; + m->parameter = Player::ASPECT169; messageQueue->postMessageFromOuterSpace(m); } else @@ -1075,7 +1061,7 @@ void Player::threadMethod() m->to = messageReceiver; m->from = this; m->message = Message::PLAYER_EVENT; - m->parameter.num = STOP_PLAYBACK; + m->parameter = STOP_PLAYBACK; logger->log("Player", Log::DEBUG, "Posting message to %p...", messageQueue); messageQueue->postMessage(m); logger->log("Player", Log::DEBUG, "Message posted..."); @@ -1212,7 +1198,7 @@ void Player::threadFeedPlay() m->to = messageReceiver; m->from = this; m->message = Message::PLAYER_EVENT; - m->parameter.num = Player::STOP_PLAYBACK; + m->parameter = Player::STOP_PLAYBACK; logger->log("Player", Log::DEBUG, "Posting message to %p...", messageQueue); messageQueue->postMessage(m); } diff --git a/player.h b/player.h index a798750..3ac56cc 100644 --- a/player.h +++ b/player.h @@ -134,7 +134,7 @@ class Player : public Thread_TYPE, public Callback void restartAtFrame(ULONG newFrame); void restartAtFramePI(ULONG newFrame); - bool subtitlesShowing; + bool subtitlesShowing{}; MessageQueue* messageQueue; void* messageReceiver; OSDReceiver* osdReceiver; @@ -151,11 +151,11 @@ class Player : public Thread_TYPE, public Callback - bool initted; + bool initted{}; bool startup; - bool videoStartup; + bool videoStartup{}; - bool is_pesrecording; + bool is_pesrecording{true}; double fps; #ifndef WIN32 @@ -166,14 +166,14 @@ class Player : public Thread_TYPE, public Callback void lock(); void unLock(); - ULLONG lengthBytes; - ULONG lengthFrames; - ULONG currentFrameNumber; - UINT blockSize; - UINT startupBlockSize; - UCHAR* threadBuffer; - UCHAR state; - UCHAR ifactor; + ULLONG lengthBytes{}; + ULONG lengthFrames{}; + ULONG currentFrameNumber{}; + UINT blockSize{100000}; + UINT startupBlockSize{250000}; + UCHAR* threadBuffer{}; + UCHAR state{S_STOP}; + UCHAR ifactor{4}; }; #endif diff --git a/playerliveradio.cc b/playerliveradio.cc index 233c55c..077d27c 100644 --- a/playerliveradio.cc +++ b/playerliveradio.cc @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with VOMP; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + along with VOMP. If not, see . */ #include "playerliveradio.h" @@ -175,7 +174,7 @@ void PlayerLiveRadio::streamReceive(ULONG flag, void* data, ULONG len) m->from = this; m->to = messageReceiver; m->message = Message::PLAYER_EVENT; - m->parameter.num = PlayerLiveRadio::STREAM_END; + m->parameter = PlayerLiveRadio::STREAM_END; messageQueue->postMessageFromOuterSpace(m); } @@ -348,7 +347,7 @@ bool PlayerLiveRadio::checkError() m->from = this; m->to = messageReceiver; m->message = Message::PLAYER_EVENT; - m->parameter.num = PlayerLiveRadio::CONNECTION_LOST; + m->parameter = PlayerLiveRadio::CONNECTION_LOST; messageQueue->postMessageFromOuterSpace(m); return true; @@ -451,7 +450,7 @@ void PlayerLiveRadio::threadMethod() m->from = this; m->to = messageReceiver; m->message = Message::PLAYER_EVENT; - m->parameter.num = PlayerLiveRadio::STREAM_END; + m->parameter = PlayerLiveRadio::STREAM_END; messageQueue->postMessageFromOuterSpace(m); } } @@ -483,7 +482,7 @@ void PlayerLiveRadio::threadMethod() m->from = this; m->to = messageReceiver; m->message = Message::PLAYER_EVENT; - m->parameter.num = PlayerLiveRadio::PREBUFFERING; + m->parameter = PlayerLiveRadio::PREBUFFERING; m->tag = percentDone; messageQueue->postMessageFromOuterSpace(m); diff --git a/playerliveradio.h b/playerliveradio.h index c5cd47d..f0e36f8 100644 --- a/playerliveradio.h +++ b/playerliveradio.h @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with VOMP; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + along with VOMP. If not, see . */ #ifndef PLAYERLIVERADIO_H diff --git a/playerlivetv.cc b/playerlivetv.cc index 7d0c708..7a79996 100644 --- a/playerlivetv.cc +++ b/playerlivetv.cc @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with VOMP; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + along with VOMP. If not, see . */ #include "playerlivetv.h" @@ -32,6 +31,7 @@ #include "channel.h" #include "dvbsubtitles.h" #include "osdreceiver.h" +#include "command.h" // ----------------------------------- Called from outside, one offs or info funcs @@ -250,7 +250,7 @@ void PlayerLiveTV::call(void* caller) m->from = this; m->to = messageReceiver; m->message = Message::PLAYER_EVENT; - m->parameter.num = PlayerLiveTV::ASPECT43; + m->parameter = PlayerLiveTV::ASPECT43; messageQueue->postMessageFromOuterSpace(m); } else if (dxCurrentAspect == Demuxer::ASPECT_16_9) @@ -269,7 +269,7 @@ void PlayerLiveTV::call(void* caller) m->from = this; m->to = messageReceiver; m->message = Message::PLAYER_EVENT; - m->parameter.num = PlayerLiveTV::ASPECT169; + m->parameter = PlayerLiveTV::ASPECT169; messageQueue->postMessageFromOuterSpace(m); } else @@ -308,7 +308,7 @@ void PlayerLiveTV::streamReceive(ULONG flag, void* data, ULONG len) m->from = this; m->to = messageReceiver; m->message = Message::PLAYER_EVENT; - m->parameter.num = PlayerLiveTV::STREAM_END; + m->parameter = PlayerLiveTV::STREAM_END; messageQueue->postMessageFromOuterSpace(m); } @@ -652,7 +652,7 @@ bool PlayerLiveTV::checkError() m->from = this; m->to = messageReceiver; m->message = Message::PLAYER_EVENT; - m->parameter.num = PlayerLiveTV::CONNECTION_LOST; + m->parameter = PlayerLiveTV::CONNECTION_LOST; messageQueue->postMessageFromOuterSpace(m); return true; @@ -812,7 +812,7 @@ void PlayerLiveTV::threadMethod() m->from = this; m->to = messageReceiver; m->message = Message::PLAYER_EVENT; - m->parameter.num = PlayerLiveTV::STREAM_END; + m->parameter = PlayerLiveTV::STREAM_END; messageQueue->postMessageFromOuterSpace(m); } } @@ -849,7 +849,7 @@ void PlayerLiveTV::threadMethod() m->from = this; m->to = messageReceiver; m->message = Message::PLAYER_EVENT; - m->parameter.num = PlayerLiveTV::PREBUFFERING; + m->parameter = PlayerLiveTV::PREBUFFERING; m->tag = percentDone; messageQueue->postMessageFromOuterSpace(m); diff --git a/playerlivetv.h b/playerlivetv.h index cff36b5..98e4e34 100644 --- a/playerlivetv.h +++ b/playerlivetv.h @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with VOMP; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + along with VOMP. If not, see . */ #ifndef PLAYERLIVETV_H diff --git a/playermedia.cc b/playermedia.cc index 3919ba8..a3a308a 100644 --- a/playermedia.cc +++ b/playermedia.cc @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with VOMP; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + along with VOMP. If not, see . */ #include "playermedia.h" @@ -23,7 +22,7 @@ #include "demuxermedia.h" #include "timers.h" #include "video.h" -#include "command.h" +#include "messagequeue.h" #include "i18n.h" #include "boxx.h" #include "log.h" @@ -332,8 +331,8 @@ void PlayerMedia::sendFrontendMessage(ULONG para) threadUnlock(); m->from = this; m->message = Message::PLAYER_EVENT; - m->parameter.num = para; - Command::getInstance()->postMessageFromOuterSpace(m); + m->parameter = para; + MessageQueue::getInstance()->postMessageFromOuterSpace(m); } //method called by the playing thread to handle @@ -669,8 +668,8 @@ void PlayerMedia::call(void* caller) m->from = this; m->to = frontend; m->message = Message::PLAYER_EVENT; - m->parameter.num = PlayerMedia::ASPECT43; - Command::getInstance()->postMessageFromOuterSpace(m); + m->parameter = PlayerMedia::ASPECT43; + MessageQueue::getInstance()->postMessageFromOuterSpace(m); } else if (dxCurrentAspect == Demuxer::ASPECT_16_9) { @@ -681,8 +680,8 @@ void PlayerMedia::call(void* caller) m->from = this; m->to = frontend; m->message = Message::PLAYER_EVENT; - m->parameter.num = PlayerMedia::ASPECT169; - Command::getInstance()->postMessageFromOuterSpace(m); + m->parameter = PlayerMedia::ASPECT169; + MessageQueue::getInstance()->postMessageFromOuterSpace(m); } else { diff --git a/playerradio.cc b/playerradio.cc index cb7e8d7..b5f8417 100644 --- a/playerradio.cc +++ b/playerradio.cc @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with VOMP; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + along with VOMP. If not, see . */ #include "playerradio.h" @@ -457,7 +456,7 @@ void PlayerRadio::doConnectionLost() m->to = messageReceiver; m->from = this; m->message = Message::PLAYER_EVENT; - m->parameter.num = PlayerRadio::CONNECTION_LOST; + m->parameter = PlayerRadio::CONNECTION_LOST; messageQueue->postMessage(m); } @@ -578,7 +577,7 @@ void PlayerRadio::threadFeedPlay() m->to = messageReceiver; m->from = this; m->message = Message::PLAYER_EVENT; - m->parameter.num = PlayerRadio::STOP_PLAYBACK; + m->parameter = PlayerRadio::STOP_PLAYBACK; logger->log("PlayerRadio", Log::DEBUG, "Posting message to %p...", messageQueue); messageQueue->postMessage(m); } diff --git a/recman.cc b/recman.cc index 2bc05a4..7b8f1d2 100644 --- a/recman.cc +++ b/recman.cc @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with VOMP; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + along with VOMP. If not, see . */ #include "recman.h" @@ -25,14 +24,8 @@ RecMan::RecMan() { - totalSpace = 0; - freeSpace = 0; - usedPercent = 0; - rootDir = new Directory("/"); currentDir = rootDir; - - chronoSortOrder = false; } RecMan::~RecMan() diff --git a/recman.h b/recman.h index 537075b..a8e657c 100644 --- a/recman.h +++ b/recman.h @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with VOMP; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + along with VOMP. If not, see . */ #ifndef RECMAN_H @@ -65,16 +64,16 @@ class RecMan ULONG getUsedPercent(); private: - ULONG totalSpace; - ULONG freeSpace; - ULONG usedPercent; + ULONG totalSpace{}; + ULONG freeSpace{}; + ULONG usedPercent{}; Directory* rootDir; Directory* currentDir; - bool chronoSortOrder; + bool chronoSortOrder{}; - void constructPath(char* target, Directory* dir) ; + void constructPath(char* target, Directory* dir); }; #endif diff --git a/recording.cc b/recording.cc index c1bcff9..908f4ee 100644 --- a/recording.cc +++ b/recording.cc @@ -38,16 +38,6 @@ Recording::Recording() { logger = Log::getInstance(); vdr = VDR::getInstance(); - - isNew = false; - start = 0; - progName = NULL; - fileName = NULL; - index = -1; - markList = NULL; - movieID = 0; - seriesID = 0; - episodeID = 0; } Recording::~Recording() diff --git a/recording.h b/recording.h index 50ff7f2..020ec74 100644 --- a/recording.h +++ b/recording.h @@ -43,7 +43,7 @@ class Recording char* getProgName() const; char* getFileName() const; - int index; + int index{-1}; // FIXME make private? void loadRecInfo(); void dropRecInfo(); @@ -59,9 +59,9 @@ class Recording bool hasMarks(); MarkList* getMarkList(); - int movieID; - int seriesID; - int episodeID; + int movieID{}; + int seriesID{}; + int episodeID{}; static RecInfo* recInfo; static MovieInfo* movieInfo; @@ -71,10 +71,10 @@ class Recording Log* logger; VDR* vdr; - bool isNew; - ULONG start; - char* progName; - char* fileName; + bool isNew{}; + ULONG start{}; + char* progName{}; + char* fileName{}; // I only want 1 RecInfo loaded at a time // if (recInfoFor == this) then recInfo is valid @@ -82,7 +82,7 @@ class Recording static Recording* recInfoFor; - MarkList* markList; + MarkList* markList{}; }; #endif diff --git a/region.cc b/region.cc index b556277..dde0f54 100644 --- a/region.cc +++ b/region.cc @@ -1,13 +1,23 @@ -#include "region.h" +/* + Copyright 2020 Chris Tallon -Region::Region() -{ - x = 0; - y = 0; - w = 0; - h = 0; - z = 0; -} + This file is part of VOMP. + + VOMP is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + VOMP is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with VOMP. If not, see . +*/ + +#include "region.h" bool Region::overlappedBy(Region& d) { @@ -39,8 +49,6 @@ Region Region::operator + (Region& other) return toReturn; } - - Region Region::subtract(Region& other) { diff --git a/region.h b/region.h index 2b191b1..ee66709 100644 --- a/region.h +++ b/region.h @@ -1,3 +1,22 @@ +/* + Copyright 2020 Chris Tallon + + This file is part of VOMP. + + VOMP is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + VOMP is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with VOMP. If not, see . +*/ + #ifndef REGION_H #define REGION_H @@ -7,7 +26,6 @@ class Region { public: - Region(); bool overlappedBy(Region& doesthisOverlap); Region subtract(Region& other); Region operator + (Region& other); @@ -19,11 +37,11 @@ class Region UINT x2(); UINT y2(); - UINT x; - UINT y; - UINT w; - UINT h; - int z; + UINT x{}; + UINT y{}; + UINT w{}; + UINT h{}; + int z{}; }; #endif diff --git a/teletextdecodervbiebu.cc b/teletextdecodervbiebu.cc index d52d3df..4a4a2e2 100644 --- a/teletextdecodervbiebu.cc +++ b/teletextdecodervbiebu.cc @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with VOMP; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + along with VOMP. If not, see . */ @@ -38,7 +37,7 @@ #include "teletextdecodervbiebu.h" #include "teletxt/tables.h" #include "message.h" -#include "command.h" +#include "messagequeue.h" #include "video.h" #ifdef WIN32 @@ -824,15 +823,15 @@ void TeletextDecoderVBIEBU::RenderTeletextCode(bool renderfirstlineonly) { m->message = Message::TELETEXTUPDATE; m->to = txtview; m->from = this; - m->parameter.num = 0; - Command::getInstance()->postMessageFromOuterSpace(m); + m->parameter = 0; + MessageQueue::getInstance()->postMessageFromOuterSpace(m); } else if (firstlineupdate==10) { Message* m= new Message(); m->message = Message::TELETEXTUPDATEFIRSTLINE; m->to = txtview; m->from = this; - m->parameter.num = 0; - Command::getInstance()->postMessageFromOuterSpace(m); + m->parameter = 0; + MessageQueue::getInstance()->postMessageFromOuterSpace(m); firstlineupdate=0; } else firstlineupdate++; diff --git a/udp.cc b/udp.cc index 3486346..70b1364 100644 --- a/udp.cc +++ b/udp.cc @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with VOMP; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + along with VOMP. If not, see . */ #include "udp.h" @@ -24,6 +23,7 @@ #include "messagequeue.h" #include "message.h" #include "log.h" +#include "command.h" //void dump(unsigned char* data, USHORT size); //unsigned char dcc(UCHAR c); @@ -50,14 +50,14 @@ int UDP::shutdown() return 1; } -int UDP::run(MessageQueue* tcommandMessageQueue) +int UDP::run(MessageQueue* tMessageQueue) { if (threadIsActive()) return 1; log->log("UDP", Log::DEBUG, "Starting UDP command server"); initted = 1; - commandMessageQueue = tcommandMessageQueue; + messageQueue = tMessageQueue; ds = new DatagramSocket(2000); if (!ds->init()) @@ -99,30 +99,30 @@ void UDP::threadMethod() } else { - processRequest((UCHAR*)ds->getData(), ds->getDataLength()); + processRequest(ds->getData(), ds->getDataLength()); } threadCheckExit(); } } -void UDP::processRequest(UCHAR* data, int length) +void UDP::processRequest(const void* data, UINT length) { log->log("UDP", Log::DEBUG, "Got request"); char* temp = new char[length + 1]; memcpy(temp, data, length); temp[length] = '\0'; - int command = atoi(temp); + UINT command = static_cast(atoi(temp)); delete[] temp; log->log("UDP", Log::DEBUG, "Command %i recieved", command); Message *m = new Message(); - m->to = commandMessageQueue; + m->to = Command::getInstance(); m->message = Message::UDP_BUTTON; - m->parameter.num = command; - commandMessageQueue->postMessage(m); + m->parameter = command; + messageQueue->postMessage(m); } /* diff --git a/udp.h b/udp.h index 36b3043..a14156e 100644 --- a/udp.h +++ b/udp.h @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with VOMP; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + along with VOMP. If not, see . */ #ifndef UDP_H @@ -39,18 +38,18 @@ class UDP : public Thread_TYPE UDP(); virtual ~UDP(); - int run(MessageQueue* commandMessageQueue); + int run(MessageQueue* messageQueue); int shutdown(); private: void threadPostStopCleanup() {}; void threadMethod(); - void processRequest(UCHAR* data, int length); + void processRequest(const void* data, UINT length); int initted; DatagramSocket* ds; - MessageQueue* commandMessageQueue; + MessageQueue* messageQueue; Log* log; }; diff --git a/vaudioselector.cc b/vaudioselector.cc index 6025720..746f189 100644 --- a/vaudioselector.cc +++ b/vaudioselector.cc @@ -485,7 +485,7 @@ int VAudioSelector::handleCommand(int command) m->from = this; m->to = parent; m->message = Message::SUBTITLE_CHANGE_CHANNEL; - m->parameter.num = (((AudioSubtitleChannel*)ssl.getCurrentOptionData())->pestype &0xFFFF)|(((AudioSubtitleChannel*)ssl.getCurrentOptionData())->type &0xFF)<<16 ; + m->parameter = (((AudioSubtitleChannel*)ssl.getCurrentOptionData())->pestype &0xFFFF)|(((AudioSubtitleChannel*)ssl.getCurrentOptionData())->type &0xFF)<<16 ; MessageQueue::getInstance()->postMessageNoLock(m); } else { asl.up(); @@ -495,7 +495,7 @@ int VAudioSelector::handleCommand(int command) m->from = this; m->to = parent; m->message = Message::AUDIO_CHANGE_CHANNEL; - m->parameter.num = (((AudioSubtitleChannel*)asl.getCurrentOptionData())->pestype &0xFFFF)|(((AudioSubtitleChannel*)asl.getCurrentOptionData())->type &0xFF)<<16 ; + m->parameter = (((AudioSubtitleChannel*)asl.getCurrentOptionData())->pestype &0xFFFF)|(((AudioSubtitleChannel*)asl.getCurrentOptionData())->type &0xFF)<<16 ; MessageQueue::getInstance()->postMessageNoLock(m); } @@ -512,7 +512,7 @@ int VAudioSelector::handleCommand(int command) m->from = this; m->to = parent; m->message = Message::SUBTITLE_CHANGE_CHANNEL; - m->parameter.num = (((AudioSubtitleChannel*)ssl.getCurrentOptionData())->pestype &0xFFFF)|(((AudioSubtitleChannel*)ssl.getCurrentOptionData())->type &0xFF)<<16 + m->parameter = (((AudioSubtitleChannel*)ssl.getCurrentOptionData())->pestype &0xFFFF)|(((AudioSubtitleChannel*)ssl.getCurrentOptionData())->type &0xFF)<<16 |(((AudioSubtitleChannel*)asl.getCurrentOptionData())->streamtype &0xFF)<<24 ; MessageQueue::getInstance()->postMessageNoLock(m); } else { @@ -523,7 +523,7 @@ int VAudioSelector::handleCommand(int command) m->from = this; m->to = parent; m->message = Message::AUDIO_CHANGE_CHANNEL; - m->parameter.num = (((AudioSubtitleChannel*)asl.getCurrentOptionData())->pestype &0xFFFF)|(((AudioSubtitleChannel*)asl.getCurrentOptionData())->type &0xFF)<<16 + m->parameter = (((AudioSubtitleChannel*)asl.getCurrentOptionData())->pestype &0xFFFF)|(((AudioSubtitleChannel*)asl.getCurrentOptionData())->type &0xFF)<<16 |(((AudioSubtitleChannel*)asl.getCurrentOptionData())->streamtype &0xFF)<<24 ; MessageQueue::getInstance()->postMessageNoLock(m); } @@ -568,7 +568,7 @@ void VAudioSelector::processMessage(Message* m) UINT lastsel=asl.getCurrentOption(); - if (((m->parameter.num>>16)-getScreenX()) < 200 && asl.mouseMove((m->parameter.num>>16)-getScreenX(),(m->parameter.num&0xFFFF)-getScreenY())) + if (((m->parameter>>16)-getScreenX()) < 200 && asl.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { editsubtitles=false; ssl.setDarkSelOption(true); @@ -582,7 +582,7 @@ void VAudioSelector::processMessage(Message* m) m2->from = this; m2->to = parent; m2->message = Message::AUDIO_CHANGE_CHANNEL; - m2->parameter.num = (((AudioSubtitleChannel*)asl.getCurrentOptionData())->pestype &0xFFFF)|(((AudioSubtitleChannel*)asl.getCurrentOptionData())->type &0xFF)<<16 ; + m2->parameter = (((AudioSubtitleChannel*)asl.getCurrentOptionData())->pestype &0xFFFF)|(((AudioSubtitleChannel*)asl.getCurrentOptionData())->type &0xFF)<<16 ; MessageQueue::getInstance()->postMessageNoLock(m2); } return; @@ -590,7 +590,7 @@ void VAudioSelector::processMessage(Message* m) } lastsel=ssl.getCurrentOption(); - if (ssl.mouseMove((m->parameter.num>>16)-getScreenX(),(m->parameter.num&0xFFFF)-getScreenY())) + if (ssl.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { editsubtitles=true; ssl.setDarkSelOption(false); @@ -604,7 +604,7 @@ void VAudioSelector::processMessage(Message* m) m2->from = this; m2->to = parent; m2->message = Message::SUBTITLE_CHANGE_CHANNEL; - m2->parameter.num = (((AudioSubtitleChannel*)ssl.getCurrentOptionData())->pestype &0xFFFF)|(((AudioSubtitleChannel*)ssl.getCurrentOptionData())->type &0xFF)<<16 ; + m2->parameter = (((AudioSubtitleChannel*)ssl.getCurrentOptionData())->pestype &0xFFFF)|(((AudioSubtitleChannel*)ssl.getCurrentOptionData())->type &0xFF)<<16 ; MessageQueue::getInstance()->postMessageNoLock(m2); } return; @@ -612,7 +612,7 @@ void VAudioSelector::processMessage(Message* m) } else if (m->message == Message::MOUSE_LBDOWN) { - if (asl.mouseLBDOWN((m->parameter.num>>16)-getScreenX(),(m->parameter.num&0xFFFF)-getScreenY())) + if (asl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { editsubtitles=false; ssl.setDarkSelOption(true); @@ -621,7 +621,7 @@ void VAudioSelector::processMessage(Message* m) ssl.draw(); BoxStack::getInstance()->handleCommand(Remote::OK); //simulate OK press } - else if (ssl.mouseLBDOWN((m->parameter.num>>16)-getScreenX(),(m->parameter.num&0xFFFF)-getScreenY())) + else if (ssl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { editsubtitles=true; ssl.setDarkSelOption(false); @@ -632,8 +632,8 @@ void VAudioSelector::processMessage(Message* m) } else { //check if press is outside this view! then simulate cancel - int x=(m->parameter.num>>16)-getScreenX(); - int y=(m->parameter.num&0xFFFF)-getScreenY(); + int x=(m->parameter>>16)-getScreenX(); + int y=(m->parameter&0xFFFF)-getScreenY(); if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight()) { BoxStack::getInstance()->handleCommand(Remote::BACK); //simulate cancel press diff --git a/vchannellist.cc b/vchannellist.cc index d16d7cf..8d6573d 100644 --- a/vchannellist.cc +++ b/vchannellist.cc @@ -264,7 +264,7 @@ void VChannelList::processMessage(Message* m) { /* if (m->message == Message::MOUSE_MOVE) { if (sl.mouseAndroidScroll((m->tag >> 16),(m->tag & 0xFFFF), - (m->parameter.num >> 16),(m->parameter.num & 0xFFFF))) { + (m->parameter >> 16),(m->parameter & 0xFFFF))) { sl.draw(); doShowingBar(); boxstack->update(this); @@ -272,7 +272,7 @@ void VChannelList::processMessage(Message* m) } else */if (m->message == Message::MOUSE_MOVE) { - if (sl.mouseMove((m->parameter.num>>16)-getScreenX(),(m->parameter.num&0xFFFF)-getScreenY())) + if (sl.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { quickUpdate(); boxstack->update(this); @@ -280,14 +280,14 @@ void VChannelList::processMessage(Message* m) } else if (m->message == Message::MOUSE_LBDOWN) { - if (sl.mouseLBDOWN((m->parameter.num>>16)-getScreenX(),(m->parameter.num&0xFFFF)-getScreenY())) + if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { boxstack->handleCommand(Remote::OK); //simulate OK press } else { //check if press is outside this view! then simulate cancel - int x=(m->parameter.num>>16)-getScreenX(); - int y=(m->parameter.num&0xFFFF)-getScreenY(); + int x=(m->parameter>>16)-getScreenX(); + int y=(m->parameter&0xFFFF)-getScreenY(); if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight()) { boxstack->handleCommand(Remote::BACK); //simulate cancel press @@ -299,7 +299,7 @@ void VChannelList::processMessage(Message* m) Channel* chan = NULL; for (UINT i = 0; i < chanList->size(); i++) { - if ((*chanList)[i]->number == m->parameter.num) + if ((*chanList)[i]->number == m->parameter) { chan = (*chanList)[i]; break; diff --git a/vchannelselect.cc b/vchannelselect.cc index 12128ea..0bba053 100644 --- a/vchannelselect.cc +++ b/vchannelselect.cc @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with VOMP; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + along with VOMP. If not, see . */ #include "vchannelselect.h" @@ -26,8 +25,8 @@ #include "colour.h" #include "log.h" #include "timers.h" -#include "command.h" #include "vdr.h" +#include "messagequeue.h" // this class only works as it does because the remote command // values for the numbers are the numbers themselves ! @@ -109,17 +108,17 @@ void VChannelSelect::changeChannel(bool which) m->from = this; m->to = parent; m->message = Message::CHANNEL_CHANGE; - m->parameter.num = 0; + m->parameter = 0; for(i = numGot - 1; i >= 0; i--) { - m->parameter.num += input[i] * (ULONG)pow(10., i); + m->parameter += input[i] * (ULONG)pow(10., i); } if (which) - Command::getInstance()->postMessageNoLock(m); + MessageQueue::getInstance()->postMessageNoLock(m); else - Command::getInstance()->postMessageFromOuterSpace(m); + MessageQueue::getInstance()->postMessageFromOuterSpace(m); } // Close me @@ -128,9 +127,9 @@ void VChannelSelect::changeChannel(bool which) m->to = BoxStack::getInstance(); m->message = Message::CLOSE_ME; if (which) - Command::getInstance()->postMessageNoLock(m); + MessageQueue::getInstance()->postMessageNoLock(m); else - Command::getInstance()->postMessageFromOuterSpace(m); + MessageQueue::getInstance()->postMessageFromOuterSpace(m); } int VChannelSelect::handleCommand(int command) diff --git a/vchannelselect.h b/vchannelselect.h index 61db671..fbd8fbf 100644 --- a/vchannelselect.h +++ b/vchannelselect.h @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with VOMP; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + along with VOMP. If not, see . */ #ifndef VCHANNELSELECT_H diff --git a/vcolourtuner.cc b/vcolourtuner.cc index 7112da3..178c22a 100644 --- a/vcolourtuner.cc +++ b/vcolourtuner.cc @@ -227,8 +227,8 @@ void VColourTuner::processMessage(Message* m) else if (m->message == Message::MOUSE_LBDOWN) { //check if press is outside this view! then simulate cancel - int x=(m->parameter.num>>16)-getScreenX(); - int y=(m->parameter.num&0xFFFF)-getScreenY(); + int x=(m->parameter>>16)-getScreenX(); + int y=(m->parameter&0xFFFF)-getScreenY(); if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight()) { BoxStack::getInstance()->handleCommand(Remote::BACK); //simulate cancel press diff --git a/vconnect.cc b/vconnect.cc index 4f62274..e5c70cc 100644 --- a/vconnect.cc +++ b/vconnect.cc @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with VOMP; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + along with VOMP. If not, see . */ #include "vconnect.h" @@ -29,9 +28,12 @@ #include "log.h" #include "wol.h" #include "vserverselect.h" +#include "messagequeue.h" VConnect::VConnect(char* tServer) { + server = tServer; + boxstack = BoxStack::getInstance(); vdr = VDR::getInstance(); logger = Log::getInstance(); @@ -48,8 +50,6 @@ VConnect::VConnect(char* tServer) } exitable = 0; - irun = 0; - server = tServer; } VConnect::~VConnect() @@ -197,14 +197,14 @@ void VConnect::threadMethod() m->from = this; m->to = Command::getInstance(); m->message = Message::VDR_CONNECTED; - Command::getInstance()->postMessage(m); + MessageQueue::getInstance()->postMessage(m); } void VConnect::processMessage(Message* m) { if (m->message == Message::SERVER_SELECTED) { - selectedServer = m->parameter.num; + selectedServer = m->parameter; threadSignal(); } } diff --git a/vconnect.h b/vconnect.h index 0e0df7b..8773a5a 100644 --- a/vconnect.h +++ b/vconnect.h @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with VOMP; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + along with VOMP. If not, see . */ #ifndef VCONNECT_H @@ -56,7 +55,7 @@ class VConnect : public VInfo, public Thread_TYPE void clearServerIPs(); BoxStack* boxstack; - UCHAR irun; + UCHAR irun{}; VDR* vdr; Log* logger; std::vector servers; diff --git a/vdr.cc b/vdr.cc index dbe6e02..6e1b6ac 100644 --- a/vdr.cc +++ b/vdr.cc @@ -119,13 +119,7 @@ VDR::VDR() { if (instance) return; instance = this; - initted = 0; - findingServer = 0; - tcp = NULL; - connected = false; - maxChannelNumber = 0; - channelNumberWidth = 1; - doVDRShutdown = false; + TEMP_SINGLE_VDR_PR = NULL; #ifdef VOMP_MEDIAPLAYER providerId=MPROVIDERID_VDR; @@ -204,7 +198,7 @@ void VDR::findServers(std::vector& servers) { waitType = 2; - char* vdpreply = ds.getData(); + const char* vdpreply = static_cast(ds.getData()); if ((ds.getDataLength() >= 24) && !strncmp(vdpreply, "VDP-0002", 8)) { VDRServer newServer; diff --git a/vdr.h b/vdr.h index 928b24f..6506f75 100644 --- a/vdr.h +++ b/vdr.h @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with VOMP; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + along with VOMP. If not, see . */ @@ -246,15 +245,15 @@ public ExternLogger bool sendKA(ULONG timeStamp); Log* logger; - int initted; - int findingServer; - TCP* tcp; + int initted{}; + int findingServer{}; + TCP* tcp{}; char serverIP[40]; USHORT serverPort; - bool connected; - ULONG maxChannelNumber; - bool doVDRShutdown; - ULONG channelNumberWidth; + bool connected{}; + ULONG maxChannelNumber{}; + bool doVDRShutdown{}; + ULONG channelNumberWidth{1}; VDR_PacketReceiver* TEMP_SINGLE_VDR_PR; #ifdef VOMP_MEDIAPLAYER diff --git a/vepg.cc b/vepg.cc index aa0099f..fb0b526 100644 --- a/vepg.cc +++ b/vepg.cc @@ -452,7 +452,7 @@ int VEpg::handleCommand(int command) m->from = this; m->to = parent; m->message = Message::CHANNEL_CHANGE; - m->parameter.num = (*chanList)[currentChannelIndex]->number; + m->parameter = (*chanList)[currentChannelIndex]->number; MessageQueue::getInstance()->postMessageNoLock(m); } @@ -480,7 +480,7 @@ int VEpg::handleCommand(int command) m->from = this; m->to = parent; m->message = Message::CHANNEL_CHANGE; - m->parameter.num = (*chanList)[currentChannelIndex]->number; + m->parameter = (*chanList)[currentChannelIndex]->number; MessageQueue::getInstance()->postMessageNoLock(m); } @@ -501,7 +501,7 @@ int VEpg::handleCommand(int command) m->from = this; m->to = parent; m->message = Message::CHANNEL_CHANGE; - m->parameter.num = (*chanList)[currentChannelIndex]->number; + m->parameter = (*chanList)[currentChannelIndex]->number; MessageQueue::getInstance()->postMessageNoLock(m); } @@ -770,7 +770,7 @@ void VEpg::processMessage(Message* m) { if (m->message == Message::MOUSE_MOVE) { - if (chanListbox.mouseMove((m->parameter.num>>16)-getScreenX(),(m->parameter.num&0xFFFF)-getScreenY())) + if (chanListbox.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { drawData(); boxstack->update(this); @@ -778,15 +778,15 @@ void VEpg::processMessage(Message* m) } else if (m->message == Message::MOUSE_LBDOWN) { - if (chanListbox.mouseLBDOWN((m->parameter.num>>16)-getScreenX(),(m->parameter.num&0xFFFF)-getScreenY())) + if (chanListbox.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { boxstack->handleCommand(Remote::OK); //simulate OK press } else { //check if press is outside this view! then simulate cancel - int x=(m->parameter.num>>16)-getScreenX(); - int y=(m->parameter.num&0xFFFF)-getScreenY(); + int x=(m->parameter>>16)-getScreenX(); + int y=(m->parameter&0xFFFF)-getScreenY(); int keyx = chanListbox.getRootBoxOffsetX(); int keyy = chanListbox.getRootBoxOffsetY() + chanListbox.getHeight() + 2; diff --git a/vepglistadvanced.cc b/vepglistadvanced.cc index 360798e..7df9c20 100644 --- a/vepglistadvanced.cc +++ b/vepglistadvanced.cc @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with VOMP; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + along with VOMP. If not, see . */ #include "vepglistadvanced.h" @@ -28,7 +27,7 @@ #include "colour.h" #include "video.h" #include "i18n.h" -#include "command.h" +#include "messagequeue.h" #include "log.h" #include "movieinfo.h" #include "seriesinfo.h" @@ -269,9 +268,9 @@ void VEpgListAdvanced::doSwitch() m->from = this; m->to = videolive; m->message = Message::CHANNEL_CHANGE; - m->parameter.num = channelNumber; + m->parameter = channelNumber; m->tag = 0; - Command::getInstance()->postMessageNoLock(m); + MessageQueue::getInstance()->postMessageNoLock(m); } } @@ -868,7 +867,7 @@ void VEpgListAdvanced::processMessage(Message* m) if (m->message == Message::MOUSE_MOVE) { - if (sl.mouseMove((m->parameter.num>>16)-getScreenX(),(m->parameter.num&0xFFFF)-getScreenY())) + if (sl.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { quickUpdate(); boxstack->update(this); @@ -876,31 +875,31 @@ void VEpgListAdvanced::processMessage(Message* m) } else if (m->message == Message::MOUSE_LBDOWN) { - if (sl.mouseLBDOWN((m->parameter.num>>16)-getScreenX(),(m->parameter.num&0xFFFF)-getScreenY())) + if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { boxstack->handleCommand(Remote::OK); //simulate OK press } - else if (boxRed.mouseLBDOWN((m->parameter.num >> 16) - getScreenX(), (m->parameter.num & 0xFFFF) - getScreenY())) + else if (boxRed.mouseLBDOWN((m->parameter >> 16) - getScreenX(), (m->parameter & 0xFFFF) - getScreenY())) { boxstack->handleCommand(Remote::RED); } - else if (boxGreen.mouseLBDOWN((m->parameter.num >> 16) - getScreenX(), (m->parameter.num & 0xFFFF) - getScreenY())) + else if (boxGreen.mouseLBDOWN((m->parameter >> 16) - getScreenX(), (m->parameter & 0xFFFF) - getScreenY())) { boxstack->handleCommand(Remote::GREEN); } - else if (boxYellow.mouseLBDOWN((m->parameter.num >> 16) - getScreenX(), (m->parameter.num & 0xFFFF) - getScreenY())) + else if (boxYellow.mouseLBDOWN((m->parameter >> 16) - getScreenX(), (m->parameter & 0xFFFF) - getScreenY())) { boxstack->handleCommand(Remote::GREEN); } - else if (boxBlue.mouseLBDOWN((m->parameter.num >> 16) - getScreenX(), (m->parameter.num & 0xFFFF) - getScreenY())) + else if (boxBlue.mouseLBDOWN((m->parameter >> 16) - getScreenX(), (m->parameter & 0xFFFF) - getScreenY())) { boxstack->handleCommand(Remote::GREEN); } else { //check if press is outside this view! then simulate cancel - int x=(m->parameter.num>>16)-getScreenX(); - int y=(m->parameter.num&0xFFFF)-getScreenY(); + int x=(m->parameter>>16)-getScreenX(); + int y=(m->parameter&0xFFFF)-getScreenY(); if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight()) { boxstack->handleCommand(Remote::BACK); //simulate cancel press diff --git a/vepgsettimer.cc b/vepgsettimer.cc index 5c6a527..8a34346 100644 --- a/vepgsettimer.cc +++ b/vepgsettimer.cc @@ -28,6 +28,7 @@ #include "vinfo.h" #include "message.h" #include "command.h" +#include "messagequeue.h" #include "video.h" #include "remote.h" #include "i18n.h" @@ -278,22 +279,22 @@ void VEpgSetTimer::doit() Message* m = new Message(); m->message = Message::ADD_VIEW; m->to = boxstack; - m->parameter.num = (ULONG)vi; - Command::getInstance()->postMessageNoLock(m); + m->parameter = (ULONG)vi; + MessageQueue::getInstance()->postMessageNoLock(m); } void VEpgSetTimer::processMessage(Message* m) { if (m->message == Message::MOUSE_MOVE) { - if (buttonYes.mouseMove((m->parameter.num>>16)-getScreenX(),(m->parameter.num&0xFFFF)-getScreenY())) + if (buttonYes.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { buttonNo.setActive(0); selectedOption = YES; draw(); boxstack->update(this); } - else if (buttonNo.mouseMove((m->parameter.num>>16)-getScreenX(),(m->parameter.num&0xFFFF)-getScreenY())) + else if (buttonNo.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { buttonYes.setActive(0); selectedOption = NO; @@ -303,19 +304,19 @@ void VEpgSetTimer::processMessage(Message* m) } else if (m->message == Message::MOUSE_LBDOWN) { - if (buttonYes.mouseLBDOWN((m->parameter.num>>16)-getScreenX(),(m->parameter.num&0xFFFF)-getScreenY())) + if (buttonYes.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { boxstack->handleCommand(Remote::OK); //simulate OK press } - else if (buttonNo.mouseLBDOWN((m->parameter.num>>16)-getScreenX(),(m->parameter.num&0xFFFF)-getScreenY())) + else if (buttonNo.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { boxstack->handleCommand(Remote::OK); //simulate OK press } else { //check if press is outside this view! then simulate cancel - int x=(m->parameter.num>>16)-getScreenX(); - int y=(m->parameter.num&0xFFFF)-getScreenY(); + int x=(m->parameter>>16)-getScreenX(); + int y=(m->parameter&0xFFFF)-getScreenY(); if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight()) { boxstack->handleCommand(Remote::BACK); //simulate cancel press diff --git a/vepgsummary.cc b/vepgsummary.cc index ac67c4e..75c5a3f 100644 --- a/vepgsummary.cc +++ b/vepgsummary.cc @@ -207,7 +207,7 @@ void VEpgSummary::processMessage(Message* m) { if (m->message == Message::MOUSE_MOVE) { - if (tabbar.mouseMove((m->parameter.num >> 16) - getScreenX(), (m->parameter.num & 0xFFFF) - getScreenY())) + if (tabbar.mouseMove((m->parameter >> 16) - getScreenX(), (m->parameter & 0xFFFF) - getScreenY())) { BoxStack::getInstance()->update(this); } @@ -215,8 +215,8 @@ void VEpgSummary::processMessage(Message* m) else if (m->message == Message::MOUSE_LBDOWN) { int cancel = true; - int x = (m->parameter.num >> 16) - getScreenX(); - int y = (m->parameter.num & 0xFFFF) - getScreenY(); + int x = (m->parameter >> 16) - getScreenX(); + int y = (m->parameter & 0xFFFF) - getScreenY(); if ((boxRed.getX() <= x) && (boxRed.getX() + (int)boxRed.getWidth() >= x) && (boxRed.getY() <= y) && (boxRed.getY() + (int)boxRed.getHeight() >= y)) { @@ -225,7 +225,7 @@ void VEpgSummary::processMessage(Message* m) } - if (cancel && tabbar.mouseLBDOWN((m->parameter.num >> 16) - getScreenX(), (m->parameter.num & 0xFFFF) - getScreenY())) + if (cancel && tabbar.mouseLBDOWN((m->parameter >> 16) - getScreenX(), (m->parameter & 0xFFFF) - getScreenY())) { BoxStack::getInstance()->update(this); cancel = false; @@ -233,8 +233,8 @@ void VEpgSummary::processMessage(Message* m) if (cancel) { //check if press is outside this view! then simulate cancel - int checkX=(m->parameter.num>>16)-getScreenX(); - int checkY=(m->parameter.num&0xFFFF)-getScreenY(); + int checkX=(m->parameter>>16)-getScreenX(); + int checkY=(m->parameter&0xFFFF)-getScreenY(); if (checkX<0 || checkY <0 || checkX>(int)getWidth() || checkY>(int)getHeight()) { BoxStack::getInstance()->handleCommand(Remote::BACK); //simulate cancel press @@ -243,7 +243,7 @@ void VEpgSummary::processMessage(Message* m) } else if (m->message == Message::MOUSE_SCROLL) { if (tabbar.mouseAndroidScroll((m->tag >> 16) - getScreenX(), (m->tag & 0xFFFF) - getScreenY(), - (short)(m->parameter.num >> 16), (short)(m->parameter.num & 0xFFFF))) + (short)(m->parameter >> 16), (short)(m->parameter & 0xFFFF))) { BoxStack::getInstance()->update(this); return; diff --git a/vmedialist.cc b/vmedialist.cc index 7bbb7c9..0f79239 100644 --- a/vmedialist.cc +++ b/vmedialist.cc @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with VOMP; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + along with VOMP. If not, see . */ /* @@ -66,7 +65,7 @@ #include "video.h" #include "i18n.h" #include "vdr.h" -#include "command.h" +#include "messagequeue.h" #include "vinfo.h" #include "media.h" #include "mediaplayer.h" @@ -1067,7 +1066,7 @@ void VMediaList::processMessage(Message* m) { if (m->message == Message::MOUSE_MOVE) { - if (sl.mouseMove((m->parameter.num>>16)-getScreenX(),(m->parameter.num&0xFFFF)-getScreenY())) + if (sl.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { sl.draw(); doShowingBar(); @@ -1077,15 +1076,15 @@ void VMediaList::processMessage(Message* m) } else if (m->message == Message::MOUSE_LBDOWN) { - if (sl.mouseLBDOWN((m->parameter.num>>16)-getScreenX(),(m->parameter.num&0xFFFF)-getScreenY())) + if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { updateSelection(); boxstack->handleCommand(Remote::OK); //simulate OK press } else { //check if press is outside this view! then simulate cancel - int x=(m->parameter.num>>16)-getScreenX(); - int y=(m->parameter.num&0xFFFF)-getScreenY(); + int x=(m->parameter>>16)-getScreenX(); + int y=(m->parameter&0xFFFF)-getScreenY(); if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight()) { boxstack->handleCommand(Remote::BACK); //simulate cancel press @@ -1093,7 +1092,7 @@ void VMediaList::processMessage(Message* m) } } else if (m->message == Message::PLAYER_EVENT) { - switch (m->parameter.num) { + switch (m->parameter) { case 1: directoryDone(); break; @@ -1185,8 +1184,8 @@ int VMediaList::load() { Message* m = new Message(); m->message = Message::ADD_VIEW; m->to = boxstack; - m->parameter.num = (ULONG)vi; - Command::getInstance()->postMessageNoLock(m); + m->parameter = (ULONG)vi; + MessageQueue::getInstance()->postMessageNoLock(m); } return 1; } @@ -1204,8 +1203,8 @@ void VMediaList::timercall(int ref) { Message* m = new Message(); m->message = Message::PLAYER_EVENT; m->to = this; - m->parameter.num = ref; - Command::getInstance()->postMessageFromOuterSpace(m); + m->parameter = ref; + MessageQueue::getInstance()->postMessageFromOuterSpace(m); } } diff --git a/vmediaview.cc b/vmediaview.cc index ef380ae..d40f45d 100644 --- a/vmediaview.cc +++ b/vmediaview.cc @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with VOMP; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + along with VOMP. If not, see . */ #include @@ -41,6 +40,7 @@ #include "mediaoptions.h" #include "mediaplayer.h" #include "log.h" +#include "messagequeue.h" const int VMediaView::EVENT_SLIDESHOW=100; const int VMediaView::EVENT_DRAWINGDONE=101; @@ -221,8 +221,8 @@ class DrawingThread : public Thread_TYPE { m->message = Message::PLAYER_EVENT; m->to = _parent; m->from = _parent; - m->parameter.num = rt?VMediaView::EVENT_DRAWINGDONE:VMediaView::EVENT_DRAWINGERROR; - Command::getInstance()->postMessageFromOuterSpace(m); + m->parameter = rt?VMediaView::EVENT_DRAWINGDONE:VMediaView::EVENT_DRAWINGERROR; + MessageQueue::getInstance()->postMessageFromOuterSpace(m); } Log::getInstance()->log("DrawingThread",Log::DEBUG,"finishing interrupt=%d",(int)_interrupted); } @@ -711,15 +711,15 @@ void VMediaView::processMessage(Message* m) { //check if press is outside this view! then simulate cancel - int x=(m->parameter.num>>16)-getScreenX(); - int y=(m->parameter.num&0xFFFF)-getScreenY(); + int x=(m->parameter>>16)-getScreenX(); + int y=(m->parameter&0xFFFF)-getScreenY(); if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight()) { BoxStack::getInstance()->handleCommand(Remote::BACK); //simulate cancel press } } else if (m->message = Message::PLAYER_EVENT) { - switch (m->parameter.num) { + switch (m->parameter) { case EVENT_SLIDESHOW: if (! pictureEnabled) break; //old timer msg... //if (! audioEnabled) { @@ -1084,8 +1084,8 @@ void VMediaView::sendViewMsg(Boxx *v) { m->message = Message::CLOSE_ME; m->to = BoxStack::getInstance(); m->from = v; - m->parameter.num=(ULONG)v; - Command::getInstance()->postMessageFromOuterSpace(m); + m->parameter=(ULONG)v; + MessageQueue::getInstance()->postMessageFromOuterSpace(m); } void VMediaView::sendCommandMsg(int command) { Message* m = new Message(); @@ -1093,8 +1093,8 @@ void VMediaView::sendCommandMsg(int command) { m->message = Message::PLAYER_EVENT; m->to = this; m->from = this; - m->parameter.num = command; - Command::getInstance()->postMessageFromOuterSpace(m); + m->parameter = command; + MessageQueue::getInstance()->postMessageFromOuterSpace(m); } void VMediaView::enableBanner(bool enable) { diff --git a/vmute.cc b/vmute.cc index c371caf..2de57ab 100644 --- a/vmute.cc +++ b/vmute.cc @@ -27,7 +27,7 @@ #include "colour.h" #include "timers.h" #include "boxstack.h" -#include "command.h" +#include "messagequeue.h" VMute::VMute() { @@ -73,7 +73,7 @@ void VMute::timercall(int clientReference) m->message = Message::CLOSE_ME; m->to = BoxStack::getInstance(); m->from = this; - Command::getInstance()->postMessageFromOuterSpace(m); + MessageQueue::getInstance()->postMessageFromOuterSpace(m); } int VMute::handleCommand(int command) diff --git a/vopts.cc b/vopts.cc index 505763a..963ea58 100644 --- a/vopts.cc +++ b/vopts.cc @@ -493,8 +493,8 @@ void VOpts::processMessage(Message* m) { if (m->message == Message::MOUSE_MOVE) { - int x=(m->parameter.num>>16)-getScreenX(); - int y=(m->parameter.num&0xFFFF)-getScreenY(); + int x=(m->parameter>>16)-getScreenX(); + int y=(m->parameter&0xFFFF)-getScreenY(); if (tabbar.mouseMove(x,y)) { BoxStack::getInstance()->update(this); @@ -503,8 +503,8 @@ void VOpts::processMessage(Message* m) } else if (m->message == Message::MOUSE_LBDOWN) { - int x=(m->parameter.num>>16)-getScreenX(); - int y=(m->parameter.num&0xFFFF)-getScreenY(); + int x=(m->parameter>>16)-getScreenX(); + int y=(m->parameter&0xFFFF)-getScreenY(); if (tabbar.mouseLBDOWN(x,y)) { BoxStack::getInstance()->update(this); diff --git a/vpicturebanner.cc b/vpicturebanner.cc index d89ce4b..c1ceef6 100644 --- a/vpicturebanner.cc +++ b/vpicturebanner.cc @@ -105,8 +105,8 @@ void VPictureBanner::processMessage(Message* m) else if (m->message == Message::MOUSE_LBDOWN) { //check if press is outside this view! then simulate cancel - int x=(m->parameter.num>>16)-getScreenX(); - int y=(m->parameter.num&0xFFFF)-getScreenY(); + int x=(m->parameter>>16)-getScreenX(); + int y=(m->parameter&0xFFFF)-getScreenY(); if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight()) { BoxStack::getInstance()->handleCommand(Remote::BACK); //simulate cancel press diff --git a/vquestion.cc b/vquestion.cc index 356b012..2a41a4a 100644 --- a/vquestion.cc +++ b/vquestion.cc @@ -126,14 +126,14 @@ void VQuestion::processMessage(Message* m) { if (m->message == Message::MOUSE_MOVE) { - if (buttonYes.mouseMove((m->parameter.num>>16)-getScreenX(),(m->parameter.num&0xFFFF)-getScreenY())) + if (buttonYes.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { buttonNo.setActive(0); selectedOption = YES; draw(); BoxStack::getInstance()->update(this); } - else if (buttonNo.mouseMove((m->parameter.num>>16)-getScreenX(),(m->parameter.num&0xFFFF)-getScreenY())) + else if (buttonNo.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { buttonYes.setActive(0); selectedOption = NO; @@ -143,19 +143,19 @@ void VQuestion::processMessage(Message* m) } else if (m->message == Message::MOUSE_LBDOWN) { - if (buttonYes.mouseLBDOWN((m->parameter.num>>16)-getScreenX(),(m->parameter.num&0xFFFF)-getScreenY())) + if (buttonYes.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { BoxStack::getInstance()->handleCommand(Remote::OK); //simulate OK press } - else if (buttonNo.mouseLBDOWN((m->parameter.num>>16)-getScreenX(),(m->parameter.num&0xFFFF)-getScreenY())) + else if (buttonNo.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { BoxStack::getInstance()->handleCommand(Remote::OK); //simulate OK press } else { //check if press is outside this view! then simulate cancel - int x=(m->parameter.num>>16)-getScreenX(); - int y=(m->parameter.num&0xFFFF)-getScreenY(); + int x=(m->parameter>>16)-getScreenX(); + int y=(m->parameter&0xFFFF)-getScreenY(); if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight()) { BoxStack::getInstance()->handleCommand(Remote::BACK); //simulate cancel press diff --git a/vradiorec.cc b/vradiorec.cc index 99624eb..b031c86 100644 --- a/vradiorec.cc +++ b/vradiorec.cc @@ -36,6 +36,7 @@ #include "vinfo.h" #include "i18n.h" #include "log.h" +#include "messagequeue.h" VRadioRec::VRadioRec(Recording* rec) { @@ -158,7 +159,7 @@ void VRadioRec::go(bool resume) m->message = Message::CLOSE_ME; m->from = this; m->to = boxstack; - Command::getInstance()->postMessageNoLock(m); + MessageQueue::getInstance()->postMessageNoLock(m); VInfo* vi = new VInfo(); vi->setSize(400, 150); @@ -176,8 +177,8 @@ void VRadioRec::go(bool resume) m = new Message(); m->message = Message::ADD_VIEW; m->to = boxstack; - m->parameter.num = (ULONG)vi; - Command::getInstance()->postMessageNoLock(m); + m->parameter = (ULONG)vi; + MessageQueue::getInstance()->postMessageNoLock(m); } } @@ -276,8 +277,8 @@ void VRadioRec::processMessage(Message* m) { if (m->message == Message::MOUSE_LBDOWN) { - int x=(m->parameter.num>>16)-(int)getScreenX(); - int y=(m->parameter.num&0xFFFF)-(int)getScreenY(); + int x=(m->parameter>>16)-(int)getScreenX(); + int y=(m->parameter&0xFFFF)-(int)getScreenY(); if (!barShowing) { boxstack->handleCommand(Remote::OK); //simulate rok press @@ -311,7 +312,7 @@ void VRadioRec::processMessage(Message* m) Log::getInstance()->log("VRadioRec", Log::DEBUG, "Message received"); - switch(m->parameter.num) + switch(m->parameter) { case Player::CONNECTION_LOST: // connection lost detected { @@ -319,7 +320,7 @@ void VRadioRec::processMessage(Message* m) Message* m2 = new Message(); m2->to = Command::getInstance(); m2->message = Message::CONNECTION_LOST; - Command::getInstance()->postMessageNoLock(m2); + MessageQueue::getInstance()->postMessageNoLock(m2); break; } case Player::STOP_PLAYBACK: @@ -328,7 +329,7 @@ void VRadioRec::processMessage(Message* m) Message* m2 = new Message(); // Must be done after this thread finishes, and must break into master mutex m2->to = Command::getInstance(); m2->message = Message::STOP_PLAYBACK; - Command::getInstance()->postMessageNoLock(m2); + MessageQueue::getInstance()->postMessageNoLock(m2); break; } } diff --git a/vrecmove.cc b/vrecmove.cc index caa28ea..c899bd7 100644 --- a/vrecmove.cc +++ b/vrecmove.cc @@ -27,7 +27,7 @@ #include "colour.h" #include "video.h" #include "i18n.h" -#include "command.h" +#include "messagequeue.h" #include "wsymbol.h" #include "recman.h" #include "directory.h" @@ -130,8 +130,8 @@ int VRecMove::handleCommand(int command) Message* m = new Message(); m->message = Message::MOVE_RECORDING; m->to = parent; - m->parameter.num = sl.getCurrentOptionData(); - Command::getInstance()->postMessageNoLock(m); + m->parameter = sl.getCurrentOptionData(); + MessageQueue::getInstance()->postMessageNoLock(m); return 4; } @@ -148,7 +148,7 @@ void VRecMove::processMessage(Message* m) { if (m->message == Message::MOUSE_MOVE) { - if (sl.mouseMove((m->parameter.num>>16)-getScreenX(),(m->parameter.num&0xFFFF)-getScreenY())) + if (sl.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { sl.draw(); BoxStack::getInstance()->update(this); @@ -156,15 +156,15 @@ void VRecMove::processMessage(Message* m) } else if (m->message == Message::MOUSE_LBDOWN) { - if (sl.mouseLBDOWN((m->parameter.num>>16)-getScreenX(),(m->parameter.num&0xFFFF)-getScreenY())) + if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { BoxStack::getInstance()->handleCommand(Remote::OK); //simulate OK press } else { //check if press is outside this view! then simulate cancel - int x=(m->parameter.num>>16)-getScreenX(); - int y=(m->parameter.num&0xFFFF)-getScreenY(); + int x=(m->parameter>>16)-getScreenX(); + int y=(m->parameter&0xFFFF)-getScreenY(); if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight()) { BoxStack::getInstance()->handleCommand(Remote::BACK); //simulate cancel press diff --git a/vrecording.cc b/vrecording.cc index 9a14028..2cb7509 100644 --- a/vrecording.cc +++ b/vrecording.cc @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with VOMP; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + along with VOMP. If not, see . */ #include "vrecording.h" @@ -28,7 +27,7 @@ #include "colour.h" #include "video.h" #include "i18n.h" -#include "command.h" +#include "messagequeue.h" #include "vrecmove.h" #include "boxstack.h" #include "recman.h" @@ -227,7 +226,7 @@ int VRecording::handleCommand(int command) m->from = this; m->to = vRecList; m->message = Message::PLAY_SELECTED_RECORDING; - Command::getInstance()->postMessageNoLock(m); + MessageQueue::getInstance()->postMessageNoLock(m); return 4; } @@ -237,7 +236,7 @@ int VRecording::handleCommand(int command) m->from = this; m->to = vRecList; m->message = Message::RESUME_SELECTED_RECORDING; - Command::getInstance()->postMessageNoLock(m); + MessageQueue::getInstance()->postMessageNoLock(m); return 4; } @@ -266,8 +265,8 @@ int VRecording::handleCommand(int command) Message* m = new Message(); m->message = Message::ADD_VIEW; m->to = BoxStack::getInstance(); - m->parameter.num = (ULONG)vi; - Command::getInstance()->postMessageNoLock(m); + m->parameter = (ULONG)vi; + MessageQueue::getInstance()->postMessageNoLock(m); if (ret == 1) { @@ -283,7 +282,7 @@ int VRecording::handleCommand(int command) m2->from = this; m2->to = vRecList; m2->message = Message::REDRAW; - Command::getInstance()->postMessageNoLock(m2); + MessageQueue::getInstance()->postMessageNoLock(m2); } return 2; @@ -379,7 +378,7 @@ void VRecording::processMessage(Message* m) { for (int i = PLAY; i < last; i++) { - if (button[i].mouseMove((m->parameter.num >> 16) - getScreenX(), (m->parameter.num & 0xFFFF) - getScreenY())) + if (button[i].mouseMove((m->parameter >> 16) - getScreenX(), (m->parameter & 0xFFFF) - getScreenY())) { for (int j = PLAY; j < last; j++) button[j].setActive(0); @@ -392,7 +391,7 @@ void VRecording::processMessage(Message* m) break; } } - if (tabbar.mouseMove((m->parameter.num >> 16) - getScreenX(), (m->parameter.num & 0xFFFF) - getScreenY())) + if (tabbar.mouseMove((m->parameter >> 16) - getScreenX(), (m->parameter & 0xFFFF) - getScreenY())) { BoxStack::getInstance()->update(this); return; @@ -401,7 +400,7 @@ void VRecording::processMessage(Message* m) else if (m->message == Message::MOUSE_SCROLL) { if (tabbar.mouseAndroidScroll((m->tag >> 16) - getScreenX(), (m->tag & 0xFFFF) - getScreenY(), - (short)(m->parameter.num >> 16), (short) (m->parameter.num & 0xFFFF))) + (short)(m->parameter >> 16), (short) (m->parameter & 0xFFFF))) { BoxStack::getInstance()->update(this); return; @@ -412,7 +411,7 @@ void VRecording::processMessage(Message* m) int cancel = true; for (int i = PLAY; i < last; i++) { - if (button[i].mouseLBDOWN((m->parameter.num>>16)-getScreenX(),(m->parameter.num&0xFFFF)-getScreenY())) + if (button[i].mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { BoxStack::getInstance()->handleCommand(Remote::OK); //simulate OK press buttons = true; @@ -420,7 +419,7 @@ void VRecording::processMessage(Message* m) break; } } - if (cancel && tabbar.mouseLBDOWN((m->parameter.num >> 16) - getScreenX(), (m->parameter.num & 0xFFFF) - getScreenY())) + if (cancel && tabbar.mouseLBDOWN((m->parameter >> 16) - getScreenX(), (m->parameter & 0xFFFF) - getScreenY())) { buttons = false; button[selected].setActive(0); @@ -431,8 +430,8 @@ void VRecording::processMessage(Message* m) if (cancel) { //check if press is outside this view! then simulate cancel - int x=(m->parameter.num>>16)-getScreenX(); - int y=(m->parameter.num&0xFFFF)-getScreenY(); + int x=(m->parameter>>16)-getScreenX(); + int y=(m->parameter&0xFFFF)-getScreenY(); if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight()) { BoxStack::getInstance()->handleCommand(Remote::BACK); //simulate cancel press @@ -447,13 +446,13 @@ void VRecording::processMessage(Message* m) m2->from = this; m2->to = BoxStack::getInstance(); m2->message = Message::CLOSE_ME; - Command::getInstance()->postMessageNoLock(m2); + MessageQueue::getInstance()->postMessageNoLock(m2); m2 = new Message(); // OK. Want this to delete before this message does its job m2->from = this; m2->to = vRecList; m2->message = Message::DELETE_SELECTED_RECORDING; - Command::getInstance()->postMessageNoLock(m2); + MessageQueue::getInstance()->postMessageNoLock(m2); } } else if (m->message == Message::MOVE_RECORDING) @@ -462,14 +461,14 @@ void VRecording::processMessage(Message* m) m2->from = this; m2->to = BoxStack::getInstance(); m2->message = Message::CLOSE_ME; - Command::getInstance()->postMessageNoLock(m2); + MessageQueue::getInstance()->postMessageNoLock(m2); m2 = new Message(); m2->from = this; m2->to = vRecList; m2->message = Message::MOVE_RECORDING; - m2->parameter.num = m->parameter.num; - Command::getInstance()->postMessageNoLock(m2); + m2->parameter = m->parameter; + MessageQueue::getInstance()->postMessageNoLock(m2); } } diff --git a/vrecordinglist.cc b/vrecordinglist.cc index 6c4ca26..9331cb6 100644 --- a/vrecordinglist.cc +++ b/vrecordinglist.cc @@ -57,7 +57,7 @@ void VRecordingList::processMessage(Message* m) if (m->message == Message::MOUSE_MOVE) { - if (sl.mouseMove((m->parameter.num>>16)-getScreenX(),(m->parameter.num&0xFFFF)-getScreenY())) + if (sl.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { quickUpdate(); boxstack->update(this); @@ -65,15 +65,15 @@ void VRecordingList::processMessage(Message* m) } else if (m->message == Message::MOUSE_LBDOWN) { - if (sl.mouseLBDOWN((m->parameter.num>>16)-getScreenX(),(m->parameter.num&0xFFFF)-getScreenY())) + if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { boxstack->handleCommand(Remote::OK); //simulate OK press } else { //check if press is outside this view! then simulate cancel - int x=(m->parameter.num>>16)-getScreenX(); - int y=(m->parameter.num&0xFFFF)-getScreenY(); + int x=(m->parameter>>16)-getScreenX(); + int y=(m->parameter&0xFFFF)-getScreenY(); if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight()) { boxstack->handleCommand(Remote::BACK); //simulate cancel press @@ -88,7 +88,7 @@ void VRecordingList::processMessage(Message* m) else if (m->message == Message::MOVE_RECORDING) { Log::getInstance()->log("VRecordingList", Log::DEBUG, "Doing move recording"); - doMoveRecording((Directory*)m->parameter.num); + doMoveRecording((Directory*)m->parameter); } else if (m->message == Message::PLAY_SELECTED_RECORDING) { diff --git a/vrecordingmenu.cc b/vrecordingmenu.cc index 3cccca7..2db388b 100644 --- a/vrecordingmenu.cc +++ b/vrecordingmenu.cc @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with VOMP; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + along with VOMP. If not, see . */ #include "vrecordingmenu.h" @@ -28,7 +27,7 @@ #include "colour.h" #include "video.h" #include "i18n.h" -#include "command.h" +#include "messagequeue.h" #include "vrecmove.h" #include "boxstack.h" #include "recman.h" @@ -109,7 +108,7 @@ int VRecordingMenu::handleCommand(int command) m->from = this; m->to = vRecList; m->message = Message::PLAY_SELECTED_RECORDING; - Command::getInstance()->postMessageNoLock(m); + MessageQueue::getInstance()->postMessageNoLock(m); return 4; } @@ -119,7 +118,7 @@ int VRecordingMenu::handleCommand(int command) m->from = this; m->to = vRecList; m->message = Message::RESUME_SELECTED_RECORDING; - Command::getInstance()->postMessageNoLock(m); + MessageQueue::getInstance()->postMessageNoLock(m); return 4; } @@ -197,7 +196,7 @@ void VRecordingMenu::processMessage(Message* m) { if (m->message == Message::MOUSE_MOVE) { - if (sl.mouseMove((m->parameter.num>>16)-getScreenX(),(m->parameter.num&0xFFFF)-getScreenY())) + if (sl.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { sl.draw(); BoxStack::getInstance()->update(this); @@ -205,15 +204,15 @@ void VRecordingMenu::processMessage(Message* m) } else if (m->message == Message::MOUSE_LBDOWN) { - if (sl.mouseLBDOWN((m->parameter.num>>16)-getScreenX(),(m->parameter.num&0xFFFF)-getScreenY())) + if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { BoxStack::getInstance()->handleCommand(Remote::OK); //simulate OK press } else { //check if press is outside this view! then simulate cancel - int x=(m->parameter.num>>16)-getScreenX(); - int y=(m->parameter.num&0xFFFF)-getScreenY(); + int x=(m->parameter>>16)-getScreenX(); + int y=(m->parameter&0xFFFF)-getScreenY(); if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight()) { BoxStack::getInstance()->handleCommand(Remote::BACK); //simulate cancel press @@ -228,13 +227,13 @@ void VRecordingMenu::processMessage(Message* m) m2->from = this; m2->to = BoxStack::getInstance(); m2->message = Message::CLOSE_ME; - Command::getInstance()->postMessageNoLock(m2); + MessageQueue::getInstance()->postMessageNoLock(m2); m2 = new Message(); // OK. Want this to delete before this message does its job m2->from = this; m2->to = vRecList; m2->message = Message::DELETE_SELECTED_RECORDING; - Command::getInstance()->postMessageNoLock(m2); + MessageQueue::getInstance()->postMessageNoLock(m2); } } else if (m->message == Message::MOVE_RECORDING) @@ -243,13 +242,13 @@ void VRecordingMenu::processMessage(Message* m) m2->from = this; m2->to = BoxStack::getInstance(); m2->message = Message::CLOSE_ME; - Command::getInstance()->postMessageNoLock(m2); + MessageQueue::getInstance()->postMessageNoLock(m2); m2 = new Message(); m2->from = this; m2->to = vRecList; m2->message = Message::MOVE_RECORDING; - m2->parameter.num = m->parameter.num; - Command::getInstance()->postMessageNoLock(m2); + m2->parameter = m->parameter; + MessageQueue::getInstance()->postMessageNoLock(m2); } } diff --git a/vrecordingmenu.h b/vrecordingmenu.h index e033b66..c67729b 100644 --- a/vrecordingmenu.h +++ b/vrecordingmenu.h @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with VOMP; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + along with VOMP. If not, see . */ #ifndef VRECORDINGMENU_H diff --git a/vserverselect.cc b/vserverselect.cc index e9f9839..182e04f 100644 --- a/vserverselect.cc +++ b/vserverselect.cc @@ -26,7 +26,7 @@ #include "video.h" #include "boxstack.h" #include "i18n.h" -#include "command.h" +#include "messagequeue.h" VServerSelect::VServerSelect(std::vector& servers, void* treplyTo) @@ -98,8 +98,8 @@ int VServerSelect::handleCommand(int command) Message* m = new Message(); // Question/Answer mech. Better being messages m->to = replyTo; m->message = Message::SERVER_SELECTED; - m->parameter.num = sl.getCurrentOption(); - Command::getInstance()->postMessageNoLock(m); + m->parameter = sl.getCurrentOption(); + MessageQueue::getInstance()->postMessageNoLock(m); return 4; } } @@ -111,7 +111,7 @@ void VServerSelect::processMessage(Message* m) { if (m->message == Message::MOUSE_MOVE) { - if (sl.mouseMove((m->parameter.num>>16)-getScreenX(),(m->parameter.num&0xFFFF)-getScreenY())) + if (sl.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { sl.draw(); BoxStack::getInstance()->update(this); @@ -119,7 +119,7 @@ void VServerSelect::processMessage(Message* m) } else if (m->message == Message::MOUSE_LBDOWN) { - if (sl.mouseLBDOWN((m->parameter.num>>16)-getScreenX(),(m->parameter.num&0xFFFF)-getScreenY())) + if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { BoxStack::getInstance()->handleCommand(Remote::OK); //simulate OK press } diff --git a/vsleeptimer.cc b/vsleeptimer.cc index 278c598..0258e0b 100644 --- a/vsleeptimer.cc +++ b/vsleeptimer.cc @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with VOMP; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + along with VOMP. If not, see . */ #include "vsleeptimer.h" @@ -34,10 +33,7 @@ Sleeptimer* Sleeptimer::instance = NULL; Sleeptimer::Sleeptimer() { if (instance) return; - sec = -1; - active = false; instance = this; - } Sleeptimer::~Sleeptimer() @@ -45,160 +41,152 @@ Sleeptimer::~Sleeptimer() instance = NULL; } - const char* Sleeptimer::SetTime() { - if (sec <890) - { - sec=900; - if (active==false) - { - active = true; - threadStart(); - } - - return "0:15"; - } - else if (sec <1790) - { - sec = 1800; - if (active==false) - { - active = true; - threadStart(); - } - - return "0:30"; - } - else if (sec < 2690) - { - sec = 2700; - if (active==false) - { - active = true; - threadStart(); - } - - return "0:45"; - } - else if (sec < 3590) - { - sec = 3600; - if (active==false) - { - active = true; - threadStart(); - } - - return "1:00"; - } - else if (sec < 4490) - { - sec = 4500; - if (active==false) - { - active = true; - threadStart(); - } - - return "1:15"; - } - else if (sec < 5390) - { - sec = 5400; - if (active==false) - { - active = true; - threadStart(); - } - - return "1:30"; - } - else if (sec < 6290) - { - sec = 6300; - if (active==false) - { - active = true; - threadStart(); - } - - return "1:45"; - } - else if (sec < 7190) - { - sec = 7200; - if (active==false) - { - active = true; - threadStart(); - } - - return "2:00"; - - } - else - { - sec = -1; - if (active==true) - shutdown(); - return "AUS"; - } - + if (sec < 890) + { + sec = 900; + if (active == false) + { + active = true; + threadStart(); + } + + return "0:15"; + } + else if (sec <1790) + { + sec = 1800; + if (active == false) + { + active = true; + threadStart(); + } + + return "0:30"; + } + else if (sec < 2690) + { + sec = 2700; + if (active==false) + { + active = true; + threadStart(); + } + + return "0:45"; + } + else if (sec < 3590) + { + sec = 3600; + if (active==false) + { + active = true; + threadStart(); + } + + return "1:00"; + } + else if (sec < 4490) + { + sec = 4500; + if (active==false) + { + active = true; + threadStart(); + } + + return "1:15"; + } + else if (sec < 5390) + { + sec = 5400; + if (active==false) + { + active = true; + threadStart(); + } + + return "1:30"; + } + else if (sec < 6290) + { + sec = 6300; + if (active==false) + { + active = true; + threadStart(); + } + + return "1:45"; + } + else if (sec < 7190) + { + sec = 7200; + if (active==false) + { + active = true; + threadStart(); + } + + return "2:00"; + + } + else + { + sec = -1; + if (active==true) + shutdown(); + return "AUS"; + } } Sleeptimer* Sleeptimer::getInstance() { - return instance; + return instance; } void Sleeptimer::threadMethod() { - - while (sec>-1 && active==true) - { - sec--; - if (sec<31 && sec>-1) - { - VCountdown* count = new VCountdown(); - char* temp = (char*)malloc(20); - sprintf(temp, "0:%02d", sec); - count->drawClock(temp); - free(temp); - Message* m1 = new Message(); - m1->message = Message::ADD_VIEW; - m1->to = BoxStack::getInstance(); - m1->parameter.num = (ULONG)count; - MessageQueue::getInstance()->postMessageNoLock(m1); - } - MILLISLEEP(1000); - - - if (sec==-1) - { - Message* m2 = new Message(); // Delete self - m2->message = Message::UDP_BUTTON; - m2->to = Command::getInstance(); - m2->from = this; - m2->parameter.num = 61; - MessageQueue::getInstance()->postMessageFromOuterSpace(m2); - shutdown(); - } - - } - - + while (sec>-1 && active==true) + { + sec--; + if (sec<31 && sec>-1) + { + VCountdown* count = new VCountdown(); + char temp[20]; + sprintf(temp, "0:%02d", sec); + count->drawClock(temp); + + Message* m1 = new Message(); + m1->message = Message::ADD_VIEW; + m1->to = BoxStack::getInstance(); + m1->parameter = (ULONG)count; + MessageQueue::getInstance()->postMessageNoLock(m1); + } + MILLISLEEP(1000); + + if (sec == -1) + { + Message* m2 = new Message(); // Delete self + m2->message = Message::UDP_BUTTON; + m2->to = Command::getInstance(); + m2->from = this; + m2->parameter = 61; // FIXME use constant name when they're sorted out + MessageQueue::getInstance()->postMessageFromOuterSpace(m2); + shutdown(); + } + } } void Sleeptimer::shutdown() { - if (active==true) - { - sec=-1; - threadCancel(); - active = false; - } - + if (active) + { + sec = -1; + threadCancel(); + active = false; + } } @@ -224,16 +212,16 @@ VSleeptimer::~VSleeptimer() void VSleeptimer::draw() { - fillColour(DrawStyle::VIEWBACKGROUND); - WSymbol w; - TEMPADD(&w); - w.nextSymbol = WSymbol::CLOCK; - w.setPosition(3, 0); - w.draw(); + fillColour(DrawStyle::VIEWBACKGROUND); + WSymbol w; + TEMPADD(&w); + w.nextSymbol = WSymbol::CLOCK; + w.setPosition(3, 0); + w.draw(); - Boxx::draw(); - drawText(displaySleeptimer,50,2,DrawStyle::LIGHTTEXT); - Timers::getInstance()->setTimerD(this, 1, 2); + Boxx::draw(); + drawText(displaySleeptimer,50,2,DrawStyle::LIGHTTEXT); + Timers::getInstance()->setTimerD(this, 1, 2); } void VSleeptimer::timercall(int clientReference) @@ -290,18 +278,17 @@ VCountdown::~VCountdown() void VCountdown::drawClock(const char* sec) { - - fillColour(DrawStyle::VIEWBACKGROUND); - WSymbol w; - TEMPADD(&w); - w.nextSymbol = WSymbol::CLOCK; - w.nextColour = DrawStyle::RED; - w.setPosition(3, 0); - w.draw(); - - Boxx::draw(); - drawText(sec,50,2,DrawStyle::RED); - Timers::getInstance()->setTimerD(this, 1, 1); + fillColour(DrawStyle::VIEWBACKGROUND); + WSymbol w; + TEMPADD(&w); + w.nextSymbol = WSymbol::CLOCK; + w.nextColour = DrawStyle::RED; + w.setPosition(3, 0); + w.draw(); + + Boxx::draw(); + drawText(sec, 50, 2, DrawStyle::RED); + Timers::getInstance()->setTimerD(this, 1, 1); } void VCountdown::timercall(int clientReference) diff --git a/vsleeptimer.h b/vsleeptimer.h index d8f7808..4a87beb 100644 --- a/vsleeptimer.h +++ b/vsleeptimer.h @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with VOMP; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + along with VOMP. If not, see . */ #ifndef VSLEEPTIMER_H @@ -40,17 +39,12 @@ class Sleeptimer : public Thread_TYPE virtual void threadPostStopCleanup() {}; private: - int sec; - bool active; + int sec{-1}; + bool active{}; static Sleeptimer* instance; - - - }; - - class VSleeptimer : public Boxx, public TimerReceiver { public: @@ -61,22 +55,16 @@ class VSleeptimer : public Boxx, public TimerReceiver void timercall(int clientReference); private: - const char* displaySleeptimer; - + const char* displaySleeptimer; }; class VCountdown : public Boxx, public TimerReceiver { - - public: - VCountdown(); - ~VCountdown(); - void drawClock(const char* sec); - void timercall(int clientReference); - -} -; - + public: + VCountdown(); + ~VCountdown(); + void drawClock(const char* sec); + void timercall(int clientReference); +}; #endif - diff --git a/vtimeredit.cc b/vtimeredit.cc index 47e0540..7031902 100644 --- a/vtimeredit.cc +++ b/vtimeredit.cc @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with VOMP; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + along with VOMP. If not, see . */ #include "vtimeredit.h" @@ -29,7 +28,7 @@ #include "i18n.h" #include "timers.h" #include "vquestion.h" -#include "command.h" +#include "messagequeue.h" #include "staticartwork.h" VTimerEdit::VTimerEdit(RecTimer* trt) @@ -240,8 +239,8 @@ void VTimerEdit::processMessage(Message* m) { if (m->message == Message::MOUSE_MOVE) { - int x=(m->parameter.num>>16)-getScreenX(); - int y=(m->parameter.num&0xFFFF)-getScreenY(); + int x=(m->parameter>>16)-getScreenX(); + int y=(m->parameter&0xFFFF)-getScreenY(); if (buttonBack.mouseMove(x,y)) { selectedButton=0; buttonDelete.setActive(false); @@ -268,13 +267,13 @@ void VTimerEdit::processMessage(Message* m) m2->from = this; m2->to = BoxStack::getInstance(); m2->message = Message::CLOSE_ME; - Command::getInstance()->postMessageNoLock(m2); + MessageQueue::getInstance()->postMessageNoLock(m2); m2 = new Message(); // OK. Want this to delete before this message does its job m2->from = this; m2->to = vTimerList; m2->message = Message::DELETE_SELECTED_TIMER; - Command::getInstance()->postMessageNoLock(m2); + MessageQueue::getInstance()->postMessageNoLock(m2); } } } diff --git a/vtimeredit.h b/vtimeredit.h index 29f500a..9f230aa 100644 --- a/vtimeredit.h +++ b/vtimeredit.h @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with VOMP; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + along with VOMP. If not, see . */ #ifndef VTIMEREDIT_H diff --git a/vtimerlist.cc b/vtimerlist.cc index 76d1280..2a4f65d 100644 --- a/vtimerlist.cc +++ b/vtimerlist.cc @@ -322,7 +322,7 @@ void VTimerList::processMessage(Message* m) { if (m->message == Message::MOUSE_MOVE) { - if (sl.mouseMove((m->parameter.num>>16)-getScreenX(),(m->parameter.num&0xFFFF)-getScreenY())) + if (sl.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { quickUpdate(); BoxStack::getInstance()->update(this); @@ -330,15 +330,15 @@ void VTimerList::processMessage(Message* m) } else if (m->message == Message::MOUSE_LBDOWN) { - if (sl.mouseLBDOWN((m->parameter.num>>16)-getScreenX(),(m->parameter.num&0xFFFF)-getScreenY())) + if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { BoxStack::getInstance()->handleCommand(Remote::OK); //simulate OK press } else { //check if press is outside this view! then simulate cancel - int x=(m->parameter.num>>16)-getScreenX(); - int y=(m->parameter.num&0xFFFF)-getScreenY(); + int x=(m->parameter>>16)-getScreenX(); + int y=(m->parameter&0xFFFF)-getScreenY(); if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight()) { BoxStack::getInstance()->handleCommand(Remote::BACK); //simulate cancel press diff --git a/vvideolivetv.cc b/vvideolivetv.cc index 94a9e56..b8cab9d 100644 --- a/vvideolivetv.cc +++ b/vvideolivetv.cc @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with VOMP; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + along with VOMP. If not, see . */ #include "vvideolivetv.h" @@ -46,6 +45,7 @@ #include "vepglistadvanced.h" #include "staticartwork.h" #include "demuxer.h" +#include "messagequeue.h" #include @@ -872,9 +872,9 @@ void VVideoLiveTV::timercall(int ref) Message* m = new Message(); m->message = Message::CHANNEL_CHANGE; m->to = this; - m->parameter.num = newChannel; + m->parameter = newChannel; m->tag = 1; // signal to call displayOSD(); - Command::getInstance()->postMessageFromOuterSpace(m); + MessageQueue::getInstance()->postMessageFromOuterSpace(m); Log::getInstance()->log("VVideoLiveTV", Log::DEBUG, "Timer Call 1 key end."); } else @@ -1025,8 +1025,8 @@ void VVideoLiveTV::processMessage(Message* m) if (m->message == Message::MOUSE_LBDOWN) { //check if press is outside this view! then simulate cancel - int x = (m->parameter.num >> 16) - osd.getScreenX(); - int y = (m->parameter.num & 0xFFFF) - osd.getScreenY(); + int x = (m->parameter >> 16) - osd.getScreenX(); + int y = (m->parameter & 0xFFFF) - osd.getScreenY(); if (osd.getVisible()) { if ((boxRed.getX()<=x) && (boxRed.getX()+(int)boxRed.getWidth()>=x ) && @@ -1060,7 +1060,7 @@ void VVideoLiveTV::processMessage(Message* m) } else if (m->message == Message::CHANNEL_CHANGE) { - channelChange(NUMBER, m->parameter.num); + channelChange(NUMBER, m->parameter); osdChannelIndex = currentChannelIndex; if (m->tag == 1) displayOSD(true); } @@ -1074,14 +1074,14 @@ void VVideoLiveTV::processMessage(Message* m) } else if (m->message == Message::AUDIO_CHANGE_CHANNEL) { - Log::getInstance()->log("VVideoLiveTV", Log::DEBUG, "Received change audio channel to %x", m->parameter.num); - player->setAudioChannel((m->parameter.num & 0xFFFF), (m->parameter.num & 0xFF0000) >> 16, (m->parameter.num & 0xFF000000) >> 24); + Log::getInstance()->log("VVideoLiveTV", Log::DEBUG, "Received change audio channel to %x", m->parameter); + player->setAudioChannel((m->parameter & 0xFFFF), (m->parameter & 0xFF0000) >> 16, (m->parameter & 0xFF000000) >> 24); } else if (m->message == Message::SUBTITLE_CHANGE_CHANNEL) { if (streamType != VDR::VIDEO) return; - Log::getInstance()->log("VVideoLiveTV", Log::DEBUG, "Received change subtitle channel to %x", m->parameter.num); - int type = (m->parameter.num & 0xFF0000) >> 16; + Log::getInstance()->log("VVideoLiveTV", Log::DEBUG, "Received change subtitle channel to %x", m->parameter); + int type = (m->parameter & 0xFF0000) >> 16; switch (type) { case 0x10: @@ -1089,7 +1089,7 @@ void VVideoLiveTV::processMessage(Message* m) //dvbsubtitle if (streamType == VDR::VIDEO) { - player->setSubtitleChannel((m->parameter.num & 0xFFFF)); + player->setSubtitleChannel((m->parameter & 0xFFFF)); (static_cast(player))->turnSubtitlesOn(true); VTeletextView *vtxt=((PlayerLiveTV*)player)->getTeletextDecoder()->getTeletxtView(); if (vtxt && vtxt->isInSubtitleMode()) @@ -1113,7 +1113,7 @@ void VVideoLiveTV::processMessage(Message* m) { //videotext (static_cast(player))->turnSubtitlesOn(false); doTeletext(true); - ((PlayerLiveTV*)player)->getTeletextDecoder()->setPage((m->parameter.num & 0xFFFF)); + ((PlayerLiveTV*)player)->getTeletextDecoder()->setPage((m->parameter & 0xFFFF)); } break; }; @@ -1126,7 +1126,7 @@ void VVideoLiveTV::processMessage(Message* m) } else if (m->message == Message::PLAYER_EVENT) { - switch (m->parameter.num) + switch (m->parameter) { case PlayerLiveTV::CONNECTION_LOST: // connection lost detected { diff --git a/vvideomedia.cc b/vvideomedia.cc index 7477f0e..04e17e7 100644 --- a/vvideomedia.cc +++ b/vvideomedia.cc @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with VOMP; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + along with VOMP. If not, see . */ #include "vvideomedia.h" @@ -39,6 +38,7 @@ #include "i18n.h" #include "log.h" #include "recinfo.h" +#include "messagequeue.h" //use the picture channel #define MEDIACHANNEL 1 @@ -175,7 +175,7 @@ void VVideoMedia::go(bool resume) m->message = Message::CLOSE_ME; m->from = this; m->to = boxstack; - Command::getInstance()->postMessageNoLock(m); + MessageQueue::getInstance()->postMessageNoLock(m); VInfo* vi = new VInfo(); vi->setSize(400, 150); @@ -193,8 +193,8 @@ void VVideoMedia::go(bool resume) m = new Message(); m->message = Message::ADD_VIEW; m->to = boxstack; - m->parameter.num = (ULONG)vi; - Command::getInstance()->postMessageNoLock(m); + m->parameter = (ULONG)vi; + MessageQueue::getInstance()->postMessageNoLock(m); } } @@ -335,8 +335,8 @@ void VVideoMedia::processMessage(Message* m) if (m->message == Message::MOUSE_LBDOWN) { - UINT x = (m->parameter.num>>16) - getScreenX(); - UINT y = (m->parameter.num&0xFFFF) - getScreenY(); + UINT x = (m->parameter>>16) - getScreenX(); + UINT y = (m->parameter&0xFFFF) - getScreenY(); if (!barShowing) { @@ -366,7 +366,7 @@ void VVideoMedia::processMessage(Message* m) } else if (m->message == Message::PLAYER_EVENT) { - switch(m->parameter.num) + switch(m->parameter) { case PlayerMedia::CONNECTION_LOST: // connection lost detected { @@ -374,7 +374,7 @@ void VVideoMedia::processMessage(Message* m) Message* m2 = new Message(); m2->to = Command::getInstance(); m2->message = Message::CONNECTION_LOST; - Command::getInstance()->postMessageNoLock(m2); + MessageQueue::getInstance()->postMessageNoLock(m2); break; } case PlayerMedia::STREAM_END: @@ -382,7 +382,7 @@ void VVideoMedia::processMessage(Message* m) Message* m2 = new Message(); // Must be done after this thread finishes, and must break into master mutex m2->to = BoxStack::getInstance(); m2->message = Message::CLOSE_ME; - Command::getInstance()->postMessageNoLock(m2); + MessageQueue::getInstance()->postMessageNoLock(m2); break; } case PlayerMedia::STATUS_CHANGE: @@ -429,7 +429,7 @@ void VVideoMedia::processMessage(Message* m) else if (m->message == Message::AUDIO_CHANGE_CHANNEL) { Log::getInstance()->log("VVideoMedia", Log::DEBUG, "Received change audio channel to %i", m->parameter); - player->setAudioChannel(m->parameter.num); + player->setAudioChannel(m->parameter); } else if (m->message == Message::CHILD_CLOSE) { @@ -584,8 +584,8 @@ void VVideoMedia::timercall(int clientReference) m->message=Message::PLAYER_EVENT; m->to=this; m->from=this; - m->parameter.num=PLAYER_TIMER_BASE+clientReference; - Command::getInstance()->postMessageFromOuterSpace(m); + m->parameter=PLAYER_TIMER_BASE+clientReference; + MessageQueue::getInstance()->postMessageFromOuterSpace(m); } void VVideoMedia::drawBarClocks() diff --git a/vvideorec.cc b/vvideorec.cc index 6acb8b4..2a71f15 100644 --- a/vvideorec.cc +++ b/vvideorec.cc @@ -40,6 +40,7 @@ #include "log.h" #include "channel.h" #include "vteletextview.h" +#include "messagequeue.h" #include "vvideorec.h" VVideoRec::VVideoRec(Recording* rec, bool ish264) @@ -195,7 +196,7 @@ void VVideoRec::go(bool resume) m->message = Message::CLOSE_ME; m->from = this; m->to = boxstack; - Command::getInstance()->postMessageNoLock(m); + MessageQueue::getInstance()->postMessageNoLock(m); VInfo* vi = new VInfo(); vi->setSize(360, 200); @@ -214,8 +215,8 @@ void VVideoRec::go(bool resume) m = new Message(); m->message = Message::ADD_VIEW; m->to = boxstack; - m->parameter.num = (ULONG)vi; - Command::getInstance()->postMessageNoLock(m); + m->parameter = (ULONG)vi; + MessageQueue::getInstance()->postMessageNoLock(m); } } @@ -452,8 +453,8 @@ void VVideoRec::processMessage(Message* m) if (m->message == Message::MOUSE_LBDOWN) { - UINT x = (m->parameter.num>>16) - getScreenX(); - UINT y = (m->parameter.num&0xFFFF) - getScreenY(); + UINT x = (m->parameter>>16) - getScreenX(); + UINT y = (m->parameter&0xFFFF) - getScreenY(); if (!barShowing) { @@ -521,7 +522,7 @@ void VVideoRec::processMessage(Message* m) else if (m->from == player) { if (m->message != Message::PLAYER_EVENT) return; - switch(m->parameter.num) + switch(m->parameter) { case Player::CONNECTION_LOST: // connection lost detected { @@ -529,7 +530,7 @@ void VVideoRec::processMessage(Message* m) Message* m2 = new Message(); m2->to = Command::getInstance(); m2->message = Message::CONNECTION_LOST; - Command::getInstance()->postMessageNoLock(m2); + MessageQueue::getInstance()->postMessageNoLock(m2); break; } case Player::STOP_PLAYBACK: @@ -538,7 +539,7 @@ void VVideoRec::processMessage(Message* m) Message* m2 = new Message(); // Must be done after this thread finishes, and must break into master mutex m2->to = Command::getInstance(); m2->message = Message::STOP_PLAYBACK; - Command::getInstance()->postMessageNoLock(m2); + MessageQueue::getInstance()->postMessageNoLock(m2); break; } case Player::ASPECT43: @@ -553,16 +554,16 @@ void VVideoRec::processMessage(Message* m) } else if (m->message == Message::AUDIO_CHANGE_CHANNEL) { - Log::getInstance()->log("VVideoRec", Log::DEBUG, "Received change audio channel to %i", m->parameter.num); - player->setAudioChannel(m->parameter.num&0xFFFF,(m->parameter.num&0xFF0000)>> 16,(m->parameter.num&0xFF000000)>> 24 ); + Log::getInstance()->log("VVideoRec", Log::DEBUG, "Received change audio channel to %i", m->parameter); + player->setAudioChannel(m->parameter&0xFFFF,(m->parameter&0xFF0000)>> 16,(m->parameter&0xFF000000)>> 24 ); } else if (m->message == Message::SUBTITLE_CHANGE_CHANNEL) { - Log::getInstance()->log("VVideoRec", Log::DEBUG, "Received change subtitle channel to %i", m->parameter.num); - int type=((m->parameter.num & 0xFF0000)>>16); + Log::getInstance()->log("VVideoRec", Log::DEBUG, "Received change subtitle channel to %i", m->parameter); + int type=((m->parameter & 0xFF0000)>>16); switch (type) { case 0x10: { //dvbsubtitle - player->setSubtitleChannel((m->parameter.num & 0xFFFF)); + player->setSubtitleChannel((m->parameter & 0xFFFF)); player->turnSubtitlesOn(true); VTeletextView *vtxt=((Player*)player)->getTeletextDecoder()->getTeletxtView(); if (vtxt && vtxt->isInSubtitleMode()) { @@ -581,7 +582,7 @@ void VVideoRec::processMessage(Message* m) case 0x11: { //videotext player->turnSubtitlesOn(false); doTeletext(); - ((Player*)player)->getTeletextDecoder()->setPage((m->parameter.num & 0xFFFF)); + ((Player*)player)->getTeletextDecoder()->setPage((m->parameter & 0xFFFF)); } break; }; if (vas) { diff --git a/vwelcome.cc b/vwelcome.cc index adec7d7..d995e4a 100644 --- a/vwelcome.cc +++ b/vwelcome.cc @@ -398,7 +398,7 @@ void VWelcome::processMessage(Message* m) { if (m->message == Message::MOUSE_MOVE) { - if (sl.mouseMove((m->parameter.num>>16)-getScreenX(),(m->parameter.num&0xFFFF)-getScreenY())) + if (sl.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { sl.draw(); boxstack->update(this); @@ -406,7 +406,7 @@ void VWelcome::processMessage(Message* m) } else if (m->message == Message::MOUSE_LBDOWN) { - if (sl.mouseLBDOWN((m->parameter.num>>16)-getScreenX(),(m->parameter.num&0xFFFF)-getScreenY())) + if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { boxstack->handleCommand(Remote::OK); //simulate OK press } diff --git a/winmain.cc b/winmain.cc index e06cb43..3dbc7fb 100644 --- a/winmain.cc +++ b/winmain.cc @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with VOMP; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + along with VOMP. If not, see . */ #ifdef WIN32 #include @@ -47,6 +46,7 @@ #include "command.h" #include "wol.h" #include "vsleeptimer.h" +#include "messagequeue.h" void sighandler(int signalReceived); void shutdown(int code); @@ -85,6 +85,8 @@ REGISTERRAWINPUTDEVICEFNC dynRegisterRawInputDevices=NULL; DWORD lastmousemove; +MessageQueue* messageQueue; + void MILLISLEEP(ULONG a) { @@ -176,6 +178,8 @@ INT WINAPI WinMain( HINSTANCE hinst , HINSTANCE previnst, LPSTR cmdline, int cmd return 0; } + messageQueue = command; + // Get logging module started -------------------------------------------------------------------------------------- if (!logger->init(Log::DEBUG, "vompwin.log", true)) @@ -682,10 +686,10 @@ LONG FAR PASCAL WindowProc(HWND wind, UINT msg, WPARAM wparam, LPARAM lparam) mousemes->message=Message::MOUSE_MOVE; mousemes->from=NULL; mousemes->to=BoxStack::getInstance(); - mousemes->parameter.num=(mpos.x & 0xFFFF)<< 16| (mpos.y & 0xFFFF); + mousemes->parameter=(mpos.x & 0xFFFF)<< 16| (mpos.y & 0xFFFF); mousemes->tag=0; //command->postMessageFromOuterSpace(mousemes); - command->postMessageIfNotBusy(mousemes); + messageQueue->postMessageIfNotBusy(mousemes); } return 0; @@ -715,9 +719,9 @@ LONG FAR PASCAL WindowProc(HWND wind, UINT msg, WPARAM wparam, LPARAM lparam) mousemes->message=Message::MOUSE_LBDOWN; mousemes->from=NULL; mousemes->to=BoxStack::getInstance(); - mousemes->parameter.num=(mpos.x & 0xFFFF)<< 16| (mpos.y & 0xFFFF); + mousemes->parameter=(mpos.x & 0xFFFF)<< 16| (mpos.y & 0xFFFF); mousemes->tag=0; - command->postMessageFromOuterSpace(mousemes); + messageQueue->postMessageFromOuterSpace(mousemes); } }break; case WM_MOUSEWHEEL:{ @@ -728,9 +732,9 @@ LONG FAR PASCAL WindowProc(HWND wind, UINT msg, WPARAM wparam, LPARAM lparam) mousemes->message = Message::MOUSE_SCROLL; mousemes->from = NULL; mousemes->to = BoxStack::getInstance(); - mousemes->parameter.num = (0 & 0xFFFF) << 16 | (GET_WHEEL_DELTA_WPARAM(wparam) &0xFFFF); + mousemes->parameter = (0 & 0xFFFF) << 16 | (GET_WHEEL_DELTA_WPARAM(wparam) &0xFFFF); mousemes->tag = (mpos.x & 0xFFFF) << 16 | (mpos.y & 0xFFFF); - command->postMessageFromOuterSpace(mousemes); + messageQueue->postMessageFromOuterSpace(mousemes); } } break; diff --git a/wremoteconfig.cc b/wremoteconfig.cc index f982b7f..f934754 100644 --- a/wremoteconfig.cc +++ b/wremoteconfig.cc @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with VOMP; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + along with VOMP. If not, see . */ #include "wremoteconfig.h" @@ -160,7 +159,7 @@ void WRemoteConfig::doSave() m->message = Message::CHANGED_REMOTECONTROL; m->to = parent; m->parameter = 0; - Command::getInstance()->postMessageNoLock(m); + //Command::getInstance()->postMessageNoLock(m); } */ @@ -238,7 +237,7 @@ int WRemoteConfig::handleCommand(int command) m->message = Message::CLOSE_ME; m->from = this; m->to = viewman; - Command::getInstance()->postMessageNoLock(m); + //Command::getInstance()->postMessageNoLock(m); return 2; */ } diff --git a/wwinaudiofilter.cc b/wwinaudiofilter.cc index 126d93f..1552f31 100644 --- a/wwinaudiofilter.cc +++ b/wwinaudiofilter.cc @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with VOMP; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + along with VOMP. If not, see . */ #include "wwinaudiofilter.h" @@ -171,7 +170,7 @@ void WWinAudioFilter::doSave() m->message = Message::CHANGED_DEVICEOPTIONS; m->to = parent; m->parameter = 0; - Command::getInstance()->postMessageNoLock(m); + //Command::getInstance()->postMessageNoLock(m); }*/ diff --git a/wwinmp3audiofilter.cc b/wwinmp3audiofilter.cc index 891f05e..3cda108 100644 --- a/wwinmp3audiofilter.cc +++ b/wwinmp3audiofilter.cc @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with VOMP; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + along with VOMP. If not, see . */ #include "wwinmp3audiofilter.h" @@ -179,7 +178,7 @@ void WWinMp3AudioFilter::processMessage(Message* m) m->message = Message::CHANGED_DEVICEOPTIONS; m->to = parent; m->parameter = 0; - Command::getInstance()->postMessageNoLock(m); + //Command::getInstance()->postMessageNoLock(m); }*/ diff --git a/wwinvideofilter.cc b/wwinvideofilter.cc index 718b9fa..b6b16b0 100644 --- a/wwinvideofilter.cc +++ b/wwinvideofilter.cc @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with VOMP; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + along with VOMP. If not, see . */ #include "wwinvideofilter.h" @@ -171,7 +170,7 @@ void WWinVideoFilter::doSave() m->message = Message::CHANGED_DEVICEOPTIONS; m->to = parent; m->parameter = 0; - Command::getInstance()->postMessageNoLock(m); + //Command::getInstance()->postMessageNoLock(m); }*/ diff --git a/wwinvideoh264filter.cc b/wwinvideoh264filter.cc index 401fb1f..a18f9ad 100644 --- a/wwinvideoh264filter.cc +++ b/wwinvideoh264filter.cc @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with VOMP; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + along with VOMP. If not, see . */ #include "wwinvideoh264filter.h" @@ -171,7 +170,7 @@ void WWinVideoH264Filter::doSave() m->message = Message::CHANGED_DEVICEOPTIONS; m->to = parent; m->parameter = 0; - Command::getInstance()->postMessageNoLock(m); + //Command::getInstance()->postMessageNoLock(m); }*/ -- 2.39.5