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.

221 lines
6.4 KiB

  1. // 42f6113daff3eebf06d809a073c99651867c42ea
  2. // Generated by the value-object.rb DO NOT EDIT!!
  3. #import "SCManagedVideoCapturerOutputSettings.h"
  4. #import <SCFoundation/SCValueObjectHelpers.h>
  5. #import <FastCoding/FastCoder.h>
  6. @implementation SCManagedVideoCapturerOutputSettings
  7. static ptrdiff_t sSCManagedVideoCapturerOutputSettingsOffsets[0];
  8. static BOOL sSCManagedVideoCapturerOutputSettingsHasOffsets;
  9. - (instancetype)initWithWidth:(CGFloat)width
  10. height:(CGFloat)height
  11. videoBitRate:(CGFloat)videoBitRate
  12. audioBitRate:(CGFloat)audioBitRate
  13. keyFrameInterval:(NSUInteger)keyFrameInterval
  14. outputType:(SCManagedVideoCapturerOutputType)outputType
  15. {
  16. self = [super init];
  17. if (self) {
  18. _width = width;
  19. _height = height;
  20. _videoBitRate = videoBitRate;
  21. _audioBitRate = audioBitRate;
  22. _keyFrameInterval = keyFrameInterval;
  23. _outputType = outputType;
  24. }
  25. return self;
  26. }
  27. #pragma mark - NSCopying
  28. - (instancetype)copyWithZone:(NSZone *)zone
  29. {
  30. // Immutable object, bypass copy
  31. return self;
  32. }
  33. #pragma mark - NSCoding
  34. - (instancetype)initWithCoder:(NSCoder *)aDecoder
  35. {
  36. self = [super init];
  37. if (self) {
  38. _width = [aDecoder decodeFloatForKey:@"width"];
  39. _height = [aDecoder decodeFloatForKey:@"height"];
  40. _videoBitRate = [aDecoder decodeFloatForKey:@"videoBitRate"];
  41. _audioBitRate = [aDecoder decodeFloatForKey:@"audioBitRate"];
  42. _keyFrameInterval = [[aDecoder decodeObjectForKey:@"keyFrameInterval"] unsignedIntegerValue];
  43. _outputType = (SCManagedVideoCapturerOutputType)[aDecoder decodeIntegerForKey:@"outputType"];
  44. }
  45. return self;
  46. }
  47. - (void)encodeWithCoder:(NSCoder *)aCoder
  48. {
  49. [aCoder encodeFloat:_width forKey:@"width"];
  50. [aCoder encodeFloat:_height forKey:@"height"];
  51. [aCoder encodeFloat:_videoBitRate forKey:@"videoBitRate"];
  52. [aCoder encodeFloat:_audioBitRate forKey:@"audioBitRate"];
  53. [aCoder encodeObject:@(_keyFrameInterval) forKey:@"keyFrameInterval"];
  54. [aCoder encodeInteger:(NSInteger)_outputType forKey:@"outputType"];
  55. }
  56. #pragma mark - FasterCoding
  57. - (BOOL)preferFasterCoding
  58. {
  59. return YES;
  60. }
  61. - (void)encodeWithFasterCoder:(id<FCFasterCoder>)fasterCoder
  62. {
  63. [fasterCoder encodeFloat64:_audioBitRate];
  64. [fasterCoder encodeFloat64:_height];
  65. [fasterCoder encodeUInt64:_keyFrameInterval];
  66. [fasterCoder encodeSInt32:_outputType];
  67. [fasterCoder encodeFloat64:_videoBitRate];
  68. [fasterCoder encodeFloat64:_width];
  69. }
  70. - (void)decodeWithFasterDecoder:(id<FCFasterDecoder>)fasterDecoder
  71. {
  72. _audioBitRate = (CGFloat)[fasterDecoder decodeFloat64];
  73. _height = (CGFloat)[fasterDecoder decodeFloat64];
  74. _keyFrameInterval = (NSUInteger)[fasterDecoder decodeUInt64];
  75. _outputType = (SCManagedVideoCapturerOutputType)[fasterDecoder decodeSInt32];
  76. _videoBitRate = (CGFloat)[fasterDecoder decodeFloat64];
  77. _width = (CGFloat)[fasterDecoder decodeFloat64];
  78. }
  79. - (void)setSInt32:(int32_t)val forUInt64Key:(uint64_t)key
  80. {
  81. switch (key) {
  82. case 54425104364133881ULL:
  83. _outputType = (SCManagedVideoCapturerOutputType)val;
  84. break;
  85. }
  86. }
  87. - (void)setUInt64:(uint64_t)val forUInt64Key:(uint64_t)key
  88. {
  89. switch (key) {
  90. case 47327990652274883ULL:
  91. _keyFrameInterval = (NSUInteger)val;
  92. break;
  93. }
  94. }
  95. - (void)setFloat64:(double)val forUInt64Key:(uint64_t)key
  96. {
  97. switch (key) {
  98. case 50995534680662654ULL:
  99. _audioBitRate = (CGFloat)val;
  100. break;
  101. case 11656660716170763ULL:
  102. _height = (CGFloat)val;
  103. break;
  104. case 29034524155663716ULL:
  105. _videoBitRate = (CGFloat)val;
  106. break;
  107. case 30689178641753681ULL:
  108. _width = (CGFloat)val;
  109. break;
  110. }
  111. }
  112. + (uint64_t)fasterCodingVersion
  113. {
  114. return 14709152111692666517ULL;
  115. }
  116. + (uint64_t *)fasterCodingKeys
  117. {
  118. static uint64_t keys[] = {
  119. 6 /* Total */,
  120. FC_ENCODE_KEY_TYPE(50995534680662654, FCEncodeTypeFloat64),
  121. FC_ENCODE_KEY_TYPE(11656660716170763, FCEncodeTypeFloat64),
  122. FC_ENCODE_KEY_TYPE(47327990652274883, FCEncodeTypeUInt64),
  123. FC_ENCODE_KEY_TYPE(54425104364133881, FCEncodeTypeSInt32),
  124. FC_ENCODE_KEY_TYPE(29034524155663716, FCEncodeTypeFloat64),
  125. FC_ENCODE_KEY_TYPE(30689178641753681, FCEncodeTypeFloat64),
  126. };
  127. return keys;
  128. }
  129. #pragma mark - isEqual
  130. - (BOOL)isEqual:(id)object
  131. {
  132. if (!SCObjectsIsEqual(self, object, &sSCManagedVideoCapturerOutputSettingsHasOffsets,
  133. sSCManagedVideoCapturerOutputSettingsOffsets, 6, 0)) {
  134. return NO;
  135. }
  136. SCManagedVideoCapturerOutputSettings *other = (SCManagedVideoCapturerOutputSettings *)object;
  137. if (other->_width != _width) {
  138. return NO;
  139. }
  140. if (other->_height != _height) {
  141. return NO;
  142. }
  143. if (other->_videoBitRate != _videoBitRate) {
  144. return NO;
  145. }
  146. if (other->_audioBitRate != _audioBitRate) {
  147. return NO;
  148. }
  149. if (other->_keyFrameInterval != _keyFrameInterval) {
  150. return NO;
  151. }
  152. if (other->_outputType != _outputType) {
  153. return NO;
  154. }
  155. return YES;
  156. }
  157. - (NSUInteger)hash
  158. {
  159. NSUInteger subhashes[] = {(NSUInteger)_width, (NSUInteger)_height, (NSUInteger)_videoBitRate,
  160. (NSUInteger)_audioBitRate, (NSUInteger)_keyFrameInterval, (NSUInteger)_outputType};
  161. NSUInteger result = subhashes[0];
  162. for (int i = 1; i < 6; i++) {
  163. unsigned long long base = (((unsigned long long)result) << 32 | subhashes[i]);
  164. base = (~base) + (base << 18);
  165. base ^= (base >> 31);
  166. base *= 21;
  167. base ^= (base >> 11);
  168. base += (base << 6);
  169. base ^= (base >> 22);
  170. result = (NSUInteger)base;
  171. }
  172. return result;
  173. }
  174. #pragma mark - Print description in console: lldb> po #{variable name}
  175. - (NSString *)description
  176. {
  177. NSMutableString *desc = [NSMutableString string];
  178. [desc appendString:@"{\n"];
  179. [desc appendFormat:@"\twidth:%@\n", [@(_width) description]];
  180. [desc appendFormat:@"\theight:%@\n", [@(_height) description]];
  181. [desc appendFormat:@"\tvideoBitRate:%@\n", [@(_videoBitRate) description]];
  182. [desc appendFormat:@"\taudioBitRate:%@\n", [@(_audioBitRate) description]];
  183. [desc appendFormat:@"\tkeyFrameInterval:%@\n", [@(_keyFrameInterval) description]];
  184. [desc appendFormat:@"\toutputType:%@\n", [@(_outputType) description]];
  185. [desc appendString:@"}\n"];
  186. return [desc copy];
  187. }
  188. @end