audio.bend checks
raw source on the hub · import 0xd6fc55bf65b187fec4175f80d08c165a/audio.bend as MAudio
Audio from RTP.
AAC (RFC 3640, the "AAC-hbr" mode every camera and server uses): a packet's payload is a list of 16-bit headers, each the size of a frame in 13 bits, and then the frames. A frame is given after an ADTS header, which says what the stream's configuration (the SDP's config=) says: profile, rate, channels; that is AAC as a file or a TS holds it.
G.711 (RFC 3551: PCMA, the A-law of payload type 8, and PCMU, the mu-law of type 0), what most cameras send: the payload is the samples, one byte each, 8000 a second, and is given as it is.
4 imports
import Base import ./bytes.bend as B import ./rtsp_core.bend as C import ./frame.bend as F
Types
type Aud source · line 21 · raw
Data
pt: the payload type. rate: the RTP clock (0: no audio). obj, freq, chan: AAC's configuration (chan alone for G.711). base: the first time seen (based: one was). codec: "AAC", "PCMA", "PCMU", or "".
Aud@pt:U32 -> @rate:U32 -> @obj:U32 -> @freq:U32 -> @chan:U32 -> @base:U32 -> @based:Bool -> @codec:String -> Aud
type Sound source · line 26 · raw
Data
What a packet gave: its frames, and the state.
Sound@frames:List<&2, 0xd6fc55bf65b187fec4175f80d08c165a/frame.Frame> -> @a:Aud -> Sound
Definitions
def Aud.none source · line 30 · raw
Aud
No audio: a payload type no packet has.
def Aud.hex source · line 33 · raw
@s:String -> @acc:List<&2, U32> -> List<&2, U32>
def Aud.cfg source · line 43 · raw
@aac:Bool -> @pt:U32 -> @rate:U32 -> @cfg:List<&2, U32> -> Aud
The configuration's first two bytes: 5 bits of object type, 4 of rate index, 4 of channels.
def Aud.g711 source · line 53 · raw
@yes:Bool -> @pt:U32 -> @+clock:U32 -> @name:String -> @else:Aud -> Aud
G.711: 8000 samples a second unless the description says otherwise, one channel.
def Aud.of source · line 63 · raw
@m:0xd6fc55bf65b187fec4175f80d08c165a/rtsp_core.Media -> Aud
The audio of a description's stream, if it is AAC or G.711. The two G.711 payload types are fixed, so a description may leave their names out.
def Aud.rate source · line 74 · raw
@a:Aud -> U32
def Aud.codec source · line 78 · raw
@a:Aud -> String
def Aud.on source · line 82 · raw
@a:Aud -> Bool
def Aud.pt source · line 85 · raw
@a:Aud -> U32
def Aud.chans source · line 89 · raw
@a:Aud -> U32
def Aud.adts source · line 94 · raw
@+n:U32 -> @obj:U32 -> @freq:U32 -> @+chan:U32 -> List<&2, U32>
The 7 bytes in front of a frame of n bytes.
def Aud.frame source · line 101 · raw
@c:0xd6fc55bf65b187fec4175f80d08c165a/bytes.Cut -> @n:U32 -> @obj:U32 -> @freq:U32 -> @chan:U32 -> @acc:List<&2, U32> -> @k:(@_:List<&2, U32> -> @_:List<&2, U32> -> List<&2, U32>) -> List<&2, U32>
def Aud.frames source · line 111 · raw
@hdrs:List<&2, U32> -> @data:List<&2, U32> -> @+obj:U32 -> @+freq:U32 -> @+chan:U32 -> @acc:List<&2, U32> -> List<&2, U32>
Every frame of a payload after its ADTS header, in order: a header per frame, its top 13 bits the size.
def Aud.ticks source · line 123 · raw
@+d:U32 -> @rate:U32 -> U32
A span of the RTP clock in 90 kHz ticks, without leaving 32 bits: the rates in use are multiples of 25.
def Aud.split source · line 127 · raw
@c:0xd6fc55bf65b187fec4175f80d08c165a/bytes.Cut -> @a:Aud -> @+rts:U32 -> Sound
def Aud.push.at source · line 138 · raw
@hn:U32 -> @t:List<&2, U32> -> @a:Aud -> @rts:U32 -> Sound
def Aud.aac source · line 142 · raw
@a:Aud -> @rts:U32 -> @payload:List<&2, U32> -> Sound
An AAC payload: its frames together, at the time of the first.
def Aud.samples source · line 150 · raw
@a:Aud -> @+rts:U32 -> @payload:List<&2, U32> -> Sound
A G.711 payload: its samples as they are.
def Aud.push.by source · line 156 · raw
@aac:Bool -> @a:Aud -> @rts:U32 -> @payload:List<&2, U32> -> Sound
def Aud.push source · line 164 · raw
@+a:Aud -> @rts:U32 -> @payload:List<&2, U32> -> Sound
A payload into the state.