Class CencEncryptingTrackImpl
- java.lang.Object
-
- org.mp4parser.muxer.tracks.encryption.CencEncryptingTrackImpl
-
- All Implemented Interfaces:
Closeable,AutoCloseable,Track,CencEncryptedTrack
public class CencEncryptingTrackImpl extends Object implements CencEncryptedTrack
Encrypts a given track with common encryption.
-
-
Constructor Summary
Constructors Constructor Description CencEncryptingTrackImpl(Track source, UUID defaultKeyId, SecretKey key, boolean dummyIvs)CencEncryptingTrackImpl(Track source, RangeStartMap<Integer,UUID> indexToKeyId, Map<UUID,SecretKey> keys, String encryptionAlgo, boolean dummyIvs, boolean encryptButAllClear)Encrypts a given source track.
-
Method Summary
Modifier and Type Method Description voidclose()List<CompositionTimeToSample.Entry>getCompositionTimeEntries()longgetDuration()The duration of the track in track timescale.List<Edit>getEdits()StringgetHandler()StringgetName()A name for identification purposes.List<SampleDependencyTypeBox.Entry>getSampleDependencies()long[]getSampleDurations()Each samples is covers a small time span in a video.List<CencSampleAuxiliaryDataFormat>getSampleEncryptionEntries()List<SampleEntry>getSampleEntries()Map<GroupEntry,long[]>getSampleGroups()List<Sample>getSamples()The list of all samples.SubSampleInformationBoxgetSubsampleInformationBox()long[]getSyncSamples()TrackMetaDatagetTrackMetaData()booleanhasSubSampleEncryption()
-
-
-
Constructor Detail
-
CencEncryptingTrackImpl
public CencEncryptingTrackImpl(Track source, UUID defaultKeyId, SecretKey key, boolean dummyIvs)
-
CencEncryptingTrackImpl
public CencEncryptingTrackImpl(Track source, RangeStartMap<Integer,UUID> indexToKeyId, Map<UUID,SecretKey> keys, String encryptionAlgo, boolean dummyIvs, boolean encryptButAllClear)
Encrypts a given source track.- Parameters:
source- unencrypted source fileindexToKeyId- dunnokeys- key ID to key mapencryptionAlgo- cenc or cbc1 (don't use cbc1)dummyIvs- disables RNG for IVs and use IVs starting with 0x00...000encryptButAllClear- will cause sub sample encryption format to keep full sample in clear (clear/encrypted pair will be len(sample)/0
-
-
Method Detail
-
hasSubSampleEncryption
public boolean hasSubSampleEncryption()
- Specified by:
hasSubSampleEncryptionin interfaceCencEncryptedTrack
-
getSampleEncryptionEntries
public List<CencSampleAuxiliaryDataFormat> getSampleEncryptionEntries()
- Specified by:
getSampleEncryptionEntriesin interfaceCencEncryptedTrack
-
getSampleEntries
public List<SampleEntry> getSampleEntries()
- Specified by:
getSampleEntriesin interfaceTrack
-
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.- Specified by:
getSampleDurationsin interfaceTrack- Returns:
- an array of ticks
-
getDuration
public long getDuration()
Description copied from interface:TrackThe duration of the track in track timescale. It's the sum of all samples' duration and does NOT include any edits.- Specified by:
getDurationin interfaceTrack- Returns:
- the track's duration
-
getCompositionTimeEntries
public List<CompositionTimeToSample.Entry> getCompositionTimeEntries()
- Specified by:
getCompositionTimeEntriesin interfaceTrack
-
getSyncSamples
public long[] getSyncSamples()
- Specified by:
getSyncSamplesin interfaceTrack
-
getSampleDependencies
public List<SampleDependencyTypeBox.Entry> getSampleDependencies()
- Specified by:
getSampleDependenciesin interfaceTrack
-
getTrackMetaData
public TrackMetaData getTrackMetaData()
- Specified by:
getTrackMetaDatain interfaceTrack
-
getHandler
public String getHandler()
- Specified by:
getHandlerin interfaceTrack
-
getSamples
public List<Sample> getSamples()
Description copied from interface:TrackThe list of all samples.- Specified by:
getSamplesin interfaceTrack- Returns:
- this track's samples
-
getSubsampleInformationBox
public SubSampleInformationBox getSubsampleInformationBox()
- Specified by:
getSubsampleInformationBoxin interfaceTrack
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
getName
public String getName()
Description copied from interface:TrackA name for identification purposes. Might return the underlying filename or network address or any other identifier. For informational/debug only. This is no metadata!
-
getSampleGroups
public Map<GroupEntry,long[]> getSampleGroups()
- Specified by:
getSampleGroupsin interfaceTrack
-
-