mirror of
https://github.com/wader/fq.git
synced 2024-09-11 20:07:11 +03:00
Merge pull request #747 from Ronsor/live2d-formats
moc3 and caff: add decoder
This commit is contained in:
commit
2eae4c2fd5
@ -66,6 +66,7 @@ bsd_loopback_frame,
|
||||
[bson](doc/formats.md#bson),
|
||||
[bytes](doc/formats.md#bytes),
|
||||
bzip2,
|
||||
[caff](doc/formats.md#caff),
|
||||
[cbor](doc/formats.md#cbor),
|
||||
[csv](doc/formats.md#csv),
|
||||
dns,
|
||||
@ -106,6 +107,7 @@ jsonl,
|
||||
macho_fat,
|
||||
[markdown](doc/formats.md#markdown),
|
||||
[matroska](doc/formats.md#matroska),
|
||||
moc3,
|
||||
[mp3](doc/formats.md#mp3),
|
||||
mp3_frame,
|
||||
mp3_frame_vbri,
|
||||
|
@ -36,6 +36,7 @@
|
||||
|[`bson`](#bson) |Binary JSON |<sub></sub>|
|
||||
|[`bytes`](#bytes) |Raw bytes |<sub></sub>|
|
||||
|`bzip2` |bzip2 compression |<sub>`probe`</sub>|
|
||||
|[`caff`](#caff) |Live2D Cubism archive |<sub>`probe`</sub>|
|
||||
|[`cbor`](#cbor) |Concise Binary Object Representation |<sub></sub>|
|
||||
|[`csv`](#csv) |Comma separated values |<sub></sub>|
|
||||
|`dns` |DNS packet |<sub></sub>|
|
||||
@ -76,6 +77,7 @@
|
||||
|`macho_fat` |Fat Mach-O macOS executable (multi-architecture) |<sub>`macho`</sub>|
|
||||
|[`markdown`](#markdown) |Markdown |<sub></sub>|
|
||||
|[`matroska`](#matroska) |Matroska file |<sub>`aac_frame` `av1_ccr` `av1_frame` `avc_au` `avc_dcr` `flac_frame` `flac_metadatablocks` `hevc_au` `hevc_dcr` `image` `mp3_frame` `mpeg_asc` `mpeg_pes_packet` `mpeg_spu` `opus_packet` `vorbis_packet` `vp8_frame` `vp9_cfm` `vp9_frame`</sub>|
|
||||
|`moc3` |MOC3 file |<sub></sub>|
|
||||
|[`mp3`](#mp3) |MP3 file |<sub>`id3v2` `id3v1` `id3v11` `apev2` `mp3_frame`</sub>|
|
||||
|`mp3_frame` |MPEG audio layer 3 frame |<sub>`mp3_frame_tags`</sub>|
|
||||
|`mp3_frame_vbri` |MP3 frame Fraunhofer encoder variable bitrate tag |<sub></sub>|
|
||||
@ -128,7 +130,7 @@
|
||||
|`ip_packet` |Group |<sub>`icmp` `icmpv6` `tcp_segment` `udp_datagram`</sub>|
|
||||
|`link_frame` |Group |<sub>`bsd_loopback_frame` `ether8023_frame` `ipv4_packet` `ipv6_packet` `sll2_packet` `sll_packet`</sub>|
|
||||
|`mp3_frame_tags` |Group |<sub>`mp3_frame_vbri` `mp3_frame_xing`</sub>|
|
||||
|`probe` |Group |<sub>`adts` `aiff` `apple_bookmark` `ar` `avi` `avro_ocf` `bitcoin_blkdat` `bplist` `bzip2` `elf` `flac` `gif` `gzip` `html` `jpeg` `json` `jsonl` `luajit` `macho` `macho_fat` `matroska` `mp3` `mp4` `mpeg_ts` `ogg` `pcap` `pcapng` `png` `tar` `tiff` `toml` `tzif` `wasm` `wav` `webp` `xml` `yaml` `zip`</sub>|
|
||||
|`probe` |Group |<sub>`adts` `aiff` `apple_bookmark` `ar` `avi` `avro_ocf` `bitcoin_blkdat` `bplist` `bzip2` `caff` `elf` `flac` `gif` `gzip` `html` `jpeg` `json` `jsonl` `luajit` `macho` `macho_fat` `matroska` `moc3` `mp3` `mp4` `mpeg_ts` `ogg` `pcap` `pcapng` `png` `tar` `tiff` `toml` `tzif` `wasm` `wav` `webp` `xml` `yaml` `zip`</sub>|
|
||||
|`tcp_stream` |Group |<sub>`dns_tcp` `rtmp` `tls`</sub>|
|
||||
|`udp_payload` |Group |<sub>`dns`</sub>|
|
||||
|
||||
@ -488,6 +490,26 @@ $ echo 'hello' | fq -d bytes '.[1]'
|
||||
101
|
||||
```
|
||||
|
||||
## caff
|
||||
|
||||
### Options
|
||||
|
||||
|Name |Default|Description|
|
||||
|- |- |-|
|
||||
|`uncompress`|true |Uncompress and probe files|
|
||||
|
||||
### Examples
|
||||
|
||||
Decode file using caff options
|
||||
```
|
||||
$ fq -d caff -o uncompress=true . file
|
||||
```
|
||||
|
||||
Decode value as caff
|
||||
```
|
||||
... | caff({uncompress:true})
|
||||
```
|
||||
|
||||
## cbor
|
||||
|
||||
### Convert represented value to JSON
|
||||
|
@ -8,6 +8,7 @@ $ fq -n _registry.groups.probe
|
||||
"bitcoin_blkdat",
|
||||
"bplist",
|
||||
"bzip2",
|
||||
"caff",
|
||||
"elf",
|
||||
"flac",
|
||||
"gif",
|
||||
@ -17,6 +18,7 @@ $ fq -n _registry.groups.probe
|
||||
"macho",
|
||||
"macho_fat",
|
||||
"matroska",
|
||||
"moc3",
|
||||
"mp4",
|
||||
"ogg",
|
||||
"pcap",
|
||||
@ -72,6 +74,7 @@ bsd_loopback_frame BSD loopback frame
|
||||
bson Binary JSON
|
||||
bytes Raw bytes
|
||||
bzip2 bzip2 compression
|
||||
caff Live2D Cubism archive
|
||||
cbor Concise Binary Object Representation
|
||||
csv Comma separated values
|
||||
dns DNS packet
|
||||
@ -112,6 +115,7 @@ macho Mach-O macOS executable
|
||||
macho_fat Fat Mach-O macOS executable (multi-architecture)
|
||||
markdown Markdown
|
||||
matroska Matroska file
|
||||
moc3 MOC3 file
|
||||
mp3 MP3 file
|
||||
mp3_frame MPEG audio layer 3 frame
|
||||
mp3_frame_vbri MP3 frame Fraunhofer encoder variable bitrate tag
|
||||
|
@ -15,6 +15,7 @@ import (
|
||||
_ "github.com/wader/fq/format/bits"
|
||||
_ "github.com/wader/fq/format/bson"
|
||||
_ "github.com/wader/fq/format/bzip2"
|
||||
_ "github.com/wader/fq/format/caff"
|
||||
_ "github.com/wader/fq/format/cbor"
|
||||
_ "github.com/wader/fq/format/crypto"
|
||||
_ "github.com/wader/fq/format/csv"
|
||||
@ -33,6 +34,7 @@ import (
|
||||
_ "github.com/wader/fq/format/markdown"
|
||||
_ "github.com/wader/fq/format/math"
|
||||
_ "github.com/wader/fq/format/matroska"
|
||||
_ "github.com/wader/fq/format/moc3"
|
||||
_ "github.com/wader/fq/format/mp3"
|
||||
_ "github.com/wader/fq/format/mp4"
|
||||
_ "github.com/wader/fq/format/mpeg"
|
||||
|
219
format/caff/caff.go
Normal file
219
format/caff/caff.go
Normal file
@ -0,0 +1,219 @@
|
||||
package caff
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"compress/flate"
|
||||
"io"
|
||||
|
||||
"github.com/wader/fq/format"
|
||||
"github.com/wader/fq/pkg/bitio"
|
||||
"github.com/wader/fq/pkg/decode"
|
||||
"github.com/wader/fq/pkg/interp"
|
||||
"github.com/wader/fq/pkg/scalar"
|
||||
)
|
||||
|
||||
var probeGroup decode.Group
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.CAFF,
|
||||
&decode.Format{
|
||||
Description: "Live2D Cubism archive",
|
||||
Groups: []*decode.Group{format.Probe},
|
||||
DecodeFn: decodeCAFF,
|
||||
DefaultInArg: format.CAFF_In{
|
||||
Uncompress: true,
|
||||
},
|
||||
Dependencies: []decode.Dependency{
|
||||
{Groups: []*decode.Group{format.Probe}, Out: &probeGroup},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
const (
|
||||
imageFormatUnknown = 0x00
|
||||
imageFormatPNG = 0x01
|
||||
imageFormatNoPreview = 0x7f
|
||||
)
|
||||
|
||||
const (
|
||||
colorTypeUnknown = 0x00
|
||||
colorTypeARGB = 0x01
|
||||
colorTypeRGB = 0x02
|
||||
colorTypeNoPreview = 0x7f
|
||||
)
|
||||
|
||||
const (
|
||||
compressOptionRaw = 0x10
|
||||
compressOptionFast = 0x21
|
||||
compressOptionSmall = 0x25
|
||||
)
|
||||
|
||||
var bool8ToSym = scalar.UintMapSymBool{
|
||||
0: false,
|
||||
1: true,
|
||||
}
|
||||
|
||||
var imageFormatNames = scalar.UintMapSymStr{
|
||||
imageFormatUnknown: "unknown",
|
||||
imageFormatPNG: "png",
|
||||
imageFormatNoPreview: "no_preview",
|
||||
}
|
||||
|
||||
var colorTypeNames = scalar.UintMapSymStr{
|
||||
colorTypeUnknown: "unknown",
|
||||
colorTypeARGB: "argb",
|
||||
colorTypeRGB: "rgb",
|
||||
colorTypeNoPreview: "no_preview",
|
||||
}
|
||||
|
||||
var compressOptionNames = scalar.UintMapSymStr{
|
||||
compressOptionRaw: "raw",
|
||||
compressOptionFast: "fast",
|
||||
compressOptionSmall: "small",
|
||||
}
|
||||
|
||||
type fileInfoListEntry struct {
|
||||
filePath string
|
||||
startPos int64
|
||||
fileSize int
|
||||
isObfuscated bool
|
||||
compressOption uint8
|
||||
}
|
||||
|
||||
func decodeVersion(d *decode.D) {
|
||||
d.FieldU8("major")
|
||||
d.FieldU8("minor")
|
||||
d.FieldU8("patch")
|
||||
}
|
||||
|
||||
func decodeCAFF(d *decode.D) any {
|
||||
var ci format.CAFF_In
|
||||
d.ArgAs(&ci)
|
||||
|
||||
var obfsKey int64
|
||||
|
||||
obfsU8 := func(d *decode.D) uint64 { return d.U8() ^ uint64(obfsKey&0xff) }
|
||||
obfsU32 := func(d *decode.D) uint64 { return d.U32() ^ uint64(obfsKey&0xffff_ffff) }
|
||||
obfsU64 := func(d *decode.D) uint64 { return d.U64() ^ uint64(obfsKey<<32|obfsKey) }
|
||||
|
||||
// "Big Endian Base 128" - LEB128's strange sibling
|
||||
obfsBEB128 := func(d *decode.D) (v uint64) {
|
||||
for {
|
||||
x := obfsU8(d)
|
||||
v <<= 7
|
||||
v |= (x & 0x7f)
|
||||
if (x >> 7) == 0 {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
obfsVarStr := func(d *decode.D) string {
|
||||
length := obfsBEB128(d)
|
||||
if length == 0 {
|
||||
return ""
|
||||
}
|
||||
|
||||
raw := d.BytesLen(int(length))
|
||||
for i := uint64(0); i < length; i++ {
|
||||
raw[i] ^= byte(obfsKey)
|
||||
}
|
||||
return string(raw)
|
||||
}
|
||||
|
||||
d.FieldUTF8("archive_id", 4, d.StrAssert("CAFF"))
|
||||
d.FieldStruct("archive_version", decodeVersion)
|
||||
d.FieldUTF8("format_id", 4)
|
||||
d.FieldStruct("format_version", decodeVersion)
|
||||
obfsKey = d.FieldS32("obfuscate_key")
|
||||
d.FieldU64("unused0")
|
||||
|
||||
d.FieldStruct("preview_image", func(d *decode.D) {
|
||||
d.FieldU8("image_format", imageFormatNames)
|
||||
d.FieldU8("color_type", colorTypeNames)
|
||||
d.FieldU16("unused0")
|
||||
d.FieldU16("width")
|
||||
d.FieldU16("height")
|
||||
d.FieldU64("start_pos", scalar.UintHex)
|
||||
d.FieldU32("file_size")
|
||||
})
|
||||
d.FieldU64("unused1")
|
||||
|
||||
fileInfoListSize := d.FieldUintFn("file_info_map_size", obfsU32)
|
||||
fileInfoList := make([]fileInfoListEntry, int(fileInfoListSize))
|
||||
|
||||
d.FieldArray("file_info_list", func(d *decode.D) {
|
||||
for i := uint64(0); i < fileInfoListSize; i++ {
|
||||
d.FieldStruct("file_info", func(d *decode.D) {
|
||||
var entry fileInfoListEntry
|
||||
|
||||
entry.filePath = d.FieldStrFn("file_path", obfsVarStr)
|
||||
d.FieldStrFn("tag", obfsVarStr)
|
||||
entry.startPos = int64(d.FieldUintFn("start_pos", obfsU64, scalar.UintHex))
|
||||
entry.fileSize = int(d.FieldUintFn("file_size", obfsU32))
|
||||
entry.isObfuscated = d.FieldUintFn("is_obfuscated", obfsU8, bool8ToSym) != 0
|
||||
entry.compressOption = uint8(d.FieldUintFn("compress_option", obfsU8, compressOptionNames))
|
||||
d.FieldU64("unused0")
|
||||
|
||||
fileInfoList[int(i)] = entry
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
d.FieldArray("files", func(d *decode.D) {
|
||||
for _, entry := range fileInfoList {
|
||||
d.FieldStruct("file", func(d *decode.D) {
|
||||
d.SeekAbs(entry.startPos * 8)
|
||||
d.FieldValueStr("file_path", entry.filePath)
|
||||
d.FieldValueUint("file_size", uint64(entry.fileSize))
|
||||
d.FieldValueBool("is_obfuscated", entry.isObfuscated)
|
||||
d.FieldValueUint("compress_option", uint64(entry.compressOption), compressOptionNames)
|
||||
|
||||
rawBr := d.FieldRawLen("raw", int64(entry.fileSize)*8)
|
||||
rawBytes := make([]byte, entry.fileSize)
|
||||
if n, err := rawBr.ReadBits(rawBytes, int64(entry.fileSize)*8); err != nil || n != int64(entry.fileSize)*8 {
|
||||
return
|
||||
}
|
||||
|
||||
if entry.isObfuscated {
|
||||
for i, v := range rawBytes {
|
||||
rawBytes[i] = v ^ uint8(obfsKey)
|
||||
}
|
||||
}
|
||||
|
||||
br := bitio.NewBitReader(rawBytes, -1)
|
||||
if !ci.Uncompress || entry.compressOption == compressOptionRaw {
|
||||
fieldName := "uncompressed"
|
||||
if entry.compressOption != compressOptionRaw {
|
||||
fieldName = "compressed"
|
||||
}
|
||||
|
||||
value, _, err := d.TryFieldFormatBitBuf(fieldName, br, &probeGroup, format.Probe_In{})
|
||||
if value == nil && err != nil {
|
||||
d.FieldRootBitBuf(fieldName, br)
|
||||
}
|
||||
} else {
|
||||
d.FieldRootBitBuf("compressed", br)
|
||||
|
||||
// Offset 0x26: skip ZIP entry header; there's nothing useful in it and it's always the same
|
||||
if len(rawBytes) > 0x26 {
|
||||
infBytes, err := io.ReadAll(flate.NewReader(bytes.NewReader(rawBytes[0x26:])))
|
||||
if err == nil {
|
||||
infBr := bitio.NewBitReader(infBytes, -1)
|
||||
value, _, err := d.TryFieldFormatBitBuf("uncompressed", infBr, &probeGroup, format.Probe_In{})
|
||||
if value == nil && err != nil {
|
||||
d.FieldRootBitBuf("uncompressed", infBr)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
d.SeekAbs(d.Len() - 2*8)
|
||||
d.FieldRawLen("guard_bytes", 2*8, d.AssertBitBuf([]byte{98, 99}))
|
||||
|
||||
return nil
|
||||
}
|
BIN
format/caff/testdata/test.cmo3
vendored
Executable file
BIN
format/caff/testdata/test.cmo3
vendored
Executable file
Binary file not shown.
221
format/caff/testdata/test.cmo3.fqtest
vendored
Normal file
221
format/caff/testdata/test.cmo3.fqtest
vendored
Normal file
@ -0,0 +1,221 @@
|
||||
$ fq dv test.cmo3
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|.{}: test.cmo3 (caff) 0x0-0x2268.7 (8809)
|
||||
0x000000|43 41 46 46 |CAFF | archive_id: "CAFF" (valid) 0x0-0x3.7 (4)
|
||||
| | | archive_version{}: 0x4-0x6.7 (3)
|
||||
0x000000| 00 | . | major: 0 0x4-0x4.7 (1)
|
||||
0x000000| 00 | . | minor: 0 0x5-0x5.7 (1)
|
||||
0x000000| 00 | . | patch: 0 0x6-0x6.7 (1)
|
||||
0x000000| 2d 2d 2d 2d | ---- | format_id: "----" 0x7-0xa.7 (4)
|
||||
| | | format_version{}: 0xb-0xd.7 (3)
|
||||
0x000000| 00 | . | major: 0 0xb-0xb.7 (1)
|
||||
0x000000| 00 | . | minor: 0 0xc-0xc.7 (1)
|
||||
0x000000| 00 | . | patch: 0 0xd-0xd.7 (1)
|
||||
0x000000| af de| ..| obfuscate_key: -1344390416 0xe-0x11.7 (4)
|
||||
0x000010|3a f0 |:. |
|
||||
0x000010| 00 00 00 00 00 00 00 00 | ........ | unused0: 0 0x12-0x19.7 (8)
|
||||
| | | preview_image{}: 0x1a-0x2d.7 (20)
|
||||
0x000010| 7f | . | image_format: "no_preview" (127) 0x1a-0x1a.7 (1)
|
||||
0x000010| 7f | . | color_type: "no_preview" (127) 0x1b-0x1b.7 (1)
|
||||
0x000010| 00 00 | .. | unused0: 0 0x1c-0x1d.7 (2)
|
||||
0x000010| 00 00| ..| width: 0 0x1e-0x1f.7 (2)
|
||||
0x000020|00 00 |.. | height: 0 0x20-0x21.7 (2)
|
||||
0x000020| 00 00 00 00 00 00 00 00 | ........ | start_pos: 0x0 0x22-0x29.7 (8)
|
||||
0x000020| 00 00 00 00 | .... | file_size: 0 0x2a-0x2d.7 (4)
|
||||
0x000020| 00 00| ..| unused1: 0 0x2e-0x35.7 (8)
|
||||
0x000030|00 00 00 00 00 00 |...... |
|
||||
0x000030| af de 3a f4 | ..:. | file_info_map_size: 4 0x36-0x39.7 (4)
|
||||
| | | file_info_list[0:4]: 0x3a-0xc8.7 (143)
|
||||
| | | [0]{}: file_info 0x3a-0x5a.7 (33)
|
||||
0x000030| f9 99 9d 91 97 95| ......| file_path: "image.png" 0x3a-0x43.7 (10)
|
||||
0x000040|de 80 9e 97 |.... |
|
||||
0x000040| f0 | . | tag: "" 0x44-0x44.7 (1)
|
||||
0x000040| ff ff ff ff af de 3a 39 | ......:9 | start_pos: 0xc9 0x45-0x4c.7 (8)
|
||||
0x000040| af de 3a| ..:| file_size: 96 0x4d-0x50.7 (4)
|
||||
0x000050|90 |. |
|
||||
0x000050| f1 | . | is_obfuscated: true (1) 0x51-0x51.7 (1)
|
||||
0x000050| e0 | . | compress_option: "raw" (16) 0x52-0x52.7 (1)
|
||||
0x000050| 00 00 00 00 00 00 00 00 | ........ | unused0: 0 0x53-0x5a.7 (8)
|
||||
| | | [1]{}: file_info 0x5b-0x7d.7 (35)
|
||||
0x000050| fb 99 9d 91 97| .....| file_path: "image_0.png" 0x5b-0x66.7 (12)
|
||||
0x000060|95 af c0 de 80 9e 97 |....... |
|
||||
0x000060| f0 | . | tag: "" 0x67-0x67.7 (1)
|
||||
0x000060| ff ff ff ff af de 3b d9| ......;.| start_pos: 0x129 0x68-0x6f.7 (8)
|
||||
0x000070|af de 3a a3 |..:. | file_size: 83 0x70-0x73.7 (4)
|
||||
0x000070| f1 | . | is_obfuscated: true (1) 0x74-0x74.7 (1)
|
||||
0x000070| e0 | . | compress_option: "raw" (16) 0x75-0x75.7 (1)
|
||||
0x000070| 00 00 00 00 00 00 00 00 | ........ | unused0: 0 0x76-0x7d.7 (8)
|
||||
| | | [2]{}: file_info 0x7e-0xa0.7 (35)
|
||||
0x000070| fb 99| ..| file_path: "image_1.png" 0x7e-0x89.7 (12)
|
||||
0x000080|9d 91 97 95 af c1 de 80 9e 97 |.......... |
|
||||
0x000080| f0 | . | tag: "" 0x8a-0x8a.7 (1)
|
||||
0x000080| ff ff ff ff af| .....| start_pos: 0x17c 0x8b-0x92.7 (8)
|
||||
0x000090|de 3b 8c |.;. |
|
||||
0x000090| af de 3a bb | ..:. | file_size: 75 0x93-0x96.7 (4)
|
||||
0x000090| f1 | . | is_obfuscated: true (1) 0x97-0x97.7 (1)
|
||||
0x000090| e0 | . | compress_option: "raw" (16) 0x98-0x98.7 (1)
|
||||
0x000090| 00 00 00 00 00 00 00| .......| unused0: 0 0x99-0xa0.7 (8)
|
||||
0x0000a0|00 |. |
|
||||
| | | [3]{}: file_info 0xa1-0xc8.7 (40)
|
||||
0x0000a0| f8 9d 91 99 9e de 88 9d 9c | ......... | file_path: "main.xml" 0xa1-0xa9.7 (9)
|
||||
0x0000a0| f8 9d 91 99 9e af| ......| tag: "main_xml" 0xaa-0xb2.7 (9)
|
||||
0x0000b0|88 9d 9c |... |
|
||||
0x0000b0| ff ff ff ff af de 3b 37 | ......;7 | start_pos: 0x1c7 0xb3-0xba.7 (8)
|
||||
0x0000b0| af de 1a 50 | ...P | file_size: 8352 0xbb-0xbe.7 (4)
|
||||
0x0000b0| f1| .| is_obfuscated: true (1) 0xbf-0xbf.7 (1)
|
||||
0x0000c0|d1 |. | compress_option: "fast" (33) 0xc0-0xc0.7 (1)
|
||||
0x0000c0| 00 00 00 00 00 00 00 00 | ........ | unused0: 0 0xc1-0xc8.7 (8)
|
||||
| | | files[0:4]: 0xc9-0x2266.7 (8606)
|
||||
| | | [0]{}: file 0xc9-0x128.7 (96)
|
||||
| | | file_path: "image.png" 0xc9-NA (0)
|
||||
| | | file_size: 96 0xc9-NA (0)
|
||||
| | | is_obfuscated: true 0xc9-NA (0)
|
||||
| | | compress_option: "raw" (16) 0xc9-NA (0)
|
||||
0x0000c0| 79 a0 be b7 fd fa ea| y......| raw: raw bits 0xc9-0x128.7 (96)
|
||||
0x0000d0|fa f0 f0 f0 fd b9 b8 b4 a2 f0 f0 f0 b0 f0 f0 f0|................|
|
||||
* |until 0x128.7 (96) | |
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef| uncompressed{}: (png) 0x0-0x5f.7 (96)
|
||||
0x0000|89 50 4e 47 0d 0a 1a 0a |.PNG.... | signature: raw bits (valid) 0x0-0x7.7 (8)
|
||||
| | | chunks[0:3]: 0x8-0x5f.7 (88)
|
||||
| | | [0]{}: chunk 0x8-0x20.7 (25)
|
||||
0x0000| 00 00 00 0d | .... | length: 13 0x8-0xb.7 (4)
|
||||
0x0000| 49 48 44 52| IHDR| type: "IHDR" 0xc-0xf.7 (4)
|
||||
0x0000| 49 | I | ancillary: false 0xc.3-0xc.3 (0.1)
|
||||
0x0000| 48 | H | private: false 0xd.3-0xd.3 (0.1)
|
||||
0x0000| 44 | D | reserved: false 0xe.3-0xe.3 (0.1)
|
||||
0x0000| 52| R| safe_to_copy: true 0xf.3-0xf.3 (0.1)
|
||||
0x0001|00 00 00 40 |...@ | width: 64 0x10-0x13.7 (4)
|
||||
0x0001| 00 00 00 40 | ...@ | height: 64 0x14-0x17.7 (4)
|
||||
0x0001| 08 | . | bit_depth: 8 0x18-0x18.7 (1)
|
||||
0x0001| 06 | . | color_type: "rgba" (6) 0x19-0x19.7 (1)
|
||||
0x0001| 00 | . | compression_method: "deflate" (0) 0x1a-0x1a.7 (1)
|
||||
0x0001| 00 | . | filter_method: "adaptive_filtering" (0) 0x1b-0x1b.7 (1)
|
||||
0x0001| 00 | . | interlace_method: "none" (0) 0x1c-0x1c.7 (1)
|
||||
0x0001| aa 69 71| .iq| crc: 0xaa6971de (valid) 0x1d-0x20.7 (4)
|
||||
0x0002|de |. |
|
||||
| | | [1]{}: chunk 0x21-0x53.7 (51)
|
||||
0x0002| 00 00 00 27 | ...' | length: 39 0x21-0x24.7 (4)
|
||||
0x0002| 49 44 41 54 | IDAT | type: "IDAT" 0x25-0x28.7 (4)
|
||||
0x0002| 49 | I | ancillary: false 0x25.3-0x25.3 (0.1)
|
||||
0x0002| 44 | D | private: false 0x26.3-0x26.3 (0.1)
|
||||
0x0002| 41 | A | reserved: false 0x27.3-0x27.3 (0.1)
|
||||
0x0002| 54 | T | safe_to_copy: true 0x28.3-0x28.3 (0.1)
|
||||
0x0002| 78 5e ed c1 01 0d 00| x^.....| data: raw bits 0x29-0x4f.7 (39)
|
||||
0x0003|00 00 c2 a0 f7 4f 6d 0e 37 a0 00 00 00 00 00 00|.....Om.7.......|
|
||||
0x0004|00 00 00 00 00 00 00 00 00 80 77 03 40 40 00 01|..........w.@@..|
|
||||
0x0005|59 0a 7b 0c |Y.{. | crc: 0x590a7b0c (valid) 0x50-0x53.7 (4)
|
||||
| | | [2]{}: chunk 0x54-0x5f.7 (12)
|
||||
0x0005| 00 00 00 00 | .... | length: 0 0x54-0x57.7 (4)
|
||||
0x0005| 49 45 4e 44 | IEND | type: "IEND" 0x58-0x5b.7 (4)
|
||||
0x0005| 49 | I | ancillary: false 0x58.3-0x58.3 (0.1)
|
||||
0x0005| 45 | E | private: false 0x59.3-0x59.3 (0.1)
|
||||
0x0005| 4e | N | reserved: false 0x5a.3-0x5a.3 (0.1)
|
||||
0x0005| 44 | D | safe_to_copy: false 0x5b.3-0x5b.3 (0.1)
|
||||
0x0005| ae 42 60 82| .B`.| crc: 0xae426082 (valid) 0x5c-0x5f.7 (4)
|
||||
| | | [1]{}: file 0x129-0x17b.7 (83)
|
||||
| | | file_path: "image_0.png" 0x129-NA (0)
|
||||
| | | file_size: 83 0x129-NA (0)
|
||||
| | | is_obfuscated: true 0x129-NA (0)
|
||||
| | | compress_option: "raw" (16) 0x129-NA (0)
|
||||
0x000120| 79 a0 be b7 fd fa ea| y......| raw: raw bits 0x129-0x17b.7 (83)
|
||||
0x000130|fa f0 f0 f0 fd b9 b8 b4 a2 f0 f0 f0 d0 f0 f0 f0|................|
|
||||
* |until 0x17b.7 (83) | |
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef| uncompressed{}: (png) 0x0-0x52.7 (83)
|
||||
0x0000|89 50 4e 47 0d 0a 1a 0a |.PNG.... | signature: raw bits (valid) 0x0-0x7.7 (8)
|
||||
| | | chunks[0:3]: 0x8-0x52.7 (75)
|
||||
| | | [0]{}: chunk 0x8-0x20.7 (25)
|
||||
0x0000| 00 00 00 0d | .... | length: 13 0x8-0xb.7 (4)
|
||||
0x0000| 49 48 44 52| IHDR| type: "IHDR" 0xc-0xf.7 (4)
|
||||
0x0000| 49 | I | ancillary: false 0xc.3-0xc.3 (0.1)
|
||||
0x0000| 48 | H | private: false 0xd.3-0xd.3 (0.1)
|
||||
0x0000| 44 | D | reserved: false 0xe.3-0xe.3 (0.1)
|
||||
0x0000| 52| R| safe_to_copy: true 0xf.3-0xf.3 (0.1)
|
||||
0x0001|00 00 00 20 |... | width: 32 0x10-0x13.7 (4)
|
||||
0x0001| 00 00 00 20 | ... | height: 32 0x14-0x17.7 (4)
|
||||
0x0001| 08 | . | bit_depth: 8 0x18-0x18.7 (1)
|
||||
0x0001| 06 | . | color_type: "rgba" (6) 0x19-0x19.7 (1)
|
||||
0x0001| 00 | . | compression_method: "deflate" (0) 0x1a-0x1a.7 (1)
|
||||
0x0001| 00 | . | filter_method: "adaptive_filtering" (0) 0x1b-0x1b.7 (1)
|
||||
0x0001| 00 | . | interlace_method: "none" (0) 0x1c-0x1c.7 (1)
|
||||
0x0001| 73 7a 7a| szz| crc: 0x737a7af4 (valid) 0x1d-0x20.7 (4)
|
||||
0x0002|f4 |. |
|
||||
| | | [1]{}: chunk 0x21-0x46.7 (38)
|
||||
0x0002| 00 00 00 1a | .... | length: 26 0x21-0x24.7 (4)
|
||||
0x0002| 49 44 41 54 | IDAT | type: "IDAT" 0x25-0x28.7 (4)
|
||||
0x0002| 49 | I | ancillary: false 0x25.3-0x25.3 (0.1)
|
||||
0x0002| 44 | D | private: false 0x26.3-0x26.3 (0.1)
|
||||
0x0002| 41 | A | reserved: false 0x27.3-0x27.3 (0.1)
|
||||
0x0002| 54 | T | safe_to_copy: true 0x28.3-0x28.3 (0.1)
|
||||
0x0002| 78 5e ed c1 01 01 00| x^.....| data: raw bits 0x29-0x42.7 (26)
|
||||
0x0003|00 00 82 20 ff af 6e 48 40 01 00 00 00 ef 06 10|... ..nH@.......|
|
||||
0x0004|20 00 01 | .. |
|
||||
0x0004| 9f 22 b8 f9 | .".. | crc: 0x9f22b8f9 (valid) 0x43-0x46.7 (4)
|
||||
| | | [2]{}: chunk 0x47-0x52.7 (12)
|
||||
0x0004| 00 00 00 00 | .... | length: 0 0x47-0x4a.7 (4)
|
||||
0x0004| 49 45 4e 44 | IEND | type: "IEND" 0x4b-0x4e.7 (4)
|
||||
0x0004| 49 | I | ancillary: false 0x4b.3-0x4b.3 (0.1)
|
||||
0x0004| 45 | E | private: false 0x4c.3-0x4c.3 (0.1)
|
||||
0x0004| 4e | N | reserved: false 0x4d.3-0x4d.3 (0.1)
|
||||
0x0004| 44 | D | safe_to_copy: false 0x4e.3-0x4e.3 (0.1)
|
||||
0x0004| ae| .| crc: 0xae426082 (valid) 0x4f-0x52.7 (4)
|
||||
0x0005|42 60 82| |B`.| |
|
||||
| | | [2]{}: file 0x17c-0x1c6.7 (75)
|
||||
| | | file_path: "image_1.png" 0x17c-NA (0)
|
||||
| | | file_size: 75 0x17c-NA (0)
|
||||
| | | is_obfuscated: true 0x17c-NA (0)
|
||||
| | | compress_option: "raw" (16) 0x17c-NA (0)
|
||||
0x000170| 79 a0 be b7| y...| raw: raw bits 0x17c-0x1c6.7 (75)
|
||||
0x000180|fd fa ea fa f0 f0 f0 fd b9 b8 b4 a2 f0 f0 f0 e0|................|
|
||||
* |until 0x1c6.7 (75) | |
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef| uncompressed{}: (png) 0x0-0x4a.7 (75)
|
||||
0x0000|89 50 4e 47 0d 0a 1a 0a |.PNG.... | signature: raw bits (valid) 0x0-0x7.7 (8)
|
||||
| | | chunks[0:3]: 0x8-0x4a.7 (67)
|
||||
| | | [0]{}: chunk 0x8-0x20.7 (25)
|
||||
0x0000| 00 00 00 0d | .... | length: 13 0x8-0xb.7 (4)
|
||||
0x0000| 49 48 44 52| IHDR| type: "IHDR" 0xc-0xf.7 (4)
|
||||
0x0000| 49 | I | ancillary: false 0xc.3-0xc.3 (0.1)
|
||||
0x0000| 48 | H | private: false 0xd.3-0xd.3 (0.1)
|
||||
0x0000| 44 | D | reserved: false 0xe.3-0xe.3 (0.1)
|
||||
0x0000| 52| R| safe_to_copy: true 0xf.3-0xf.3 (0.1)
|
||||
0x0001|00 00 00 10 |.... | width: 16 0x10-0x13.7 (4)
|
||||
0x0001| 00 00 00 10 | .... | height: 16 0x14-0x17.7 (4)
|
||||
0x0001| 08 | . | bit_depth: 8 0x18-0x18.7 (1)
|
||||
0x0001| 06 | . | color_type: "rgba" (6) 0x19-0x19.7 (1)
|
||||
0x0001| 00 | . | compression_method: "deflate" (0) 0x1a-0x1a.7 (1)
|
||||
0x0001| 00 | . | filter_method: "adaptive_filtering" (0) 0x1b-0x1b.7 (1)
|
||||
0x0001| 00 | . | interlace_method: "none" (0) 0x1c-0x1c.7 (1)
|
||||
0x0001| 1f f3 ff| ...| crc: 0x1ff3ff61 (valid) 0x1d-0x20.7 (4)
|
||||
0x0002|61 |a |
|
||||
| | | [1]{}: chunk 0x21-0x3e.7 (30)
|
||||
0x0002| 00 00 00 12 | .... | length: 18 0x21-0x24.7 (4)
|
||||
0x0002| 49 44 41 54 | IDAT | type: "IDAT" 0x25-0x28.7 (4)
|
||||
0x0002| 49 | I | ancillary: false 0x25.3-0x25.3 (0.1)
|
||||
0x0002| 44 | D | private: false 0x26.3-0x26.3 (0.1)
|
||||
0x0002| 41 | A | reserved: false 0x27.3-0x27.3 (0.1)
|
||||
0x0002| 54 | T | safe_to_copy: true 0x28.3-0x28.3 (0.1)
|
||||
0x0002| 78 5e 63 60 18 05 a3| x^c`...| data: raw bits 0x29-0x3a.7 (18)
|
||||
0x0003|60 14 8c 02 08 00 00 04 10 00 01 |`.......... |
|
||||
0x0003| 66 c1 64 0b | f.d. | crc: 0x66c1640b (valid) 0x3b-0x3e.7 (4)
|
||||
| | | [2]{}: chunk 0x3f-0x4a.7 (12)
|
||||
0x0003| 00| .| length: 0 0x3f-0x42.7 (4)
|
||||
0x0004|00 00 00 |... |
|
||||
0x0004| 49 45 4e 44 | IEND | type: "IEND" 0x43-0x46.7 (4)
|
||||
0x0004| 49 | I | ancillary: false 0x43.3-0x43.3 (0.1)
|
||||
0x0004| 45 | E | private: false 0x44.3-0x44.3 (0.1)
|
||||
0x0004| 4e | N | reserved: false 0x45.3-0x45.3 (0.1)
|
||||
0x0004| 44 | D | safe_to_copy: false 0x46.3-0x46.3 (0.1)
|
||||
0x0004| ae 42 60 82| | .B`.| | crc: 0xae426082 (valid) 0x47-0x4a.7 (4)
|
||||
| | | [3]{}: file 0x1c7-0x2266.7 (8352)
|
||||
| | | file_path: "main.xml" 0x1c7-NA (0)
|
||||
| | | file_size: 8352 0x1c7-NA (0)
|
||||
| | | is_obfuscated: true 0x1c7-NA (0)
|
||||
| | | compress_option: "fast" (33) 0x1c7-NA (0)
|
||||
0x0001c0| a0 bb f3 f4 e4 f0 f8 f8 f8| .........| raw: raw bits 0x1c7-0x2266.7 (8352)
|
||||
0x0001d0|f0 8b 6a e2 a7 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0|..j.............|
|
||||
* |until 0x2266.7 (8352) | |
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|
|
||||
0x0000|50 4b 03 04 14 00 08 08 08 00 7b 9a 12 57 00 00|PK........{..W..| compressed: raw bits 0x0-0x209f.7 (8352)
|
||||
* |until 0x209f.7 (end) (8352) | |
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|
|
||||
0x0000|3c 3f 78 6d 6c 20 76 65 72 73 69 6f 6e 3d 22 31|<?xml version="1| uncompressed: {} (xml) 0x0-0xfcd9.7 (64730)
|
||||
* |until 0xfcd9.7 (end) (64730) | |
|
||||
0x002260| 62 63| | bc| | guard_bytes: raw bits (valid) 0x2267-0x2268.7 (2)
|
@ -87,6 +87,7 @@ var (
|
||||
BSD_Loopback_Frame = &decode.Group{Name: "bsd_loopback_frame"}
|
||||
BSON = &decode.Group{Name: "bson"}
|
||||
Bzip2 = &decode.Group{Name: "bzip2"}
|
||||
CAFF = &decode.Group{Name: "caff"}
|
||||
CBOR = &decode.Group{Name: "cbor"}
|
||||
CSV = &decode.Group{Name: "csv"}
|
||||
DNS = &decode.Group{Name: "dns"}
|
||||
@ -128,6 +129,7 @@ var (
|
||||
MachO_Fat = &decode.Group{Name: "macho_fat"}
|
||||
Markdown = &decode.Group{Name: "markdown"}
|
||||
Matroska = &decode.Group{Name: "matroska"}
|
||||
MOC3 = &decode.Group{Name: "moc3"}
|
||||
MP3 = &decode.Group{Name: "mp3"}
|
||||
MP3_Frame = &decode.Group{Name: "mp3_frame"}
|
||||
MP3_Frame_VBRI = &decode.Group{Name: "mp3_frame_vbri"}
|
||||
@ -189,6 +191,11 @@ type AVC_AU_In struct {
|
||||
type AVC_DCR_Out struct {
|
||||
LengthSize uint64
|
||||
}
|
||||
|
||||
type CAFF_In struct {
|
||||
Uncompress bool `doc:"Uncompress and probe files"`
|
||||
}
|
||||
|
||||
type FLAC_Frame_In struct {
|
||||
SamplesBuf []byte
|
||||
BitsPerSample int `doc:"Bits per sample"`
|
||||
|
1405
format/moc3/moc3.go
Normal file
1405
format/moc3/moc3.go
Normal file
File diff suppressed because it is too large
Load Diff
BIN
format/moc3/testdata/archchan_sdk5.moc3
vendored
Executable file
BIN
format/moc3/testdata/archchan_sdk5.moc3
vendored
Executable file
Binary file not shown.
1198
format/moc3/testdata/archchan_sdk5.moc3.fqtest
vendored
Normal file
1198
format/moc3/testdata/archchan_sdk5.moc3.fqtest
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user