Skip to content

Commit

Permalink
Merge pull request #113 from Netflix/feature/AudioChannelSubDescripto…
Browse files Browse the repository at this point in the history
…rMap

Modifications for AudioChannelSubDescriptorMap
  • Loading branch information
svenkatrav authored Sep 13, 2016
2 parents 0d9706c + ee96b3a commit 7cc2e69
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/netflix/imflibrary/IMFConstraints.java
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ public static HeaderPartitionIMF checkIMFCompliance(MXFOperationalPattern1A.Head
}
else {
//Section 5.3.6.2 st2067-2:2016
Map<Long, AudioChannelLabelSubDescriptor.AudioChannelLabelSubDescriptorBO> audioChannelLabelSubDescriptorMap = headerPartition.getAudioChannelIDToMCASubDescriptorMap();
Map<Long, AudioChannelLabelSubDescriptor> audioChannelLabelSubDescriptorMap = headerPartition.getAudioChannelIDToMCASubDescriptorMap();
if (waveAudioEssenceDescriptor.getChannelCount() != audioChannelLabelSubDescriptorMap.size()) {
imfErrorLogger.addError(IMFErrorLogger.IMFErrors.ErrorCodes.IMF_ESSENCE_COMPONENT_ERROR, IMFErrorLogger.IMFErrors.ErrorLevels.NON_FATAL, IMFConstraints.IMF_ESSENCE_EXCEPTION_PREFIX +
String.format("WaveAudioEssenceDescriptor indicates a channel count of %d, however there are %d AudioChannelLabelSubdescriptors, every audio channel should refer to exactly one AudioChannelLabelSubDescriptor and vice versa.", waveAudioEssenceDescriptor.getChannelCount(), audioChannelLabelSubDescriptorMap.size()));
Expand Down
11 changes: 5 additions & 6 deletions src/main/java/com/netflix/imflibrary/st0377/HeaderPartition.java
Original file line number Diff line number Diff line change
Expand Up @@ -669,14 +669,13 @@ public String getAudioEssenceSpokenLanguage() throws IOException {
* @return Channel ID to AudioChannelLabelSubDescriptor mapping
*/
@Nullable
public Map<Long, AudioChannelLabelSubDescriptor.AudioChannelLabelSubDescriptorBO> getAudioChannelIDToMCASubDescriptorMap() {
List<InterchangeObject.InterchangeObjectBO> subDescriptors = getSubDescriptors();
public Map<Long, AudioChannelLabelSubDescriptor> getAudioChannelIDToMCASubDescriptorMap() {
List<InterchangeObject> subDescriptors = getAudioChannelLabelSubDescriptors();

Map<Long, AudioChannelLabelSubDescriptor.AudioChannelLabelSubDescriptorBO> audioChannelLabelSubDescriptorMap = new HashMap<>();
Map<Long, AudioChannelLabelSubDescriptor> audioChannelLabelSubDescriptorMap = new HashMap<>();
subDescriptors.stream()
.filter(e -> e.getClass().getEnclosingClass().equals(AudioChannelLabelSubDescriptor.class))
.map(e -> AudioChannelLabelSubDescriptor.AudioChannelLabelSubDescriptorBO.class.cast(e))
.forEach(e -> audioChannelLabelSubDescriptorMap.put(e.getMCAChannelID() == null? 1 : e.getMCAChannelID(), e));
.map(e -> AudioChannelLabelSubDescriptor.class.cast(e))
.forEach(e -> audioChannelLabelSubDescriptorMap.put(e.getMCAChannelId() == null? 1 : e.getMCAChannelId(), e));
return audioChannelLabelSubDescriptorMap;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@ public MXFUID getMCALinkId()
return new MXFUID(this.audioChannelLabelSubDescriptorBO.mca_link_id);
}

/**
* Getter for the MCAChannelId field of an AudioChannelLabelSubDescriptor object.
* @return MCAChannelId of the AudioChannelLabelSubDescriptor object
*/

public Long getMCAChannelId()
{
return this.audioChannelLabelSubDescriptorBO.getMCAChannelID();
}

/**
* A method that returns a string representation of an AudioChannelLabelSubDescriptor object.
*
Expand Down

0 comments on commit 7cc2e69

Please sign in to comment.