Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add wrapper for clip_if() and children_if() #27

Merged
merged 51 commits into from
Apr 5, 2022

Conversation

jradha11
Copy link
Contributor

No description provided.

@jradha11 jradha11 changed the title [WIP] Add wrapper for clip_if() and children_if [WIP] Add wrapper for clip_if() and children_if() Aug 11, 2021
src/test/java/io/opentimeline/TimelineTest.java Outdated Show resolved Hide resolved
src/test/java/io/opentimeline/TimelineTest.java Outdated Show resolved Hide resolved
src/test/java/io/opentimeline/TimelineTest.java Outdated Show resolved Hide resolved
src/test/java/io/opentimeline/TimelineTest.java Outdated Show resolved Hide resolved
@KarthikRIyer
Copy link
Contributor

@jradha11 This looks good. You might have missed a few Composable types like Stack. Could you please check if you've covered all of them?

Also, I would add a check in the tests for the size equality of the reference and result Lists.

@jradha11
Copy link
Contributor Author

@KarthikRIyer
Nice point about the test. I will check for length too in the equality cases.
Also, I will be adding the remaining composable types - Item, Composition, Transition, and Stack.

@KarthikRIyer
Copy link
Contributor

Looks good!

Copy link
Member

@reinecke reinecke left a comment

Choose a reason for hiding this comment

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

Looking good! I had a few notes to help code readability and maintainability, but nothing major. Glad to have someone keeping the API up to date!

src/main/cpp/io_opentimeline_opentimelineio_Timeline.cpp Outdated Show resolved Hide resolved
src/main/cpp/io_opentimeline_opentimelineio_Timeline.cpp Outdated Show resolved Hide resolved
src/main/cpp/io_opentimeline_opentimelineio_Timeline.cpp Outdated Show resolved Hide resolved
@reinecke reinecke added the API Exposure Tasks to add bindings for C++ features not exposed yet label Aug 23, 2021
@KarthikRIyer
Copy link
Contributor

Could you also remove this plugin from the build.gradle file? We do not publish to bintray.

dependencies {
        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.+'
    }

@KarthikRIyer
Copy link
Contributor

Looks good.
Tiny suggestion:

JNIEXPORT jobjectArray JNICALL Java_io_opentimeline_opentimelineio_SerializableCollection_clipIfNative
        (JNIEnv *env, jobject thisObj, jobject searchRangeTimeRange, jboolean shallowSearch)

I would rename searchRangeTimeRange to searchRangeTimeRangeOptional everywhere, including the utility function. It'll be very clear that the value is an optional and cannot be used directly as a timerange.

@jradha11
Copy link
Contributor Author

will do the change

@reinecke
Copy link
Member

reinecke commented Feb 2, 2022

I think we're pretty much there! One question, I saw tests for:

// Make sure we find expected clips within range
track.childrenIf(Composable.class, Optional.of(search_range), false);

and:

// Make sure null throws NullPointerException
track.childrenIf(Composable.class, null, false);

But I think we were missing:

// Make sure full time range is traversed
track.childrenIf(Composable.class, Optional.empty(), false);

@jradha11
Copy link
Contributor Author

jradha11 commented Feb 3, 2022

oh yes! I must have missed this edge case. Will add them too!

@jradha11
Copy link
Contributor Author

Hey @reinecke @KarthikRIyer ,
I have updated tests with the trimmed and full-time range. But, I was not able to do the same for SerialisableCollectionTest. I am not getting how to filter it. Could you please review and help me out here?

@reinecke
Copy link
Member

Oh wow, good catch. I just checked the python implementation and it doesn't seem to have a test for this case.
Looking at the implementation, I think it is designed to:

  1. ignore search range for direct children
  2. apply search range for child compositions if shallow_search is false

So, with shallow_search as true, I think search_range has no impact on the results of children_if for SerializableCollection. With shallow_search set false, I think it returns all the children of the SerializableCollection and uses type-based behavior for the children it recurses into.

Does that make sense?

Since this test is for language bindings, I don't think it needs to be too rigorous around the behavior of c++ implementation, we just want our testing to verify all the parameters are being passed into the underlying implementation correctly.

@jradha11
Copy link
Contributor Author

jradha11 commented Mar 8, 2022

@reinecke
Does that mean we cannot filter using time range in this case?

@KarthikRIyer
Copy link
Contributor

@jradha11 I think what @reinecke means is that if shallow_search = true, search_range is ignored.

If shallow_search = false, it will take search_range into consideration only for Compositions (like Track) inside the SerializableCollection. Track organises objects temporally (one after another). So I think a search_range for it makes sense. Since a Stack organise objects spatially (one over another), but it can contain tracks, search_range makes sense for it too. But a SerializableCollection is just a collection with no specific rules. So unless it has other compositions, a search_range doesn't mean anything.

So you could create a Track with 4 clips, add it to your SerializableCollection and check if clipIf works.

@reinecke please correct me if I'm wrong.

@jradha11
Copy link
Contributor Author

@KarthikRIyer @reinecke I have made the changes. I'd love if you could review! :)

@reinecke
Copy link
Member

reinecke commented Apr 5, 2022

Looks Good! Thanks for seeing this through!

@reinecke reinecke merged commit d9928a2 into OpenTimelineIO:main Apr 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Exposure Tasks to add bindings for C++ features not exposed yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrap each_child/children_if & each_clip/clip_if instead of reimplementing
3 participants