本文整理汇总了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;
}
示例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);
}
示例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();
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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() );
}
示例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;
}
示例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);
}