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

Java FileTypeBox类代码示例

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

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



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

示例1: createMovie

import com.coremedia.iso.boxes.FileTypeBox; //导入依赖的package包/类
public MP4Builder createMovie(Mp4Movie mp4Movie) throws Exception {
    currentMp4Movie = mp4Movie;

    fos = new FileOutputStream(mp4Movie.getCacheFile());
    fc = fos.getChannel();

    FileTypeBox fileTypeBox = createFileTypeBox();
    fileTypeBox.getBox(fc);
    dataOffset += fileTypeBox.getSize();
    writedSinceLastMdat += dataOffset;

    mdat = new InterleaveChunkMdat();

    sizeBuffer = ByteBuffer.allocateDirect(4);

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


示例2: createFtyp

import com.coremedia.iso.boxes.FileTypeBox; //导入依赖的package包/类
public Box createFtyp(Movie movie) {
    List<String> minorBrands = new LinkedList<String>();
    minorBrands.add("isom");
    minorBrands.add("iso2");
    minorBrands.add("avc1");
    return new FileTypeBox("isom", 0, minorBrands);
}
 
开发者ID:lisnstatic,项目名称:live_master,代码行数:8,代码来源:FragmentedMp4Builder.java


示例3: createMovie

import com.coremedia.iso.boxes.FileTypeBox; //导入依赖的package包/类
private void createMovie(File outputFile) throws IOException {
    fos = new FileOutputStream(outputFile);
    fc = fos.getChannel();
    mdat = new InterleaveChunkMdat();
    mdatOffset = 0;

    FileTypeBox fileTypeBox = createFileTypeBox();
    fileTypeBox.getBox(fc);
    recFileSize += fileTypeBox.getSize();
}
 
开发者ID:lisnstatic,项目名称:live_master,代码行数:11,代码来源:SrsMp4Muxer.java


示例4: createFileTypeBox

import com.coremedia.iso.boxes.FileTypeBox; //导入依赖的package包/类
protected FileTypeBox createFileTypeBox() {
    LinkedList<String> minorBrands = new LinkedList<>();
    minorBrands.add("isom");
    minorBrands.add("iso2");
    minorBrands.add("avc1");
    minorBrands.add("mp41");
    return new FileTypeBox("isom", 512, minorBrands);
}
 
开发者ID:DrKLO,项目名称:Telegram,代码行数:9,代码来源:MP4Builder.java


示例5: createFileTypeBox

import com.coremedia.iso.boxes.FileTypeBox; //导入依赖的package包/类
protected FileTypeBox createFileTypeBox() {
    LinkedList<String> minorBrands = new LinkedList<>();
    minorBrands.add("isom");
    minorBrands.add("3gp4");
    return new FileTypeBox("isom", 0, minorBrands);
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:7,代码来源:MP4Builder.java


示例6: build

import com.coremedia.iso.boxes.FileTypeBox; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public IsoFile build(Movie movie) {
    LOG.fine("Creating movie " + movie);
    for (Track track : movie.getTracks()) {
        // getting the samples may be a time consuming activity
        List<ByteBuffer> samples = track.getSamples();
        putSamples(track, samples);
        long[] sizes = new long[samples.size()];
        for (int i = 0; i < sizes.length; i++) {
            sizes[i] = samples.get(i).limit();
        }
        putSampleSizes(track, sizes);
    }

    IsoFile isoFile = new IsoFile();
    // ouch that is ugly but I don't know how to do it else
    List<String> minorBrands = new LinkedList<String>();
    minorBrands.add("isom");
    minorBrands.add("iso2");
    minorBrands.add("avc1");

    isoFile.addBox(new FileTypeBox("isom", 0, minorBrands));
    isoFile.addBox(createMovieBox(movie));
    InterleaveChunkMdat mdat = new InterleaveChunkMdat(movie);
    isoFile.addBox(mdat);

    /*
    dataOffset is where the first sample starts. In this special mdat the samples always start
    at offset 16 so that we can use the same offset for large boxes and small boxes
     */
    long dataOffset = mdat.getDataOffset();
    for (StaticChunkOffsetBox chunkOffsetBox : chunkOffsetBoxes) {
        long[] offsets = chunkOffsetBox.getChunkOffsets();
        for (int i = 0; i < offsets.length; i++) {
            offsets[i] += dataOffset;
        }
    }


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


示例7: createFileTypeBox

import com.coremedia.iso.boxes.FileTypeBox; //导入依赖的package包/类
private FileTypeBox createFileTypeBox() {
    LinkedList<String> minorBrands = new LinkedList<>();
    minorBrands.add("isom");
    minorBrands.add("3gp4");
    return new FileTypeBox("isom", 0, minorBrands);
}
 
开发者ID:lisnstatic,项目名称:live_master,代码行数:7,代码来源:SrsMp4Muxer.java


示例8: LoadSpecificBox

import com.coremedia.iso.boxes.FileTypeBox; //导入依赖的package包/类
private void LoadSpecificBox( FileTypeBox box ) {
   Log.d( "this", "load FileTypeBox" );
   addViewForValue( "Major Brand:", box.getMajorBrand() );
   addViewForValue( "Version:", box.getMinorVersion() );
   addViewForValue( "Compatible Brands:", box.getCompatibleBrands() );
}
 
开发者ID:hoolrory,项目名称:VideoInfoViewer,代码行数:7,代码来源:BoxInfoView.java


示例9: loadIsoFile

import com.coremedia.iso.boxes.FileTypeBox; //导入依赖的package包/类
private Media loadIsoFile(IsoFile isoFile, FileBaseResourceInfo fileBaseResourceInfo) {
		// Grab the file type box
		FileTypeBox fileType = getOrNull(isoFile, FileTypeBox.class);
		if (fileType == null) {
			return null;
		}
		
//		String brand = fileType.getMajorBrand();
//		String type = null;
//		
//		for(String t : mp4_audio_brands) {
//			if (brand.equals(t)){
//				type = t;
//				break;
//			}
//		}
//			
//		for(String t : mp4_video_brands) {
//			if (brand.equals(t)){
//				type = t;
//				break;
//			}
//		}
//		
//		if (type == null){
//			return null;
//		}
		
//		Audio.Format format = null;
//		String encoding = null;
//		if ("mp3".equals(audioHeader.getEncodingType())){
//			format = Audio.Format.mp3;
//			encoding = "mp3";
//		}else if ("AAC".equals(audioHeader.getEncodingType())){
//			format = Audio.Format.m4a;
//			encoding = "aac";
//		}
//		
		// mp4 file format, see:
		// http://1.richitec.sinaapp.com/?p=46
		
		// Get the main MOOV box
		MovieBox moov = getOrNull(isoFile, MovieBox.class);
		if (moov == null) {
			// Bail out
			return null;
		}
		
		double duration = 0;
		
		// Pull out some information from the header box
		MovieHeaderBox mHeader = getOrNull(moov, MovieHeaderBox.class);
		if (mHeader == null) {
			return null;
		}
         
		// Get the duration. Seconds
		duration = (double)mHeader.getDuration() / mHeader.getTimescale();
		
		// see: http://en.wikipedia.org/wiki/Bit_rate
		int bitrate = (int)(fileBaseResourceInfo.getContentLength() * 8 / duration / 1000);
		
		Audio audio = new DefaultAudio(
				fileBaseResourceInfo,
				Audio.Format.m4a, "aac", 
				duration,
				bitrate,
				Audio.BitrateMode.variable);
		
		M4aMetaDataParser metaDataParser = new M4aMetaDataParser();
		audio.setMetaData(metaDataParser.parse(moov));
		
		return audio;
	}
 
开发者ID:ivarptr,项目名称:clobaframe,代码行数:75,代码来源:M4aLoader.java


示例10: loadIsoFile

import com.coremedia.iso.boxes.FileTypeBox; //导入依赖的package包/类
private Media loadIsoFile(IsoFile isoFile, FileBaseResourceInfo fileBaseResourceInfo) {
	// Grab the file type box
	FileTypeBox fileType = getOrNull(isoFile, FileTypeBox.class);
	if (fileType == null) {
		return null;
	}
	
	// Get the main MOOV box
	MovieBox moov = getOrNull(isoFile, MovieBox.class);
	if (moov == null) {
		// Bail out
		return null;
	}
	
	double duration = 0;
	
	// Pull out some information from the header box
	MovieHeaderBox mHeader = getOrNull(moov, MovieHeaderBox.class);
	if (mHeader == null) {
		return null;
	}
        
	// Get the duration. Seconds
	duration = (double)mHeader.getDuration() / mHeader.getTimescale();
	
	if (duration == 0){
		duration = 1;
	}
	
	// Get some more information from the track header
	List<TrackBox> tb = moov.getBoxes(TrackBox.class);
	if (tb.isEmpty()) {
		return null;
	}
	
	// Get the video with and height
	int width = 0;
	int height = 0;

	for(int idx=0; idx<tb.size(); idx++){
		TrackBox track = tb.get(idx);
		TrackHeaderBox header = track.getTrackHeaderBox();

		int w = (int)header.getWidth();
		int h = (int)header.getHeight();
		
		if (w==0 && h==0){
			// skip the none-video track
			continue;
		}
		
		// Get the video with and height
		width = w;
		height = h;
		break;
	}

	if (width == 0 && height == 0) {
		// no video track found.
		return null;
	}
	
	Video.Format format = (
			MIME_TYPE_VIDEO_MP4.equals(fileBaseResourceInfo.getMimeType())?
			Video.Format.mp4:
			Video.Format.mov);
	
	return new DefaultVideo(
			fileBaseResourceInfo, format, 
			width, height, duration);
}
 
开发者ID:ivarptr,项目名称:clobaframe,代码行数:72,代码来源:VideoLoader.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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