]> git.vomp.tv Git - vompclient-marten.git/commitdiff
Query Mpeg2 support and fix of aspect switching
authorMarten Richter <marten.richter@freenet.de>
Sun, 18 Nov 2012 14:23:19 +0000 (15:23 +0100)
committerMarten Richter <marten.richter@freenet.de>
Sun, 18 Nov 2012 14:23:19 +0000 (15:23 +0100)
vdr.cc
video.h
videoomx.cc
videoomx.h
vrecordinglist.cc

diff --git a/vdr.cc b/vdr.cc
index f16b48114d44d95c04b7247619d1ef4aa3074dfe..b45533035f8c48b64edb008647db0cc105803b2d 100644 (file)
--- a/vdr.cc
+++ b/vdr.cc
@@ -792,6 +792,7 @@ ChannelList* VDR::getChannelsList(ULONG type)
   ChannelList* chanList = new ChannelList();
 
   bool h264support=Video::getInstance()->supportsh264();
+  bool mpeg2support=Video::getInstance()->supportsmpeg2();
 
   while (!vresp->end())
   {
@@ -801,7 +802,7 @@ ChannelList* VDR::getChannelsList(ULONG type)
     chan->name = vresp->extractString();
     chan->vstreamtype = vresp->extractULONG();
 
-    if (chan->type == type && (chan->vstreamtype!=0x1b || h264support))
+    if (chan->type == type && ((chan->vstreamtype==0x1b && h264support)|| mpeg2support) )
     {
       chanList->push_back(chan);
       logger->log("VDR", Log::DEBUG, "Have added a channel to list. %lu %lu %s", chan->number, chan->type, chan->name);
diff --git a/video.h b/video.h
index 2a670f595b02fec691e3094690891dad3028cdef..5624421c37d6489c8c3eafa644284ffb0c2c62ad 100644 (file)
--- a/video.h
+++ b/video.h
@@ -75,6 +75,7 @@ class Video: public DrainTarget, public AbstractOption
     virtual int EnterIframePlayback() {return 1;}; // Must not be implemented
 
        virtual bool supportsh264(){return false;};
+       virtual bool supportsmpeg2(){return true;};
        virtual void seth264mode(bool ish264) {h264=ish264;};
        virtual int getTeletextBufferFaktor(){return 1;};
 
@@ -105,7 +106,7 @@ class Video: public DrainTarget, public AbstractOption
     UCHAR getFormat()       { return format; }
     UINT getScreenWidth()   { return screenWidth; }
     UINT getScreenHeight()  { return screenHeight; }
-    UCHAR getTVsize()       { return tvsize; }
+    virtual UCHAR getTVsize()       { return tvsize; }
 
 
 
index 26c8077a106a6d281a2368a0c6fd3a67b2ed5f88..6c88e6b3314a19d54446187533724e41d1170c73 100644 (file)
@@ -54,6 +54,7 @@ VideoOMX::VideoOMX() {
        lastreftimePTS = 0;
        firstsynched = false;
        cur_clock_time=0;
+       mpeg2_supported=false;
        //cur_pts=0;
 
        mode=NORMAL;
@@ -75,6 +76,25 @@ int VideoOMX::init(UCHAR tformat)
   if (initted) return 0;
   initted = 1;
 
+  int ret=vc_gencmd_send("codec_enabled MPG2");
+  if (ret!=0) {
+         Log::getInstance()->log("Video", Log::DEBUG, "vc_gencmd_send failed %x",ret);
+  } else {
+         char buffer[1024];
+         ret=vc_gencmd_read_response(buffer,sizeof(buffer));
+         if (ret!=0) {
+                 Log::getInstance()->log("Video", Log::DEBUG, "vc_gencmd_read_response failed %x",ret);
+         } else {
+                 if (STRCASECMP(buffer,"MPG2=enabled")==0) {
+                         mpeg2_supported=true;
+                 } else if (STRCASECMP(buffer,"MPG2=disabled")==0) {
+                         mpeg2_supported=false;
+                 } else {
+                         Log::getInstance()->log("Video", Log::DEBUG, "Undefined mpg codec answer %s",buffer);
+                 }
+         }
+  }
+
   if (!setFormat(tformat))           { shutdown(); return 0; }
   if (!setConnection(HDMI))  { shutdown(); return 0; }
   if (!setAspectRatio(ASPECT4X3,12,11))    { shutdown(); return 0; }
@@ -82,7 +102,7 @@ int VideoOMX::init(UCHAR tformat)
   if (!setSource())                  { shutdown(); return 0; }
   if (!attachFrameBuffer())          { shutdown(); return 0; }
 
-  setTVsize(ASPECT4X3);
+  setTVsize(ASPECT16X9);
   selectVideoMode(0);
 
 
@@ -306,6 +326,12 @@ int VideoOMX::setTVsize(UCHAR ttvsize)
   return 1;
 }
 
+UCHAR VideoOMX::getTVsize()       {
+       /*if (hdmi)*/
+       return ASPECT16X9; // in order that aspect ratio changes are reported
+       //return tvsize;
+}
+
 void VideoOMX::executePendingModeChanges()
 {
        if (pendingmodechange) {
index 286f084957ff88d08e0ea5d279d7c06363541c44..85c0a5b4b1b5b06b740644a541d7189261b3384e 100644 (file)
@@ -81,6 +81,7 @@ class VideoOMX : public Video
     int setAspectRatio(UCHAR aspectRatio, int tparx,int tpary);   // This one does the pin 8 scart widescreen switching
     int setMode(UCHAR mode);
     int setTVsize(UCHAR size);               // Is the TV a widescreen?
+   UCHAR getTVsize();
 
     void executePendingModeChanges();
     int setDefaultAspect();
@@ -111,6 +112,7 @@ class VideoOMX : public Video
 
 
        virtual bool supportsh264(){return true;};
+       virtual bool supportsmpeg2(){return mpeg2_supported;};
 
        int WriteOutTS(const unsigned char *bulibaver,int length, int type);
        void WriteOutPATPMT();
@@ -278,6 +280,7 @@ class VideoOMX : public Video
           bool signalon;
           bool pendingmodechange;
           bool hdmi;
+          bool mpeg2_supported;
           int outputinterlaced;
 
 
index 0426ae83fb791a113a7c7aaa552943ceed827615..c96bd41e8c01cb652a08b50abd076393acaa5c4f 100644 (file)
@@ -360,7 +360,24 @@ int VRecordingList::doPlay(bool resume)
                        boxstack->add(vi);
                        boxstack->update(vi);
                        
-               } else {
+               } else if (!ish264 && !Video::getInstance()->supportsmpeg2()) {
+                       VInfo* vi = new VInfo();
+                       vi->setSize(360, 200);
+                       vi->createBuffer();
+                       if (Video::getInstance()->getFormat() == Video::PAL)
+                               vi->setPosition(190, 170);
+                       else
+                               vi->setPosition(180, 120);
+                       vi->setOneLiner(tr("Mpeg2 video not supported"));
+                       vi->setExitable();
+                       vi->setBorderOn(1);
+                       vi->setTitleBarColour(DrawStyle::DANGER);
+                       vi->okButton();
+                       vi->draw();
+                       boxstack->add(vi);
+                       boxstack->update(vi);
+
+               }else {
                        VVideoRec* vidrec = new VVideoRec(toPlay, ish264);
                        vidrec->draw();
                        boxstack->add(vidrec);