Ticket #10291: cc708_colorfix.patch

File cc708_colorfix.patch, 4.8 KB (added by Jim Stichnoth <stichnot@…>, 8 years ago)
  • mythtv/libs/libmythtv/avformatdecoder.cpp

    diff --git a/mythtv/libs/libmythtv/avformatdecoder.cpp b/mythtv/libs/libmythtv/avformatdecoder.cpp
    index a5fa68e..d3e25ad 100644
    a b AvFormatDecoder::AvFormatDecoder(MythPlayer *parent, 
    322322    cc608_build_parity_table(cc608_parity_table);
    323323
    324324    if (gCoreContext->GetNumSetting("CCBackground", 0))
    325         CC708Window::forceWhiteOnBlackText = true;
     325        CC708Window::forceBlackBackground = true;
    326326
    327327    LOG(VB_PLAYBACK, LOG_DEBUG, LOC + QString("PlayerFlags: 0x%1")
    328328        .arg(playerFlags, 0, 16));
  • mythtv/libs/libmythtv/cc708window.cpp

    diff --git a/mythtv/libs/libmythtv/cc708window.cpp b/mythtv/libs/libmythtv/cc708window.cpp
    index e133eae..e6a57cc 100644
    a b const uint k708AttrOpacityFlash = 1; 
    106106const uint k708AttrOpacityTranslucent = 2;
    107107const uint k708AttrOpacityTransparent = 3;
    108108
    109 bool CC708Window::forceWhiteOnBlackText = false;
     109bool CC708Window::forceBlackBackground = false;
    110110
    111111CC708Window::CC708Window()
    112112    : priority(0),              visible(0),
    void CC708Window::DefineWindow(int _priority, int _visible, 
    177177        for (uint i = old_row * old_col; i < num; i++)
    178178        {
    179179            new_text[i].attr = pen.attr;
    180             if (forceWhiteOnBlackText)
     180            if (forceBlackBackground)
    181181            {
    182182                new_text[i].attr.fg_opacity = k708AttrOpacityTransparent;
    183183                new_text[i].attr.bg_opacity = k708AttrOpacityTransparent;
    void CC708Window::DefineWindow(int _priority, int _visible, 
    202202        for (uint i = 0; i < num; i++)
    203203        {
    204204            text[i].attr = pen.attr;
    205             if (forceWhiteOnBlackText)
     205            if (forceBlackBackground)
    206206            {
    207207                text[i].attr.fg_opacity = k708AttrOpacityTransparent;
    208208                text[i].attr.bg_opacity = k708AttrOpacityTransparent;
    void CC708Window::Clear(void) 
    241241    {
    242242        text[i].character = QChar(' ');
    243243        text[i].attr = pen.attr;
    244         if (forceWhiteOnBlackText)
     244        if (forceBlackBackground)
    245245        {
    246246            text[i].attr.fg_opacity = k708AttrOpacityTransparent;
    247247            text[i].attr.bg_opacity = k708AttrOpacityTransparent;
    void CC708Window::AddChar(QChar ch) 
    370370    }
    371371
    372372    GetCCChar().attr      = pen.attr;
    373     if (forceWhiteOnBlackText)
     373    if (forceBlackBackground)
    374374    {
    375         GetCCChar().attr.fg_color   = k708AttrColorWhite;
    376         GetCCChar().attr.fg_opacity = k708AttrOpacitySolid;
    377375        GetCCChar().attr.bg_color   = k708AttrColorBlack;
    378376        GetCCChar().attr.bg_opacity = k708AttrOpacityTranslucent;
    379         GetCCChar().attr.edge_color = k708AttrColorWhite;
    380377    }
    381378    GetCCChar().character = ch;
    382379    int c = pen.column;
    void CC708Pen::SetPenStyle(uint style) 
    546543CC708Character::CC708Character(const CC708Window &win)
    547544{
    548545    attr = win.pen.attr;
    549     if (CC708Window::forceWhiteOnBlackText)
     546    if (CC708Window::forceBlackBackground)
    550547    {
    551548        attr.fg_opacity = k708AttrOpacityTransparent;
    552549        attr.bg_opacity = k708AttrOpacityTransparent;
    bool CC708CharacterAttribute::operator==( 
    573570
    574571QColor CC708CharacterAttribute::ConvertToQColor(uint c)
    575572{
    576     //int X[4] = {0, 85, 170, 255}; RGB( X[(c>>4)&3], X[(c>>2)&3], X[c&3] )
    577     return QColor((c & 0x30) << 2, (c & 0x0c) << 4, (c & 0x3) << 6);
     573    // Color is expressed in 6 bits, 2 each for red, green, and blue.
     574    // U.S. ATSC programs seem to use just the higher-order bit,
     575    // i.e. values 0 and 2, so the last two elements of X[] are both
     576    // set to the maximum 255, otherwise font colors are dim.
     577    static int X[] = {0, 96, 255, 255};
     578    return QColor(X[(c>>4)&3], X[(c>>2)&3], X[c&3]);
    578579}
  • mythtv/libs/libmythtv/cc708window.h

    diff --git a/mythtv/libs/libmythtv/cc708window.h b/mythtv/libs/libmythtv/cc708window.h
    index 2c1db0a..ccce79e 100644
    a b class MTV_PUBLIC CC708Window 
    200200    bool            exists;
    201201    bool            changed;
    202202
    203     static bool     forceWhiteOnBlackText;
     203    static bool     forceBlackBackground;
    204204
    205205    mutable QMutex  lock;
    206206};
  • mythtv/programs/mythfrontend/globalsettings.cpp

    diff --git a/mythtv/programs/mythfrontend/globalsettings.cpp b/mythtv/programs/mythfrontend/globalsettings.cpp
    index 7e6fad3..6f2785c 100644
    a b static HostCheckBox *CCBackground() 
    14461446    gc->setValue(false);
    14471447    gc->setHelpText(QObject::tr(
    14481448                        "If enabled, captions will be displayed "
    1449                         "as white text over a black background "
     1449                        "over a black background "
    14501450                        "for better contrast."));
    14511451    return gc;
    14521452}