mirror of
https://github.com/wader/fq.git
synced 2024-12-03 01:33:02 +03:00
06245d1295
Rename buffer to binary. Still some work left what to call buffer/binary in decode code. Document decode value and binary type Fix proper unit padding for tobytes and add still undocumenated extra padding argument. Add some additional binary tests
124 lines
3.7 KiB
Plaintext
124 lines
3.7 KiB
Plaintext
$ fq -i -d mp3 . /test.mp3
|
|
mp3> .headers[0].flags | ., tovalue, type, length?
|
|
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|.headers[0].flags{}:
|
|
0x0| 00 | . | unsynchronisation: false
|
|
0x0| 00 | . | extended_header: false
|
|
0x0| 00 | . | experimental_indicator: false
|
|
0x0| 00 | . | unused: 0
|
|
{
|
|
"experimental_indicator": false,
|
|
"extended_header": false,
|
|
"unsynchronisation": false,
|
|
"unused": 0
|
|
}
|
|
"object"
|
|
4
|
|
mp3> .headers[0].flags[0] | ., type, length?
|
|
error: expected an array with index 0 but got: object
|
|
mp3> .headers[0].flags[-1000] | ., type, length?
|
|
error: expected an array with index -2 but got: object
|
|
mp3> .headers[0].flags[1000] | ., type, length?
|
|
error: expected an array with index -1 but got: object
|
|
mp3> .headers[0].flags[1:3] | ., type, length?
|
|
error: expected an array but got: object
|
|
mp3> .headers[0].flags[0:-1] | ., type, length?
|
|
error: expected an array but got: object
|
|
mp3> .headers[0].flags[-1000:2000] | ., type, length?
|
|
error: expected an array but got: object
|
|
mp3> .headers[0].flags["test"] | ., type, length?
|
|
null
|
|
"null"
|
|
0
|
|
mp3> [.headers[0].flags[]] | type, length?
|
|
"array"
|
|
4
|
|
mp3> .headers[0].flags | keys
|
|
[
|
|
"unsynchronisation",
|
|
"extended_header",
|
|
"experimental_indicator",
|
|
"unused"
|
|
]
|
|
mp3> .headers[0].flags | has("a")
|
|
false
|
|
mp3> .headers[0].flags | has(0)
|
|
error: cannot check whether object has a key: 0
|
|
mp3> .headers[0].flags | type
|
|
"object"
|
|
mp3> .headers[0].flags | tonumber
|
|
error: tonumber cannot be applied to: object
|
|
mp3> .headers[0].flags | tostring
|
|
error: tostring cannot be applied to: object
|
|
mp3> .headers[0].flags + ""
|
|
error: cannot add: object ({"experimental_indicator" ...}) and string ("")
|
|
mp3> .headers[0].flags + 1
|
|
error: cannot add: object ({"experimental_indicator" ...}) and number (1)
|
|
mp3> .headers[0].flags._start | ., type, length?
|
|
40
|
|
"number"
|
|
40
|
|
mp3> .headers[0].flags._stop | ., type, length?
|
|
48
|
|
"number"
|
|
48
|
|
mp3> .headers[0].flags._len | ., type, length?
|
|
8
|
|
"number"
|
|
8
|
|
mp3> .headers[0].flags._name | ., type, length?
|
|
"flags"
|
|
"string"
|
|
5
|
|
mp3> .headers[0].flags._sym | ., type, length?
|
|
null
|
|
"null"
|
|
0
|
|
mp3> .headers[0].flags._description | ., type, length?
|
|
null
|
|
"null"
|
|
0
|
|
mp3> .headers[0].flags._path | ., type, length?
|
|
[
|
|
"headers",
|
|
0,
|
|
"flags"
|
|
]
|
|
"array"
|
|
3
|
|
mp3> .headers[0].flags._bits | ., type, length?
|
|
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|
|
|
0x0| 00 | . |.: raw bits 0x5-0x5.7 (1)
|
|
"binary"
|
|
8
|
|
mp3>
|
|
mp3> .headers[0].flags._bytes | ., type, length?
|
|
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|
|
|
0x0| 00 | . |.: raw bits 0x5-0x5.7 (1)
|
|
"binary"
|
|
1
|
|
mp3>
|
|
mp3> .headers[0].flags._error | ., type, length?
|
|
null
|
|
"null"
|
|
0
|
|
mp3> .headers[0].flags._unknown | ., type, length?
|
|
false
|
|
"boolean"
|
|
mp3> .headers[0].flags.a = 1
|
|
error: update key a cannot be applied to: object
|
|
mp3> .headers[0].flags[0] = 1
|
|
error: expected an array with index 0 but got: object
|
|
mp3> .headers[0].flags.a |= empty
|
|
error: update key a cannot be applied to: object
|
|
mp3> .headers[0].flags[0] |= empty
|
|
error: expected an array with index 0 but got: object
|
|
mp3> .headers[0].flags | setpath(["a"]; 1)
|
|
error: update key a cannot be applied to: object
|
|
mp3> .headers[0].flags | setpath([0]; 1)
|
|
error: update key 0 cannot be applied to: object
|
|
mp3> .headers[0].flags | delpaths([["a"]])
|
|
error: update key a cannot be applied to: object
|
|
mp3> .headers[0].flags | delpaths([[0]])
|
|
error: update key 0 cannot be applied to: object
|
|
mp3> ^D
|