Ticket #4567: 4567-v2.patch
File 4567-v2.patch, 8.8 KB (added by , 16 years ago) |
---|
-
libs/libmythtv/avformatdecoder.cpp
1157 1157 aspect_ratio = 4.0 / 3; 1158 1158 } 1159 1159 1160 GetNVP()->SetVideoParams( align_width, align_height, fps,1160 GetNVP()->SetVideoParams(enc->width, enc->height, fps, 1161 1161 keyframedist, aspect_ratio, kScan_Detect, 1162 1162 dvd_video_codec_changed); 1163 1163 } … … 2340 2340 uint awidth = width, aheight = height; 2341 2341 align_dimensions(context, awidth, aheight); 2342 2342 2343 GetNVP()->SetVideoParams( awidth, aheight, seqFPS,2343 GetNVP()->SetVideoParams(width, height, seqFPS, 2344 2344 keyframedist, aspect, 2345 2345 kScan_Detect); 2346 2346 … … 2420 2420 uint awidth = width, aheight = height; 2421 2421 align_dimensions(context, awidth, aheight); 2422 2422 2423 GetNVP()->SetVideoParams( awidth, aheight, seqFPS,2423 GetNVP()->SetVideoParams(width, height, seqFPS, 2424 2424 keyframedist, aspect_ratio, 2425 2425 kScan_Detect); 2426 2426 -
libs/libmythtv/videooutbase.cpp
47 47 #define LOC_ERR QString("VideoOutput, Error: ") 48 48 49 49 static QSize fix_1080i(QSize raw); 50 static QSize fix_alignment(QSize raw); 50 51 static float fix_aspect(float raw); 51 52 static QString to_comma_list(const QStringList &list); 52 53 … … 375 376 } 376 377 377 378 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); 380 382 381 383 db_vdisp_profile->SetInput(video_dim); 382 384 … … 603 605 (void)myth_codec_id; 604 606 (void)codec_private; 605 607 606 video_dim = input_size; 608 video_disp_dim = fix_1080i(input_size); 609 video_dim = fix_alignment(input_size); 607 610 608 611 db_vdisp_profile->SetInput(video_dim); 609 612 … … 710 713 QRect VideoOutput::GetVisibleOSDBounds( 711 714 float &visible_aspect, float &font_scaling, float themeaspect) const 712 715 { 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()); 715 720 716 721 uint right_overflow = max((display_video_rect.width() 717 722 + display_video_rect.left()) … … 723 728 // top left and bottom right corners respecting letterboxing 724 729 QPoint tl = QPoint((uint) ceil(max(-display_video_rect.left(),0)*dv_w), 725 730 (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))); 728 734 // adjust for overscan 729 735 if ((db_scale_vert > 0.0f) || (db_scale_horiz > 0.0f)) 730 736 { … … 762 768 */ 763 769 QRect VideoOutput::GetTotalOSDBounds(void) const 764 770 { 765 return QRect(QPoint(0, 0), video_di m);771 return QRect(QPoint(0, 0), video_disp_dim); 766 772 } 767 773 768 774 /** \fn VideoOutput::ApplyManualScaleAndMove(void) … … 869 875 if (db_scale_horiz > 0) 870 876 { 871 877 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)); 874 881 875 882 int xoff = db_move.x(); 876 883 if (xoff > 0) … … 1102 1109 void VideoOutput::MoveResize(void) 1103 1110 { 1104 1111 // 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); 1106 1113 display_video_rect = display_visible_rect; 1107 1114 1108 1115 // Avoid too small frames for audio only streams (for OSD). 1109 1116 if ((video_rect.width() <= 0) || (video_rect.height() <= 0)) 1110 1117 { 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); 1113 1121 } 1114 1122 1115 1123 // Apply various modifications … … 1445 1453 } 1446 1454 1447 1455 // 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(); 1450 1458 1451 1459 // adjust for non-square pixels in video 1452 1460 float vidPixelAdj = pipVideoWidth / (pipVideoAspect * pipVideoHeight); … … 1826 1834 return raw; 1827 1835 } 1828 1836 1837 /// Correct for underalignment 1838 static QSize fix_alignment(QSize raw) 1839 { 1840 return QSize((raw.width() + 15) & (~0xf), 1841 (raw.height() + 15) & (~0xf)); 1842 } 1843 1829 1844 /// Correct for rounding errors 1830 1845 static float fix_aspect(float raw) 1831 1846 { -
libs/libmythtv/videoout_xv.cpp
235 235 QMutexLocker locker(&global_lock); 236 236 237 237 bool cid_changed = (myth_codec_id != av_codec_id); 238 bool res_changed = input_size != video_di m;238 bool res_changed = input_size != video_disp_dim; 239 239 bool asp_changed = aspect != video_aspect; 240 240 241 241 VideoOutput::InputChanged(input_size, aspect, av_codec_id, codec_private); … … 318 318 QSize dvr2 = QSize(display_visible_rect.width() & ~0x3, 319 319 display_visible_rect.height() & ~0x1); 320 320 321 QSize sz = (chroma_osd || gl_use_osd_opengl2) ? dvr2 : video_di m;321 QSize sz = (chroma_osd || gl_use_osd_opengl2) ? dvr2 : video_disp_dim; 322 322 return QRect(QPoint(0,0), sz); 323 323 } 324 324 … … 379 379 380 380 void VideoOutputXv::ResizeForVideo(void) 381 381 { 382 ResizeForVideo(video_di m.width(), video_dim.height());382 ResizeForVideo(video_disp_dim.width(), video_disp_dim.height()); 383 383 } 384 384 385 385 void VideoOutputXv::ResizeForGui(void) … … 4073 4073 QRect position; 4074 4074 float pipVideoAspect = 1.3333f; 4075 4075 // set height 4076 int tmph = (video_di m.height() * db_pip_size) / 100;4076 int tmph = (video_disp_dim.height() * db_pip_size) / 100; 4077 4077 // adjust for aspect override modes... 4078 4078 int letterXadj = 0; 4079 4079 int letterYadj = 0; … … 4106 4106 break; 4107 4107 case kPIPBottomLeft: 4108 4108 xoff += letterXadj; 4109 yoff = video_di m.height() - position.height() -4109 yoff = video_disp_dim.height() - position.height() - 4110 4110 yoff - letterYadj; 4111 4111 break; 4112 4112 case kPIPTopRight: 4113 xoff = video_di m.width() - position.width() -4113 xoff = video_disp_dim.width() - position.width() - 4114 4114 xoff - letterXadj; 4115 4115 yoff = yoff + letterYadj; 4116 4116 break; 4117 4117 case kPIPBottomRight: 4118 xoff = video_di m.width() - position.width() -4118 xoff = video_disp_dim.width() - position.width() - 4119 4119 xoff - letterXadj; 4120 yoff = video_di m.height() - position.height() -4120 yoff = video_disp_dim.height() - position.height() - 4121 4121 yoff - letterYadj; 4122 4122 break; 4123 4123 } -
libs/libmythtv/videooutbase.h
273 273 float display_aspect; ///< Physical aspect ratio of playback window 274 274 275 275 // 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 277 278 float video_aspect; ///< Physical aspect ratio of video 278 279 279 280 /// Normally this is the same as videoAspect, but may not be