mirror of
https://github.com/wader/fq.git
synced 2024-09-11 12:05:39 +03:00
formats: Clenaup naming a bit
This commit is contained in:
parent
f3fc85a63e
commit
a4a332bf4e
@ -15,7 +15,7 @@ import (
|
||||
var bookmarkFS embed.FS
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(format.AppleBookmark,
|
||||
interp.RegisterFormat(format.Apple_Bookmark,
|
||||
&decode.Format{
|
||||
ProbeOrder: format.ProbeOrderBinUnique,
|
||||
Description: "Apple BookmarkData",
|
||||
|
@ -19,7 +19,7 @@ var machoFS embed.FS
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.Macho,
|
||||
format.MachO,
|
||||
&decode.Format{
|
||||
Description: "Mach-O macOS executable",
|
||||
Groups: []*decode.Group{format.Probe},
|
||||
|
@ -13,13 +13,13 @@ var machoFormat decode.Group
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.MachoFat,
|
||||
format.MachO_Fat,
|
||||
&decode.Format{
|
||||
Description: "Fat Mach-O macOS executable (multi-architecture)",
|
||||
Groups: []*decode.Group{format.Probe},
|
||||
DecodeFn: machoFatDecode,
|
||||
Dependencies: []decode.Dependency{
|
||||
{Groups: []*decode.Group{format.Macho}, Out: &machoFormat},
|
||||
{Groups: []*decode.Group{format.MachO}, Out: &machoFormat},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ var probeGroup decode.Group
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.Ar,
|
||||
format.AR,
|
||||
&decode.Format{
|
||||
Description: "Unix archive",
|
||||
Groups: []*decode.Group{format.Probe},
|
||||
|
@ -34,7 +34,7 @@ var asn1FS embed.FS
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.Asn1Ber,
|
||||
format.ASN1_BER,
|
||||
&decode.Format{
|
||||
Description: "ASN1 BER (basic encoding rules, also CER and DER)",
|
||||
DecodeFn: decodeASN1BER,
|
||||
|
@ -13,7 +13,7 @@ import (
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.Av1Ccr,
|
||||
format.AV1_CCR,
|
||||
&decode.Format{
|
||||
Description: "AV1 Codec Configuration Record",
|
||||
DecodeFn: ccrDecode,
|
||||
|
@ -14,14 +14,14 @@ var av1FrameObuGroup decode.Group
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.Av1Frame,
|
||||
format.AV1_Frame,
|
||||
&decode.Format{
|
||||
Description: "AV1 frame",
|
||||
DecodeFn: frameDecode,
|
||||
RootArray: true,
|
||||
RootName: "frame",
|
||||
Dependencies: []decode.Dependency{
|
||||
{Groups: []*decode.Group{format.Av1Obu}, Out: &av1FrameObuGroup},
|
||||
{Groups: []*decode.Group{format.AV1_OBU}, Out: &av1FrameObuGroup},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.Av1Obu,
|
||||
format.AV1_OBU,
|
||||
&decode.Format{
|
||||
Description: "AV1 Open Bitstream Unit",
|
||||
DecodeFn: obuDecode,
|
||||
|
@ -21,7 +21,7 @@ var avroOcfFS embed.FS
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.AvroOcf,
|
||||
format.Avro_Ocf,
|
||||
&decode.Format{
|
||||
Description: "Avro object container file",
|
||||
Groups: []*decode.Group{format.Probe},
|
||||
|
@ -10,12 +10,12 @@ var bitcoinBlockGroup decode.Group
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.BitcoinBlkdat,
|
||||
format.Bitcoin_Blkdat,
|
||||
&decode.Format{
|
||||
Description: "Bitcoin blk.dat",
|
||||
Groups: []*decode.Group{format.Probe},
|
||||
Dependencies: []decode.Dependency{
|
||||
{Groups: []*decode.Group{format.BitcoinBlock}, Out: &bitcoinBlockGroup},
|
||||
{Groups: []*decode.Group{format.Bitcoin_Block}, Out: &bitcoinBlockGroup},
|
||||
},
|
||||
DecodeFn: decodeBlkDat,
|
||||
RootArray: true,
|
||||
@ -26,7 +26,7 @@ func init() {
|
||||
func decodeBlkDat(d *decode.D) any {
|
||||
validBlocks := 0
|
||||
for !d.End() {
|
||||
d.FieldFormat("block", &bitcoinBlockGroup, format.BitCoinBlockIn{HasHeader: true})
|
||||
d.FieldFormat("block", &bitcoinBlockGroup, format.Bitcoin_Block_In{HasHeader: true})
|
||||
validBlocks++
|
||||
}
|
||||
|
||||
|
@ -16,14 +16,14 @@ var bitcoinTranscationGroup decode.Group
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.BitcoinBlock,
|
||||
format.Bitcoin_Block,
|
||||
&decode.Format{
|
||||
Description: "Bitcoin block",
|
||||
Dependencies: []decode.Dependency{
|
||||
{Groups: []*decode.Group{format.BitcoinTransaction}, Out: &bitcoinTranscationGroup},
|
||||
{Groups: []*decode.Group{format.Bitcoin_Transaction}, Out: &bitcoinTranscationGroup},
|
||||
},
|
||||
DecodeFn: decodeBitcoinBlock,
|
||||
DefaultInArg: format.BitCoinBlockIn{
|
||||
DefaultInArg: format.Bitcoin_Block_In{
|
||||
HasHeader: false,
|
||||
},
|
||||
})
|
||||
@ -37,7 +37,7 @@ var rawHexReverse = scalar.BitBufFn(func(s scalar.BitBuf) (scalar.BitBuf, error)
|
||||
})
|
||||
|
||||
func decodeBitcoinBlock(d *decode.D) any {
|
||||
var bbi format.BitCoinBlockIn
|
||||
var bbi format.Bitcoin_Block_In
|
||||
d.ArgAs(&bbi)
|
||||
|
||||
size := d.BitsLeft()
|
||||
|
@ -35,7 +35,7 @@ func (ops opcodeEntries) MapUint(s scalar.Uint) (scalar.Uint, error) {
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.BitcoinScript,
|
||||
format.Bitcoin_Script,
|
||||
&decode.Format{
|
||||
Description: "Bitcoin script",
|
||||
DecodeFn: decodeBitcoinScript,
|
||||
|
@ -15,11 +15,11 @@ var bitcoinScriptGroup decode.Group
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.BitcoinTransaction,
|
||||
format.Bitcoin_Transaction,
|
||||
&decode.Format{
|
||||
Description: "Bitcoin transaction",
|
||||
Dependencies: []decode.Dependency{
|
||||
{Groups: []*decode.Group{format.BitcoinScript}, Out: &bitcoinScriptGroup},
|
||||
{Groups: []*decode.Group{format.Bitcoin_Script}, Out: &bitcoinScriptGroup},
|
||||
},
|
||||
DecodeFn: decodeBitcoinTranscation,
|
||||
})
|
||||
|
@ -18,7 +18,7 @@ var bsonFS embed.FS
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.Bson,
|
||||
format.BSON,
|
||||
&decode.Format{
|
||||
Description: "Binary JSON",
|
||||
DecodeFn: decodeBSON,
|
||||
|
@ -26,7 +26,7 @@ var cborFS embed.FS
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.Cbor,
|
||||
format.CBOR,
|
||||
&decode.Format{
|
||||
Description: "Concise Binary Object Representation",
|
||||
DecodeFn: decodeCBOR,
|
||||
|
@ -22,12 +22,12 @@ var csvFS embed.FS
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.Csv,
|
||||
format.CSV,
|
||||
&decode.Format{
|
||||
Description: "Comma separated values",
|
||||
ProbeOrder: format.ProbeOrderTextFuzzy,
|
||||
DecodeFn: decodeCSV,
|
||||
DefaultInArg: format.CSVLIn{
|
||||
DefaultInArg: format.CSV_In{
|
||||
Comma: ",",
|
||||
Comment: "#",
|
||||
},
|
||||
@ -38,7 +38,7 @@ func init() {
|
||||
}
|
||||
|
||||
func decodeCSV(d *decode.D) any {
|
||||
var ci format.CSVLIn
|
||||
var ci format.CSV_In
|
||||
d.ArgAs(&ci)
|
||||
|
||||
var rvs []any
|
||||
|
@ -15,10 +15,10 @@ import (
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.Dns,
|
||||
format.DNS,
|
||||
&decode.Format{
|
||||
Description: "DNS packet",
|
||||
Groups: []*decode.Group{format.UdpPayload},
|
||||
Groups: []*decode.Group{format.UDP_Payload},
|
||||
DecodeFn: dnsUDPDecode,
|
||||
})
|
||||
}
|
||||
@ -263,7 +263,7 @@ func dnsDecode(d *decode.D, hasLengthHeader bool) any {
|
||||
}
|
||||
|
||||
func dnsUDPDecode(d *decode.D) any {
|
||||
var upi format.UDPPayloadIn
|
||||
var upi format.UDP_Payload_In
|
||||
if d.ArgAs(&upi) {
|
||||
upi.MustIsPort(d.Fatalf, format.UDPPortDomain, format.UDPPortMDNS)
|
||||
}
|
||||
|
@ -8,16 +8,16 @@ import (
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.DnsTcp,
|
||||
format.DNS_TCP,
|
||||
&decode.Format{
|
||||
Description: "DNS packet (TCP)",
|
||||
Groups: []*decode.Group{format.TcpStream},
|
||||
Groups: []*decode.Group{format.TCP_Stream},
|
||||
DecodeFn: dnsTCPDecode,
|
||||
})
|
||||
}
|
||||
|
||||
func dnsTCPDecode(d *decode.D) any {
|
||||
var tsi format.TCPStreamIn
|
||||
var tsi format.TCP_Stream_In
|
||||
if d.ArgAs(&tsi) {
|
||||
tsi.MustIsPort(d.Fatalf, format.TCPPortDomain)
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ import (
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.Elf,
|
||||
format.ELF,
|
||||
&decode.Format{
|
||||
Description: "Executable and Linkable Format",
|
||||
Groups: []*decode.Group{format.Probe},
|
||||
|
@ -10,7 +10,7 @@ import (
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.FairplaySpc,
|
||||
format.Fairplay_SPC,
|
||||
&decode.Format{
|
||||
Description: "FairPlay Server Playback Context",
|
||||
DecodeFn: fairPlaySPCDecode,
|
||||
|
@ -21,14 +21,14 @@ var flacFrameGroup decode.Group
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.Flac,
|
||||
format.FLAC,
|
||||
&decode.Format{
|
||||
Description: "Free Lossless Audio Codec file",
|
||||
Groups: []*decode.Group{format.Probe},
|
||||
DecodeFn: flacDecode,
|
||||
Dependencies: []decode.Dependency{
|
||||
{Groups: []*decode.Group{format.FlacMetadatablocks}, Out: &flacMetadatablocksGroup},
|
||||
{Groups: []*decode.Group{format.FlacFrame}, Out: &flacFrameGroup},
|
||||
{Groups: []*decode.Group{format.FLAC_Metadatablocks}, Out: &flacMetadatablocksGroup},
|
||||
{Groups: []*decode.Group{format.FLAC_Frame}, Out: &flacFrameGroup},
|
||||
},
|
||||
})
|
||||
}
|
||||
@ -36,21 +36,21 @@ func init() {
|
||||
func flacDecode(d *decode.D) any {
|
||||
d.FieldUTF8("magic", 4, d.StrAssert("fLaC"))
|
||||
|
||||
var streamInfo format.FlacStreamInfo
|
||||
var flacFrameIn format.FlacFrameIn
|
||||
var streamInfo format.FLAC_Stream_Info
|
||||
var flacFrameIn format.FLAC_Frame_In
|
||||
var framesNDecodedSamples uint64
|
||||
var streamTotalSamples uint64
|
||||
var streamDecodedSamples uint64
|
||||
|
||||
_, v := d.FieldFormat("metadatablocks", &flacMetadatablocksGroup, nil)
|
||||
flacMetadatablockOut, ok := v.(format.FlacMetadatablocksOut)
|
||||
flacMetadatablockOut, ok := v.(format.FLAC_Metadatablocks_Out)
|
||||
if !ok {
|
||||
panic(fmt.Sprintf("expected FlacMetadatablockOut got %#+v", v))
|
||||
}
|
||||
if flacMetadatablockOut.HasStreamInfo {
|
||||
streamInfo = flacMetadatablockOut.StreamInfo
|
||||
streamTotalSamples = streamInfo.TotalSamplesInStream
|
||||
flacFrameIn = format.FlacFrameIn{BitsPerSample: int(streamInfo.BitsPerSample)}
|
||||
flacFrameIn = format.FLAC_Frame_In{BitsPerSample: int(streamInfo.BitsPerSample)}
|
||||
}
|
||||
|
||||
md5Samples := md5.New()
|
||||
@ -58,7 +58,7 @@ func flacDecode(d *decode.D) any {
|
||||
for d.NotEnd() {
|
||||
// flac frame might need some fields from stream info to decode
|
||||
_, v := d.FieldFormat("frame", &flacFrameGroup, flacFrameIn)
|
||||
ffo, ok := v.(format.FlacFrameOut)
|
||||
ffo, ok := v.(format.FLAC_Frame_Out)
|
||||
if !ok {
|
||||
panic(fmt.Sprintf("expected FlacFrameOut got %#+v", v))
|
||||
}
|
||||
|
@ -14,11 +14,11 @@ import (
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.FlacFrame,
|
||||
format.FLAC_Frame,
|
||||
&decode.Format{
|
||||
Description: "FLAC frame",
|
||||
DecodeFn: frameDecode,
|
||||
DefaultInArg: format.FlacFrameIn{
|
||||
DefaultInArg: format.FLAC_Frame_In{
|
||||
BitsPerSample: 16, // TODO: maybe should not have a default value?
|
||||
},
|
||||
})
|
||||
@ -109,7 +109,7 @@ func frameDecode(d *decode.D) any {
|
||||
sampleSize := 0
|
||||
sideChannelIndex := -1
|
||||
|
||||
var ffi format.FlacFrameIn
|
||||
var ffi format.FLAC_Frame_In
|
||||
if d.ArgAs(&ffi) {
|
||||
sampleSize = ffi.BitsPerSample
|
||||
}
|
||||
@ -642,7 +642,7 @@ func frameDecode(d *decode.D) any {
|
||||
}
|
||||
}
|
||||
|
||||
return format.FlacFrameOut{
|
||||
return format.FLAC_Frame_Out{
|
||||
SamplesBuf: interleavedSamplesBuf,
|
||||
Samples: uint64(streamSamples),
|
||||
Channels: channels,
|
||||
|
@ -18,14 +18,14 @@ var vorbisCommentFormat decode.Group
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.FlacMetadatablock,
|
||||
format.FLAC_Metadatablock,
|
||||
&decode.Format{
|
||||
Description: "FLAC metadatablock",
|
||||
DecodeFn: metadatablockDecode,
|
||||
Dependencies: []decode.Dependency{
|
||||
{Groups: []*decode.Group{format.FlacStreaminfo}, Out: &flacStreaminfoFormat},
|
||||
{Groups: []*decode.Group{format.FlacPicture}, Out: &flacPicture},
|
||||
{Groups: []*decode.Group{format.VorbisComment}, Out: &vorbisCommentFormat},
|
||||
{Groups: []*decode.Group{format.FLAC_Streaminfo}, Out: &flacStreaminfoFormat},
|
||||
{Groups: []*decode.Group{format.FLAC_Picture}, Out: &flacPicture},
|
||||
{Groups: []*decode.Group{format.Vorbis_Comment}, Out: &vorbisCommentFormat},
|
||||
},
|
||||
})
|
||||
}
|
||||
@ -52,7 +52,7 @@ var metadataBlockNames = scalar.UintMapSymStr{
|
||||
|
||||
func metadatablockDecode(d *decode.D) any {
|
||||
var hasStreamInfo bool
|
||||
var streamInfo format.FlacStreamInfo
|
||||
var streamInfo format.FLAC_Stream_Info
|
||||
|
||||
isLastBlock := d.FieldBool("last_block")
|
||||
typ := d.FieldU7("type", metadataBlockNames)
|
||||
@ -60,7 +60,7 @@ func metadatablockDecode(d *decode.D) any {
|
||||
|
||||
switch typ {
|
||||
case MetadataBlockStreaminfo:
|
||||
flacStreaminfoOut, ok := d.Format(&flacStreaminfoFormat, nil).(format.FlacStreaminfoOut)
|
||||
flacStreaminfoOut, ok := d.Format(&flacStreaminfoFormat, nil).(format.FLAC_Streaminfo_Out)
|
||||
if !ok {
|
||||
panic(fmt.Sprintf("expected FlacStreaminfoOut, got %#+v", flacStreaminfoOut))
|
||||
}
|
||||
@ -90,7 +90,7 @@ func metadatablockDecode(d *decode.D) any {
|
||||
d.FieldRawLen("data", int64(length*8))
|
||||
}
|
||||
|
||||
return format.FlacMetadatablockOut{
|
||||
return format.FLAC_Metadatablock_Out{
|
||||
IsLastBlock: isLastBlock,
|
||||
HasStreamInfo: hasStreamInfo,
|
||||
StreamInfo: streamInfo,
|
||||
|
@ -12,25 +12,25 @@ var flacMetadatablockGroup decode.Group
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.FlacMetadatablocks,
|
||||
format.FLAC_Metadatablocks,
|
||||
&decode.Format{
|
||||
Description: "FLAC metadatablocks",
|
||||
DecodeFn: metadatablocksDecode,
|
||||
RootArray: true,
|
||||
RootName: "metadatablocks",
|
||||
Dependencies: []decode.Dependency{
|
||||
{Groups: []*decode.Group{format.FlacMetadatablock}, Out: &flacMetadatablockGroup},
|
||||
{Groups: []*decode.Group{format.FLAC_Metadatablock}, Out: &flacMetadatablockGroup},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func metadatablocksDecode(d *decode.D) any {
|
||||
flacMetadatablocksOut := format.FlacMetadatablocksOut{}
|
||||
flacMetadatablocksOut := format.FLAC_Metadatablocks_Out{}
|
||||
|
||||
isLastBlock := false
|
||||
for !isLastBlock {
|
||||
_, v := d.FieldFormat("metadatablock", &flacMetadatablockGroup, nil)
|
||||
flacMetadatablockOut, ok := v.(format.FlacMetadatablockOut)
|
||||
flacMetadatablockOut, ok := v.(format.FLAC_Metadatablock_Out)
|
||||
if !ok {
|
||||
panic(fmt.Sprintf("expected FlacMetadatablocksOut, got %#+v", flacMetadatablockOut))
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ var pictureTypeNames = scalar.UintMapSymStr{
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.FlacPicture,
|
||||
format.FLAC_Picture,
|
||||
&decode.Format{
|
||||
Description: "FLAC metadatablock picture",
|
||||
DecodeFn: pictureDecode,
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.FlacStreaminfo,
|
||||
format.FLAC_Streaminfo,
|
||||
&decode.Format{
|
||||
Description: "FLAC streaminfo",
|
||||
DecodeFn: streaminfoDecode,
|
||||
@ -30,8 +30,8 @@ func streaminfoDecode(d *decode.D) any {
|
||||
md5BR := d.FieldRawLen("md5", 16*8, scalar.RawHex)
|
||||
md5b := d.ReadAllBits(md5BR)
|
||||
|
||||
return format.FlacStreaminfoOut{
|
||||
StreamInfo: format.FlacStreamInfo{
|
||||
return format.FLAC_Streaminfo_Out{
|
||||
StreamInfo: format.FLAC_Stream_Info{
|
||||
SampleRate: sampleRate,
|
||||
BitsPerSample: bitsPerSample,
|
||||
TotalSamplesInStream: totalSamplesInStream,
|
||||
|
328
format/format.go
328
format/format.go
@ -13,190 +13,188 @@ const (
|
||||
// TODO: move to group package somehow?
|
||||
|
||||
var (
|
||||
All = &decode.Group{Name: "all"}
|
||||
|
||||
Image = &decode.Group{Name: "image"}
|
||||
Probe = &decode.Group{Name: "probe"}
|
||||
LinkFrame = &decode.Group{Name: "link_frame", DefaultInArg: LinkFrameIn{}} // ex: ethernet
|
||||
InetPacket = &decode.Group{Name: "inet_packet", DefaultInArg: InetPacketIn{}} // ex: ipv4
|
||||
IpPacket = &decode.Group{Name: "ip_packet", DefaultInArg: InetPacketIn{}} // ex: tcp
|
||||
TcpStream = &decode.Group{Name: "tcp_stream", DefaultInArg: TCPStreamIn{}} // ex: http
|
||||
UdpPayload = &decode.Group{Name: "udp_payload", DefaultInArg: UDPPayloadIn{}} // ex: dns
|
||||
Mp3FrameTags = &decode.Group{Name: "mp3_frame_tags"}
|
||||
Image = &decode.Group{Name: "image"}
|
||||
Probe = &decode.Group{Name: "probe"}
|
||||
Link_Frame = &decode.Group{Name: "link_frame", DefaultInArg: Link_Frame_In{}} // ex: ethernet
|
||||
INET_Packet = &decode.Group{Name: "inet_packet", DefaultInArg: INET_Packet_In{}} // ex: ipv4
|
||||
IP_Packet = &decode.Group{Name: "ip_packet", DefaultInArg: INET_Packet_In{}} // ex: tcp
|
||||
TCP_Stream = &decode.Group{Name: "tcp_stream", DefaultInArg: TCP_Stream_In{}} // ex: http
|
||||
UDP_Payload = &decode.Group{Name: "udp_payload", DefaultInArg: UDP_Payload_In{}} // ex: dns
|
||||
MP3_Frame_Tags = &decode.Group{Name: "mp3_frame_tags"}
|
||||
|
||||
Bytes = &decode.Group{Name: "bytes"}
|
||||
Bits = &decode.Group{Name: "bits"}
|
||||
|
||||
AacFrame = &decode.Group{Name: "aac_frame"}
|
||||
Adts = &decode.Group{Name: "adts"}
|
||||
AdtsFrame = &decode.Group{Name: "adts_frame"}
|
||||
Aiff = &decode.Group{Name: "aiff"}
|
||||
Amf0 = &decode.Group{Name: "amf0"}
|
||||
Apev2 = &decode.Group{Name: "apev2"}
|
||||
AppleBookmark = &decode.Group{Name: "apple_bookmark"}
|
||||
Ar = &decode.Group{Name: "ar"}
|
||||
Asn1Ber = &decode.Group{Name: "asn1_ber"}
|
||||
Av1Ccr = &decode.Group{Name: "av1_ccr"}
|
||||
Av1Frame = &decode.Group{Name: "av1_frame"}
|
||||
Av1Obu = &decode.Group{Name: "av1_obu"}
|
||||
AvcAnnexb = &decode.Group{Name: "avc_annexb"}
|
||||
AvcAu = &decode.Group{Name: "avc_au"}
|
||||
AvcDcr = &decode.Group{Name: "avc_dcr"}
|
||||
AvcNalu = &decode.Group{Name: "avc_nalu"}
|
||||
AvcPps = &decode.Group{Name: "avc_pps"}
|
||||
AvcSei = &decode.Group{Name: "avc_sei"}
|
||||
AvcSps = &decode.Group{Name: "avc_sps"}
|
||||
Avi = &decode.Group{Name: "avi"}
|
||||
AvroOcf = &decode.Group{Name: "avro_ocf"}
|
||||
Bencode = &decode.Group{Name: "bencode"}
|
||||
BitcoinBlkdat = &decode.Group{Name: "bitcoin_blkdat"}
|
||||
BitcoinBlock = &decode.Group{Name: "bitcoin_block"}
|
||||
BitcoinScript = &decode.Group{Name: "bitcoin_script"}
|
||||
BitcoinTransaction = &decode.Group{Name: "bitcoin_transaction"}
|
||||
Bplist = &decode.Group{Name: "bplist"}
|
||||
BsdLoopbackFrame = &decode.Group{Name: "bsd_loopback_frame"}
|
||||
Bson = &decode.Group{Name: "bson"}
|
||||
Bzip2 = &decode.Group{Name: "bzip2"}
|
||||
Cbor = &decode.Group{Name: "cbor"}
|
||||
Csv = &decode.Group{Name: "csv"}
|
||||
Dns = &decode.Group{Name: "dns"}
|
||||
DnsTcp = &decode.Group{Name: "dns_tcp"}
|
||||
Elf = &decode.Group{Name: "elf"}
|
||||
Ether8023Frame = &decode.Group{Name: "ether8023_frame"}
|
||||
Exif = &decode.Group{Name: "exif"}
|
||||
FairplaySpc = &decode.Group{Name: "fairplay_spc"}
|
||||
Flac = &decode.Group{Name: "flac"}
|
||||
FlacFrame = &decode.Group{Name: "flac_frame"}
|
||||
FlacMetadatablock = &decode.Group{Name: "flac_metadatablock"}
|
||||
FlacMetadatablocks = &decode.Group{Name: "flac_metadatablocks"}
|
||||
FlacPicture = &decode.Group{Name: "flac_picture"}
|
||||
FlacStreaminfo = &decode.Group{Name: "flac_streaminfo"}
|
||||
Flv = &decode.Group{Name: "flv"}
|
||||
Gif = &decode.Group{Name: "gif"}
|
||||
Gzip = &decode.Group{Name: "gzip"}
|
||||
HevcAnnexb = &decode.Group{Name: "hevc_annexb"}
|
||||
HevcAu = &decode.Group{Name: "hevc_au"}
|
||||
HevcDcr = &decode.Group{Name: "hevc_dcr"}
|
||||
HevcNalu = &decode.Group{Name: "hevc_nalu"}
|
||||
HevcPps = &decode.Group{Name: "hevc_pps"}
|
||||
HevcSps = &decode.Group{Name: "hevc_sps"}
|
||||
HevcVps = &decode.Group{Name: "hevc_vps"}
|
||||
Html = &decode.Group{Name: "html"}
|
||||
IccProfile = &decode.Group{Name: "icc_profile"}
|
||||
Icmp = &decode.Group{Name: "icmp"}
|
||||
Icmpv6 = &decode.Group{Name: "icmpv6"}
|
||||
Id3v1 = &decode.Group{Name: "id3v1"}
|
||||
Id3v11 = &decode.Group{Name: "id3v11"}
|
||||
Id3v2 = &decode.Group{Name: "id3v2"}
|
||||
Ipv4Packet = &decode.Group{Name: "ipv4_packet"}
|
||||
Ipv6Packet = &decode.Group{Name: "ipv6_packet"}
|
||||
Jpeg = &decode.Group{Name: "jpeg"}
|
||||
Json = &decode.Group{Name: "json"}
|
||||
Jsonl = &decode.Group{Name: "jsonl"}
|
||||
Macho = &decode.Group{Name: "macho"}
|
||||
MachoFat = &decode.Group{Name: "macho_fat"}
|
||||
Markdown = &decode.Group{Name: "markdown"}
|
||||
Matroska = &decode.Group{Name: "matroska"}
|
||||
Mp3 = &decode.Group{Name: "mp3"}
|
||||
Mp3Frame = &decode.Group{Name: "mp3_frame"}
|
||||
Mp3FrameVbri = &decode.Group{Name: "mp3_frame_vbri"}
|
||||
Mp3FrameXing = &decode.Group{Name: "mp3_frame_xing"}
|
||||
Mp4 = &decode.Group{Name: "mp4"}
|
||||
MpegAsc = &decode.Group{Name: "mpeg_asc"}
|
||||
MpegEs = &decode.Group{Name: "mpeg_es"}
|
||||
MpegPes = &decode.Group{Name: "mpeg_pes"}
|
||||
MpegPesPacket = &decode.Group{Name: "mpeg_pes_packet"}
|
||||
MpegSpu = &decode.Group{Name: "mpeg_spu"}
|
||||
MpegTs = &decode.Group{Name: "mpeg_ts"}
|
||||
Msgpack = &decode.Group{Name: "msgpack"}
|
||||
Ogg = &decode.Group{Name: "ogg"}
|
||||
OggPage = &decode.Group{Name: "ogg_page"}
|
||||
OpusPacket = &decode.Group{Name: "opus_packet"}
|
||||
Pcap = &decode.Group{Name: "pcap"}
|
||||
Pcapng = &decode.Group{Name: "pcapng"}
|
||||
Png = &decode.Group{Name: "png"}
|
||||
ProresFrame = &decode.Group{Name: "prores_frame"}
|
||||
Protobuf = &decode.Group{Name: "protobuf"}
|
||||
ProtobufWidevine = &decode.Group{Name: "protobuf_widevine"}
|
||||
PsshPlayready = &decode.Group{Name: "pssh_playready"}
|
||||
Rtmp = &decode.Group{Name: "rtmp"}
|
||||
SllPacket = &decode.Group{Name: "sll_packet"}
|
||||
Sll2Packet = &decode.Group{Name: "sll2_packet"}
|
||||
Tar = &decode.Group{Name: "tar"}
|
||||
TcpSegment = &decode.Group{Name: "tcp_segment"}
|
||||
Tiff = &decode.Group{Name: "tiff"}
|
||||
Tls = &decode.Group{Name: "tls"}
|
||||
Toml = &decode.Group{Name: "toml"}
|
||||
Tzif = &decode.Group{Name: "tzif"}
|
||||
UdpDatagram = &decode.Group{Name: "udp_datagram"}
|
||||
VorbisComment = &decode.Group{Name: "vorbis_comment"}
|
||||
VorbisPacket = &decode.Group{Name: "vorbis_packet"}
|
||||
Vp8Frame = &decode.Group{Name: "vp8_frame"}
|
||||
Vp9Cfm = &decode.Group{Name: "vp9_cfm"}
|
||||
Vp9Frame = &decode.Group{Name: "vp9_frame"}
|
||||
VpxCcr = &decode.Group{Name: "vpx_ccr"}
|
||||
Wasm = &decode.Group{Name: "wasm"}
|
||||
Wav = &decode.Group{Name: "wav"}
|
||||
Webp = &decode.Group{Name: "webp"}
|
||||
Xml = &decode.Group{Name: "xml"}
|
||||
Yaml = &decode.Group{Name: "yaml"}
|
||||
Zip = &decode.Group{Name: "zip"}
|
||||
AAC_Frame = &decode.Group{Name: "aac_frame"}
|
||||
ADTS = &decode.Group{Name: "adts"}
|
||||
ADTS_Frame = &decode.Group{Name: "adts_frame"}
|
||||
AIFF = &decode.Group{Name: "aiff"}
|
||||
AMF0 = &decode.Group{Name: "amf0"}
|
||||
Apev2 = &decode.Group{Name: "apev2"}
|
||||
Apple_Bookmark = &decode.Group{Name: "apple_bookmark"}
|
||||
AR = &decode.Group{Name: "ar"}
|
||||
ASN1_BER = &decode.Group{Name: "asn1_ber"}
|
||||
AV1_CCR = &decode.Group{Name: "av1_ccr"}
|
||||
AV1_Frame = &decode.Group{Name: "av1_frame"}
|
||||
AV1_OBU = &decode.Group{Name: "av1_obu"}
|
||||
AVC_Annexb = &decode.Group{Name: "avc_annexb"}
|
||||
AVC_AU = &decode.Group{Name: "avc_au"}
|
||||
AVC_DCR = &decode.Group{Name: "avc_dcr"}
|
||||
AVC_NALU = &decode.Group{Name: "avc_nalu"}
|
||||
AVC_PPS = &decode.Group{Name: "avc_pps"}
|
||||
AVC_SEI = &decode.Group{Name: "avc_sei"}
|
||||
AVC_SPS = &decode.Group{Name: "avc_sps"}
|
||||
AVI = &decode.Group{Name: "avi"}
|
||||
Avro_Ocf = &decode.Group{Name: "avro_ocf"}
|
||||
Bencode = &decode.Group{Name: "bencode"}
|
||||
Bitcoin_Blkdat = &decode.Group{Name: "bitcoin_blkdat"}
|
||||
Bitcoin_Block = &decode.Group{Name: "bitcoin_block"}
|
||||
Bitcoin_Script = &decode.Group{Name: "bitcoin_script"}
|
||||
Bitcoin_Transaction = &decode.Group{Name: "bitcoin_transaction"}
|
||||
Bplist = &decode.Group{Name: "bplist"}
|
||||
BSD_Loopback_Frame = &decode.Group{Name: "bsd_loopback_frame"}
|
||||
BSON = &decode.Group{Name: "bson"}
|
||||
Bzip2 = &decode.Group{Name: "bzip2"}
|
||||
CBOR = &decode.Group{Name: "cbor"}
|
||||
CSV = &decode.Group{Name: "csv"}
|
||||
DNS = &decode.Group{Name: "dns"}
|
||||
DNS_TCP = &decode.Group{Name: "dns_tcp"}
|
||||
ELF = &decode.Group{Name: "elf"}
|
||||
Ether_8023_Frame = &decode.Group{Name: "ether8023_frame"}
|
||||
Exif = &decode.Group{Name: "exif"}
|
||||
Fairplay_SPC = &decode.Group{Name: "fairplay_spc"}
|
||||
FLAC = &decode.Group{Name: "flac"}
|
||||
FLAC_Frame = &decode.Group{Name: "flac_frame"}
|
||||
FLAC_Metadatablock = &decode.Group{Name: "flac_metadatablock"}
|
||||
FLAC_Metadatablocks = &decode.Group{Name: "flac_metadatablocks"}
|
||||
FLAC_Picture = &decode.Group{Name: "flac_picture"}
|
||||
FLAC_Streaminfo = &decode.Group{Name: "flac_streaminfo"}
|
||||
FLV = &decode.Group{Name: "flv"}
|
||||
GIF = &decode.Group{Name: "gif"}
|
||||
Gzip = &decode.Group{Name: "gzip"}
|
||||
HEVC_Annexb = &decode.Group{Name: "hevc_annexb"}
|
||||
HEVC_AU = &decode.Group{Name: "hevc_au"}
|
||||
HEVC_DCR = &decode.Group{Name: "hevc_dcr"}
|
||||
HEVC_NALU = &decode.Group{Name: "hevc_nalu"}
|
||||
HEVC_PPS = &decode.Group{Name: "hevc_pps"}
|
||||
HEVC_SPS = &decode.Group{Name: "hevc_sps"}
|
||||
HEVC_VPS = &decode.Group{Name: "hevc_vps"}
|
||||
HTML = &decode.Group{Name: "html"}
|
||||
ICC_Profile = &decode.Group{Name: "icc_profile"}
|
||||
ICMP = &decode.Group{Name: "icmp"}
|
||||
ICMPv6 = &decode.Group{Name: "icmpv6"}
|
||||
ID3v1 = &decode.Group{Name: "id3v1"}
|
||||
ID3v11 = &decode.Group{Name: "id3v11"}
|
||||
ID3v2 = &decode.Group{Name: "id3v2"}
|
||||
IPv4Packet = &decode.Group{Name: "ipv4_packet"}
|
||||
IPv6Packet = &decode.Group{Name: "ipv6_packet"}
|
||||
JPEG = &decode.Group{Name: "jpeg"}
|
||||
JSON = &decode.Group{Name: "json"}
|
||||
JSONL = &decode.Group{Name: "jsonl"}
|
||||
MachO = &decode.Group{Name: "macho"}
|
||||
MachO_Fat = &decode.Group{Name: "macho_fat"}
|
||||
Markdown = &decode.Group{Name: "markdown"}
|
||||
Matroska = &decode.Group{Name: "matroska"}
|
||||
MP3 = &decode.Group{Name: "mp3"}
|
||||
MP3_Frame = &decode.Group{Name: "mp3_frame"}
|
||||
MP3_Frame_VBRI = &decode.Group{Name: "mp3_frame_vbri"}
|
||||
MP3_Frame_XING = &decode.Group{Name: "mp3_frame_xing"}
|
||||
MP4 = &decode.Group{Name: "mp4"}
|
||||
MPEG_ASC = &decode.Group{Name: "mpeg_asc"}
|
||||
MPEG_ES = &decode.Group{Name: "mpeg_es"}
|
||||
MPES_PES = &decode.Group{Name: "mpeg_pes"}
|
||||
MPEG_PES_Packet = &decode.Group{Name: "mpeg_pes_packet"}
|
||||
MPEG_SPU = &decode.Group{Name: "mpeg_spu"}
|
||||
MPEG_TS = &decode.Group{Name: "mpeg_ts"}
|
||||
MsgPack = &decode.Group{Name: "msgpack"}
|
||||
Ogg = &decode.Group{Name: "ogg"}
|
||||
Ogg_Page = &decode.Group{Name: "ogg_page"}
|
||||
Opus_Packet = &decode.Group{Name: "opus_packet"}
|
||||
PCAP = &decode.Group{Name: "pcap"}
|
||||
PCAPNG = &decode.Group{Name: "pcapng"}
|
||||
PNG = &decode.Group{Name: "png"}
|
||||
Prores_Frame = &decode.Group{Name: "prores_frame"}
|
||||
Protobuf = &decode.Group{Name: "protobuf"}
|
||||
ProtobufWidevine = &decode.Group{Name: "protobuf_widevine"}
|
||||
PSSH_Playready = &decode.Group{Name: "pssh_playready"}
|
||||
RTMP = &decode.Group{Name: "rtmp"}
|
||||
SLL_Packet = &decode.Group{Name: "sll_packet"}
|
||||
SLL2_Packet = &decode.Group{Name: "sll2_packet"}
|
||||
TAR = &decode.Group{Name: "tar"}
|
||||
TCP_Segment = &decode.Group{Name: "tcp_segment"}
|
||||
TIFF = &decode.Group{Name: "tiff"}
|
||||
TLS = &decode.Group{Name: "tls"}
|
||||
TOML = &decode.Group{Name: "toml"}
|
||||
Tzif = &decode.Group{Name: "tzif"}
|
||||
UDP_Datagram = &decode.Group{Name: "udp_datagram"}
|
||||
Vorbis_Comment = &decode.Group{Name: "vorbis_comment"}
|
||||
Vorbis_Packet = &decode.Group{Name: "vorbis_packet"}
|
||||
VP8_Frame = &decode.Group{Name: "vp8_frame"}
|
||||
VP9_CFM = &decode.Group{Name: "vp9_cfm"}
|
||||
VP9_Frame = &decode.Group{Name: "vp9_frame"}
|
||||
VPX_CCR = &decode.Group{Name: "vpx_ccr"}
|
||||
WASM = &decode.Group{Name: "wasm"}
|
||||
WAV = &decode.Group{Name: "wav"}
|
||||
WebP = &decode.Group{Name: "webp"}
|
||||
XML = &decode.Group{Name: "xml"}
|
||||
YAML = &decode.Group{Name: "yaml"}
|
||||
Zip = &decode.Group{Name: "zip"}
|
||||
)
|
||||
|
||||
// below are data types used to communicate between formats <FormatName>In/Out
|
||||
|
||||
type AACFrameIn struct {
|
||||
type AAC_Frame_In struct {
|
||||
ObjectType int `doc:"Audio object type"`
|
||||
}
|
||||
type AvcAuIn struct {
|
||||
type AVC_AU_In struct {
|
||||
LengthSize uint64 `doc:"Length value size"`
|
||||
}
|
||||
|
||||
type AvcDcrOut struct {
|
||||
type AVC_DCR_Out struct {
|
||||
LengthSize uint64
|
||||
}
|
||||
type FlacFrameIn struct {
|
||||
type FLAC_Frame_In struct {
|
||||
SamplesBuf []byte
|
||||
BitsPerSample int `doc:"Bits per sample"`
|
||||
}
|
||||
|
||||
type FlacFrameOut struct {
|
||||
type FLAC_Frame_Out struct {
|
||||
SamplesBuf []byte
|
||||
Samples uint64
|
||||
Channels int
|
||||
BitsPerSample int
|
||||
}
|
||||
type FlacStreamInfo struct {
|
||||
type FLAC_Stream_Info struct {
|
||||
SampleRate uint64
|
||||
BitsPerSample uint64
|
||||
TotalSamplesInStream uint64
|
||||
MD5 []byte
|
||||
}
|
||||
|
||||
type FlacStreaminfoOut struct {
|
||||
StreamInfo FlacStreamInfo
|
||||
type FLAC_Streaminfo_Out struct {
|
||||
StreamInfo FLAC_Stream_Info
|
||||
}
|
||||
|
||||
type FlacMetadatablockOut struct {
|
||||
type FLAC_Metadatablock_Out struct {
|
||||
IsLastBlock bool
|
||||
HasStreamInfo bool
|
||||
StreamInfo FlacStreamInfo
|
||||
StreamInfo FLAC_Stream_Info
|
||||
}
|
||||
|
||||
type FlacMetadatablocksOut struct {
|
||||
type FLAC_Metadatablocks_Out struct {
|
||||
HasStreamInfo bool
|
||||
StreamInfo FlacStreamInfo
|
||||
StreamInfo FLAC_Stream_Info
|
||||
}
|
||||
|
||||
type HevcAuIn struct {
|
||||
type HEVC_AU_In struct {
|
||||
LengthSize uint64 `doc:"Length value size"`
|
||||
}
|
||||
|
||||
type HevcDcrOut struct {
|
||||
type HEVC_DCR_Out struct {
|
||||
LengthSize uint64
|
||||
}
|
||||
|
||||
type OggPageOut struct {
|
||||
type Ogg_Page_Out struct {
|
||||
IsLastPage bool
|
||||
IsFirstPage bool
|
||||
IsContinuedPacket bool
|
||||
@ -205,21 +203,21 @@ type OggPageOut struct {
|
||||
Segments [][]byte
|
||||
}
|
||||
|
||||
type ProtoBufIn struct {
|
||||
type Protobuf_In struct {
|
||||
Message ProtoBufMessage
|
||||
}
|
||||
|
||||
type MatroskaIn struct {
|
||||
type Matroska_In struct {
|
||||
DecodeSamples bool `doc:"Decode samples"`
|
||||
}
|
||||
|
||||
type Mp3In struct {
|
||||
type MP3_In struct {
|
||||
MaxUniqueHeaderConfigs int `doc:"Max number of unique frame header configs allowed"`
|
||||
MaxUnknown int `doc:"Max percent (0-100) unknown bits"`
|
||||
MaxSyncSeek int `doc:"Max byte distance to next sync"`
|
||||
}
|
||||
|
||||
type MP3FrameOut struct {
|
||||
type MP3_Frame_Out struct {
|
||||
MPEGVersion int
|
||||
ProtectionAbsent bool
|
||||
BitRate int
|
||||
@ -228,38 +226,38 @@ type MP3FrameOut struct {
|
||||
ChannelModeIndex int
|
||||
}
|
||||
|
||||
type MpegDecoderConfig struct {
|
||||
type MPEG_Decoder_Config struct {
|
||||
ObjectType int
|
||||
ASCObjectType int
|
||||
}
|
||||
|
||||
type MpegEsOut struct {
|
||||
DecoderConfigs []MpegDecoderConfig
|
||||
type MPEG_ES_Out struct {
|
||||
DecoderConfigs []MPEG_Decoder_Config
|
||||
}
|
||||
|
||||
type MPEGASCOut struct {
|
||||
type MPEG_ASC_Out struct {
|
||||
ObjectType int
|
||||
}
|
||||
|
||||
type LinkFrameIn struct {
|
||||
type Link_Frame_In struct {
|
||||
Type int
|
||||
IsLittleEndian bool // pcap endian etc
|
||||
}
|
||||
|
||||
type InetPacketIn struct {
|
||||
type INET_Packet_In struct {
|
||||
EtherType int
|
||||
}
|
||||
|
||||
type IPPacketIn struct {
|
||||
type IP_Packet_In struct {
|
||||
Protocol int
|
||||
}
|
||||
|
||||
type UDPPayloadIn struct {
|
||||
type UDP_Payload_In struct {
|
||||
SourcePort int
|
||||
DestinationPort int
|
||||
}
|
||||
|
||||
func (u UDPPayloadIn) IsPort(ports ...int) bool {
|
||||
func (u UDP_Payload_In) IsPort(ports ...int) bool {
|
||||
for _, p := range ports {
|
||||
if u.DestinationPort == p || u.SourcePort == p {
|
||||
return true
|
||||
@ -268,13 +266,13 @@ func (u UDPPayloadIn) IsPort(ports ...int) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (u UDPPayloadIn) MustIsPort(fn func(format string, a ...any), ports ...int) {
|
||||
func (u UDP_Payload_In) MustIsPort(fn func(format string, a ...any), ports ...int) {
|
||||
if !u.IsPort(ports...) {
|
||||
fn("incorrect udp port %t src:%d dst:%d", u.DestinationPort, u.SourcePort)
|
||||
}
|
||||
}
|
||||
|
||||
type TCPStreamIn struct {
|
||||
type TCP_Stream_In struct {
|
||||
IsClient bool
|
||||
HasStart bool
|
||||
HasEnd bool
|
||||
@ -283,12 +281,12 @@ type TCPStreamIn struct {
|
||||
DestinationPort int
|
||||
}
|
||||
|
||||
type TCPStreamOut struct {
|
||||
type TCP_Stream_Out struct {
|
||||
PostFn func(peerIn any)
|
||||
InArg any
|
||||
}
|
||||
|
||||
func (t TCPStreamIn) IsPort(ports ...int) bool {
|
||||
func (t TCP_Stream_In) IsPort(ports ...int) bool {
|
||||
for _, p := range ports {
|
||||
if (t.IsClient && t.DestinationPort == p) ||
|
||||
(!t.IsClient && t.SourcePort == p) {
|
||||
@ -298,46 +296,46 @@ func (t TCPStreamIn) IsPort(ports ...int) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (t TCPStreamIn) MustIsPort(fn func(format string, a ...any), ports ...int) {
|
||||
func (t TCP_Stream_In) MustIsPort(fn func(format string, a ...any), ports ...int) {
|
||||
if !t.IsPort(ports...) {
|
||||
fn("incorrect tcp port client %t src:%d dst:%d", t.IsClient, t.DestinationPort, t.SourcePort)
|
||||
}
|
||||
}
|
||||
|
||||
type Mp4In struct {
|
||||
type MP4_In struct {
|
||||
DecodeSamples bool `doc:"Decode samples"`
|
||||
AllowTruncated bool `doc:"Allow box to be truncated"`
|
||||
}
|
||||
|
||||
type AviIn struct {
|
||||
type AVI_In struct {
|
||||
DecodeSamples bool `doc:"Decode samples"`
|
||||
}
|
||||
|
||||
type ZipIn struct {
|
||||
type Zip_In struct {
|
||||
Uncompress bool `doc:"Uncompress and probe files"`
|
||||
}
|
||||
|
||||
type XMLIn struct {
|
||||
type XML_In struct {
|
||||
Seq bool `doc:"Use seq attribute to preserve element order"`
|
||||
Array bool `doc:"Decode as nested arrays"`
|
||||
AttributePrefix string `doc:"Prefix for attribute keys"`
|
||||
}
|
||||
|
||||
type HTMLIn struct {
|
||||
type HTML_In struct {
|
||||
Seq bool `doc:"Use seq attribute to preserve element order"`
|
||||
Array bool `doc:"Decode as nested arrays"`
|
||||
AttributePrefix string `doc:"Prefix for attribute keys"`
|
||||
}
|
||||
|
||||
type CSVLIn struct {
|
||||
type CSV_In struct {
|
||||
Comma string `doc:"Separator character"`
|
||||
Comment string `doc:"Comment line character"`
|
||||
}
|
||||
|
||||
type BitCoinBlockIn struct {
|
||||
type Bitcoin_Block_In struct {
|
||||
HasHeader bool `doc:"Has blkdat header"`
|
||||
}
|
||||
|
||||
type TLSIn struct {
|
||||
type TLS_In struct {
|
||||
Keylog string `doc:"NSS Key Log content"`
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ import (
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.Gif,
|
||||
format.GIF,
|
||||
&decode.Format{
|
||||
Description: "Graphics Interchange Format",
|
||||
Groups: []*decode.Group{format.Probe, format.Image},
|
||||
|
@ -12,7 +12,7 @@ import (
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.IccProfile,
|
||||
format.ICC_Profile,
|
||||
&decode.Format{
|
||||
Description: "International Color Consortium profile",
|
||||
DecodeFn: iccProfileDecode,
|
||||
|
@ -11,7 +11,7 @@ import (
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.Id3v1,
|
||||
format.ID3v1,
|
||||
&decode.Format{
|
||||
Description: "ID3v1 metadata",
|
||||
DecodeFn: id3v1Decode,
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.Id3v11,
|
||||
format.ID3v11,
|
||||
&decode.Format{
|
||||
Description: "ID3v1.1 metadata",
|
||||
DecodeFn: id3v11Decode,
|
||||
|
@ -23,7 +23,7 @@ var imageGroup decode.Group
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.Id3v2,
|
||||
format.ID3v2,
|
||||
&decode.Format{
|
||||
Description: "ID3v2 metadata",
|
||||
DecodeFn: id3v2Decode,
|
||||
|
@ -13,11 +13,11 @@ var bsdLoopbackFrameInetPacketGroup decode.Group
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.BsdLoopbackFrame, &decode.Format{
|
||||
format.BSD_Loopback_Frame, &decode.Format{
|
||||
Description: "BSD loopback frame",
|
||||
Groups: []*decode.Group{format.LinkFrame},
|
||||
Groups: []*decode.Group{format.Link_Frame},
|
||||
Dependencies: []decode.Dependency{
|
||||
{Groups: []*decode.Group{format.InetPacket}, Out: &bsdLoopbackFrameInetPacketGroup},
|
||||
{Groups: []*decode.Group{format.INET_Packet}, Out: &bsdLoopbackFrameInetPacketGroup},
|
||||
},
|
||||
DecodeFn: decodeLoopbackFrame,
|
||||
})
|
||||
@ -39,7 +39,7 @@ var bsdLookbackNetworkLayerMap = scalar.UintMap{
|
||||
}
|
||||
|
||||
func decodeLoopbackFrame(d *decode.D) any {
|
||||
var lfi format.LinkFrameIn
|
||||
var lfi format.Link_Frame_In
|
||||
if d.ArgAs(&lfi) {
|
||||
if lfi.Type != format.LinkTypeNULL {
|
||||
d.Fatalf("wrong link type %d", lfi.Type)
|
||||
@ -58,7 +58,7 @@ func decodeLoopbackFrame(d *decode.D) any {
|
||||
d.BitsLeft(),
|
||||
&bsdLoopbackFrameInetPacketGroup,
|
||||
// TODO: unknown mapped to ether type 0 is ok?
|
||||
format.InetPacketIn{EtherType: bsdLoopbackFrameNetworkLayerEtherType[networkLayer]},
|
||||
format.INET_Packet_In{EtherType: bsdLoopbackFrameNetworkLayerEtherType[networkLayer]},
|
||||
)
|
||||
|
||||
return nil
|
||||
|
@ -16,12 +16,12 @@ var ether8023FrameInetPacketGroup decode.Group
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.Ether8023Frame,
|
||||
format.Ether_8023_Frame,
|
||||
&decode.Format{
|
||||
Description: "Ethernet 802.3 frame",
|
||||
Groups: []*decode.Group{format.LinkFrame},
|
||||
Groups: []*decode.Group{format.Link_Frame},
|
||||
Dependencies: []decode.Dependency{
|
||||
{Groups: []*decode.Group{format.InetPacket}, Out: ðer8023FrameInetPacketGroup},
|
||||
{Groups: []*decode.Group{format.INET_Packet}, Out: ðer8023FrameInetPacketGroup},
|
||||
},
|
||||
DecodeFn: decodeEthernetFrame,
|
||||
})
|
||||
@ -36,7 +36,7 @@ var mapUToEtherSym = scalar.UintFn(func(s scalar.Uint) (scalar.Uint, error) {
|
||||
})
|
||||
|
||||
func decodeEthernetFrame(d *decode.D) any {
|
||||
var lfi format.LinkFrameIn
|
||||
var lfi format.Link_Frame_In
|
||||
if d.ArgAs(&lfi) {
|
||||
if lfi.Type != format.LinkTypeETHERNET {
|
||||
d.Fatalf("wrong link type %d", lfi.Type)
|
||||
@ -51,7 +51,7 @@ func decodeEthernetFrame(d *decode.D) any {
|
||||
"payload",
|
||||
d.BitsLeft(),
|
||||
ðer8023FrameInetPacketGroup,
|
||||
format.InetPacketIn{EtherType: int(etherType)},
|
||||
format.INET_Packet_In{EtherType: int(etherType)},
|
||||
)
|
||||
|
||||
return nil
|
||||
|
@ -9,10 +9,10 @@ import (
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.Icmp,
|
||||
format.ICMP,
|
||||
&decode.Format{
|
||||
Description: "Internet Control Message Protocol",
|
||||
Groups: []*decode.Group{format.IpPacket},
|
||||
Groups: []*decode.Group{format.IP_Packet},
|
||||
DecodeFn: decodeICMP,
|
||||
})
|
||||
}
|
||||
@ -94,7 +94,7 @@ var icmpCodeMapMap = map[uint64]scalar.UintMapDescription{
|
||||
}
|
||||
|
||||
func decodeICMP(d *decode.D) any {
|
||||
var ipi format.IPPacketIn
|
||||
var ipi format.IP_Packet_In
|
||||
if d.ArgAs(&ipi) && ipi.Protocol != format.IPv4ProtocolICMP {
|
||||
d.Fatalf("incorrect protocol %d", ipi.Protocol)
|
||||
}
|
||||
|
@ -9,10 +9,10 @@ import (
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.Icmpv6,
|
||||
format.ICMPv6,
|
||||
&decode.Format{
|
||||
Description: "Internet Control Message Protocol v6",
|
||||
Groups: []*decode.Group{format.IpPacket},
|
||||
Groups: []*decode.Group{format.IP_Packet},
|
||||
DecodeFn: decodeICMPv6,
|
||||
})
|
||||
}
|
||||
@ -79,7 +79,7 @@ var icmpv6CodeMapMap = map[uint64]scalar.UintMapDescription{
|
||||
}
|
||||
|
||||
func decodeICMPv6(d *decode.D) any {
|
||||
var ipi format.IPPacketIn
|
||||
var ipi format.IP_Packet_In
|
||||
if d.ArgAs(&ipi) && ipi.Protocol != format.IPv4ProtocolICMPv6 {
|
||||
d.Fatalf("incorrect protocol %d", ipi.Protocol)
|
||||
}
|
||||
|
@ -16,15 +16,15 @@ var ipv4IpPacketGroup decode.Group
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.Ipv4Packet,
|
||||
format.IPv4Packet,
|
||||
&decode.Format{
|
||||
Description: "Internet protocol v4 packet",
|
||||
Groups: []*decode.Group{
|
||||
format.InetPacket,
|
||||
format.LinkFrame,
|
||||
format.INET_Packet,
|
||||
format.Link_Frame,
|
||||
},
|
||||
Dependencies: []decode.Dependency{
|
||||
{Groups: []*decode.Group{format.IpPacket}, Out: &ipv4IpPacketGroup},
|
||||
{Groups: []*decode.Group{format.IP_Packet}, Out: &ipv4IpPacketGroup},
|
||||
},
|
||||
DecodeFn: decodeIPv4,
|
||||
})
|
||||
@ -54,8 +54,8 @@ var mapUToIPv4Sym = scalar.UintFn(func(s scalar.Uint) (scalar.Uint, error) {
|
||||
})
|
||||
|
||||
func decodeIPv4(d *decode.D) any {
|
||||
var ipi format.InetPacketIn
|
||||
var lfi format.LinkFrameIn
|
||||
var ipi format.INET_Packet_In
|
||||
var lfi format.Link_Frame_In
|
||||
if d.ArgAs(&ipi) && ipi.EtherType != format.EtherTypeIPv4 {
|
||||
d.Fatalf("incorrect ethertype %d", ipi.EtherType)
|
||||
} else if d.ArgAs(&lfi) && lfi.Type != format.LinkTypeIPv4 && lfi.Type != format.LinkTypeRAW {
|
||||
@ -115,7 +115,7 @@ func decodeIPv4(d *decode.D) any {
|
||||
"payload",
|
||||
dataLen,
|
||||
&ipv4IpPacketGroup,
|
||||
format.IPPacketIn{Protocol: int(protocol)},
|
||||
format.IP_Packet_In{Protocol: int(protocol)},
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -15,15 +15,15 @@ var ipv6IpPacketGroup decode.Group
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.Ipv6Packet,
|
||||
format.IPv6Packet,
|
||||
&decode.Format{
|
||||
Description: "Internet protocol v6 packet",
|
||||
Groups: []*decode.Group{
|
||||
format.InetPacket,
|
||||
format.LinkFrame,
|
||||
format.INET_Packet,
|
||||
format.Link_Frame,
|
||||
},
|
||||
Dependencies: []decode.Dependency{
|
||||
{Groups: []*decode.Group{format.IpPacket}, Out: &ipv6IpPacketGroup},
|
||||
{Groups: []*decode.Group{format.IP_Packet}, Out: &ipv6IpPacketGroup},
|
||||
},
|
||||
DecodeFn: decodeIPv6,
|
||||
})
|
||||
@ -113,8 +113,8 @@ var mapUToIPv6Sym = scalar.BitBufFn(func(s scalar.BitBuf) (scalar.BitBuf, error)
|
||||
})
|
||||
|
||||
func decodeIPv6(d *decode.D) any {
|
||||
var ipi format.InetPacketIn
|
||||
var lfi format.LinkFrameIn
|
||||
var ipi format.INET_Packet_In
|
||||
var lfi format.Link_Frame_In
|
||||
if d.ArgAs(&ipi) && ipi.EtherType != format.EtherTypeIPv6 {
|
||||
d.Fatalf("incorrect ethertype %d", ipi.EtherType)
|
||||
} else if d.ArgAs(&lfi) && lfi.Type != format.LinkTypeIPv6 && lfi.Type != format.LinkTypeRAW {
|
||||
@ -174,7 +174,7 @@ func decodeIPv6(d *decode.D) any {
|
||||
"payload",
|
||||
payloadLen,
|
||||
&ipv4IpPacketGroup,
|
||||
format.IPPacketIn{Protocol: int(nextHeader)},
|
||||
format.IP_Packet_In{Protocol: int(nextHeader)},
|
||||
)
|
||||
|
||||
return nil
|
||||
|
@ -14,19 +14,19 @@ var sllPacket2InetPacketGroup decode.Group
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.Sll2Packet,
|
||||
format.SLL2_Packet,
|
||||
&decode.Format{
|
||||
Description: "Linux cooked capture encapsulation v2",
|
||||
Groups: []*decode.Group{format.LinkFrame},
|
||||
Groups: []*decode.Group{format.Link_Frame},
|
||||
Dependencies: []decode.Dependency{
|
||||
{Groups: []*decode.Group{format.InetPacket}, Out: &sllPacket2InetPacketGroup},
|
||||
{Groups: []*decode.Group{format.INET_Packet}, Out: &sllPacket2InetPacketGroup},
|
||||
},
|
||||
DecodeFn: decodeSLL2,
|
||||
})
|
||||
}
|
||||
|
||||
func decodeSLL2(d *decode.D) any {
|
||||
var lfi format.LinkFrameIn
|
||||
var lfi format.Link_Frame_In
|
||||
if d.ArgAs(&lfi) && lfi.Type != format.LinkTypeLINUX_SLL2 {
|
||||
d.Fatalf("wrong link type %d", lfi.Type)
|
||||
}
|
||||
@ -56,7 +56,7 @@ func decodeSLL2(d *decode.D) any {
|
||||
"payload",
|
||||
d.BitsLeft(),
|
||||
&sllPacket2InetPacketGroup,
|
||||
format.InetPacketIn{EtherType: int(protcolType)},
|
||||
format.INET_Packet_In{EtherType: int(protcolType)},
|
||||
)
|
||||
default:
|
||||
d.FieldRawLen("payload", d.BitsLeft())
|
||||
|
@ -14,12 +14,12 @@ var sllPacketInetPacketGroup decode.Group
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.SllPacket,
|
||||
format.SLL_Packet,
|
||||
&decode.Format{
|
||||
Description: "Linux cooked capture encapsulation",
|
||||
Groups: []*decode.Group{format.LinkFrame},
|
||||
Groups: []*decode.Group{format.Link_Frame},
|
||||
Dependencies: []decode.Dependency{
|
||||
{Groups: []*decode.Group{format.InetPacket}, Out: &sllPacketInetPacketGroup},
|
||||
{Groups: []*decode.Group{format.INET_Packet}, Out: &sllPacketInetPacketGroup},
|
||||
},
|
||||
DecodeFn: decodeSLL,
|
||||
})
|
||||
@ -110,7 +110,7 @@ var arpHdrTypeMAp = scalar.UintMap{
|
||||
}
|
||||
|
||||
func decodeSLL(d *decode.D) any {
|
||||
var lfi format.LinkFrameIn
|
||||
var lfi format.Link_Frame_In
|
||||
if d.ArgAs(&lfi) && lfi.Type != format.LinkTypeLINUX_SLL {
|
||||
d.Fatalf("wrong link type %d", lfi.Type)
|
||||
}
|
||||
@ -133,7 +133,7 @@ func decodeSLL(d *decode.D) any {
|
||||
"payload",
|
||||
d.BitsLeft(),
|
||||
&sllPacketInetPacketGroup,
|
||||
format.InetPacketIn{EtherType: int(protcolType)},
|
||||
format.INET_Packet_In{EtherType: int(protcolType)},
|
||||
)
|
||||
default:
|
||||
d.FieldU16LE("protocol_type")
|
||||
|
@ -11,10 +11,10 @@ import (
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.TcpSegment,
|
||||
format.TCP_Segment,
|
||||
&decode.Format{
|
||||
Description: "Transmission control protocol segment",
|
||||
Groups: []*decode.Group{format.IpPacket},
|
||||
Groups: []*decode.Group{format.IP_Packet},
|
||||
DecodeFn: decodeTCP,
|
||||
})
|
||||
}
|
||||
@ -40,7 +40,7 @@ var tcpOptionsMap = scalar.UintMap{
|
||||
}
|
||||
|
||||
func decodeTCP(d *decode.D) any {
|
||||
var ipi format.IPPacketIn
|
||||
var ipi format.IP_Packet_In
|
||||
if d.ArgAs(&ipi) && ipi.Protocol != format.IPv4ProtocolTCP {
|
||||
d.Fatalf("incorrect protocol %d", ipi.Protocol)
|
||||
}
|
||||
|
@ -11,19 +11,19 @@ var udpPayloadGroup decode.Group
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.UdpDatagram,
|
||||
format.UDP_Datagram,
|
||||
&decode.Format{
|
||||
Description: "User datagram protocol",
|
||||
Groups: []*decode.Group{format.IpPacket},
|
||||
Groups: []*decode.Group{format.IP_Packet},
|
||||
Dependencies: []decode.Dependency{
|
||||
{Groups: []*decode.Group{format.UdpPayload}, Out: &udpPayloadGroup},
|
||||
{Groups: []*decode.Group{format.UDP_Payload}, Out: &udpPayloadGroup},
|
||||
},
|
||||
DecodeFn: decodeUDP,
|
||||
})
|
||||
}
|
||||
|
||||
func decodeUDP(d *decode.D) any {
|
||||
var ipi format.IPPacketIn
|
||||
var ipi format.IP_Packet_In
|
||||
if d.ArgAs(&ipi) && ipi.Protocol != format.IPv4ProtocolUDP {
|
||||
d.Fatalf("incorrect protocol %d", ipi.Protocol)
|
||||
}
|
||||
@ -38,7 +38,7 @@ func decodeUDP(d *decode.D) any {
|
||||
"payload",
|
||||
payloadLen,
|
||||
&udpPayloadGroup,
|
||||
format.UDPPayloadIn{
|
||||
format.UDP_Payload_In{
|
||||
SourcePort: int(sourcePort),
|
||||
DestinationPort: int(destPort),
|
||||
},
|
||||
|
@ -19,14 +19,14 @@ var iccProfileFormat decode.Group
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.Jpeg,
|
||||
format.JPEG,
|
||||
&decode.Format{
|
||||
Description: "Joint Photographic Experts Group file",
|
||||
Groups: []*decode.Group{format.Probe, format.Image},
|
||||
DecodeFn: jpegDecode,
|
||||
Dependencies: []decode.Dependency{
|
||||
{Groups: []*decode.Group{format.Exif}, Out: &exifFormat},
|
||||
{Groups: []*decode.Group{format.IccProfile}, Out: &iccProfileFormat},
|
||||
{Groups: []*decode.Group{format.ICC_Profile}, Out: &iccProfileFormat},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ var jsonFS embed.FS
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.Json,
|
||||
format.JSON,
|
||||
&decode.Format{
|
||||
Description: "JavaScript Object Notation",
|
||||
ProbeOrder: format.ProbeOrderTextJSON,
|
||||
|
@ -16,7 +16,7 @@ var jsonlFS embed.FS
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.Jsonl,
|
||||
format.JSONL,
|
||||
&decode.Format{
|
||||
Description: "JavaScript Object Notation Lines",
|
||||
ProbeOrder: format.ProbeOrderTextFuzzy,
|
||||
|
@ -57,29 +57,29 @@ func init() {
|
||||
Description: "Matroska file",
|
||||
Groups: []*decode.Group{format.Probe},
|
||||
DecodeFn: matroskaDecode,
|
||||
DefaultInArg: format.MatroskaIn{
|
||||
DefaultInArg: format.Matroska_In{
|
||||
DecodeSamples: true,
|
||||
},
|
||||
Dependencies: []decode.Dependency{
|
||||
{Groups: []*decode.Group{format.AacFrame}, Out: &aacFrameGroup},
|
||||
{Groups: []*decode.Group{format.Av1Ccr}, Out: &av1CCRGroup},
|
||||
{Groups: []*decode.Group{format.Av1Frame}, Out: &av1FrameGroup},
|
||||
{Groups: []*decode.Group{format.AvcAu}, Out: &mpegAVCAUGroup},
|
||||
{Groups: []*decode.Group{format.AvcDcr}, Out: &mpegAVCDCRGroup},
|
||||
{Groups: []*decode.Group{format.FlacFrame}, Out: &flacFrameGroup},
|
||||
{Groups: []*decode.Group{format.FlacMetadatablocks}, Out: &flacMetadatablocksGroup},
|
||||
{Groups: []*decode.Group{format.HevcAu}, Out: &mpegHEVCSampleGroup},
|
||||
{Groups: []*decode.Group{format.HevcDcr}, Out: &mpegHEVCDCRGroup},
|
||||
{Groups: []*decode.Group{format.AAC_Frame}, Out: &aacFrameGroup},
|
||||
{Groups: []*decode.Group{format.AV1_CCR}, Out: &av1CCRGroup},
|
||||
{Groups: []*decode.Group{format.AV1_Frame}, Out: &av1FrameGroup},
|
||||
{Groups: []*decode.Group{format.AVC_AU}, Out: &mpegAVCAUGroup},
|
||||
{Groups: []*decode.Group{format.AVC_DCR}, Out: &mpegAVCDCRGroup},
|
||||
{Groups: []*decode.Group{format.FLAC_Frame}, Out: &flacFrameGroup},
|
||||
{Groups: []*decode.Group{format.FLAC_Metadatablocks}, Out: &flacMetadatablocksGroup},
|
||||
{Groups: []*decode.Group{format.HEVC_AU}, Out: &mpegHEVCSampleGroup},
|
||||
{Groups: []*decode.Group{format.HEVC_DCR}, Out: &mpegHEVCDCRGroup},
|
||||
{Groups: []*decode.Group{format.Image}, Out: &imageGroup},
|
||||
{Groups: []*decode.Group{format.Mp3Frame}, Out: &mp3FrameGroup},
|
||||
{Groups: []*decode.Group{format.MpegAsc}, Out: &mpegASCFrameGroup},
|
||||
{Groups: []*decode.Group{format.MpegPesPacket}, Out: &mpegPESPacketSampleGroup},
|
||||
{Groups: []*decode.Group{format.MpegSpu}, Out: &mpegSPUFrameGroup},
|
||||
{Groups: []*decode.Group{format.OpusPacket}, Out: &opusPacketFrameGroup},
|
||||
{Groups: []*decode.Group{format.VorbisPacket}, Out: &vorbisPacketGroup},
|
||||
{Groups: []*decode.Group{format.Vp8Frame}, Out: &vp8FrameGroup},
|
||||
{Groups: []*decode.Group{format.Vp9Cfm}, Out: &vp9CFMGroup},
|
||||
{Groups: []*decode.Group{format.Vp9Frame}, Out: &vp9FrameGroup},
|
||||
{Groups: []*decode.Group{format.MP3_Frame}, Out: &mp3FrameGroup},
|
||||
{Groups: []*decode.Group{format.MPEG_ASC}, Out: &mpegASCFrameGroup},
|
||||
{Groups: []*decode.Group{format.MPEG_PES_Packet}, Out: &mpegPESPacketSampleGroup},
|
||||
{Groups: []*decode.Group{format.MPEG_SPU}, Out: &mpegSPUFrameGroup},
|
||||
{Groups: []*decode.Group{format.Opus_Packet}, Out: &opusPacketFrameGroup},
|
||||
{Groups: []*decode.Group{format.Vorbis_Packet}, Out: &vorbisPacketGroup},
|
||||
{Groups: []*decode.Group{format.VP8_Frame}, Out: &vp8FrameGroup},
|
||||
{Groups: []*decode.Group{format.VP9_CFM}, Out: &vp9CFMGroup},
|
||||
{Groups: []*decode.Group{format.VP9_Frame}, Out: &vp9FrameGroup},
|
||||
},
|
||||
})
|
||||
interp.RegisterFS(matroskaFS)
|
||||
@ -442,7 +442,7 @@ func decodeMaster(d *decode.D, bitsLimit int64, elm *ebml.Master, unknownSize bo
|
||||
}
|
||||
|
||||
func matroskaDecode(d *decode.D) any {
|
||||
var mi format.MatroskaIn
|
||||
var mi format.Matroska_In
|
||||
d.ArgAs(&mi)
|
||||
|
||||
ebmlHeaderID := uint64(0x1a45dfa3)
|
||||
@ -477,12 +477,12 @@ func matroskaDecode(d *decode.D) any {
|
||||
})
|
||||
case "A_AAC":
|
||||
_, v := t.parentD.FieldFormatRange("value", t.codecPrivatePos, t.codecPrivateTagSize, &mpegASCFrameGroup, nil)
|
||||
mpegASCOut, ok := v.(format.MPEGASCOut)
|
||||
mpegASCOut, ok := v.(format.MPEG_ASC_Out)
|
||||
if !ok {
|
||||
panic(fmt.Sprintf("expected mpegASCOut got %#+v", v))
|
||||
}
|
||||
//nolint:gosimple
|
||||
t.formatInArg = format.AACFrameIn{ObjectType: mpegASCOut.ObjectType}
|
||||
t.formatInArg = format.AAC_Frame_In{ObjectType: mpegASCOut.ObjectType}
|
||||
case "A_OPUS":
|
||||
t.parentD.FieldFormatRange("value", t.codecPrivatePos, t.codecPrivateTagSize, &opusPacketFrameGroup, nil)
|
||||
case "A_FLAC":
|
||||
@ -490,29 +490,29 @@ func matroskaDecode(d *decode.D) any {
|
||||
d.FieldStruct("value", func(d *decode.D) {
|
||||
d.FieldUTF8("magic", 4, d.StrAssert("fLaC"))
|
||||
_, v := d.FieldFormat("metadatablocks", &flacMetadatablocksGroup, nil)
|
||||
flacMetadatablockOut, ok := v.(format.FlacMetadatablocksOut)
|
||||
flacMetadatablockOut, ok := v.(format.FLAC_Metadatablocks_Out)
|
||||
if !ok {
|
||||
panic(fmt.Sprintf("expected FlacMetadatablockOut got %#+v", v))
|
||||
}
|
||||
if flacMetadatablockOut.HasStreamInfo {
|
||||
t.formatInArg = format.FlacFrameIn{BitsPerSample: int(flacMetadatablockOut.StreamInfo.BitsPerSample)}
|
||||
t.formatInArg = format.FLAC_Frame_In{BitsPerSample: int(flacMetadatablockOut.StreamInfo.BitsPerSample)}
|
||||
}
|
||||
})
|
||||
})
|
||||
case "V_MPEG4/ISO/AVC":
|
||||
_, v := t.parentD.FieldFormatRange("value", t.codecPrivatePos, t.codecPrivateTagSize, &mpegAVCDCRGroup, nil)
|
||||
avcDcrOut, ok := v.(format.AvcDcrOut)
|
||||
avcDcrOut, ok := v.(format.AVC_DCR_Out)
|
||||
if !ok {
|
||||
panic(fmt.Sprintf("expected AvcDcrOut got %#+v", v))
|
||||
}
|
||||
t.formatInArg = format.AvcAuIn{LengthSize: avcDcrOut.LengthSize} //nolint:gosimple
|
||||
t.formatInArg = format.AVC_AU_In{LengthSize: avcDcrOut.LengthSize} //nolint:gosimple
|
||||
case "V_MPEGH/ISO/HEVC":
|
||||
_, v := t.parentD.FieldFormatRange("value", t.codecPrivatePos, t.codecPrivateTagSize, &mpegHEVCDCRGroup, nil)
|
||||
hevcDcrOut, ok := v.(format.HevcDcrOut)
|
||||
hevcDcrOut, ok := v.(format.HEVC_DCR_Out)
|
||||
if !ok {
|
||||
panic(fmt.Sprintf("expected HevcDcrOut got %#+v", v))
|
||||
}
|
||||
t.formatInArg = format.HevcAuIn{LengthSize: hevcDcrOut.LengthSize} //nolint:gosimple
|
||||
t.formatInArg = format.HEVC_AU_In{LengthSize: hevcDcrOut.LengthSize} //nolint:gosimple
|
||||
case "V_AV1":
|
||||
t.parentD.FieldFormatRange("value", t.codecPrivatePos, t.codecPrivateTagSize, &av1CCRGroup, nil)
|
||||
case "V_VP9":
|
||||
|
@ -16,34 +16,34 @@ var mp3FrameGroup decode.Group
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.Mp3,
|
||||
format.MP3,
|
||||
&decode.Format{
|
||||
ProbeOrder: format.ProbeOrderBinFuzzy, // after most others (silent samples and jpeg header can look like mp3 sync)
|
||||
Description: "MP3 file",
|
||||
Groups: []*decode.Group{format.Probe},
|
||||
DecodeFn: mp3Decode,
|
||||
DefaultInArg: format.Mp3In{
|
||||
DefaultInArg: format.MP3_In{
|
||||
MaxUniqueHeaderConfigs: 5,
|
||||
MaxUnknown: 50,
|
||||
MaxSyncSeek: 4 * 1024 * 8,
|
||||
},
|
||||
Dependencies: []decode.Dependency{
|
||||
{Groups: []*decode.Group{format.Id3v2}, Out: &headerGroup},
|
||||
{Groups: []*decode.Group{format.ID3v2}, Out: &headerGroup},
|
||||
{
|
||||
Groups: []*decode.Group{
|
||||
format.Id3v1,
|
||||
format.Id3v11,
|
||||
format.ID3v1,
|
||||
format.ID3v11,
|
||||
format.Apev2,
|
||||
},
|
||||
Out: &footerGroup,
|
||||
},
|
||||
{Groups: []*decode.Group{format.Mp3Frame}, Out: &mp3FrameGroup},
|
||||
{Groups: []*decode.Group{format.MP3_Frame}, Out: &mp3FrameGroup},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func mp3Decode(d *decode.D) any {
|
||||
var mi format.Mp3In
|
||||
var mi format.MP3_In
|
||||
d.ArgAs(&mi)
|
||||
|
||||
// things in a mp3 stream usually have few unique combinations of.
|
||||
@ -93,7 +93,7 @@ func mp3Decode(d *decode.D) any {
|
||||
d.SeekRel(8)
|
||||
continue
|
||||
}
|
||||
mfo, ok := v.(format.MP3FrameOut)
|
||||
mfo, ok := v.(format.MP3_Frame_Out)
|
||||
if !ok {
|
||||
panic(fmt.Sprintf("expected MP3FrameOut got %#+v", v))
|
||||
}
|
||||
|
@ -11,10 +11,10 @@ import (
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.Mp3FrameVbri,
|
||||
format.MP3_Frame_VBRI,
|
||||
&decode.Format{
|
||||
Description: "MP3 frame Fraunhofer encoder variable bitrate tag",
|
||||
Groups: []*decode.Group{format.Mp3FrameTags},
|
||||
Groups: []*decode.Group{format.MP3_Frame_Tags},
|
||||
DecodeFn: mp3FrameTagVBRIDecode,
|
||||
})
|
||||
}
|
||||
|
@ -12,10 +12,10 @@ import (
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.Mp3FrameXing,
|
||||
format.MP3_Frame_XING,
|
||||
&decode.Format{
|
||||
Description: "MP3 frame Xing/Info tag",
|
||||
Groups: []*decode.Group{format.Mp3FrameTags},
|
||||
Groups: []*decode.Group{format.MP3_Frame_Tags},
|
||||
DecodeFn: mp3FrameTagXingDecode,
|
||||
})
|
||||
}
|
||||
|
@ -677,33 +677,33 @@ func decodeBox(ctx *decodeContext, d *decode.D, typ string) {
|
||||
})
|
||||
case "avcC":
|
||||
_, v := d.FieldFormat("descriptor", &avcDCRGroup, nil)
|
||||
avcDcrOut, ok := v.(format.AvcDcrOut)
|
||||
avcDcrOut, ok := v.(format.AVC_DCR_Out)
|
||||
if !ok {
|
||||
panic(fmt.Sprintf("expected AvcDcrOut got %#+v", v))
|
||||
}
|
||||
if t := ctx.currentTrack(); t != nil {
|
||||
t.formatInArg = format.AvcAuIn{LengthSize: avcDcrOut.LengthSize} //nolint:gosimple
|
||||
t.formatInArg = format.AVC_AU_In{LengthSize: avcDcrOut.LengthSize} //nolint:gosimple
|
||||
}
|
||||
case "hvcC":
|
||||
_, v := d.FieldFormat("descriptor", &hevcCDCRGroup, nil)
|
||||
hevcDcrOut, ok := v.(format.HevcDcrOut)
|
||||
hevcDcrOut, ok := v.(format.HEVC_DCR_Out)
|
||||
if !ok {
|
||||
panic(fmt.Sprintf("expected HevcDcrOut got %#+v", v))
|
||||
}
|
||||
if t := ctx.currentTrack(); t != nil {
|
||||
t.formatInArg = format.HevcAuIn{LengthSize: hevcDcrOut.LengthSize} //nolint:gosimple
|
||||
t.formatInArg = format.HEVC_AU_In{LengthSize: hevcDcrOut.LengthSize} //nolint:gosimple
|
||||
}
|
||||
case "dfLa":
|
||||
d.FieldU8("version")
|
||||
d.FieldU24("flags")
|
||||
_, v := d.FieldFormat("descriptor", &flacMetadatablocksGroup, nil)
|
||||
flacMetadatablockOut, ok := v.(format.FlacMetadatablocksOut)
|
||||
flacMetadatablockOut, ok := v.(format.FLAC_Metadatablocks_Out)
|
||||
if !ok {
|
||||
panic(fmt.Sprintf("expected FlacMetadatablockOut got %#+v", v))
|
||||
}
|
||||
if flacMetadatablockOut.HasStreamInfo {
|
||||
if t := ctx.currentTrack(); t != nil {
|
||||
t.formatInArg = format.FlacFrameIn{BitsPerSample: int(flacMetadatablockOut.StreamInfo.BitsPerSample)}
|
||||
t.formatInArg = format.FLAC_Frame_In{BitsPerSample: int(flacMetadatablockOut.StreamInfo.BitsPerSample)}
|
||||
}
|
||||
}
|
||||
case "dOps":
|
||||
@ -717,7 +717,7 @@ func decodeBox(ctx *decodeContext, d *decode.D, typ string) {
|
||||
case "esds":
|
||||
d.FieldU32("version")
|
||||
_, v := d.FieldFormat("descriptor", &mpegESGroup, nil)
|
||||
mpegEsOut, ok := v.(format.MpegEsOut)
|
||||
mpegEsOut, ok := v.(format.MPEG_ES_Out)
|
||||
if !ok {
|
||||
panic(fmt.Sprintf("expected mpegEsOut got %#+v", v))
|
||||
}
|
||||
@ -725,7 +725,7 @@ func decodeBox(ctx *decodeContext, d *decode.D, typ string) {
|
||||
if t := ctx.currentTrack(); t != nil && len(mpegEsOut.DecoderConfigs) > 0 {
|
||||
dc := mpegEsOut.DecoderConfigs[0]
|
||||
t.objectType = dc.ObjectType
|
||||
t.formatInArg = format.AACFrameIn{ObjectType: dc.ASCObjectType}
|
||||
t.formatInArg = format.AAC_Frame_In{ObjectType: dc.ASCObjectType}
|
||||
}
|
||||
case "stts":
|
||||
d.FieldU8("version")
|
||||
|
@ -56,7 +56,7 @@ var vpxCCRGroup decode.Group
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.Mp4,
|
||||
format.MP4,
|
||||
&decode.Format{
|
||||
Description: "ISOBMFF, QuickTime and similar",
|
||||
Groups: []*decode.Group{
|
||||
@ -64,35 +64,35 @@ func init() {
|
||||
format.Image, // avif
|
||||
},
|
||||
DecodeFn: mp4Decode,
|
||||
DefaultInArg: format.Mp4In{
|
||||
DefaultInArg: format.MP4_In{
|
||||
DecodeSamples: true,
|
||||
AllowTruncated: false,
|
||||
},
|
||||
Dependencies: []decode.Dependency{
|
||||
{Groups: []*decode.Group{format.AacFrame}, Out: &aacFrameGroup},
|
||||
{Groups: []*decode.Group{format.Av1Ccr}, Out: &av1CCRGroup},
|
||||
{Groups: []*decode.Group{format.Av1Frame}, Out: &av1FrameGroup},
|
||||
{Groups: []*decode.Group{format.AvcAu}, Out: &avcAUGroup},
|
||||
{Groups: []*decode.Group{format.AvcDcr}, Out: &avcDCRGroup},
|
||||
{Groups: []*decode.Group{format.FlacFrame}, Out: &flacFrameGroup},
|
||||
{Groups: []*decode.Group{format.FlacMetadatablocks}, Out: &flacMetadatablocksGroup},
|
||||
{Groups: []*decode.Group{format.HevcAu}, Out: &hevcAUGroup},
|
||||
{Groups: []*decode.Group{format.HevcDcr}, Out: &hevcCDCRGroup},
|
||||
{Groups: []*decode.Group{format.IccProfile}, Out: &iccProfileGroup},
|
||||
{Groups: []*decode.Group{format.Id3v2}, Out: &id3v2Group},
|
||||
{Groups: []*decode.Group{format.AAC_Frame}, Out: &aacFrameGroup},
|
||||
{Groups: []*decode.Group{format.AV1_CCR}, Out: &av1CCRGroup},
|
||||
{Groups: []*decode.Group{format.AV1_Frame}, Out: &av1FrameGroup},
|
||||
{Groups: []*decode.Group{format.AVC_AU}, Out: &avcAUGroup},
|
||||
{Groups: []*decode.Group{format.AVC_DCR}, Out: &avcDCRGroup},
|
||||
{Groups: []*decode.Group{format.FLAC_Frame}, Out: &flacFrameGroup},
|
||||
{Groups: []*decode.Group{format.FLAC_Metadatablocks}, Out: &flacMetadatablocksGroup},
|
||||
{Groups: []*decode.Group{format.HEVC_AU}, Out: &hevcAUGroup},
|
||||
{Groups: []*decode.Group{format.HEVC_DCR}, Out: &hevcCDCRGroup},
|
||||
{Groups: []*decode.Group{format.ICC_Profile}, Out: &iccProfileGroup},
|
||||
{Groups: []*decode.Group{format.ID3v2}, Out: &id3v2Group},
|
||||
{Groups: []*decode.Group{format.Image}, Out: &imageGroup},
|
||||
{Groups: []*decode.Group{format.Jpeg}, Out: &jpegGroup},
|
||||
{Groups: []*decode.Group{format.Mp3Frame}, Out: &mp3FrameGroup},
|
||||
{Groups: []*decode.Group{format.MpegEs}, Out: &mpegESGroup},
|
||||
{Groups: []*decode.Group{format.MpegPesPacket}, Out: &mpegPESPacketSampleGroup},
|
||||
{Groups: []*decode.Group{format.OpusPacket}, Out: &opusPacketFrameGroup},
|
||||
{Groups: []*decode.Group{format.Png}, Out: &pngGroup},
|
||||
{Groups: []*decode.Group{format.ProresFrame}, Out: &proResFrameGroup},
|
||||
{Groups: []*decode.Group{format.JPEG}, Out: &jpegGroup},
|
||||
{Groups: []*decode.Group{format.MP3_Frame}, Out: &mp3FrameGroup},
|
||||
{Groups: []*decode.Group{format.MPEG_ES}, Out: &mpegESGroup},
|
||||
{Groups: []*decode.Group{format.MPEG_PES_Packet}, Out: &mpegPESPacketSampleGroup},
|
||||
{Groups: []*decode.Group{format.Opus_Packet}, Out: &opusPacketFrameGroup},
|
||||
{Groups: []*decode.Group{format.PNG}, Out: &pngGroup},
|
||||
{Groups: []*decode.Group{format.Prores_Frame}, Out: &proResFrameGroup},
|
||||
{Groups: []*decode.Group{format.ProtobufWidevine}, Out: &protoBufWidevineGroup},
|
||||
{Groups: []*decode.Group{format.PsshPlayready}, Out: &psshPlayreadyGroup},
|
||||
{Groups: []*decode.Group{format.VorbisPacket}, Out: &vorbisPacketGroup},
|
||||
{Groups: []*decode.Group{format.Vp9Frame}, Out: &vp9FrameGroup},
|
||||
{Groups: []*decode.Group{format.VpxCcr}, Out: &vpxCCRGroup},
|
||||
{Groups: []*decode.Group{format.PSSH_Playready}, Out: &psshPlayreadyGroup},
|
||||
{Groups: []*decode.Group{format.Vorbis_Packet}, Out: &vorbisPacketGroup},
|
||||
{Groups: []*decode.Group{format.VP9_Frame}, Out: &vp9FrameGroup},
|
||||
{Groups: []*decode.Group{format.VPX_CCR}, Out: &vpxCCRGroup},
|
||||
},
|
||||
})
|
||||
interp.RegisterFS(mp4FS)
|
||||
@ -151,7 +151,7 @@ type pathEntry struct {
|
||||
}
|
||||
|
||||
type decodeContext struct {
|
||||
opts format.Mp4In
|
||||
opts format.MP4_In
|
||||
path []pathEntry
|
||||
tracks map[int]*track
|
||||
}
|
||||
@ -419,7 +419,7 @@ func mp4Tracks(d *decode.D, ctx *decodeContext) {
|
||||
}
|
||||
|
||||
func mp4Decode(d *decode.D) any {
|
||||
var mi format.Mp4In
|
||||
var mi format.MP4_In
|
||||
d.ArgAs(&mi)
|
||||
|
||||
ctx := &decodeContext{
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.PsshPlayready,
|
||||
format.PSSH_Playready,
|
||||
&decode.Format{
|
||||
Description: "PlayReady PSSH",
|
||||
DecodeFn: playreadyPsshDecode,
|
||||
|
@ -15,11 +15,11 @@ import (
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.AacFrame,
|
||||
format.AAC_Frame,
|
||||
&decode.Format{
|
||||
Description: "Advanced Audio Coding frame",
|
||||
DecodeFn: aacDecode,
|
||||
DefaultInArg: format.AACFrameIn{
|
||||
DefaultInArg: format.AAC_Frame_In{
|
||||
ObjectType: format.MPEGAudioObjectTypeMain,
|
||||
},
|
||||
RootArray: true,
|
||||
@ -272,7 +272,7 @@ func aacFillElement(d *decode.D) {
|
||||
}
|
||||
|
||||
func aacDecode(d *decode.D) any {
|
||||
var ai format.AACFrameIn
|
||||
var ai format.AAC_Frame_In
|
||||
d.ArgAs(&ai)
|
||||
|
||||
// TODO: seems tricky to know length of blocks
|
||||
|
@ -10,7 +10,7 @@ var adtsFrameGroup decode.Group
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.Adts,
|
||||
format.ADTS,
|
||||
&decode.Format{
|
||||
Description: "Audio Data Transport Stream",
|
||||
Groups: []*decode.Group{format.Probe},
|
||||
@ -18,7 +18,7 @@ func init() {
|
||||
RootArray: true,
|
||||
RootName: "frames",
|
||||
Dependencies: []decode.Dependency{
|
||||
{Groups: []*decode.Group{format.AdtsFrame}, Out: &adtsFrameGroup},
|
||||
{Groups: []*decode.Group{format.ADTS_Frame}, Out: &adtsFrameGroup},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
@ -15,12 +15,12 @@ var aacFrameGroup decode.Group
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.AdtsFrame,
|
||||
format.ADTS_Frame,
|
||||
&decode.Format{
|
||||
Description: "Audio Data Transport Stream frame",
|
||||
DecodeFn: adtsFrameDecoder,
|
||||
Dependencies: []decode.Dependency{
|
||||
{Groups: []*decode.Group{format.AacFrame}, Out: &aacFrameGroup},
|
||||
{Groups: []*decode.Group{format.AAC_Frame}, Out: &aacFrameGroup},
|
||||
},
|
||||
})
|
||||
}
|
||||
@ -98,7 +98,7 @@ func adtsFrameDecoder(d *decode.D) any {
|
||||
|
||||
d.FieldArray("raw_data_blocks", func(d *decode.D) {
|
||||
for i := uint64(0); i < numberOfRDBs; i++ {
|
||||
d.FieldFormatLen("raw_data_block", dataLength*8, &aacFrameGroup, format.AACFrameIn{ObjectType: int(objectType)})
|
||||
d.FieldFormatLen("raw_data_block", dataLength*8, &aacFrameGroup, format.AAC_Frame_In{ObjectType: int(objectType)})
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -6,20 +6,20 @@ import (
|
||||
"github.com/wader/fq/pkg/interp"
|
||||
)
|
||||
|
||||
var annexBAVCNALUFormat decode.Group
|
||||
var annexBAVCNALUGroup decode.Group
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.AvcAnnexb,
|
||||
format.AVC_Annexb,
|
||||
&decode.Format{
|
||||
Description: "H.264/AVC Annex B",
|
||||
DecodeFn: func(d *decode.D) any {
|
||||
return annexBDecode(d, annexBAVCNALUFormat)
|
||||
return annexBDecode(d, annexBAVCNALUGroup)
|
||||
},
|
||||
RootArray: true,
|
||||
RootName: "stream",
|
||||
Dependencies: []decode.Dependency{
|
||||
{Groups: []*decode.Group{format.AvcNalu}, Out: &annexBAVCNALUFormat},
|
||||
{Groups: []*decode.Group{format.AVC_NALU}, Out: &annexBAVCNALUGroup},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
@ -12,23 +12,23 @@ var avcNALUFormat decode.Group
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.AvcAu,
|
||||
format.AVC_AU,
|
||||
&decode.Format{
|
||||
Description: "H.264/AVC Access Unit",
|
||||
DecodeFn: avcAUDecode,
|
||||
DefaultInArg: format.AvcAuIn{
|
||||
DefaultInArg: format.AVC_AU_In{
|
||||
LengthSize: 0,
|
||||
},
|
||||
RootArray: true,
|
||||
RootName: "access_unit",
|
||||
Dependencies: []decode.Dependency{
|
||||
{Groups: []*decode.Group{format.AvcNalu}, Out: &avcNALUFormat},
|
||||
{Groups: []*decode.Group{format.AVC_NALU}, Out: &avcNALUFormat},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func avcAUDecode(d *decode.D) any {
|
||||
var ai format.AvcAuIn
|
||||
var ai format.AVC_AU_In
|
||||
d.ArgAs(&ai)
|
||||
|
||||
if ai.LengthSize == 0 {
|
||||
|
@ -16,12 +16,12 @@ var avcDCRNALFormat decode.Group
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.AvcDcr,
|
||||
format.AVC_DCR,
|
||||
&decode.Format{
|
||||
Description: "H.264/AVC Decoder Configuration Record",
|
||||
DecodeFn: avcDcrDecode,
|
||||
Dependencies: []decode.Dependency{
|
||||
{Groups: []*decode.Group{format.AvcNalu}, Out: &avcDCRNALFormat},
|
||||
{Groups: []*decode.Group{format.AVC_NALU}, Out: &avcDCRNALFormat},
|
||||
},
|
||||
})
|
||||
}
|
||||
@ -146,5 +146,5 @@ func avcDcrDecode(d *decode.D) any {
|
||||
// TODO: something wrong here, seen files with profileIdc = 100 with no bytes after picture_parameter_sets
|
||||
// https://github.com/FFmpeg/FFmpeg/blob/069d2b4a50a6eb2f925f36884e6b9bd9a1e54670/libavcodec/h264_ps.c#L333
|
||||
|
||||
return format.AvcDcrOut{LengthSize: lengthSize}
|
||||
return format.AVC_DCR_Out{LengthSize: lengthSize}
|
||||
}
|
||||
|
@ -17,14 +17,14 @@ var avcSEIFormat decode.Group
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.AvcNalu,
|
||||
format.AVC_NALU,
|
||||
&decode.Format{
|
||||
Description: "H.264/AVC Network Access Layer Unit",
|
||||
DecodeFn: avcNALUDecode,
|
||||
Dependencies: []decode.Dependency{
|
||||
{Groups: []*decode.Group{format.AvcSps}, Out: &avcSPSFormat},
|
||||
{Groups: []*decode.Group{format.AvcPps}, Out: &avcPPSFormat},
|
||||
{Groups: []*decode.Group{format.AvcSei}, Out: &avcSEIFormat},
|
||||
{Groups: []*decode.Group{format.AVC_SPS}, Out: &avcSPSFormat},
|
||||
{Groups: []*decode.Group{format.AVC_PPS}, Out: &avcPPSFormat},
|
||||
{Groups: []*decode.Group{format.AVC_SEI}, Out: &avcSEIFormat},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.AvcPps,
|
||||
format.AVC_PPS,
|
||||
&decode.Format{
|
||||
Description: "H.264/AVC Picture Parameter Set",
|
||||
DecodeFn: avcPPSDecode,
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.AvcSei,
|
||||
format.AVC_SEI,
|
||||
&decode.Format{
|
||||
Description: "H.264/AVC Supplemental Enhancement Information",
|
||||
DecodeFn: avcSEIDecode,
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.AvcSps,
|
||||
format.AVC_SPS,
|
||||
&decode.Format{
|
||||
Description: "H.264/AVC Sequence Parameter Set",
|
||||
DecodeFn: avcSPSDecode,
|
||||
|
@ -10,7 +10,7 @@ var annexBHEVCNALUFormat decode.Group
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.HevcAnnexb,
|
||||
format.HEVC_Annexb,
|
||||
&decode.Format{
|
||||
Description: "H.265/HEVC Annex B",
|
||||
DecodeFn: func(d *decode.D) any {
|
||||
@ -19,7 +19,7 @@ func init() {
|
||||
RootArray: true,
|
||||
RootName: "stream",
|
||||
Dependencies: []decode.Dependency{
|
||||
{Groups: []*decode.Group{format.HevcNalu}, Out: &annexBHEVCNALUFormat},
|
||||
{Groups: []*decode.Group{format.HEVC_NALU}, Out: &annexBHEVCNALUFormat},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
@ -10,24 +10,24 @@ var hevcAUNALGroup decode.Group
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.HevcAu,
|
||||
format.HEVC_AU,
|
||||
&decode.Format{
|
||||
Description: "H.265/HEVC Access Unit",
|
||||
DecodeFn: hevcAUDecode,
|
||||
DefaultInArg: format.HevcAuIn{
|
||||
DefaultInArg: format.HEVC_AU_In{
|
||||
LengthSize: 4,
|
||||
},
|
||||
RootArray: true,
|
||||
RootName: "access_unit",
|
||||
Dependencies: []decode.Dependency{
|
||||
{Groups: []*decode.Group{format.HevcNalu}, Out: &hevcAUNALGroup},
|
||||
{Groups: []*decode.Group{format.HEVC_NALU}, Out: &hevcAUNALGroup},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
// TODO: share/refactor with avcAUDecode?
|
||||
func hevcAUDecode(d *decode.D) any {
|
||||
var hi format.HevcAuIn
|
||||
var hi format.HEVC_AU_In
|
||||
d.ArgAs(&hi)
|
||||
|
||||
if hi.LengthSize == 0 {
|
||||
|
@ -11,12 +11,12 @@ var hevcDCRNALGroup decode.Group
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.HevcDcr,
|
||||
format.HEVC_DCR,
|
||||
&decode.Format{
|
||||
Description: "H.265/HEVC Decoder Configuration Record",
|
||||
DecodeFn: hevcDcrDecode,
|
||||
Dependencies: []decode.Dependency{
|
||||
{Groups: []*decode.Group{format.HevcNalu}, Out: &hevcDCRNALGroup},
|
||||
{Groups: []*decode.Group{format.HEVC_NALU}, Out: &hevcDCRNALGroup},
|
||||
},
|
||||
})
|
||||
}
|
||||
@ -64,5 +64,5 @@ func hevcDcrDecode(d *decode.D) any {
|
||||
}
|
||||
})
|
||||
|
||||
return format.HevcDcrOut{LengthSize: lengthSize}
|
||||
return format.HEVC_DCR_Out{LengthSize: lengthSize}
|
||||
}
|
||||
|
@ -14,14 +14,14 @@ var hevcSPSGroup decode.Group
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.HevcNalu,
|
||||
format.HEVC_NALU,
|
||||
&decode.Format{
|
||||
Description: "H.265/HEVC Network Access Layer Unit",
|
||||
DecodeFn: hevcNALUDecode,
|
||||
Dependencies: []decode.Dependency{
|
||||
{Groups: []*decode.Group{format.HevcVps}, Out: &hevcVPSGroup},
|
||||
{Groups: []*decode.Group{format.HevcPps}, Out: &hevcPPSGroup},
|
||||
{Groups: []*decode.Group{format.HevcSps}, Out: &hevcSPSGroup},
|
||||
{Groups: []*decode.Group{format.HEVC_VPS}, Out: &hevcVPSGroup},
|
||||
{Groups: []*decode.Group{format.HEVC_PPS}, Out: &hevcPPSGroup},
|
||||
{Groups: []*decode.Group{format.HEVC_SPS}, Out: &hevcSPSGroup},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ import (
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.HevcPps,
|
||||
format.HEVC_PPS,
|
||||
&decode.Format{
|
||||
Description: "H.265/HEVC Picture Parameter Set",
|
||||
DecodeFn: hevcPPSDecode,
|
||||
|
@ -10,7 +10,7 @@ import (
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.HevcSps,
|
||||
format.HEVC_SPS,
|
||||
&decode.Format{
|
||||
Description: "H.265/HEVC Sequence Parameter Set",
|
||||
DecodeFn: hevcSPSDecode,
|
||||
|
@ -10,7 +10,7 @@ import (
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.HevcVps,
|
||||
format.HEVC_VPS,
|
||||
&decode.Format{
|
||||
Description: "H.265/HEVC Video Parameter Set",
|
||||
DecodeFn: hevcVPSDecode,
|
||||
|
@ -25,12 +25,12 @@ var mp3FrameTagsGroup decode.Group
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.Mp3Frame,
|
||||
format.MP3_Frame,
|
||||
&decode.Format{
|
||||
Description: "MPEG audio layer 3 frame",
|
||||
DecodeFn: frameDecode,
|
||||
Dependencies: []decode.Dependency{
|
||||
{Groups: []*decode.Group{format.Mp3FrameTags}, Out: &mp3FrameTagsGroup},
|
||||
{Groups: []*decode.Group{format.MP3_Frame_Tags}, Out: &mp3FrameTagsGroup},
|
||||
},
|
||||
})
|
||||
}
|
||||
@ -391,7 +391,7 @@ func frameDecode(d *decode.D) any {
|
||||
|
||||
d.FieldValueBitBuf("crc_calculated", bitio.NewBitReader(crcHash.Sum(nil), -1), scalar.RawHex)
|
||||
|
||||
return format.MP3FrameOut{
|
||||
return format.MP3_Frame_Out{
|
||||
MPEGVersion: int(mpegVersionNr),
|
||||
ProtectionAbsent: protectionAbsent,
|
||||
BitRate: bitRate,
|
||||
|
@ -11,7 +11,7 @@ import (
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.MpegAsc,
|
||||
format.MPEG_ASC,
|
||||
&decode.Format{
|
||||
Description: "MPEG-4 Audio Specific Config",
|
||||
DecodeFn: ascDecoder,
|
||||
@ -52,5 +52,5 @@ func ascDecoder(d *decode.D) any {
|
||||
// TODO: GASpecificConfig etc
|
||||
d.FieldRawLen("var_aot_or_byte_align", d.BitsLeft())
|
||||
|
||||
return format.MPEGASCOut{ObjectType: int(objectType)}
|
||||
return format.MPEG_ASC_Out{ObjectType: int(objectType)}
|
||||
}
|
||||
|
@ -14,13 +14,13 @@ var vorbisPacketGroup decode.Group
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.MpegEs,
|
||||
format.MPEG_ES,
|
||||
&decode.Format{
|
||||
Description: "MPEG Elementary Stream",
|
||||
DecodeFn: esDecode,
|
||||
Dependencies: []decode.Dependency{
|
||||
{Groups: []*decode.Group{format.MpegAsc}, Out: &mpegASCGroup},
|
||||
{Groups: []*decode.Group{format.VorbisPacket}, Out: &vorbisPacketGroup},
|
||||
{Groups: []*decode.Group{format.MPEG_ASC}, Out: &mpegASCGroup},
|
||||
{Groups: []*decode.Group{format.Vorbis_Packet}, Out: &vorbisPacketGroup},
|
||||
},
|
||||
})
|
||||
}
|
||||
@ -169,8 +169,8 @@ func fieldODDecodeTag(d *decode.D, edc *esDecodeContext, name string, expectedTa
|
||||
}
|
||||
|
||||
type esDecodeContext struct {
|
||||
currentDecoderConfig *format.MpegDecoderConfig
|
||||
decoderConfigs []format.MpegDecoderConfig
|
||||
currentDecoderConfig *format.MPEG_Decoder_Config
|
||||
decoderConfigs []format.MPEG_Decoder_Config
|
||||
}
|
||||
|
||||
func odDecodeTag(d *decode.D, edc *esDecodeContext, _ int, fn func(d *decode.D)) {
|
||||
@ -196,7 +196,7 @@ func odDecodeTag(d *decode.D, edc *esDecodeContext, _ int, fn func(d *decode.D))
|
||||
},
|
||||
DecoderConfigDescrTag: func(d *decode.D) {
|
||||
objectType := d.FieldU8("object_type_indication", format.MpegObjectTypeNames)
|
||||
edc.decoderConfigs = append(edc.decoderConfigs, format.MpegDecoderConfig{
|
||||
edc.decoderConfigs = append(edc.decoderConfigs, format.MPEG_Decoder_Config{
|
||||
ObjectType: int(objectType),
|
||||
})
|
||||
edc.currentDecoderConfig = &edc.decoderConfigs[len(edc.decoderConfigs)-1]
|
||||
@ -245,7 +245,7 @@ func odDecodeTag(d *decode.D, edc *esDecodeContext, _ int, fn func(d *decode.D))
|
||||
case format.MPEGStreamTypeAudio:
|
||||
fieldODDecodeTag(d, edc, "decoder_specific_info", -1, func(d *decode.D) {
|
||||
_, v := d.FieldFormat("audio_specific_config", &mpegASCGroup, nil)
|
||||
mpegASCout, ok := v.(format.MPEGASCOut)
|
||||
mpegASCout, ok := v.(format.MPEG_ASC_Out)
|
||||
if !ok {
|
||||
panic(fmt.Sprintf("expected MPEGASCOut got %#+v", v))
|
||||
}
|
||||
@ -280,5 +280,5 @@ func odDecodeTag(d *decode.D, edc *esDecodeContext, _ int, fn func(d *decode.D))
|
||||
func esDecode(d *decode.D) any {
|
||||
var edc esDecodeContext
|
||||
odDecodeTag(d, &edc, -1, nil)
|
||||
return format.MpegEsOut{DecoderConfigs: edc.decoderConfigs}
|
||||
return format.MPEG_ES_Out{DecoderConfigs: edc.decoderConfigs}
|
||||
}
|
||||
|
@ -16,15 +16,15 @@ var mpegSpuGroup decode.Group
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.MpegPes,
|
||||
format.MPES_PES,
|
||||
&decode.Format{
|
||||
Description: "MPEG Packetized elementary stream",
|
||||
DecodeFn: pesDecode,
|
||||
RootArray: true,
|
||||
RootName: "packets",
|
||||
Dependencies: []decode.Dependency{
|
||||
{Groups: []*decode.Group{format.MpegPesPacket}, Out: &pesPacketGroup},
|
||||
{Groups: []*decode.Group{format.MpegSpu}, Out: &mpegSpuGroup},
|
||||
{Groups: []*decode.Group{format.MPEG_PES_Packet}, Out: &pesPacketGroup},
|
||||
{Groups: []*decode.Group{format.MPEG_SPU}, Out: &mpegSpuGroup},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ import (
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.MpegPesPacket,
|
||||
format.MPEG_PES_Packet,
|
||||
&decode.Format{
|
||||
Description: "MPEG Packetized elementary stream packet",
|
||||
DecodeFn: pesPacketDecode,
|
||||
|
@ -16,7 +16,7 @@ import (
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.MpegSpu,
|
||||
format.MPEG_SPU,
|
||||
&decode.Format{
|
||||
Description: "Sub Picture Unit (DVD subtitle)",
|
||||
DecodeFn: spuDecode,
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.MpegTs,
|
||||
format.MPEG_TS,
|
||||
&decode.Format{
|
||||
ProbeOrder: format.ProbeOrderBinFuzzy, // make sure to be after gif, both start with 0x47
|
||||
Description: "MPEG Transport Stream",
|
||||
|
@ -19,7 +19,7 @@ var msgPackFS embed.FS
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.Msgpack,
|
||||
format.MsgPack,
|
||||
&decode.Format{
|
||||
Description: "MessagePack",
|
||||
DecodeFn: decodeMsgPack,
|
||||
|
@ -26,11 +26,11 @@ func init() {
|
||||
Groups: []*decode.Group{format.Probe},
|
||||
DecodeFn: decodeOgg,
|
||||
Dependencies: []decode.Dependency{
|
||||
{Groups: []*decode.Group{format.OggPage}, Out: &oggPageGroup},
|
||||
{Groups: []*decode.Group{format.VorbisPacket}, Out: &vorbisPacketGroup},
|
||||
{Groups: []*decode.Group{format.OpusPacket}, Out: &opusPacketGroup},
|
||||
{Groups: []*decode.Group{format.FlacMetadatablock}, Out: &flacMetadatablockGroup},
|
||||
{Groups: []*decode.Group{format.FlacFrame}, Out: &flacFrameGroup},
|
||||
{Groups: []*decode.Group{format.Ogg_Page}, Out: &oggPageGroup},
|
||||
{Groups: []*decode.Group{format.Vorbis_Packet}, Out: &vorbisPacketGroup},
|
||||
{Groups: []*decode.Group{format.Opus_Packet}, Out: &opusPacketGroup},
|
||||
{Groups: []*decode.Group{format.FLAC_Metadatablock}, Out: &flacMetadatablockGroup},
|
||||
{Groups: []*decode.Group{format.FLAC_Frame}, Out: &flacFrameGroup},
|
||||
},
|
||||
})
|
||||
}
|
||||
@ -55,7 +55,7 @@ type stream struct {
|
||||
packetBuf []byte
|
||||
packetD *decode.D
|
||||
codec streamCodec
|
||||
flacStreamInfo format.FlacStreamInfo
|
||||
flacStreamInfo format.FLAC_Stream_Info
|
||||
}
|
||||
|
||||
func decodeOgg(d *decode.D) any {
|
||||
@ -69,7 +69,7 @@ func decodeOgg(d *decode.D) any {
|
||||
if dv == nil {
|
||||
break
|
||||
}
|
||||
oggPageOut, ok := dv.(format.OggPageOut)
|
||||
oggPageOut, ok := dv.(format.Ogg_Page_Out)
|
||||
if !ok {
|
||||
panic("page decode is not a oggPageOut")
|
||||
}
|
||||
@ -144,7 +144,7 @@ func decodeOgg(d *decode.D) any {
|
||||
d.FieldU16("header_packets")
|
||||
d.FieldUTF8("flac_signature", 4)
|
||||
_, v := d.FieldFormat("metadatablock", &flacMetadatablockGroup, nil)
|
||||
flacMetadatablockOut, ok := v.(format.FlacMetadatablockOut)
|
||||
flacMetadatablockOut, ok := v.(format.FLAC_Metadatablock_Out)
|
||||
if !ok {
|
||||
panic(fmt.Sprintf("expected FlacMetadatablockOut, got %#+v", flacMetadatablockOut))
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ import (
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.OggPage,
|
||||
format.Ogg_Page,
|
||||
&decode.Format{
|
||||
Description: "OGG page",
|
||||
DecodeFn: pageDecode,
|
||||
@ -21,7 +21,7 @@ func init() {
|
||||
}
|
||||
|
||||
func pageDecode(d *decode.D) any {
|
||||
p := format.OggPageOut{}
|
||||
p := format.Ogg_Page_Out{}
|
||||
startPos := d.Pos()
|
||||
|
||||
d.Endian = decode.LittleEndian
|
||||
|
@ -14,12 +14,12 @@ var vorbisComment decode.Group
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.OpusPacket,
|
||||
format.Opus_Packet,
|
||||
&decode.Format{
|
||||
Description: "Opus packet",
|
||||
DecodeFn: opusDecode,
|
||||
Dependencies: []decode.Dependency{
|
||||
{Groups: []*decode.Group{format.VorbisComment}, Out: &vorbisComment},
|
||||
{Groups: []*decode.Group{format.Vorbis_Comment}, Out: &vorbisComment},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
@ -40,14 +40,14 @@ var endianMap = scalar.UintMapSymStr{
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.Pcap,
|
||||
format.PCAP,
|
||||
&decode.Format{
|
||||
Description: "PCAP packet capture",
|
||||
Groups: []*decode.Group{format.Probe},
|
||||
Dependencies: []decode.Dependency{
|
||||
{Groups: []*decode.Group{format.LinkFrame}, Out: &pcapLinkFrameGroup},
|
||||
{Groups: []*decode.Group{format.TcpStream}, Out: &pcapTCPStreamGroup},
|
||||
{Groups: []*decode.Group{format.Ipv4Packet}, Out: &pcapIPv4PacketGroup},
|
||||
{Groups: []*decode.Group{format.Link_Frame}, Out: &pcapLinkFrameGroup},
|
||||
{Groups: []*decode.Group{format.TCP_Stream}, Out: &pcapTCPStreamGroup},
|
||||
{Groups: []*decode.Group{format.IPv4Packet}, Out: &pcapIPv4PacketGroup},
|
||||
},
|
||||
DecodeFn: decodePcap,
|
||||
})
|
||||
@ -124,7 +124,7 @@ func decodePcap(d *decode.D) any {
|
||||
"packet",
|
||||
int64(inclLen)*8,
|
||||
&pcapLinkFrameGroup,
|
||||
format.LinkFrameIn{
|
||||
format.Link_Frame_In{
|
||||
Type: linkType,
|
||||
IsLittleEndian: d.Endian == decode.LittleEndian,
|
||||
},
|
||||
|
@ -19,15 +19,15 @@ var pcapngIPvPacket4Group decode.Group
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.Pcapng,
|
||||
format.PCAPNG,
|
||||
&decode.Format{
|
||||
Description: "PCAPNG packet capture",
|
||||
RootArray: true,
|
||||
Groups: []*decode.Group{format.Probe},
|
||||
Dependencies: []decode.Dependency{
|
||||
{Groups: []*decode.Group{format.LinkFrame}, Out: &pcapngLinkFrameGroup},
|
||||
{Groups: []*decode.Group{format.TcpStream}, Out: &pcapngTCPStreamGroup},
|
||||
{Groups: []*decode.Group{format.Ipv4Packet}, Out: &pcapngIPvPacket4Group},
|
||||
{Groups: []*decode.Group{format.Link_Frame}, Out: &pcapngLinkFrameGroup},
|
||||
{Groups: []*decode.Group{format.TCP_Stream}, Out: &pcapngTCPStreamGroup},
|
||||
{Groups: []*decode.Group{format.IPv4Packet}, Out: &pcapngIPvPacket4Group},
|
||||
},
|
||||
DecodeFn: decodePcapng,
|
||||
})
|
||||
@ -244,7 +244,7 @@ var blockFns = map[uint64]func(d *decode.D, dc *decodeContext){
|
||||
"packet",
|
||||
int64(capturedLength)*8,
|
||||
&pcapngLinkFrameGroup,
|
||||
format.LinkFrameIn{
|
||||
format.Link_Frame_In{
|
||||
Type: linkType,
|
||||
IsLittleEndian: d.Endian == decode.LittleEndian,
|
||||
},
|
||||
|
@ -36,7 +36,7 @@ func fieldFlows(d *decode.D, fd *flowsdecoder.Decoder, tcpStreamFormat decode.Gr
|
||||
d.FieldArray("tcp_connections", func(d *decode.D) {
|
||||
for _, s := range fd.TCPConnections {
|
||||
d.FieldStruct("tcp_connection", func(d *decode.D) {
|
||||
f := func(d *decode.D, td *flowsdecoder.TCPDirection, tsi format.TCPStreamIn) any {
|
||||
f := func(d *decode.D, td *flowsdecoder.TCPDirection, tsi format.TCP_Stream_In) any {
|
||||
d.FieldValueStr("ip", td.Endpoint.IP.String())
|
||||
d.FieldValueUint("port", uint64(td.Endpoint.Port), format.TCPPortMap)
|
||||
d.FieldValueBool("has_start", td.HasStart)
|
||||
@ -59,7 +59,7 @@ func fieldFlows(d *decode.D, fd *flowsdecoder.Decoder, tcpStreamFormat decode.Gr
|
||||
var clientV any
|
||||
var serverV any
|
||||
d.FieldStruct("client", func(d *decode.D) {
|
||||
clientV = f(d, &s.Client, format.TCPStreamIn{
|
||||
clientV = f(d, &s.Client, format.TCP_Stream_In{
|
||||
IsClient: true,
|
||||
HasStart: s.Client.HasStart,
|
||||
HasEnd: s.Client.HasEnd,
|
||||
@ -69,7 +69,7 @@ func fieldFlows(d *decode.D, fd *flowsdecoder.Decoder, tcpStreamFormat decode.Gr
|
||||
})
|
||||
})
|
||||
d.FieldStruct("server", func(d *decode.D) {
|
||||
serverV = f(d, &s.Server, format.TCPStreamIn{
|
||||
serverV = f(d, &s.Server, format.TCP_Stream_In{
|
||||
IsClient: false,
|
||||
HasStart: s.Server.HasStart,
|
||||
HasEnd: s.Server.HasEnd,
|
||||
@ -79,8 +79,8 @@ func fieldFlows(d *decode.D, fd *flowsdecoder.Decoder, tcpStreamFormat decode.Gr
|
||||
})
|
||||
})
|
||||
|
||||
clientTo, clientToOk := clientV.(format.TCPStreamOut)
|
||||
serverTo, serverToOk := serverV.(format.TCPStreamOut)
|
||||
clientTo, clientToOk := clientV.(format.TCP_Stream_Out)
|
||||
serverTo, serverToOk := serverV.(format.TCP_Stream_Out)
|
||||
if clientToOk && serverToOk {
|
||||
if clientTo.PostFn != nil {
|
||||
clientTo.PostFn(serverTo.InArg)
|
||||
|
@ -20,13 +20,13 @@ var exifGroup decode.Group
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.Png,
|
||||
format.PNG,
|
||||
&decode.Format{
|
||||
Description: "Portable Network Graphics file",
|
||||
Groups: []*decode.Group{format.Probe, format.Image},
|
||||
DecodeFn: pngDecode,
|
||||
Dependencies: []decode.Dependency{
|
||||
{Groups: []*decode.Group{format.IccProfile}, Out: &iccProfileGroup},
|
||||
{Groups: []*decode.Group{format.ICC_Profile}, Out: &iccProfileGroup},
|
||||
{Groups: []*decode.Group{format.Exif}, Out: &exifGroup},
|
||||
},
|
||||
})
|
||||
|
@ -11,7 +11,7 @@ import (
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.ProresFrame,
|
||||
format.Prores_Frame,
|
||||
&decode.Format{
|
||||
Description: "Apple ProRes frame",
|
||||
DecodeFn: decodeProResFrame,
|
||||
|
@ -130,7 +130,7 @@ func protobufDecodeFields(d *decode.D, pbm *format.ProtoBufMessage) {
|
||||
}
|
||||
|
||||
func protobufDecode(d *decode.D) any {
|
||||
var pbi format.ProtoBufIn
|
||||
var pbi format.Protobuf_In
|
||||
d.ArgAs(&pbi)
|
||||
|
||||
protobufDecodeFields(d, &pbi.Message)
|
||||
|
@ -43,7 +43,7 @@ func widevineDecode(d *decode.D) any {
|
||||
}},
|
||||
}
|
||||
|
||||
d.Format(&widevineProtoBufGroup, format.ProtoBufIn{Message: widewinePb})
|
||||
d.Format(&widevineProtoBufGroup, format.Protobuf_In{Message: widewinePb})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ import (
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.Aiff,
|
||||
format.AIFF,
|
||||
&decode.Format{
|
||||
ProbeOrder: format.ProbeOrderBinFuzzy,
|
||||
Description: "Audio Interchange File Format",
|
||||
|
@ -37,18 +37,18 @@ var aviFLACFrameGroup decode.Group
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.Avi,
|
||||
format.AVI,
|
||||
&decode.Format{
|
||||
Description: "Audio Video Interleaved",
|
||||
DecodeFn: aviDecode,
|
||||
DefaultInArg: format.AviIn{
|
||||
DefaultInArg: format.AVI_In{
|
||||
DecodeSamples: true,
|
||||
},
|
||||
Dependencies: []decode.Dependency{
|
||||
{Groups: []*decode.Group{format.AvcAu}, Out: &aviMpegAVCAUGroup},
|
||||
{Groups: []*decode.Group{format.HevcAu}, Out: &aviMpegHEVCAUGroup},
|
||||
{Groups: []*decode.Group{format.Mp3Frame}, Out: &aviMp3FrameGroup},
|
||||
{Groups: []*decode.Group{format.FlacFrame}, Out: &aviFLACFrameGroup},
|
||||
{Groups: []*decode.Group{format.AVC_AU}, Out: &aviMpegAVCAUGroup},
|
||||
{Groups: []*decode.Group{format.HEVC_AU}, Out: &aviMpegHEVCAUGroup},
|
||||
{Groups: []*decode.Group{format.MP3_Frame}, Out: &aviMp3FrameGroup},
|
||||
{Groups: []*decode.Group{format.FLAC_Frame}, Out: &aviFLACFrameGroup},
|
||||
},
|
||||
Groups: []*decode.Group{format.Probe},
|
||||
})
|
||||
@ -215,7 +215,7 @@ func aviDecodeChunkIndex(d *decode.D) []ranges.Range {
|
||||
}
|
||||
|
||||
func aviDecode(d *decode.D) any {
|
||||
var ai format.AviIn
|
||||
var ai format.AVI_In
|
||||
d.ArgAs(&ai)
|
||||
|
||||
d.Endian = decode.LittleEndian
|
||||
|
@ -19,15 +19,15 @@ var wavFooterGroup decode.Group
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.Wav,
|
||||
format.WAV,
|
||||
&decode.Format{
|
||||
ProbeOrder: format.ProbeOrderBinFuzzy, // after most others (overlap some with webp)
|
||||
Description: "WAV file",
|
||||
Groups: []*decode.Group{format.Probe},
|
||||
DecodeFn: wavDecode,
|
||||
Dependencies: []decode.Dependency{
|
||||
{Groups: []*decode.Group{format.Id3v2}, Out: &wavHeaderGroup},
|
||||
{Groups: []*decode.Group{format.Id3v1, format.Id3v11}, Out: &wavFooterGroup},
|
||||
{Groups: []*decode.Group{format.ID3v2}, Out: &wavHeaderGroup},
|
||||
{Groups: []*decode.Group{format.ID3v1, format.ID3v11}, Out: &wavFooterGroup},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ import (
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.Amf0,
|
||||
format.AMF0,
|
||||
&decode.Format{
|
||||
Description: "Action Message Format 0",
|
||||
DecodeFn: amf0Decode,
|
||||
|
@ -26,16 +26,16 @@ var rtmpFS embed.FS
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.Rtmp,
|
||||
format.RTMP,
|
||||
&decode.Format{
|
||||
Description: "Real-Time Messaging Protocol",
|
||||
Groups: []*decode.Group{
|
||||
format.TcpStream,
|
||||
format.TCP_Stream,
|
||||
},
|
||||
DecodeFn: rtmpDecode,
|
||||
Dependencies: []decode.Dependency{
|
||||
{Groups: []*decode.Group{format.Amf0}, Out: &rtmpAmf0Group},
|
||||
{Groups: []*decode.Group{format.MpegAsc}, Out: &rtmpMpegASCGroup},
|
||||
{Groups: []*decode.Group{format.AMF0}, Out: &rtmpAmf0Group},
|
||||
{Groups: []*decode.Group{format.MPEG_ASC}, Out: &rtmpMpegASCGroup},
|
||||
},
|
||||
})
|
||||
interp.RegisterFS(rtmpFS)
|
||||
@ -311,7 +311,7 @@ func rtmpDecodeMessageType(d *decode.D, typ int, chunkSize *int) {
|
||||
func rtmpDecode(d *decode.D) any {
|
||||
var isClient bool
|
||||
|
||||
var tsi format.TCPStreamIn
|
||||
var tsi format.TCP_Stream_In
|
||||
if d.ArgAs(&tsi) {
|
||||
tsi.MustIsPort(d.Fatalf, format.TCPPortRTMP)
|
||||
isClient = tsi.IsClient
|
||||
|
@ -17,7 +17,7 @@ var probeGroup decode.Group
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.Tar,
|
||||
format.TAR,
|
||||
&decode.Format{
|
||||
Description: "Tar archive",
|
||||
Groups: []*decode.Group{format.Probe},
|
||||
|
@ -13,13 +13,13 @@ var tiffIccProfile decode.Group
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.Tiff,
|
||||
format.TIFF,
|
||||
&decode.Format{
|
||||
Description: "Tag Image File Format",
|
||||
Groups: []*decode.Group{format.Probe, format.Image},
|
||||
DecodeFn: tiffDecode,
|
||||
Dependencies: []decode.Dependency{
|
||||
{Groups: []*decode.Group{format.IccProfile}, Out: &tiffIccProfile},
|
||||
{Groups: []*decode.Group{format.ICC_Profile}, Out: &tiffIccProfile},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
@ -43,14 +43,14 @@ var asn1BerGroup decode.Group
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.Tls,
|
||||
format.TLS,
|
||||
&decode.Format{
|
||||
Description: "Transport layer security",
|
||||
Groups: []*decode.Group{format.TcpStream},
|
||||
Groups: []*decode.Group{format.TCP_Stream},
|
||||
DecodeFn: decodeTLS,
|
||||
DefaultInArg: format.TLSIn{},
|
||||
DefaultInArg: format.TLS_In{},
|
||||
Dependencies: []decode.Dependency{
|
||||
{Groups: []*decode.Group{format.Asn1Ber}, Out: &asn1BerGroup},
|
||||
{Groups: []*decode.Group{format.ASN1_BER}, Out: &asn1BerGroup},
|
||||
},
|
||||
})
|
||||
interp.RegisterFS(tlsFS)
|
||||
@ -676,12 +676,12 @@ func decodeV2ClientHello(d *decode.D, tc *tlsCtx) {
|
||||
}
|
||||
|
||||
func decodeTLS(d *decode.D) any {
|
||||
var ti format.TLSIn
|
||||
var ti format.TLS_In
|
||||
d.ArgAs(&ti)
|
||||
|
||||
isClient := false
|
||||
|
||||
var tsi format.TCPStreamIn
|
||||
var tsi format.TCP_Stream_In
|
||||
if d.ArgAs(&tsi) {
|
||||
if !tsi.HasStart {
|
||||
d.Fatalf("tls requires start of byte stream")
|
||||
@ -717,10 +717,10 @@ func decodeTLS(d *decode.D) any {
|
||||
|
||||
// client side will do post for both
|
||||
if !isClient {
|
||||
return format.TCPStreamOut{InArg: tc}
|
||||
return format.TCP_Stream_Out{InArg: tc}
|
||||
}
|
||||
|
||||
return format.TCPStreamOut{
|
||||
return format.TCP_Stream_Out{
|
||||
PostFn: func(peerIn any) {
|
||||
// peerIn will be the other peers outArg, the server *tlsCtx
|
||||
clientTc := tc
|
||||
|
@ -22,7 +22,7 @@ var tomlFS embed.FS
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.Toml,
|
||||
format.TOML,
|
||||
&decode.Format{
|
||||
Description: "Tom's Obvious, Minimal Language",
|
||||
ProbeOrder: format.ProbeOrderTextFuzzy,
|
||||
|
@ -14,12 +14,12 @@ var flacPicture decode.Group
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.VorbisComment,
|
||||
format.Vorbis_Comment,
|
||||
&decode.Format{
|
||||
Description: "Vorbis comment",
|
||||
DecodeFn: commentDecode,
|
||||
Dependencies: []decode.Dependency{
|
||||
{Groups: []*decode.Group{format.FlacPicture}, Out: &flacPicture},
|
||||
{Groups: []*decode.Group{format.FLAC_Picture}, Out: &flacPicture},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
@ -15,12 +15,12 @@ var vorbisComment decode.Group
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.VorbisPacket,
|
||||
format.Vorbis_Packet,
|
||||
&decode.Format{
|
||||
Description: "Vorbis packet",
|
||||
DecodeFn: vorbisDecode,
|
||||
Dependencies: []decode.Dependency{
|
||||
{Groups: []*decode.Group{format.VorbisComment}, Out: &vorbisComment},
|
||||
{Groups: []*decode.Group{format.Vorbis_Comment}, Out: &vorbisComment},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ import (
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.Vp8Frame,
|
||||
format.VP8_Frame,
|
||||
&decode.Format{
|
||||
Description: "VP8 frame",
|
||||
DecodeFn: vp8Decode,
|
||||
|
@ -10,7 +10,7 @@ import (
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.Vp9Cfm,
|
||||
format.VP9_CFM,
|
||||
&decode.Format{
|
||||
Description: "VP9 Codec Feature Metadata",
|
||||
DecodeFn: vp9CFMDecode,
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user