diff --git a/jpegsnack/src/main/java/org/mipams/jpegsnack/entities/ObjectMetadataBox.java b/jpegsnack/src/main/java/org/mipams/jpegsnack/entities/ObjectMetadataBox.java index a244d82..5271145 100644 --- a/jpegsnack/src/main/java/org/mipams/jpegsnack/entities/ObjectMetadataBox.java +++ b/jpegsnack/src/main/java/org/mipams/jpegsnack/entities/ObjectMetadataBox.java @@ -3,7 +3,6 @@ import java.util.ArrayList; import java.util.List; -import org.mipams.jpegsnack.util.JpegSnackException; import org.mipams.jumbf.entities.BmffBox; import org.mipams.jumbf.util.CoreUtils; import org.mipams.jumbf.util.MipamsException; diff --git a/jpegsnack/src/main/java/org/mipams/jpegsnack/services/boxes/JpegSnackDescriptionBoxService.java b/jpegsnack/src/main/java/org/mipams/jpegsnack/services/boxes/JpegSnackDescriptionBoxService.java index 8faaae0..992c115 100644 --- a/jpegsnack/src/main/java/org/mipams/jpegsnack/services/boxes/JpegSnackDescriptionBoxService.java +++ b/jpegsnack/src/main/java/org/mipams/jpegsnack/services/boxes/JpegSnackDescriptionBoxService.java @@ -107,8 +107,13 @@ protected void writeBmffPayloadToJumbfFile(JpegSnackDescriptionBox jsdb, OutputS } for (Composition composition : jsdb.getCompositions()) { - if (noOfCompositionExists) { - CoreUtils.writeIntAsSingleByteToOutputStream(composition.getId(), os); + if (composition.getId() != null) { + if (noOfCompositionExists) { + CoreUtils.writeIntAsSingleByteToOutputStream(composition.getId(), os); + } else { + throw new JpegSnackException( + "The composition id value shall be absent when the number of compositions field is not present"); + } } CoreUtils.writeIntAsSingleByteToOutputStream(composition.getNoOfObjects(), os); if (composition.getNoOfObjects() != composition.getObjectIds().size()) { diff --git a/jpegsnack/src/main/java/org/mipams/jpegsnack/services/boxes/ObjectMetadataBoxService.java b/jpegsnack/src/main/java/org/mipams/jpegsnack/services/boxes/ObjectMetadataBoxService.java index 47936a5..0ff5d3a 100644 --- a/jpegsnack/src/main/java/org/mipams/jpegsnack/services/boxes/ObjectMetadataBoxService.java +++ b/jpegsnack/src/main/java/org/mipams/jpegsnack/services/boxes/ObjectMetadataBoxService.java @@ -2,7 +2,6 @@ import java.io.InputStream; import java.io.OutputStream; -import java.nio.ByteBuffer; import org.mipams.jpegsnack.entities.ObjectMetadataBox; import org.mipams.jumbf.entities.ParseMetadata;