Search in sources :

Example 1 with SmilMediaParallelImpl

use of org.opencastproject.smil.entity.media.container.SmilMediaParallelImpl in project opencast by opencast.

the class SmilServiceImpl method addParallel.

/**
 * {@inheritDoc}
 */
@Override
public SmilResponse addParallel(Smil smil, String parentId) throws SmilException {
    SmilMediaContainer par = new SmilMediaParallelImpl();
    ((SmilBodyImpl) smil.getBody()).addMediaElement(par, parentId);
    return new SmilResponseImpl(smil, par);
}
Also used : SmilBodyImpl(org.opencastproject.smil.entity.SmilBodyImpl) SmilMediaParallelImpl(org.opencastproject.smil.entity.media.container.SmilMediaParallelImpl) SmilMediaContainer(org.opencastproject.smil.entity.media.container.api.SmilMediaContainer)

Example 2 with SmilMediaParallelImpl

use of org.opencastproject.smil.entity.media.container.SmilMediaParallelImpl in project opencast by opencast.

the class SmilServiceImplTest method testFromXml.

/**
 * Test of fromXml methods, of class SmilServiceImpl.
 */
@Test
public void testFromXml() throws Exception {
    SmilResponse smilResponse = smilService.fromXml(TEST_SMIL);
    assertNotNull(smilResponse.getSmil());
    Smil smil = smilResponse.getSmil();
    // test head
    assertSame(2, smil.getHead().getParamGroups().size());
    // test body
    assertSame(2, smil.getBody().getMediaElements().size());
    assertTrue(smil.getBody().getMediaElements().get(0) instanceof SmilMediaParallelImpl);
    assertTrue(smil.getBody().getMediaElements().get(1) instanceof SmilMediaParallelImpl);
    SmilMediaContainer par = (SmilMediaContainer) smil.getBody().getMediaElements().get(0);
    assertSame(2, par.getElements().size());
    assertTrue(par.getElements().get(0) instanceof SmilMediaVideoImpl);
    assertTrue(par.getElements().get(1) instanceof SmilMediaAudioImpl);
}
Also used : SmilMediaVideoImpl(org.opencastproject.smil.entity.media.element.SmilMediaVideoImpl) SmilResponse(org.opencastproject.smil.api.SmilResponse) SmilMediaAudioImpl(org.opencastproject.smil.entity.media.element.SmilMediaAudioImpl) Smil(org.opencastproject.smil.entity.api.Smil) SmilMediaParallelImpl(org.opencastproject.smil.entity.media.container.SmilMediaParallelImpl) SmilMediaContainer(org.opencastproject.smil.entity.media.container.api.SmilMediaContainer) Test(org.junit.Test)

Example 3 with SmilMediaParallelImpl

use of org.opencastproject.smil.entity.media.container.SmilMediaParallelImpl in project opencast by opencast.

the class SmilServiceImplTest method testAddParallel.

/**
 * Test of addParallel methods, of class SmilServiceImpl.
 */
@Test
public void testAddParallel() throws Exception {
    SmilResponse smilResponse = smilService.createNewSmil();
    smilResponse = smilService.addParallel(smilResponse.getSmil());
    assertNotNull(smilResponse.getSmil().getBody().getMediaElements().get(0));
    assertEquals(smilResponse.getSmil().getBody().getMediaElements().get(0), smilResponse.getEntity());
    assertTrue(smilResponse.getSmil().getBody().getMediaElements().get(0) instanceof SmilMediaParallelImpl);
    SmilMediaContainer par = (SmilMediaContainer) smilResponse.getEntity();
    assertTrue(par.isContainer());
    assertSame(SmilMediaContainer.ContainerType.PAR, par.getContainerType());
    smilResponse = smilService.addParallel(smilResponse.getSmil(), smilResponse.getEntity().getId());
    assertNotNull(smilResponse.getSmil().getBody().getMediaElements().get(0));
    assertTrue(smilResponse.getSmil().getBody().getMediaElements().get(0) instanceof SmilMediaContainer);
    SmilMediaContainer parent = (SmilMediaContainer) smilResponse.getSmil().getBody().getMediaElements().get(0);
    assertNotNull(parent.getElements().get(0));
    assertTrue(parent.getElements().get(0) instanceof SmilMediaParallelImpl);
    assertEquals(parent.getElements().get(0).getId(), smilResponse.getEntity().getId());
}
Also used : SmilResponse(org.opencastproject.smil.api.SmilResponse) SmilMediaParallelImpl(org.opencastproject.smil.entity.media.container.SmilMediaParallelImpl) SmilMediaContainer(org.opencastproject.smil.entity.media.container.api.SmilMediaContainer) Test(org.junit.Test)

Aggregations

SmilMediaParallelImpl (org.opencastproject.smil.entity.media.container.SmilMediaParallelImpl)3 SmilMediaContainer (org.opencastproject.smil.entity.media.container.api.SmilMediaContainer)3 Test (org.junit.Test)2 SmilResponse (org.opencastproject.smil.api.SmilResponse)2 SmilBodyImpl (org.opencastproject.smil.entity.SmilBodyImpl)1 Smil (org.opencastproject.smil.entity.api.Smil)1 SmilMediaAudioImpl (org.opencastproject.smil.entity.media.element.SmilMediaAudioImpl)1 SmilMediaVideoImpl (org.opencastproject.smil.entity.media.element.SmilMediaVideoImpl)1