Add ImageSequenceReference Support - #83
Draft
camkerr wants to merge 1 commit into
Draft
Conversation
|
|
Signed-off-by: Cameron Kerr <camkerr@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Link the Issue(s) this Pull Request is related to.
Fixes Issue #82
Summarize your change.
Support for ImageSequenceReference isn't available in the Swift bindings, this PR adds that support.
Reference associated tests.
testImageSequenceReference.swifthas been added with 11 tests to cover this new implementation.Use of AI / LLM
This code was written using an LLM. The following are the details of that session.
My Original Prompt
Environment
Claude Code
Model: Opus 4.8
Claude for Mac: Version 1.15962.2
See uploaded CLAUDE.md and SKILLS.md
Start of Claude's Response
ImageSequenceReference.1is now implemented across all three layers, and the build and full test suite (75 tests, 0 failures) are green.What I did
1. Obj-C++ bridge —
Sources/objc/include/opentimelineio.h+Sources/objc/opentimelineio.mmotio_new_image_sequence_reference()constructor (and#include <opentimelineio/imageSequenceReference.h>).// MARK: - ImageSequenceReferencesection wrapping every C++ member:target_url_base,name_prefix,name_suffixstart_frame,frame_step,rate,frame_zero_paddingmissing_frame_policy(bridged asint, cast back to the C++MissingFramePolicy)end_frame,number_of_images_in_sequence, and the three error-returning methodsframe_for_time,target_url_for_image_number,presentation_time_for_image_number(using the_AutoErrorHandler aeh(cxxErr)pattern).2. Swift layer — ImageSequenceReference.swift
public class ImageSequenceReference : MediaReferencewith a nestedMissingFramePolicy: Intenum (error/hold/black), modeled onTrack.NeighborGapPolicy.ExternalReference/MediaReferencegeneric-metadata pattern, with C++-matching defaults (startFrame: 1,frameStep: 1,rate: 1,frameZeroPadding: 0,missingFramePolicy: .error).endFrame/numberOfImagesInSequenceas get-only; the three error-returning methods asthrowsfunctions viaOTIOError.returnOrThrow."ImageSequenceReference"in SerializableObject.swift'sWrapperCreator.3. Tests — testImageSequenceReference.swift
endFrame,numberOfImagesInSequence,targetURL(forImageNumber:)(including the missing-slash case),frame(for:)(including out-of-range throwing),presentationTime(forImageNumber:),testNegativeFrameNumbers, and JSON serialize/deserialize round-trip. Expected values are taken from upstream'stest_image_sequence_reference.py.Notes worth flagging
OpenTimelineIO/C++ submodule was empty, so I rangit submodule update --init --recursiveto get the headers needed to compile the bridge. (CLAUDE.md describes it as a checked-out reference repo.)swift testfailed withno such module 'XCTest'becausexcode-selectpoints at CommandLineTools. I ran the suite withDEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer swift test(no global change).swift buildworks either way.CLAUDE.md"Coverage status" section untouched — but it now listsImageSequenceReference.1as missing, which is no longer true. Want me to move it into the "Bound" list?One small API-design call I made: the conversion methods are named
frame(for:),targetURL(forImageNumber:), andpresentationTime(forImageNumber:)since there was no existing peer to copy. Easy to rename if you'd prefer something closer to the C++frame_for_time/target_url_for_image_numbernaming.End of Claude's Response
I also used this new implementation to write out a couple of .otio test files containing image sequences. Those imported correctly into: DaVinci Resolve, NukeStudio and RV. I did have some issues with image sequences that have negative frame numbers, but those issues appear to be lack of support for negative frame numbers at the host application level and not my implementation.
Creating this as a Draft PR until we finalize our AI coding policy.
I did create my own CLAUDE.md and SKILLS.md for use with these Swift bindings. I have uploaded them here for reference.
CLAUDE.md
SKILLS.md