Search in sources :

Example 16 with VideoStreamImpl

use of org.opencastproject.mediapackage.track.VideoStreamImpl 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());
}
Also used : TrackImpl(org.opencastproject.mediapackage.track.TrackImpl) SmilResponse(org.opencastproject.smil.api.SmilResponse) VideoStreamImpl(org.opencastproject.mediapackage.track.VideoStreamImpl) MediaPackageElementFlavor(org.opencastproject.mediapackage.MediaPackageElementFlavor) URI(java.net.URI) Test(org.junit.Test)

Example 17 with VideoStreamImpl

use of org.opencastproject.mediapackage.track.VideoStreamImpl in project opencast by opencast.

the class ProbeResolutionWorkflowOperationHandlerTest method testStart.

@Test
public void testStart() throws MediaPackageException, WorkflowOperationException {
    MediaPackage mediaPackage = MediaPackageBuilderFactory.newInstance().newMediaPackageBuilder().createNew();
    VideoStreamImpl videoStream = new VideoStreamImpl("234");
    videoStream.setFrameWidth(1280);
    videoStream.setFrameHeight(720);
    TrackImpl track = new TrackImpl();
    track.setFlavor(MediaPackageElementFlavor.parseFlavor("presenter/source"));
    track.addStream(videoStream);
    JobContext jobContext = EasyMock.createMock(JobContext.class);
    EasyMock.replay(jobContext);
    WorkflowOperationInstance operationInstance = EasyMock.createMock(WorkflowOperationInstance.class);
    String[][] config = { { ProbeResolutionWorkflowOperationHandler.OPT_SOURCE_FLAVOR, "*/source" }, { ProbeResolutionWorkflowOperationHandler.OPT_VAR_PREFIX + "aspect", "1280x720,1280x700" }, { ProbeResolutionWorkflowOperationHandler.OPT_VAL_PREFIX + "aspect", "16/9" }, { ProbeResolutionWorkflowOperationHandler.OPT_VAR_PREFIX + "is_720", "1280x720,1280x700" }, { ProbeResolutionWorkflowOperationHandler.OPT_VAR_PREFIX + "is_1080", "1920x1080" } };
    Set<String> keys = new HashSet<>();
    for (String[] cfg : config) {
        keys.add(cfg[0]);
        EasyMock.expect(operationInstance.getConfiguration(cfg[0])).andReturn(cfg[1]).anyTimes();
    }
    EasyMock.expect(operationInstance.getConfigurationKeys()).andReturn(keys).anyTimes();
    EasyMock.replay(operationInstance);
    WorkflowInstance workflowInstance = EasyMock.createMock(WorkflowInstance.class);
    EasyMock.expect(workflowInstance.getMediaPackage()).andReturn(mediaPackage).anyTimes();
    EasyMock.expect(workflowInstance.getCurrentOperation()).andReturn(operationInstance).anyTimes();
    EasyMock.replay(workflowInstance);
    // With no matching track
    assertEquals(null, operationHandler.start(workflowInstance, jobContext).getProperties());
    // With matching track
    mediaPackage.add(track);
    WorkflowOperationResult workflowOperationResult = operationHandler.start(workflowInstance, jobContext);
    Map<String, String> properties = workflowOperationResult.getProperties();
    String[][] props = { { "presenter_source_aspect", "16/9" }, { "presenter_source_is_720", "true" }, { "presenter_source_is_1080", null } };
    for (String[] prop : props) {
        assertEquals(prop[1], properties.get(prop[0]));
    }
}
Also used : TrackImpl(org.opencastproject.mediapackage.track.TrackImpl) VideoStreamImpl(org.opencastproject.mediapackage.track.VideoStreamImpl) WorkflowInstance(org.opencastproject.workflow.api.WorkflowInstance) WorkflowOperationResult(org.opencastproject.workflow.api.WorkflowOperationResult) WorkflowOperationInstance(org.opencastproject.workflow.api.WorkflowOperationInstance) MediaPackage(org.opencastproject.mediapackage.MediaPackage) JobContext(org.opencastproject.job.api.JobContext) HashSet(java.util.HashSet) Test(org.junit.Test)

Aggregations

VideoStreamImpl (org.opencastproject.mediapackage.track.VideoStreamImpl)17 TrackImpl (org.opencastproject.mediapackage.track.TrackImpl)12 Test (org.junit.Test)9 URI (java.net.URI)7 MediaPackageElementFlavor (org.opencastproject.mediapackage.MediaPackageElementFlavor)7 SmilResponse (org.opencastproject.smil.api.SmilResponse)6 AudioStreamImpl (org.opencastproject.mediapackage.track.AudioStreamImpl)4 BeforeClass (org.junit.BeforeClass)3 MediaPackage (org.opencastproject.mediapackage.MediaPackage)3 SmilMediaObject (org.opencastproject.smil.entity.media.api.SmilMediaObject)3 SmilMediaContainer (org.opencastproject.smil.entity.media.container.api.SmilMediaContainer)3 SmilMediaElement (org.opencastproject.smil.entity.media.element.api.SmilMediaElement)3 WorkflowInstance (org.opencastproject.workflow.api.WorkflowInstance)3 ArrayList (java.util.ArrayList)2 JobContext (org.opencastproject.job.api.JobContext)2 Track (org.opencastproject.mediapackage.Track)2 VideoStream (org.opencastproject.mediapackage.VideoStream)2 AccessControlList (org.opencastproject.security.api.AccessControlList)2 Field (com.entwinemedia.fn.data.json.Field)1 JValue (com.entwinemedia.fn.data.json.JValue)1