MediaSegmentParseResult Class
The result of MediaSegmentParser.Parse.
public sealed class MediaSegmentParseResultProperties
| Name | Description |
|---|---|
| ByteCount | Gets the number of bytes to remove from the start of the buffer. |
| ErrorMessage | Gets the diagnostic message of an error, or an empty string. |
| Frames | Gets the complete coded frames of the media segment (MediaSegmentParseStatus.MediaSegment), in decode order. |
| InitializationSegment | Gets the initialization segment (MediaSegmentParseStatus.InitializationSegment), or null. |
| IsParsingMediaSegment | Gets a value indicating whether the parser is in the middle of a media segment: the rest of the segment is not received yet (the append state of the SourceBuffer is then PARSING_MEDIA_SEGMENT: mode and timestampOffset cannot be set until the segment is complete or abort() is called). |
| Status | Gets what the start of the buffer contains. |
ByteCount
MediaSegmentParser.csErrorMessage
MediaSegmentParser.csFrames
MediaSegmentParser.csGets the complete coded frames of the media segment (MediaSegmentParseStatus.MediaSegment), in decode order.
public IReadOnlyList<MediaCodedFrame> Frames { get; }Property value
InitializationSegment
MediaSegmentParser.csGets the initialization segment (MediaSegmentParseStatus.InitializationSegment), or null.
public MediaInitializationSegment? InitializationSegment { get; }Property value
IsParsingMediaSegment
MediaSegmentParser.csGets a value indicating whether the parser is in the middle of a media segment: the rest of the segment is not received yet (the append state of the SourceBuffer is then PARSING_MEDIA_SEGMENT: mode and timestampOffset cannot be set until the segment is complete or abort() is called).
public bool IsParsingMediaSegment { get; }Property value
Status
MediaSegmentParser.csGets what the start of the buffer contains.
public MediaSegmentParseStatus Status { get; }Property value
Methods
| Name | Description |
|---|---|
| Error(string) | The bytes violate the byte stream format, use a codec that is not supported, or cannot be decoded. |
| Ignore(int) | The buffer starts with bytes that the byte stream format ignores (e.g. an unknown box). |
| Initialization(int, MediaInitializationSegment) | The buffer starts with a complete initialization segment. |
| Media(int, IReadOnlyList<MediaCodedFrame>, bool) | The buffer starts with complete coded frames of a media segment. |
| NeedMoreData(bool) | The buffer does not contain a complete segment yet. |
Error(string)
MediaSegmentParser.csThe bytes violate the byte stream format, use a codec that is not supported, or cannot be decoded.
public static MediaSegmentParseResult Error(string message = "")Ignore(int)
MediaSegmentParser.csThe buffer starts with bytes that the byte stream format ignores (e.g. an unknown box).
public static MediaSegmentParseResult Ignore(int byteCount)Initialization(int, MediaInitializationSegment)
MediaSegmentParser.csThe buffer starts with a complete initialization segment.
public static MediaSegmentParseResult Initialization(int byteCount, MediaInitializationSegment segment)Parameters
byteCountint- The size of the segment in bytes (0 when the segment has no byte of its own: e.g. the header of the first frame of an MPEG audio stream, which is then parsed as a media segment).
segmentMediaInitializationSegment- The tracks and the duration of the segment.
Returns
Media(int, IReadOnlyList<MediaCodedFrame>, bool)
MediaSegmentParser.csThe buffer starts with complete coded frames of a media segment.
public static MediaSegmentParseResult Media(int byteCount, IReadOnlyList<MediaCodedFrame> frames, bool isComplete = true)Parameters
byteCountint- The number of bytes of the buffer that were parsed (0 or more when the segment is not complete).
framesIReadOnlyList<MediaCodedFrame>- The coded frames, in decode order.
isCompletebool- Whether the media segment is complete: otherwise the next bytes are the rest of the segment.
Returns
NeedMoreData(bool)
MediaSegmentParser.csThe buffer does not contain a complete segment yet.
public static MediaSegmentParseResult NeedMoreData(bool isParsingMediaSegment = false)Parameters
isParsingMediaSegmentbool- Whether the buffer starts with (or continues) a media segment that is not complete.