Skip to content

Commit

Permalink
增加注释
Browse files Browse the repository at this point in the history
  • Loading branch information
kingslay committed Dec 28, 2023
1 parent 4e19ed5 commit 433ff6c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
10 changes: 6 additions & 4 deletions Sources/KSPlayer/AVPlayer/KSOptions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -113,16 +113,18 @@ open class KSOptions {
// 参数的配置可以参考protocols.texi 和 http.c
// 这个一定要,不然有的流就会判断不准FieldOrder
formatContextOptions["scan_all_pmts"] = 1
// 下面是用来处理秒开的参数,有需要的自己打开
// ts直播流需要加这个才能一直直播下去,不然播放一小段就会结束了。
formatContextOptions["reconnect"] = 1
formatContextOptions["reconnect_streamed"] = 1
// 这个是用来开启http的链接复用(keep-alive)。vlc默认是打开的,所以这边也默认打开。
formatContextOptions["multiple_requests"] = 1
// 下面是用来处理秒开的参数,有需要的自己打开。默认不开,不然在播放某些特殊的ts直播流会频繁卡顿。
// formatContextOptions["auto_convert"] = 0
// formatContextOptions["fps_probe_size"] = 3
// formatContextOptions["rw_timeout"] = 10_000_000
// formatContextOptions["max_analyze_duration"] = 300 * 1000
// 默认情况下允许所有协议,只有嵌套协议才需要指定这个协议子集,例如m3u8里面有http。
// formatContextOptions["protocol_whitelist"] = "file,http,https,tcp,tls,crypto,async,cache,data,httpproxy"
formatContextOptions["reconnect"] = 1
formatContextOptions["reconnect_streamed"] = 1
formatContextOptions["multiple_requests"] = 1
// 开启这个,纯ipv6地址会无法播放。并且有些视频结束了,但还会一直尝试重连。所以这个值默认不设置
// formatContextOptions["reconnect_at_eof"] = 1
// 开启这个,会导致tcp Failed to resolve hostname 还会一直重试
Expand Down
1 change: 1 addition & 0 deletions Sources/KSPlayer/MEPlayer/Resample.swift
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ class VideoSwresample: FrameChange {
let dstFormat = dstFormat ?? format.bestPixelFormat
pixelFormatType = dstFormat.osType()!
// imgConvertCtx = sws_getContext(width, height, self.format, width, height, dstFormat, SWS_FAST_BILINEAR, nil, nil, nil)
// AV_PIX_FMT_VIDEOTOOLBOX格式是无法进行swscale的
imgConvertCtx = sws_getCachedContext(imgConvertCtx, width, height, self.format, dstWidth, dstHeight, dstFormat, SWS_FAST_BILINEAR, nil, nil, nil)
}
pool = CVPixelBufferPool.ceate(width: dstWidth, height: dstHeight, bytesPerRowAlignment: linesize, pixelFormatType: pixelFormatType)
Expand Down
5 changes: 2 additions & 3 deletions Sources/KSPlayer/MEPlayer/ThumbnailController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@ public class ThumbnailController {
}

public func generateThumbnail(for url: URL, thumbWidth: Int32 = 240) async throws -> [FFThumbnail] {
let task = Task {
try await Task {
try getPeeks(for: url, thumbWidth: thumbWidth)
}
return try await task.value
}.value
}

private func getPeeks(for url: URL, thumbWidth: Int32 = 240) throws -> [FFThumbnail] {
Expand Down

0 comments on commit 433ff6c

Please sign in to comment.