From c4a31205c0e1a9146bf55dd4baac10b670a638ee Mon Sep 17 00:00:00 2001 From: Mattias Wadman Date: Sat, 4 Sep 2021 11:39:33 +0200 Subject: [PATCH] mp3,README: some cleanup --- README.md | 2 +- format/mp3/mp3.go | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0a520673..e0c60d06 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ $ fq '.headers[].frames[] | select(.id == "APIC").picture.chunks[] | select(.typ }   # Extract PNG file  -$ fq '.headers[].frames[] | select(.id == "APIC")?.picture._bits' file.mp3 > file.png  +$ fq '.headers[].frames[] | select(.id == "APIC")?.picture | tobits' file.mp3 > file.png  $ file file.png  file.png: PNG image data, 320 x 240, 8-bit/color RGB, non-interlaced   diff --git a/format/mp3/mp3.go b/format/mp3/mp3.go index 61455022..ee589425 100644 --- a/format/mp3/mp3.go +++ b/format/mp3/mp3.go @@ -23,7 +23,11 @@ func init() { DecodeFn: mp3Decode, Dependencies: []decode.Dependency{ {Names: []string{format.ID3V2}, Formats: &headerFormat}, - {Names: []string{format.ID3V1, format.ID3V11, format.APEV2}, Formats: &footerFormat}, + {Names: []string{ + format.ID3V1, + format.ID3V11, + format.APEV2, + }, Formats: &footerFormat}, {Names: []string{format.MP3_FRAME}, Formats: &mp3Frame}, }, }) @@ -44,7 +48,9 @@ func mp3Decode(d *decode.D, in interface{}) interface{} { d.FieldArrayFn("frames", func(d *decode.D) { for d.NotEnd() { startFindSync := d.Pos() - syncLen, _, err := d.TryPeekFind(16, 8, func(v uint64) bool { return v&0b1111_1111_1110_0000 == 0b1111_1111_1110_0000 }, d.BitsLeft()) + syncLen, _, err := d.TryPeekFind(16, 8, func(v uint64) bool { + return v&0b1111_1111_1110_0000 == 0b1111_1111_1110_0000 + }, d.BitsLeft()) if err != nil { break }