use of org.opencastproject.mediapackage.track.TrackImpl in project opencast by opencast.
the class SmilServiceImplTest method testAddClipStartValueBiggerThanDuration.
@Test(expected = SmilException.class)
public void testAddClipStartValueBiggerThanDuration() throws Exception {
TrackImpl videoTrack = new TrackImpl();
videoTrack.setIdentifier("track-1");
videoTrack.setFlavor(new MediaPackageElementFlavor("source", "presentation"));
videoTrack.setURI(new URI("http://hostname/video.mp4"));
videoTrack.addStream(new VideoStreamImpl());
videoTrack.setDuration(new Long(1000));
SmilResponse smilResponse = smilService.createNewSmil();
smilResponse = smilService.addClip(smilResponse.getSmil(), null, videoTrack, 1000, 10);
fail("Sequence start value is equal track duration but SmilService does not throw an SmilException.");
}
use of org.opencastproject.mediapackage.track.TrackImpl in project opencast by opencast.
the class SmilServiceImplTest method testAddClipWithUnsetTrackDuration.
@Test
public void testAddClipWithUnsetTrackDuration() throws Exception {
TrackImpl videoTrack = new TrackImpl();
videoTrack.setIdentifier("track-1");
videoTrack.setFlavor(new MediaPackageElementFlavor("source", "presentation"));
videoTrack.setURI(new URI("http://hostname/video.mp4"));
videoTrack.addStream(new VideoStreamImpl());
// no track duration set
SmilResponse smilResponse = smilService.createNewSmil();
smilResponse = smilService.addClip(smilResponse.getSmil(), null, videoTrack, 0, 10);
assertTrue("Smil service does not add new par element", smilResponse.getEntitiesCount() > 0);
assertNotNull(smilResponse.getEntities());
}
use of org.opencastproject.mediapackage.track.TrackImpl in project opencast by opencast.
the class SmilServiceImplTest method testAddClipWithInvalidTrack.
@Test(expected = SmilException.class)
public void testAddClipWithInvalidTrack() throws Exception {
TrackImpl videoTrack = new TrackImpl();
SmilResponse smilResponse = smilService.createNewSmil();
smilResponse = smilService.addClip(smilResponse.getSmil(), null, videoTrack, 0, 10);
fail("SmilException schould be thrown if you try to add an invalid track.");
}
use of org.opencastproject.mediapackage.track.TrackImpl in project opencast by opencast.
the class SoxServiceTest method testAnalyzeAudio.
@Test
public void testAnalyzeAudio() throws Exception {
if (!soxInstalled)
return;
assertTrue(source.isFile());
String sourceTrackXml = "<track xmlns=\"http://mediapackage.opencastproject.org\" id=\"track-1\" type=\"presentation/source\"><mimetype>audio/flac</mimetype>" + "<url>http://localhost:8080/workflow/samples/camera.mpg</url>" + "<checksum type=\"md5\">43b7d843b02c4a429b2f547a4f230d31</checksum><duration>14546</duration>" + "<audio><device type=\"UFG03\" version=\"30112007\" vendor=\"Unigraf\" />" + "<encoder type=\"H.264\" version=\"7.4\" vendor=\"Apple Inc\" /><channels>2</channels>" + "<bitdepth>16</bitdepth><samplingrate>44100</samplingrate></audio></track>";
Track sourceTrack = (Track) MediaPackageElementParser.getFromXml(sourceTrackXml);
List<Job> jobs = new ArrayList<Job>();
for (int i = 0; i < 10; i++) {
jobs.add(soxService.analyze(sourceTrack));
}
boolean success = new JobBarrier(null, serviceRegistry, jobs.toArray(new Job[jobs.size()])).waitForJobs().isSuccess();
assertTrue(success);
for (Job j : jobs) {
// Always check the service registry for the latest version of the job
Job job = serviceRegistry.getJob(j.getId());
TrackImpl track = (TrackImpl) MediaPackageElementParser.getFromXml(job.getPayload());
AudioStream audioStream = track.getAudio().get(0);
assertEquals(-8.55f, audioStream.getPkLevDb().floatValue(), 0.0002);
assertEquals(-27.78f, audioStream.getRmsLevDb().floatValue(), 0.0002);
assertEquals(-20.12f, audioStream.getRmsPkDb().floatValue(), 0.0002);
assertEquals(Job.Status.FINISHED, job.getStatus());
}
}
use of org.opencastproject.mediapackage.track.TrackImpl in project opencast by opencast.
the class SoxServiceTest method testNormalizeDecreaseAudio.
@Test
public void testNormalizeDecreaseAudio() throws Exception {
if (!soxInstalled)
return;
assertTrue(source.isFile());
String sourceTrackXml = "<track xmlns=\"http://mediapackage.opencastproject.org\" id=\"track-1\" type=\"presentation/source\"><mimetype>audio/flac</mimetype>" + "<url>http://localhost:8080/workflow/samples/camera.mpg</url>" + "<checksum type=\"md5\">43b7d843b02c4a429b2f547a4f230d31</checksum><duration>14546</duration>" + "<audio><device type=\"UFG03\" version=\"30112007\" vendor=\"Unigraf\" />" + "<encoder type=\"H.264\" version=\"7.4\" vendor=\"Apple Inc\" /><channels>2</channels>" + "<bitdepth>16</bitdepth><rmsleveldb>-27.78</rmsleveldb><samplingrate>44100</samplingrate></audio></track>";
Track sourceTrack = (Track) MediaPackageElementParser.getFromXml(sourceTrackXml);
List<Job> jobs = new ArrayList<Job>();
for (int i = 0; i < 10; i++) {
jobs.add(soxService.normalize(sourceTrack, -30f));
}
boolean success = new JobBarrier(null, serviceRegistry, jobs.toArray(new Job[jobs.size()])).waitForJobs().isSuccess();
assertTrue(success);
for (Job j : jobs) {
// Always check the service registry for the latest version of the job
Job job = serviceRegistry.getJob(j.getId());
TrackImpl track = (TrackImpl) MediaPackageElementParser.getFromXml(job.getPayload());
AudioStream audioStream = track.getAudio().get(0);
assertEquals(-30f, audioStream.getRmsLevDb().floatValue(), 0.1);
assertEquals(Job.Status.FINISHED, job.getStatus());
}
}
Aggregations