gpt4 book ai didi

ios - 我可以在 iphone 12 上获得 PHAsset/PHAsset is hdr video/dolby vision 吗?

转载 作者:行者123 更新时间:2023-12-04 15:14:53 25 4
gpt4 key购买 nike

我想添加 HDR 图标以指示某些 Assets 是 HDR,但如果这是来自 iphone12 的 HDR 视频记​​录,我无法获取任何信息来检查视频

最佳答案

+ (BOOL)isHDRVideo:(AVAsset *)avasset {
if (!avasset) {
return NO;
}
__block BOOL isHDRVideo = NO;
[avasset.tracks enumerateObjectsUsingBlock:^(AVAssetTrack * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stopTracks) {
[obj.formatDescriptions enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stopFormatDescriptions) {
CMFormatDescriptionRef desc = (__bridge CMVideoFormatDescriptionRef)obj;
NSDictionary *dic = (__bridge NSDictionary *)CMFormatDescriptionGetExtensions(desc);
NSString *imageBufferColorPrimaries = dic[(__bridge id)kCVImageBufferColorPrimariesKey];
if ([imageBufferColorPrimaries isEqualToString:(__bridge id)kCVImageBufferColorPrimaries_ITU_R_2020]) {
*stopFormatDescriptions = YES;
*stopTracks = YES;
isHDRVideo = YES;
}
}];
}];

return isHDRVideo;
}

关于ios - 我可以在 iphone 12 上获得 PHAsset/PHAsset is hdr video/dolby vision 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64510556/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com