Ticket #7776: black-background.patch

File black-background.patch, 3.5 KB (added by Clayton Smith <argilo@…>, 2 years ago)

Add support for black background behind EIA-708 closed captions

  • libs/libmythtv/osdtypes.cpp

     
    26002600} 
    26012601 
    26022602OSDType708CC::OSDType708CC(const QString &name, TTFFont *fonts[48], 
    2603                            int xoff, int yoff, int dispw, int disph) :  
     2603                          int xoff, int yoff, int dispw, int disph, 
     2604                          float wmult, float hmult) :  
    26042605    OSDType(name) 
    26052606{ 
    26062607    xoffset = xoff; 
     
    26102611 
    26112612    for (uint i = 0; i < 48; i++) 
    26122613        m_fonts[i] = fonts[i]; 
     2614 
     2615    QRect rect = QRect(0, 0, 0, 0); 
     2616    m_box = new OSDTypeBox("cc_background", rect, wmult, hmult); 
     2617    m_ccbackground = gContext->GetNumSetting("CCBackground", 0); 
    26132618} 
    26142619 
    26152620QRect OSDType708CC::CalcBounds(const OSDSurface *surface, 
     
    27652770                font->setShadow(+2, +2); 
    27662771            } 
    27672772 
     2773            if (m_ccbackground) 
     2774            { 
     2775                QRect rect = QRect(0, 0, text_length + 1,  
     2776                                   (font->Size() * 3 / 2) + 1); 
     2777                m_box->SetRect(rect, m_wmult, m_hmult); 
     2778                m_box->Draw(surface, 0, 0, ul.x() + tot_width - 2, 
     2779                                           ul.y() + total_height - 2); 
     2780            } 
     2781 
    27682782            font->DrawString(surface, 
    27692783                             ul.x() + tot_width, ul.y() + total_height + 2, 
    27702784                             list[i]->str, maxx, maxy, 
  • libs/libmythtv/osdtypes.h

     
    604604{ 
    605605  public: 
    606606    OSDType708CC(const QString &name, TTFFont *fonts[48], 
    607                  int xoff, int yoff, int dispw, int disph); 
     607                 int xoff, int yoff, int dispw, int disph, 
     608                 float wmult, float hmult); 
    608609    virtual ~OSDType708CC() {} 
    609610 
    610611    void Reinit(float, float) {} 
     
    625626 
    626627    TTFFont *m_fonts[48]; 
    627628 
     629    OSDTypeBox *m_box; 
     630    int m_ccbackground; 
     631    float m_wmult, m_hmult; 
    628632    int xoffset, yoffset, displaywidth, displayheight; 
    629633}; 
    630634 
  • libs/libmythtv/osd.cpp

     
    325325    AddSet(container, name); 
    326326    OSDType708CC *ccpage =  
    327327        new OSDType708CC(name, ccfonts, xoffset, yoffset,  
    328                          displaywidth, displayheight); 
     328                         displaywidth, displayheight, wmult, hmult); 
    329329    container->AddType(ccpage); 
    330330 
    331331    VERBOSE(VB_VBI, LOC + "InitCC708() -- end"); 
  • programs/mythfrontend/globalsettings.cpp

     
    19501950static HostCheckBox *CCBackground() 
    19511951{ 
    19521952    HostCheckBox *gc = new HostCheckBox("CCBackground"); 
    1953     gc->setLabel(QObject::tr("Black background for analog closed captioning")); 
     1953    gc->setLabel(QObject::tr("Black background for closed captioning")); 
    19541954    gc->setValue(false); 
    19551955    gc->setHelpText(QObject::tr( 
    1956                         "If enabled, analog captions will be displayed " 
     1956                        "If enabled, captions will be displayed " 
    19571957                        "over a black space for maximum contrast. Otherwise, " 
    19581958                        "captions will use outlined text over the picture.")); 
    19591959    return gc;