avfilter/vf_coreimage: simplify list_filters code

Use fast-enumeration and get rid of unnecessary intermediate variables.
This commit is contained in:
Marvin Scholz 2024-07-12 19:19:37 +02:00
parent 8d674e604c
commit 799503f4bb
1 changed files with 4 additions and 10 deletions

View File

@ -102,19 +102,13 @@ static void list_filters(CoreImageContext *ctx)
filter_categories = [NSArray arrayWithObjects:kCICategoryGenerator, nil]; filter_categories = [NSArray arrayWithObjects:kCICategoryGenerator, nil];
} }
NSArray *filter_names = [CIFilter filterNamesInCategories:filter_categories]; for (NSString *filter_name in [CIFilter filterNamesInCategories:filter_categories]) {
NSEnumerator *filters = [filter_names objectEnumerator];
NSString *filter_name;
while (filter_name = [filters nextObject]) {
av_log(ctx, AV_LOG_INFO, "Filter: %s\n", [filter_name UTF8String]);
NSString *input;
CIFilter *filter = [CIFilter filterWithName:filter_name]; CIFilter *filter = [CIFilter filterWithName:filter_name];
NSDictionary *filter_attribs = [filter attributes]; // <nsstring, id> NSDictionary<NSString *, id> *filter_attribs = [filter attributes];
NSArray *filter_inputs = [filter inputKeys]; // <nsstring>
for (input in filter_inputs) { av_log(ctx, AV_LOG_INFO, "Filter: %s\n", [filter_name UTF8String]);
for (NSString *input in [filter inputKeys]) {
NSDictionary *input_attribs = [filter_attribs valueForKey:input]; NSDictionary *input_attribs = [filter_attribs valueForKey:input];
NSString *input_class = [input_attribs valueForKey:kCIAttributeClass]; NSString *input_class = [input_attribs valueForKey:kCIAttributeClass];
if ([input_class isEqualToString:@"NSNumber"]) { if ([input_class isEqualToString:@"NSNumber"]) {