Add ambient viewing enviroment atom.
This commit is contained in:
5 files changed
+48
-1
No files matched your search
@@ -296,6 +296,20 @@ MP42_OBJC_DIRECT_MEMBERS
|
|||||||
videoTrack.coll = coll;
|
videoTrack.coll = coll;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (@available(macOS 12.0, *)) {
|
||||||
|
CFDataRef ambientExtension = CMFormatDescriptionGetExtension(formatDescription, kCMFormatDescriptionExtension_AmbientViewingEnvironment);
|
||||||
|
if (ambientExtension && CFDataGetLength(ambientExtension) >= 8) {
|
||||||
|
MP42AmbientViewingEnviroment *ambientPayload = (MP42AmbientViewingEnviroment *)CFDataGetBytePtr(ambientExtension);
|
||||||
|
MP42AmbientViewingEnviroment ambient;
|
||||||
|
|
||||||
|
ambient.ambient_illuminance = CFSwapInt32BigToHost(ambientPayload->ambient_illuminance);
|
||||||
|
ambient.ambient_light_x = CFSwapInt16BigToHost(ambientPayload->ambient_light_x);
|
||||||
|
ambient.ambient_light_y = CFSwapInt16BigToHost(ambientPayload->ambient_light_y);
|
||||||
|
|
||||||
|
videoTrack.ambient = ambient;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CFDictionaryRef extentions = CMFormatDescriptionGetExtensions(formatDescription);
|
CFDictionaryRef extentions = CMFormatDescriptionGetExtensions(formatDescription);
|
||||||
CFDictionaryRef atoms = CFDictionaryGetValue(extentions, kCMFormatDescriptionExtension_SampleDescriptionExtensionAtoms);
|
CFDictionaryRef atoms = CFDictionaryGetValue(extentions, kCMFormatDescriptionExtension_SampleDescriptionExtensionAtoms);
|
||||||
if (atoms) {
|
if (atoms) {
|
||||||
|
|||||||
@@ -25,6 +25,13 @@ typedef struct MP42ContentLightMetadata {
|
|||||||
uint32_t MaxFALL;
|
uint32_t MaxFALL;
|
||||||
} MP42ContentLightMetadata;
|
} MP42ContentLightMetadata;
|
||||||
|
|
||||||
|
typedef struct MP42AmbientViewingEnviroment {
|
||||||
|
uint32_t ambient_illuminance;
|
||||||
|
uint16_t ambient_light_x;
|
||||||
|
uint16_t ambient_light_y;
|
||||||
|
} MP42AmbientViewingEnviroment;
|
||||||
|
|
||||||
|
|
||||||
// matches payload of ISO/IEC 23008-2:2015(E), D.2.28 Mastering display colour volume SEI message
|
// matches payload of ISO/IEC 23008-2:2015(E), D.2.28 Mastering display colour volume SEI message
|
||||||
typedef struct MP42MasteringDisplayMetadataPayload {
|
typedef struct MP42MasteringDisplayMetadataPayload {
|
||||||
uint16_t display_primaries_gx;
|
uint16_t display_primaries_gx;
|
||||||
@@ -46,4 +53,5 @@ typedef struct MP42ContentLightMetadataPayload {
|
|||||||
uint16_t MaxFALL;
|
uint16_t MaxFALL;
|
||||||
} MP42ContentLightMetadataPayload;
|
} MP42ContentLightMetadataPayload;
|
||||||
|
|
||||||
|
|
||||||
#endif /* MP42MasteringDisplayMetadata_h */
|
#endif /* MP42MasteringDisplayMetadata_h */
|
||||||
@@ -35,6 +35,9 @@
|
|||||||
@property(nonatomic, readwrite) MP42DolbyVisionMetadata dolbyVision;
|
@property(nonatomic, readwrite) MP42DolbyVisionMetadata dolbyVision;
|
||||||
@property(nonatomic, readwrite) NSData *dolbyVisionELConfiguration;
|
@property(nonatomic, readwrite) NSData *dolbyVisionELConfiguration;
|
||||||
|
|
||||||
|
// Ambient viewning enviroment
|
||||||
|
@property(nonatomic, readwrite) MP42AmbientViewingEnviroment ambient;
|
||||||
|
|
||||||
// Pixel Aspect Ratio
|
// Pixel Aspect Ratio
|
||||||
@property(nonatomic, readwrite) uint64_t hSpacing;
|
@property(nonatomic, readwrite) uint64_t hSpacing;
|
||||||
@property(nonatomic, readwrite) uint64_t vSpacing;
|
@property(nonatomic, readwrite) uint64_t vSpacing;
|
||||||
|
|||||||
@@ -136,6 +136,18 @@ MP42_OBJC_DIRECT_MEMBERS
|
|||||||
_mastering.has_luminance = 1;
|
_mastering.has_luminance = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (MP4HaveTrackAtom(fileHandle, self.trackId, "mdia.minf.stbl.stsd.*.amve")) {
|
||||||
|
uint64_t ambientIlluminance, ambientLightX, ambientLightY;
|
||||||
|
|
||||||
|
MP4GetTrackIntegerProperty(fileHandle, self.trackId, "mdia.minf.stbl.stsd.*.amve.ambientIlluminance", &ambientIlluminance);
|
||||||
|
MP4GetTrackIntegerProperty(fileHandle, self.trackId, "mdia.minf.stbl.stsd.*.amve.ambientLightX", &ambientLightX);
|
||||||
|
MP4GetTrackIntegerProperty(fileHandle, self.trackId, "mdia.minf.stbl.stsd.*.amve.ambientLightY", &ambientLightY);
|
||||||
|
|
||||||
|
_ambient.ambient_illuminance = (uint32_t)ambientIlluminance;
|
||||||
|
_ambient.ambient_light_x = ambientLightX;
|
||||||
|
_ambient.ambient_light_y = ambientLightY;
|
||||||
|
}
|
||||||
|
|
||||||
if (MP4HaveTrackAtom(fileHandle, self.trackId, "mdia.minf.stbl.stsd.*.dvcC")) {
|
if (MP4HaveTrackAtom(fileHandle, self.trackId, "mdia.minf.stbl.stsd.*.dvcC")) {
|
||||||
uint64_t versionMajor, versionMinor, profile, level, rpuPresentFlag, elPresentFlag, blPresentFlag, blSignalCompatibilityId;
|
uint64_t versionMajor, versionMinor, profile, level, rpuPresentFlag, elPresentFlag, blPresentFlag, blSignalCompatibilityId;
|
||||||
|
|
||||||
@@ -353,6 +365,16 @@ static uint32_t convertToFixedPoint(CGFloat value) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (self.updatedProperty[@"amve"] || self.muxed == NO) {
|
||||||
|
if (self.ambient.ambient_illuminance && self.ambient.ambient_light_x && self.ambient.ambient_light_y) {
|
||||||
|
MP4SetAmbientViewingEnviroment(fileHandle, self.trackId,
|
||||||
|
_ambient.ambient_illuminance, _ambient.ambient_light_x, _ambient.ambient_light_y);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
MP4SetAmbientViewingEnviroment(fileHandle, self.trackId, 0, 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (self.updatedProperty[@"hSpacing"] || self.updatedProperty[@"vSpacing"] || self.muxed == NO) {
|
if (self.updatedProperty[@"hSpacing"] || self.updatedProperty[@"vSpacing"] || self.muxed == NO) {
|
||||||
if (_hSpacing >= 1 && _vSpacing >= 1) {
|
if (_hSpacing >= 1 && _vSpacing >= 1) {
|
||||||
if (MP4HaveTrackAtom(fileHandle, self.trackId, "mdia.minf.stbl.stsd.*.pasp")) {
|
if (MP4HaveTrackAtom(fileHandle, self.trackId, "mdia.minf.stbl.stsd.*.pasp")) {
|
||||||
|
|||||||
+1
-1
Submodule contrib updated: ba43df668d...9df6671729.
Reference in new issue
Block a user