| 870 | | - (int)aspectRatios |
| 871 | | { |
| 872 | | DVDAspectRatio aspectRatio = kDVDAspectRatioUninitialized; |
| 873 | | DVDGetAspectRatio (&aspectRatio); |
| 874 | | |
| 875 | | |
| 876 | | switch (aspectRatio) { |
| 877 | | case kDVDAspectRatio4x3: |
| 878 | | case kDVDAspectRatio4x3PanAndScan: |
| 879 | | return 0; //4:3 |
| 880 | | break; |
| 881 | | case kDVDAspectRatio16x9: |
| 882 | | case kDVDAspectRatioLetterBox: |
| 883 | | return 1; //16:9 |
| 884 | | break; |
| 885 | | } |
| 886 | | |
| 887 | | return 0; |
| 888 | | } |
| 889 | | |
| 890 | | - (void)update1080iBoundsWithSize:(NSSize)nativeSize |
| 891 | | { |
| 892 | | int aspect = [self aspectRatios]; |
| 893 | | |
| 894 | | //float var = (nativeSize.width/nativeSize.height); |
| 895 | | //NSRect frame = [win frame]; |
| 896 | | CGDirectDisplayID display = [(BRDisplayManager *)[BRDisplayManager sharedInstance] display]; |
| 897 | | CGRect frame = CGDisplayBounds( display ); |
| 898 | | frame.size.width = CGDisplayPixelsWide( display ); |
| 899 | | frame.size.height = CGDisplayPixelsHigh( display ); |
| 900 | | |
| 901 | | CGSize currentSize; |
| 902 | | currentSize.width = frame.size.width; |
| 903 | | currentSize.height = frame.size.height; |
| 904 | | Rect qdRect; |
| 905 | | |
| 906 | | switch (aspect) |
| 907 | | { |
| 908 | | case 0: //4:3 |
| 909 | | //NSLog(@"4:3"); |
| 910 | | qdRect.left = 125; |
| 911 | | qdRect.right = 1155; |
| 912 | | qdRect.top = 0; |
| 913 | | qdRect.bottom = 1080; |
| 914 | | |
| 915 | | break; |
| 916 | | |
| 917 | | case 1: //16:9 |
| 918 | | //NSLog(@"16:9"); |
| 919 | | qdRect.left = 0; |
| 920 | | qdRect.right = frame.size.width; |
| 921 | | qdRect.top = 0; |
| 922 | | qdRect.bottom = 1080; |
| 923 | | break; |
| 924 | | |
| 925 | | } |
| 926 | | DVDSetVideoBounds(&qdRect); |
| 927 | | } |
| 928 | | |
| 980 | | //NSLog(@"width = %f", (float)frame.size.width); |
| 981 | | //NSLog(@"height = %f", (float)frame.size.height); |
| 982 | | [self update1080iBoundsWithSize:nativeSize]; |
| 983 | | return; |
| 984 | | } |
| 985 | | |
| 986 | | //NSRect content = [[win contentView] bounds]; |
| | 931 | currentSize.width = 1280; |
| | 932 | currentSize.height = 1080; |
| | 933 | } |
| | 934 | else |
| | 935 | { |
| | 936 | currentSize.width = frame.size.width; |
| | 937 | currentSize.height = frame.size.height; |
| | 938 | } |
| | 939 | |
| | 940 | NSRect rect; |
| | 941 | if(NSEqualSizes(currentSize, nativeSize)) |
| | 942 | { |
| | 943 | rect.size = currentSize; |
| | 944 | } |
| | 945 | else if(currentSize.width/currentSize.height > nativeSize.width/nativeSize.height) |
| | 946 | { |
| | 947 | float resizeScale = currentSize.height/nativeSize.height; |
| | 948 | rect.size.width = nativeSize.width * resizeScale; |
| | 949 | rect.size.height = currentSize.height; |
| | 950 | } |
| | 951 | else |
| | 952 | { |
| | 953 | float resizeScale = currentSize.width/nativeSize.width; |
| | 954 | frame.size.height = nativeSize.height * resizeScale; |
| | 955 | frame.size.width = currentSize.width; |
| | 956 | } |
| | 957 | |
| | 958 | switch (zoomLevel) { |
| | 959 | case CMPDVDZoomLetterBoxInFullFrame: |
| | 960 | rect.size.width *= 4.0f/3.0f; |
| | 961 | rect.size.height *= 4.0f/3.0f; |
| | 962 | break; |
| | 963 | case CMPDVDZoom2x: |
| | 964 | rect.size.width *= 2.0f; |
| | 965 | rect.size.height *= 2.0f; |
| | 966 | break; |
| | 967 | default: |
| | 968 | break; |
| | 969 | } |
| | 970 | |
| | 971 | rect.origin.x = (currentSize.width - rect.size.width)/2; |
| | 972 | rect.origin.y = (currentSize.height - rect.size.height)/2; |
| 989 | | float resizeScale = 1.0; |
| 990 | | if(NSEqualSizes(currentSize , nativeSize)) |
| 991 | | { |
| 992 | | //NSLog(@"one"); |
| 993 | | qdRect.left = 0; |
| 994 | | qdRect.right = frame.size.width; |
| 995 | | qdRect.bottom = frame.size.height; |
| 996 | | qdRect.top = 0; |
| 997 | | } |
| 998 | | else if(currentSize.width/currentSize.height > nativeSize.width/nativeSize.height) |
| 999 | | { |
| 1000 | | //NSLog(@"two"); |
| 1001 | | resizeScale = currentSize.height/nativeSize.height; |
| 1002 | | //NSLog(@"resizeScale: %f", resizeScale); |
| 1003 | | qdRect.left = currentSize.width/2 - (nativeSize.width * resizeScale)/2; |
| 1004 | | //NSLog(@"qdRect.left: %d", qdRect.left); |
| 1005 | | qdRect.right = currentSize.width/2 + (nativeSize.width * resizeScale)/2; |
| 1006 | | qdRect.bottom = frame.size.height; |
| 1007 | | qdRect.top = 0; |
| 1008 | | //NSLog(@"qdRect.left: %d right: %d top: %d bottom: %d", qdRect.left,qdRect.right,qdRect.top, qdRect.bottom); |
| 1009 | | } |
| 1010 | | else |
| 1011 | | { |
| 1012 | | //NSLog(@"three"); |
| 1013 | | resizeScale = currentSize.width/nativeSize.width; |
| 1014 | | qdRect.left = 0; |
| 1015 | | qdRect.right = frame.size.width; |
| 1016 | | qdRect.bottom = frame.size.height - currentSize.height/2 + (nativeSize.height * resizeScale)/2; |
| 1017 | | qdRect.top = frame.size.height - currentSize.height/2 - (nativeSize.height * resizeScale)/2; |
| 1018 | | } |
| 1019 | | |
| 1020 | | //qdRect.left = 0; |
| 1021 | | //qdRect.right = frame.size.width; |
| 1022 | | //qdRect.bottom = frame.size.height; |
| 1023 | | //qdRect.top = 0; |
| 1024 | | |
| 1025 | | //NSLog(@"4: DVDSetVideoBounds"); |
| | 975 | qdRect.left = rect.origin.x; |
| | 976 | qdRect.right = rect.origin.x + rect.size.width; |
| | 977 | qdRect.top = rect.origin.y; |
| | 978 | qdRect.bottom = rect.origin.y + rect.size.height; |
| | 979 | |