1
1
mirror of https://github.com/wader/fq.git synced 2024-11-23 09:56:07 +03:00

flac_picture: Add picture_type names

This commit is contained in:
Mattias Wadman 2021-10-13 21:34:14 +02:00
parent 15d85e1043
commit 509b8f8c50
2 changed files with 26 additions and 2 deletions

View File

@ -8,6 +8,30 @@ import (
var images []*decode.Format
var pictureTypeNames = map[uint64]string{
0: "Other",
1: "32x32 pixels 'file icon' (PNG only)",
2: "Other file icon",
3: "Cover (front)",
4: "Cover (back)",
5: "Leaflet page",
6: "Media (e.g. label side of CD)",
7: "Lead artist/lead performer/soloist",
8: "Artist/performer",
9: "Conductor",
10: "Band/Orchestra",
11: "Composer",
12: "Lyricist/text writer",
13: "Recording Location",
14: "During recording",
15: "During performance",
16: "Movie/video screen capture",
17: "A bright colored fish",
18: "Illustration",
19: "Band/artist logotype",
20: "Publisher/Studio logotype",
}
func init() {
registry.MustRegister(&decode.Format{
Name: format.FLAC_PICTURE,
@ -24,7 +48,7 @@ func pictureDecode(d *decode.D, in interface{}) interface{} {
l := d.FieldU32(name + "_length")
return d.FieldUTF8(name, int(l))
}
d.FieldU32("picture_type")
d.FieldStringMapFn("picture_type", pictureTypeNames, "Unknown", d.U32, decode.NumberDecimal)
lenStr("mime")
lenStr("description")
d.FieldU32("width")

View File

@ -72,7 +72,7 @@ $ fq -d flac verbose /picture_seek_gain.flac
0x0120| 06| .| type: Picture (6) 0x12f.1-0x12f.7 (0.7)
0x0130|00 01 2c |.., | length: 300 0x130-0x132.7 (3)
| | | picture: {} (flac_picture) 0x133-0x25e.7 (300)
0x0130| 00 00 00 03 | .... | picture_type: 3 0x133-0x136.7 (4)
0x0130| 00 00 00 03 | .... | picture_type: Cover (front) (3) 0x133-0x136.7 (4)
0x0130| 00 00 00 09 | .... | mime_length: 9 0x137-0x13a.7 (4)
0x0130| 69 6d 61 67 65| image| mime: "image/png" 0x13b-0x143.7 (9)
0x0140|2f 70 6e 67 |/png |