From 12fa94b806338faf924dabfcc71517957c1db2e6 Mon Sep 17 00:00:00 2001 From: IMFTool Date: Mon, 20 Mar 2023 22:16:23 +0100 Subject: [PATCH 1/3] Adding IMSC 1.1 profile designators --- src/main/java/com/netflix/imflibrary/IMFConstraints.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/netflix/imflibrary/IMFConstraints.java b/src/main/java/com/netflix/imflibrary/IMFConstraints.java index 493ad00a..d27ad56d 100644 --- a/src/main/java/com/netflix/imflibrary/IMFConstraints.java +++ b/src/main/java/com/netflix/imflibrary/IMFConstraints.java @@ -50,6 +50,9 @@ public final class IMFConstraints private static final byte[] IMF_CHANNEL_ASSIGNMENT_UL = {0x06, 0x0e, 0x2b, 0x34, 0x04, 0x01, 0x01, 0x0d, 0x04, 0x02, 0x02, 0x10, 0x04, 0x01, 0x00, 0x00}; public static final String IMSC1TextProfileDesignator = "http://www.w3.org/ns/ttml/profile/imsc1/text"; public static final String IMSC1ImageProfileDesignator = "http://www.w3.org/ns/ttml/profile/imsc1/image"; + // Timed Text profile designators per SMPTE ST 2067-2:2020, section 5.4.2 + private static final String[] IMSC1TextProfileDesignators2020 = {IMSC1TextProfileDesignator, "http://www.w3.org/ns/ttml/profile/imsc1.1/text", "urn:ebu:tt:distribution:2014-01", "urn:ebu:tt:distribution:2018-04", "http://www.w3.org/ns/ttml/profile/sdp-us", "https://www.netflix.com/ns/imsc1.1/text/1"}; + private static final String[] IMSC1ImageProfileDesignators2020 = {IMSC1ImageProfileDesignator, "http://www.w3.org/ns/ttml/profile/imsc1.1/image"}; public static final String IMSC1ImageResourceMimeMediaType = "image/png"; public static final String IMSC1FontResourceMimeMediaType = "application/x-font-opentype"; //to prevent instantiation @@ -278,11 +281,11 @@ else if (!audioChannelLabelSubDescriptor.getSoundfieldGroupLinkId() packageID.toString())); } //https://www.w3.org/TR/ttml-imsc1/ Section 6.3 - if (!timedTextDescriptor.getNamespaceURI().equals(IMSC1TextProfileDesignator) && !timedTextDescriptor.getNamespaceURI().equals(IMSC1ImageProfileDesignator)) { + if (!(Arrays.asList(IMSC1TextProfileDesignators2020).contains(timedTextDescriptor.getNamespaceURI()) || Arrays.asList(IMSC1ImageProfileDesignators2020).contains(timedTextDescriptor.getNamespaceURI()))) { imfErrorLogger.addError(IMFErrorLogger.IMFErrors.ErrorCodes.IMF_CORE_CONSTRAINTS_ERROR, IMFErrorLogger.IMFErrors.ErrorLevels.NON_FATAL, IMFConstraints .IMF_ESSENCE_EXCEPTION_PREFIX + String.format("Invalid NamespaceURI(%s) in TimedTextDescriptor within trackFile represented by ID %s. Valid NamespaceURIs: " + "{%s}, {%s}", - timedTextDescriptor.getNamespaceURI(), packageID.toString(), IMSC1TextProfileDesignator, IMSC1ImageProfileDesignator)); + timedTextDescriptor.getNamespaceURI(), packageID.toString(), Arrays.toString(IMSC1TextProfileDesignators2020), Arrays.toString(IMSC1ImageProfileDesignators2020))); } for(TimeTextResourceSubDescriptor textResourceSubDescriptor : timedTextDescriptor.getSubDescriptorList()) { //Section 5.4.5 and 5.4.6 st2067-2:2016 From 900c9727ff1911b30aec61310f5d5fbb6c6be2f1 Mon Sep 17 00:00:00 2001 From: IMFTool Date: Mon, 20 Mar 2023 22:34:16 +0100 Subject: [PATCH 2/3] Adding DataEssence as EssenceType, ST 2067-2:2020 Table 15 Timed Text Sequences are all of DataEssence EssenceType --- .../imflibrary/app/IMFTrackFileReader.java | 1 + .../imflibrary/st0377/HeaderPartition.java | 77 ++++++++----------- 2 files changed, 34 insertions(+), 44 deletions(-) diff --git a/src/main/java/com/netflix/imflibrary/app/IMFTrackFileReader.java b/src/main/java/com/netflix/imflibrary/app/IMFTrackFileReader.java index d614b1e2..b7e54a03 100644 --- a/src/main/java/com/netflix/imflibrary/app/IMFTrackFileReader.java +++ b/src/main/java/com/netflix/imflibrary/app/IMFTrackFileReader.java @@ -491,6 +491,7 @@ HeaderPartition.EssenceTypeEnum getEssenceType(@Nonnull IMFErrorLogger imfErrorL supportedEssenceComponentTypes.add(HeaderPartition.EssenceTypeEnum.MainAudioEssence); supportedEssenceComponentTypes.add(HeaderPartition.EssenceTypeEnum.MarkerEssence); supportedEssenceComponentTypes.add(HeaderPartition.EssenceTypeEnum.IABEssence); + supportedEssenceComponentTypes.add(HeaderPartition.EssenceTypeEnum.DataEssence); List supportedEssenceTypesFound = new ArrayList<>(); List essenceTypes = this.getHeaderPartitionIMF(imfErrorLogger).getHeaderPartitionOP1A().getHeaderPartition().getEssenceTypes(); diff --git a/src/main/java/com/netflix/imflibrary/st0377/HeaderPartition.java b/src/main/java/com/netflix/imflibrary/st0377/HeaderPartition.java index 70f9d25e..16b24f36 100644 --- a/src/main/java/com/netflix/imflibrary/st0377/HeaderPartition.java +++ b/src/main/java/com/netflix/imflibrary/st0377/HeaderPartition.java @@ -1318,7 +1318,7 @@ else if(interchangeObjectBO.getClass().getEnclosingClass().equals(RGBAPictureEss essenceTypes.add(EssenceTypeEnum.MainImageEssence); } else if(interchangeObjectBO.getClass().getEnclosingClass().equals(TimedTextDescriptor.class)){ - essenceTypes.add(EssenceTypeEnum.SubtitlesEssence); + essenceTypes.add(EssenceTypeEnum.DataEssence); } } @@ -1336,27 +1336,13 @@ else if(interchangeObjectBO.getClass().getEnclosingClass().equals(TimedTextDescr * An enumeration of all possible essence types that could be contained in a MXF file. */ public enum EssenceTypeEnum { - MarkerEssence(Composition.SequenceTypeEnum.MarkerSequence), - MainImageEssence(Composition.SequenceTypeEnum.MainImageSequence), - MainAudioEssence(Composition.SequenceTypeEnum.MainAudioSequence), - SubtitlesEssence(Composition.SequenceTypeEnum.SubtitlesSequence), - HearingImpairedCaptionsEssence(Composition.SequenceTypeEnum.HearingImpairedCaptionsSequence), - VisuallyImpairedTextEssence(Composition.SequenceTypeEnum.VisuallyImpairedTextSequence), - CommentaryEssence(Composition.SequenceTypeEnum.CommentarySequence), - KaraokeEssence(Composition.SequenceTypeEnum.CommentarySequence), - ForcedNarrativeEssence(Composition.SequenceTypeEnum.ForcedNarrativeSequence), - AncillaryDataEssence(Composition.SequenceTypeEnum.AncillaryDataSequence), - IABEssence(Composition.SequenceTypeEnum.IABSequence), - UnsupportedEssence(Composition.SequenceTypeEnum.UnsupportedSequence); - - private final Composition.SequenceTypeEnum sequenceType; - private final String name; - - private EssenceTypeEnum(Composition.SequenceTypeEnum sequenceType) - { - this.sequenceType = sequenceType; - this.name = getEssenceTypeString(sequenceType); - } + MarkerEssence, + MainImageEssence, + MainAudioEssence, + DataEssence, + IABEssence, + UnsupportedEssence; + private static EssenceTypeEnum getEssenceTypeEnum(String name) { @@ -1368,20 +1354,8 @@ private static EssenceTypeEnum getEssenceTypeEnum(String name) return MainAudioEssence; case "MarkerEssence": return MarkerEssence; - case "SubtitlesEssence": - return SubtitlesEssence; - case "HearingImpairedCaptionsEssence": - return HearingImpairedCaptionsEssence; - case "VisuallyImpairedTextEssence": - return VisuallyImpairedTextEssence; - case "CommentaryEssence": - return CommentaryEssence; - case "KaraokeEssence": - return KaraokeEssence; - case "ForcedNarrativeEssence": - return ForcedNarrativeEssence; - case "AncillaryDataEssence": - return AncillaryDataEssence; + case "DataEssence": + return DataEssence; case "IABEssence": return IABEssence; case "UnsupportedEssence": @@ -1401,19 +1375,19 @@ private static String getEssenceTypeString(Composition.SequenceTypeEnum sequence case MarkerSequence: return "MarkerEssence"; case SubtitlesSequence: - return "SubtitlesEssence"; + return "DataEssence"; case HearingImpairedCaptionsSequence: - return "HearingImpairedCaptionsEssence"; + return "DataEssence"; case VisuallyImpairedTextSequence: - return "VisuallyImpairedTextEssence"; + return "DataEssence"; case CommentarySequence: - return "CommentaryEssence"; + return "DataEssence"; case KaraokeSequence: - return "KaraokeEssence"; + return "DataEssence"; case ForcedNarrativeSequence: - return "ForcedNarrativeEssence"; + return "DataEssence"; case AncillaryDataSequence: - return "AncillaryDataEssence"; + return "DataEssence"; case IABSequence: return "IABEssence"; case UnsupportedSequence: @@ -1423,7 +1397,22 @@ private static String getEssenceTypeString(Composition.SequenceTypeEnum sequence } public String toString(){ - return this.name; + switch (this) + { + case MainImageEssence: + return "MainImageEssence"; + case MainAudioEssence: + return "MainAudioEssence"; + case MarkerEssence: + return "MarkerEssence"; + case DataEssence: + return "DataEssence"; + case IABEssence: + return "IABEssence"; + case UnsupportedEssence: + default: + return "UnsupportedEssence"; + } } } From 11c394121ed6f7126dad9677b98c331e470494f7 Mon Sep 17 00:00:00 2001 From: IMFTool Date: Thu, 24 Oct 2024 19:25:17 +0200 Subject: [PATCH 3/3] roll back essence type changes --- .../imflibrary/st0377/HeaderPartition.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/netflix/imflibrary/st0377/HeaderPartition.java b/src/main/java/com/netflix/imflibrary/st0377/HeaderPartition.java index 4f2c413c..d604c941 100644 --- a/src/main/java/com/netflix/imflibrary/st0377/HeaderPartition.java +++ b/src/main/java/com/netflix/imflibrary/st0377/HeaderPartition.java @@ -1408,19 +1408,19 @@ private static String getEssenceTypeString(Composition.SequenceTypeEnum sequence case MarkerSequence: return "MarkerEssence"; case SubtitlesSequence: - return "DataEssence"; + return "SubtitlesEssence"; case HearingImpairedCaptionsSequence: - return "DataEssence"; + return "HearingImpairedCaptionsEssence"; case VisuallyImpairedTextSequence: - return "DataEssence"; + return "VisuallyImpairedTextEssence"; case CommentarySequence: - return "DataEssence"; + return "CommentaryEssence"; case KaraokeSequence: - return "DataEssence"; + return "KaraokeEssence"; case ForcedNarrativeSequence: - return "DataEssence"; + return "ForcedNarrativeEssence"; case AncillaryDataSequence: - return "DataEssence"; + return "AncillaryDataEssence"; case IABSequence: return "IABEssence"; case MGASADMSignalSequence: @@ -1432,7 +1432,7 @@ private static String getEssenceTypeString(Composition.SequenceTypeEnum sequence } public String toString(){ - return this.name; + return this.name; } }