本文整理汇总了Java中com.googlecode.mp4parser.util.Path.getPath方法的典型用法代码示例。如果您正苦于以下问题:Java Path.getPath方法的具体用法?Java Path.getPath怎么用?Java Path.getPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.googlecode.mp4parser.util.Path
的用法示例。
在下文中一共展示了Path.getPath方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processVideoBox
import com.googlecode.mp4parser.util.Path; //导入方法依赖的package包/类
/**
* Process the video information contained in the atoms.
*
* @param stbl
* @param scale timescale
*/
private void processVideoBox(SampleTableBox stbl, long scale) {
AvcConfigurationBox avcC = (AvcConfigurationBox) Path.getPath(isoFile, "/moov/trak/mdia/minf/stbl/stsd/drmi/avcC");
if (avcC != null) {
long videoConfigContentSize = avcC.getContentSize();
log.debug("AVCC size: {}", videoConfigContentSize);
// ByteBuffer byteBuffer = ByteBuffer.allocate((int) videoConfigContentSize);
// avc1.avcDecoderConfigurationRecord.getContent(byteBuffer);
// byteBuffer.flip();
// videoDecoderBytes = new byte[byteBuffer.limit()];
// byteBuffer.get(videoDecoderBytes);
} else {
log.warn("avcC atom not found");
}
processVideoStbl(stbl, scale);
}
示例2: muxerFileDebug
import com.googlecode.mp4parser.util.Path; //导入方法依赖的package包/类
public static void muxerFileDebug(){
try
{
File input = new File(SDCardUtils.getExternalSdCardPath() + "/a.h264");
File output = new File(SDCardUtils.getExternalSdCardPath() + "/b.mp4");
H264TrackImpl h264Track = new H264TrackImpl(new FileDataSourceImpl(input), "eng", UriParser.videoQuality.framerate, 1);
Movie m = new Movie();
m.addTrack(h264Track);
m.setMatrix(Matrix.ROTATE_90);
Container out = new DefaultMp4Builder().build(m);
MovieHeaderBox mvhd = Path.getPath(out, "moov/mvhd");
mvhd.setMatrix(Matrix.ROTATE_90);
TrackBox trackBox = Path.getPath(out, "moov/trak");
TrackHeaderBox tkhd = trackBox.getTrackHeaderBox();
tkhd.setMatrix(Matrix.ROTATE_90);
FileChannel fc = new FileOutputStream(output.getAbsolutePath()).getChannel();
out.writeContainer(fc);
fc.close();
}
catch (IOException e) {
Log.e("test", "some exception", e);
}
}
示例3: _parseDetails
import com.googlecode.mp4parser.util.Path; //导入方法依赖的package包/类
@Override
public void _parseDetails(ByteBuffer content) {
parseVersionAndFlags(content);
int useThisIvSize = -1;
if ((getFlags() & 0x1) > 0) {
algorithmId = IsoTypeReader.readUInt24(content);
ivSize = IsoTypeReader.readUInt8(content);
useThisIvSize = ivSize;
kid = new byte[16];
content.get(kid);
} else {
List<Box> tkhds = Path.getPaths(this, "/moov[0]/trak/tkhd");
for (Box tkhd : tkhds) {
if (((TrackHeaderBox) tkhd).getTrackId() == this.getParent().getBoxes(TrackFragmentHeaderBox.class).get(0).getTrackId()) {
AbstractTrackEncryptionBox tenc = (AbstractTrackEncryptionBox) Path.getPath(tkhd, "../mdia[0]/minf[0]/stbl[0]/stsd[0]/enc.[0]/sinf[0]/schi[0]/tenc[0]");
if (tenc == null) {
tenc = (AbstractTrackEncryptionBox) Path.getPath(tkhd, "../mdia[0]/minf[0]/stbl[0]/stsd[0]/enc.[0]/sinf[0]/schi[0]/uuid[0]");
}
useThisIvSize = tenc.getDefaultIvSize();
}
}
}
long numOfEntries = IsoTypeReader.readUInt32(content);
while (numOfEntries-- > 0) {
Entry e = new Entry();
e.iv = new byte[useThisIvSize < 0 ? 8 : useThisIvSize]; // default to 8
content.get(e.iv);
if ((getFlags() & 0x2) > 0) {
int numOfPairs = IsoTypeReader.readUInt16(content);
e.pairs = new LinkedList<Entry.Pair>();
while (numOfPairs-- > 0) {
e.pairs.add(e.createPair(IsoTypeReader.readUInt16(content), IsoTypeReader.readUInt32(content)));
}
}
entries.add(e);
}
}
示例4: startTrim
import com.googlecode.mp4parser.util.Path; //导入方法依赖的package包/类
public static void startTrim(File src, File dst, double startTime, double endTime) throws IOException {
FileDataSourceImpl file = new FileDataSourceImpl(src);
Movie movie = MovieCreator.build(file);
List<Track> tracks = movie.getTracks();
movie.setTracks(new LinkedList<Track>());
Log.d(TAG, "startTrim: " + startTime + " " + endTime);
for (Track track : tracks) {
long currentSample = 0;
double currentTime = 0;
long startSample = -1;
long endSample = -1;
for (int i = 0; i < track.getSampleDurations().length; i++) {
if (currentTime <= startTime) {
// current sample is still before the new starttime
startSample = currentSample;
}
if (currentTime <= endTime) {
// current sample is after the new start time and still before the new endtime
endSample = currentSample;
} else {
// current sample is after the end of the cropped video
break;
}
currentTime += (double) track.getSampleDurations()[i] / (double) track.getTrackMetaData().getTimescale();
currentSample++;
}
movie.addTrack(new CroppedTrack(track, startSample, endSample));
}
Container out = new DefaultMp4Builder().build(movie);
MovieHeaderBox mvhd = Path.getPath(out, "moov/mvhd");
mvhd.setMatrix(Matrix.ROTATE_180);
if (!dst.exists()) {
dst.createNewFile();
}
FileOutputStream fos = new FileOutputStream(dst);
WritableByteChannel fc = fos.getChannel();
try {
out.writeContainer(fc);
}catch (Exception e){
e.printStackTrace();
} finally {
fc.close();
fos.close();
file.close();
}
}
示例5: getDuration
import com.googlecode.mp4parser.util.Path; //导入方法依赖的package包/类
@Override
public long getDuration() {
long dur = 0;
for (IsoFile fragment : fragments) {
TrackRunBox trun = (TrackRunBox) Path.getPath(fragment, "/moof[0]/traf[0]/trun[0]");
for (TrackRunBox.Entry entry : trun.getEntries()) {
dur += entry.getSampleDuration();
}
}
return dur;
}
示例6: getCompositionTimeEntries
import com.googlecode.mp4parser.util.Path; //导入方法依赖的package包/类
@Override
public List<CompositionTimeToSample.Entry> getCompositionTimeEntries() {
List<CompositionTimeToSample.Entry> entries = new LinkedList<CompositionTimeToSample.Entry>();
for (IsoFile fragment : fragments) {
TrackRunBox trun = (TrackRunBox) Path.getPath(fragment, "/moof[0]/traf[0]/trun[0]");
for (TrackRunBox.Entry entry : trun.getEntries()) {
entries.add(new CompositionTimeToSample.Entry(l2i(entry.getSampleCompositionTimeOffset()), 1));
}
}
return entries;
}
示例7: concatTwoVideos
import com.googlecode.mp4parser.util.Path; //导入方法依赖的package包/类
public static boolean concatTwoVideos(File src1, File src2, File dst) {
try {
FileDataSourceImpl file1 = new FileDataSourceImpl(src1);
FileDataSourceImpl file2 = new FileDataSourceImpl(src2);
Movie result = new Movie();
Movie movie1 = MovieCreator.build(file1);
Movie movie2 = MovieCreator.build(file2);
Movie[] inMovies = new Movie[]{
movie1, movie2
};
List<Track> videoTracks = new LinkedList<Track>();
List<Track> audioTracks = new LinkedList<Track>();
for (Movie m : inMovies) {
for (Track t : m.getTracks()) {
if (t.getHandler().equals("soun")) {
audioTracks.add(t);
}
if (t.getHandler().equals("vide")) {
videoTracks.add(t);
}
}
}
if (audioTracks.size() > 0) {
result.addTrack(new AppendTrack(audioTracks.toArray(new Track[audioTracks.size()])));
}
if (videoTracks.size() > 0) {
result.addTrack(new AppendTrack(videoTracks.toArray(new Track[videoTracks.size()])));
}
Container out = new DefaultMp4Builder().build(result);
MovieHeaderBox mvhd = Path.getPath(out, "moov/mvhd");
mvhd.setMatrix(Matrix.ROTATE_180);
if (!dst.exists()) {
dst.createNewFile();
}
FileOutputStream fos = new FileOutputStream(dst);
WritableByteChannel fc = fos.getChannel();
try {
out.writeContainer(fc);
} finally {
fc.close();
fos.close();
file1.close();
file2.close();
}
return true;
} catch (IOException e) {
e.printStackTrace();
return false;
}
}