func InitDesc() { var desc *C.struct_AVCodecDescriptor = nil var c *C.struct_AVCodec if Codecs != nil { log.Println("Wrong method call. Map 'Codecs' is already initialized. Ignoring...") return } Codecs = make([]*CodecDescriptor, 0) for { if c = C.av_codec_next(c); c == nil { break } if desc = C.avcodec_descriptor_get(c.id); desc == nil { log.Printf("Unable to get descriptor for codec id: %d\n", int(c.id)) } result := &CodecDescriptor{avDesc: desc, IsEncoder: false} if C.av_codec_is_encoder(c) > 0 { result.IsEncoder = true } Codecs = append(Codecs, result) } }
//If c is NULL, returns the first registered codec, if c is non-NULL, func (c *Codec) AvCodecNext() *Codec { return (*Codec)(C.av_codec_next((*C.struct_AVCodec)(c))) }
//If c is NULL, returns the first registered codec, if c is non-NULL, //returns the next registered codec after c, or NULL if c is the last one. //AVCodec *av_codec_next (const AVCodec *c) func Av_codec_next(c *AVCodec) *AVCodec { return (*AVCodec)(C.av_codec_next((*C.struct_AVCodec)(c))) }