[mythtv] [PATCH] Specify aspect ratio cycle

Kristof Pelckmans kristof.pelckmans at antwerpen.be
Tue Jun 1 19:05:03 EDT 2004


Hello,

Included in attachment a patch for specifying the aspect ratio cycle :

It allows you to specify which aspect ratio changes you want to have when
pressing the 'W' key during playback. You specify the changes you want to have
in an ordered, comma-separated list.

I put it under Setup -> TV Settings -> Playback Settings -> General Playback.

When you specify nothing, you get all the values (currently in the order 16:9,
16:9 Stretch, 16:9 Zoom, 4:3, 4:3 Zoom).

It saves me a lot of remote button presses :-)

Ciaos,

Kristof

PS I also changed a tiny bit on the directfb output plugin in order to make it
initialize the aspect ratio correctly, hope this is ok.
-------------- next part --------------
diff -Nurd -x CVS -x Makefile -x '.*' mythtv/libs/libmythtv/videoout_directfb.cpp mythtv-dev/libs/libmythtv/videoout_directfb.cpp
--- mythtv/libs/libmythtv/videoout_directfb.cpp	2004-05-25 07:13:30.000000000 +0200
+++ mythtv-dev/libs/libmythtv/videoout_directfb.cpp	2004-06-02 00:33:26.714494608 +0200
@@ -456,7 +456,6 @@
                       embedid);
 
     VERBOSE(VB_GENERAL, QString("DirectFB output : screen size %1x%2").arg(data->screen_width).arg(data->screen_height));
-    MoveResize();
 
     if (gContext->GetNumSetting("UseOutputPictureControls", 0))
     {
@@ -471,6 +470,7 @@
 
     w_mm = data->screen_width;
     h_mm = data->screen_height;
+    MoveResize();
     //w_mm = DisplayWidthMM(data->XJ_disp, XJ_screen_num);
     //h_mm = DisplayHeightMM(data->XJ_disp, XJ_screen_num);
 
diff -Nurd -x CVS -x Makefile -x '.*' mythtv/libs/libmythtv/videooutbase.cpp mythtv-dev/libs/libmythtv/videooutbase.cpp
--- mythtv/libs/libmythtv/videooutbase.cpp	2004-04-30 08:54:35.000000000 +0200
+++ mythtv-dev/libs/libmythtv/videooutbase.cpp	2004-06-02 01:01:49.696601976 +0200
@@ -168,6 +168,27 @@
     if (asp_override > 0) 
         AspectOverride(asp_override);
 
+    aspectRatioMap["4:3"] = kLetterbox_4_3;
+    aspectRatioMap["16:9"] = kLetterbox_16_9;
+    aspectRatioMap["4:3 Zoom"] = kLetterbox_4_3_Zoom;
+    aspectRatioMap["16:9 Zoom"] = kLetterbox_16_9_Zoom;
+    aspectRatioMap["16:9 Stretch"] = kLetterbox_16_9_Stretch;
+
+    QString aspectRatios = gContext->GetSetting("AspectRatioList");
+    if (aspectRatios.length() > 1)
+    {
+	aspectRatioList = QStringList::split(",", aspectRatios);
+    }
+    else
+    {
+	QMap<QString, int>::Iterator it;
+        for ( it = aspectRatioMap.begin(); it != aspectRatioMap.end(); ++it )
+	{
+            aspectRatioList.append(it.key());
+        }
+    }
+    aspectRatioIterator = aspectRatioList.begin();
+
     embedding = false;
 
     return true;
@@ -532,8 +553,11 @@
 {
     if (letterboxMode == kLetterbox_Toggle)
     {
-        if (++letterbox >= kLetterbox_END)
-            letterbox = 0;
+	if(aspectRatioIterator == aspectRatioList.end())
+	     aspectRatioIterator = aspectRatioList.begin();
+
+	letterbox = aspectRatioMap[*aspectRatioIterator];
+	aspectRatioIterator++;
     }
     else
     {
diff -Nurd -x CVS -x Makefile -x '.*' mythtv/libs/libmythtv/videooutbase.h mythtv-dev/libs/libmythtv/videooutbase.h
--- mythtv/libs/libmythtv/videooutbase.h	2004-05-20 09:09:02.000000000 +0200
+++ mythtv-dev/libs/libmythtv/videooutbase.h	2004-06-01 23:44:47.808235808 +0200
@@ -12,6 +12,7 @@
 #include <qptrqueue.h>
 #include <qwaitcondition.h>
 #include <qptrlist.h>
+#include <qstringlist.h>
 
 using namespace std;
 
@@ -242,6 +243,10 @@
     ImgReSampleContext *pipscontext;
 
     bool allowpreviewepg;
+    
+    QMap<QString, int> aspectRatioMap;
+    QStringList aspectRatioList;
+    QStringList::Iterator aspectRatioIterator;
 };
 
 #endif
diff -Nurd -x CVS -x Makefile -x '.*' mythtv/programs/mythfrontend/globalsettings.cpp mythtv-dev/programs/mythfrontend/globalsettings.cpp
--- mythtv/programs/mythfrontend/globalsettings.cpp	2004-05-30 18:36:19.000000000 +0200
+++ mythtv-dev/programs/mythfrontend/globalsettings.cpp	2004-06-02 00:14:52.281914112 +0200
@@ -1075,16 +1075,28 @@
         GlobalSetting("AspectOverride") {
         setLabel(QObject::tr("Aspect Override"));
         addSelection(QObject::tr("Off"), "0");
-        addSelection(QObject::tr("16/9 Anamorphic"), "1");
-        addSelection(QObject::tr("4/3 Normal"), "2");
-        addSelection(QObject::tr("16/9 Zoom"), "3");
-        addSelection(QObject::tr("4/3 Zoom"), "3");
+        addSelection(QObject::tr("16:9 Anamorphic"), "1");
+        addSelection(QObject::tr("4:3 Normal"), "2");
+        addSelection(QObject::tr("16:9 Zoom"), "3");
+        addSelection(QObject::tr("4:3 Zoom"), "3");
         setHelpText(QObject::tr("This will override any aspect ratio in the "
                     "recorded stream, the same as pressing the W Key "
                     "during playback."));
     };
 };
 
+class AspectRatioList: public LineEditSetting, public GlobalSetting {
+public:
+    AspectRatioList():
+        GlobalSetting("AspectRatioList") {
+        setLabel(QObject::tr("Aspect ratio cycle"));
+        setValue("");
+        setHelpText(QObject::tr("The aspect ratios used when pressing \'W\' during playback. "
+				"They are specified as an ordered, comma-separated list (without spaces). "
+                                "Possible values are : 4:3, 4:3 Zoom, 16:9, 16:9 Zoom and 16:9 Stretch."));
+    };
+};
+
 // Theme settings
 
 class GuiWidth: public SpinBoxSetting, public GlobalSetting {
@@ -2316,6 +2328,7 @@
     general->addChild(new UseVideoTimebase());
     general->addChild(new DecodeExtraAudio());
     general->addChild(new AspectOverride());
+    general->addChild(new AspectRatioList());
     general->addChild(new PIPLocation());
     addChild(general);
 


More information about the mythtv-dev mailing list