Ticket #4567: 4567-v2.patch

File 4567-v2.patch, 8.8 KB (added by danielk, 16 years ago)

Little tweaks to previous patch

  • libs/libmythtv/avformatdecoder.cpp

     
    11571157            aspect_ratio = 4.0 / 3;
    11581158        }
    11591159
    1160         GetNVP()->SetVideoParams(align_width, align_height, fps,
     1160        GetNVP()->SetVideoParams(enc->width, enc->height, fps,
    11611161                                 keyframedist, aspect_ratio, kScan_Detect,
    11621162                                 dvd_video_codec_changed);
    11631163    }
     
    23402340                uint awidth = width, aheight = height;
    23412341                align_dimensions(context, awidth, aheight);
    23422342
    2343                 GetNVP()->SetVideoParams(awidth, aheight, seqFPS,
     2343                GetNVP()->SetVideoParams(width, height, seqFPS,
    23442344                                         keyframedist, aspect,
    23452345                                         kScan_Detect);
    23462346               
     
    24202420            uint awidth = width, aheight = height;
    24212421            align_dimensions(context, awidth, aheight);
    24222422
    2423             GetNVP()->SetVideoParams(awidth, aheight, seqFPS,
     2423            GetNVP()->SetVideoParams(width, height, seqFPS,
    24242424                                     keyframedist, aspect_ratio,
    24252425                                     kScan_Detect);
    24262426
  • libs/libmythtv/videooutbase.cpp

     
    4747#define LOC_ERR QString("VideoOutput, Error: ")
    4848
    4949static QSize fix_1080i(QSize raw);
     50static QSize fix_alignment(QSize raw);
    5051static float fix_aspect(float raw);
    5152static QString to_comma_list(const QStringList &list);
    5253
     
    375376    }
    376377
    377378    display_visible_rect = QRect(0, 0, winw, winh);
    378     video_dim            = QSize(width, height);
    379     video_rect           = QRect(QPoint(winx, winy), fix_1080i(video_dim));
     379    video_disp_dim       = fix_1080i(QSize(width, height));
     380    video_dim            = fix_alignment(QSize(width, height));
     381    video_rect           = QRect(QPoint(winx, winy), video_disp_dim);
    380382
    381383    db_vdisp_profile->SetInput(video_dim);
    382384
     
    603605    (void)myth_codec_id;
    604606    (void)codec_private;
    605607
    606     video_dim = input_size;
     608    video_disp_dim = fix_1080i(input_size);
     609    video_dim      = fix_alignment(input_size);
    607610
    608611    db_vdisp_profile->SetInput(video_dim);
    609612
     
    710713QRect VideoOutput::GetVisibleOSDBounds(
    711714    float &visible_aspect, float &font_scaling, float themeaspect) const
    712715{
    713     float dv_w = ((float)video_dim.width())  / display_video_rect.width();
    714     float dv_h = ((float)video_dim.height()) / display_video_rect.height();
     716    float dv_w = (((float)video_disp_dim.width())  /
     717                  display_video_rect.width());
     718    float dv_h = (((float)video_disp_dim.height()) /
     719                  display_video_rect.height());
    715720
    716721    uint right_overflow = max((display_video_rect.width()
    717722                                + display_video_rect.left())
     
    723728    // top left and bottom right corners respecting letterboxing
    724729    QPoint tl = QPoint((uint) ceil(max(-display_video_rect.left(),0)*dv_w),
    725730                       (uint) ceil(max(-display_video_rect.top(),0)*dv_h));
    726     QPoint br = QPoint((uint) floor(video_dim.width()-(right_overflow*dv_w)),
    727                        (uint) floor(video_dim.height()-(lower_overflow*dv_h)));
     731    QPoint br = QPoint(
     732        (uint) floor(video_disp_dim.width()  - (right_overflow * dv_w)),
     733        (uint) floor(video_disp_dim.height() - (lower_overflow * dv_h)));
    728734    // adjust for overscan
    729735    if ((db_scale_vert > 0.0f) || (db_scale_horiz > 0.0f))
    730736    {
     
    762768 */
    763769QRect VideoOutput::GetTotalOSDBounds(void) const
    764770{
    765     return QRect(QPoint(0, 0), video_dim);
     771    return QRect(QPoint(0, 0), video_disp_dim);
    766772}
    767773
    768774/** \fn VideoOutput::ApplyManualScaleAndMove(void)
     
    869875    if (db_scale_horiz > 0)
    870876    {
    871877        float tmp = 1.0f - 2.0f * db_scale_horiz;
    872         video_rect.moveLeft((int) round(video_dim.width() * db_scale_horiz));
    873         video_rect.setWidth((int) round(video_dim.width() * tmp));
     878        video_rect.moveLeft(
     879            (int) round(video_disp_dim.width() * db_scale_horiz));
     880        video_rect.setWidth((int) round(video_disp_dim.width() * tmp));
    874881
    875882        int xoff = db_move.x();
    876883        if (xoff > 0)
     
    11021109void VideoOutput::MoveResize(void)
    11031110{
    11041111    // Preset all image placement and sizing variables.
    1105     video_rect         = QRect(QPoint(0, 0), fix_1080i(video_dim));
     1112    video_rect         = QRect(QPoint(0, 0), video_disp_dim);
    11061113    display_video_rect = display_visible_rect;
    11071114
    11081115    // Avoid too small frames for audio only streams (for OSD).
    11091116    if ((video_rect.width() <= 0) || (video_rect.height() <= 0))
    11101117    {
    1111         video_dim  = display_visible_rect.size();
    1112         video_rect = QRect(QPoint(0, 0), video_dim);
     1118        video_disp_dim = display_visible_rect.size();
     1119        video_dim      = fix_alignment(display_visible_rect.size());
     1120        video_rect     = QRect(QPoint(0, 0), video_dim);
    11131121    }
    11141122
    11151123    // Apply various modifications
     
    14451453    }
    14461454
    14471455    // adjust for non-square pixels on screen
    1448     float dispPixelAdj = (GetDisplayAspect() * video_dim.height()) /
    1449         video_dim.width();
     1456    float dispPixelAdj =
     1457        (GetDisplayAspect() * video_disp_dim.height())/video_disp_dim.width();
    14501458
    14511459    // adjust for non-square pixels in video
    14521460    float vidPixelAdj  = pipVideoWidth / (pipVideoAspect * pipVideoHeight);
     
    18261834    return raw;
    18271835}
    18281836
     1837/// Correct for underalignment
     1838static QSize fix_alignment(QSize raw)
     1839{
     1840    return QSize((raw.width()  + 15) & (~0xf),
     1841                 (raw.height() + 15) & (~0xf));
     1842}
     1843
    18291844/// Correct for rounding errors
    18301845static float fix_aspect(float raw)
    18311846{
  • libs/libmythtv/videoout_xv.cpp

     
    235235    QMutexLocker locker(&global_lock);
    236236
    237237    bool cid_changed = (myth_codec_id != av_codec_id);
    238     bool res_changed = input_size != video_dim;
     238    bool res_changed = input_size != video_disp_dim;
    239239    bool asp_changed = aspect != video_aspect;
    240240
    241241    VideoOutput::InputChanged(input_size, aspect, av_codec_id, codec_private);
     
    318318    QSize dvr2 = QSize(display_visible_rect.width()  & ~0x3,
    319319                       display_visible_rect.height() & ~0x1);
    320320
    321     QSize sz = (chroma_osd || gl_use_osd_opengl2) ? dvr2 : video_dim;
     321    QSize sz = (chroma_osd || gl_use_osd_opengl2) ? dvr2 : video_disp_dim;
    322322    return QRect(QPoint(0,0), sz);
    323323}
    324324
     
    379379
    380380void VideoOutputXv::ResizeForVideo(void)
    381381{
    382     ResizeForVideo(video_dim.width(), video_dim.height());
     382    ResizeForVideo(video_disp_dim.width(), video_disp_dim.height());
    383383}
    384384
    385385void VideoOutputXv::ResizeForGui(void)
     
    40734073    QRect position;
    40744074    float pipVideoAspect = 1.3333f;
    40754075    // set height
    4076     int tmph = (video_dim.height() * db_pip_size) / 100;
     4076    int tmph = (video_disp_dim.height() * db_pip_size) / 100;
    40774077    // adjust for aspect override modes...
    40784078    int letterXadj = 0;
    40794079    int letterYadj = 0;
     
    41064106            break;
    41074107        case kPIPBottomLeft:
    41084108            xoff += letterXadj;
    4109             yoff = video_dim.height() - position.height() -
     4109            yoff = video_disp_dim.height() - position.height() -
    41104110                yoff - letterYadj;
    41114111            break;
    41124112        case kPIPTopRight:
    4113             xoff = video_dim.width() - position.width() -
     4113            xoff = video_disp_dim.width() - position.width() -
    41144114                    xoff - letterXadj;
    41154115            yoff = yoff + letterYadj;
    41164116            break;
    41174117        case kPIPBottomRight:
    4118             xoff = video_dim.width() - position.width() -
     4118            xoff = video_disp_dim.width() - position.width() -
    41194119                    xoff - letterXadj;
    4120             yoff = video_dim.height() - position.height() -
     4120            yoff = video_disp_dim.height() - position.height() -
    41214121                   yoff - letterYadj;
    41224122            break;
    41234123    }
  • libs/libmythtv/videooutbase.h

     
    273273    float   display_aspect;   ///< Physical aspect ratio of playback window
    274274
    275275    // Video dimensions
    276     QSize   video_dim;        ///< Pixel dimensions of video
     276    QSize   video_dim;        ///< Pixel dimensions of video buffer
     277    QSize   video_disp_dim;   ///< Pixel dimensions of video display area
    277278    float   video_aspect;     ///< Physical aspect ratio of video
    278279
    279280    /// Normally this is the same as videoAspect, but may not be