Created
January 21, 2016 18:39
-
-
Save fzakaria/5b0cab52536f35951c14 to your computer and use it in GitHub Desktop.
How to iterate over a double array in Cgo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package avformat | |
//#cgo pkg-config: libavformat | |
//#include <libavformat/avformat.h> | |
import "C" | |
import ( | |
"unsafe" | |
) | |
//https://www.ffmpeg.org/doxygen/2.7/structAVFormatContext.html | |
func (ctxt *Context) Streams(i uint) *Stream { | |
offset := (unsafe.Sizeof(unsafe.Pointer(*ctxt.streams)) * uintptr(i)) | |
return *(** Stream)(unsafe.Pointer(uintptr(unsafe.Pointer(ctxt.streams)) + offset )) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment