Skip to content

Commit 5687b08

Browse files
committed
Try to fix docs, add latest, add failing test
1 parent 2e67911 commit 5687b08

File tree

7 files changed

+234
-17
lines changed

7 files changed

+234
-17
lines changed

doc/dev.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,19 @@ Flags can be struct with bit-fields.
3838
- Use commit messages with a context prefix to make it easier to find and understand, ex:<br>
3939
`mp3: Validate sync correctly`
4040
- Tests:
41-
- If possible use a pair of `testdata/file` and `testdata/file.fqtest` where `file.fqtest` is `$ fq dv file` or `$ fq 'dv,torepr' file` if there is `torepr` support.
41+
- If possible, add one or more pairs of example input file and expected CLI output, with naming like:
42+
- `./format/<format_name>/testdata/<name>.<ext>`, e.g. [`./format/mp4/testdata/aac.mp4`](../format/mp4/testdata/aac.mp4)
43+
- and `./format/<format_name>/testdata/<name>.fqtest`, e.g. [`./format/mp4/testdata/aac.fqtest`](../format/mp4/testdata/aac.fqtest)
44+
- The latter contents should be `$ go run . dv <file_path>` or `$ go run . 'dv,torepr' <file_path>` if there is `torepr` support.
4245
- If `dv` produces a lof of output maybe use `dv({array_truncate: 50})` etc
4346
- Run `go test ./format -run TestFormats/<name>` to test expected output.
4447
- Run `go test ./format -run TestFormats/<name> -update` to update current output as expected output.
4548
- If you have format specific documentation:
4649
- Put it in `format/*/<name>.md` and use `//go:embed <name>.md`/`interp.RegisterFS(..)` to embed/register it.
4750
- Use simple markdown, just sections (depth starts at 3, `### Section`), paragraphs, lists and links.
48-
- No heading section is needs with format name, will be added by `make doc` and fq cli help system.
51+
- No heading section is needed with format name, will be added by `make doc` and fq cli help system.
4952
- Add a `testdata/<name>_help.fqtest` with just `$ fq -h <name>` to test CLI help.
50-
- If in doubt look at `mp4.md`/`mp4.go` etc.
53+
- If in doubt look at [`mp4.md`](../format/mp4/mp4.md)/[`mp4.go`](../format/mp4/mp4.go) etc.
5154
- Run `make README.md doc/formats.md` to update md files.
5255
- Run linter `make lint`
5356
- Run fuzzer `make fuzz GROUP=<name>`, see usage in Makefile

format/riff/adm.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[Audio Definition Model](https://adm.ebu.io/background/what_is_the_adm.html) including 3D Audio.
2+
3+
RIFF / WAV / Broadcast Wave Format (BWF) chunks:
4+
- `<chna>` Chunk, Track UIDs of Audio Definition Model
5+
- `<axml>` Chunk, BWF XML Metadata, e.g. for Audio Definition Model ambisonics and elements
6+
7+
### Examples
8+
Decode ADM configuration from `<chna>` and `<axml>` chunks:
9+
```bash
10+
$ fq -d wav '.chunks[] | select(.id | IN("chna", "axml")) | tovalue' amd-bwf.wav
11+
12+
# Extract ADM <axml> chunk objects definitions xml content
13+
$ fq -r -d wav '.chunks[] | select(.id | IN("axml")) | .xml | tovalue' amd-bwf.wav | tee axml-content.xml
14+
```
15+
16+
### Authors
17+
- [@johnnymarnell](https://johnnymarnell.github.io), original author
18+
19+
### References
20+
- https://adm.ebu.io/background/what_is_the_adm.html
21+
- https://tech.ebu.ch/publications/tech3285s7
22+
- https://tech.ebu.ch/publications/tech3285s5

format/riff/common.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ func riffDecode(d *decode.D, path path, headFn func(d *decode.D, path path) (str
3636
}
3737
})
3838

39-
wordAlgin := d.AlignBits(16)
40-
if wordAlgin != 0 {
41-
d.FieldRawLen("align", int64(wordAlgin))
39+
wordAlign := d.AlignBits(16)
40+
if wordAlign != 0 {
41+
d.FieldRawLen("align", int64(wordAlign))
4242
}
4343
}
4444

format/riff/dolby.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
"github.com/wader/fq/pkg/scalar"
1313
)
1414

15-
func dbmdDecode(d *decode.D, size int64) any {
15+
func tmp_dbmdDecode(d *decode.D, size int64) any {
1616
version := d.U32()
1717
major := (version >> 24) & 0xFF
1818
minor := (version >> 16) & 0xFF
@@ -47,9 +47,9 @@ func dbmdDecode(d *decode.D, size int64) any {
4747
case 8:
4848
parseAudioInfo(d)
4949
case 9:
50-
parseDolbyAtmos(d, segmentSize)
50+
parseDolbyAtmos(d)
5151
case 10:
52-
parseDolbyAtmosSupplemental(d, segmentSize)
52+
parseDolbyAtmosSupplemental(d)
5353
default:
5454
d.FieldRawLen("unknown_segment_raw", int64(segmentSize*8))
5555
}
@@ -117,7 +117,7 @@ var warpMode = scalar.UintMapDescription{
117117
4: "not indicated (Default warping will be applied.)",
118118
}
119119

120-
var trimConfigName = scalar.UintMapDescription{
120+
var tmp_trimConfigName = scalar.UintMapDescription{
121121
0: "2.0",
122122
1: "5.1",
123123
2: "7.1",
@@ -134,7 +134,7 @@ var trimType = scalar.UintMapDescription{
134134
1: "automatic",
135135
}
136136

137-
func parseDolbyE(d *decode.D) {
137+
func tmp_parseDolbyE(d *decode.D) {
138138
d.FieldValueStr("metadata_segment_type", "dolby_e")
139139

140140
d.FieldU8("program_config")
@@ -145,7 +145,7 @@ func parseDolbyE(d *decode.D) {
145145
d.FieldRawLen("reserved_for_future_use", 80*8)
146146
}
147147

148-
func parseDolbyDigital(d *decode.D) {
148+
func tmp_parseDolbyDigital(d *decode.D) {
149149
d.FieldValueStr("metadata_segment_type", "dolby_digital")
150150

151151
d.FieldU8("ac3_program_id")
@@ -166,7 +166,7 @@ func parseDolbyDigital(d *decode.D) {
166166
d.FieldRawLen("program_description_text", 32*8)
167167
}
168168

169-
func parseDolbyDigitalPlus(d *decode.D) {
169+
func tmp_parseDolbyDigitalPlus(d *decode.D) {
170170
d.FieldValueStr("metadata_segment_type", "dolby_digital_plus")
171171

172172
d.FieldU8("program_id")
@@ -205,7 +205,7 @@ func parseDolbyDigitalPlus(d *decode.D) {
205205
d.FieldRawLen("reserved_for_future_use", 69*8)
206206
}
207207

208-
func parseAudioInfo(d *decode.D) {
208+
func tmp_parseAudioInfo(d *decode.D) {
209209
d.FieldValueStr("metadata_segment_type", "audio_info")
210210

211211
d.FieldU8("program_id")
@@ -224,7 +224,7 @@ func parseAudioInfo(d *decode.D) {
224224
d.FieldUTF8("segment_modified_date", 32)
225225
}
226226

227-
func parseDolbyAtmos(d *decode.D, size uint64) {
227+
func tmp_parseDolbyAtmos(d *decode.D, size uint64) {
228228
d.FieldValueStr("metadata_segment_type", "dolby_atmos")
229229

230230
// d.SeekRel(32 * 8)
@@ -248,7 +248,7 @@ func parseDolbyAtmos(d *decode.D, size uint64) {
248248
d.SeekRel(80 * 8)
249249
}
250250

251-
func parseDolbyAtmosSupplemental(d *decode.D, size uint64) {
251+
func tmp_parseDolbyAtmosSupplemental(d *decode.D, size uint64) {
252252
d.FieldValueStr("metadata_segment_type", "dolby_atmos_supplemental")
253253

254254
sync := d.FieldU32LE("dasms_sync")

format/riff/dolby_metadata.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ including Dolby Atmos, AC3, Dolby Digital \[Plus\], and Dolby Audio Info (e.g. L
44
### Examples
55
Decode Dolby metadata from `<dbmd>` chunk:
66
```
7-
$ fq -d wav '.chunks[] | select(.id | IN("dbmd")) | tovalue' bwf.wav
7+
$ fq -d wav '.chunks[] | select(.id | IN("dbmd")) | tovalue' adm-bwf.wav
88
```
99

1010
RIFF / WAV / Broadcast Wave Format (BWF) chunks:

0 commit comments

Comments
 (0)