當前位置: 首頁>>代碼示例>>Golang>>正文


Golang struct_jpeg_decompress_struct.src方法代碼示例

本文整理匯總了Golang中C.struct_jpeg_decompress_struct.src方法的典型用法代碼示例。如果您正苦於以下問題:Golang struct_jpeg_decompress_struct.src方法的具體用法?Golang struct_jpeg_decompress_struct.src怎麽用?Golang struct_jpeg_decompress_struct.src使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在C.struct_jpeg_decompress_struct的用法示例。


在下文中一共展示了struct_jpeg_decompress_struct.src方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: makeSourceManager

func makeSourceManager(src io.Reader, dinfo *C.struct_jpeg_decompress_struct) (mgr *sourceManager) {
	mgr = new(sourceManager)
	mgr.src = src
	mgr.pub = C.malloc_jpeg_source_mgr()
	if mgr.pub == nil {
		panic("Failed to allocate C.struct_jpeg_source_mgr")
	}
	mgr.buffer = C.malloc(readBufferSize)
	if mgr.buffer == nil {
		panic("Failed to allocate buffer")
	}
	mgr.pub.init_source = (*[0]byte)(C.sourceInit)
	mgr.pub.fill_input_buffer = (*[0]byte)(C.sourceFill)
	mgr.pub.skip_input_data = (*[0]byte)(C.sourceSkip)
	mgr.pub.resync_to_restart = (*[0]byte)(C._get_jpeg_resync_to_restart())
	mgr.pub.term_source = (*[0]byte)(C.sourceTerm)
	mgr.pub.bytes_in_buffer = 0
	mgr.pub.next_input_byte = nil
	dinfo.src = mgr.pub

	sourceManagerMapMutex.Lock()
	defer sourceManagerMapMutex.Unlock()
	sourceManagerMap[uintptr(unsafe.Pointer(mgr.pub))] = mgr

	return
}
開發者ID:ieee0824,項目名稱:go-libjpeg,代碼行數:26,代碼來源:sourceManager.go

示例2: makeSourceManager

func makeSourceManager(src io.Reader, dinfo *C.struct_jpeg_decompress_struct) (ret *sourceManager) {
	ret = (*sourceManager)(C.malloc(C.size_t(unsafe.Sizeof(sourceManager{}))))
	if ret == nil {
		panic("Failed to allocate sourceManager")
	}
	ret.magic = magic
	ret.src = src
	ret.pub.init_source = (*[0]byte)(C.sourceInit)
	ret.pub.fill_input_buffer = (*[0]byte)(C.sourceFill)
	ret.pub.skip_input_data = (*[0]byte)(C.sourceSkip)
	ret.pub.resync_to_restart = (*[0]byte)(C.jpeg_resync_to_restart) // default implementation
	ret.pub.term_source = (*[0]byte)(C.sourceTerm)
	ret.pub.bytes_in_buffer = 0
	ret.pub.next_input_byte = nil
	dinfo.src = &ret.pub
	return
}
開發者ID:ieee0824,項目名稱:go-thumber,代碼行數:17,代碼來源:jpeg_read.go


注:本文中的C.struct_jpeg_decompress_struct.src方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。