github.com/bluenviron/gomavlib/v2@v2.2.1-0.20240308101627-2c07e3da629c/pkg/dialects/common/enum_video_stream_type.go (about) 1 //autogenerated:yes 2 //nolint:revive,misspell,govet,lll,dupl,gocritic 3 package common 4 5 import ( 6 "fmt" 7 "strconv" 8 ) 9 10 // Video stream types 11 type VIDEO_STREAM_TYPE uint64 12 13 const ( 14 // Stream is RTSP 15 VIDEO_STREAM_TYPE_RTSP VIDEO_STREAM_TYPE = 0 16 // Stream is RTP UDP (URI gives the port number) 17 VIDEO_STREAM_TYPE_RTPUDP VIDEO_STREAM_TYPE = 1 18 // Stream is MPEG on TCP 19 VIDEO_STREAM_TYPE_TCP_MPEG VIDEO_STREAM_TYPE = 2 20 // Stream is h.264 on MPEG TS (URI gives the port number) 21 VIDEO_STREAM_TYPE_MPEG_TS_H264 VIDEO_STREAM_TYPE = 3 22 ) 23 24 var labels_VIDEO_STREAM_TYPE = map[VIDEO_STREAM_TYPE]string{ 25 VIDEO_STREAM_TYPE_RTSP: "VIDEO_STREAM_TYPE_RTSP", 26 VIDEO_STREAM_TYPE_RTPUDP: "VIDEO_STREAM_TYPE_RTPUDP", 27 VIDEO_STREAM_TYPE_TCP_MPEG: "VIDEO_STREAM_TYPE_TCP_MPEG", 28 VIDEO_STREAM_TYPE_MPEG_TS_H264: "VIDEO_STREAM_TYPE_MPEG_TS_H264", 29 } 30 31 var values_VIDEO_STREAM_TYPE = map[string]VIDEO_STREAM_TYPE{ 32 "VIDEO_STREAM_TYPE_RTSP": VIDEO_STREAM_TYPE_RTSP, 33 "VIDEO_STREAM_TYPE_RTPUDP": VIDEO_STREAM_TYPE_RTPUDP, 34 "VIDEO_STREAM_TYPE_TCP_MPEG": VIDEO_STREAM_TYPE_TCP_MPEG, 35 "VIDEO_STREAM_TYPE_MPEG_TS_H264": VIDEO_STREAM_TYPE_MPEG_TS_H264, 36 } 37 38 // MarshalText implements the encoding.TextMarshaler interface. 39 func (e VIDEO_STREAM_TYPE) MarshalText() ([]byte, error) { 40 if name, ok := labels_VIDEO_STREAM_TYPE[e]; ok { 41 return []byte(name), nil 42 } 43 return []byte(strconv.Itoa(int(e))), nil 44 } 45 46 // UnmarshalText implements the encoding.TextUnmarshaler interface. 47 func (e *VIDEO_STREAM_TYPE) UnmarshalText(text []byte) error { 48 if value, ok := values_VIDEO_STREAM_TYPE[string(text)]; ok { 49 *e = value 50 } else if value, err := strconv.Atoi(string(text)); err == nil { 51 *e = VIDEO_STREAM_TYPE(value) 52 } else { 53 return fmt.Errorf("invalid label '%s'", text) 54 } 55 return nil 56 } 57 58 // String implements the fmt.Stringer interface. 59 func (e VIDEO_STREAM_TYPE) String() string { 60 val, _ := e.MarshalText() 61 return string(val) 62 }