瀏覽代碼

iOS: Add basic 360 support methods in VLCPlaybackController

Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
Soomin Lee 8 年之前
父節點
當前提交
5f0e796317
共有 2 個文件被更改,包括 25 次插入1 次删除
  1. 2 1
      Sources/VLCPlaybackController.h
  2. 23 0
      Sources/VLCPlaybackController.m

+ 2 - 1
Sources/VLCPlaybackController.h

@@ -91,7 +91,8 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
 - (void)forward;
 - (void)backward;
 - (void)switchAspectRatio;
-
+- (BOOL)updateViewpoint:(CGFloat)yaw pitch:(CGFloat)pitch roll:(CGFloat)roll fov:(CGFloat)fov absolute:(BOOL)absolute;
+- (NSInteger)currentMediaProjection;
 - (void)recoverDisplayedMetadata;
 - (void)recoverPlaybackState;
 

+ 23 - 0
Sources/VLCPlaybackController.m

@@ -765,6 +765,29 @@ VLCMediaDelegate>
     return _videoOutputViewWrapper;
 }
 
+#pragma mark - 360 Support
+
+- (BOOL)updateViewpoint:(CGFloat)yaw pitch:(CGFloat)pitch roll:(CGFloat)roll fov:(CGFloat)fov absolute:(BOOL)absolute
+{
+    return [_mediaPlayer updateViewpoint:yaw pitch:pitch roll:roll fov:fov absolute:absolute];
+}
+
+- (NSInteger)currentMediaProjection
+{
+    VLCMedia *media = [_mediaPlayer media];
+    NSInteger currentVideoTrackIndex = [_mediaPlayer currentVideoTrackIndex];
+
+    if (media && currentVideoTrackIndex >= 0) {
+        NSArray *tracksInfo = media.tracksInformation;
+        NSDictionary *track = tracksInfo[currentVideoTrackIndex];
+
+        if ([track[VLCMediaTracksInformationType] isEqualToString:VLCMediaTracksInformationTypeVideo]) {
+            return [track[VLCMediaTracksInformationVideoProjection] integerValue];
+        }
+    }
+    return -1;
+}
+
 #pragma mark - equalizer
 
 - (void)setAmplification:(CGFloat)amplification forBand:(unsigned int)index