Java Code Examples for com.coremedia.iso.boxes.TrackHeaderBox#setInPreview()

The following examples show how to use com.coremedia.iso.boxes.TrackHeaderBox#setInPreview() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MP4Builder.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
protected TrackBox createTrackBox(Track track, Mp4Movie movie) {
    TrackBox trackBox = new TrackBox();
    TrackHeaderBox tkhd = new TrackHeaderBox();

    tkhd.setEnabled(true);
    tkhd.setInMovie(true);
    tkhd.setInPreview(true);
    if (track.isAudio()) {
        tkhd.setMatrix(Matrix.ROTATE_0);
    } else {
        tkhd.setMatrix(movie.getMatrix());
    }
    tkhd.setAlternateGroup(0);
    tkhd.setCreationTime(track.getCreationTime());
    tkhd.setDuration(track.getDuration() * getTimescale(movie) / track.getTimeScale());
    tkhd.setHeight(track.getHeight());
    tkhd.setWidth(track.getWidth());
    tkhd.setLayer(0);
    tkhd.setModificationTime(new Date());
    tkhd.setTrackId(track.getTrackId() + 1);
    tkhd.setVolume(track.getVolume());

    trackBox.addBox(tkhd);

    MediaBox mdia = new MediaBox();
    trackBox.addBox(mdia);
    MediaHeaderBox mdhd = new MediaHeaderBox();
    mdhd.setCreationTime(track.getCreationTime());
    mdhd.setDuration(track.getDuration());
    mdhd.setTimescale(track.getTimeScale());
    mdhd.setLanguage("eng");
    mdia.addBox(mdhd);
    HandlerBox hdlr = new HandlerBox();
    hdlr.setName(track.isAudio() ? "SoundHandle" : "VideoHandle");
    hdlr.setHandlerType(track.getHandler());

    mdia.addBox(hdlr);

    MediaInformationBox minf = new MediaInformationBox();
    minf.addBox(track.getMediaHeaderBox());

    DataInformationBox dinf = new DataInformationBox();
    DataReferenceBox dref = new DataReferenceBox();
    dinf.addBox(dref);
    DataEntryUrlBox url = new DataEntryUrlBox();
    url.setFlags(1);
    dref.addBox(url);
    minf.addBox(dinf);

    Box stbl = createStbl(track);
    minf.addBox(stbl);
    mdia.addBox(minf);

    return trackBox;
}
 
Example 2
Source File: MP4Builder.java    From VideoCompressor with Apache License 2.0 4 votes vote down vote up
protected TrackBox createTrackBox(Track track, Mp4Movie movie) {
    TrackBox trackBox = new TrackBox();
    TrackHeaderBox tkhd = new TrackHeaderBox();

    tkhd.setEnabled(true);
    tkhd.setInMovie(true);
    tkhd.setInPreview(true);
    if (track.isAudio()) {
        tkhd.setMatrix(Matrix.ROTATE_0);
    } else {
        tkhd.setMatrix(movie.getMatrix());
    }
    tkhd.setAlternateGroup(0);
    tkhd.setCreationTime(track.getCreationTime());
    tkhd.setDuration(track.getDuration() * getTimescale(movie) / track.getTimeScale());
    tkhd.setHeight(track.getHeight());
    tkhd.setWidth(track.getWidth());
    tkhd.setLayer(0);
    tkhd.setModificationTime(new Date());
    tkhd.setTrackId(track.getTrackId() + 1);
    tkhd.setVolume(track.getVolume());

    trackBox.addBox(tkhd);

    MediaBox mdia = new MediaBox();
    trackBox.addBox(mdia);
    MediaHeaderBox mdhd = new MediaHeaderBox();
    mdhd.setCreationTime(track.getCreationTime());
    mdhd.setDuration(track.getDuration());
    mdhd.setTimescale(track.getTimeScale());
    mdhd.setLanguage("eng");
    mdia.addBox(mdhd);
    HandlerBox hdlr = new HandlerBox();
    hdlr.setName(track.isAudio() ? "SoundHandle" : "VideoHandle");
    hdlr.setHandlerType(track.getHandler());

    mdia.addBox(hdlr);

    MediaInformationBox minf = new MediaInformationBox();
    minf.addBox(track.getMediaHeaderBox());

    DataInformationBox dinf = new DataInformationBox();
    DataReferenceBox dref = new DataReferenceBox();
    dinf.addBox(dref);
    DataEntryUrlBox url = new DataEntryUrlBox();
    url.setFlags(1);
    dref.addBox(url);
    minf.addBox(dinf);

    Box stbl = createStbl(track);
    minf.addBox(stbl);
    mdia.addBox(minf);

    return trackBox;
}
 
Example 3
Source File: MP4Builder.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
protected TrackBox createTrackBox(Track track, Mp4Movie movie) {
    TrackBox trackBox = new TrackBox();
    TrackHeaderBox tkhd = new TrackHeaderBox();

    tkhd.setEnabled(true);
    tkhd.setInMovie(true);
    tkhd.setInPreview(true);
    if (track.isAudio()) {
        tkhd.setMatrix(Matrix.ROTATE_0);
    } else {
        tkhd.setMatrix(movie.getMatrix());
    }
    tkhd.setAlternateGroup(0);
    tkhd.setCreationTime(track.getCreationTime());
    tkhd.setDuration(track.getDuration() * getTimescale(movie) / track.getTimeScale());
    tkhd.setHeight(track.getHeight());
    tkhd.setWidth(track.getWidth());
    tkhd.setLayer(0);
    tkhd.setModificationTime(new Date());
    tkhd.setTrackId(track.getTrackId() + 1);
    tkhd.setVolume(track.getVolume());

    trackBox.addBox(tkhd);

    MediaBox mdia = new MediaBox();
    trackBox.addBox(mdia);
    MediaHeaderBox mdhd = new MediaHeaderBox();
    mdhd.setCreationTime(track.getCreationTime());
    mdhd.setDuration(track.getDuration());
    mdhd.setTimescale(track.getTimeScale());
    mdhd.setLanguage("eng");
    mdia.addBox(mdhd);
    HandlerBox hdlr = new HandlerBox();
    hdlr.setName(track.isAudio() ? "SoundHandle" : "VideoHandle");
    hdlr.setHandlerType(track.getHandler());

    mdia.addBox(hdlr);

    MediaInformationBox minf = new MediaInformationBox();
    minf.addBox(track.getMediaHeaderBox());

    DataInformationBox dinf = new DataInformationBox();
    DataReferenceBox dref = new DataReferenceBox();
    dinf.addBox(dref);
    DataEntryUrlBox url = new DataEntryUrlBox();
    url.setFlags(1);
    dref.addBox(url);
    minf.addBox(dinf);

    Box stbl = createStbl(track);
    minf.addBox(stbl);
    mdia.addBox(minf);

    return trackBox;
}
 
Example 4
Source File: MP4Builder.java    From react-native-video-helper with MIT License 4 votes vote down vote up
protected TrackBox createTrackBox(Track track, Mp4Movie movie) {
    TrackBox trackBox = new TrackBox();
    TrackHeaderBox tkhd = new TrackHeaderBox();

    tkhd.setEnabled(true);
    tkhd.setInMovie(true);
    tkhd.setInPreview(true);
    if (track.isAudio()) {
        tkhd.setMatrix(Matrix.ROTATE_0);
    } else {
        tkhd.setMatrix(movie.getMatrix());
    }
    tkhd.setAlternateGroup(0);
    tkhd.setCreationTime(track.getCreationTime());
    tkhd.setDuration(track.getDuration() * getTimescale(movie) / track.getTimeScale());
    tkhd.setHeight(track.getHeight());
    tkhd.setWidth(track.getWidth());
    tkhd.setLayer(0);
    tkhd.setModificationTime(new Date());
    tkhd.setTrackId(track.getTrackId() + 1);
    tkhd.setVolume(track.getVolume());

    trackBox.addBox(tkhd);

    MediaBox mdia = new MediaBox();
    trackBox.addBox(mdia);
    MediaHeaderBox mdhd = new MediaHeaderBox();
    mdhd.setCreationTime(track.getCreationTime());
    mdhd.setDuration(track.getDuration());
    mdhd.setTimescale(track.getTimeScale());
    mdhd.setLanguage("eng");
    mdia.addBox(mdhd);
    HandlerBox hdlr = new HandlerBox();
    hdlr.setName(track.isAudio() ? "SoundHandle" : "VideoHandle");
    hdlr.setHandlerType(track.getHandler());

    mdia.addBox(hdlr);

    MediaInformationBox minf = new MediaInformationBox();
    minf.addBox(track.getMediaHeaderBox());

    DataInformationBox dinf = new DataInformationBox();
    DataReferenceBox dref = new DataReferenceBox();
    dinf.addBox(dref);
    DataEntryUrlBox url = new DataEntryUrlBox();
    url.setFlags(1);
    dref.addBox(url);
    minf.addBox(dinf);

    Box stbl = createStbl(track);
    minf.addBox(stbl);
    mdia.addBox(minf);

    return trackBox;
}
 
Example 5
Source File: MP4Builder.java    From VideoCompressor with Apache License 2.0 4 votes vote down vote up
protected TrackBox createTrackBox(Track track, Mp4Movie movie) {
    TrackBox trackBox = new TrackBox();
    TrackHeaderBox tkhd = new TrackHeaderBox();

    tkhd.setEnabled(true);
    tkhd.setInMovie(true);
    tkhd.setInPreview(true);
    if (track.isAudio()) {
        tkhd.setMatrix(Matrix.ROTATE_0);
    } else {
        tkhd.setMatrix(movie.getMatrix());
    }
    tkhd.setAlternateGroup(0);
    tkhd.setCreationTime(track.getCreationTime());
    tkhd.setDuration(track.getDuration() * getTimescale(movie) / track.getTimeScale());
    tkhd.setHeight(track.getHeight());
    tkhd.setWidth(track.getWidth());
    tkhd.setLayer(0);
    tkhd.setModificationTime(new Date());
    tkhd.setTrackId(track.getTrackId() + 1);
    tkhd.setVolume(track.getVolume());

    trackBox.addBox(tkhd);

    MediaBox mdia = new MediaBox();
    trackBox.addBox(mdia);
    MediaHeaderBox mdhd = new MediaHeaderBox();
    mdhd.setCreationTime(track.getCreationTime());
    mdhd.setDuration(track.getDuration());
    mdhd.setTimescale(track.getTimeScale());
    mdhd.setLanguage("eng");
    mdia.addBox(mdhd);
    HandlerBox hdlr = new HandlerBox();
    hdlr.setName(track.isAudio() ? "SoundHandle" : "VideoHandle");
    hdlr.setHandlerType(track.getHandler());

    mdia.addBox(hdlr);

    MediaInformationBox minf = new MediaInformationBox();
    minf.addBox(track.getMediaHeaderBox());

    DataInformationBox dinf = new DataInformationBox();
    DataReferenceBox dref = new DataReferenceBox();
    dinf.addBox(dref);
    DataEntryUrlBox url = new DataEntryUrlBox();
    url.setFlags(1);
    dref.addBox(url);
    minf.addBox(dinf);

    Box stbl = createStbl(track);
    minf.addBox(stbl);
    mdia.addBox(minf);

    return trackBox;
}
 
Example 6
Source File: MP4Builder.java    From talk-android with MIT License 4 votes vote down vote up
protected TrackBox createTrackBox(Track track, Mp4Movie movie) {
    TrackBox trackBox = new TrackBox();
    TrackHeaderBox tkhd = new TrackHeaderBox();

    tkhd.setEnabled(true);
    tkhd.setInMovie(true);
    tkhd.setInPreview(true);
    if (track.isAudio()) {
        tkhd.setMatrix(Matrix.ROTATE_0);
    } else {
        tkhd.setMatrix(movie.getMatrix());
    }
    tkhd.setAlternateGroup(0);
    tkhd.setCreationTime(track.getCreationTime());
    tkhd.setDuration(track.getDuration() * getTimescale(movie) / track.getTimeScale());
    tkhd.setHeight(track.getHeight());
    tkhd.setWidth(track.getWidth());
    tkhd.setLayer(0);
    tkhd.setModificationTime(new Date());
    tkhd.setTrackId(track.getTrackId() + 1);
    tkhd.setVolume(track.getVolume());

    trackBox.addBox(tkhd);

    MediaBox mdia = new MediaBox();
    trackBox.addBox(mdia);
    MediaHeaderBox mdhd = new MediaHeaderBox();
    mdhd.setCreationTime(track.getCreationTime());
    mdhd.setDuration(track.getDuration());
    mdhd.setTimescale(track.getTimeScale());
    mdhd.setLanguage("eng");
    mdia.addBox(mdhd);
    HandlerBox hdlr = new HandlerBox();
    hdlr.setName(track.isAudio() ? "SoundHandle" : "VideoHandle");
    hdlr.setHandlerType(track.getHandler());

    mdia.addBox(hdlr);

    MediaInformationBox minf = new MediaInformationBox();
    minf.addBox(track.getMediaHeaderBox());

    DataInformationBox dinf = new DataInformationBox();
    DataReferenceBox dref = new DataReferenceBox();
    dinf.addBox(dref);
    DataEntryUrlBox url = new DataEntryUrlBox();
    url.setFlags(1);
    dref.addBox(url);
    minf.addBox(dinf);

    Box stbl = createStbl(track);
    minf.addBox(stbl);
    mdia.addBox(minf);

    return trackBox;
}
 
Example 7
Source File: MP4Builder.java    From SiliCompressor with Apache License 2.0 4 votes vote down vote up
protected TrackBox createTrackBox(Track track, Mp4Movie movie) {
    TrackBox trackBox = new TrackBox();
    TrackHeaderBox tkhd = new TrackHeaderBox();

    tkhd.setEnabled(true);
    tkhd.setInMovie(true);
    tkhd.setInPreview(true);
    if (track.isAudio()) {
        tkhd.setMatrix(Matrix.ROTATE_0);
    } else {
        tkhd.setMatrix(movie.getMatrix());
    }
    tkhd.setAlternateGroup(0);
    tkhd.setCreationTime(track.getCreationTime());
    tkhd.setDuration(track.getDuration() * getTimescale(movie) / track.getTimeScale());
    tkhd.setHeight(track.getHeight());
    tkhd.setWidth(track.getWidth());
    tkhd.setLayer(0);
    tkhd.setModificationTime(new Date());
    tkhd.setTrackId(track.getTrackId() + 1);
    tkhd.setVolume(track.getVolume());

    trackBox.addBox(tkhd);

    MediaBox mdia = new MediaBox();
    trackBox.addBox(mdia);
    MediaHeaderBox mdhd = new MediaHeaderBox();
    mdhd.setCreationTime(track.getCreationTime());
    mdhd.setDuration(track.getDuration());
    mdhd.setTimescale(track.getTimeScale());
    mdhd.setLanguage("eng");
    mdia.addBox(mdhd);
    HandlerBox hdlr = new HandlerBox();
    hdlr.setName(track.isAudio() ? "SoundHandle" : "VideoHandle");
    hdlr.setHandlerType(track.getHandler());

    mdia.addBox(hdlr);

    MediaInformationBox minf = new MediaInformationBox();
    minf.addBox(track.getMediaHeaderBox());

    DataInformationBox dinf = new DataInformationBox();
    DataReferenceBox dref = new DataReferenceBox();
    dinf.addBox(dref);
    DataEntryUrlBox url = new DataEntryUrlBox();
    url.setFlags(1);
    dref.addBox(url);
    minf.addBox(dinf);

    Box stbl = createStbl(track);
    minf.addBox(stbl);
    mdia.addBox(minf);

    return trackBox;
}
 
Example 8
Source File: MP4Builder.java    From deltachat-android with GNU General Public License v3.0 4 votes vote down vote up
protected TrackBox createTrackBox(Track track, Mp4Movie movie) {
    TrackBox trackBox = new TrackBox();
    TrackHeaderBox tkhd = new TrackHeaderBox();

    tkhd.setEnabled(true);
    tkhd.setInMovie(true);
    tkhd.setInPreview(true);
    if (track.isAudio()) {
        tkhd.setMatrix(Matrix.ROTATE_0);
    } else {
        tkhd.setMatrix(movie.getMatrix());
    }
    tkhd.setAlternateGroup(0);
    tkhd.setCreationTime(track.getCreationTime());
    tkhd.setDuration(track.getDuration() * getTimescale(movie) / track.getTimeScale());
    tkhd.setHeight(track.getHeight());
    tkhd.setWidth(track.getWidth());
    tkhd.setLayer(0);
    tkhd.setModificationTime(new Date());
    tkhd.setTrackId(track.getTrackId() + 1);
    tkhd.setVolume(track.getVolume());

    trackBox.addBox(tkhd);

    MediaBox mdia = new MediaBox();
    trackBox.addBox(mdia);
    MediaHeaderBox mdhd = new MediaHeaderBox();
    mdhd.setCreationTime(track.getCreationTime());
    mdhd.setDuration(track.getDuration());
    mdhd.setTimescale(track.getTimeScale());
    mdhd.setLanguage("eng");
    mdia.addBox(mdhd);
    HandlerBox hdlr = new HandlerBox();
    hdlr.setName(track.isAudio() ? "SoundHandle" : "VideoHandle");
    hdlr.setHandlerType(track.getHandler());

    mdia.addBox(hdlr);

    MediaInformationBox minf = new MediaInformationBox();
    minf.addBox(track.getMediaHeaderBox());

    DataInformationBox dinf = new DataInformationBox();
    DataReferenceBox dref = new DataReferenceBox();
    dinf.addBox(dref);
    DataEntryUrlBox url = new DataEntryUrlBox();
    url.setFlags(1);
    dref.addBox(url);
    minf.addBox(dinf);

    Box stbl = createStbl(track);
    minf.addBox(stbl);
    mdia.addBox(minf);

    return trackBox;
}
 
Example 9
Source File: MP4Builder.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
protected TrackBox createTrackBox(Track track, Mp4Movie movie) {
    TrackBox trackBox = new TrackBox();
    TrackHeaderBox tkhd = new TrackHeaderBox();

    tkhd.setEnabled(true);
    tkhd.setInMovie(true);
    tkhd.setInPreview(true);
    if (track.isAudio()) {
        tkhd.setMatrix(Matrix.ROTATE_0);
    } else {
        tkhd.setMatrix(movie.getMatrix());
    }
    tkhd.setAlternateGroup(0);
    tkhd.setCreationTime(track.getCreationTime());
    tkhd.setDuration(track.getDuration() * getTimescale(movie) / track.getTimeScale());
    tkhd.setHeight(track.getHeight());
    tkhd.setWidth(track.getWidth());
    tkhd.setLayer(0);
    tkhd.setModificationTime(new Date());
    tkhd.setTrackId(track.getTrackId() + 1);
    tkhd.setVolume(track.getVolume());

    trackBox.addBox(tkhd);

    MediaBox mdia = new MediaBox();
    trackBox.addBox(mdia);
    MediaHeaderBox mdhd = new MediaHeaderBox();
    mdhd.setCreationTime(track.getCreationTime());
    mdhd.setDuration(track.getDuration());
    mdhd.setTimescale(track.getTimeScale());
    mdhd.setLanguage("eng");
    mdia.addBox(mdhd);
    HandlerBox hdlr = new HandlerBox();
    hdlr.setName(track.isAudio() ? "SoundHandle" : "VideoHandle");
    hdlr.setHandlerType(track.getHandler());

    mdia.addBox(hdlr);

    MediaInformationBox minf = new MediaInformationBox();
    minf.addBox(track.getMediaHeaderBox());

    DataInformationBox dinf = new DataInformationBox();
    DataReferenceBox dref = new DataReferenceBox();
    dinf.addBox(dref);
    DataEntryUrlBox url = new DataEntryUrlBox();
    url.setFlags(1);
    dref.addBox(url);
    minf.addBox(dinf);

    Box stbl = createStbl(track);
    minf.addBox(stbl);
    mdia.addBox(minf);

    return trackBox;
}
 
Example 10
Source File: MP4Builder.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
protected TrackBox createTrackBox(Track track, Mp4Movie movie) {
    TrackBox trackBox = new TrackBox();
    TrackHeaderBox tkhd = new TrackHeaderBox();

    tkhd.setEnabled(true);
    tkhd.setInMovie(true);
    tkhd.setInPreview(true);
    if (track.isAudio()) {
        tkhd.setMatrix(Matrix.ROTATE_0);
    } else {
        tkhd.setMatrix(movie.getMatrix());
    }
    tkhd.setAlternateGroup(0);
    tkhd.setCreationTime(track.getCreationTime());
    tkhd.setDuration(track.getDuration() * getTimescale(movie) / track.getTimeScale());
    tkhd.setHeight(track.getHeight());
    tkhd.setWidth(track.getWidth());
    tkhd.setLayer(0);
    tkhd.setModificationTime(new Date());
    tkhd.setTrackId(track.getTrackId() + 1);
    tkhd.setVolume(track.getVolume());

    trackBox.addBox(tkhd);

    MediaBox mdia = new MediaBox();
    trackBox.addBox(mdia);
    MediaHeaderBox mdhd = new MediaHeaderBox();
    mdhd.setCreationTime(track.getCreationTime());
    mdhd.setDuration(track.getDuration());
    mdhd.setTimescale(track.getTimeScale());
    mdhd.setLanguage("eng");
    mdia.addBox(mdhd);
    HandlerBox hdlr = new HandlerBox();
    hdlr.setName(track.isAudio() ? "SoundHandle" : "VideoHandle");
    hdlr.setHandlerType(track.getHandler());

    mdia.addBox(hdlr);

    MediaInformationBox minf = new MediaInformationBox();
    minf.addBox(track.getMediaHeaderBox());

    DataInformationBox dinf = new DataInformationBox();
    DataReferenceBox dref = new DataReferenceBox();
    dinf.addBox(dref);
    DataEntryUrlBox url = new DataEntryUrlBox();
    url.setFlags(1);
    dref.addBox(url);
    minf.addBox(dinf);

    Box stbl = createStbl(track);
    minf.addBox(stbl);
    mdia.addBox(minf);

    return trackBox;
}