C# Class MP4_Mangler.FileRoot

Utility object for building useful MP4f files and file parts. This is not thread-safe!
Afficher le fichier Open project: i-e-b/HLS---Smooth-Encoder Class Usage Examples

Méthodes publiques

Méthode Description
EndFile ( ) : void

Close a started MP4f file, writing footer data. After calling this, WriteStream() will cache data.

FileRoot ( ) : System

Create a new file root with the given streams. Frame data will be cached until StartFile() is called.

Once a file is started, the tracks and streams can't be changed. If you know the tracks in advance, it uses less memory to start the file as early as possible. If you don't know the tracks in advance, don't StartFile() until all tracks are known. It is possible to Write all frames in all tracks then StartFile() and EndFile() in direct succession.

GenerateFileSpec ( ) : byte[]

Output a 'ftyp' atom and it's children as raw data for the current set of streams. Does not write to file.

GenerateFooters ( ) : byte[]

Output a 'mfra' atom and it's children as raw data.

GenerateFragment ( MediaStream Stream ) : MediaFragmentHandler

Generate a pair of 'moof' and 'mdat' atoms for the given stream. The stream should contains a populated list of frame data, otherwise output will be empty. Keeps track of fragment index. Does not write to file. Does not remove frames. Does not adjust offset time.

GenerateHeaders ( ) : byte[]

Output a 'moov' atom and it's children as raw data for the current set of streams. Does not write to file.

StartFile ( string FilePath ) : void

Start an MP4f file. After a sucessful call, all cached data will be sent to this file, and frame data will no longer be cached on subsequent WriteStream() calls.

WriteStream ( MediaStream SourceStream ) : void

Write the frames of a stream to a file if one is open or to memory if not.

Private Methods

Méthode Description
CacheStreamFrames ( MediaStream SourceStream ) : MediaStream

Store the frames of a stream in the KnownStreams cache, adding a new entry if needed. If there is a file open, then new streams will be refused with an argument exception

GenerateMoov ( ) : byte[]

Output a 'moov' atom and it's children as raw data.

Method Details

EndFile() public méthode

Close a started MP4f file, writing footer data. After calling this, WriteStream() will cache data.
public EndFile ( ) : void
Résultat void

FileRoot() public méthode

Create a new file root with the given streams. Frame data will be cached until StartFile() is called.
Once a file is started, the tracks and streams can't be changed. If you know the tracks in advance, it uses less memory to start the file as early as possible. If you don't know the tracks in advance, don't StartFile() until all tracks are known. It is possible to Write all frames in all tracks then StartFile() and EndFile() in direct succession.
public FileRoot ( ) : System
Résultat System

GenerateFileSpec() public méthode

Output a 'ftyp' atom and it's children as raw data for the current set of streams. Does not write to file.
public GenerateFileSpec ( ) : byte[]
Résultat byte[]

GenerateFooters() public méthode

Output a 'mfra' atom and it's children as raw data.
public GenerateFooters ( ) : byte[]
Résultat byte[]

GenerateFragment() public méthode

Generate a pair of 'moof' and 'mdat' atoms for the given stream. The stream should contains a populated list of frame data, otherwise output will be empty. Keeps track of fragment index. Does not write to file. Does not remove frames. Does not adjust offset time.
public GenerateFragment ( MediaStream Stream ) : MediaFragmentHandler
Stream MediaStream
Résultat MP4_Mangler.FragmentBoxes.MediaFragmentHandler

GenerateHeaders() public méthode

Output a 'moov' atom and it's children as raw data for the current set of streams. Does not write to file.
public GenerateHeaders ( ) : byte[]
Résultat byte[]

StartFile() public méthode

Start an MP4f file. After a sucessful call, all cached data will be sent to this file, and frame data will no longer be cached on subsequent WriteStream() calls.
public StartFile ( string FilePath ) : void
FilePath string
Résultat void

WriteStream() public méthode

Write the frames of a stream to a file if one is open or to memory if not.
public WriteStream ( MediaStream SourceStream ) : void
SourceStream MediaStream
Résultat void