Skip to content

Conversation

@mikemahony
Copy link
Contributor

Fixes #65

Exposes the Timeline's find_clips method. This pass exposes the method without the optional search_range and shallow_search parameters - a future PR could expose those params.

Request includes a new test testTimelineClipAvailableBounds and refactors the existing two tests in the suite to keep the code D.R.Y. The otio file used in the new test came from the OpenTimelineIO test sample data here.

@mikemahony mikemahony force-pushed the expose_timeline_find_clips branch from e406a47 to 724191a Compare April 30, 2025 23:44
}

NSArray* timeline_find_clips(CxxRetainer* self, CxxErrorStruct* cxxErr) {
auto array = [NSMutableArray new];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR!

I have a naive q - apologies if this is obvious! WRT to memory management, is there a possible leak with the Clips returned from SO_cast<otio::Timeline>(self)->find_clips(&aeh.error_status)) via NSValue?

Are the Clip objects life time managed by the SO_cast correctly via NSValue when vended to Swift in the findClips()?

I see the pointer values survive through to swift, via result.append(SerializableObject.findOrCreate(cxxPtr: cxxPtr) as! Clip) - are they cleaned up by the dynamic cast within the SO_cast?

var result = [Clip]()
for child in children_array {
if let nsptr = child as? NSValue, let cxxPtr = nsptr.pointerValue {
result.append(SerializableObject.findOrCreate(cxxPtr: cxxPtr) as! Clip)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May I suggest a

if let clip = SerializableObject.findOrCreate(cxxPtr: cxxPtr) as? Clip to avoid a exception / crash on a bad cast?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose find_clips

2 participants