Search in sources :

Example 1 with ExVideoContainer

use of org.apache.poi.hslf.record.ExVideoContainer in project poi by apache.

the class MovieShape method getPath.

/**
     * @return UNC or local path to a video file
     */
@SuppressWarnings("resource")
public String getPath() {
    ExObjRefAtom oe = getClientDataRecord(RecordTypes.ExObjRefAtom.typeID);
    int idx = oe.getExObjIdRef();
    HSLFSlideShow ppt = getSheet().getSlideShow();
    ExObjList lst = (ExObjList) ppt.getDocumentRecord().findFirstOfType(RecordTypes.ExObjList.typeID);
    if (lst == null) {
        return null;
    }
    Record[] r = lst.getChildRecords();
    for (int i = 0; i < r.length; i++) {
        if (r[i] instanceof ExMCIMovie) {
            ExMCIMovie mci = (ExMCIMovie) r[i];
            ExVideoContainer exVideo = mci.getExVideo();
            int objectId = exVideo.getExMediaAtom().getObjectId();
            if (objectId == idx) {
                return exVideo.getPathAtom().getText();
            }
        }
    }
    return null;
}
Also used : ExObjList(org.apache.poi.hslf.record.ExObjList) ExObjRefAtom(org.apache.poi.hslf.record.ExObjRefAtom) HSLFEscherClientDataRecord(org.apache.poi.hslf.record.HSLFEscherClientDataRecord) Record(org.apache.poi.hslf.record.Record) EscherContainerRecord(org.apache.poi.ddf.EscherContainerRecord) HSLFSlideShow(org.apache.poi.hslf.usermodel.HSLFSlideShow) ExVideoContainer(org.apache.poi.hslf.record.ExVideoContainer) ExMCIMovie(org.apache.poi.hslf.record.ExMCIMovie)

Aggregations

EscherContainerRecord (org.apache.poi.ddf.EscherContainerRecord)1 ExMCIMovie (org.apache.poi.hslf.record.ExMCIMovie)1 ExObjList (org.apache.poi.hslf.record.ExObjList)1 ExObjRefAtom (org.apache.poi.hslf.record.ExObjRefAtom)1 ExVideoContainer (org.apache.poi.hslf.record.ExVideoContainer)1 HSLFEscherClientDataRecord (org.apache.poi.hslf.record.HSLFEscherClientDataRecord)1 Record (org.apache.poi.hslf.record.Record)1 HSLFSlideShow (org.apache.poi.hslf.usermodel.HSLFSlideShow)1