Search in sources :

Example 11 with SmilObject

use of org.opencastproject.smil.entity.api.SmilObject in project opencast by opencast.

the class SmilResponseImplTest method testGetEntity.

/**
 * Test of getEntity method, of class SmilResponseImpl.
 */
@Test
public void testGetEntity() throws Exception {
    Smil smil = new SmilImpl();
    SmilResponse response = new SmilResponseImpl(smil);
    try {
        response.getEntity();
        fail("getEntity should fail, if entity count is zero");
    } catch (SmilException ex) {
    }
    response = new SmilResponseImpl(smil, smil.getBody());
    try {
        assertSame(smil.getBody(), response.getEntity());
        assertSame(1, response.getEntities().length);
        assertSame(smil.getBody(), response.getEntities()[0]);
    } catch (SmilException ex) {
        fail("getEntity should return the entity");
    }
    response = new SmilResponseImpl(smil, new SmilObject[] { smil.getHead(), smil.getBody() });
    try {
        response.getEntity();
        fail("get entity should fail if there are more then one entities set.");
    } catch (SmilException ex) {
    }
}
Also used : SmilResponse(org.opencastproject.smil.api.SmilResponse) SmilImpl(org.opencastproject.smil.entity.SmilImpl) SmilObject(org.opencastproject.smil.entity.api.SmilObject) Smil(org.opencastproject.smil.entity.api.Smil) SmilException(org.opencastproject.smil.api.SmilException) Test(org.junit.Test)

Example 12 with SmilObject

use of org.opencastproject.smil.entity.api.SmilObject in project opencast by opencast.

the class SmilBodyImpl method putAllChilds.

/**
 * {@inheritDoc}
 */
@Override
public void putAllChilds(List<SmilObject> elements) {
    for (SmilObject child : getMediaElements()) {
        elements.add(child);
        ((SmilObjectImpl) child).putAllChilds(elements);
    }
}
Also used : SmilObject(org.opencastproject.smil.entity.api.SmilObject)

Example 13 with SmilObject

use of org.opencastproject.smil.entity.api.SmilObject in project opencast by opencast.

the class SmilHeadImpl method addMeta.

/**
 * Add given {@link SmilMeta} element.
 *
 * @param meta {@link SmilMeta} to add
 */
public void addMeta(SmilMeta meta) {
    SmilObject m = getElementOrNull(meta.getId());
    if (m != null && m instanceof SmilMeta) {
        ((SmilMetaImpl) m).setName(meta.getName());
        ((SmilMetaImpl) m).setContent(meta.getContent());
    } else {
        metas.add(meta);
    }
}
Also used : SmilObject(org.opencastproject.smil.entity.api.SmilObject) SmilMeta(org.opencastproject.smil.entity.api.SmilMeta)

Example 14 with SmilObject

use of org.opencastproject.smil.entity.api.SmilObject in project opencast by opencast.

the class SmilHeadImpl method putAllChilds.

/**
 * {@inheritDoc}
 */
@Override
public void putAllChilds(List<SmilObject> elements) {
    for (SmilObject meta : getMetas()) {
        elements.add(meta);
        ((SmilObjectImpl) meta).putAllChilds(elements);
    }
    for (SmilObject paramGroup : getParamGroups()) {
        elements.add(paramGroup);
        ((SmilObjectImpl) paramGroup).putAllChilds(elements);
    }
}
Also used : SmilObject(org.opencastproject.smil.entity.api.SmilObject)

Aggregations

SmilObject (org.opencastproject.smil.entity.api.SmilObject)14 SmilResponse (org.opencastproject.smil.api.SmilResponse)6 Test (org.junit.Test)5 SmilImpl (org.opencastproject.smil.entity.SmilImpl)3 SmilObjectImpl (org.opencastproject.smil.entity.SmilObjectImpl)3 Smil (org.opencastproject.smil.entity.api.Smil)3 SmilMediaElement (org.opencastproject.smil.entity.media.element.api.SmilMediaElement)3 URI (java.net.URI)2 MediaPackageElementFlavor (org.opencastproject.mediapackage.MediaPackageElementFlavor)2 Track (org.opencastproject.mediapackage.Track)2 TrackImpl (org.opencastproject.mediapackage.track.TrackImpl)2 VideoStreamImpl (org.opencastproject.mediapackage.track.VideoStreamImpl)2 SmilException (org.opencastproject.smil.api.SmilException)2 SmilMediaObject (org.opencastproject.smil.entity.media.api.SmilMediaObject)2 SmilMediaContainer (org.opencastproject.smil.entity.media.container.api.SmilMediaContainer)2 SmilMediaVideoImpl (org.opencastproject.smil.entity.media.element.SmilMediaVideoImpl)2 ArrayList (java.util.ArrayList)1 LinkedList (java.util.LinkedList)1 AudioStreamImpl (org.opencastproject.mediapackage.track.AudioStreamImpl)1 SmilMeta (org.opencastproject.smil.entity.api.SmilMeta)1