Added genre parsing for mp4 (atom) file metadata#83
Added genre parsing for mp4 (atom) file metadata#83redlex-spb wants to merge 3 commits intodhowden:masterfrom
Conversation
dhowden
left a comment
There was a problem hiding this comment.
Thanks for the contribution! Just a few quick changes.
| return fmt.Errorf("invalid encoding: expected at least %d bytes, for integer tag data, got %d", 1, len(b)) | ||
| } | ||
| data = getInt(b[:1]) | ||
| data = getInt(b[len(b)-1:]) |
There was a problem hiding this comment.
Is there some padding in front that we need to jump over? Might be best to explicitly say that (for future reference!)
| } | ||
|
|
||
| if name == "gnre" { | ||
| m.data[name] = getInt(b[len(b)-1:]) |
There was a problem hiding this comment.
The genre identifier in the "gnre" tag is stored at the end of the byte array, subsequent processing is redundant, we only need id
There was a problem hiding this comment.
Ah ok. But then b[len(b)-1:] is going to be 1 byte, so the number will only ever be between 0 and 255 (which will not hit any of the genres added). Is this is in the spec somewhere?
There was a problem hiding this comment.
Yes, the identifier is stored in one byte.
Sorry, couldn't find an explanation / specification.
I can provide an example.
Co-authored-by: David Howden <dhowden@gmail.com>
| } | ||
|
|
||
| if name == "gnre" { | ||
| m.data[name] = getInt(b[len(b)-1:]) |
There was a problem hiding this comment.
Ah ok. But then b[len(b)-1:] is going to be 1 byte, so the number will only ever be between 0 and 255 (which will not hit any of the genres added). Is this is in the spec somewhere?
No description provided.