Skip to content

Commit

Permalink
temp commit for SegData changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Angie Ramirez committed Nov 28, 2018
1 parent e56658a commit 09f536b
Show file tree
Hide file tree
Showing 4 changed files with 168 additions and 139 deletions.
16 changes: 8 additions & 8 deletions eth/types/segment.go
Expand Up @@ -3,24 +3,24 @@ package types
import (
"math/big"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
ethcommon "github.com/ethereum/go-ethereum/common"
"github.com/livepeer/go-livepeer/common"
ffmpeg "github.com/livepeer/lpms/ffmpeg"
)

type Segment struct {
StreamID string
SegmentSequenceNumber *big.Int
DataHash common.Hash
}

func (s *Segment) Hash() common.Hash {
return crypto.Keccak256Hash([]byte(s.StreamID), common.LeftPadBytes(s.SegmentSequenceNumber.Bytes(), 32), s.DataHash.Bytes())
DataHash ethcommon.Hash
Profiles []ffmpeg.VideoProfile
}

func (s *Segment) Flatten() []byte {
buf := make([]byte, len(s.StreamID)+32+len(s.DataHash.Bytes()))
buf := make([]byte, len(s.StreamID)+32+len(s.DataHash.Bytes())+len(s.Profiles))
i := copy(buf[0:], []byte(s.StreamID))
i += copy(buf[i:], common.LeftPadBytes(s.SegmentSequenceNumber.Bytes(), 32))
i += copy(buf[i:], s.DataHash.Bytes())
i += copy(buf[i:], common.ProfilesToTranscodeOpts(s.Profiles))

return buf
}

0 comments on commit 09f536b

Please sign in to comment.