File: decode.fqtest

package info (click to toggle)
fq 0.9.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 106,624 kB
  • sloc: xml: 2,835; makefile: 250; sh: 241; exp: 57; ansic: 21
file content (111 lines) | stat: -rw-r--r-- 6,773 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
$ 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].header.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