Commit a5c298da authored by Felix Paul Kühne's avatar Felix Paul Kühne

Simplify libvlc vs. external sub interaction

parent 4cbb7f8a
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:
----
......
......@@ -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;
......
......@@ -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"
......
......@@ -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;
......
......@@ -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;
}
......
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