Bläddra i källkod

Simplify libvlc vs. external sub interaction

Felix Paul Kühne 11 år sedan
förälder
incheckning
a5c298dac5
5 ändrade filer med 14 tillägg och 12 borttagningar
  1. 3 0
      NEWS
  2. 2 2
      Sources/VLCAppDelegate.m
  3. 0 1
      Sources/VLCConstants.h
  4. 1 1
      Sources/VLCMovieViewController.h
  5. 8 8
      Sources/VLCMovieViewController.m

+ 3 - 0
NEWS

@@ -1,5 +1,8 @@
 2.4 (not yet released):
 -----------------------
+* Detection of external subtitles when streaming media via http or ftp (#10668)
+* Option to download media from http/ftp/https instead of direct playback when
+  requested through third-party app (#11147)
 
 2.3:
 ----

+ 2 - 2
Sources/VLCAppDelegate.m

@@ -392,7 +392,7 @@
 
     _movieViewController.mediaList = list;
     _movieViewController.itemInMediaListToBePlayedFirst = index;
-    _movieViewController.urlExternalSrt = nil;
+    _movieViewController.pathToExternalSubtitlesFile = nil;
 
     UINavigationController *navCon = [[UINavigationController alloc] initWithRootViewController:_movieViewController];
     navCon.modalPresentationStyle = UIModalPresentationFullScreen;
@@ -405,7 +405,7 @@
         _movieViewController = [[VLCMovieViewController alloc] initWithNibName:nil bundle:nil];
 
     _movieViewController.url = url;
-    _movieViewController.urlExternalSrt = SubtitlePath;
+    _movieViewController.pathToExternalSubtitlesFile = SubtitlePath;
 
     UINavigationController *navCon = [[UINavigationController alloc] initWithRootViewController:_movieViewController];
     navCon.modalPresentationStyle = UIModalPresentationFullScreen;

+ 0 - 1
Sources/VLCConstants.h

@@ -34,7 +34,6 @@
 #define kVLCSettingSubtitlesBoldFontDefaulValue @NO
 #define kVLCSettingSubtitlesFontColor @"quartztext-color"
 #define kVLCSettingSubtitlesFontColorDefaultValue @"16777215"
-#define kVLCSettingSubtitlesFilePath @"sub-file"
 #define kVLCSettingDeinterlace @"deinterlace"
 #define kVLCSettingDeinterlaceDefaultValue @(0)
 #define kVLCSettingNetworkCaching @"network-caching"

+ 1 - 1
Sources/VLCMovieViewController.h

@@ -84,7 +84,7 @@
 
 @property (nonatomic, strong) MLFile *fileFromMediaLibrary;
 @property (nonatomic, strong) NSURL *url;
-@property (nonatomic, strong) NSString *urlExternalSrt;
+@property (nonatomic, strong) NSString *pathToExternalSubtitlesFile;
 @property (nonatomic, retain) VLCMediaList *mediaList;
 @property (nonatomic, readwrite) int itemInMediaListToBePlayedFirst;
 

+ 8 - 8
Sources/VLCMovieViewController.m

@@ -407,10 +407,7 @@
         return;
     }
 
-    if (self.urlExternalSrt)
-        _listPlayer = [[VLCMediaListPlayer alloc] initWithOptions:@[[NSString stringWithFormat:@"--%@=%@", kVLCSettingSubtitlesFilePath, [self urlExternalSrt]]]];
-    else
-        _listPlayer = [[VLCMediaListPlayer alloc] init];
+    _listPlayer = [[VLCMediaListPlayer alloc] init];
 
     _mediaPlayer = _listPlayer.mediaPlayer;
     [_mediaPlayer setDelegate:self];
@@ -419,6 +416,9 @@
         [_mediaPlayer setDeinterlaceFilter:@"blend"];
     else
         [_mediaPlayer setDeinterlaceFilter:nil];
+    if (self.pathToExternalSubtitlesFile)
+        [_mediaPlayer openVideoSubTitlesFromFile:self.pathToExternalSubtitlesFile];
+
     self.trackNameLabel.text = self.artistNameLabel.text = self.albumNameLabel.text = @"";
 
     VLCMedia *media;
@@ -640,11 +640,11 @@
         _mediaList = nil;
     if (_url)
         _url = nil;
-    if (_urlExternalSrt) {
+    if (_pathToExternalSubtitlesFile) {
             NSFileManager *fileManager = [NSFileManager defaultManager];
-            if ([fileManager fileExistsAtPath:_urlExternalSrt])
-                [fileManager removeItemAtPath:_urlExternalSrt error:nil];
-            _urlExternalSrt = nil;
+            if ([fileManager fileExistsAtPath:_pathToExternalSubtitlesFile])
+                [fileManager removeItemAtPath:_pathToExternalSubtitlesFile error:nil];
+            _pathToExternalSubtitlesFile = nil;
     }
     _playerIsSetup = NO;
 }