C# Class HCS_Encoder.Outputs.SmoothStream.Multiplexing.MpegTS_Demux

Class to handle the input of MPEG Transport files. Keeps a buffer of the Video and Audio streams. Output frames are suitable for remuxing into MP4 files.
ファイルを表示 Open project: i-e-b/HLS---Smooth-Encoder Class Usage Examples

Protected Properties

Property Type Description
Packets Queue>.Dictionary
Payloads MemoryStream>.Dictionary
Timestamps long>.Dictionary
VideoPID int
WaitingFrames Queue>.Dictionary

Public Methods

Method Description
FeedTransportStream ( Stream TransportStream, double MinimumTime ) : void

Feed a data stream into the demuxer. Stream MUST be aligned to packets. This method is NOT THREAD SAFE -- lock Demux before calling. Feed must come from one logical transport stream only (to decode another stream, start another demux object).

GetAvailableAudio ( ) : List

Return all completed video frames (removes them from completion queue)

GetAvailableVideo ( ) : List

Return all completed video frames (removes them from completion queue)

MpegTS_Demux ( ) : System

Create a new demuxer, prepared for stream feeding. Timestamps will be converted from MPEG timing (90kHz) to .Net timing (10MHz). The demuxer should be kept and fed data when available. Creating a new demuxer for each data fragment will cause information loss.

Private Methods

Method Description
AgregatePayload ( int PES_PID, Queue Pkts, double MinimumTime ) : void

Concatenate packet payloads, splitting at start-of-payload points. Passes these to DecodeFrame()

DecodeFrame ( int PES_PID, MemoryStream StreamData, double MinimumTime ) : void

Called by 'AgregatePayload()' as soon as a frame has been completed. Adds a GenericMediaFrame to the WaitingFrames queue if possible.

DecodePAT ( ) : int

Scan for the first non-empty PAT, and use it to read the PID for the PMT table.

GetCompletedFrames ( int PID ) : List

Return complete frames for the given PID, clearing the queue.

MapVideoAudioPIDs ( ) : void

Read PAT table, find PMT table, and read that to get the *FIRST* video & audio PIDs. Will not change the PIDs after they've first been mapped (to prevent accidental switching).

MpegToNetTime ( long timestamp ) : long

Convert from MPEG 90kHz clock to .Net 10MHz clock.

Method Details

FeedTransportStream() public method

Feed a data stream into the demuxer. Stream MUST be aligned to packets. This method is NOT THREAD SAFE -- lock Demux before calling. Feed must come from one logical transport stream only (to decode another stream, start another demux object).
public FeedTransportStream ( Stream TransportStream, double MinimumTime ) : void
TransportStream Stream Source data stream. Must be readable, does not need to be seekable.
MinimumTime double
return void

GetAvailableAudio() public method

Return all completed video frames (removes them from completion queue)
public GetAvailableAudio ( ) : List
return List

GetAvailableVideo() public method

Return all completed video frames (removes them from completion queue)
public GetAvailableVideo ( ) : List
return List

MpegTS_Demux() public method

Create a new demuxer, prepared for stream feeding. Timestamps will be converted from MPEG timing (90kHz) to .Net timing (10MHz). The demuxer should be kept and fed data when available. Creating a new demuxer for each data fragment will cause information loss.
public MpegTS_Demux ( ) : System
return System

Property Details

Packets protected_oe property

protected Dictionary> Packets
return Queue>.Dictionary

Payloads protected_oe property

protected Dictionary Payloads
return MemoryStream>.Dictionary

Timestamps protected_oe property

protected Dictionary Timestamps
return long>.Dictionary

VideoPID protected_oe property

protected int VideoPID
return int

WaitingFrames protected_oe property

protected Dictionary> WaitingFrames
return Queue>.Dictionary