java.io.Closeable, java.lang.AutoCloseable, SampleSinkpublic 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 | Description |
|---|---|---|
protected java.util.Map<StreamingTrack,java.util.Queue<org.mp4parser.streaming.output.mp4.StandardMp4Writer.ChunkContainer>> |
chunkBuffers |
Buffers segements until it's time for a segment to be written.
|
protected java.util.Map<StreamingTrack,java.lang.Long> |
chunkNumbers |
|
protected java.util.Map<StreamingTrack,java.util.concurrent.CountDownLatch> |
congestionControl |
|
protected java.util.Date |
creationTime |
|
protected java.util.Map<StreamingTrack,java.lang.Long> |
nextChunkCreateStartTime |
Contains the start time of the next segment in line that will be created.
|
protected java.util.Map<StreamingTrack,java.lang.Long> |
nextChunkWriteStartTime |
Contains the start time of the next segment in line that will be written.
|
protected java.util.Map<StreamingTrack,java.lang.Long> |
nextSampleStartTime |
Contains the next sample's start time.
|
static java.lang.Object |
OBJ |
|
protected java.util.Map<StreamingTrack,java.util.List<StreamingSample>> |
sampleBuffers |
Buffers the samples per track until there are enough samples to form a Segment.
|
protected java.util.Map<StreamingTrack,java.lang.Long> |
sampleNumbers |
|
protected java.nio.channels.WritableByteChannel |
sink |
|
protected java.util.List<StreamingTrack> |
source |
|
protected java.util.Map<StreamingTrack,org.mp4parser.boxes.iso14496.part12.TrackBox> |
trackBoxes |
| Constructor | Description |
|---|---|
StandardMp4Writer(java.util.List<StreamingTrack> source,
java.nio.channels.WritableByteChannel sink) |
| Modifier and Type | Method | 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 org.mp4parser.Box |
createMdhd(StreamingTrack streamingTrack) |
|
protected org.mp4parser.Box |
createMoov() |
|
protected org.mp4parser.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(java.nio.channels.WritableByteChannel out,
org.mp4parser.Box... boxes) |
|
protected void |
writeChunkContainer(org.mp4parser.streaming.output.mp4.StandardMp4Writer.ChunkContainer chunkContainer) |
createDinf, createFtyp, createMdia, createMdiaHdlr, createMinf, createStbl, createTkhd, createTrakpublic static final java.lang.Object OBJ
protected final java.nio.channels.WritableByteChannel sink
protected java.util.List<StreamingTrack> source
protected java.util.Date creationTime
protected java.util.Map<StreamingTrack,java.util.concurrent.CountDownLatch> congestionControl
protected java.util.Map<StreamingTrack,java.lang.Long> nextChunkCreateStartTime
protected java.util.Map<StreamingTrack,java.lang.Long> nextChunkWriteStartTime
protected java.util.Map<StreamingTrack,java.lang.Long> nextSampleStartTime
protected java.util.Map<StreamingTrack,java.util.List<StreamingSample>> sampleBuffers
protected java.util.Map<StreamingTrack,org.mp4parser.boxes.iso14496.part12.TrackBox> trackBoxes
protected java.util.Map<StreamingTrack,java.util.Queue<org.mp4parser.streaming.output.mp4.StandardMp4Writer.ChunkContainer>> chunkBuffers
protected java.util.Map<StreamingTrack,java.lang.Long> chunkNumbers
protected java.util.Map<StreamingTrack,java.lang.Long> sampleNumbers
public StandardMp4Writer(java.util.List<StreamingTrack> source, java.nio.channels.WritableByteChannel sink)
public void close()
throws java.io.IOException
SampleSinkclose in interface java.lang.AutoCloseableclose in interface java.io.Closeableclose in interface SampleSinkjava.io.IOException - if closing failsprotected org.mp4parser.Box createMoov()
protected org.mp4parser.Box createMvhd()
createMvhd in class DefaultBoxesprotected void write(java.nio.channels.WritableByteChannel out,
org.mp4parser.Box... boxes)
throws java.io.IOException
java.io.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 java.io.IOException
java.io.IOExceptionpublic void acceptSample(StreamingSample streamingSample, StreamingTrack streamingTrack) throws java.io.IOException
SampleSinkStreamingTrack must be ready and accept calls to any method.acceptSample in interface SampleSinkjava.io.IOException - if writing (or reading) fails.protected org.mp4parser.Box createMdhd(StreamingTrack streamingTrack)
createMdhd in class DefaultBoxesCopyright © 2018. All rights reserved.