2014 snapchat source code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.1 KiB

  1. //
  2. // SCProcessingPipeline.m
  3. // Snapchat
  4. //
  5. // Created by Yu-Kuan (Anthony) Lai on 5/30/17.
  6. // Copyright © 2017 Snapchat, Inc. All rights reserved.
  7. //
  8. #import "SCProcessingPipeline.h"
  9. #import <SCFoundation/NSString+Helpers.h>
  10. @import CoreMedia;
  11. @implementation SCProcessingPipeline
  12. - (CMSampleBufferRef)render:(RenderData)renderData
  13. {
  14. for (id<SCProcessingModule> module in self.processingModules) {
  15. if (![module requiresDepthData] || ([module requiresDepthData] && renderData.depthDataMap)) {
  16. renderData.sampleBuffer = [module render:renderData];
  17. }
  18. }
  19. return renderData.sampleBuffer;
  20. }
  21. - (NSString *)description
  22. {
  23. NSMutableString *desc = [NSMutableString new];
  24. [desc appendString:@"ProcessingPipeline, modules: "];
  25. for (id<SCProcessingModule> module in self.processingModules) {
  26. [desc appendFormat:@"%@, ", [module description]];
  27. }
  28. if (self.processingModules.count > 0) {
  29. return [desc substringToIndex:desc.lengthOfCharacterSequences - 2];
  30. }
  31. return desc;
  32. }
  33. - (BOOL)requiresDepthData
  34. {
  35. return NO;
  36. }
  37. @end