Skip to content

Commit

Permalink
Merge pull request #168 from abema/fix-psshdump
Browse files Browse the repository at this point in the history
Fix psshdump command
  • Loading branch information
sunfish-shogi authored Sep 30, 2024
2 parents d52813c + b6303fa commit 895fe1d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion cmd/mp4tool/internal/psshdump/psshdump.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,13 @@ func dump(inputFilePath string) error {
for i := range bs {
pssh := bs[i].Payload.(*mp4.Pssh)

sysid, _ := pssh.StringifyField("SystemID", "", 0, bs[i].Info.Context)
var sysid string
for i, v := range pssh.SystemID {
sysid += fmt.Sprintf("%02x", v)
if i == 3 || i == 5 || i == 7 || i == 9 {
sysid += "-"
}
}

if _, err := bs[i].Info.SeekToStart(r); err != nil {
return err
Expand Down
4 changes: 2 additions & 2 deletions cmd/mp4tool/internal/psshdump/psshdump_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func TestPsshdump(t *testing.T) {
" size: 52\n" +
" version: 1\n" +
" flags: 0x000000\n" +
" systemId: \n" +
" systemId: 1077efec-c0b2-4d02-ace3-3c1e52e2fb4b\n" +
" dataSize: 0\n" +
" base64: \"AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAEBI0VniavN7wEjRWeJq83vAAAAAA==\"\n" +
"\n",
Expand All @@ -37,7 +37,7 @@ func TestPsshdump(t *testing.T) {
" size: 52\n" +
" version: 1\n" +
" flags: 0x000000\n" +
" systemId: \n" +
" systemId: 1077efec-c0b2-4d02-ace3-3c1e52e2fb4b\n" +
" dataSize: 0\n" +
" base64: \"AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAEBI0VniavN7wEjRWeJq83vAAAAAA==\"\n" +
"\n",
Expand Down

0 comments on commit 895fe1d

Please sign in to comment.