package goffmpeg
|
|
/*
|
#include <stdlib.h>
|
#include "libcffmpeg.h"
|
*/
|
import "C"
|
import "unsafe"
|
|
// FireRecorder fire recorder
|
func (h *GoFFMPEG) FireRecorder(id int64) {
|
C.wrap_fn_fire_recorder(h.ffmpeg, C.long(id))
|
}
|
|
// BuildRecorder build recorder
|
func (h *GoFFMPEG) BuildRecorder(output string, mind, maxd int) {
|
out := C.CString(output)
|
defer C.free(unsafe.Pointer(out))
|
|
C.wrap_fn_recorder(h.ffmpeg, out, C.int(mind), C.int(maxd))
|
}
|
|
// GetInfoRecorder info
|
func (h *GoFFMPEG) GetInfoRecorder(index *int, path *string) {
|
var i C.int = -1
|
var l C.int
|
|
p := C.wrap_fn_info_recorder(h.ffmpeg, &i, &l)
|
if i == -1 {
|
return
|
}
|
defer C.free(unsafe.Pointer(p))
|
|
*index = int(i)
|
*path = C.GoString(p)
|
}
|
|
// BuildDecoder build decoder
|
func (h *GoFFMPEG) BuildDecoder() {
|
C.wrap_fn_decoder(h.ffmpeg)
|
}
|
|
// GetPicDecoder get pic from decoder
|
func (h *GoFFMPEG) GetPicDecoder(data *[]byte, wid, hei *int) {
|
var width C.int
|
var height C.int
|
|
p := C.wrap_fn_decoder_pic(h.ffmpeg, &width, &height)
|
if width == 0 && height == 0 {
|
return
|
}
|
defer C.free(unsafe.Pointer(p))
|
*data = C.GoBytes(p, width*height*3)
|
*wid = int(width)
|
*hei = int(height)
|
}
|