Java Code Examples for com.coremedia.iso.boxes.Box#getBox()
The following examples show how to use
com.coremedia.iso.boxes.Box#getBox() .
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 | 6 votes |
public void finishMovie() throws Exception { if (mdat.getContentSize() != 0) { flushCurrentMdat(); } for (Track track : currentMp4Movie.getTracks()) { List<Sample> samples = track.getSamples(); long[] sizes = new long[samples.size()]; for (int i = 0; i < sizes.length; i++) { sizes[i] = samples.get(i).getSize(); } track2SampleSizes.put(track, sizes); } Box moov = createMovieBox(currentMp4Movie); moov.getBox(fc); fos.flush(); fos.getFD().sync(); fc.close(); fos.close(); }
Example 2
Source File: MP4Builder.java From VideoCompressor with Apache License 2.0 | 6 votes |
public void finishMovie(boolean error) throws Exception { if (mdat.getContentSize() != 0) { flushCurrentMdat(); } for (Track track : currentMp4Movie.getTracks()) { List<Sample> samples = track.getSamples(); long[] sizes = new long[samples.size()]; for (int i = 0; i < sizes.length; i++) { sizes[i] = samples.get(i).getSize(); } track2SampleSizes.put(track, sizes); } Box moov = createMovieBox(currentMp4Movie); moov.getBox(fc); fos.flush(); fc.close(); fos.close(); }
Example 3
Source File: MP4Builder.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
public void finishMovie() throws Exception { if (mdat.getContentSize() != 0) { flushCurrentMdat(); } for (Track track : currentMp4Movie.getTracks()) { List<Sample> samples = track.getSamples(); long[] sizes = new long[samples.size()]; for (int i = 0; i < sizes.length; i++) { sizes[i] = samples.get(i).getSize(); } track2SampleSizes.put(track, sizes); } Box moov = createMovieBox(currentMp4Movie); moov.getBox(fc); fos.flush(); fos.getFD().sync(); fc.close(); fos.close(); }
Example 4
Source File: MP4Builder.java From react-native-video-helper with MIT License | 6 votes |
public void finishMovie(boolean error) throws Exception { if (mdat.getContentSize() != 0) { flushCurrentMdat(); } for (Track track : currentMp4Movie.getTracks()) { List<Sample> samples = track.getSamples(); long[] sizes = new long[samples.size()]; for (int i = 0; i < sizes.length; i++) { sizes[i] = samples.get(i).getSize(); } track2SampleSizes.put(track, sizes); } Box moov = createMovieBox(currentMp4Movie); moov.getBox(fc); fos.flush(); fc.close(); fos.close(); }
Example 5
Source File: MP4Builder.java From VideoCompressor with Apache License 2.0 | 6 votes |
public void finishMovie(boolean error) throws Exception { if (mdat.getContentSize() != 0) { flushCurrentMdat(); } for (Track track : currentMp4Movie.getTracks()) { List<Sample> samples = track.getSamples(); long[] sizes = new long[samples.size()]; for (int i = 0; i < sizes.length; i++) { sizes[i] = samples.get(i).getSize(); } track2SampleSizes.put(track, sizes); } Box moov = createMovieBox(currentMp4Movie); moov.getBox(fc); fos.flush(); fc.close(); fos.close(); }
Example 6
Source File: MP4Builder.java From talk-android with MIT License | 6 votes |
public void finishMovie(boolean error) throws Exception { if (mdat.getContentSize() != 0) { flushCurrentMdat(); } for (Track track : currentMp4Movie.getTracks()) { List<Sample> samples = track.getSamples(); long[] sizes = new long[samples.size()]; for (int i = 0; i < sizes.length; i++) { sizes[i] = samples.get(i).getSize(); } track2SampleSizes.put(track, sizes); } Box moov = createMovieBox(currentMp4Movie); moov.getBox(fc); fos.flush(); fc.close(); fos.close(); }
Example 7
Source File: MP4Builder.java From SiliCompressor with Apache License 2.0 | 6 votes |
public void finishMovie(boolean error) throws Exception { if (mdat.getContentSize() != 0) { flushCurrentMdat(); } for (Track track : currentMp4Movie.getTracks()) { List<Sample> samples = track.getSamples(); long[] sizes = new long[samples.size()]; for (int i = 0; i < sizes.length; i++) { sizes[i] = samples.get(i).getSize(); } track2SampleSizes.put(track, sizes); } Box moov = createMovieBox(currentMp4Movie); moov.getBox(fc); fos.flush(); fc.close(); fos.close(); }
Example 8
Source File: MP4Builder.java From deltachat-android with GNU General Public License v3.0 | 6 votes |
public void finishMovie(boolean error) throws Exception { if (mdat.getContentSize() != 0) { flushCurrentMdat(); } for (Track track : currentMp4Movie.getTracks()) { List<Sample> samples = track.getSamples(); long[] sizes = new long[samples.size()]; for (int i = 0; i < sizes.length; i++) { sizes[i] = samples.get(i).getSize(); } track2SampleSizes.put(track, sizes); } Box moov = createMovieBox(currentMp4Movie); moov.getBox(fc); fos.flush(); fc.close(); fos.close(); }
Example 9
Source File: MP4Builder.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
public void finishMovie() throws Exception { if (mdat.getContentSize() != 0) { flushCurrentMdat(); } for (Track track : currentMp4Movie.getTracks()) { List<Sample> samples = track.getSamples(); long[] sizes = new long[samples.size()]; for (int i = 0; i < sizes.length; i++) { sizes[i] = samples.get(i).getSize(); } track2SampleSizes.put(track, sizes); } Box moov = createMovieBox(currentMp4Movie); moov.getBox(fc); fos.flush(); fos.getFD().sync(); fc.close(); fos.close(); }
Example 10
Source File: MP4Builder.java From Telegram with GNU General Public License v2.0 | 6 votes |
public void finishMovie() throws Exception { if (mdat.getContentSize() != 0) { flushCurrentMdat(); } for (Track track : currentMp4Movie.getTracks()) { List<Sample> samples = track.getSamples(); long[] sizes = new long[samples.size()]; for (int i = 0; i < sizes.length; i++) { sizes[i] = samples.get(i).getSize(); } track2SampleSizes.put(track, sizes); } Box moov = createMovieBox(currentMp4Movie); moov.getBox(fc); fos.flush(); fos.getFD().sync(); fc.close(); fos.close(); }
Example 11
Source File: FakeCamOutput.java From sensorhub with Mozilla Public License 2.0 | 4 votes |
private void sendMeasurement() { // read next video frame try { videoFrameBuffer.reset(); WritableByteChannel byteChannel = Channels.newChannel(videoFrameBuffer); // init or loop if (mp4Boxes == null || !mp4Boxes.hasNext()) mp4Boxes = mp4File.getBoxes().iterator(); // copy all box until actual frame data is found while (mp4Boxes.hasNext()) { Box currentBox = mp4Boxes.next(); if (currentBox instanceof MovieBox) { log.trace(((MovieBox) currentBox).getMovieHeaderBox().toString()); } if (currentBox instanceof MovieFragmentBox) { // always increment seq number sampleCounter++; ((MovieFragmentBox) currentBox).getBoxes(MovieFragmentHeaderBox.class).get(0).setSequenceNumber(sampleCounter);; // need to rewrite base offset so it's not relative to begining of file //((MovieFragmentBox) currentBox).getTrackFragmentHeaderBoxes().get(0).setDefaultBaseIsMoof(true); ((MovieFragmentBox) currentBox).getTrackFragmentHeaderBoxes().get(0).setBaseDataOffset(-1L); ((MovieFragmentBox) currentBox).getTrackFragmentHeaderBoxes().get(0).setDefaultSampleDuration(4000); ((MovieFragmentBox) currentBox).getTrackRunBoxes().get(0).setDataOffset(224-8); log.trace(((MovieFragmentBox) currentBox).getBoxes(MovieFragmentHeaderBox.class).get(0).toString()); log.trace(((MovieFragmentBox) currentBox).getTrackFragmentHeaderBoxes().get(0).toString()); log.trace(((MovieFragmentBox) currentBox).getTrackRunBoxes().get(0).toString()); //for (Entry sample: ((MovieFragmentBox) currentBox).getTrackRunBoxes().get(0).getEntries()) // System.out.println(sample); } if (currentBox.getType().equals("moof")) { // TODO add time tag box (tfdt?) log.trace("Copying box " + currentBox.getType()); currentBox.getBox(byteChannel); } else if (currentBox.getType().equals("mdat")) { log.trace("Copying box " + currentBox.getType()); currentBox.getBox(byteChannel); break; } else if (currentBox.getType().equals("mfra")) { mp4Boxes = mp4File.getBoxes().iterator(); } } } catch (IOException e) { throw new RuntimeException(e); } // build and publish datablock DataBlockCompressed dataBlock = new DataBlockCompressed(); dataBlock.setUnderlyingObject(videoFrameBuffer.toByteArray()); // update latest record and send event latestRecord = dataBlock; latestRecordTime = System.currentTimeMillis(); eventHandler.publishEvent(new SensorDataEvent(latestRecordTime, FakeCamOutput.this, dataBlock)); }