Exemple #1
0
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
}
Exemple #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)}
}
Exemple #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)))
}
Exemple #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)))
}