Esempio n. 1
0
File: codec.go Progetto: Dim0N22/gmf
func FindDecoder(i interface{}) (*Codec, error) {
	var avc *C.AVCodec

	switch t := i.(type) {
	case string:
		cname := C.CString(i.(string))
		defer C.free(unsafe.Pointer(cname))

		avc = C.avcodec_find_decoder_by_name(cname)
		break

	case int:
		avc = C.avcodec_find_decoder(uint32(i.(int)))
		break

	default:
		return nil, errors.New(fmt.Sprintf("Unable to find codec, unexpected arguments type '%v'", t))
	}

	if avc == nil {
		return nil, errors.New(fmt.Sprintf("Unable to find codec by value '%v'", i))
	}

	return &Codec{avCodec: avc}, nil
}
Esempio n. 2
0
func avcodec_find_decoder_by_name(name string) _Codec {
	cname := C.CString(name)
	defer C.free(unsafe.Pointer(cname))
	return _Codec{codec: C.avcodec_find_decoder_by_name(cname)}
}
Esempio n. 3
0
//Find a registered decoder with the specified name.
func AvcodecFindDecoderByName(n string) *Codec {
	return (*Codec)(C.avcodec_find_decoder_by_name(C.CString(n)))
}
Esempio n. 4
0
//Find a registered decoder with the specified name.
//AVCodec *avcodec_find_decoder_by_name (const char *name)
func Avcodec_find_decoder_by_name(n string) *AVCodec {
	return (*AVCodec)(C.avcodec_find_decoder_by_name(C.CString(n)))
}