Swiftpack.co -  UnpxreTW/SwiftH264Decoder as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
UnpxreTW/SwiftH264Decoder
將 Raw H.264 Data 轉換為 CMSampleBuffer 或 CVPixelBuffer
.package(url: "https://github.com/UnpxreTW/SwiftH264Decoder.git", from: "v1.0.2")

H264Decoder

將 Raw H.264 Data 轉換為 CMSampleBuffer 或 CVPixelBuffer

使用方式

  1. 建立 Decoder 實例

預設初始化解碼為 CMSampleBuffer:

var decoder = H264Decoder()

或是指定初始化格式:

var decoder = H264Decoder(to: .CVPixelBuffer)
  1. 設定解碼完成後輸出流

使自己的類別繼承 H264DecoderDelegate 並設定 Decoder 的 delegate 並實作方法以得到解碼完後的輸出

  • note: 只有與解碼器設定同一個模式的輸出才會被觸發。
class HandleClass: H264DecoderDelegate {
    decoder.delegate = self

    func newFrame(_ decoder: H264Decoder, decoded frame: CMSampleBuffer) {
        // do something
    }

    func newFrame(_ decoder: H264Decoder, decoded frame: CVPixelBuffer) {
        // do something
    }
}

或是更改解碼模式

decoder.change(to: .CVPixelBuffer)
  1. 將 Raw H.264 Data 傳入 Decoder 實例進行解碼
decoder.qnqueue(<#T##Raw H.264 Data##Data#>)

GitHub

link
Stars: 0
Last commit: 2 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Submit a free job ad (while I'm testing this). The analytics numbers for this website are here.

Release Notes

新增對於版本的最低需求
2 weeks ago
  • iOS 最低需求 iOS 8
  • macOS 最低需求 macOS 10.11
  • tvOS 最低需求 tvOS 11,但是其實可支援到 tvOS 10.2
  • watchOS 不可使用

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics