2019-09-25 05:46:18 +03:00
|
|
|
/*
|
|
|
|
DESCRIPTIONS
|
|
|
|
helpers.go provides general codec related helper functions.
|
|
|
|
|
|
|
|
AUTHORS
|
|
|
|
Saxon A. Nelson-Milton <saxon@ausocean.org>
|
|
|
|
|
|
|
|
LICENSE
|
|
|
|
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 http://www.gnu.org/licenses.
|
|
|
|
*/
|
|
|
|
|
|
|
|
package codecutil
|
|
|
|
|
|
|
|
import "errors"
|
|
|
|
|
|
|
|
// Stream types
|
|
|
|
const (
|
|
|
|
H264SID = 27
|
|
|
|
H265SID = 36
|
|
|
|
MJPEGSID = 28
|
2019-09-25 14:59:19 +03:00
|
|
|
ADPCMSID = 192
|
2019-09-25 05:46:18 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
// SIDToMIMEType will return the corresponding MIME type for passed stream ID.
|
|
|
|
func SIDToMIMEType(id int) (string, error) {
|
|
|
|
switch id {
|
|
|
|
case H264SID:
|
2019-09-25 14:59:19 +03:00
|
|
|
return "video/h264", nil
|
2019-09-25 05:46:18 +03:00
|
|
|
case H265SID:
|
2019-09-25 14:59:19 +03:00
|
|
|
return "video/h265", nil
|
2019-09-25 05:46:18 +03:00
|
|
|
case MJPEGSID:
|
|
|
|
return "video/x-motion-jpeg", nil
|
2019-09-25 14:59:19 +03:00
|
|
|
case ADPCMSID:
|
|
|
|
return "audio/adpcm", nil
|
2019-09-25 05:46:18 +03:00
|
|
|
default:
|
|
|
|
return "", errors.New("unkown stream ID")
|
|
|
|
}
|
|
|
|
}
|