Esempio n. 1
0
File: codec.go Progetto: Dim0N22/gmf
func FindEncoder(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_encoder_by_name(cname)
		break

	case int:
		avc = C.avcodec_find_encoder(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_encoder_by_name(name string) _Codec {
	cname := C.CString(name)
	defer C.free(unsafe.Pointer(cname))
	return _Codec{codec: C.avcodec_find_encoder_by_name(cname)}
}
Esempio n. 3
0
//Find a registered encoder with the specified name.
func AvcodecFindEncoderByName(c string) *Codec {
	return (*Codec)(C.avcodec_find_encoder_by_name(C.CString(c)))
}
Esempio n. 4
0
//Find a registered encoder with the specified name.
//AVCodec *avcodec_find_encoder_by_name (const char *name)
func Avcodec_find_encoder_by_name(c string) *AVCodec {
	return (*AVCodec)(C.avcodec_find_encoder_by_name(C.CString(c)))
}