[mythtv] Re: [PATCH] Specify aspect ratio cycle
Stefan Frank
sfr+lists at 6913304088794.gnuu.de
Mon Jun 7 16:02:53 EDT 2004
Hi Hamish and friends!
On Mon, 07 Jun 2004, Hamish Moffatt wrote:
> On Sun, Jun 06, 2004 at 08:38:38PM +1000, Hamish Moffatt wrote:
> > On Thu, Jun 03, 2004 at 12:21:28AM +0200, Kristof Pelckmans wrote:
> > > > Good idea. However I think you changed the default order, which violates
> > > > the principle of least surprise. Currently it is:
> > > >
> > > > kLetterbox_4_3 = 0,
> > > > kLetterbox_16_9,
> > > > kLetterbox_4_3_Zoom,
> > > > kLetterbox_16_9_Zoom,
> > > > kLetterbox_16_9_Stretch,
> > >
> > > It was due to the standard behaviour of QMap : the items are sorted
> > > alphabetically (by key) when iterating over the map.
> >
> > I tried your patch and indeed now it uses the standard order for the
> > modes. The only problem is that it doesn't take into account the
> > default mode.
>
> Sorry, I had another problem. The selected modes don't seem to be
> correct. For example I set my modes to "16:9, 16:9 Zoom". What I get is:
>
> 1. Start in 16:9 (default for my source material),
> 2. Press W takes me to 16:9 (bug I reported already),
> 3. Press W again takes me to 4:3 (why?),
> 4. Press W again returns to 16:9 (ok).
>
> Similarly if I set "16:9 Zoom, 16:9" I get 16:9, then 16:9 Zoom, then
> 4:3, then 16:9 Zoom, then 4:3 etc. Seems like the second mode is 4:3
> regardless of what I actually set. I didn't try a set of three modes.
>
>
> Hamish
> --
> Hamish Moffatt VK3SB <hamish at debian.org> <hamish at cloud.net.au>
here's an combined patch of Kristofs and one i send a few days ago.
My part fixes the zoom-mode cycling via w and adds the 16:9 Stretch mode
to the AspectOverride setting. I don't see the behaviour you described
here Hamish. As it also changes the meaning of the AspectOverride value in
the db, simply reselect your preferred mode in the settings screen.
Bye, Stefan
--
I'm wet! I'm wild!
-------------- next part --------------
--- mythtv/libs/libmythtv/videoout_directfb.cpp 2004-05-25 10:24:21.000000000 +0200
+++ mythtv-local/libs/libmythtv/videoout_directfb.cpp 2004-06-07 19:43:20.000000000 +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);
--- mythtv/libs/libmythtv/videooutbase.cpp 2004-05-28 10:38:08.000000000 +0200
+++ mythtv-local/libs/libmythtv/videooutbase.cpp 2004-06-07 19:43:20.000000000 +0200
@@ -165,8 +165,31 @@
int asp_override = gContext->GetNumSetting("AspectOverride", 0);
- if (asp_override > 0)
- AspectOverride(asp_override);
+ 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("AspectRatioCycle");
+ if (aspectRatios.length() > 1)
+ {
+ QStringList aspectRatioList = QStringList::split(",", aspectRatios);
+ for ( QStringList::Iterator it = aspectRatioList.begin(); it != aspectRatioList.end(); ++it )
+ {
+ aspectRatioCycle.append(aspectRatioMap[*it]);
+ }
+ }
+ else
+ {
+ for ( int i = 0; i < kLetterbox_END; i++ )
+ {
+ aspectRatioCycle.append(i);
+ }
+ }
+ aspectRatioIterator = aspectRatioCycle.begin();
embedding = false;
@@ -175,27 +198,23 @@
void VideoOutput::AspectOverride(int override)
{
- switch(override)
+ if (override > kLetterbox_Toggle && override < kLetterbox_END)
{
- default:
- case 0:
- break;
- case 1:
- XJ_aspect = (16.0 / 9);
- letterbox = 0;
- break;
- case 2:
- XJ_aspect = (4.0 / 3);
- letterbox = 1;
- break;
- case 3:
- XJ_aspect = (16.0 / 9);
- letterbox = 2;
- break;
- case 4:
- XJ_aspect = (4.0 / 3);
- letterbox = 3;
- break;
+ letterbox = override;
+
+ switch(letterbox)
+ {
+ case kLetterbox_4_3:
+ case kLetterbox_4_3_Zoom:
+ XJ_aspect = (4.0 / 3);
+ break;
+ case kLetterbox_16_9:
+ case kLetterbox_16_9_Zoom:
+ case kLetterbox_16_9_Stretch: XJ_aspect = (16.0 / 9);
+ break;
+ default:
+ break;
+ }
}
}
@@ -532,8 +551,11 @@
{
if (letterboxMode == kLetterbox_Toggle)
{
- if (++letterbox >= kLetterbox_END)
- letterbox = 0;
+ if(aspectRatioIterator == aspectRatioCycle.end())
+ aspectRatioIterator = aspectRatioCycle.begin();
+
+ letterbox = *aspectRatioIterator;
+ aspectRatioIterator++;
}
else
{
--- mythtv/libs/libmythtv/videooutbase.h 2004-06-05 16:25:37.000000000 +0200
+++ mythtv-local/libs/libmythtv/videooutbase.h 2004-06-07 19:43:20.000000000 +0200
@@ -12,6 +12,7 @@
#include <qptrqueue.h>
#include <qwaitcondition.h>
#include <qptrlist.h>
+#include <qvaluelist.h>
using namespace std;
@@ -246,6 +243,10 @@
ImgReSampleContext *pipscontext;
bool allowpreviewepg;
+
+ QMap<QString, int> aspectRatioMap;
+ QValueList<int> aspectRatioCycle;
+ QValueList<int>::Iterator aspectRatioIterator;
};
#endif
--- mythtv/programs/mythfrontend/globalsettings.cpp 2004-06-05 16:25:37.000000000 +0200
+++ mythtv-local/programs/mythfrontend/globalsettings.cpp 2004-06-07 19:47:34.000000000 +0200
@@ -1131,17 +1086,32 @@
AspectOverride():
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("Off"), "-1");
+ addSelection(QObject::tr("4:3 Normal"), "0");
+ addSelection(QObject::tr("16:9 Anamorphic"), "1");
+ addSelection(QObject::tr("4:3 Zoom"), "2");
+ addSelection(QObject::tr("16:9 Zoom"), "3");
+ addSelection(QObject::tr("16:9 Stretch"), "4");
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("AspectRatioCycle") {
+ 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 after commas). "
+ "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 {
@@ -2374,6 +2343,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