public class StandardMp4Writer extends DefaultBoxes implements SampleSink
sink receives it. (in contrast to typical implementations which need random
access to write length fields at the beginning of the file)| Modifier and Type | Field and Description |
|---|---|
protected Map<StreamingTrack,Queue<org.mp4parser.streaming.output.mp4.StandardMp4Writer.ChunkContainer>> |
chunkBuffers
Buffers segements until it's time for a segment to be written.
|
protected Map<StreamingTrack,Long> |
chunkNumbers |
protected Map<StreamingTrack,CountDownLatch> |
congestionControl |
protected Date |
creationTime |
protected Map<StreamingTrack,Long> |
nextChunkCreateStartTime
Contains the start time of the next segment in line that will be created.
|
protected Map<StreamingTrack,Long> |
nextChunkWriteStartTime
Contains the start time of the next segment in line that will be written.
|
protected Map<StreamingTrack,Long> |
nextSampleStartTime
Contains the next sample's start time.
|
static Object |
OBJ |
protected Map<StreamingTrack,List<StreamingSample>> |
sampleBuffers
Buffers the samples per track until there are enough samples to form a Segment.
|
protected Map<StreamingTrack,Long> |
sampleNumbers |
protected WritableByteChannel |
sink |
protected List<StreamingTrack> |
source |
protected Map<StreamingTrack,TrackBox> |
trackBoxes |
| Constructor and Description |
|---|
StandardMp4Writer(List<StreamingTrack> source,
WritableByteChannel sink) |
| Modifier and Type | Method and Description |
|---|---|
void |
acceptSample(StreamingSample streamingSample,
StreamingTrack streamingTrack)
Adds a samples to the SampleSink.
|
void |
close()
Free all resources blocked and interrupts the process of
writing the output.
|
protected Box |
createMdhd(StreamingTrack streamingTrack) |
protected Box |
createMoov() |
protected Box |
createMvhd() |
protected boolean |
isChunkReady(StreamingTrack streamingTrack,
StreamingSample next)
Tests if the currently received samples for a given track
are already a 'chunk' as we want to have it.
|
protected void |
write(WritableByteChannel out,
Box... boxes) |
protected void |
writeChunkContainer(org.mp4parser.streaming.output.mp4.StandardMp4Writer.ChunkContainer chunkContainer) |
createDinf, createFtyp, createMdia, createMdiaHdlr, createMinf, createStbl, createTkhd, createTrakpublic static final Object OBJ
protected final WritableByteChannel sink
protected List<StreamingTrack> source
protected Date creationTime
protected Map<StreamingTrack,CountDownLatch> congestionControl
protected Map<StreamingTrack,Long> nextChunkCreateStartTime
protected Map<StreamingTrack,Long> nextChunkWriteStartTime
protected Map<StreamingTrack,Long> nextSampleStartTime
protected Map<StreamingTrack,List<StreamingSample>> sampleBuffers
protected Map<StreamingTrack,TrackBox> trackBoxes
protected Map<StreamingTrack,Queue<org.mp4parser.streaming.output.mp4.StandardMp4Writer.ChunkContainer>> chunkBuffers
protected Map<StreamingTrack,Long> chunkNumbers
protected Map<StreamingTrack,Long> sampleNumbers
public StandardMp4Writer(List<StreamingTrack> source, WritableByteChannel sink)
public void close()
throws IOException
SampleSinkclose in interface Closeableclose in interface AutoCloseableclose in interface SampleSinkIOException - if closing failsprotected Box createMoov()
protected Box createMvhd()
createMvhd in class DefaultBoxesprotected void write(WritableByteChannel out, Box... boxes) throws IOException
IOExceptionprotected boolean isChunkReady(StreamingTrack streamingTrack, StreamingSample next)
streamingTrack - track to testnext - the lastest samplesprotected void writeChunkContainer(org.mp4parser.streaming.output.mp4.StandardMp4Writer.ChunkContainer chunkContainer) throws IOException
IOExceptionpublic void acceptSample(StreamingSample streamingSample, StreamingTrack streamingTrack) throws IOException
SampleSinkStreamingTrack must be ready and accept calls to any method.acceptSample in interface SampleSinkIOException - if writing (or reading) fails.protected Box createMdhd(StreamingTrack streamingTrack)
createMdhd in class DefaultBoxesCopyright © 2017. All rights reserved.