Commit 83b9f1cd authored by Felix Paul Kühne's avatar Felix Paul Kühne

iOS sample code: update video cropping code to v4 API

parent 4b23a53f
......@@ -271,7 +271,7 @@
if (_currentAspectRatioMask + 1 > count - 1) {
_mediaplayer.videoAspectRatio = NULL;
// _mediaplayer.videoCropGeometry = NULL;
[_mediaplayer setCropRatioWithNumerator:1 denominator:0];
_currentAspectRatioMask = 0;
NSLog(@"crop disabled");
} else {
......@@ -281,22 +281,24 @@
UIScreen *screen = [UIScreen mainScreen];
float f_ar = screen.bounds.size.width / screen.bounds.size.height;
/* if (f_ar == (float)(640./1136.)) // iPhone 5 aka 16:9.01
_mediaplayer.videoCropGeometry = "16:9";
else if (f_ar == (float)(2./3.)) // all other iPhones
_mediaplayer.videoCropGeometry = "16:10"; // libvlc doesn't support 2:3 crop
else if (f_ar == .75) // all iPads
_mediaplayer.videoCropGeometry = "4:3";
else if (f_ar == .5625) // AirPlay
_mediaplayer.videoCropGeometry = "16:9";
else
NSLog(@"unknown screen format %f, can't crop", f_ar);
*/
if (f_ar == (float)(640./1136.)) { // iPhone 5 aka 16:9.01
[_mediaplayer setCropRatioWithNumerator:16 denominator:9];
} else if (f_ar == (float)(2./3.)) { // all other iPhones
[_mediaplayer setCropRatioWithNumerator:2 denominator:3];
} else if (f_ar == .75) { // all iPads
[_mediaplayer setCropRatioWithNumerator:4 denominator:3];
} else if (f_ar == .5625) { // AirPlay
[_mediaplayer setCropRatioWithNumerator:4 denominator:3];
} else {
NSLog(@"unknown screen format %f, trying a best effort crop", f_ar);
[_mediaplayer setCropRatioWithNumerator:screen.bounds.size.width denominator:screen.bounds.size.height];
}
NSLog(@"FILL_TO_SCREEN");
return;
}
// _mediaplayer.videoCropGeometry = NULL;
[_mediaplayer setCropRatioWithNumerator:1 denominator:0];
_mediaplayer.videoAspectRatio = (char *)[_aspectRatios[_currentAspectRatioMask] UTF8String];
NSLog(@"crop switched to %@", _aspectRatios[_currentAspectRatioMask]);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment