github.com/bluenviron/mediacommon@v1.9.3/pkg/codecs/jpeg/define_restart_interval.go (about) 1 package jpeg 2 3 import ( 4 "fmt" 5 ) 6 7 // DefineRestartInterval is a DRI marker. 8 type DefineRestartInterval struct { 9 Interval uint16 10 } 11 12 // Unmarshal decodes the marker. 13 func (m *DefineRestartInterval) Unmarshal(buf []byte) error { 14 if len(buf) != 2 { 15 return fmt.Errorf("unsupported DRI size of %d", len(buf)) 16 } 17 18 m.Interval = uint16(buf[0])<<8 | uint16(buf[1]) 19 return nil 20 }