Search in sources :

Example 1 with SmilXmlParser

use of com.android.mms.dom.smil.parser.SmilXmlParser in project qksms by moezbhatti.

the class SmilHelper method getSmilDocument.

/**
 * Parse SMIL message and retrieve SMILDocument.
 *
 * @return A SMILDocument or null if parsing failed.
 */
private static SMILDocument getSmilDocument(PduPart smilPart) {
    try {
        byte[] data = smilPart.getData();
        if (data != null) {
            if (LOCAL_LOGV) {
                Log.v(TAG, "Parsing SMIL document.");
                Log.v(TAG, new String(data));
            }
            ByteArrayInputStream bais = new ByteArrayInputStream(data);
            SMILDocument document = new SmilXmlParser().parse(bais);
            return validate(document);
        }
    } catch (IOException e) {
        Log.e(TAG, "Failed to parse SMIL document.", e);
    } catch (SAXException e) {
        Log.e(TAG, "Failed to parse SMIL document.", e);
    } catch (MmsException e) {
        Log.e(TAG, "Failed to parse SMIL document.", e);
    }
    return null;
}
Also used : MmsException(com.google.android.mms.MmsException) SMILDocument(org.w3c.dom.smil.SMILDocument) ByteArrayInputStream(java.io.ByteArrayInputStream) SmilXmlParser(com.android.mms.dom.smil.parser.SmilXmlParser) IOException(java.io.IOException) SAXException(org.xml.sax.SAXException)

Example 2 with SmilXmlParser

use of com.android.mms.dom.smil.parser.SmilXmlParser in project android-aosp-mms by slvn.

the class SmilHelper method getSmilDocument.

/**
 * Parse SMIL message and retrieve SMILDocument.
 *
 * @return A SMILDocument or null if parsing failed.
 */
private static SMILDocument getSmilDocument(PduPart smilPart) {
    try {
        byte[] data = smilPart.getData();
        if (data != null) {
            if (LOCAL_LOGV) {
                Log.v(TAG, "Parsing SMIL document.");
                Log.v(TAG, new String(data));
            }
            ByteArrayInputStream bais = new ByteArrayInputStream(data);
            SMILDocument document = new SmilXmlParser().parse(bais);
            return validate(document);
        }
    } catch (IOException e) {
        Log.e(TAG, "Failed to parse SMIL document.", e);
    } catch (SAXException e) {
        Log.e(TAG, "Failed to parse SMIL document.", e);
    } catch (MmsException e) {
        Log.e(TAG, "Failed to parse SMIL document.", e);
    }
    return null;
}
Also used : MmsException(com.google.android.mms.MmsException) SMILDocument(org.w3c.dom.smil.SMILDocument) ByteArrayInputStream(java.io.ByteArrayInputStream) SmilXmlParser(com.android.mms.dom.smil.parser.SmilXmlParser) IOException(java.io.IOException) SAXException(org.xml.sax.SAXException)

Example 3 with SmilXmlParser

use of com.android.mms.dom.smil.parser.SmilXmlParser in project opencast by opencast.

the class PartialImportWorkflowOperationHandler method getSmilDocument.

/**
 * Get the SMIL document from a catalog.
 */
private SMILDocument getSmilDocument(final Catalog smilCatalog) throws WorkflowOperationException {
    FileInputStream in = null;
    try {
        File smilXmlFile = workspace.get(smilCatalog.getURI());
        SmilXmlParser smilParser = new SmilXmlParser();
        in = new FileInputStream(smilXmlFile);
        return smilParser.parse(in);
    } catch (Exception e) {
        logger.error("Unable to parse smil catalog {}! {}", smilCatalog.getURI(), e);
        throw new WorkflowOperationException(e);
    } finally {
        IOUtils.closeQuietly(in);
    }
}
Also used : SmilXmlParser(com.android.mms.dom.smil.parser.SmilXmlParser) WorkflowOperationException(org.opencastproject.workflow.api.WorkflowOperationException) File(java.io.File) FileInputStream(java.io.FileInputStream) ServiceRegistryException(org.opencastproject.serviceregistry.api.ServiceRegistryException) WorkflowOperationException(org.opencastproject.workflow.api.WorkflowOperationException) MediaPackageException(org.opencastproject.mediapackage.MediaPackageException) NotFoundException(org.opencastproject.util.NotFoundException) IOException(java.io.IOException) EncoderException(org.opencastproject.composer.api.EncoderException)

Aggregations

SmilXmlParser (com.android.mms.dom.smil.parser.SmilXmlParser)3 IOException (java.io.IOException)3 MmsException (com.google.android.mms.MmsException)2 ByteArrayInputStream (java.io.ByteArrayInputStream)2 SMILDocument (org.w3c.dom.smil.SMILDocument)2 SAXException (org.xml.sax.SAXException)2 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 EncoderException (org.opencastproject.composer.api.EncoderException)1 MediaPackageException (org.opencastproject.mediapackage.MediaPackageException)1 ServiceRegistryException (org.opencastproject.serviceregistry.api.ServiceRegistryException)1 NotFoundException (org.opencastproject.util.NotFoundException)1 WorkflowOperationException (org.opencastproject.workflow.api.WorkflowOperationException)1