Skip to content

Commit

Permalink
Merge pull request #13 from nickft/10-jpeg-snack-the-composition-id-n…
Browse files Browse the repository at this point in the history
…o-of-composition-check-is-not-included-in-the-jpeg-snack-description-box

Add exception during creation of Snack files
  • Loading branch information
nickft authored Jan 8, 2024
2 parents fca60e3 + 2f30c44 commit e7a8b49
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit e7a8b49

Please sign in to comment.