Package org.mp4parser.muxer.tracks
Class AbstractH26XTrack
- java.lang.Object
-
- org.mp4parser.muxer.AbstractTrack
-
- org.mp4parser.muxer.tracks.AbstractH26XTrack
-
- All Implemented Interfaces:
Closeable,AutoCloseable,Track
- Direct Known Subclasses:
H263TrackImpl,H264TrackImpl,H265TrackImpl
public abstract class AbstractH26XTrack extends AbstractTrack
Bundles common functionality and parsing patterns of NAL based formats such as H264(AVC) and H265 (HEVC).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAbstractH26XTrack.LookAhead
-
Field Summary
Fields Modifier and Type Field Description static intBUFFERprotected List<CompositionTimeToSample.Entry>cttsprotected long[]decodingTimesprotected List<SampleDependencyTypeBox.Entry>sdtpprotected List<Integer>stssprotected TrackMetaDatatrackMetaData
-
Constructor Summary
Constructors Constructor Description AbstractH26XTrack(DataSource dataSource)AbstractH26XTrack(DataSource dataSource, boolean tripleZeroIsEndOfSequence)
-
Method Summary
Modifier and Type Method Description protected static InputStreamcleanBuffer(InputStream is)voidclose()protected SamplecreateSampleObject(List<? extends ByteBuffer> nals)Builds an MP4 sample from a list of NALs.protected ByteBufferfindNextNal(AbstractH26XTrack.LookAhead la)List<CompositionTimeToSample.Entry>getCompositionTimeEntries()protected abstract SampleEntrygetCurrentSampleEntry()List<SampleDependencyTypeBox.Entry>getSampleDependencies()long[]getSampleDurations()Each samples is covers a small time span in a video.long[]getSyncSamples()TrackMetaDatagetTrackMetaData()protected static byte[]toArray(ByteBuffer buf)-
Methods inherited from class org.mp4parser.muxer.AbstractTrack
getDuration, getEdits, getName, getSampleGroups, getSubsampleInformationBox
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.mp4parser.muxer.Track
getHandler, getSampleEntries, getSamples
-
-
-
-
Field Detail
-
BUFFER
public static int BUFFER
-
decodingTimes
protected long[] decodingTimes
-
ctts
protected List<CompositionTimeToSample.Entry> ctts
-
sdtp
protected List<SampleDependencyTypeBox.Entry> sdtp
-
trackMetaData
protected TrackMetaData trackMetaData
-
-
Constructor Detail
-
AbstractH26XTrack
public AbstractH26XTrack(DataSource dataSource, boolean tripleZeroIsEndOfSequence)
-
AbstractH26XTrack
public AbstractH26XTrack(DataSource dataSource)
-
-
Method Detail
-
cleanBuffer
protected static InputStream cleanBuffer(InputStream is)
-
toArray
protected static byte[] toArray(ByteBuffer buf)
-
getTrackMetaData
public TrackMetaData getTrackMetaData()
-
findNextNal
protected ByteBuffer findNextNal(AbstractH26XTrack.LookAhead la) throws IOException
- Throws:
IOException
-
getCurrentSampleEntry
protected abstract SampleEntry getCurrentSampleEntry()
-
createSampleObject
protected Sample createSampleObject(List<? extends ByteBuffer> nals)
Builds an MP4 sample from a list of NALs. Each NAL will be preceded by its 4 byte (unit32) length.- Parameters:
nals- a list of NALs that form the sample- Returns:
- sample as it appears in the MP4 file
-
getSampleDurations
public long[] getSampleDurations()
Description copied from interface:TrackEach samples is covers a small time span in a video. This method returns the duration for each sample in track timescale. The array must contain exactly as many samples asTrack.getSamples()contains.- Returns:
- an array of ticks
-
getCompositionTimeEntries
public List<CompositionTimeToSample.Entry> getCompositionTimeEntries()
- Specified by:
getCompositionTimeEntriesin interfaceTrack- Overrides:
getCompositionTimeEntriesin classAbstractTrack
-
getSyncSamples
public long[] getSyncSamples()
- Specified by:
getSyncSamplesin interfaceTrack- Overrides:
getSyncSamplesin classAbstractTrack
-
getSampleDependencies
public List<SampleDependencyTypeBox.Entry> getSampleDependencies()
- Specified by:
getSampleDependenciesin interfaceTrack- Overrides:
getSampleDependenciesin classAbstractTrack
-
close
public void close() throws IOException- Throws:
IOException
-
-