func av_open_input_file(ctx *FormatContext, filename string, format *InputFormat, bufsize int, params *FormatParameters) int {
	cfilename := C.CString(filename)
	//defer C.free(unsafe.Pointer(cfilename))
	return int(C.av_open_input_file(
		&ctx.ctx,
		cfilename,
		/*(*C.AVInputFormat)(unsafe.Pointer(&format))*/ nil,
		C.int(bufsize),
		/*(*C.AVFormatParameters)(unsafe.Pointer(&params))*/ nil))
}
//export OpenMediaFile
func OpenMediaFile(filename string) {
	println("try openning the media file ")
	println(filename)
	cfilename := C.CString(filename)

	C.avcodec_register_all()
	C.av_register_all()
	ctx := C.avformat_alloc_context()

	result := C.av_open_input_file(&ctx, cfilename, nil, 0, nil)
	println(result)
	result = C.av_find_stream_info(ctx)
	C.free(unsafe.Pointer(cfilename))
	C.av_close_input_file(ctx)
	//C.free(unsafe.Pointer(ctx));
}
func (src *DataSource) Connect() bool {
	src.Valid = false
	cfilename := C.CString(src.Locator.Filename)

	src.Ctx = C.avformat_alloc_context()

	result := C.av_open_input_file(&src.Ctx, cfilename, nil, 0, nil)
	C.free(unsafe.Pointer(cfilename))

	if result != 0 {
		return src.Valid
	}
	result = C.av_find_stream_info(src.Ctx)
	if result < 0 {
		return src.Valid
	}
	src.Valid = true
	return src.Valid
}