~/bend-docscommunity

depay.bend checks

raw source on the hub · import 0xfbc4773809086afacef84e7fba6d620c/depay.bend as Depay

From RTP packets to frames: the video's NAL units gathered into one access unit per picture, the audio's frames as they come.

A picture's packets share an RTP timestamp, and the last has the marker bit: either a new timestamp or the marker ends the access unit.

5 imports
import Base
import ./bytes.bend as B
import ./rtp.bend as R
import ./audio.bend as A
import ./frame.bend as F

Types

type Asm source · line 15 · raw

Data

dep: the units being rebuilt. au: the open access unit's NAL units, the last first; at: its RTP time. base: the first time seen (based: one was). aud: the audio.

type Got source · line 20 · raw

Data

What a packet gave: the frames it completed, and the state after.

Definitions

def Asm.new source · line 23 · raw

@h265:Bool -> @aud:0xfbc4773809086afacef84e7fba6d620c/audio.Aud -> Asm

def Asm.idr source · line 28 · raw

@h265:Bool -> @+b:U32 -> Bool

A unit a decoder can start at: an IDR slice (H.264 type 5), or an IRAP picture (H.265 types 16 to 21).

def Asm.key source · line 35 · raw

@+h265:Bool -> @au:List<&2, List<&2, U32>> -> Bool

def Asm.flush.if source · line 45 · raw

@yes:Bool -> @+h265:Bool -> @dep:0xfbc4773809086afacef84e7fba6d620c/rtp.Dep -> @+au:List<&2, List<&2, U32>> -> @+at:U32 -> @open:Bool -> @+base:U32 -> @based:Bool -> @aud:0xfbc4773809086afacef84e7fba6d620c/audio.Aud -> Got

The open access unit out, if it is to end.

def Asm.flush source · line 56 · raw

@m:Asm -> @rts:U32 -> @force:Bool -> Got

End the open access unit when told to, or when the time moved on.

def Asm.any source · line 61 · raw

@nals:List<&2, List<&2, U32>> -> Bool

def Asm.add source · line 69 · raw

@m:Asm -> @+nals:List<&2, List<&2, U32>> -> @+rts:U32 -> Asm

Units into the open access unit, which is of this time.

def Asm.join.end source · line 75 · raw

@g:Got -> @f1:List<&2, 0xfbc4773809086afacef84e7fba6d620c/frame.Frame> -> Got

def Asm.join source · line 79 · raw

@g:Got -> @nals:List<&2, List<&2, U32>> -> @marker:Bool -> @+rts:U32 -> Got

def Asm.out source · line 83 · raw

@o:0xfbc4773809086afacef84e7fba6d620c/rtp.Out -> @h265:Bool -> @au:List<&2, List<&2, U32>> -> @at:U32 -> @open:Bool -> @base:U32 -> @based:Bool -> @aud:0xfbc4773809086afacef84e7fba6d620c/audio.Aud -> @marker:Bool -> @+rts:U32 -> Got

def Asm.dep source · line 90 · raw

@h265:Bool -> @dep:0xfbc4773809086afacef84e7fba6d620c/rtp.Dep -> @payload:List<&2, U32> -> 0xfbc4773809086afacef84e7fba6d620c/rtp.Out

def Asm.video source · line 98 · raw

@m:Asm -> @marker:Bool -> @rts:U32 -> @payload:List<&2, U32> -> Got

A video payload into the state.

def Asm.sound.end source · line 102 · raw

@o:0xfbc4773809086afacef84e7fba6d620c/audio.Sound -> @h265:Bool -> @dep:0xfbc4773809086afacef84e7fba6d620c/rtp.Dep -> @au:List<&2, List<&2, U32>> -> @at:U32 -> @open:Bool -> @base:U32 -> @based:Bool -> Got

def Asm.sound source · line 108 · raw

@m:Asm -> @rts:U32 -> @payload:List<&2, U32> -> Got

An audio payload into the state.

def Asm.audio.pt source · line 112 · raw

@m:Asm -> Pair(Asm, U32)

def Asm.mine source · line 116 · raw

@video:Bool -> @audio:Bool -> @m:Asm -> @marker:Bool -> @rts:U32 -> @payload:List<&2, U32> -> Got

def Asm.typed source · line 126 · raw

@ma:Pair(Asm, U32) -> @+p:U32 -> @pt:U32 -> @+sound:Bool -> @marker:Bool -> @rts:U32 -> @payload:List<&2, U32> -> Got

def Asm.packet source · line 136 · raw

@rtp:0xfbc4773809086afacef84e7fba6d620c/rtp.Rtp -> @pt:U32 -> @sound:Bool -> @m:Asm -> Got

An RTP packet into the state: the video's, of payload type pt, or (sound) one from the audio's channel, of the audio's type; the two streams may well use the same number. Another type changes nothing, as does something that is no RTP.