]> git.vomp.tv Git - vompclient-marten.git/commitdiff
Portability
authorChris Tallon <chris@vomp.tv>
Sun, 26 Mar 2006 17:03:18 +0000 (17:03 +0000)
committerChris Tallon <chris@vomp.tv>
Sun, 26 Mar 2006 17:03:18 +0000 (17:03 +0000)
Makefile
main.cc
mtd.cc
mtd.h
mtdmvp.cc [new file with mode: 0644]
mtdmvp.h [new file with mode: 0644]
mtdwin.cc [new file with mode: 0644]
mtdwin.h [new file with mode: 0644]

index a731f69320d83d4f8abc2435feb891a0ab5216fa..eef915820f38586b30045e102d3762126ca8e0f5 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -25,11 +25,12 @@ OBJECTS1 = main.o command.o log.o tcp.o dsock.o thread.o timers.o i18n.o
 
 OBJECTS2 = remote.o led.o mtd.o video.o audio.o osd.o surface.o                        \
            remotemvp.o remotewin.o                                                     \
-           audiomvp.o audiowin.o                                                       \
+           ledmvp.o ledwin.o                                                           \
+           mtdmvp.o mtdwin.o                                                           \
            videomvp.o videowin.o                                                       \
+           audiomvp.o audiowin.o                                                       \
            osdmvp.o osdwin.o                                                           \
-           surfacemvp.o surfacewin.o                                                   \
-           ledmvp.o ledwin.o
+           surfacemvp.o surfacewin.o
 
 OBJECTS = $(OBJECTS1) $(OBJECTS2)
 
diff --git a/main.cc b/main.cc
index e9024a64415236da9f9efd45a754711185e578de..53c629bda21703ae607763b23cc00207515c8018 100644 (file)
--- a/main.cc
+++ b/main.cc
 
 #include "defines.h"
 #include "log.h"
-#include "mtd.h"
 #include "timers.h"
 #include "vdr.h"
 #include "viewman.h"
 #include "command.h"
 
 #ifdef WIN32
+  #include "mtdwin.h"
   #include "remotewin.h"
   #include "ledwin.h"
   #include "osdwin.h"
   #include "audiowin.h"
   #include "videowin.h"
 #else
+  #include "mtdmvp.h"
   #include "remotemvp.h"
   #include "ledmvp.h"
   #include "osdmvp.h"
@@ -72,16 +73,17 @@ int main(int argc, char** argv)
   // Init global vars ------------------------------------------------------------------------------------------------
 
   logger     = new Log();
-  mtd        = new Mtd();
   timers     = new Timers();
   vdr        = new VDR();
 #ifdef WIN32
+  mtd        = new MtdWin();
   remote     = new RemoteWin();
   led        = new LedWin();
   osd        = new OsdWin();
   audio      = new AudioWin();
   video      = new VideoWin();
 #else
+  mtd        = new MtdMVP();
   remote     = new RemoteMVP();
   led        = new LedMVP();
   osd        = new OsdMVP();
diff --git a/mtd.cc b/mtd.cc
index 100097e0e8787407a1f0b4e3ec87e25e956df22c..f4434dfaf79ca2f12cec5efaf19e2be59211cf49 100644 (file)
--- a/mtd.cc
+++ b/mtd.cc
@@ -26,7 +26,6 @@ Mtd::Mtd()
 {
   if (instance) return;
   instance = this;
-  initted = 0;
 }
 
 Mtd::~Mtd()
@@ -38,90 +37,3 @@ Mtd* Mtd::getInstance()
 {
   return instance;
 }
-
-int Mtd::init(char* device)
-{
-  if (initted) return 0;
-  initted = 1;
-
-  int fd;
-
-  if ((fd = open(device, O_RDONLY)) < 0)
-  {
-    initted = 0;
-    return 0;
-  }
-
-  if (read(fd, data, 8192) < 8192)
-  {
-    initted = 0;
-    return 0;
-  }
-
-  close(fd);
-
-  logit();
-
-  return 1;
-}
-
-int Mtd::shutdown()
-{
-  if (!initted) return 0;
-  initted = 0;
-  return 1;
-}
-
-short Mtd::getPALorNTSC()
-{
-  return data[2119];
-}
-
-short Mtd::getAspect()
-{
-  return data[2125];
-}
-
-short Mtd::getFlicker()
-{
-  return data[2124];
-}
-
-short Mtd::getBootLogoOutput()
-{
-  return data[2116];
-}
-
-short Mtd::getBootLogoDisplayVideoLeft()
-{
-  return data[2120];
-}
-
-short Mtd::getBootLogoDisplayVideoUpper()
-{
-  return data[2121];
-}
-
-short Mtd::getBootLogoDisplayVideoWidth()
-{
-  return data[2122];
-}
-
-short Mtd::getBootLogoDisplayVideoHeight()
-{
-  return data[2123];
-}
-
-void Mtd::logit()
-{
-  Log* logger = Log::getInstance();
-
-  logger->log("MTD", Log::DEBUG, "Mode: %i", getPALorNTSC());
-  logger->log("MTD", Log::DEBUG, "Aspect: %i", getAspect());
-  logger->log("MTD", Log::DEBUG, "Flicker: %i", getFlicker());
-  logger->log("MTD", Log::DEBUG, "Bootlogo output: %i", getBootLogoOutput());
-  logger->log("MTD", Log::DEBUG, "Bootlogo display video left: %i", getBootLogoDisplayVideoLeft());
-  logger->log("MTD", Log::DEBUG, "Bootlogo display video upper: %i", getBootLogoDisplayVideoUpper());
-  logger->log("MTD", Log::DEBUG, "Bootlogo display video width: %i", getBootLogoDisplayVideoWidth());
-  logger->log("MTD", Log::DEBUG, "Bootlogo display video height: %i", getBootLogoDisplayVideoHeight());
-}
diff --git a/mtd.h b/mtd.h
index aca0b9f05ba181cb1c2093d2a41c01f15c0d9fe4..0ab774970711abad4b6441f6102c82f3ac46cfd3 100644 (file)
--- a/mtd.h
+++ b/mtd.h
     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
 
-// Information for this class taken from the mvpmc project - thanks
-
-/*
- discussion on short positions:
- http://www.shspvr.com/smf/index.php?topic=3765.30
-
-It says:
-1 = NTSC/composite
-2 = PAL/Scart
-3 = PAL/Composite
-
-But with PAL/Scart/RGB I get a value of 1
-
-So, am assuming:
-0 = NTSC / composite
-1 = PAL / scart rgb
-2 = PAL / scart composite
-*/
-
 #ifndef MTD_H
 #define MTD_H
 
-#include <unistd.h>
-#include <fcntl.h>
-
-#include "log.h"
+#include <stdio.h>
 
 class Mtd
 {
   public:
     Mtd();
-    ~Mtd();
+    virtual ~Mtd();
     static Mtd* getInstance();
 
-    int init(char* device);
-    int shutdown();
+    virtual int init(char* device)=0;
+    virtual int shutdown()=0;
 
-    short getPALorNTSC();
-    short getAspect();
-    short getFlicker();
-    short getBootLogoOutput();
-    short getBootLogoDisplayVideoLeft();
-    short getBootLogoDisplayVideoUpper();
-    short getBootLogoDisplayVideoWidth();
-    short getBootLogoDisplayVideoHeight();
+    virtual short getPALorNTSC()=0;
 
-    void logit();
-
-  private:
+  protected:
     static Mtd* instance;
-    int initted;
-
-    short data[4096];
 };
 
 #endif
diff --git a/mtdmvp.cc b/mtdmvp.cc
new file mode 100644 (file)
index 0000000..c801710
--- /dev/null
+++ b/mtdmvp.cc
@@ -0,0 +1,120 @@
+/*
+    Copyright 2004-2005 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, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+#include "mtdmvp.h"
+
+MtdMVP::MtdMVP()
+{
+  if (instance) return;
+  initted = 0;
+}
+
+MtdMVP::~MtdMVP()
+{
+}
+
+int MtdMVP::init(char* device)
+{
+  if (initted) return 0;
+  initted = 1;
+
+  int fd;
+
+  if ((fd = open(device, O_RDONLY)) < 0)
+  {
+    initted = 0;
+    return 0;
+  }
+
+  if (read(fd, data, 8192) < 8192)
+  {
+    initted = 0;
+    return 0;
+  }
+
+  close(fd);
+
+  //logit();
+
+  return 1;
+}
+
+int MtdMVP::shutdown()
+{
+  if (!initted) return 0;
+  initted = 0;
+  return 1;
+}
+
+short MtdMVP::getPALorNTSC()
+{
+  return data[2119];
+}
+
+/*
+short MtdMVP::getAspect()
+{
+  return data[2125];
+}
+
+short MtdMVP::getFlicker()
+{
+  return data[2124];
+}
+
+short MtdMVP::getBootLogoOutput()
+{
+  return data[2116];
+}
+
+short MtdMVP::getBootLogoDisplayVideoLeft()
+{
+  return data[2120];
+}
+
+short MtdMVP::getBootLogoDisplayVideoUpper()
+{
+  return data[2121];
+}
+
+short MtdMVP::getBootLogoDisplayVideoWidth()
+{
+  return data[2122];
+}
+
+short MtdMVP::getBootLogoDisplayVideoHeight()
+{
+  return data[2123];
+}
+
+void MtdMVP::logit()
+{
+  Log* logger = Log::getInstance();
+
+  logger->log("MTD", Log::DEBUG, "Mode: %i", getPALorNTSC());
+  logger->log("MTD", Log::DEBUG, "Aspect: %i", getAspect());
+  logger->log("MTD", Log::DEBUG, "Flicker: %i", getFlicker());
+  logger->log("MTD", Log::DEBUG, "Bootlogo output: %i", getBootLogoOutput());
+  logger->log("MTD", Log::DEBUG, "Bootlogo display video left: %i", getBootLogoDisplayVideoLeft());
+  logger->log("MTD", Log::DEBUG, "Bootlogo display video upper: %i", getBootLogoDisplayVideoUpper());
+  logger->log("MTD", Log::DEBUG, "Bootlogo display video width: %i", getBootLogoDisplayVideoWidth());
+  logger->log("MTD", Log::DEBUG, "Bootlogo display video height: %i", getBootLogoDisplayVideoHeight());
+}
+*/
diff --git a/mtdmvp.h b/mtdmvp.h
new file mode 100644 (file)
index 0000000..8b110d3
--- /dev/null
+++ b/mtdmvp.h
@@ -0,0 +1,78 @@
+/*
+    Copyright 2004-2005 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, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+// Information for this class taken from the mvpmc project - thanks
+
+/*
+ discussion on short positions:
+ http://www.shspvr.com/smf/index.php?topic=3765.30
+
+It says:
+1 = NTSC/composite
+2 = PAL/Scart
+3 = PAL/Composite
+
+But with PAL/Scart/RGB I get a value of 1
+
+So, am assuming:
+0 = NTSC / composite
+1 = PAL / scart rgb
+2 = PAL / scart composite
+*/
+
+#ifndef MTDMVP_H
+#define MTDMVP_H
+
+#include <unistd.h>
+#include <fcntl.h>
+
+#include "log.h"
+#include "mtd.h"
+
+class MtdMVP : public Mtd
+{
+  public:
+    MtdMVP();
+    ~MtdMVP();
+
+    int init(char* device);
+    int shutdown();
+
+    short getPALorNTSC();
+
+    /*
+    short getAspect();
+    short getFlicker();
+    short getBootLogoOutput();
+    short getBootLogoDisplayVideoLeft();
+    short getBootLogoDisplayVideoUpper();
+    short getBootLogoDisplayVideoWidth();
+    short getBootLogoDisplayVideoHeight();
+
+    void logit();
+    */
+
+  private:
+    int initted;
+
+    short data[4096];
+};
+
+#endif
diff --git a/mtdwin.cc b/mtdwin.cc
new file mode 100644 (file)
index 0000000..0c7e338
--- /dev/null
+++ b/mtdwin.cc
@@ -0,0 +1,50 @@
+/*
+    Copyright 2004-2005 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, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+#include "mtdwin.h"
+
+MtdWin::MtdWin()
+{
+  if (instance) return;
+  initted = 0;
+}
+
+MtdWin::~MtdWin()
+{
+}
+
+int MtdWin::init(char* device)
+{
+  if (initted) return 0;
+  initted = 1;
+  return 1;
+}
+
+int MtdWin::shutdown()
+{
+  if (!initted) return 0;
+  initted = 0;
+  return 1;
+}
+
+short MtdWin::getPALorNTSC()
+{
+  return 0;
+}
diff --git a/mtdwin.h b/mtdwin.h
new file mode 100644 (file)
index 0000000..4a6086e
--- /dev/null
+++ b/mtdwin.h
@@ -0,0 +1,41 @@
+/*
+    Copyright 2004-2005 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, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+#ifndef MTDWIN_H
+#define MTDWIN_H
+
+#include "mtd.h"
+
+class MtdWin : public Mtd
+{
+  public:
+    MtdWin();
+    ~MtdWin();
+
+    int init(char* device);
+    int shutdown();
+
+    short getPALorNTSC();
+
+  private:
+    int initted;
+};
+
+#endif