mirror of
https://github.com/wader/fq.git
synced 2024-12-25 14:23:18 +03:00
e77f776999
Think it makes it clearer and also less likely to collide with a field name a deocder wants to use.
112 lines
6.6 KiB
Plaintext
112 lines
6.6 KiB
Plaintext
$ fq -i -d mp3 . test.mp3
|
|
mp3> decode
|
|
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|.{}: (mp3)
|
|
0x000|49 44 33 04 00 00 00 00 00 23 54 53 53 45 00 00|ID3......#TSSE..| headers[0:1]:
|
|
* |until 0x2c.7 (45) | |
|
|
0x020| ff fb 40| ..@| frames[0:3]:
|
|
0x030|c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00|................|
|
|
* |until 0x283.7 (end) (599) | |
|
|
| | | footers[0:0]:
|
|
mp3> decode("mp3")
|
|
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|.{}: (mp3)
|
|
0x000|49 44 33 04 00 00 00 00 00 23 54 53 53 45 00 00|ID3......#TSSE..| headers[0:1]:
|
|
* |until 0x2c.7 (45) | |
|
|
0x020| ff fb 40| ..@| frames[0:3]:
|
|
0x030|c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00|................|
|
|
* |until 0x283.7 (end) (599) | |
|
|
| | | footers[0:0]:
|
|
mp3> decode("mp3"; {})
|
|
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|.{}: (mp3)
|
|
0x000|49 44 33 04 00 00 00 00 00 23 54 53 53 45 00 00|ID3......#TSSE..| headers[0:1]:
|
|
* |until 0x2c.7 (45) | |
|
|
0x020| ff fb 40| ..@| frames[0:3]:
|
|
0x030|c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00|................|
|
|
* |until 0x283.7 (end) (599) | |
|
|
| | | footers[0:0]:
|
|
mp3> probe
|
|
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|.{}: (mp3)
|
|
0x000|49 44 33 04 00 00 00 00 00 23 54 53 53 45 00 00|ID3......#TSSE..| headers[0:1]:
|
|
* |until 0x2c.7 (45) | |
|
|
0x020| ff fb 40| ..@| frames[0:3]:
|
|
0x030|c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00|................|
|
|
* |until 0x283.7 (end) (599) | |
|
|
| | | footers[0:0]:
|
|
mp3> probe({})
|
|
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|.{}: (mp3)
|
|
0x000|49 44 33 04 00 00 00 00 00 23 54 53 53 45 00 00|ID3......#TSSE..| headers[0:1]:
|
|
* |until 0x2c.7 (45) | |
|
|
0x020| ff fb 40| ..@| frames[0:3]:
|
|
0x030|c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00|................|
|
|
* |until 0x283.7 (end) (599) | |
|
|
| | | footers[0:0]:
|
|
mp3> format
|
|
"mp3"
|
|
mp3> null | format
|
|
null
|
|
mp3> path(.[])
|
|
[
|
|
"headers"
|
|
]
|
|
[
|
|
"frames"
|
|
]
|
|
[
|
|
"footers"
|
|
]
|
|
mp3> .[] = 1
|
|
{
|
|
"footers": 1,
|
|
"frames": 1,
|
|
"headers": 1
|
|
}
|
|
mp3> walk(tovalue) | .headers[0].magic
|
|
"ID3"
|
|
mp3> ^D
|
|
$ fq -d bytes 'png | d' test.mp3
|
|
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|.{}: (png)
|
|
| | | error: png: RawLen(signature): failed at position 8 (read size 0 seek pos 0): failed to validate raw
|
|
0x000|49 44 33 04 00 00 00 00 00 23 54 53 53 45 00 00|ID3......#TSSE..| gap0: raw bits
|
|
* |until 0x283.7 (end) (644) | |
|
|
$ fq -d bytes '.[0:1] | png | d' test.mp3
|
|
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|.{}: (png)
|
|
| | | error: png: RawLen(signature): failed at position 0 (read size 0 seek pos 0): outside buffer
|
|
0x0|49 |I | gap0: raw bits
|
|
$ fq -o force=true -d png d test.mp3
|
|
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|.{}: test.mp3 (png)
|
|
| | | error: png: BitBufRange: failed at position 0 (read size 2315363 seek pos 0): outside buffer
|
|
0x000|49 44 33 04 00 00 00 00 |ID3..... | signature: raw bits (invalid)
|
|
| | | chunks[0:1]:
|
|
| | | [0]{}: chunk
|
|
0x000| 00 23 54 53 | .#TS | length: 2315347
|
|
0x000| 53 45 00 00| SE..| type: "SE\x00\x00"
|
|
0x000| 53 | S | ancillary: true
|
|
0x000| 45 | E | private: false
|
|
0x000| 00 | . | reserved: false
|
|
0x000| 00| .| safe_to_copy: false
|
|
0x010|00 0f 00 00 03 4c 61 76 66 35 38 2e 34 35 2e 31|.....Lavf58.45.1| gap0: raw bits
|
|
* |until 0x283.7 (end) (628) | |
|
|
$ fq -d bytes '.[0:1] | try probe catch . | type' test.mp3
|
|
"array"
|
|
$ fq -d bytes 'png({force: true}) | d' test.mp3
|
|
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|.{}: (png)
|
|
| | | error: png: BitBufRange: failed at position 0 (read size 2315363 seek pos 0): outside buffer
|
|
0x000|49 44 33 04 00 00 00 00 |ID3..... | signature: raw bits (invalid)
|
|
| | | chunks[0:1]:
|
|
| | | [0]{}: chunk
|
|
0x000| 00 23 54 53 | .#TS | length: 2315347
|
|
0x000| 53 45 00 00| SE..| type: "SE\x00\x00"
|
|
0x000| 53 | S | ancillary: true
|
|
0x000| 45 | E | private: false
|
|
0x000| 00 | . | reserved: false
|
|
0x000| 00| .| safe_to_copy: false
|
|
0x010|00 0f 00 00 03 4c 61 76 66 35 38 2e 34 35 2e 31|.....Lavf58.45.1| gap0: raw bits
|
|
* |until 0x283.7 (end) (628) | |
|
|
$ fq -d bbb . test.mp3
|
|
exitcode: 4
|
|
stderr:
|
|
error: test.mp3: bbb: format group not found
|
|
$ fq -n '"aaa" | decode("aaa")'
|
|
exitcode: 5
|
|
stderr:
|
|
error: format group not found
|