2 次代碼提交 d99db34c13 ... ea08cf3afb

作者 SHA1 備註 提交日期
  yanxuyao ea08cf3afb [*] swift重写完善 3 周之前
  yanxuyao be2d187d9b [*] 暂时提交 3 周之前

+ 1 - 1
QGVAPlayer.podspec

@@ -96,7 +96,7 @@ Pod::Spec.new do |spec|
   #  Not including the public_header_files will make all headers public.
   #
 
-  spec.source_files = 'QGVAPlayer/QGVAPlayer/LNSwift/**/*.swift', 'QGVAPlayer/QGVAPlayer/Shaders/QGHWDShaders.metal'
+  spec.source_files = 'QGVAPlayer/QGVAPlayer/LNSwift/{Core,Model,Parser,Render,Utils,View}/**/*.swift', 'QGVAPlayer/QGVAPlayer/Shaders/QGHWDShaders.metal'
   spec.swift_version = '5.0'
 
   # spec.subspec 'Shaders' do |ss|

+ 0 - 2
QGVAPlayer/QGVAPlayer.xcodeproj/project.pbxproj

@@ -12,7 +12,6 @@
 		630723B122F0409200B15629 /* QGVAPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 630723A722F0409200B15629 /* QGVAPlayer.framework */; };
 		630723B622F0409200B15629 /* QGVAPlayerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 630723B522F0409200B15629 /* QGVAPlayerTests.m */; };
 		6307243F22F0410600B15629 /* QGHWDShaders.metal in Sources */ = {isa = PBXBuildFile; fileRef = 6307240622F0410600B15629 /* QGHWDShaders.metal */; };
-		69DCB6EF3D76FAEFFD1929CC /* LNLegacyMappings.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADF46D8C8C93AA38D15B3345 /* LNLegacyMappings.swift */; };
 		6A449A4C2102FA07B1E481A1 /* LNMP4Parser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0DFC2669FA8BE22005CBC78B /* LNMP4Parser.swift */; };
 		7644770111F618C09AAFB77A /* LNControllers.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC2DF61A816CBDC209E81671 /* LNControllers.swift */; };
 		7769C2ADCDBE6BA6706FA10F /* LNVAPFacade.swift in Sources */ = {isa = PBXBuildFile; fileRef = E18C9AF6293B68DAD4F8640E /* LNVAPFacade.swift */; };
@@ -568,7 +567,6 @@
 				424CEEC3D60F73A1EE8EBE0A /* LNVAPPlayerView.swift in Sources */,
 				D0B10869F3FC013BB0FB0BE2 /* LNVAPWrapView.swift in Sources */,
 				D572F414BCB8C54DE8E43E75 /* LNUtilities.swift in Sources */,
-				69DCB6EF3D76FAEFFD1929CC /* LNLegacyMappings.swift in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

+ 1 - 3
QGVAPlayer/QGVAPlayer/LNSwift/Core/LNControllers.swift

@@ -123,8 +123,6 @@ public final class LNAnimatedImageBufferManager: NSObject {
 
 public let kLNVAPDecoderSeekStart = "kLNVAPDecoderSeekStart"
 public let kLNVAPDecoderSeekFinish = "kLNVAPDecoderSeekFinish"
-public let kQGVAPDecoderSeekStart = kLNVAPDecoderSeekStart
-public let kQGVAPDecoderSeekFinish = kLNVAPDecoderSeekFinish
 
 @objcMembers
 open class LNBaseDecoder: NSObject {
@@ -719,7 +717,7 @@ public final class LNVAPConfigManager: NSObject {
     @objc(loadMTLBuffers:)
     public func loadMTLBuffers(_ device: MTLDevice) {
         model.resources.forEach { resource in
-            resource.colorParamsBuffer = LNVAPTextureLoader.loadVapColorFillBuffer(with: resource.color, device: device)
+            resource.colorParamsBuffer = LNVAPTextureLoader.lnLoadVAPColorFillBuffer(with: resource.color, device: device)
         }
     }
 

+ 4 - 28
QGVAPlayer/QGVAPlayer/LNSwift/Core/LNPlaybackTypes.swift

@@ -4,10 +4,10 @@ import UIKit
 public typealias LNVAPImageCompletion = (_ image: UIImage?, _ error: NSError?, _ imageURL: String) -> Void
 public typealias LNVAPGestureEventBlock = (_ gestureRecognizer: UIGestureRecognizer, _ insideSource: Bool, _ source: LNVAPSourceDisplayItem?) -> Void
 
-public let kQGHWDMP4DefaultFPS = 25
-public let kQGHWDMP4MinFPS = 1
-public let QGHWDMP4MaxFPS = 60
-public let VapMaxCompatibleVersion = 2
+public let kLNMP4DefaultFPS = 20
+public let kLNMP4MinFPS = 1
+public let LNMP4MaxFPS = 60
+public let LNVAPMaxCompatibleVersion = 2
 
 @objc public enum LNTextureBlendMode: Int {
     case alphaLeft = 0
@@ -16,8 +16,6 @@ public let VapMaxCompatibleVersion = 2
     case alphaBottom = 3
 }
 
-public typealias QGHWDTextureBlendMode = LNTextureBlendMode
-
 @objc public enum LNEnterBackgroundOperation: Int {
     case stop
     case pauseAndResume
@@ -57,17 +55,6 @@ public typealias QGHWDTextureBlendMode = LNTextureBlendMode
     @objc optional func lnPlayerLoadImage(withURL url: String, context: NSDictionary, completion: @escaping LNVAPImageCompletion)
 }
 
-@objc public protocol LNVAPLegacyPlaybackDelegate: AnyObject {
-    @objc optional func shouldStartPlayMP4(_ container: UIView, config: LNVAPConfigModel) -> Bool
-    @objc optional func viewDidStartPlayMP4(_ container: UIView)
-    @objc optional func viewDidPlayMP4AtFrame(_ frame: LNMP4AnimatedImageFrame, view container: UIView)
-    @objc optional func viewDidStopPlayMP4(_ lastFrameIndex: Int, view container: UIView)
-    @objc optional func viewDidFinishPlayMP4(_ totalFrameCount: Int, view container: UIView)
-    @objc optional func viewDidFailPlayMP4(_ error: NSError)
-    @objc optional func contentForVapTag(_ tag: String, resource: LNVAPSourceInfo) -> String?
-    @objc optional func loadVapImage(withURL url: String, context: NSDictionary, completion: @escaping LNVAPImageCompletion)
-}
-
 @objc public protocol LNVAPWrapPlaybackDelegate: AnyObject {
     @objc optional func lnWrapViewShouldStart(_ wrapView: LNVAPWrapView, config: LNVAPConfigModel) -> Bool
     @objc optional func lnWrapViewDidStart(_ wrapView: LNVAPWrapView)
@@ -78,14 +65,3 @@ public typealias QGHWDTextureBlendMode = LNTextureBlendMode
     @objc optional func lnWrapViewContent(forTag tag: String, resource: LNVAPSourceInfo) -> String?
     @objc optional func lnWrapViewLoadImage(withURL url: String, context: NSDictionary, completion: @escaping LNVAPImageCompletion)
 }
-
-@objc public protocol LNVAPWrapLegacyPlaybackDelegate: AnyObject {
-    @objc optional func vapWrap_viewshouldStartPlayMP4(_ container: UIView, config: LNVAPConfigModel) -> Bool
-    @objc optional func vapWrap_viewDidStartPlayMP4(_ container: UIView)
-    @objc optional func vapWrap_viewDidPlayMP4AtFrame(_ frame: LNMP4AnimatedImageFrame, view container: UIView)
-    @objc optional func vapWrap_viewDidStopPlayMP4(_ lastFrameIndex: Int, view container: UIView)
-    @objc optional func vapWrap_viewDidFinishPlayMP4(_ totalFrameCount: Int, view container: UIView)
-    @objc optional func vapWrap_viewDidFailPlayMP4(_ error: NSError)
-    @objc optional func vapWrapview_contentForVapTag(_ tag: String, resource: LNVAPSourceInfo) -> String?
-    @objc optional func vapWrapView_loadVapImage(withURL url: String, context: NSDictionary, completion: @escaping LNVAPImageCompletion)
-}

+ 1 - 1
QGVAPlayer/QGVAPlayer/LNSwift/Core/LNVAPFacade.swift

@@ -12,7 +12,7 @@ public final class LNVAPFacade: NSObject {
     }
 
     @objc public static func lnUseDefaultLogBridge() {
-        // Swift façade keeps API surface centralized; legacy logger registration remains available in OC layer.
+        // Swift facade keeps log registration centralized through LNVAPLogger.
     }
 
     @objc(lnRegisterLogHandler:)

+ 4 - 4
QGVAPlayer/QGVAPlayer/LNSwift/Model/LNModels.swift

@@ -229,8 +229,8 @@ public final class LNVAPMaskInfo: NSObject {
 @objcMembers
 public final class LNVAPTextureLoader: NSObject {
 #if targetEnvironment(simulator)
-    @objc(loadVapColorFillBufferWith:device:)
-    public static func loadVapColorFillBuffer(with color: UIColor?, device: MTLDevice?) -> MTLBuffer? { nil }
+    @objc(lnLoadVAPColorFillBufferWith:device:)
+    public static func lnLoadVAPColorFillBuffer(with color: UIColor?, device: MTLDevice?) -> MTLBuffer? { nil }
 
     @objc(loadTextureWithImage:device:)
     public static func loadTexture(with image: UIImage?, device: MTLDevice?) -> MTLTexture? { nil }
@@ -260,8 +260,8 @@ public final class LNVAPTextureLoader: NSObject {
         var fillColor: SIMD4<Float>
     }
 
-    @objc(loadVapColorFillBufferWith:device:)
-    public static func loadVapColorFillBuffer(with color: UIColor?, device: MTLDevice?) -> MTLBuffer? {
+    @objc(lnLoadVAPColorFillBufferWith:device:)
+    public static func lnLoadVAPColorFillBuffer(with color: UIColor?, device: MTLDevice?) -> MTLBuffer? {
         guard let device else { return nil }
         var red: CGFloat = 0
         var green: CGFloat = 0

+ 0 - 33
QGVAPlayer/QGVAPlayer/LNSwift/Parser/LNMP4Parser.swift

@@ -5,39 +5,6 @@ public let kLNBoxTypeLengthInBytes = 4
 public let kLNBoxLargeSizeLengthInBytes = 8
 public let kLNBoxLargeSizeFlagLengthInBytes = 1
 
-// Legacy aliases for QG-prefixed MP4 parser constants.
-public let kQGBoxSizeLengthInBytes = kLNBoxSizeLengthInBytes
-public let kQGBoxTypeLengthInBytes = kLNBoxTypeLengthInBytes
-public let kQGBoxLargeSizeLengthInBytes = kLNBoxLargeSizeLengthInBytes
-public let kQGBoxLargeSizeFlagLengthInBytes = kLNBoxLargeSizeFlagLengthInBytes
-
-// Legacy aliases for QG-prefixed Swift type references.
-public typealias QGMP4CodecType = LNMP4CodecType
-public typealias QGMP4TrackType = LNMP4TrackType
-public typealias QGMP4VideoStreamCodecID = LNMP4VideoStreamCodecID
-public typealias QGMP4BoxType = LNMP4BoxType
-public typealias QGMP4Box = LNMP4Box
-public typealias QGMP4MdatBox = LNMP4MdatBox
-public typealias QGMP4AvccBox = LNMP4AvccBox
-public typealias QGMP4HvccBox = LNMP4HvccBox
-public typealias QGMP4MvhdBox = LNMP4MvhdBox
-public typealias QGMP4StsdBox = LNMP4StsdBox
-public typealias QGMP4TrackBox = LNMP4TrackBox
-public typealias QGStscEntry = LNStscEntry
-public typealias QGMP4StscBox = LNMP4StscBox
-public typealias QGMP4StcoBox = LNMP4StcoBox
-public typealias QGMP4StssBox = LNMP4StssBox
-public typealias QGMP4CttsBox = LNMP4CttsBox
-public typealias QGSttsEntry = LNSttsEntry
-public typealias QGMP4SttsBox = LNMP4SttsBox
-public typealias QGMP4StszBox = LNMP4StszBox
-public typealias QGMP4HdlrBox = LNMP4HdlrBox
-public typealias QGMP4Sample = LNMP4Sample
-public typealias QGChunkOffsetEntry = LNChunkOffsetEntry
-public typealias QGMP4BoxFactory = LNMP4BoxFactory
-public typealias QGMP4Parser = LNMP4Parser
-public typealias QGMP4ParserProxy = LNMP4ParserProxy
-
 private func lnReadU32(_ bytes: UnsafePointer<UInt8>, _ offset: Int) -> UInt32 {
     (UInt32(bytes[offset]) << 24)
     | (UInt32(bytes[offset + 1]) << 16)

+ 7 - 7
QGVAPlayer/QGVAPlayer/LNSwift/Render/LNRenderers.swift

@@ -95,7 +95,7 @@ private final class LNHWDMetalCoreRenderer {
     private var yuvMatrixBuffer: MTLBuffer?
     private var currentColorMatrix = matrix601Full
 
-    init?(metalLayer: CAMetalLayer, blendMode: QGHWDTextureBlendMode) {
+    init?(metalLayer: CAMetalLayer, blendMode: LNTextureBlendMode) {
         guard let device = MTLCreateSystemDefaultDevice(),
               let queue = device.makeCommandQueue() else {
             return nil
@@ -129,7 +129,7 @@ private final class LNHWDMetalCoreRenderer {
         updateYuvMatrixBuffer(matrix: Self.matrix601Full)
     }
 
-    func updateBlendMode(_ blendMode: QGHWDTextureBlendMode) {
+    func updateBlendMode(_ blendMode: LNTextureBlendMode) {
         let modeIndex = max(0, min(Int(blendMode.rawValue), Self.verticesByBlendMode.count - 1))
         let flat = Self.verticesByBlendMode[modeIndex].flatMap { $0 }
         vertexBuffer = device.makeBuffer(bytes: flat, length: flat.count * MemoryLayout<Float>.size, options: .storageModeShared)
@@ -580,7 +580,7 @@ private final class LNMetalUnavailableBridge: NSObject {
 
 @objcMembers
 public final class LNHWDMetalRenderer: NSObject {
-    public var blendMode: QGHWDTextureBlendMode {
+    public var blendMode: LNTextureBlendMode {
         didSet {
             if #available(iOS 13.0, *), let swiftRenderer = swiftRenderer as? LNHWDMetalCoreRenderer {
                 swiftRenderer.updateBlendMode(blendMode)
@@ -593,7 +593,7 @@ public final class LNHWDMetalRenderer: NSObject {
     private let swiftRenderer: AnyObject?
 
     @objc(initWithMetalLayer:blendMode:)
-    public init(metalLayer: AnyObject, blendMode: QGHWDTextureBlendMode) {
+    public init(metalLayer: AnyObject, blendMode: LNTextureBlendMode) {
         self.blendMode = blendMode
         if #available(iOS 13.0, *), let metalLayer = metalLayer as? CAMetalLayer {
             self.swiftRenderer = LNHWDMetalCoreRenderer(metalLayer: metalLayer, blendMode: blendMode)
@@ -632,7 +632,7 @@ public final class LNHWDMetalView: UIView {
         get { delegate }
         set { delegate = newValue }
     }
-    public var blendMode: QGHWDTextureBlendMode {
+    public var blendMode: LNTextureBlendMode {
         didSet {
             fallbackRenderer.blendMode = blendMode
         }
@@ -643,7 +643,7 @@ public final class LNHWDMetalView: UIView {
     private lazy var fallbackRenderer = LNHWDMetalRenderer(metalLayer: renderLayer, blendMode: blendMode)
 
     @objc(initWithFrame:blendMode:)
-    public init(frame: CGRect, blendMode: QGHWDTextureBlendMode) {
+    public init(frame: CGRect, blendMode: LNTextureBlendMode) {
         self.blendMode = blendMode
         super.init(frame: frame)
         setupRenderingLayer(frame: frame)
@@ -841,7 +841,7 @@ public final class LNHWDMP4OpenGLView: UIView {
     public weak var displayDelegate: LNHWDMP4OpenGLViewDelegate?
     public var glContext: AnyObject?
 
-    public var blendMode: QGHWDTextureBlendMode = .alphaLeft {
+    public var blendMode: LNTextureBlendMode = .alphaLeft {
         didSet {
             fallbackRenderer.blendMode = blendMode
         }

+ 3 - 72
QGVAPlayer/QGVAPlayer/LNSwift/Utils/LNUtilities.swift

@@ -18,7 +18,7 @@ public final class LNVAPLogger: NSObject {
         lock.unlock()
     }
 
-    // Legacy ObjC parity: +[QGVAPLogger registerExternalLog:]
+    // Keep the external logging hook as a stable LN logger entry point.
     @objc(registerExternalLog:)
     public static func registerExternalLog(_ handler: @escaping LNLogHandler) {
         registerLogHandler(handler)
@@ -597,8 +597,8 @@ public final class LNVAPDeviceUtil: NSObject {
 }
 
 public extension UIDevice {
-    @objc(hwd_isSimulator)
-    func hwd_isSimulator() -> Bool {
+    @objc(ln_isSimulator)
+    func ln_isSimulator() -> Bool {
         #if targetEnvironment(simulator)
         return true
         #else
@@ -622,11 +622,6 @@ public extension NSArray {
                       width: (self[2] as? NSNumber)?.doubleValue ?? ((self[2] as? NSString)?.doubleValue ?? 0),
                       height: (self[3] as? NSNumber)?.doubleValue ?? ((self[3] as? NSString)?.doubleValue ?? 0))
     }
-
-    @objc(hwd_rectValue)
-    func hwd_rectValue() -> CGRect {
-        ln_rectValue()
-    }
 }
 
 public extension NSDictionary {
@@ -668,31 +663,6 @@ public extension NSDictionary {
         guard let key else { return nil }
         return self[key] as? NSArray
     }
-
-    @objc(hwd_floatValue:)
-    func hwd_floatValue(_ key: String?) -> CGFloat {
-        ln_floatValue(forKey: key)
-    }
-
-    @objc(hwd_integerValue:)
-    func hwd_integerValue(_ key: String?) -> Int {
-        ln_integerValue(forKey: key)
-    }
-
-    @objc(hwd_stringValue:)
-    func hwd_stringValue(_ key: String?) -> String {
-        ln_stringValue(forKey: key)
-    }
-
-    @objc(hwd_dicValue:)
-    func hwd_dicValue(_ key: String?) -> NSDictionary? {
-        ln_dictionaryValue(forKey: key)
-    }
-
-    @objc(hwd_arrValue:)
-    func hwd_arrValue(_ key: String?) -> NSArray? {
-        ln_arrayValue(forKey: key)
-    }
 }
 
 public extension UIColor {
@@ -758,11 +728,6 @@ public extension UIColor {
 
         return UIColor(red: r, green: g, blue: b, alpha: a)
     }
-
-    @objc(hwd_colorWithHexString:)
-    static func hwd_color(withHexString hexString: String) -> UIColor? {
-        ln_color(hexString: hexString)
-    }
 }
 
 private final class LNGestureBlockTarget: NSObject {
@@ -803,21 +768,6 @@ public extension UIGestureRecognizer {
         }
         objc_setAssociatedObject(self, &lnGestureTargetKey, nil, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)
     }
-
-    @objc(initWithVapActionBlock:)
-    convenience init(vapActionBlock: @escaping (Any) -> Void) {
-        self.init(lnActionBlock: vapActionBlock)
-    }
-
-    @objc(addVapActionBlock:)
-    func addVapActionBlock(_ block: @escaping (Any) -> Void) {
-        ln_addActionBlock(block)
-    }
-
-    @objc(removeAllVapActionBlocks)
-    func removeAllVapActionBlocks() {
-        ln_removeAllActionBlocks()
-    }
 }
 
 private enum LNNotificationQueueStore {
@@ -897,23 +847,4 @@ public extension NotificationCenter {
             block(note, target)
         }
     }
-
-    @objc(hwd_addSafeObserver:selector:name:object:)
-    func hwd_addSafeObserver(_ observer: NSObject, selector: Selector, name: Notification.Name?, object: Any?) {
-        ln_addSafeObserver(observer, selector: selector, name: name, object: object)
-    }
-
-    @objc(hwd_addSafeObserver:selector:name:object:queue:)
-    func hwd_addSafeObserver(_ observer: NSObject, selector: Selector, name: Notification.Name?, object: Any?, queue: OperationQueue?) {
-        guard let queue else {
-            ln_addSafeObserver(observer, selector: selector, name: name, object: object)
-            return
-        }
-        ln_addSafeObserver(observer, selector: selector, name: name, object: object, queue: queue)
-    }
-
-    @objc(hwd_addWeakObserver:name:usingBlock:)
-    func hwd_addWeakObserver(_ weakObserver: NSObject, name: Notification.Name?, using block: @escaping (Notification, NSObject) -> Void) {
-        ln_addWeakObserver(weakObserver, name: name, using: block)
-    }
 }

+ 8 - 34
QGVAPlayer/QGVAPlayer/LNSwift/View/LNVAPPlayerView.swift

@@ -2,10 +2,10 @@ import UIKit
 import CoreVideo
 import Metal
 
-private let lnDefaultFPS = 20
-private let lnMinFPS = 1
-private let lnMaxFPS = 60
-private let lnMaxCompatibleVAPVersion = 2
+private let lnDefaultFPS = kLNMP4DefaultFPS
+private let lnMinFPS = kLNMP4MinFPS
+private let lnMaxFPS = LNMP4MaxFPS
+private let lnMaxCompatibleVAPVersion = LNVAPMaxCompatibleVersion
 
 @objcMembers
 public final class LNVAPPlayerView: UIView {
@@ -15,7 +15,6 @@ public final class LNVAPPlayerView: UIView {
     fileprivate var didStart = false
 
     public weak var delegate: LNVAPPlaybackDelegate?
-    public weak var legacyDelegate: LNVAPLegacyPlaybackDelegate?
 
     public var enterBackgroundOperation: LNEnterBackgroundOperation {
         get { core.enterBackgroundOperation }
@@ -156,49 +155,29 @@ public final class LNVAPPlayerView: UIView {
         playbackView.isUserInteractionEnabled = true
     }
 
-    @objc(addVapTapGesture:)
-    public func addVapTapGesture(_ handler: @escaping LNVAPGestureEventBlock) {
-        lnAddVapTapGesture(handler)
-    }
-
-    @objc(addVapGesture:callback:)
-    public func addVapGesture(_ gestureRecognizer: UIGestureRecognizer, callback: @escaping LNVAPGestureEventBlock) {
-        lnAddVapGesture(gestureRecognizer, callback: callback)
-    }
-
     fileprivate func notifyShouldStart(_ config: LNVAPConfigModel) -> Bool {
-        if let allow = delegate?.lnPlayerShouldStart?(self, config: config) {
-            return allow
-        }
-        return legacyDelegate?.shouldStartPlayMP4?(self, config: config) ?? true
+        delegate?.lnPlayerShouldStart?(self, config: config) ?? true
     }
 
     fileprivate func notifyStart() {
         didStart = true
         delegate?.lnPlayerDidStart?(self)
-        legacyDelegate?.viewDidStartPlayMP4?(self)
     }
 
     fileprivate func notifyPlay(_ frame: LNMP4AnimatedImageFrame) {
         delegate?.lnPlayerDidPlay?(self, frame: frame)
-        legacyDelegate?.viewDidPlayMP4AtFrame?(frame, view: self)
     }
 
     fileprivate func notifyFinish(_ totalFrameCount: Int) {
         delegate?.lnPlayerDidFinish?(self, totalFrameCount: totalFrameCount)
-        legacyDelegate?.viewDidFinishPlayMP4?(totalFrameCount, view: self)
     }
 
     fileprivate func notifyFail(_ error: NSError) {
         delegate?.lnPlayerDidFail?(self, error: error)
-        legacyDelegate?.viewDidFailPlayMP4?(error)
     }
 
     fileprivate func contentForTag(_ tag: String, resource: LNVAPSourceInfo) -> String? {
-        if let text = delegate?.lnPlayerContent?(forTag: tag, resource: resource) {
-            return text
-        }
-        return legacyDelegate?.contentForVapTag?(tag, resource: resource)
+        delegate?.lnPlayerContent?(forTag: tag, resource: resource)
     }
 
     fileprivate func loadImage(withURL url: String, context: NSDictionary, completion: @escaping LNVAPImageCompletion) {
@@ -206,10 +185,6 @@ public final class LNVAPPlayerView: UIView {
             handler(url, context, completion)
             return
         }
-        if (legacyDelegate as AnyObject?)?.responds(to: #selector(LNVAPLegacyPlaybackDelegate.loadVapImage(withURL:context:completion:))) == true {
-            legacyDelegate?.loadVapImage?(withURL: url, context: context, completion: completion)
-            return
-        }
         let error = NSError(
             domain: NSURLErrorDomain,
             code: -1,
@@ -220,7 +195,6 @@ public final class LNVAPPlayerView: UIView {
 
     fileprivate func notifyStopIfNeeded(lastFrameIndex: Int) {
         delegate?.lnPlayerDidStop?(self)
-        legacyDelegate?.viewDidStopPlayMP4?(lastFrameIndex, view: self)
         didStart = false
     }
 
@@ -374,7 +348,7 @@ private final class LNPlayerCore: NSObject {
         self.filePath = filePath
         self.repeatCount = repeatCount
 
-        if callbackQueue == nil, (owner?.delegate != nil || owner?.legacyDelegate != nil) {
+        if callbackQueue == nil, owner?.delegate != nil {
             let queue = OperationQueue()
             queue.maxConcurrentOperationCount = 1
             callbackQueue = queue
@@ -700,7 +674,7 @@ extension LNPlayerCore: LNAnimatedImageDecoderDelegate {
     }
 
     func decoderDidFailDecode(_ decoder: LNBaseDecoder?, error: NSError) {
-        // Keep parity with OC UIView+VAP: stop first, then emit failure callback.
+        // Stop first, then emit the failure callback to keep playback state consistent.
         stopInternal(triggerDelegate: true)
         performCallback { [weak self] in
             self?.owner?.notifyFail(error)

+ 2 - 33
QGVAPlayer/QGVAPlayer/LNSwift/View/LNVAPWrapView.swift

@@ -6,7 +6,6 @@ public final class LNVAPWrapView: UIView {
     private var delegateBridge = LNWrapDelegateBridge()
 
     public weak var delegate: LNVAPWrapPlaybackDelegate?
-    public weak var legacyDelegate: LNVAPWrapLegacyPlaybackDelegate?
 
     public var contentModeOption: LNVAPWrapContentMode = .scaleToFill {
         didSet {
@@ -115,16 +114,6 @@ public final class LNVAPWrapView: UIView {
         player.lnAddVapGesture(gestureRecognizer, callback: callback)
     }
 
-    @objc(addVapTapGesture:)
-    public func addVapTapGesture(_ handler: @escaping LNVAPGestureEventBlock) {
-        lnAddVapTapGesture(handler)
-    }
-
-    @objc(addVapGesture:callback:)
-    public func addVapGesture(_ gestureRecognizer: UIGestureRecognizer, callback: @escaping LNVAPGestureEventBlock) {
-        lnAddVapGesture(gestureRecognizer, callback: callback)
-    }
-
     public override func hitTest(_ hitPoint: CGPoint, with event: UIEvent?) -> UIView? {
         if !isUserInteractionEnabled || isHidden || alpha < 0.01 {
             return nil
@@ -143,32 +132,24 @@ public final class LNVAPWrapView: UIView {
 
     fileprivate func shouldStart(with config: LNVAPConfigModel) -> Bool {
         applyContentMode(with: config)
-        if let allow = delegate?.lnWrapViewShouldStart?(self, config: config) {
-            return allow
-        }
-        return legacyDelegate?.vapWrap_viewshouldStartPlayMP4?(legacyContainerView(), config: config) ?? true
+        return delegate?.lnWrapViewShouldStart?(self, config: config) ?? true
     }
 
     fileprivate func notifyStart() {
         delegate?.lnWrapViewDidStart?(self)
-        legacyDelegate?.vapWrap_viewDidStartPlayMP4?(legacyContainerView())
     }
 
     fileprivate func notifyPlay(_ frame: LNMP4AnimatedImageFrame) {
         delegate?.lnWrapViewDidPlay?(self, frame: frame)
-        legacyDelegate?.vapWrap_viewDidPlayMP4AtFrame?(frame, view: legacyContainerView())
     }
 
     fileprivate func notifyFinish(_ totalFrameCount: Int) {
         let computedCount = max(totalFrameCount, delegateBridge.lastPlayedFrameIndex + 1)
         delegate?.lnWrapViewDidFinish?(self, totalFrameCount: computedCount)
-        legacyDelegate?.vapWrap_viewDidFinishPlayMP4?(computedCount, view: legacyContainerView())
     }
 
     fileprivate func notifyStop() {
         delegate?.lnWrapViewDidStop?(self)
-        let lastFrameIndex = delegateBridge.lastPlayedFrameIndex
-        legacyDelegate?.vapWrap_viewDidStopPlayMP4?(lastFrameIndex, view: legacyContainerView())
         delegateBridge.lastPlayedFrameIndex = 0
         DispatchQueue.main.async { [weak self] in
             guard let self else { return }
@@ -181,14 +162,10 @@ public final class LNVAPWrapView: UIView {
 
     fileprivate func notifyFail(_ error: NSError) {
         delegate?.lnWrapViewDidFail?(self, error: error)
-        legacyDelegate?.vapWrap_viewDidFailPlayMP4?(error)
     }
 
     fileprivate func contentForTag(_ tag: String, resource: LNVAPSourceInfo) -> String? {
-        if let text = delegate?.lnWrapViewContent?(forTag: tag, resource: resource) {
-            return text
-        }
-        return legacyDelegate?.vapWrapview_contentForVapTag?(tag, resource: resource)
+        delegate?.lnWrapViewContent?(forTag: tag, resource: resource)
     }
 
     fileprivate func loadImage(withURL url: String, context: NSDictionary, completion: @escaping LNVAPImageCompletion) {
@@ -196,10 +173,6 @@ public final class LNVAPWrapView: UIView {
             handler(url, context, completion)
             return
         }
-        if (legacyDelegate as AnyObject?)?.responds(to: #selector(LNVAPWrapLegacyPlaybackDelegate.vapWrapView_loadVapImage(withURL:context:completion:))) == true {
-            legacyDelegate?.vapWrapView_loadVapImage?(withURL: url, context: context, completion: completion)
-            return
-        }
         completion(nil, nil, url)
     }
 
@@ -215,10 +188,6 @@ public final class LNVAPWrapView: UIView {
         return view
     }
 
-    private func legacyContainerView() -> UIView {
-        playerView ?? self
-    }
-
     private func applyContentModeIfPossible() {
         guard let playerView else { return }
         guard let config = delegateBridge.lastConfig else {

+ 1 - 1
QGVAPlayer/QGVAPlayer/Shaders/QGHWDShaders.metal

@@ -17,7 +17,7 @@
 #import <simd/simd.h>
 
 /*
- 请注意:更新本文件后请同步到QGHWDMetalShaderSourceDefine.h
+ 请注意:更新本文件后请同步到 LNVAPMetalShaderFunctionLoader.inlineShaderSource
  */
 using namespace metal;