/** * Create an instance of {@link DppType } * */ public DppType createDppType() { return new DppType(); }
@Override public void fillAttributes(TimedTextObject tto) { String programName = metadata.getEditorial().getProgrammeTitle() != null ? metadata.getEditorial().getProgrammeTitle() : ""; if (metadata.getEditorial().getEpisodeTitleNumber() != null) { OET.setValue(metadata.getEditorial().getEpisodeTitleNumber()); } else { OET.fillEmptyValue(); if (metadata.getEditorial().getOriginator() != null) { PUB.setValue(metadata.getEditorial().getOriginator()); } else { PUB.fillEmptyValue(); if (metadata.getEditorial().getDistributor() != null) { EN.setValue(metadata.getEditorial().getDistributor()); } else if (metadata.getEditorial().getOriginator() != null) { EN.setValue(metadata.getEditorial().getOriginator()); } else { EN.fillEmptyValue(); if (metadata.getTechnical().getContactInformation() != null && metadata.getTechnical().getContactInformation().getContactEmail() != null) { ECD.setValue(metadata.getTechnical().getContactInformation().getContactEmail()); } else { ECD.fillEmptyValue(); if (metadata.getTechnical().getAdditional() != null && metadata.getTechnical().getAdditional().getCompletionDate() != null) {
DppType dpp = new DppType(); dpp.setEditorial(editorial); dpp.setTechnical(technical); technical.setVideo(video); technical.setAudio(audio);
private void fillTcp() { TCP.fillEmptyValue(); if (metadata.getTechnical().getTimecodes() == null) { return; } if (metadata.getTechnical().getTimecodes().getParts() == null) { return; } if (metadata.getTechnical().getTimecodes().getParts().getPart() == null) { return; } if (metadata.getTechnical().getTimecodes().getParts().getPart().isEmpty()) { return; } TimecodeType tc = metadata.getTechnical().getTimecodes().getParts().getPart().get(0).getPartSOM(); String[] parts = tc.getValue().split("[:;]"); StringBuilder sb = new StringBuilder(); for (String part : parts) { if (part.length() == 1) { sb.append("0"); sb.append(part); } else if (part.length() > 2) { sb.append(part.substring(part.length() - 2, part.length())); } else { sb.append(part); } } TCP.setValue(sb.toString()); }
/** * Tests that test-metadata.xml is loaded correctly. * * @throws Exception */ @Test public void parseCorrectMetadataXml() throws Exception { // load generated test-metadata.xml this.metadataProvider = new MetadataXmlProvider(MetadataUtils.getCorrectMetadataXml(), TemplateParameterContextCreator.getCurrentTmpDir()); assertNotNull(metadataProvider.getDpp()); assertNotNull(metadataProvider.getDpp().getEditorial()); assertNotNull(metadataProvider.getDpp().getTechnical()); assertNotNull(metadataProvider.getDpp().getTechnical().getAudio()); assertNotNull(metadataProvider.getDpp().getTechnical().getVideo()); }
/** * Check that total duration specified in Metadata.xml is less than total duration of the output file. * Otherwise conversion will abort at the very last step (BMX). It may make the user unhappy after a long conversion. */ private void checkTotalDuration() { String metadataTotalDurationTc = metadataXmlProvider.getDpp().getTechnical().getTimecodes().getTotalProgrammeDuration().getValue(); if (StringUtils.isEmpty(metadataTotalDurationTc)) { return; } String destFps = contextProvider.getDestContext().getParameterValue(DestContextParameters.FRAME_RATE); if (destFps == null) { destFps = MetadataXmlProvider.DEST_FRAME_RATE; } BigFraction fps = ConversionHelper.parseEditRate(destFps); long metadataTotalDurationMs = ConversionHelper.smpteTimecodeToMilliSeconds( metadataTotalDurationTc, fps); long cplTotalDurationMs = getCplTotalDurationMs(); // BMX accepts any total duration if zero timecode is specified in metadata.xml if (metadataTotalDurationMs == 0) { return; } if (metadataTotalDurationMs > cplTotalDurationMs) { throw new ConversionException( String.format("A total programme duration as specified in metadata.xml (%s, %s ms) exceeds a " + "total duration of the output as defined by the CPL (%s, %s ms) ", metadataTotalDurationTc, String.valueOf(metadataTotalDurationMs), ConversionHelper.msToSmpteTimecode(cplTotalDurationMs, fps), String.valueOf(cplTotalDurationMs))); } }
@Override protected void doBuildDynamicContextPostCpl() throws IOException, XmlParsingException { DynamicTemplateParameterContext dynamicContext = contextProvider.getDynamicContext(); // 1. load metadata.xml metadataXmlProvider = new MetadataXmlProvider(dppInputParameters.getMetadataFile(), contextProvider.getWorkingDir()); // 2. load audiomap.xml AudioTrackLayoutDmAs11Type audioTrackLayout = metadataXmlProvider.getDpp().getTechnical().getAudio().getAudioTrackLayout(); AudioMapXmlProvider audioMapXmlProvider = new AudioMapXmlProvider(dppInputParameters.getAudiomapFile(), audioTrackLayout, contextProvider); // 3. fill audio map parameters dynamicContext.addParameter(DYNAMIC_PARAM_PAN, audioMapXmlProvider.getPanParameter()); // 4. fill ebuAudioTracks parameter Integer audioTracksNum = audioMapXmlProvider.getEBUAudioTracks(); dynamicContext.addParameter(DYNAMIC_PARAM_EBU_AUDIO_TRACKS, String.valueOf(audioTracksNum)); // 5. fill bmx metadata files parameters metadataXmlProvider.createBmxDppParameterFiles(); dynamicContext.addParameter(DYNAMIC_PARAM_UK_DPP_FILE, metadataXmlProvider.getBmxDppParameterFile(DMFramework.UKDPP).getAbsolutePath(), true); dynamicContext.addParameter(DYNAMIC_PARAM_AS11_CORE_FILE, metadataXmlProvider.getBmxDppParameterFile(DMFramework.AS11CORE).getAbsolutePath(), true); dynamicContext.addParameter(DYNAMIC_PARAM_AS11_SEGM_FILE, metadataXmlProvider.getBmxDppParameterFile(DMFramework.AS11Segmentation).getAbsolutePath(), true); resolveSameFpsParameter(); }
/** * Create an instance of {@link DppType } * */ public DppType createDppType() { return new DppType(); }