Skip to content

Instantly share code, notes, and snippets.

@ElfSundae
Created November 13, 2019 07:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ElfSundae/72ce6dca3c4df46e53928ffbc2c18d66 to your computer and use it in GitHub Desktop.
Save ElfSundae/72ce6dca3c4df46e53928ffbc2c18d66 to your computer and use it in GitHub Desktop.
FourCharCode to String
// https://developer.apple.com/documentation/avfoundation/avassettrack/1386694-formatdescriptions?language=objc
static NSString * FourCCString(FourCharCode code) {
NSString *result = [NSString stringWithFormat:@"%c%c%c%c",
(code >> 24) & 0xff,
(code >> 16) & 0xff,
(code >> 8) & 0xff,
code & 0xff];
NSCharacterSet *characterSet = [NSCharacterSet whitespaceCharacterSet];
return [result stringByTrimmingCharactersInSet:characterSet];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment