opentimelineio / opentimelineio-swift-bindings Goto Github PK
View Code? Open in Web Editor NEWSwift bindings for the OpenTimelineIO Library (http://opentimeline.io)
Home Page: http://opentimeline.io
License: Apache License 2.0
Swift bindings for the OpenTimelineIO Library (http://opentimeline.io)
Home Page: http://opentimeline.io
License: Apache License 2.0
Use Github-Actions for CI.
On the main opentimeline.io repo, we use GitHub actions CI to detect PRs that break things. We should enable this for the swift repo build as well.
Some potential references:
https://medium.com/rosberryapps/github-actions-ci-for-swift-projects-c129baceed1a
Currently the Swift bindings won't build due to the recent introduction of the OTIO version downgrade feature last year (see AcademySoftwareFoundation/OpenTimelineIO#1387)
This has been mentioned and / or discussed here:
/Users/runner/work/OpenTimelineIO-Swift-Bindings/OpenTimelineIO-Swift-Bindings/Sources/objc/opentimelineio.mm:184:79: error: cannot initialize a parameter of type 'const opentimelineio::v1_0::schema_version_map *' (aka 'const unordered_map<basic_string<char, char_traits<char>, allocator<char>>, long long> *') with an lvalue of type 'int'
[18](https://github.com/OpenTimelineIO/OpenTimelineIO-Swift-Bindings/actions/runs/4672986419/jobs/8275720886#step:3:19)
self.retainer.value->to_json_file(filename.UTF8String, &aeh.error_status, indent);
[19](https://github.com/OpenTimelineIO/OpenTimelineIO-Swift-Bindings/actions/runs/4672986419/jobs/8275720886#step:3:20)
^~~~~~
[20](https://github.com/OpenTimelineIO/OpenTimelineIO-Swift-Bindings/actions/runs/4672986419/jobs/8275720886#step:3:21)
/Users/runner/work/OpenTimelineIO-Swift-Bindings/OpenTimelineIO-Swift-Bindings/OpenTimelineIO/src/opentimelineio/serializableObject.h:51:35: note: passing argument to parameter 'target_family_label_spec' here
[21](https://github.com/OpenTimelineIO/OpenTimelineIO-Swift-Bindings/actions/runs/4672986419/jobs/8275720886#step:3:22)
const schema_version_map* target_family_label_spec = nullptr,
[22](https://github.com/OpenTimelineIO/OpenTimelineIO-Swift-Bindings/actions/runs/4672986419/jobs/8275720886#step:3:23)
^
[23](https://github.com/OpenTimelineIO/OpenTimelineIO-Swift-Bindings/actions/runs/4672986419/jobs/8275720886#step:3:24)
/Users/runner/work/OpenTimelineIO-Swift-Bindings/OpenTimelineIO-Swift-Bindings/Sources/objc/opentimelineio.mm:190:81: error: cannot initialize a parameter of type 'const opentimelineio::v1_0::schema_version_map *' (aka 'const unordered_map<basic_string<char, char_traits<char>, allocator<char>>, long long> *') with an lvalue of type 'int'
[24](https://github.com/OpenTimelineIO/OpenTimelineIO-Swift-Bindings/actions/runs/4672986419/jobs/8275720886#step:3:25)
return make_nsstring(self.retainer.value->to_json_string(&aeh.error_status, indent));
[25](https://github.com/OpenTimelineIO/OpenTimelineIO-Swift-Bindings/actions/runs/4672986419/jobs/8275720886#step:3:26)
^~~~~~
[26](https://github.com/OpenTimelineIO/OpenTimelineIO-Swift-Bindings/actions/runs/4672986419/jobs/8275720886#step:3:27)
/Users/runner/work/OpenTimelineIO-Swift-Bindings/OpenTimelineIO-Swift-Bindings/OpenTimelineIO/src/opentimelineio/serializableObject.h:56:35: note: passing argument to parameter 'target_family_label_spec' here
[27](https://github.com/OpenTimelineIO/OpenTimelineIO-Swift-Bindings/actions/runs/4672986419/jobs/8275720886#step:3:28)
const schema_version_map* target_family_label_spec = nullptr,
[28](https://github.com/OpenTimelineIO/OpenTimelineIO-Swift-Bindings/actions/runs/4672986419/jobs/8275720886#step:3:29)
^
[29](https://github.com/OpenTimelineIO/OpenTimelineIO-Swift-Bindings/actions/runs/4672986419/jobs/8275720886#step:3:30)
2 errors generated.
In Track.swift, the track kind is defined as
public enum Kind : String {
case video = "Video"
case audion = "Audio"
}
Should be
public enum Kind : String {
case video = "Video"
case audio = "Audio"
}
New feature
expose some of the timecode conversion functions available in Python and C++
ie
is_valid_timecode_rate
to_timecode
and the static lists of
dropframe_timecode_rates
smpte_timecode_rates
valid_timecode_rates
Would be nice to have!
The initializer is missing an assignment of availableRange, see below.
public class ExternalReference : MediaReference {
override public init() {
super.init(otio_new_external_reference())
}
public convenience init<ST : Sequence>(targetURL: URL? = nil,
availableRange: TimeRange? = nil,
metadata: ST? = nil) where ST.Element == Metadata.Dictionary.Element {
self.init()
metadataInit(name, metadata)
if let targetURL = targetURL {
self.targetURL = targetURL
}
}
Swift/C++ interoperation support has come a long way since we last looked. We should re-evaluate and compare to the approach taken in this repo to see which strategy is best.
See also this proposal: AcademySoftwareFoundation/tac#578 including @furby-tm's slides which give an overview: Swift_Working_Group.pdf
Hi friends.
I'm working on adding some extensions to the Swift portion to enable CoreMedia and AVFoundation compatibility.
With a checkout of the project in Xcode 14.3.1 on Mac OS 13.4.1, I am unable to run tests via Xcode's built in testing framework, which appears supported given the project's structure and source.
Checkout latest into a new repo
Command + U to run tests, or in the command line swift test
- both result in
'any/any.hpp' file not found
Tests run (and pass)
vade@Attitude-Adjuster OpenTimelineIO-Swift-Bindings % swift test
warning: 'opentimelineio-swift-bindings': Invalid Exclude '/Users/vade/Documents/Repositories/OpenTimelineIO-Swift-Bindings/OpenTimelineIO/src/opentime/OpentimeConfig.cmake.in': File not found.
warning: 'opentimelineio-swift-bindings': Invalid Exclude '/Users/vade/Documents/Repositories/OpenTimelineIO-Swift-Bindings/OpenTimelineIO/src/opentimelineio/OpentimelineIOConfig.cmake.in': File not found.
Building for debugging...
In file included from /Users/vade/Documents/Repositories/OpenTimelineIO-Swift-Bindings/OpenTimelineIO/src/opentimelineio/externalReference.cpp:4:
In file included from /Users/vade/Documents/Repositories/OpenTimelineIO-Swift-Bindings/OpenTimelineIO/src/opentimelineio/externalReference.h:6:
In file included from /Users/vade/Documents/Repositories/OpenTimelineIO-Swift-Bindings/OpenTimelineIO/src/opentimelineio/mediaReference.h:6:
In file included from /Users/vade/Documents/Repositories/OpenTimelineIO-Swift-Bindings/OpenTimelineIO/src/opentimelineio/serializableObjectWithMetadata.h:6:
In file included from /Users/vade/Documents/Repositories/OpenTimelineIO-Swift-Bindings/OpenTimelineIO/src/opentimelineio/serializableObject.h:9:
In file included from /Users/vade/Documents/Repositories/OpenTimelineIO-Swift-Bindings/OpenTimelineIO/src/opentimelineio/anyDictionary.h:6:
/Users/vade/Documents/Repositories/OpenTimelineIO-Swift-Bindings/OpenTimelineIO/src/opentimelineio/any.h:6:10: fatal error: 'any/any.hpp' file not found
#include "any/any.hpp"
^~~~~~~~~~~~~
1 error generated.
In file included from /Users/vade/Documents/Repositories/OpenTimelineIO-Swift-Bindings/OpenTimelineIO/src/opentimelineio/clip.cpp:4:
In file included from /Users/vade/Documents/Repositories/OpenTimelineIO-Swift-Bindings/OpenTimelineIO/src/opentimelineio/clip.h:6:
In file included from /Users/vade/Documents/Repositories/OpenTimelineIO-Swift-Bindings/OpenTimelineIO/src/opentimelineio/item.h:7:
In file included from /Users/vade/Documents/Repositories/OpenTimelineIO-Swift-Bindings/OpenTimelineIO/src/opentimelineio/composable.h:6:
In file included from /Users/vade/Documents/Repositories/OpenTimelineIO-Swift-Bindings/OpenTimelineIO/src/opentimelineio/serializableObjectWithMetadata.h:6:
In file included from /Users/vade/Documents/Repositories/OpenTimelineIO-Swift-Bindings/OpenTimelineIO/src/opentimelineio/serializableObject.h:9:
In file included from /Users/vade/Documents/Repositories/OpenTimelineIO-Swift-Bindings/OpenTimelineIO/src/opentimelineio/anyDictionary.h:6:
/Users/vade/Documents/Repositories/OpenTimelineIO-Swift-Bindings/OpenTimelineIO/src/opentimelineio/any.h:6:10: fatal error: 'any/any.hpp' file not found
#include "any/any.hpp"
^~~~~~~~~~~~~
1 error generated.
In file included from /Users/vade/Documents/Repositories/OpenTimelineIO-Swift-Bindings/OpenTimelineIO/src/opentimelineio/CORE_VERSION_MAP.cpp:13:
In file included from /Users/vade/Documents/Repositories/OpenTimelineIO-Swift-Bindings/OpenTimelineIO/src/opentimelineio/typeRegistry.h:6:
/Users/vade/Documents/Repositories/OpenTimelineIO-Swift-Bindings/OpenTimelineIO/src/opentimelineio/any.h:6:10: fatal error: 'any/any.hpp' file not found
#include "any/any.hpp"
^~~~~~~~~~~~~
1 error generated.
In file included from /Users/vade/Documents/Repositories/OpenTimelineIO-Swift-Bindings/OpenTimelineIO/src/opentimelineio/composable.cpp:4:
In file included from /Users/vade/Documents/Repositories/OpenTimelineIO-Swift-Bindings/OpenTimelineIO/src/opentimelineio/composable.h:6:
In file included from /Users/vade/Documents/Repositories/OpenTimelineIO-Swift-Bindings/OpenTimelineIO/src/opentimelineio/serializableObjectWithMetadata.h:6:
In file included from /Users/vade/Documents/Repositories/OpenTimelineIO-Swift-Bindings/OpenTimelineIO/src/opentimelineio/serializableObject.h:9:
In file included from /Users/vade/Documents/Repositories/OpenTimelineIO-Swift-Bindings/OpenTimelineIO/src/opentimelineio/anyDictionary.h:6:
/Users/vade/Documents/Repositories/OpenTimelineIO-Swift-Bindings/OpenTimelineIO/src/opentimelineio/any.h:6:10: fatal error: 'any/any.hpp' file not found
#include "any/any.hpp"
^~~~~~~~~~~~~
1 error generated.
In file included from /Users/vade/Documents/Repositories/OpenTimelineIO-Swift-Bindings/OpenTimelineIO/src/opentimelineio/effect.cpp:4:
In file included from /Users/vade/Documents/Repositories/OpenTimelineIO-Swift-Bindings/OpenTimelineIO/src/opentimelineio/effect.h:6:
In file included from /Users/vade/Documents/Repositories/OpenTimelineIO-Swift-Bindings/OpenTimelineIO/src/opentimelineio/serializableObjectWithMetadata.h:6:
In file included from /Users/vade/Documents/Repositories/OpenTimelineIO-Swift-Bindings/OpenTimelineIO/src/opentimelineio/serializableObject.h:9:
In file included from /Users/vade/Documents/Repositories/OpenTimelineIO-Swift-Bindings/OpenTimelineIO/src/opentimelineio/anyDictionary.h:6:
/Users/vade/Documents/Repositories/OpenTimelineIO-Swift-Bindings/OpenTimelineIO/src/opentimelineio/any.h:6:10: fatal error: 'any/any.hpp' file not found
#include "any/any.hpp"
^~~~~~~~~~~~~
1 error generated.
[3/49] Compiling opentime.mm
error: fatalError
pull repo, swift test
fails with
/Users/nporcino/dev/OpenTimelineIO-Swift-Bindings/Tests/OpenTimelineIOTests/testExernalReference.swift:40:52: warning: cast from 'MetadataValue?' to unrelated type 'Int' always fails
let index : Int = test_dict["sheet_index"] as! Int
~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~
[86/86] Build complete!
Test Suite 'All tests' started at 2021-09-16 16:43:01.710
Test Suite 'OpenTimelineIOPackageTests.xctest' started at 2021-09-16 16:43:01.711
Test Suite 'tesExternalReference' started at 2021-09-16 16:43:01.711
Test Case '-[OpenTimelineIOTests.tesExternalReference testAvailableRange]' started.
Test Case '-[OpenTimelineIOTests.tesExternalReference testAvailableRange]' passed (0.006 seconds).
Test Case '-[OpenTimelineIOTests.tesExternalReference testMetadata]' started.
Could not cast value of type 'Swift.Double' (0x7fff81659c00) to 'Swift.Int' (0x7fff81659fa0).
Exited with signal code 6
MetadataValue? as! Int
seems to have bit-rotted as a valid way to get an int out of the metadata.
This project's GitHub Action currently fails with the following error:
error: unable to open dependencies file (/Users/runner/work/OpenTimelineIO-Swift-Bindings/OpenTimelineIO-Swift-Bindings/.build/x86_64-apple-macosx/debug/OpenTimelineIO_CXX.build/OpenTimelineIOConfig.cmake.in.d)
Add support for defining custom schemas from Swift.
Being able to register custom schemas is a central part of OTIO. The Swift bindings support the Unknown schama, which is nice. But it should also support registering custom schemas.
Working on an AVFoundation interoperability implementation of OTIO and noticing that Media Reference does not expose its bounds in any way.
While not strictly necessary, its helpful to have access when trying to read an OTIO timeline and do useful stuff with it
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.