ReadFrames no params validation added
This commit is contained in:
parent
cf930a3eae
commit
0677d357e2
2 changed files with 18 additions and 0 deletions
4
video.go
4
video.go
|
@ -309,6 +309,10 @@ func (video *Video) ReadFrame(n int) error {
|
|||
// Read the N-amount of frames with the given indexes and return them as a slice of buffers. If one of
|
||||
// the indexes is out of range, the function will return an error. The frames are indexes from 0.
|
||||
func (video *Video) ReadFrames(n ...int) ([][]byte, error) {
|
||||
if len(n) == 0 {
|
||||
return nil, fmt.Errorf("vidio: no frames indexes specified")
|
||||
}
|
||||
|
||||
for _, nValue := range n {
|
||||
if nValue >= video.frames {
|
||||
return nil, fmt.Errorf("vidio: provided frame index %d is not in frame count range", nValue)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue