• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java IsoFile类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getBox

import com.coremedia.iso.IsoFile; //导入依赖的package包/类
public void getBox(WritableByteChannel writableByteChannel) throws IOException {
    ByteBuffer bb = ByteBuffer.allocate(16);
    long size = getSize();
    if (isSmallBox(size)) {
        IsoTypeWriter.writeUInt32(bb, size);
    } else {
        IsoTypeWriter.writeUInt32(bb, 1);
    }
    bb.put(IsoFile.fourCCtoBytes("mdat"));
    if (isSmallBox(size)) {
        bb.put(new byte[8]);
    } else {
        IsoTypeWriter.writeUInt64(bb, size);
    }
    bb.rewind();
    writableByteChannel.write(bb);
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:18,代码来源:MP4Builder.java


示例2: build

import com.coremedia.iso.IsoFile; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public IsoFile build(Movie movie) {
    LOG.fine("Creating movie " + movie);
    IsoFile isoFile = new IsoFile();


    isoFile.addBox(createFtyp(movie));
    isoFile.addBox(createMoov(movie));

    for (Box box : createMoofMdat(movie)) {
        isoFile.addBox(box);
    }
    isoFile.addBox(createMfra(movie, isoFile));

    return isoFile;
}
 
开发者ID:begeekmyfriend,项目名称:mp4parser_android,代码行数:19,代码来源:FragmentedMp4Builder.java


示例3: initIsoFile

import com.coremedia.iso.IsoFile; //导入依赖的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:begeekmyfriend,项目名称:mp4parser_android,代码行数:22,代码来源:SampleList.java


示例4: getContent

import com.coremedia.iso.IsoFile; //导入依赖的package包/类
@Override
protected void getContent(ByteBuffer byteBuffer) {
    writeVersionAndFlags(byteBuffer);
    if ((getFlags() & 1) == 1) {
        byteBuffer.put(IsoFile.fourCCtoBytes(auxInfoType));
        byteBuffer.put(IsoFile.fourCCtoBytes(auxInfoTypeParameter));
    }

    IsoTypeWriter.writeUInt8(byteBuffer, defaultSampleInfoSize);

    if (defaultSampleInfoSize == 0) {
        IsoTypeWriter.writeUInt32(byteBuffer, sampleInfoSizes.size());
        for (short sampleInfoSize : sampleInfoSizes) {
            IsoTypeWriter.writeUInt8(byteBuffer, sampleInfoSize);
        }
    } else {
        IsoTypeWriter.writeUInt32(byteBuffer, sampleCount);
    }
}
 
开发者ID:begeekmyfriend,项目名称:mp4parser_android,代码行数:20,代码来源:SampleAuxiliaryInformationSizesBox.java


示例5: getBox

import com.coremedia.iso.IsoFile; //导入依赖的package包/类
public void getBox(WritableByteChannel writableByteChannel) throws IOException {
    header = ByteBuffer.allocate(16);
    long size = getSize();
    if (isSmallBox(size)) {
        IsoTypeWriter.writeUInt32(header, size);
    } else {
        IsoTypeWriter.writeUInt32(header, 1);
    }
    header.put(IsoFile.fourCCtoBytes("mdat"));
    if (isSmallBox(size)) {
        header.put(new byte[8]);
    } else {
        IsoTypeWriter.writeUInt64(header, size);
    }
    header.rewind();
    writableByteChannel.write(header);
}
 
开发者ID:lisnstatic,项目名称:live_master,代码行数:18,代码来源:SrsMp4Muxer.java


示例6: trimToLast20sec

import com.coremedia.iso.IsoFile; //导入依赖的package包/类
/**
 * Shortens/Crops a track
 */
public static String trimToLast20sec(File src) throws IOException {

    IsoFile isoFile = new IsoFile(src.getAbsolutePath());
    double duration = (double)
            isoFile.getMovieBox().getMovieHeaderBox().getDuration() /
            isoFile.getMovieBox().getMovieHeaderBox().getTimescale();
    Log.d(TAG, "trimToLast20sec: " + duration);
    if (duration > 20) {
        double startTime = duration - 20;
        File dst = new File(FilesUtils.getOutputExternalMediaFile(FilesUtils.MEDIA_TYPE_VIDEO).getAbsolutePath());
        Log.d(TAG, "dst: " + dst.getAbsolutePath());
        startTrim(src, dst, startTime, duration);
        FilesUtils.removeFile(src.getAbsolutePath());
        return dst.getAbsolutePath();
    }
    return null;
}
 
开发者ID:stfalcon-studio,项目名称:patrol-android,代码行数:21,代码来源:ProcessVideoUtils.java


示例7: M4AReader

import com.coremedia.iso.IsoFile; //导入依赖的package包/类
/**
 * Creates M4A reader from file input stream, sets up metadata generation flag.
 *
 * @param f                    File input stream
 * @throws IOException on IO error
 */
public M4AReader(File f) throws IOException {
	if (null == f) {
		log.warn("Reader was passed a null file");
		log.debug("{}", ToStringBuilder.reflectionToString(this));
	}
	// create a datasource / channel
	dataSource = new FileDataSourceImpl(f);
	// instance an iso file from mp4parser
	isoFile = new IsoFile(dataSource);
	//decode all the info that we want from the atoms
	decodeHeader();
	//analyze the samples/chunks and build the keyframe meta data
	analyzeFrames();
	//add meta data
	firstTags.add(createFileMeta());
	//create / add the pre-streaming (decoder config) tags
	createPreStreamingTags();
}
 
开发者ID:Kyunghwa-Yoo,项目名称:StitchRTSP,代码行数:25,代码来源:M4AReader.java


示例8: MP4Reader

import com.coremedia.iso.IsoFile; //导入依赖的package包/类
/**
 * Creates MP4 reader from file input stream, sets up metadata generation flag.
 *
 * @param f                    File input stream
 * @throws IOException on IO exception
 */
public MP4Reader(File f) throws IOException {
	if (null == f) {
		log.warn("Reader was passed a null file");
		log.debug("{}", ToStringBuilder.reflectionToString(this));
	}
	if (f.exists() && f.canRead()) {
		// create a datasource / channel
		dataSource = new FileDataSourceImpl(f);
		// instance an iso file from mp4parser
		isoFile = new IsoFile(dataSource);
		//decode all the info that we want from the atoms
		decodeHeader();
		//analyze the samples/chunks and build the keyframe meta data
		analyzeFrames();
		//add meta data
		firstTags.add(createFileMeta());
		//create / add the pre-streaming (decoder config) tags
		createPreStreamingTags(0, false);
	} else {
		log.warn("Reader was passed an unreadable or non-existant file");
	}
}
 
开发者ID:Kyunghwa-Yoo,项目名称:StitchRTSP,代码行数:29,代码来源:MP4Reader.java


示例9: writeMovieIntoFile

import com.coremedia.iso.IsoFile; //导入依赖的package包/类
private static void writeMovieIntoFile(File dst, Movie movie)
        throws IOException {
    if (!dst.exists()) {
        dst.createNewFile();
    }

    IsoFile out = new DefaultMp4Builder().build(movie);
    FileOutputStream fos = new FileOutputStream(dst);
    FileChannel fc = fos.getChannel();
    out.getBox(fc); // This one build up the memory.

    fc.close();
    fos.close();
}
 
开发者ID:asm-products,项目名称:nexus-gallery,代码行数:15,代码来源:VideoUtils.java


示例10: load

import com.coremedia.iso.IsoFile; //导入依赖的package包/类
@Override
public Media load(FileBaseResourceInfo fileBaseResourceInfo) throws IOException {
	Assert.notNull(fileBaseResourceInfo);
	
	File file = fileBaseResourceInfo.getFile();
	
	DataSource dataSource = new FileDataSourceImpl(file);

	try{
		IsoFile isoFile = new IsoFile(dataSource);
		return loadIsoFile(isoFile, fileBaseResourceInfo);
	}finally{
		IOUtils.closeQuietly(dataSource);
	}
	
}
 
开发者ID:ivarptr,项目名称:clobaframe,代码行数:17,代码来源:VideoLoader.java


示例11: getHeader

import com.coremedia.iso.IsoFile; //导入依赖的package包/类
private void getHeader(ByteBuffer byteBuffer) {
    if (isSmallBox()) {
        IsoTypeWriter.writeUInt32(byteBuffer, this.getSize());
        byteBuffer.put(IsoFile.fourCCtoBytes(getType()));
    } else {
        IsoTypeWriter.writeUInt32(byteBuffer, 1);
        byteBuffer.put(IsoFile.fourCCtoBytes(getType()));
        IsoTypeWriter.writeUInt64(byteBuffer, getSize());
    }
    if (UserBox.TYPE.equals(getType())) {
        byteBuffer.put(getUserType());
    }


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


示例12: build

import com.coremedia.iso.IsoFile; //导入依赖的package包/类
public static Movie build(ReadableByteChannel channel) throws IOException {
    IsoFile isoFile = new IsoFile(channel);
    Movie m = new Movie();
    List<TrackBox> trackBoxes = isoFile.getMovieBox().getBoxes(TrackBox.class);
    for (TrackBox trackBox : trackBoxes) {
        m.addTrack(new Mp4TrackImpl(trackBox));
    }
    return m;
}
 
开发者ID:begeekmyfriend,项目名称:mp4parser_android,代码行数:10,代码来源:MovieCreator.java


示例13: getBox

import com.coremedia.iso.IsoFile; //导入依赖的package包/类
public void getBox(WritableByteChannel writableByteChannel) throws IOException {
    ByteBuffer bb = ByteBuffer.allocate(16);
    long size = getSize();
    if (isSmallBox(size)) {
        IsoTypeWriter.writeUInt32(bb, size);
    } else {
        IsoTypeWriter.writeUInt32(bb, 1);
    }
    bb.put(IsoFile.fourCCtoBytes("mdat"));
    if (isSmallBox(size)) {
        bb.put(new byte[8]);
    } else {
        IsoTypeWriter.writeUInt64(bb, size);
    }
    bb.rewind();
    writableByteChannel.write(bb);
    if (writableByteChannel instanceof GatheringByteChannel) {
        List<ByteBuffer> nuSamples = unifyAdjacentBuffers(samples);


        for (int i = 0; i < Math.ceil((double) nuSamples.size() / STEPSIZE); i++) {
            List<ByteBuffer> sublist = nuSamples.subList(
                    i * STEPSIZE, // start
                    (i + 1) * STEPSIZE < nuSamples.size() ? (i + 1) * STEPSIZE : nuSamples.size()); // end
            ByteBuffer sampleArray[] = sublist.toArray(new ByteBuffer[sublist.size()]);
            do {
                ((GatheringByteChannel) writableByteChannel).write(sampleArray);
            } while (sampleArray[sampleArray.length - 1].remaining() > 0);
        }
        //System.err.println(bytesWritten);
    } else {
        for (ByteBuffer sample : samples) {
            sample.rewind();
            writableByteChannel.write(sample);
        }
    }
}
 
开发者ID:begeekmyfriend,项目名称:mp4parser_android,代码行数:38,代码来源:DefaultMp4Builder.java


示例14: createMfra

import com.coremedia.iso.IsoFile; //导入依赖的package包/类
/**
 * Creates a 'mfra' - movie fragment random access box for the given movie in the given
 * isofile. Uses {@link #createTfra(com.googlecode.mp4parser.authoring.Track, com.coremedia.iso.IsoFile)}
 * to generate the child boxes.
 *
 * @param movie   concerned movie
 * @param isoFile concerned isofile
 * @return a complete 'mfra' box
 */
protected Box createMfra(Movie movie, IsoFile isoFile) {
    MovieFragmentRandomAccessBox mfra = new MovieFragmentRandomAccessBox();
    for (Track track : movie.getTracks()) {
        mfra.addBox(createTfra(track, isoFile));
    }

    MovieFragmentRandomAccessOffsetBox mfro = new MovieFragmentRandomAccessOffsetBox();
    mfra.addBox(mfro);
    mfro.setMfraSize(mfra.getSize());
    return mfra;
}
 
开发者ID:begeekmyfriend,项目名称:mp4parser_android,代码行数:21,代码来源:FragmentedMp4Builder.java


示例15: createPath

import com.coremedia.iso.IsoFile; //导入依赖的package包/类
private static String createPath(Box box, String path) {
    if (box instanceof IsoFile) {
        return path;
    } else {
        List<?> boxesOfBoxType = box.getParent().getBoxes(box.getClass());
        int index = boxesOfBoxType.indexOf(box);
        path = String.format("/%s[%d]", box.getType(), index) + path;

        return createPath(box.getParent(), path);
    }
}
 
开发者ID:begeekmyfriend,项目名称:mp4parser_android,代码行数:12,代码来源:Path.java


示例16: getContent

import com.coremedia.iso.IsoFile; //导入依赖的package包/类
@Override
protected void getContent(ByteBuffer byteBuffer) {
    byteBuffer.put(IsoFile.fourCCtoBytes(majorBrand));
    IsoTypeWriter.writeUInt32(byteBuffer, minorVersion);
    for (String compatibleBrand : compatibleBrands) {
        byteBuffer.put(IsoFile.fourCCtoBytes(compatibleBrand));
    }

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


示例17: _parseDetails

import com.coremedia.iso.IsoFile; //导入依赖的package包/类
@Override
public void _parseDetails(ByteBuffer content) {
    parseVersionAndFlags(content);
    byte[] cE = new byte[4];
    content.get(cE);
    classificationEntity = IsoFile.bytesToFourCC(cE);
    classificationTableIndex = IsoTypeReader.readUInt16(content);
    language = IsoTypeReader.readIso639(content);
    classificationInfo = IsoTypeReader.readString(content);
}
 
开发者ID:begeekmyfriend,项目名称:mp4parser_android,代码行数:11,代码来源:ClassificationBox.java


示例18: getContent

import com.coremedia.iso.IsoFile; //导入依赖的package包/类
@Override
protected void getContent(ByteBuffer byteBuffer) {
    byteBuffer.put(IsoFile.fourCCtoBytes(classificationEntity));
    IsoTypeWriter.writeUInt16(byteBuffer, classificationTableIndex);
    IsoTypeWriter.writeIso639(byteBuffer, language);
    byteBuffer.put(Utf8.convert(classificationInfo));
    byteBuffer.put((byte) 0);
}
 
开发者ID:begeekmyfriend,项目名称:mp4parser_android,代码行数:9,代码来源:ClassificationBox.java


示例19: _parseDetails

import com.coremedia.iso.IsoFile; //导入依赖的package包/类
@Override
public void _parseDetails(ByteBuffer content) {
    byte[] v = new byte[4];
    content.get(v);
    vendor = IsoFile.bytesToFourCC(v);

    decoderVersion = IsoTypeReader.readUInt8(content);
    modeSet = IsoTypeReader.readUInt16(content);
    modeChangePeriod = IsoTypeReader.readUInt8(content);
    framesPerSample = IsoTypeReader.readUInt8(content);

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


示例20: getContent

import com.coremedia.iso.IsoFile; //导入依赖的package包/类
public void getContent(ByteBuffer byteBuffer) {
    byteBuffer.put(IsoFile.fourCCtoBytes(vendor));
    IsoTypeWriter.writeUInt8(byteBuffer, decoderVersion);
    IsoTypeWriter.writeUInt16(byteBuffer, modeSet);
    IsoTypeWriter.writeUInt8(byteBuffer, modeChangePeriod);
    IsoTypeWriter.writeUInt8(byteBuffer, framesPerSample);
}
 
开发者ID:begeekmyfriend,项目名称:mp4parser_android,代码行数:8,代码来源:AmrSpecificBox.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Attribute类代码示例发布时间:2022-05-21
下一篇:
Java ProxyPrintGraphics类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap