]> git.vomp.tv Git - vompclient.git/commitdiff
Add more flexible video display options
authorroot <root@raspberrypi>
Fri, 3 Oct 2014 13:54:49 +0000 (15:54 +0200)
committerroot <root@raspberrypi>
Fri, 3 Oct 2014 13:54:49 +0000 (15:54 +0200)
21 files changed:
boxstack.cc
boxstack.h
boxx.cc
boxx.h
colour.cc
colour.h
message.h
playermedia.cc
vepg.cc
vepglistadvanced.cc
vepgsummary.cc
video.cc
video.h
videomvp.cc
videomvp.h
videoomx.cc
videoomx.h
videowin.cc
videowin.h
vvideolivetv.cc
vvideorec.cc

index 455439f814a1b82971e7fce0d7f26944b8ef093d..cf7890a030fb597095d914ad6f7a6693877ef4e2 100644 (file)
@@ -63,6 +63,13 @@ int BoxStack::shutdown()
   return 1;
 }
 
+int BoxStack::addVideoDisplay(Boxx* box,VideoDisplay vd)
+{
+         videoStack.push(pair<Boxx*,VideoDisplay>(box,vd));
+         Video::getInstance()->setVideoDisplay(vd);
+         return 1;
+}
+
 int BoxStack::add(Boxx* v)
 {
   if (!initted) return 0;
@@ -77,6 +84,11 @@ int BoxStack::add(Boxx* v)
     return 0;
   }
   boxes[numBoxes++] = v;
+  VideoDisplay vd;
+  if (v->getVideoDisplay(vd)) {
+         Log::getInstance()->log("BoxStack", Log::DEBUG, "Add video display");
+         addVideoDisplay(v,vd);
+  }
 
   boxLock.Unlock();
 
@@ -90,6 +102,7 @@ int BoxStack::add(Boxx* v)
 int BoxStack::remove(Boxx* toDelete)
 {
   if (!initted) return 0;
+  VideoDisplay *display = NULL;
 
   boxLock.Lock();
   Log::getInstance()->log("BoxStack", Log::DEBUG, "Locked for remove");  
@@ -152,6 +165,10 @@ toDelete->preDelete();
     Command::getInstance()->postMessageNoLock(m);
   }
 
+  if (!videoStack.empty() && videoStack.top().first==toDelete) {
+       videoStack.pop();
+    if (!videoStack.empty()) display=&videoStack.top().second;
+  }
   boxLock.Unlock();
   Log::getInstance()->log("BoxStack", Log::DEBUG, "Unlocked for remove");  
  
@@ -160,6 +177,11 @@ toDelete->preDelete();
   //     as this box is not in the stack any more, there is no chance for a second delete
   Log::getInstance()->log("BoxStack", Log::DEBUG, "remove: going to delete boxx %p, num %d", toDelete, numBoxes);  
   delete toDelete;
+  if  (display) {
+         Log::getInstance()->log("BoxStack", Log::DEBUG, "setVideoDisplay %d %d %d %d %d %d", display->mode, display->fallbackMode,
+                         display->x, display->y, display->width, display->height);
+         Video::getInstance()->setVideoDisplay(*display);
+  }
 
   return 1;
 }
@@ -431,6 +453,7 @@ void BoxStack::removeAll()
   // This is pretty silly now that preDelete needs mutex unlocked
   
   Boxx* toDel = NULL;
+  VideoDisplay *display = NULL;
   
   while(numBoxes > 1)
   {
@@ -461,12 +484,21 @@ void BoxStack::removeAll()
       toDel = NULL;
     }
 
+    if (!videoStack.empty() && videoStack.top().first==toDel) {
+       videoStack.pop();
+       if (!videoStack.empty()) display=&videoStack.top().second;
+    }
     boxLock.Unlock();
 
     //AVO: do the delete outside the lock to allow for recursive deletes
     Log::getInstance()->log("BoxStack", Log::DEBUG, "going to delete boxx %p, num=%d", toDel, numBoxes);
+    if (display) Video::getInstance()->setVideoDisplay(*display);
+
+
     if (toDel) delete toDel;
   }
+
+
 }
 
 int BoxStack::handleCommand(int command)
index b0b7156eeb966b56d3bb29a213f9de29e1408bb7..e730dfffe594451751f451a03ac0c3cc2d3fab34 100644 (file)
@@ -25,6 +25,7 @@
 #include <time.h>
 #include <signal.h>
 #include <list>
+#include <stack>
 
 #ifndef WIN32
 #include <pthread.h>
 #include "boxx.h"
 #include "region.h"
 #include "message.h"
+#include "video.h"
 
 
-//using namespace std;
 
-//using namespace __gnu_cxx; // needed for newer compilers?
-
-typedef list<Region> RegionList;
+typedef std::list<Region> RegionList;
+typedef std::stack<std::pair<Boxx*,VideoDisplay> > VideoDisplayStack;
 
 class BoxStack
 {
@@ -71,12 +71,15 @@ class BoxStack
     Boxx* boxes[20];
     int numBoxes;
 
+    VideoDisplayStack videoStack;
+
     Mutex boxLock;
 
 
     void deleteBox(int z);
     void repaintRevealed(int x, Region r);
     void boxSplit(Region r, int start, int end, int direction, RegionList& rl);
+    int addVideoDisplay(Boxx*,VideoDisplay);
 };
 
 #endif
diff --git a/boxx.cc b/boxx.cc
index da742065f901de0379cda1855c816134ffc6428d..fd697bc349f592906d3f6d3eec297689316920a0 100644 (file)
--- a/boxx.cc
+++ b/boxx.cc
@@ -40,6 +40,8 @@ Boxx::Boxx()
   area.w = 0;
   area.h = 0;
 
+  vdisplay.mode = None;
+
   paraVSpace = 6; // default gap for drawPara
 
   backgroundColourSet = false;
@@ -134,6 +136,16 @@ void Boxx::setBackgroundColour(const DrawStyle& Tcolour)
   backgroundColourSet = true;
 }
 
+void Boxx::setVideoBackground()
+{
+       vdisplay.mode=Window;
+       vdisplay.fallbackMode=Fullscreen;
+       vdisplay.x=getScreenX();
+       vdisplay.y=getScreenY();
+       vdisplay.width=getWidth();
+       vdisplay.height=getHeight();
+}
+
 void Boxx::setVisible(bool isVisible)
 {
   visible = isVisible;
@@ -247,6 +259,18 @@ void Boxx::getRootBoxRegion(Region* r)
   r->h = area.h;  
 }
 
+bool Boxx::getVideoDisplay(VideoDisplay &vd)
+{
+       for(vector<Boxx*>::iterator i = children.begin(); i != children.end(); i++)
+       {
+               if ((*i)->getVideoDisplay(vd)) return true;
+       }
+
+       if (vdisplay.mode==None) return false;
+       vd=vdisplay;
+       return true;
+}
+
 // Level 1 drawing functions
 
 void Boxx::fillColour(const DrawStyle& colour)
diff --git a/boxx.h b/boxx.h
index 76342e42d33aa4c8f10b676032b268779b1ab99a..5cf60efc1e18c406bb7ac4a5db10efe5a63a335d 100644 (file)
--- a/boxx.h
+++ b/boxx.h
@@ -32,6 +32,7 @@ using namespace std;
 
 
 #include "surface.h"
+#include "video.h"
 #include "tvmedia.h"
 #include "osdvector.h"
 
@@ -53,6 +54,7 @@ class Boxx
     void setGap(UINT gap);
     void setBackgroundColour(const DrawStyle& colour);
     void setVisible(bool isVisible);
+    void setVideoBackground();
 
 
     // The following are supposed to be abstract functions
@@ -91,6 +93,8 @@ class Boxx
     Region getRegionR();     // Same but as an object
     void getRootBoxRegion(Region*);
     
+    bool getVideoDisplay(VideoDisplay &vd);
+
     // Drawing functions level 1
     void fillColour(const DrawStyle & colour);
     int drawPara(const char* text, int x, int y, const DrawStyle& colour, unsigned int skiplines=0);
@@ -144,6 +148,7 @@ class Boxx
     Boxx* parent;
     Region area;
     vector<Boxx*> children;
+    VideoDisplay vdisplay;
 
     void setParent(Boxx*);    
     void blt(Region& r);
index e06214840ffe216c42dd69c6169c562c350180a7..05e6f24338eab68e6ebe7e1b11d3867ead635161 100644 (file)
--- a/colour.cc
+++ b/colour.cc
@@ -30,6 +30,7 @@ DrawStyle DrawStyle::BLUE(0, 0, 255);
 DrawStyle DrawStyle::YELLOW(255, 255, 0);
 DrawStyle DrawStyle::VIDEOBLUE(0, 0, 150);
 DrawStyle DrawStyle::VIEWBACKGROUND(0, 0, 100);
+DrawStyle DrawStyle::VIEWTRANSPARENTBACKGROUND(0, 0, 100, 128);
 DrawStyle DrawStyle::TABVIEWBACKGROUND(0, 0, 120);
 DrawStyle DrawStyle::TITLEBARBACKGROUND(0, 0, 200);
 DrawStyle DrawStyle::SELECTHIGHLIGHT(240, 250, 80);
@@ -57,6 +58,7 @@ Real colours
        DrawStyle::YELLOW=DrawStyle(255, 255, 0);
        DrawStyle::VIDEOBLUE=DrawStyle(0, 0, 150);
        DrawStyle::VIEWBACKGROUND=DrawStyle(0, 0, 100);
+       DrawStyle::VIEWTRANSPARENTBACKGROUND=DrawStyle(0, 0, 100, 128);
        DrawStyle::TABVIEWBACKGROUND=DrawStyle(0, 0, 120);
        DrawStyle::TITLEBARBACKGROUND=DrawStyle(0, 0, 200);
        DrawStyle::SELECTHIGHLIGHT=DrawStyle(240, 250, 80);
@@ -169,6 +171,15 @@ Real colours
        DrawStyle::VIEWBACKGROUND.x2=0.0;
        DrawStyle::VIEWBACKGROUND.y2=1.0;
 
+       DrawStyle::VIEWTRANSPARENTBACKGROUND=DrawStyle(0, 0, 100, 128);
+       DrawStyle::VIEWTRANSPARENTBACKGROUND.grad_col[0]=Colour(0,0,160,128);
+       DrawStyle::VIEWTRANSPARENTBACKGROUND.num_colors=1;
+       DrawStyle::VIEWTRANSPARENTBACKGROUND.ft=DrawStyle::GradientLinear;
+       DrawStyle::VIEWTRANSPARENTBACKGROUND.x1=0.0;
+       DrawStyle::VIEWTRANSPARENTBACKGROUND.y1=0.0;
+       DrawStyle::VIEWTRANSPARENTBACKGROUND.x2=0.0;
+       DrawStyle::VIEWTRANSPARENTBACKGROUND.y2=1.0;
+
        DrawStyle::TABVIEWBACKGROUND=DrawStyle(0, 0, 120);
 
 
index 9b620f804cbb7d1ca6d5a0f074a2a0aa21806be8..28eaf0163134bb5b0875157ee669cef7c747c48f 100644 (file)
--- a/colour.h
+++ b/colour.h
@@ -93,6 +93,7 @@ public:
     static DrawStyle DARKGREY;
     static DrawStyle VIDEOBLUE;
     static DrawStyle VIEWBACKGROUND;
+    static DrawStyle VIEWTRANSPARENTBACKGROUND;
     static DrawStyle TABVIEWBACKGROUND;
     static DrawStyle TITLEBARBACKGROUND;
     static DrawStyle SELECTHIGHLIGHT;
index a8d10d30f71fc8da25e4ad10a89d2dfa6d6f6dcf..c115772a1d0d723f748b95e6226dabcddca590b7 100644 (file)
--- a/message.h
+++ b/message.h
@@ -58,7 +58,7 @@ 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;
+    //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;
index 7cd314b504c44d74b7292446e8066b1c7af5107b..8c793294b6f4a83bb6b1b79108576d9820200972 100644 (file)
@@ -649,7 +649,7 @@ void PlayerMedia::call(void* caller)
       int ypos=(video->getScreenHeight()-demuxer->getVerticalSize())/2;
       if (ypos < 0) ypos=0;
       logger->log("PlayerMedia", Log::DEBUG, "setting pos x=%d,y=%d",xpos,ypos);
-      video->setPosition(xpos,ypos);
+      //video->setPosition(xpos,ypos); // needs to be fixed
     }
 
     if (video->getTVsize() == Video::ASPECT4X3)
diff --git a/vepg.cc b/vepg.cc
index 94605e99e4739ec90f77987233fe18a9427f66d9..76662f29b79c4b1a1574ffb445455d68e6d1b0c5 100644 (file)
--- a/vepg.cc
+++ b/vepg.cc
@@ -173,6 +173,13 @@ VEpg::VEpg(void* tparent, UINT tcurrentChannelIndex, ChannelList* tchanList)
   ltime = prevHour(&ltime); // set ltime to previous hour TODO make this half hour?
   time(&selTime); // set selTime to now
   updateEventList(); // get list of programmes
+
+  vdisplay.mode=Window;
+  vdisplay.fallbackMode=Quarter;
+  vdisplay.x=Video::getInstance()->getScreenWidth()/2;
+  vdisplay.y=10;
+  vdisplay.width=Video::getInstance()->getScreenWidth()/2;
+  vdisplay.height=Video::getInstance()->getScreenHeight()/2;
 }
 
 void VEpg::preDelete()
@@ -454,15 +461,6 @@ int VEpg::handleCommand(int command)
     case Remote::BACK:
     case Remote::GUIDE:
     {
-      // return to normal TV mode
-      if (parent) // ptr check done in case being tested from videorec
-      {
-        Message* m = new Message(); // Must be done after this view deleted
-        m->from = this;
-        m->to = parent;
-        m->message = Message::EPG_CLOSE;
-        Command::getInstance()->postMessageNoLock(m);
-      }
       return 4;
     }
     case Remote::CHANNELUP:
index f10f17dea08ce1d5e44bca07a37a2be8413df490..cd2bcc494bee8f8ef382fc98de6ef1f4064f29a4 100644 (file)
@@ -50,10 +50,10 @@ VEpgListAdvanced::VEpgListAdvanced(VVideoLiveTV *tvideolive, ChannelList* tchanL
 
        mode = OneChannel;
 
-       setSize(640, 500); //old   setSize(570, 420);
+       setSize(640+40, 500+40); //old   setSize(570, 420);
        createBuffer();
 
-       setPosition(40, 40);
+       setPosition(20, 20);
 
        setTitleBarOn(1);
        setTitleBarColour(DrawStyle::TITLEBARBACKGROUND);
@@ -70,7 +70,8 @@ VEpgListAdvanced::VEpgListAdvanced(VVideoLiveTV *tvideolive, ChannelList* tchanL
        epg.setSize(area.w -slarea.x -slarea.w -10, area.h - 30 - 15 - 30);
        add(&epg);
        epg.setText("");
-       epg.setBackgroundColour(DrawStyle::VIEWBACKGROUND);
+       epg.setVideoBackground();
+       epg.setBackgroundColour(DrawStyle::VIEWTRANSPARENTBACKGROUND);
 
        epgTVmedia.setPosition(epg.getRegionR().w-100-10,10);
        epgTVmedia.setSize(100,150/Osd::getInstance()->getPixelAspect());
@@ -279,7 +280,6 @@ void VEpgListAdvanced::doRecord()
                                current->duration, current->title);
                VEpgSetTimer* vs = new VEpgSetTimer(current, chan);
                vs->draw();
-               BoxStack *boxstack=BoxStack::getInstance();
                boxstack->add(vs);
                boxstack->update(vs);
        }
@@ -288,9 +288,7 @@ void VEpgListAdvanced::doRecord()
 
 void VEpgListAdvanced::doGrid()
 {
-       Video* video=Video::getInstance();
-       video->setMode(Video::QUARTER);
-       video->setPosition(170, 5); //TODO add stack for these changes
+
        if (mode!=OneChannel) {
                Channel * chan=(*chanList)[ sl.getCurrentOptionData()];
                channelNumber = chan->number;
index 796a700f9a3b7fae11d9b0e7ff1358dc64d778ed..978451329bfe5f0cb3e655cdbfada1ba971128e8 100644 (file)
@@ -48,7 +48,7 @@ VEpgSummary::VEpgSummary(Event *tevent, Channel* tchannel)
 
   if (Video::getInstance()->getFormat() == Video::PAL)
   {
-    setSize(640, 500);
+    setSize(640+40, 500+40);
        createBuffer();
   }
   else
@@ -56,7 +56,7 @@ VEpgSummary::VEpgSummary(Event *tevent, Channel* tchannel)
        setSize(560, 400);
        createBuffer();
   }
-  setPosition(40, 40);
+  setPosition(20, 20);
 
   setTitleBarOn(1);
   setBorderOn(1);
@@ -86,34 +86,42 @@ VEpgSummary::VEpgSummary(Event *tevent, Channel* tchannel)
 
   summary->setText(summary_text.c_str());
   OsdVector *osdv=dynamic_cast<OsdVector*>(Osd::getInstance());
+  summary->setBackgroundColour(DrawStyle::VIEWTRANSPARENTBACKGROUND);
 
   tabbar.addTab(tr("EPG"), summary);
+  summary->setVideoBackground();
   WMovieView *movieview=NULL;
   WSeriesView *seriesview=NULL;
   if (event->movieInfo) {
          movieview = new WMovieView(event->movieInfo);
          movieview->setParaMode(true);
+         movieview->setBackgroundColour(DrawStyle::VIEWTRANSPARENTBACKGROUND);
          tabbar.addTab(tr("TheTVDB Info"), movieview);
          if (osdv) {
                  if (event->movieInfo->actors.size() > 0 && osdv)
                  {
                          WActorGallery *gallery= new WActorGallery(event->movieInfo->actors);
+                         gallery->setBackgroundColour(DrawStyle::VIEWTRANSPARENTBACKGROUND);
                          tabbar.addTab(tr("Cast"),gallery);
                  }
                  WArtworkGallery *artgallery= new WArtworkGallery(*event->movieInfo);
+                 artgallery->setBackgroundColour(DrawStyle::VIEWTRANSPARENTBACKGROUND);
                  tabbar.addTab(tr("Gallery"),artgallery);
          }
   } else if (event->seriesInfo) {
          seriesview = new WSeriesView(event->seriesInfo);
          seriesview->setParaMode(true);
+         seriesview->setBackgroundColour(DrawStyle::VIEWTRANSPARENTBACKGROUND);
          tabbar.addTab(tr("TheTVDB Info"), seriesview);
          if (osdv) {
                  if (event->seriesInfo->actors.size() > 0 && osdv)
                  {
                          WActorGallery *gallery= new WActorGallery(event->seriesInfo->actors);
+                         gallery->setBackgroundColour(DrawStyle::VIEWTRANSPARENTBACKGROUND);
                          tabbar.addTab(tr("Cast"),gallery);
                  }
                  WArtworkGallery *artgallery= new WArtworkGallery(*event->seriesInfo);
+                 artgallery->setBackgroundColour(DrawStyle::VIEWTRANSPARENTBACKGROUND);
                  tabbar.addTab(tr("Gallery"),artgallery);
          }
 
index 2c8bb562326bd4e404c3e984891b6dfbb54ff712..ae406e974accd535aabf8d7e6580fe6507aa2031 100644 (file)
--- a/video.cc
+++ b/video.cc
@@ -52,6 +52,34 @@ Video* Video::getInstance()
 {
   return instance;
 }
+
+// For legacy implementations
+bool Video::setVideoDisplay(VideoDisplay display)
+{
+       VideoMode applyMode=display.mode;
+       if (display.mode==Window || display.mode == None) {
+               if (display.fallbackMode == None || display.fallbackMode == Window) return false; // No Effect
+               applyMode=display.fallbackMode;
+       }
+       switch (applyMode) {
+       case Fullscreen: {
+               setMode(mode);
+       } break;
+       case Quarter: {
+               setMode(QUARTER);
+               setPosition(display.x/2, display.y/2);
+       }break;
+       case Eighth: {
+               setMode(EIGHTH);
+               setPosition(display.x/2, display.y/2);
+       } break;
+       case Window:
+       case None: return false; break; //Stupid
+       }
+       return true;
+
+}
+
 /*
 void Video::setInstance(Video* inst)
 {
diff --git a/video.h b/video.h
index 5624421c37d6489c8c3eafa644284ffb0c2c62ad..3dcc0cef0cffac1cecd89b6efda3b2ea19024b43 100644 (file)
--- a/video.h
+++ b/video.h
@@ -34,6 +34,22 @@ typedef struct _hmsf
   UINT frames;
 } hmsf;
 
+enum VideoMode {
+       None,
+       Fullscreen,
+       Window, //Not supported on legacy hardware like mvp
+       Quarter,
+       Eighth
+};
+
+// New video api
+typedef struct _VideoDisplay {
+       enum VideoMode mode;
+       enum VideoMode fallbackMode;
+       UINT x,y;
+       UINT width,height;
+} VideoDisplay;
+
 class Video: public DrainTarget, public AbstractOption
 {
   public:
@@ -56,7 +72,6 @@ class Video: public DrainTarget, public AbstractOption
     virtual void executePendingModeChanges() {}; // This is called if you change the output mode and the device take a while for reinitialization
     virtual int setDefaultAspect()=0;
     virtual int setSource()=0;
-    virtual int setPosition(int x, int y)=0;
     virtual int sync()=0;
     virtual int play()=0;
     virtual int stop()=0;
@@ -109,6 +124,10 @@ class Video: public DrainTarget, public AbstractOption
     virtual UCHAR getTVsize()       { return tvsize; }
 
 
+    virtual bool setVideoDisplay(VideoDisplay display);
+
+
+
 
     //hmsf framesToHMSF(ULONG frames,double fps);
    // UINT getFPS(); //removed
@@ -161,7 +180,12 @@ class Video: public DrainTarget, public AbstractOption
     const static UCHAR ZOOM = 5;
     const static UCHAR UNKNOWN6 = 6;
 
+
+
+
   protected:
+
+    virtual int setPosition(int x, int y){return 0;}; //legacy api do  not use, use setVideoDisplay instead
     static Video* instance;
     int initted;
     int fdVideo;
@@ -172,6 +196,7 @@ class Video: public DrainTarget, public AbstractOption
     UCHAR aspectRatio;
     int parx,pary;
     UCHAR mode;
+
        bool h264;
 
     UINT screenWidth;
index 8820fe9a0cbb216c8ed0d14db68d08866871e3d3..460fe4630c366f656ca61f42fdcfdd94d8859df1 100644 (file)
@@ -170,7 +170,7 @@ int VideoMVP::setMode(UCHAR tmode)
 
   if ((tmode != NORMAL) && (tmode != LETTERBOX) && (tmode != UNKNOWN2) && (tmode != QUARTER) && (tmode != EIGHTH)
       && (tmode != ZOOM) && (tmode != UNKNOWN6)) return 0;
-  mode = tmode;
+  if (tmode==NORMAL || tmode == LETTERBOX) mode = tmode;
 
   if (ioctl(fdVideo, AV_SET_VID_MODE, mode) != 0) return 0;
   return 1;
index 7b093c4c25ad3f0b00f43311a642f0314684afbf..7e9d4406ea4bbf1f7e630eebf3e0a2980c650f09 100644 (file)
@@ -119,7 +119,6 @@ class VideoMVP : public Video
     int setTVsize(UCHAR size);               // Is the TV a widescreen?
     int setDefaultAspect();
     int setSource();
-    int setPosition(int x, int y);
     int sync();
     int play();
     int stop();
@@ -148,6 +147,10 @@ class VideoMVP : public Video
     int test2();
 #endif
 
+
+  protected:
+  int setPosition(int x, int y); // legacy api do not use
+
   private:
     int checkSCART();
     void setLetterboxBorder(char* border);
index 629860281dabe3aafedaab57be1f50fa84cd070a..a1017d96e1dbe21ebbf9fcd03dfa111b31301bc6 100644 (file)
@@ -539,11 +539,49 @@ int VideoOMX::setAspectRatio(UCHAR taspectRatio, int tparx,int tpary)
 int VideoOMX::setMode(UCHAR tmode)
 {
   if (!initted) return 0;
-  mode=tmode;
+  if (tmode==LETTERBOX || tmode==NORMAL) mode=tmode;
   updateMode();
   return 1;
 }
 
+bool VideoOMX::setVideoDisplay(VideoDisplay display)
+{
+       if (!initted) return false;
+       switch (display.mode)
+       {
+       case None: return true; //??
+       case Fullscreen: {
+               windowed = false;
+
+       } break;
+       case Quarter: {
+               windowed =true;
+               xpos = ((float) display.x) / ((float) screenWidth);
+               ypos = ((float) display.y) / ((float) screenHeight);
+               width = 0.5f;
+               height = 0.5f;
+       } break;
+
+       case Eighth: {
+               windowed =true;
+               xpos = ((float) display.x) / ((float) screenWidth);
+               ypos = ((float) display.y) / ((float) screenHeight);
+               width = 0.25f;
+               height = 0.25f;
+       } break;
+
+       case Window: {
+               windowed =true;
+               xpos = ((float) display.x) / ((float) screenWidth);
+               ypos = ((float) display.y) / ((float) screenHeight);
+               width = ((float) display.width) / ((float) screenWidth);
+               height = ((float) display.height) / ((float) screenHeight);
+       }break;
+       }
+       updateMode();
+       return true;
+}
+
 
 void VideoOMX::updateMode()
 {
@@ -586,7 +624,7 @@ void VideoOMX::updateMode()
 
 
                dispconf.set = OMX_DISPLAY_SET_FULLSCREEN;
-               if (mode != QUARTER && mode != EIGHTH) {
+               if (!windowed) {
                        //Set Fullscreen
                        dispconf.fullscreen = OMX_TRUE;
                } else {
@@ -602,7 +640,7 @@ void VideoOMX::updateMode()
                }
 
                dispconf.set = OMX_DISPLAY_SET_MODE;
-               if (mode != QUARTER && mode != EIGHTH) {
+               if (!windowed) {
                        dispconf.mode = (mode == NORMAL) ? OMX_DISPLAY_MODE_FILL
                                        : OMX_DISPLAY_MODE_LETTERBOX;
                } else {
@@ -617,7 +655,7 @@ void VideoOMX::updateMode()
                        return;
                }
 
-               if (mode == QUARTER || mode == EIGHTH) {
+               if (windowed) {
                        unsigned int display_width, display_height;
                        display_width = display_height = 0;
                        if (graphics_get_display_size(0, &display_width, &display_height)
@@ -633,13 +671,12 @@ void VideoOMX::updateMode()
                                        = (int) (xpos * ((float) display_width));
                        dispconf.dest_rect.y_offset = (int) (ypos
                                        * ((float) display_height));
-                       if (mode == QUARTER) {
-                               dispconf.dest_rect.width = display_width >> 1;
-                               dispconf.dest_rect.height = display_height >> 1;
-                       } else if (mode == EIGHTH) {
-                               dispconf.dest_rect.width = display_width >> 2;
-                               dispconf.dest_rect.height = display_height >> 2;
-                       }
+                       dispconf.dest_rect.width = (int) (width * ((float) display_width));
+                       dispconf.dest_rect.height = (int) (height * ((float) display_height));
+                       Log::getInstance()->log("Video", Log::DEBUG,
+                                                                       "Set dest_rect as %d %d %d %d", dispconf.dest_rect.x_offset,dispconf.dest_rect.y_offset,
+                                                                       dispconf.dest_rect.width , dispconf.dest_rect.height);
+
                        error = OMX_SetParameter(omx_vid_rend,
                                        OMX_IndexConfigDisplayRegion, &dispconf);
                        if (error != OMX_ErrorNone) {
index 8e72a510d2a4a15f636246229992f197537715c6..69fd5eebe74bc952214047e97c32aa992e9316e9 100644 (file)
@@ -85,6 +85,7 @@ class VideoOMX : public Video
     int setConnection(UCHAR connection);
     int setAspectRatio(UCHAR aspectRatio, int tparx,int tpary);   // This one does the pin 8 scart widescreen switching
     int setMode(UCHAR mode);
+    bool setVideoDisplay(VideoDisplay display);
     int setTVsize(UCHAR size);               // Is the TV a widescreen?
    UCHAR getTVsize();
 
@@ -288,9 +289,12 @@ class VideoOMX : public Video
           bool omx_mpeg2;
           bool omx_h264;
           float xpos,ypos;
+          float width, height;
+          bool windowed;
           int deinterlace;
           void updateMode();//called internally to adjust for different parameters
           void selectVideoMode(int interlaced);
+
           UCHAR tvsystem;
           bool signalon;
           bool pendingmodechange;
@@ -300,6 +304,8 @@ class VideoOMX : public Video
 
 
 
+
+
           bool firstsynched;
 
 
index dcde4aa2b25714a24514e98100a9f936e68dc93d..2b1de80ef15d94639b7a60de5be8ef13601fd62a 100644 (file)
@@ -203,7 +203,7 @@ int VideoWin::setMode(UCHAR tmode)
 
   if ((tmode != NORMAL) && (tmode != LETTERBOX) && (tmode != UNKNOWN2) && (tmode != QUARTER) && (tmode != EIGHTH)
       && (tmode != ZOOM) && (tmode != UNKNOWN6)) return 0;
-  mode = tmode;
+  if (tmode==NORMAL || tmode == LETTERBOX) mode = tmode;
   videoposx=0;
   videoposy=0;
   AdjustWindow();
index 7e43236db0f920fba88ebf0f5a1711fbee02e70a..7919973f4d278066e6d7ee2a1a18ff372c607496 100644 (file)
@@ -72,7 +72,6 @@ public:
        int setTVsize(UCHAR size);               // Is the TV a widescreen?
        int setDefaultAspect();
        int setSource();
-       int setPosition(int x, int y);
        int sync();
        int play();
        int dsplay();
@@ -163,6 +162,10 @@ public:
        int test();
        int test2();
 #endif
+protected:
+       int setPosition(int x, int y); // legacy api remove
+#error Port the new api
+
 private:
        int EnterIframePlayback();
 #ifdef NEW_DS_MECHANISMENS
index 5d84cac985304353811bf0a37b6a7a363e4d207d..96bcdf9d5741890ed82307a9b9e173df66f4ac7a 100644 (file)
@@ -272,6 +272,13 @@ VVideoLiveTV::VVideoLiveTV(ChannelList* tchanList, ULONG initialChannelNumber, V
   Region r1 = summary.getRegionR();
   Region r2 = osd.getRegionR();
   osdSummaryRegion = r1 + r2;
+
+  vdisplay.mode=Fullscreen;
+  vdisplay.fallbackMode=Fullscreen;
+  vdisplay.x=0;
+  vdisplay.y=0;
+  vdisplay.width=0;
+  vdisplay.height=0;
 }
 
 void VVideoLiveTV::preDelete()
@@ -731,8 +738,6 @@ void VVideoLiveTV::doEPG()
   if (osd.getVisible()) clearScreen();
 
   if (!Command::getInstance()->advMenues()) {
-         video->setMode(Video::QUARTER);
-         video->setPosition(170, 5); //TODO need to deal with 4:3 switching
 
          VEpg* vepg = new VEpg(this, currentChannelIndex, chanList);
          vepg->draw();
@@ -1076,10 +1081,6 @@ void VVideoLiveTV::processMessage(Message* m)
     osdChannelIndex = currentChannelIndex;
     if (m->tag == 1) displayOSD(true);
   }
-  else if (m->message == Message::EPG_CLOSE)
-  {
-    video->setMode(videoMode);
-  }
   else if (m->message == Message::CHILD_CLOSE)
   {
     if (m->from == vas)
index e813b6397ed5ef13fb8b92477bcc6aef1204567d..1aee6d466306f9a49710f80fe32e6338e94b9d7d 100644 (file)
@@ -131,6 +131,12 @@ VVideoRec::VVideoRec(Recording* rec, bool ish264)
     wssRegion.h = 300;
   }
 #endif
+  vdisplay.mode=Fullscreen;
+  vdisplay.fallbackMode=Fullscreen;
+  vdisplay.x=0;
+  vdisplay.y=0;
+  vdisplay.width=0;
+  vdisplay.height=0;
 }
 
 void VVideoRec::preDelete()