Flow Plugin - RemoveStreamByProperty: Codec-Type Filtering & Fix for 'not_includes #790
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.
Problem 1:
I have extended the
RemoveStreamByProperty
FlowPlugin to allow specifying the codec type (audio
,video
, orany
).The new default value for the new property is set to
any
so that my change is backwards compatible.Use Case:
In my workflow, I need to ensure that audio streams matching a specific language property are removed before encoding them. Previously, the plugin would also remove video streams if their language matched, which was unintended. This update ensures only the specified codec type is affected.
Problem 2:
I also fixed an issue when using the
not_includes
option.Example Scenario:
Consider the following audio tracks:
en
de
it
Plugin Configuration:
not_includes
tags.language
de, en, ger, eng, und
Expected Result:
it
) should be removed because it does not match any of the specified values.Current (Bugged) Behavior:
Root Cause:
The issue occurs because the code incorrectly iterates over each "value to remove" individually. If a single value does not match the property, the stream is immediately marked for removal, leading to unintended removals.
My Fix:
My fix changes this so that the plugins behave as follows:
includes
→ Remove the stream if the "Property to check" contains ANY of the "values to remove".not_includes
→ Remove the stream if the "Property to check" contains NONE of the "values to remove".Additionally, my fix improves the logging, so that not multiple logs are printed for multiple values and improves the iteration-efficiency a bit as I use the
.some()
method which stops as soon as a match was found.