本文整理匯總了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
}
示例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
}