Skip to content

Commit 62b9e09

Browse files
adamsfliuAbySwifter
authored andcommitted
【Example】Add CustomBeautyPlugin
1 parent 1f62a63 commit 62b9e09

File tree

11 files changed

+28
-14
lines changed

11 files changed

+28
-14
lines changed

beauty_process_plugin/iOS/Classes/ITXCustomBeautyProcessFactory.swift renamed to beauty_processer_plugin/iOS/Classes/ITXCustomBeautyProcesserFactory.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77

88
import UIKit
99

10-
public protocol ITXCustomBeautyProcessFactory: NSObject {
10+
@objc public protocol ITXCustomBeautyProcesserFactory {
1111
/// 创建美颜实例
12-
func createBeautyInstance() -> ITXCustomBeautyProcesser
12+
func createCustomBeautyProcesser() -> ITXCustomBeautyProcesser
1313

1414
/// 销毁美颜实例
15-
func destroyBeautyInstance()
15+
func destroyCustomBeautyProcesser()
1616
}
1717

18-
public protocol ITXCustomBeautyProcesser: NSObject {
18+
@objc public protocol ITXCustomBeautyProcesser {
1919
/// 获取第三方美颜 PixelFormat
2020
func getSupportedPixelFormat() -> ITXCustomBeautyPixelFormat
2121

beauty_process_plugin/iOS/Classes/ITXCustomBeautyVideoFrame.swift renamed to beauty_processer_plugin/iOS/Classes/ITXCustomBeautyVideoFrame.swift

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import Foundation
99
import TXLiteAVSDK_Live
1010

11-
public enum ITXCustomBeautyBufferType: Int {
11+
@objc public enum ITXCustomBeautyBufferType: Int {
1212
case Unknown = 0
1313
case PixelBuffer = 1
1414
case Data = 2
@@ -41,7 +41,7 @@ public enum ITXCustomBeautyBufferType: Int {
4141
}
4242
}
4343

44-
public enum ITXCustomBeautyPixelFormat: Int {
44+
@objc public enum ITXCustomBeautyPixelFormat: Int {
4545
case Unknown = 0
4646
case I420 = 1
4747
case Texture2D = 2
@@ -79,6 +79,7 @@ public enum ITXCustomBeautyPixelFormat: Int {
7979
}
8080
}
8181

82+
@objcMembers
8283
public class ITXCustomBeautyVideoFrame: NSObject {
8384

8485
public enum ITXCustomBeautyRotation: Int {
@@ -122,8 +123,21 @@ public class ITXCustomBeautyVideoFrame: NSObject {
122123
height = v2VideoFrame.height
123124
textureId = v2VideoFrame.textureId
124125
rotation = ITXCustomBeautyRotation(rawValue: v2VideoFrame.rotation.rawValue) ?? .rotation_0
125-
pixelFormat = ITXCustomBeautyPixelFormat(rawValue: v2VideoFrame.pixelFormat.rawValue) ?? nil
126-
bufferType = ITXCustomBeautyBufferType(rawValue: v2VideoFrame.bufferType.rawValue) ?? nil
126+
switch v2VideoFrame.pixelFormat {
127+
case .unknown:
128+
pixelFormat = .Unknown
129+
case .I420:
130+
pixelFormat = .I420
131+
case .texture2D:
132+
pixelFormat = .Texture2D
133+
case .BGRA32:
134+
pixelFormat = .BGRA
135+
case .NV12:
136+
pixelFormat = .NV12
137+
default:
138+
pixelFormat = .Unknown
139+
}
140+
bufferType = ITXCustomBeautyBufferType(rawValue: v2VideoFrame.bufferType.rawValue) ?? .Unknown
127141
timestamp = 0
128142
super.init()
129143
}

0 commit comments

Comments
 (0)