当前位置: 首页>>代码示例>>Java>>正文


Java Box类代码示例

本文整理汇总了Java中com.coremedia.iso.boxes.Box的典型用法代码示例。如果您正苦于以下问题:Java Box类的具体用法?Java Box怎么用?Java Box使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Box类属于com.coremedia.iso.boxes包,在下文中一共展示了Box类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: finishMovie

import com.coremedia.iso.boxes.Box; //导入依赖的package包/类
public void finishMovie(boolean error) throws Exception {
    if (mdat.getContentSize() != 0) {
        flushCurrentMdat();
    }

    for (Track track : currentMp4Movie.getTracks()) {
        List<Sample> samples = track.getSamples();
        long[] sizes = new long[samples.size()];
        for (int i = 0; i < sizes.length; i++) {
            sizes[i] = samples.get(i).getSize();
        }
        track2SampleSizes.put(track, sizes);
    }

    Box moov = createMovieBox(currentMp4Movie);
    moov.getBox(fc);
    fos.flush();

    fc.close();
    fos.close();
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:22,代码来源:MP4Builder.java

示例2: getBoxes

import com.coremedia.iso.boxes.Box; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public <T extends Box> List<T> getBoxes(Class<T> clazz, boolean recursive) {
    List<T> boxesToBeReturned = new ArrayList<T>(2);
    for (Box boxe : boxes) { //clazz.isInstance(boxe) / clazz == boxe.getClass()?
        if (clazz == boxe.getClass()) {
            boxesToBeReturned.add((T) boxe);
        }

        if (recursive && boxe instanceof ContainerBox) {
            boxesToBeReturned.addAll((((ContainerBox) boxe).getBoxes(clazz, recursive)));
        }
    }
    // Optimize here! Spare object creation work on arrays directly! System.arrayCopy
    return boxesToBeReturned;
    //return (T[]) boxesToBeReturned.toArray();
}
 
开发者ID:begeekmyfriend,项目名称:mp4parser_android,代码行数:17,代码来源:FullContainerBox.java

示例3: getBoxes

import com.coremedia.iso.boxes.Box; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public <T extends Box> List<T> getBoxes(Class<T> clazz, boolean recursive) {
    List<T> boxesToBeReturned = new ArrayList<T>(2);
    for (Box boxe : boxes) {
        //clazz.isInstance(boxe) / clazz == boxe.getClass()?
        // I hereby finally decide to use isInstance

        if (clazz.isInstance(boxe)) {
            boxesToBeReturned.add((T) boxe);
        }

        if (recursive && boxe instanceof ContainerBox) {
            boxesToBeReturned.addAll(((ContainerBox) boxe).getBoxes(clazz, recursive));
        }
    }
    return boxesToBeReturned;
}
 
开发者ID:begeekmyfriend,项目名称:mp4parser_android,代码行数:18,代码来源:AbstractContainerBox.java

示例4: parse

import com.coremedia.iso.boxes.Box; //导入依赖的package包/类
private void parse() throws IOException {

        boolean done = false;
        while (!done) {
            try {
                Box box = boxParser.parseBox(byteChannel, this);
                if (box != null) {
                    //  System.err.println(box.getType());
                    boxes.add(box);
                } else {
                    done = true;
                }
            } catch (EOFException e) {
                done = true;
            }
        }
    }
 
开发者ID:lisnstatic,项目名称:live_master,代码行数:18,代码来源:IsoFile.java

示例5: getBoxes

import com.coremedia.iso.boxes.Box; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public <T extends Box> List<T> getBoxes(Class<T> clazz, boolean recursive) {
    List<T> boxesToBeReturned = new ArrayList<T>(2);
    for (Box boxe : boxes) { //clazz.isInstance(boxe) / clazz == boxe.getClass()?
        if (clazz == boxe.getClass()) {
            boxesToBeReturned.add((T) boxe);
        }

        if (recursive && boxe instanceof ContainerBox) {
            boxesToBeReturned.addAll(((ContainerBox) boxe).getBoxes(clazz, recursive));
        }
    }
    // Optimize here! Spare object creation work on arrays directly! System.arrayCopy
    return boxesToBeReturned;
    //return (T[]) boxesToBeReturned.toArray();
}
 
开发者ID:lisnstatic,项目名称:live_master,代码行数:17,代码来源:SampleEntry.java

示例6: createTrex

import com.coremedia.iso.boxes.Box; //导入依赖的package包/类
protected Box createTrex(Movie movie, Track track) {
    TrackExtendsBox trex = new TrackExtendsBox();
    trex.setTrackId(track.getTrackMetaData().getTrackId());
    trex.setDefaultSampleDescriptionIndex(1);
    trex.setDefaultSampleDuration(0);
    trex.setDefaultSampleSize(0);
    SampleFlags sf = new SampleFlags();
    if ("soun".equals(track.getHandler())) {
        // as far as I know there is no audio encoding
        // where the sample are not self contained.
        sf.setSampleDependsOn(2);
        sf.setSampleIsDependedOn(2);
    }
    trex.setDefaultSampleFlags(sf);
    return trex;
}
 
开发者ID:lisnstatic,项目名称:live_master,代码行数:17,代码来源:FragmentedMp4Builder.java

示例7: initIsoFile

import com.coremedia.iso.boxes.Box; //导入依赖的package包/类
private void initIsoFile(IsoFile isoFile) {
    this.isoFile = isoFile;
    // find all mdats first to be able to use them later with explicitly looking them up
    long currentOffset = 0;
    LinkedList<MediaDataBox> mdats = new LinkedList<MediaDataBox>();
    for (Box b : this.isoFile.getBoxes()) {
        long currentSize = b.getSize();
        if ("mdat".equals(b.getType())) {
            if (b instanceof MediaDataBox) {
                long contentOffset = currentOffset + ((MediaDataBox) b).getHeader().limit();
                mdatStartCache.put((MediaDataBox) b, contentOffset);
                mdatEndCache.put((MediaDataBox) b, contentOffset + currentSize);
                mdats.add((MediaDataBox) b);
            } else {
                throw new RuntimeException("Sample need to be in mdats and mdats need to be instanceof MediaDataBox");
            }
        }
        currentOffset += currentSize;
    }
    this.mdats = mdats.toArray(new MediaDataBox[mdats.size()]);
}
 
开发者ID:lisnstatic,项目名称:live_master,代码行数:22,代码来源:SampleList.java

示例8: createStbl

import com.coremedia.iso.boxes.Box; //导入依赖的package包/类
protected Box createStbl(Track track) {
    SampleTableBox stbl = new SampleTableBox();

    createStsd(track, stbl);
    createStts(track, stbl);
    createStss(track, stbl);
    createStsc(track, stbl);
    createStsz(track, stbl);
    createStco(track, stbl);

    return stbl;
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:13,代码来源:MP4Builder.java

示例9: getContentSize

import com.coremedia.iso.boxes.Box; //导入依赖的package包/类
protected long getContentSize() {
    long contentSize = 4; // flags and version
    for (Box boxe : boxes) {
        contentSize += boxe.getSize();
    }
    return contentSize;
}
 
开发者ID:begeekmyfriend,项目名称:mp4parser_android,代码行数:8,代码来源:FullContainerBox.java

示例10: getContentSize

import com.coremedia.iso.boxes.Box; //导入依赖的package包/类
protected long getContentSize() {
    long contentSize = 18;
    contentSize += boxRecord.getSize();
    contentSize += styleRecord.getSize();
    for (Box boxe : boxes) {
        contentSize += boxe.getSize();
    }
    return contentSize;
}
 
开发者ID:lisnstatic,项目名称:live_master,代码行数:10,代码来源:TextSampleEntry.java

示例11: writeChildBoxes

import com.coremedia.iso.boxes.Box; //导入依赖的package包/类
protected final void writeChildBoxes(ByteBuffer bb) {
    WritableByteChannel wbc = new ByteBufferByteChannel(bb);
    for (Box box : boxes) {
        try {
            box.getBox(wbc);
        } catch (IOException e) {
            // cannot happen since my WritableByteChannel won't throw any excpetion
            throw new RuntimeException("Cannot happen.", e);
        }

    }
}
 
开发者ID:begeekmyfriend,项目名称:mp4parser_android,代码行数:13,代码来源:FullContainerBox.java

示例12: getContentSize

import com.coremedia.iso.boxes.Box; //导入依赖的package包/类
@Override
protected long getContentSize() {
    long size = 8;

    for (Box box : boxes) {
        size += box.getSize();
    }
    size += vc1Content.length;
    return size;
}
 
开发者ID:lisnstatic,项目名称:live_master,代码行数:11,代码来源:Ovc1VisualSampleEntryImpl.java

示例13: getContentSize

import com.coremedia.iso.boxes.Box; //导入依赖的package包/类
@Override
protected long getContentSize() {
    long contentSize = 0;
    for (Box boxe : boxes) {
        contentSize += boxe.getSize();
    }
    return contentSize;
}
 
开发者ID:begeekmyfriend,项目名称:mp4parser_android,代码行数:9,代码来源:AbstractContainerBox.java

示例14: createStbl

import com.coremedia.iso.boxes.Box; //导入依赖的package包/类
private Box createStbl(Track track) {
    SampleTableBox stbl = new SampleTableBox();
    createStsd(track, stbl);
    createStts(track, stbl);
    createStss(track, stbl);
    createStsc(track, stbl);
    createStsz(track, stbl);
    createStco(track, stbl);
    return stbl;
}
 
开发者ID:lisnstatic,项目名称:live_master,代码行数:11,代码来源:SrsMp4Muxer.java

示例15: getBoxes

import com.coremedia.iso.boxes.Box; //导入依赖的package包/类
public <T extends Box> List<T> getBoxes(Class<T> clazz, boolean recursive) {
    //todo recursive?
    if (clazz.isAssignableFrom(appleDataBox.getClass())) {
        return (List<T>) Collections.singletonList(appleDataBox);
    }
    return null;
}
 
开发者ID:lisnstatic,项目名称:live_master,代码行数:8,代码来源:AbstractAppleMetaDataBox.java


注:本文中的com.coremedia.iso.boxes.Box类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。