Skip to content
This repository has been archived by the owner on Jan 6, 2025. It is now read-only.

- Migration of Objective-C code to Swift 5.0 #599

Closed
wants to merge 1 commit into from

Conversation

jvega1976
Copy link

Hello,
Not sure if you could be interested, but I have migrated the iOS Objective-C code to Swift, so I'm contributing it in case you would like to use it for future releases.

Below is a short description of the multiple changes. I tried to not change the actual code, so I mostly copied (and sometimes renamed) the actual files (like the "ios-.sh" scripts, that I copied and renamed as "apple-.sh"); or the fftools C Language files that I copied to iOS/Sources/fftools (I did small changes in those files to enable full concurrent execution in Swift). New Swift files are located at ios/Sources/MobileFFmpeg. And the Xcode project is inside the ios folder.

In general these are the updates:

  • Migration of Objective-C code to Swift 5.0.
  • Addition of "apple.sh" shell script to generate a "Binary Framework"
    for iOS, iOS Simulator, Mac Catalyst and Mac OS plaforms.
  • Adoption of Cocoa design patters for Framework compatibility with Objective-C Applications/Frameworks.
  • Addition of "apple-*.sh" scripts to support generation of external libraries.
    for Apple Intel (x86_64) and Apple Silicon (arm64) architectures. Scripts supports
    generation for platforms: macOS (Intel and Apple Silicon), Catalyst (Intel and Apple Silicon),
    iOS Simulator(Intel and Apple Silicon) and iOS (arm64).
  • Addition of Xcode project (MobileFFmpeg.xcodeproj) to support generation of
    Framework. New "apple.sh" script make use of this project to generate
    final individual Frameworks. Project can be integrated in other Xcode
    projects, used for testing, or Frameworks generation for specific
    Platform/Architecture.
  • Xcode project include Test Unit with examples of new APIs.
  • Addition of Swift Package for distribution of final Binary Framework
    (XCFramework).

- Addition of "apple.sh" shell script to generate a "Binary Framework"
  for iOS, iOS Simulator, Mac Catalyst and Mac OS plaforms.
- Adoption of Cocoa design patters for Framework compatibility with Objective-C.
- Addition of "apple-*.sh" scripts to support generation of libraries
  for Apple Intel (x86_64) and Apple Silicon (arm64) architectures. Scripts supports
  generation for platforms: macOS (Intel and Apple Silicon), Catalyst (Intel and Apple Silicon),
  iOS Simulator(Intel and Apple Silicon) and iOS (arm64).
- Addition of Xcode project (MobileFFmpeg.xcodeproj) to support generation of
  Framework.  New "apple.sh" script make use of this project to generate
  final individual Frameworks.  Project can be integrated in other
  projects, or used to generate individual Framework for specific
  Platform/Architecture.
- Project provide Test Unit with examples of new classes and methods.
- Addition of Swift Package for distribution of final Binary Framework
  (XCFramework).
@tanersener
Copy link
Owner

Thanks, it looks like a big PR. There are a lot of changes introduced in these files.

Let me have a look at them. It will take time to understand how they work and whether we can merge them or not.

@NCrusher74
Copy link

Speaking as person working in Swift, I'm very excited about this! My current project isn't using FFMpeg because I put the one that does on the back burner in the hopes of this very thing eventually coming to be. Thank you!

@jvega1976
Copy link
Author

jvega1976 commented Nov 30, 2020 via email

@tanersener
Copy link
Owner

tanersener commented Dec 25, 2020

I see some issues that make it difficult to merge this PR.

  • apple.sh script does a lot of things but doesn't cover tvOS
  • Updated build scripts and Swift API doesn't support LTS releases: @available(iOS 13.0, macOS 10.15, *)
  • I want to keep Android and Apple APIs identical as much as possible. But Swift API introduced in this PR is very different than the Android API. They look like two separate APIs
  • module.modulemap used by apple.sh script includes headers for all libraries. If one of the libraries is not enabled, then the build fails with header not found errors. There is no other option than enabling all external libraries
  • Disabling architectures is not handled well by apple.sh script. If, at least one of the architectures is disabled, apple.sh fails to create an XCF framework
  • There are lots of warnings generated by libtool due to having the same object file. /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: warning same member name (4xm.o) in output file used for input files: /Users/taner/Projects/mobile-ffmpeg/prebuilt/ios/lib/libavcodec.a(4xm.o) and: /Users/taner/Projects/mobile-ffmpeg/prebuilt/ios/lib/libavformat.a(4xm.o) due to use of basename, truncation and blank padding

@Alanko5
Copy link

Alanko5 commented Jan 27, 2021

@jvega1976 Will you make a script to support tvOS as well?

@NiuXiaoGuang
Copy link

谢谢,它看起来像一个很大的公关。这些文件中引入了许多更改。

让我看看他们。了解它们的工作方式以及我们是否可以合并它们将需要一些时间。

非常期待

@github-actions
Copy link

github-actions bot commented Apr 9, 2021

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@tanersener
Copy link
Owner

This project will be retired. Please consider switching to FFmpegKit.

@tanersener tanersener closed this Apr 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants