File tree 1 file changed +30
-3
lines changed
Shared/Extensions/JellyfinAPI
1 file changed +30
-3
lines changed Original file line number Diff line number Diff line change @@ -220,14 +220,41 @@ extension [MediaStream] {
220
220
func adjustExternalSubtitleIndexes( audioStreamCount: Int ) -> [ MediaStream ] {
221
221
guard allSatisfy ( { $0. type == . subtitle } ) else { return self }
222
222
let embeddedSubtitleCount = filter { !( $0. isExternal ?? false ) } . count
223
+ let externalSubtitleCount = filter { $0. isExternal ?? false } . count
223
224
224
225
var mediaStreams = self
225
226
227
+ // TODO: how to fix when transcoding
228
+ // case:鱿鱼游戏第二季,第五集
229
+ // display order
230
+ // - external, ch
231
+ // - korean
232
+ // - ...
233
+ // - viet
234
+
235
+ // vlc player subtitle track order
236
+ // - 2 ==> viet
237
+ // - 3 ==> korean
238
+ // - 37 ==> same as displayed subtitle
239
+ // - 38 ==> external, ch while displaying viet
240
+
241
+ // display order
242
+ // - extern subtitles
243
+ // - embeded subtitles
244
+
245
+ // ??? weird order
246
+ // vlc player subtitle track order
247
+ // - embeded subtitles n
248
+ // - embeded subtitles (1, n-1)
249
+ // - extern subtitles
250
+
226
251
for (i, mediaStream) in mediaStreams. enumerated ( ) {
227
- guard mediaStream. isExternal ?? false else { continue }
228
252
var copy = mediaStream
229
- copy. index = ( copy. index ?? 0 ) + 1 + embeddedSubtitleCount + audioStreamCount
230
-
253
+ if copy. isExternal ?? false {
254
+ copy. index = ( copy. index ?? 0 ) + 1 + embeddedSubtitleCount + audioStreamCount
255
+ } else {
256
+ copy. index = ( copy. index ?? 0 ) - externalSubtitleCount
257
+ }
231
258
mediaStreams [ i] = copy
232
259
}
233
260
You can’t perform that action at this time.
0 commit comments