Ticket #3797: 3797-v1.patch

File 3797-v1.patch, 6.4 KB (added by danielk, 13 years ago)

Patch to allow setting the color for mythtv's letterboxing.

  • libs/libmythtv/videoouttypes.h

     
    4747    kAdjustFill_END
    4848} AdjustFillMode;
    4949
     50typedef enum LetterBoxColour
     51{
     52    kLetterBoxColour_Toggle = -1,
     53    kLetterBoxColour_Black = 0,
     54    kLetterBoxColour_Gray25,
     55    kLetterBoxColour_END
     56} LetterBoxColour;
     57
    5058typedef enum FrameScanType
    5159{
    5260    kScan_Ignore       = -1,
     
    136144    return QDeepCopy<QString>(ret);
    137145}
    138146
     147inline QString toString(LetterBoxColour letterboxcolour)
     148{
     149    QString ret = QObject::tr("Black");
     150    switch (letterboxcolour)
     151    {
     152        case kLetterBoxColour_Gray25: ret = QObject::tr("Gray"); break;
     153        case kLetterBoxColour_Black:
     154        case kLetterBoxColour_Toggle:
     155        case kLetterBoxColour_END: break;
     156    }
     157    return QDeepCopy<QString>(ret);
     158}
     159
     160inline QString toXString(LetterBoxColour letterboxcolour)
     161{
     162    QString ret = "gray0";
     163    switch (letterboxcolour)
     164    {
     165        case kLetterBoxColour_Gray25: ret = "gray25"; break;
     166        case kLetterBoxColour_Black:
     167        case kLetterBoxColour_Toggle:
     168        case kLetterBoxColour_END: break;
     169    }
     170    return QDeepCopy<QString>(ret);
     171}
     172
    139173inline float get_aspect_override(AspectOverrideMode aspectmode, float orig)
    140174{
    141175    float ret = orig;
  • libs/libmythtv/videooutbase.cpp

     
    242242    db_scale_horiz(0.0f),               db_scale_vert(0.0f),
    243243    db_pip_location(kPIPTopLeft),       db_pip_size(26),
    244244    db_aspectoverride(kAspect_Off),     db_adjustfill(kAdjustFill_Off),
     245    db_letterbox_colour(kLetterBoxColour_Black),
    245246    db_deint_filtername(QString::null),
    246247    db_vdisp_profile(new VideoDisplayProfile()),
    247248
     
    309310        gContext->GetNumSetting("AspectOverride",      0);
    310311    db_adjustfill = (AdjustFillMode)
    311312        gContext->GetNumSetting("AdjustFill",          0);
     313    db_letterbox_colour = (LetterBoxColour)
     314        gContext->GetNumSetting("LetterboxColour",     0);
    312315}
    313316
    314317/**
  • libs/libmythtv/videoout_xv.h

     
    214214    int                  XJ_screen_num;
    215215    unsigned long        XJ_white;
    216216    unsigned long        XJ_black;
     217    unsigned long        XJ_letterbox_colour;
    217218    int                  XJ_depth;
    218219    int                  XJ_screenx;
    219220    int                  XJ_screeny;
  • libs/libmythtv/videoout_xv.cpp

     
    105105      use_i420_hack_for_broken_driver(false),
    106106
    107107      XJ_root(0),  XJ_win(0), XJ_curwin(0), XJ_gc(0), XJ_screen(NULL),
    108       XJ_disp(NULL), XJ_screen_num(0), XJ_white(0), XJ_black(0), XJ_depth(0),
     108      XJ_disp(NULL), XJ_screen_num(0),
     109      XJ_white(0), XJ_black(0), XJ_letterbox_colour(0), XJ_depth(0),
    109110      XJ_screenx(0), XJ_screeny(0), XJ_screenwidth(0), XJ_screenheight(0),
    110111      XJ_started(false),
    111112
     
    15301531    XJ_root       = DefaultRootWindow(XJ_disp);
    15311532    XJ_gc         = XCreateGC(XJ_disp, XJ_win, 0, 0);
    15321533    XJ_depth      = DefaultDepthOfScreen(XJ_screen);
     1534
     1535    // The letterbox color..
     1536    XJ_letterbox_colour = XJ_black;
     1537    Colormap cmap = XDefaultColormap(XJ_disp, XJ_screen_num);
     1538    XColor colour, colour_exact;
     1539    QString name = toXString(db_letterbox_colour);
     1540    if (XAllocNamedColor(XJ_disp, cmap, name.ascii(), &colour, &colour_exact))
     1541        XJ_letterbox_colour = colour.pixel;
     1542
    15331543    X11U;
    15341544
     1545
    15351546    // Basic setup
    15361547    VideoOutput::Init(width, height, aspect,
    15371548                      winid, winx, winy, winw, winh,
     
    31273138    needrepaint = false;
    31283139    xv_need_bobdeint_repaint = false;
    31293140
    3130     // Draw black in masked areas
    3131     XSetForeground(XJ_disp, XJ_gc, XJ_black);
     3141    // Set colour for masked areas
     3142    XSetForeground(XJ_disp, XJ_gc, XJ_letterbox_colour);
    31323143
    31333144    if (display_video_rect.left() > display_visible_rect.left())
    31343145    { // left
  • libs/libmythtv/videooutbase.h

     
    248248    PictureSettingMap  db_pict_attr; ///< Picture settings
    249249    AspectOverrideMode db_aspectoverride;
    250250    AdjustFillMode     db_adjustfill;
     251    LetterBoxColour    db_letterbox_colour;
    251252    QString db_deint_filtername;
    252253
    253254    VideoDisplayProfile *db_vdisp_profile;
  • programs/mythfrontend/globalsettings.cpp

     
    20992099    return gc;
    21002100}
    21012101
     2102static HostComboBox *LetterboxingColour()
     2103{
     2104    HostComboBox *gc = new HostComboBox("LetterboxColour");
     2105    gc->setLabel(QObject::tr("Letterboxing Color"));
     2106    for (int m = kLetterBoxColour_Black; m < kLetterBoxColour_END; m++)
     2107        gc->addSelection(toString((LetterBoxColour)m), QString::number(m));
     2108    gc->setHelpText(
     2109        QObject::tr(
     2110            "By default MythTV uses black letterboxing to match broadcaster "
     2111            "letterboxing, but those with plasma screens may prefer gray "
     2112            "to minimize burn-in."));
     2113    return gc;
     2114}
     2115
    21022116static HostComboBox *AspectOverride()
    21032117{
    21042118    HostComboBox *gc = new HostComboBox("AspectOverride");
     
    43794393    oscan->addChild(ocol1);
    43804394    oscan->addChild(ocol2);
    43814395
     4396    HorizontalConfigurationGroup* aspect_fill =
     4397        new HorizontalConfigurationGroup(false, false, true, true);
     4398    aspect_fill->addChild(AspectOverride());
     4399    aspect_fill->addChild(AdjustFill());
     4400
    43824401    general2->addChild(oscan);
    4383     general2->addChild(AspectOverride());
    4384     general2->addChild(AdjustFill());
     4402    general2->addChild(aspect_fill);
     4403    general2->addChild(LetterboxingColour());
    43854404    general2->addChild(PIPLocationComboBox());
    43864405    general2->addChild(PlaybackExitPrompt());
    43874406    general2->addChild(EndOfRecordingExitPrompt());