Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export makePSSHBox #90

Merged
merged 1 commit into from
Dec 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions mpd/mpd.go
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ func NewWidevineContentProtection(wvHeader []byte) (*WidevineContentProtection,
if err != nil {
panic(err.Error())
}
psshBox, err := makePSSHBox(wvSystemID, wvHeader)
psshBox, err := MakePSSHBox(wvSystemID, wvHeader)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -853,7 +853,7 @@ func (as *AdaptationSet) AddNewContentProtectionSchemePlayreadyWithPSSH(pro stri
return nil, err
}

psshBox, err := makePSSHBox(prSystemID, proBin)
psshBox, err := MakePSSHBox(prSystemID, proBin)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -885,7 +885,7 @@ func (as *AdaptationSet) AddNewContentProtectionSchemePlayreadyV10WithPSSH(pro s
return nil, err
}

psshBox, err := makePSSHBox(prSystemID, proBin)
psshBox, err := MakePSSHBox(prSystemID, proBin)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion mpd/pssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"fmt"
)

func makePSSHBox(systemID, payload []byte) ([]byte, error) {
func MakePSSHBox(systemID, payload []byte) ([]byte, error) {
if len(systemID) != 16 {
return nil, fmt.Errorf("SystemID must be 16 bytes, was: %d", len(systemID))
}
Expand Down
8 changes: 4 additions & 4 deletions mpd/pssh_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestMakePSSHBox_Widevine(t *testing.T) {
panic(err.Error())
}

psshBox, err := makePSSHBox(wvSystemID, payload)
psshBox, err := MakePSSHBox(wvSystemID, payload)
require.NoError(t, err)

require.EqualString(t, string(expectedPSSH), string(psshBox))
Expand All @@ -46,18 +46,18 @@ func TestMakePSSHBox_Playready(t *testing.T) {
panic(err.Error())
}

psshBox, err := makePSSHBox(wvSystemID, payload)
psshBox, err := MakePSSHBox(wvSystemID, payload)
require.NoError(t, err)

require.EqualString(t, string(expectedPSSH), string(psshBox))
}

func TestMakePSSHBox_BadSystemID(t *testing.T) {
_, err := makePSSHBox([]byte("meaningless byte array"), nil)
_, err := MakePSSHBox([]byte("meaningless byte array"), nil)
require.EqualError(t, err, "SystemID must be 16 bytes, was: 22")
}

func TestMakePSSHBox_NilSystemID(t *testing.T) {
_, err := makePSSHBox(nil, nil)
_, err := MakePSSHBox(nil, nil)
require.EqualError(t, err, "SystemID must be 16 bytes, was: 0")
}