Skip to content

Commit

Permalink
fix #626
Browse files Browse the repository at this point in the history
  • Loading branch information
kingslay committed Dec 2, 2023
1 parent 85ee1aa commit 191ad95
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion Sources/KSPlayer/MEPlayer/AVFFmpegExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ extension AVCodecContext {
}

extension AVCodecParameters {
mutating func ceateContext(options: KSOptions) throws -> UnsafeMutablePointer<AVCodecContext> {
mutating func createContext(options: KSOptions) throws -> UnsafeMutablePointer<AVCodecContext> {
var codecContextOption = avcodec_alloc_context3(nil)
guard let codecContext = codecContextOption else {
throw NSError(errorCode: .codecContextCreate)
Expand Down Expand Up @@ -106,6 +106,7 @@ extension AVCodecParameters {
av_dict_set_int(&avOptions, "lowres", Int64(lowres), 0)
}
result = avcodec_open2(codecContext, codec, &avOptions)
av_dict_free(&avOptions)
guard result == 0 else {
avcodec_free_context(&codecContextOption)
throw NSError(errorCode: .codesContextOpen, avErrorCode: result)
Expand Down
4 changes: 2 additions & 2 deletions Sources/KSPlayer/MEPlayer/FFmpegAssetTrack.swift
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,8 @@ public class FFmpegAssetTrack: MediaPlayerTrack {
trackID = 0
}

func ceateContext(options: KSOptions) throws -> UnsafeMutablePointer<AVCodecContext> {
try codecpar.ceateContext(options: options)
func createContext(options: KSOptions) throws -> UnsafeMutablePointer<AVCodecContext> {
try codecpar.createContext(options: options)
}

public var isEnabled: Bool {
Expand Down
2 changes: 1 addition & 1 deletion Sources/KSPlayer/MEPlayer/FFmpegDecode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class FFmpegDecode: DecodeProtocol {
required init(assetTrack: FFmpegAssetTrack, options: KSOptions) {
self.options = options
do {
codecContext = try assetTrack.ceateContext(options: options)
codecContext = try assetTrack.createContext(options: options)
} catch {
KSLog(error as CustomStringConvertible)
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/KSPlayer/MEPlayer/MEPlayerItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ final class MEPlayerItem {
operationQueue.name = "KSPlayer_" + String(describing: self).components(separatedBy: ".").last!
operationQueue.maxConcurrentOperationCount = 1
operationQueue.qualityOfService = .userInteractive
_ = MEPlayerItem.onceInitial
// _ = MEPlayerItem.onceInitial
if let locale = options.audioLocale {
audioRecognizer = AudioRecognizer(locale: locale) { text in
print(text)
Expand Down
2 changes: 1 addition & 1 deletion Sources/KSPlayer/MEPlayer/SubtitleDecode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class SubtitleDecode: DecodeProtocol {
required init(assetTrack: FFmpegAssetTrack, options: KSOptions) {
startTime = assetTrack.startTime.seconds
do {
codecContext = try assetTrack.ceateContext(options: options)
codecContext = try assetTrack.createContext(options: options)
if let pointer = codecContext?.pointee.subtitle_header {
let subtitleHeader = String(cString: pointer)
_ = assParse.canParse(scanner: Scanner(string: subtitleHeader))
Expand Down

0 comments on commit 191ad95

Please sign in to comment.