Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
VideoLAN
VLC-iOS
Commits
ee3a2345
Commit
ee3a2345
authored
Apr 08, 2014
by
Pierre SAGASPE
Committed by
Felix Paul Kühne
Apr 18, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
External subtitles over ftp (refs #10668)
Signed-off-by:
Felix Paul Kühne
<
fkuehne@videolan.org
>
parent
1502026b
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
79 additions
and
5 deletions
+79
-5
Sources/VLCAppDelegate.h
Sources/VLCAppDelegate.h
+1
-0
Sources/VLCAppDelegate.m
Sources/VLCAppDelegate.m
+15
-1
Sources/VLCConstants.h
Sources/VLCConstants.h
+2
-1
Sources/VLCLocalServerFolderListViewController.m
Sources/VLCLocalServerFolderListViewController.m
+49
-1
Sources/VLCMovieViewController.h
Sources/VLCMovieViewController.h
+1
-0
Sources/VLCMovieViewController.m
Sources/VLCMovieViewController.m
+11
-2
No files found.
Sources/VLCAppDelegate.h
View file @
ee3a2345
...
...
@@ -38,6 +38,7 @@
-
(
void
)
openMediaFromManagedObject
:(
NSManagedObject
*
)
file
;
-
(
void
)
openMovieFromURL
:(
NSURL
*
)
url
;
-
(
void
)
openMediaList
:(
VLCMediaList
*
)
list
atIndex
:(
int
)
index
;
-
(
void
)
openMovieWithExternalSubtitleFromURL
:(
NSURL
*
)
url
externalSubURL
:(
NSString
*
)
SubtitlePath
;
@property
(
nonatomic
,
readonly
)
VLCPlaylistViewController
*
playlistViewController
;
@property
(
nonatomic
,
readonly
)
VLCDropboxTableViewController
*
dropboxTableViewController
;
...
...
Sources/VLCAppDelegate.m
View file @
ee3a2345
...
...
@@ -372,13 +372,27 @@
[
self
.
window
.
rootViewController
presentViewController
:
navCon
animated
:
YES
completion
:
nil
];
}
-
(
void
)
openMediaList
:(
VLCMediaList
*
)
list
atIndex
:(
int
)
index
-
(
void
)
openMediaList
:(
VLCMediaList
*
)
list
atIndex
:(
int
)
index
{
if
(
!
_movieViewController
)
_movieViewController
=
[[
VLCMovieViewController
alloc
]
initWithNibName
:
nil
bundle
:
nil
];
_movieViewController
.
mediaList
=
list
;
_movieViewController
.
itemInMediaListToBePlayedFirst
=
index
;
_movieViewController
.
urlExternalSrt
=
nil
;
UINavigationController
*
navCon
=
[[
UINavigationController
alloc
]
initWithRootViewController
:
_movieViewController
];
navCon
.
modalPresentationStyle
=
UIModalPresentationFullScreen
;
[
self
.
window
.
rootViewController
presentViewController
:
navCon
animated
:
YES
completion
:
nil
];
}
-
(
void
)
openMovieWithExternalSubtitleFromURL
:(
NSURL
*
)
url
externalSubURL
:(
NSString
*
)
SubtitlePath
{
if
(
!
_movieViewController
)
_movieViewController
=
[[
VLCMovieViewController
alloc
]
initWithNibName
:
nil
bundle
:
nil
];
_movieViewController
.
url
=
url
;
_movieViewController
.
urlExternalSrt
=
SubtitlePath
;
UINavigationController
*
navCon
=
[[
UINavigationController
alloc
]
initWithRootViewController
:
_movieViewController
];
navCon
.
modalPresentationStyle
=
UIModalPresentationFullScreen
;
...
...
Sources/VLCConstants.h
View file @
ee3a2345
...
...
@@ -34,6 +34,7 @@
#define kVLCSettingSubtitlesBoldFontDefaulValue @NO
#define kVLCSettingSubtitlesFontColor @"quartztext-color"
#define kVLCSettingSubtitlesFontColorDefaultValue @"16777215"
#define kVLCSettingSubtitlesFilePath @"sub-file"
#define kVLCSettingDeinterlace @"deinterlace"
#define kVLCSettingDeinterlaceDefaultValue @(0)
#define kVLCSettingNetworkCaching @"network-caching"
...
...
@@ -54,7 +55,7 @@
#define kVLCLastFTPPassword @"last-ftp-pass"
#define kSupportedFileExtensions @"\\.(3gp|3gp|3gp2|3gpp|amv|asf|avi|axv|divx|dv|flv|f4v|gvi|gxf|m1v|m2p|m2t|m2ts|m2v|m4v|mks|mkv|moov|mov|mp2v|mp4|mpeg|mpeg1|mpeg2|mpeg4|mpg|mpv|mt2s|mts|mxf|mxg|nsv|nuv|oga|ogg|ogm|ogv|ogx|spx|ps|qt|rec|rm|rmvb|tod|ts|tts|vob|vro|webm|wm|wmv|wtv|xesc)$"
#define kSupportedSubtitleFileExtensions @"\\.(
cdg|idx|srt|sub
|utf|ass|ssa|aqt|jss|psb|rt|smi|txt|smil)$"
#define kSupportedSubtitleFileExtensions @"\\.(
srt|sub|cdg|idx
|utf|ass|ssa|aqt|jss|psb|rt|smi|txt|smil)$"
#define kSupportedAudioFileExtensions @"\\.(aac|aiff|aif|amr|aob|ape|axa|caf|flac|it|m2a|m4a|m4b|mka|mlp|mod|mp1|mp2|mp3|mpa|mpc|mpga|oga|ogg|oma|opus|rmi|s3m|spx|tta|voc|vqf|wav|w64|wma|wv|xa|xm)$"
#define kBlobHash @"521923d214b9ae628da7987cf621e94c4afdd726"
...
...
Sources/VLCLocalServerFolderListViewController.m
View file @
ee3a2345
...
...
@@ -463,10 +463,58 @@
#pragma mark - communication with playback engine
-
(
void
)
_streamFTPFile
:(
NSString
*
)
fileName
{
NSString
*
URLofSubtitle
=
nil
;
NSMutableArray
*
SubtitlesList
=
[[
NSMutableArray
alloc
]
init
];
[
SubtitlesList
removeAllObjects
];
SubtitlesList
=
[
self
_searchSubtitle
:
fileName
];
if
(
SubtitlesList
.
count
>
0
)
URLofSubtitle
=
[
self
_getFileSubtitleFromFtpServer
:
SubtitlesList
[
0
]];
NSURL
*
URLToPlay
=
[
NSURL
URLWithString
:[[
@"ftp"
stringByAppendingFormat
:
@"://%@%@/%@/%@"
,
[
self
_credentials
],
_ftpServerAddress
,
_ftpServerPath
,
fileName
]
stringByAddingPercentEscapesUsingEncoding
:
NSUTF8StringEncoding
]];
VLCAppDelegate
*
appDelegate
=
[
UIApplication
sharedApplication
].
delegate
;
[
appDelegate
openMovieFromURL
:
URLToPlay
];
[
appDelegate
openMovieWithExternalSubtitleFromURL
:
URLToPlay
externalSubURL
:
URLofSubtitle
];
}
-
(
NSMutableArray
*
)
_searchSubtitle
:(
NSString
*
)
url
{
NSString
*
urlTemp
=
[[
url
lastPathComponent
]
stringByDeletingPathExtension
];
NSMutableArray
*
ObjList
=
[[
NSMutableArray
alloc
]
init
];
[
ObjList
removeAllObjects
];
for
(
int
loop
=
0
;
loop
<
_objectList
.
count
;
loop
++
)
[
ObjList
addObject
:[
_objectList
[
loop
]
objectForKey
:(
id
)
kCFFTPResourceName
]];
NSPredicate
*
predicate
=
[
NSPredicate
predicateWithFormat
:
@"SELF contains[c] %@"
,
urlTemp
];
NSArray
*
results
=
[
ObjList
filteredArrayUsingPredicate
:
predicate
];
[
ObjList
removeAllObjects
];
for
(
int
cnt
=
0
;
cnt
<
results
.
count
;
cnt
++
)
{
if
([
results
[
cnt
]
isSupportedSubtitleFormat
])
[
ObjList
addObject
:
results
[
cnt
]];
}
return
ObjList
;
}
-
(
NSString
*
)
_getFileSubtitleFromFtpServer
:(
NSString
*
)
fileName
{
NSURL
*
url
=
[
NSURL
URLWithString
:[[
@"ftp"
stringByAppendingFormat
:
@"://%@%@/%@/%@"
,
[
self
_credentials
],
_ftpServerAddress
,
_ftpServerPath
,
fileName
]
stringByAddingPercentEscapesUsingEncoding
:
NSUTF8StringEncoding
]];
NSString
*
receivedSub
=
[
NSString
stringWithContentsOfURL
:
url
encoding
:
NSASCIIStringEncoding
error
:
nil
];
NSArray
*
searchPaths
=
NSSearchPathForDirectoriesInDomains
(
NSCachesDirectory
,
NSUserDomainMask
,
YES
);
NSString
*
directoryPath
=
searchPaths
[
0
];
NSString
*
FileSubtitlePath
=
[
directoryPath
stringByAppendingPathComponent
:[
fileName
lastPathComponent
]];
NSFileManager
*
fileManager
=
[
NSFileManager
defaultManager
];
if
(
!
[
fileManager
fileExistsAtPath
:
FileSubtitlePath
])
{
//create local subtitle file
[
fileManager
createFileAtPath
:
FileSubtitlePath
contents
:
nil
attributes
:
nil
];
if
(
!
[
fileManager
fileExistsAtPath
:
FileSubtitlePath
])
APLog
(
@"file creation failed, no data was saved"
);
}
[
receivedSub
writeToFile
:
FileSubtitlePath
atomically
:
YES
encoding
:
NSUTF8StringEncoding
error
:
nil
];
return
FileSubtitlePath
;
}
#pragma mark - Search Display Controller Delegate
...
...
Sources/VLCMovieViewController.h
View file @
ee3a2345
...
...
@@ -84,6 +84,7 @@
@property
(
nonatomic
,
strong
)
MLFile
*
fileFromMediaLibrary
;
@property
(
nonatomic
,
strong
)
NSURL
*
url
;
@property
(
nonatomic
,
strong
)
NSString
*
urlExternalSrt
;
@property
(
nonatomic
,
retain
)
VLCMediaList
*
mediaList
;
@property
(
nonatomic
,
readwrite
)
int
itemInMediaListToBePlayedFirst
;
...
...
Sources/VLCMovieViewController.m
View file @
ee3a2345
...
...
@@ -407,7 +407,11 @@
return
;
}
_listPlayer
=
[[
VLCMediaListPlayer
alloc
]
init
];
if
(
self
.
urlExternalSrt
)
_listPlayer
=
[[
VLCMediaListPlayer
alloc
]
initWithOptions
:@[[
NSString
stringWithFormat
:
@"--%@=%@"
,
kVLCSettingSubtitlesFilePath
,
[
self
urlExternalSrt
]]]];
else
_listPlayer
=
[[
VLCMediaListPlayer
alloc
]
init
];
_mediaPlayer
=
_listPlayer
.
mediaPlayer
;
[
_mediaPlayer
setDelegate
:
self
];
[
_mediaPlayer
setDrawable
:
self
.
movieView
];
...
...
@@ -636,7 +640,12 @@
_mediaList
=
nil
;
if
(
_url
)
_url
=
nil
;
if
(
_urlExternalSrt
)
{
NSFileManager
*
fileManager
=
[
NSFileManager
defaultManager
];
if
([
fileManager
fileExistsAtPath
:
_urlExternalSrt
])
[
fileManager
removeItemAtPath
:
_urlExternalSrt
error
:
nil
];
_urlExternalSrt
=
nil
;
}
_playerIsSetup
=
NO
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment