@Test public void testShowAESAudioMetadata() throws IOException { final AESAudioMetadata aes = new AESAudioMetadata(); aes.setFormat("audio/wav"); JsonObjectBuilder b = this.handler.showAESAudioMetadata(aes); buildJson(b); handler.close(); String result = outString.toString(); LOGGER.info(FIND + result); final String expected = "{\"aes:schemaVersion\":\"1.02b\",\"aes:format\":\"audio/wav\"," + "\"aes:face\":{\"aes:timeline\":{\"tcf:startTime\":{\"tcf:frameCount\":30,\"tcf:timeBase\":1000," + "\"tcf:videoField\":\"FIELD_1\",\"tcf:countingMode\":\"NTSC_NON_DROP_FRAME\",\"tcf:hours\":0," + "\"tcf:minutes\":0,\"tcf:seconds\":0,\"tcf:frames\":0," + "\"tcf:samples\":{\"tcf:sampleRate\":\"S44100\",\"tcf:numberOfSamples\":0}," + "\"tcf:filmFraming\":{\"tcf:framing\":\"NOT_APPLICABLE\",\"tcf:framingType\":\"tcf:ntscFilmFramingType\"}}}," + "\"aes:streams\":[]}}"; assertEquals(expected, result); }
protected JsonObjectBuilder showAESAudioMetadata(AESAudioMetadata aes) { JsonObjectBuilder aesBuilder = Json.createObjectBuilder(); _sampleRate = aes.getSampleRate(); String s = aes.getAnalogDigitalFlag(); if (s != null) { aesBuilder.add("aes:analogDigitalFlag", s); } s = aes.getSchemaVersion(); if (s != null) { aesBuilder.add("aes:schemaVersion", s); } s = aes.getFormat(); if (s != null) { aesBuilder.add("aes:format", s); } s = aes.getSpecificationVersion(); if (s != null) { aesBuilder.add("aes:specificationVersion", s); } s = aes.getAppSpecificData(); if (s != null) { aesBuilder.add("aes:appSpecificData", s); } s = aes.getAudioDataEncoding(); if (s != null) { aesBuilder.add("aes:audioDataEncoding", s); } int in = aes.getByteOrder(); if (in != AESAudioMetadata.NULL) { aesBuilder.add("aes:byteOrder", (in == AESAudioMetadata.BIG_ENDIAN ? "BIG_ENDIAN" : "LITTLE_ENDIAN")); } long lin = aes.getFirstSampleOffset(); if (lin != AESAudioMetadata.NULL) { aesBuilder.add("aes:firstSampleOffset", lin); } String[] use = aes.getUse(); if (use != null) { aesBuilder.add("aes:use", Json.createObjectBuilder().add("aes:useType", use[0]).add("aes:otherType", use[1])); } s = aes.getPrimaryIdentifier(); if (s != null) { String t = aes.getPrimaryIdentifierType(); aesBuilder.add("aes:primaryIdentifier", s); if (t != null) { aesBuilder.add("aes:primaryIdentifierType", t); } } List<AESAudioMetadata.Face> facelist = aes.getFaceList(); if (facelist != null && !facelist.isEmpty()) { AESAudioMetadata.Face f = facelist.get(0); JsonObjectBuilder faceBuilder = Json.createObjectBuilder(); AESAudioMetadata.TimeDesc startTime = f.getStartTime(); if (startTime != null) { faceBuilder.add("aes:timeline", writeAESTimeRange(startTime, f.getDuration())); } int nchan = aes.getNumChannels(); if (nchan != AESAudioMetadata.NULL) { faceBuilder.add("aes:numChannels", nchan); } String[] locs = aes.getMapLocations(); JsonArrayBuilder streamsBuilder = Json.createArrayBuilder(); for (int ch = 0; ch < nchan; ch++) { streamsBuilder .add(Json.createObjectBuilder().add("aes:channelNum", ch).add("aes:mapLocation", locs[ch])); } faceBuilder.add("aes:streams", streamsBuilder); aesBuilder.add("aes:face", faceBuilder); } List<AESAudioMetadata.FormatRegion> flist = aes.getFormatList(); if (flist != null && !flist.isEmpty()) { AESAudioMetadata.FormatRegion rgn = flist.get(0); int bitDepth = rgn.getBitDepth(); double sampleRate = rgn.getSampleRate(); int wordSize = rgn.getWordSize(); String[] bitRed = rgn.getBitrateReduction(); JsonArrayBuilder formatListBuilder = Json.createArrayBuilder(); JsonObjectBuilder formatRegionBuilder = Json.createObjectBuilder(); if (bitDepth != AESAudioMetadata.NULL || sampleRate != AESAudioMetadata.NILL || wordSize != AESAudioMetadata.NULL) { if (bitDepth != AESAudioMetadata.NULL) { formatRegionBuilder.add("aes:bitDepth", bitDepth); } if (sampleRate != AESAudioMetadata.NILL) { formatRegionBuilder.add("aes:sampleRate", sampleRate); } if (wordSize != AESAudioMetadata.NULL) { formatRegionBuilder.add("aes:wordSize", wordSize); } if (bitRed != null) { formatRegionBuilder.add("aes:bitrateReduction", Json.createObjectBuilder() .add("aes:codecName", bitRed[0]).add("aes:codecNameVersion", bitRed[1]) .add("aes:codecCreatorApplication", bitRed[2]) .add("aes:codecCreatorApplicationVersion", bitRed[3]).add("aes:codecQuality", bitRed[4]) .add("aes:dataRate", bitRed[5]).add("aes:dataRateMode", bitRed[6])); } formatListBuilder.add(formatRegionBuilder); aesBuilder.add("aes:formatList", formatListBuilder); } } return aesBuilder; }
JsonHandler extends HandlerBase { protected JsonObjectBuilder showAESAudioMetadata(AESAudioMetadata aes) { JsonObjectBuilder aesBuilder = Json.createObjectBuilder(); _sampleRate = aes.getSampleRate(); String s = aes.getAnalogDigitalFlag(); if (s != null) { aesBuilder.add("aes:analogDigitalFlag", s); } s = aes.getSchemaVersion(); if (s != null) { aesBuilder.add("aes:schemaVersion", s); } s = aes.getFormat(); if (s != null) { aesBuilder.add("aes:format", s); } s = aes.getSpecificationVersion(); if (s != null) { aesBuilder.add("aes:specificationVersion", s); } s = aes.getAppSpecificData(); if (s != null) { aesBuilder.add("aes:appSpecificData", s); } s = aes.getAudioDataEncoding(); if (s != null) { aesBuilder.add("aes:audioDataEncoding", s); } int in = aes.getByteOrder(); if (in != AESAudioMetadata.NULL) { aesBuilder.add("aes:byteOrder", (in == AESAudioMetadata.BIG_ENDIAN ? "BIG_ENDIAN" : "LITTLE_ENDIAN")); } long lin = aes.getFirstSampleOffset(); if (lin != AESAudioMetadata.NULL) { aesBuilder.add("aes:firstSampleOffset", lin); } String[] use = aes.getUse(); if (use != null) { aesBuilder.add("aes:use", Json.createObjectBuilder().add("aes:useType", use[0]).add("aes:otherType", use[1])); } s = aes.getPrimaryIdentifier(); if (s != null) { String t = aes.getPrimaryIdentifierType(); aesBuilder.add("aes:primaryIdentifier", s); if (t != null) { aesBuilder.add("aes:primaryIdentifierType", t); } } List<AESAudioMetadata.Face> facelist = aes.getFaceList(); if (facelist != null && !facelist.isEmpty()) { AESAudioMetadata.Face f = facelist.get(0); JsonObjectBuilder faceBuilder = Json.createObjectBuilder(); AESAudioMetadata.TimeDesc startTime = f.getStartTime(); if (startTime != null) { faceBuilder.add("aes:timeline", writeAESTimeRange(startTime, f.getDuration())); } int nchan = aes.getNumChannels(); if (nchan != AESAudioMetadata.NULL) { faceBuilder.add("aes:numChannels", nchan); } String[] locs = aes.getMapLocations(); JsonArrayBuilder streamsBuilder = Json.createArrayBuilder(); for (int ch = 0; ch < nchan; ch++) { streamsBuilder .add(Json.createObjectBuilder().add("aes:channelNum", ch).add("aes:mapLocation", locs[ch])); } faceBuilder.add("aes:streams", streamsBuilder); aesBuilder.add("aes:face", faceBuilder); } List<AESAudioMetadata.FormatRegion> flist = aes.getFormatList(); if (flist != null && !flist.isEmpty()) { AESAudioMetadata.FormatRegion rgn = flist.get(0); int bitDepth = rgn.getBitDepth(); double sampleRate = rgn.getSampleRate(); int wordSize = rgn.getWordSize(); String[] bitRed = rgn.getBitrateReduction(); JsonArrayBuilder formatListBuilder = Json.createArrayBuilder(); JsonObjectBuilder formatRegionBuilder = Json.createObjectBuilder(); if (bitDepth != AESAudioMetadata.NULL || sampleRate != AESAudioMetadata.NILL || wordSize != AESAudioMetadata.NULL) { if (bitDepth != AESAudioMetadata.NULL) { formatRegionBuilder.add("aes:bitDepth", bitDepth); } if (sampleRate != AESAudioMetadata.NILL) { formatRegionBuilder.add("aes:sampleRate", sampleRate); } if (wordSize != AESAudioMetadata.NULL) { formatRegionBuilder.add("aes:wordSize", wordSize); } if (bitRed != null) { formatRegionBuilder.add("aes:bitrateReduction", Json.createObjectBuilder() .add("aes:codecName", bitRed[0]).add("aes:codecNameVersion", bitRed[1]) .add("aes:codecCreatorApplication", bitRed[2]) .add("aes:codecCreatorApplicationVersion", bitRed[3]).add("aes:codecQuality", bitRed[4]) .add("aes:dataRate", bitRed[5]).add("aes:dataRateMode", bitRed[6])); } formatListBuilder.add(formatRegionBuilder); aesBuilder.add("aes:formatList", formatListBuilder); } } return aesBuilder; } }
JsonHandler extends HandlerBase { protected JsonObjectBuilder showAESAudioMetadata(AESAudioMetadata aes) { JsonObjectBuilder aesBuilder = Json.createObjectBuilder(); _sampleRate = aes.getSampleRate(); String s = aes.getAnalogDigitalFlag(); if (s != null) { aesBuilder.add("aes:analogDigitalFlag", s); } s = aes.getSchemaVersion(); if (s != null) { aesBuilder.add("aes:schemaVersion", s); } s = aes.getFormat(); if (s != null) { aesBuilder.add("aes:format", s); } s = aes.getSpecificationVersion(); if (s != null) { aesBuilder.add("aes:specificationVersion", s); } s = aes.getAppSpecificData(); if (s != null) { aesBuilder.add("aes:appSpecificData", s); } s = aes.getAudioDataEncoding(); if (s != null) { aesBuilder.add("aes:audioDataEncoding", s); } int in = aes.getByteOrder(); if (in != AESAudioMetadata.NULL) { aesBuilder.add("aes:byteOrder", (in == AESAudioMetadata.BIG_ENDIAN ? "BIG_ENDIAN" : "LITTLE_ENDIAN")); } long lin = aes.getFirstSampleOffset(); if (lin != AESAudioMetadata.NULL) { aesBuilder.add("aes:firstSampleOffset", lin); } String[] use = aes.getUse(); if (use != null) { aesBuilder.add("aes:use", Json.createObjectBuilder().add("aes:useType", use[0]).add("aes:otherType", use[1])); } s = aes.getPrimaryIdentifier(); if (s != null) { String t = aes.getPrimaryIdentifierType(); aesBuilder.add("aes:primaryIdentifier", s); if (t != null) { aesBuilder.add("aes:primaryIdentifierType", t); } } List<AESAudioMetadata.Face> facelist = aes.getFaceList(); if (facelist != null && !facelist.isEmpty()) { AESAudioMetadata.Face f = facelist.get(0); JsonObjectBuilder faceBuilder = Json.createObjectBuilder(); AESAudioMetadata.TimeDesc startTime = f.getStartTime(); if (startTime != null) { faceBuilder.add("aes:timeline", writeAESTimeRange(startTime, f.getDuration())); } int nchan = aes.getNumChannels(); if (nchan != AESAudioMetadata.NULL) { faceBuilder.add("aes:numChannels", nchan); } String[] locs = aes.getMapLocations(); JsonArrayBuilder streamsBuilder = Json.createArrayBuilder(); for (int ch = 0; ch < nchan; ch++) { streamsBuilder .add(Json.createObjectBuilder().add("aes:channelNum", ch).add("aes:mapLocation", locs[ch])); } faceBuilder.add("aes:streams", streamsBuilder); aesBuilder.add("aes:face", faceBuilder); } List<AESAudioMetadata.FormatRegion> flist = aes.getFormatList(); if (flist != null && !flist.isEmpty()) { AESAudioMetadata.FormatRegion rgn = flist.get(0); int bitDepth = rgn.getBitDepth(); double sampleRate = rgn.getSampleRate(); int wordSize = rgn.getWordSize(); String[] bitRed = rgn.getBitrateReduction(); JsonArrayBuilder formatListBuilder = Json.createArrayBuilder(); JsonObjectBuilder formatRegionBuilder = Json.createObjectBuilder(); if (bitDepth != AESAudioMetadata.NULL || sampleRate != AESAudioMetadata.NILL || wordSize != AESAudioMetadata.NULL) { if (bitDepth != AESAudioMetadata.NULL) { formatRegionBuilder.add("aes:bitDepth", bitDepth); } if (sampleRate != AESAudioMetadata.NILL) { formatRegionBuilder.add("aes:sampleRate", sampleRate); } if (wordSize != AESAudioMetadata.NULL) { formatRegionBuilder.add("aes:wordSize", wordSize); } if (bitRed != null) { formatRegionBuilder.add("aes:bitrateReduction", Json.createObjectBuilder() .add("aes:codecName", bitRed[0]).add("aes:codecNameVersion", bitRed[1]) .add("aes:codecCreatorApplication", bitRed[2]) .add("aes:codecCreatorApplicationVersion", bitRed[3]).add("aes:codecQuality", bitRed[4]) .add("aes:dataRate", bitRed[5]).add("aes:dataRateMode", bitRed[6])); } formatListBuilder.add(formatRegionBuilder); aesBuilder.add("aes:formatList", formatListBuilder); } } return aesBuilder; } JsonHandler();  JsonHandler(String name, String release, int[] date, String note, String rights); }
JsonHandler extends HandlerBase { protected JsonObjectBuilder showAESAudioMetadata(AESAudioMetadata aes) { JsonObjectBuilder aesBuilder = Json.createObjectBuilder(); _sampleRate = aes.getSampleRate(); String s = aes.getAnalogDigitalFlag(); if (s != null) { aesBuilder.add("aes:analogDigitalFlag", s); } s = aes.getSchemaVersion(); if (s != null) { aesBuilder.add("aes:schemaVersion", s); } s = aes.getFormat(); if (s != null) { aesBuilder.add("aes:format", s); } s = aes.getSpecificationVersion(); if (s != null) { aesBuilder.add("aes:specificationVersion", s); } s = aes.getAppSpecificData(); if (s != null) { aesBuilder.add("aes:appSpecificData", s); } s = aes.getAudioDataEncoding(); if (s != null) { aesBuilder.add("aes:audioDataEncoding", s); } int in = aes.getByteOrder(); if (in != AESAudioMetadata.NULL) { aesBuilder.add("aes:byteOrder", (in == AESAudioMetadata.BIG_ENDIAN ? "BIG_ENDIAN" : "LITTLE_ENDIAN")); } long lin = aes.getFirstSampleOffset(); if (lin != AESAudioMetadata.NULL) { aesBuilder.add("aes:firstSampleOffset", lin); } String[] use = aes.getUse(); if (use != null) { aesBuilder.add("aes:use", Json.createObjectBuilder().add("aes:useType", use[0]).add("aes:otherType", use[1])); } s = aes.getPrimaryIdentifier(); if (s != null) { String t = aes.getPrimaryIdentifierType(); aesBuilder.add("aes:primaryIdentifier", s); if (t != null) { aesBuilder.add("aes:primaryIdentifierType", t); } } List<AESAudioMetadata.Face> facelist = aes.getFaceList(); if (facelist != null && !facelist.isEmpty()) { AESAudioMetadata.Face f = facelist.get(0); JsonObjectBuilder faceBuilder = Json.createObjectBuilder(); AESAudioMetadata.TimeDesc startTime = f.getStartTime(); if (startTime != null) { faceBuilder.add("aes:timeline", writeAESTimeRange(startTime, f.getDuration())); } int nchan = aes.getNumChannels(); if (nchan != AESAudioMetadata.NULL) { faceBuilder.add("aes:numChannels", nchan); } String[] locs = aes.getMapLocations(); JsonArrayBuilder streamsBuilder = Json.createArrayBuilder(); for (int ch = 0; ch < nchan; ch++) { streamsBuilder .add(Json.createObjectBuilder().add("aes:channelNum", ch).add("aes:mapLocation", locs[ch])); } faceBuilder.add("aes:streams", streamsBuilder); aesBuilder.add("aes:face", faceBuilder); } List<AESAudioMetadata.FormatRegion> flist = aes.getFormatList(); if (flist != null && !flist.isEmpty()) { AESAudioMetadata.FormatRegion rgn = flist.get(0); int bitDepth = rgn.getBitDepth(); double sampleRate = rgn.getSampleRate(); int wordSize = rgn.getWordSize(); String[] bitRed = rgn.getBitrateReduction(); JsonArrayBuilder formatListBuilder = Json.createArrayBuilder(); JsonObjectBuilder formatRegionBuilder = Json.createObjectBuilder(); if (bitDepth != AESAudioMetadata.NULL || sampleRate != AESAudioMetadata.NILL || wordSize != AESAudioMetadata.NULL) { if (bitDepth != AESAudioMetadata.NULL) { formatRegionBuilder.add("aes:bitDepth", bitDepth); } if (sampleRate != AESAudioMetadata.NILL) { formatRegionBuilder.add("aes:sampleRate", sampleRate); } if (wordSize != AESAudioMetadata.NULL) { formatRegionBuilder.add("aes:wordSize", wordSize); } if (bitRed != null) { formatRegionBuilder.add("aes:bitrateReduction", Json.createObjectBuilder() .add("aes:codecName", bitRed[0]).add("aes:codecNameVersion", bitRed[1]) .add("aes:codecCreatorApplication", bitRed[2]) .add("aes:codecCreatorApplicationVersion", bitRed[3]).add("aes:codecQuality", bitRed[4]) .add("aes:dataRate", bitRed[5]).add("aes:dataRateMode", bitRed[6])); } formatListBuilder.add(formatRegionBuilder); aesBuilder.add("aes:formatList", formatListBuilder); } } return aesBuilder; } JsonHandler();  JsonHandler(String name, String release, int[] date, String note, String rights); @Override void show(); @Override void show(App app); @Override void show(OutputHandler handler); @Override void show(Module module); @Override void show(RepInfo info); @Override void showFooter(); @Override void showHeader(); }
JsonHandler extends HandlerBase { protected JsonObjectBuilder showAESAudioMetadata(AESAudioMetadata aes) { JsonObjectBuilder aesBuilder = Json.createObjectBuilder(); _sampleRate = aes.getSampleRate(); String s = aes.getAnalogDigitalFlag(); if (s != null) { aesBuilder.add("aes:analogDigitalFlag", s); } s = aes.getSchemaVersion(); if (s != null) { aesBuilder.add("aes:schemaVersion", s); } s = aes.getFormat(); if (s != null) { aesBuilder.add("aes:format", s); } s = aes.getSpecificationVersion(); if (s != null) { aesBuilder.add("aes:specificationVersion", s); } s = aes.getAppSpecificData(); if (s != null) { aesBuilder.add("aes:appSpecificData", s); } s = aes.getAudioDataEncoding(); if (s != null) { aesBuilder.add("aes:audioDataEncoding", s); } int in = aes.getByteOrder(); if (in != AESAudioMetadata.NULL) { aesBuilder.add("aes:byteOrder", (in == AESAudioMetadata.BIG_ENDIAN ? "BIG_ENDIAN" : "LITTLE_ENDIAN")); } long lin = aes.getFirstSampleOffset(); if (lin != AESAudioMetadata.NULL) { aesBuilder.add("aes:firstSampleOffset", lin); } String[] use = aes.getUse(); if (use != null) { aesBuilder.add("aes:use", Json.createObjectBuilder().add("aes:useType", use[0]).add("aes:otherType", use[1])); } s = aes.getPrimaryIdentifier(); if (s != null) { String t = aes.getPrimaryIdentifierType(); aesBuilder.add("aes:primaryIdentifier", s); if (t != null) { aesBuilder.add("aes:primaryIdentifierType", t); } } List<AESAudioMetadata.Face> facelist = aes.getFaceList(); if (facelist != null && !facelist.isEmpty()) { AESAudioMetadata.Face f = facelist.get(0); JsonObjectBuilder faceBuilder = Json.createObjectBuilder(); AESAudioMetadata.TimeDesc startTime = f.getStartTime(); if (startTime != null) { faceBuilder.add("aes:timeline", writeAESTimeRange(startTime, f.getDuration())); } int nchan = aes.getNumChannels(); if (nchan != AESAudioMetadata.NULL) { faceBuilder.add("aes:numChannels", nchan); } String[] locs = aes.getMapLocations(); JsonArrayBuilder streamsBuilder = Json.createArrayBuilder(); for (int ch = 0; ch < nchan; ch++) { streamsBuilder .add(Json.createObjectBuilder().add("aes:channelNum", ch).add("aes:mapLocation", locs[ch])); } faceBuilder.add("aes:streams", streamsBuilder); aesBuilder.add("aes:face", faceBuilder); } List<AESAudioMetadata.FormatRegion> flist = aes.getFormatList(); if (flist != null && !flist.isEmpty()) { AESAudioMetadata.FormatRegion rgn = flist.get(0); int bitDepth = rgn.getBitDepth(); double sampleRate = rgn.getSampleRate(); int wordSize = rgn.getWordSize(); String[] bitRed = rgn.getBitrateReduction(); JsonArrayBuilder formatListBuilder = Json.createArrayBuilder(); JsonObjectBuilder formatRegionBuilder = Json.createObjectBuilder(); if (bitDepth != AESAudioMetadata.NULL || sampleRate != AESAudioMetadata.NILL || wordSize != AESAudioMetadata.NULL) { if (bitDepth != AESAudioMetadata.NULL) { formatRegionBuilder.add("aes:bitDepth", bitDepth); } if (sampleRate != AESAudioMetadata.NILL) { formatRegionBuilder.add("aes:sampleRate", sampleRate); } if (wordSize != AESAudioMetadata.NULL) { formatRegionBuilder.add("aes:wordSize", wordSize); } if (bitRed != null) { formatRegionBuilder.add("aes:bitrateReduction", Json.createObjectBuilder() .add("aes:codecName", bitRed[0]).add("aes:codecNameVersion", bitRed[1]) .add("aes:codecCreatorApplication", bitRed[2]) .add("aes:codecCreatorApplicationVersion", bitRed[3]).add("aes:codecQuality", bitRed[4]) .add("aes:dataRate", bitRed[5]).add("aes:dataRateMode", bitRed[6])); } formatListBuilder.add(formatRegionBuilder); aesBuilder.add("aes:formatList", formatListBuilder); } } return aesBuilder; } JsonHandler();  JsonHandler(String name, String release, int[] date, String note, String rights); @Override void show(); @Override void show(App app); @Override void show(OutputHandler handler); @Override void show(Module module); @Override void show(RepInfo info); @Override void showFooter(); @Override void showHeader();  }