Skip to content

Commit

Permalink
修改代码提高清晰度
Browse files Browse the repository at this point in the history
  • Loading branch information
zhengwenming committed Jul 3, 2020
1 parent 521a873 commit 5ed0c5d
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -239,5 +239,69 @@
stopOnStyle = "0">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "0B9D637E-AF2C-4FDB-A4F2-8BA017B6801A"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "WNPlayer/WNPlayer/Category/UIViewController+Autorotate.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "17"
endingLineNumber = "17"
landmarkName = "-shouldAutorotate"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "1EDF1F33-CB46-4C43-BF10-D6537DCD2253"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "WNPlayer/WNPlayer/Category/UIViewController+Autorotate.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "21"
endingLineNumber = "21"
landmarkName = "-supportedInterfaceOrientations"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "702B450F-9EBF-4713-9D6D-C94C5F677FA8"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "WNPlayer/WNPlayer/Category/UIViewController+Autorotate.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "25"
endingLineNumber = "25"
landmarkName = "-preferredInterfaceOrientationForPresentation"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "169FAFD4-4121-4EA4-8752-8652E03979E3"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "WNPlayer/WNPlayer/Category/UIViewController+Autorotate.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "106"
endingLineNumber = "106"
landmarkName = "-shouldAutorotate"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>
14 changes: 12 additions & 2 deletions WNPlayer/DetailViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,19 @@ - (void)viewDidLoad {
contrlView.title = @"测试播放wmv";
contrlView.coverImageView.image = [UIImage imageNamed:@"cover"];
self.wnPlayer.controlView = contrlView;
// self.wnPlayer.urlString = @"rtsp://184.72.239.149/vod/mp4://BigBuckBunny_175k.mov";
self.wnPlayer.urlString = @"http://mov.bn.netease.com/mobilev/open/nos/mp4/2015/12/09/SB9F77DEA_sd.mp4";
// self.wnPlayer.urlString = @"rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov";
// self.wnPlayer.urlString = @"http://mov.bn.netease.com/mobilev/open/nos/mp4/2015/12/09/SB9F77DEA_sd.mp4";
// self.wnPlayer.urlString = @"https://review.v.news.cn/review/basics/live4958/20200605/0955521822_mp4/095552_1822_5000k.mp4?ut=5ed9af72&us=73284591&sign=e1ad1a1d2d652bc64c7b1e6f594daa11";



self.wnPlayer.urlString = @"rtmp://210.73.216.21:1935/live/974348_live";

// self.wnPlayer.urlString = @"https://becpan245129201909202114533965970.eos-guangzhou-1.cmecloud.cn/53e60ce31cab4823b0576cfdd2e8023a?response-content-disposition=attachment%3Bfilename%3D%22001---%E5%BA%94%E7%94%A8%E9%87%8D%E7%AD%BE%E5%90%8D.wmv%22&AWSAccessKeyId=9RM1KC629RXWWWGZ5XG6&Expires=1585202559&Signature=%2BpEaExUcDfT0eLwhRbRDustSVQk%3D";




// self.wnPlayer.urlString = @"https://paasalihlsgw.lechange.cn:443/LCO/4F069C3PAZB2065/15/1/20190919162804/dev_20190919162804_kcfx18ca340dnrdg.m3u8?proto=https";


Expand Down
12 changes: 11 additions & 1 deletion WNPlayer/WNPlayer/Category/UIViewController+Autorotate.m
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,12 @@ - (BOOL)shouldAutorotate {
UIViewController *vc = self.viewControllers[self.selectedIndex];
if ([vc isKindOfClass:UINavigationController.class]) {
UINavigationController *nav = (UINavigationController *)vc;
return [nav.topViewController shouldAutorotate];
NSString *className = NSStringFromClass(self.class);
if ([@[@"AVPlayerViewController", @"AVFullScreenViewController", @"AVFullScreenPlaybackControlsViewController"
] containsObject:className]) {
return YES;
}
return [nav.topViewController shouldAutorotate];
} else {
return [vc shouldAutorotate];
}
Expand All @@ -73,6 +78,11 @@ - (UIInterfaceOrientationMask)supportedInterfaceOrientations {
UIViewController *vc = self.viewControllers[self.selectedIndex];
if ([vc isKindOfClass:UINavigationController.class]) {
UINavigationController *nav = (UINavigationController *)vc;
NSString *className = NSStringFromClass(self.class);
if ([@[@"AVPlayerViewController", @"AVFullScreenViewController", @"AVFullScreenPlaybackControlsViewController"
] containsObject:className]) {
return UIInterfaceOrientationMaskAllButUpsideDown;
}
return [nav.topViewController supportedInterfaceOrientations];
} else {
return [vc supportedInterfaceOrientations];
Expand Down
11 changes: 8 additions & 3 deletions WNPlayer/WNPlayer/view/WNDisplayView.m
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,13 @@ - (void)render:(WNPlayerVideoFrame *)frame {
glClearColor(0, 0, 0, 1);
glClear(GL_COLOR_BUFFER_BIT);

GLsizei _viewScale;
self.contentScaleFactor = [UIScreen mainScreen].scale;
_viewScale = [UIScreen mainScreen].scale;
CGSize size = self.bounds.size;

// Setup viewport
glViewport(0, 0, _backingWidth, _backingHeight);
glViewport(0, 0, size.width * _viewScale -2, size.height * _viewScale -2);

// Set frame
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
Expand Down Expand Up @@ -350,8 +355,8 @@ - (void)render:(WNPlayerVideoFrame *)frame {
}

+ (UIImage *)glToUIImage:(CGSize)size {
CGSize viewSize = size;

GLsizei _viewScale = [UIScreen mainScreen].scale;
CGSize viewSize = CGSizeMake(size.width * _viewScale -2, size.height * _viewScale -2);
NSInteger myDataLength = viewSize.width * viewSize.height * 4;

// allocate array and read pixels into it.
Expand Down

0 comments on commit 5ed0c5d

Please sign in to comment.