C# Класс MP4_Mangler.FileRoot

Utility object for building useful MP4f files and file parts. This is not thread-safe!
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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.

Приватные методы

Метод Описание
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.

Описание методов

EndFile() публичный Метод

Close a started MP4f file, writing footer data. After calling this, WriteStream() will cache data.
public EndFile ( ) : void
Результат void

FileRoot() публичный Метод

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
Результат System

GenerateFileSpec() публичный Метод

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[]
Результат byte[]

GenerateFooters() публичный Метод

Output a 'mfra' atom and it's children as raw data.
public GenerateFooters ( ) : byte[]
Результат byte[]

GenerateFragment() публичный Метод

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
Результат MP4_Mangler.FragmentBoxes.MediaFragmentHandler

GenerateHeaders() публичный Метод

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[]
Результат byte[]

StartFile() публичный Метод

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
Результат void

WriteStream() публичный Метод

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
Результат void