/** * 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))); } }