mirror of https://bitbucket.org/ausocean/av.git
49 lines
1.3 KiB
Go
49 lines
1.3 KiB
Go
/*
|
|
NAME
|
|
list.go
|
|
|
|
AUTHOR
|
|
Trek Hopton <trek@ausocean.org>
|
|
|
|
LICENSE
|
|
This file is Copyright (C) 2019 the Australian Ocean Lab (AusOcean)
|
|
|
|
It is free software: you can redistribute it and/or modify them
|
|
under the terms of the GNU General Public License as published by the
|
|
Free Software Foundation, either version 3 of the License, or (at your
|
|
option) any later version.
|
|
|
|
It is distributed in the hope that it will be useful, but WITHOUT
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
for more details.
|
|
|
|
You should have received a copy of the GNU General Public License in gpl.txt.
|
|
If not, see [GNU licenses](http://www.gnu.org/licenses).
|
|
*/
|
|
|
|
package codecutil
|
|
|
|
import "fmt"
|
|
|
|
// numCodecs is the number of entries in the list of codecs.
|
|
const numCodecs = 5
|
|
|
|
// A global list containing all available codecs for reference in any application.
|
|
// When adding or removing a codec from this list, the numCodecs const must be updated.
|
|
const (
|
|
PCM = iota
|
|
ADPCM
|
|
H264
|
|
H265
|
|
MJPEG
|
|
)
|
|
|
|
// Validate recieves an int representing a codec and checks if it is valid.
|
|
func Validate(codec uint8) error {
|
|
if codec < 0 || codec >= numCodecs {
|
|
return fmt.Errorf("invalid codec")
|
|
}
|
|
return nil
|
|
}
|