Skip to content

Commit

Permalink
add additional means (#101)
Browse files Browse the repository at this point in the history
  • Loading branch information
nzoschke authored Jan 22, 2024
1 parent 0253fc5 commit 713ab0e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions mp4.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ var atoms = atomNames(map[string]string{
"disk": "disc",
})

var means = map[string]bool{
"com.apple.iTunes": true,
"com.mixedinkey.mixedinkey": true,
"com.serato.dj": true,
}

// Detect PNG image if "implicit" class is used
var pngHeader = []byte{137, 80, 78, 71, 13, 10, 26, 10}

Expand Down Expand Up @@ -226,7 +232,7 @@ func readAtomHeader(r io.ReadSeeker) (name string, size uint32, err error) {

// Generic atom.
// Should have 3 sub atoms : mean, name and data.
// We check that mean is "com.apple.iTunes" and we use the subname as
// We check that mean is "com.apple.iTunes" or others and we use the subname as
// the name, and move to the data atom.
// Data atom could have multiple data values, each with a header.
// If anything goes wrong, we jump at the end of the "----" atom.
Expand Down Expand Up @@ -268,9 +274,10 @@ func readCustomAtom(r io.ReadSeeker, size uint32) (_ string, data []string, _ er
return "", nil, err
}

if subNames["mean"] != "com.apple.iTunes" || subNames["name"] == "" || len(data) == 0 {
if !means[subNames["mean"]] || subNames["name"] == "" || len(data) == 0 {
return "----", nil, nil
}

return subNames["name"], data, nil
}

Expand Down

0 comments on commit 713ab0e

Please sign in to comment.