Make mp4.UUID an alias of the standard library uuid.UUID once Go 1.28 is released
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 18/100
Research direction
Start by reading the UUID type and UnpackKey/NewUUIDFromString in the mp4 package, then trace the KID and SystemID fields the issue lists: PsshBox.SystemID, KIDs, TencBox.DefaultKID, SeigSampleGroupEntry.KID, and the InitProtect parameter. Do not begin until Go 1.28 is released, since the issue requires go.mod to stay at 1.24 until then. Done means the alias compiles across these sites, the tests pass, and the CHANGELOG lists the breaking change.
Written by the indexing model from the issue text.
Description
[!IMPORTANT]
Timing: do this once Go 1.28 is released (expected February 2027), not before.
The standard libraryuuidpackage arrived in Go 1.27. Once Go 1.28 is out, 1.27 is the oldest supported Go release, so requiring it then follows the Go release policy.
Until then, mp4ff keeps its current minimum (go 1.24ingo.mod, tested in CI).
Proposal
Make mp4.UUID an alias of the standard library type:
type UUID = uuid.UUID // [16]byte
Today mp4.UUID is a []byte. A 16-byte array is a better fit for KIDs and SystemIDs:
- UUIDs compare with
==and work as map keys, soUUID.Equalis no longer needed. - A UUID can no longer have the wrong length, so
String()no longer needs its"bad uuid ..."case. - Decoding no longer allocates a slice for each KID or SystemID.
- Callers can pass
uuid.UUIDvalues straight in, andString,MarshalText/UnmarshalTextandComparecome from the standard library.
Use an alias rather than a defined type: a defined type such as type UUID uuid.UUID would lose the methods, including String().
What stays in mp4ff
UnpackKeyandNewUUIDFromString. They also accept 24-character base64, whichuuid.Parsedoes not, andUnpackKeydecodes content keys, which are not UUIDs. They would returnuuid.UUIDfor KIDs.- The PlayReady GUID byte-order conversion for KIDs.
- The
UUID*string constants. They are all in canonical form, souuid.MustParsecan parse them (UUIDMssSmwas fixed in #715).
Breaking changes
This changes the type of exported fields and parameters, including PsshBox.SystemID and KIDs, TencBox.DefaultKID, SeigSampleGroupEntry.KID, the kid parameter of InitProtect, ProtectionSystemName, the PIFF tenc KID, and the KID fields of the decoded Widevine and PlayReady pssh data.
For callers:
mp4.UUID(b)withb []bytestill compiles (slice-to-array conversion), but panics iflen(b) < 16..Equal(...), comparisons withnil, and passing a UUID tobytesorhexfunctions without[:]no longer compile.- An unset KID is now the zero UUID instead of
nil. json.Marshalwrites UUIDs as dashed strings instead of base64.
Raising the go directive to 1.27 also makes every module that depends on mp4ff require Go 1.27 or later. The CHANGELOG entry must list this as a breaking change.
- Dominant language
- Go
- Stars
- 667
- Forks
- 132
- Avg merge
- 20h 4m
- Merged PRs (30d)
- 54
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Eyevinn/mp4ff
-
CBCS encryption accepts an IV that readers do not receivePossibly taken @perfloop-agent claimed this 2 days ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 52/100
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 30/100
Maintainers usually reply within 1 day
Similar issues
-
bug Web API
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
kubevela/terraform-controller#423 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
fosrl/windows-linux#91 ·
Maintainers usually reply within 1 day