mirror of
https://github.com/go-gst/go-gst.git
synced 2025-10-30 19:16:34 +08:00
add the ability to set audio metadata on a buffer
This commit is contained in:
31
gst/audio/gst_audio_meta.go
Normal file
31
gst/audio/gst_audio_meta.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package audio
|
||||
|
||||
/*
|
||||
#include "gst.go.h"
|
||||
*/
|
||||
import "C"
|
||||
|
||||
import (
|
||||
"unsafe"
|
||||
|
||||
"github.com/tinyzimmer/go-gst/gst"
|
||||
)
|
||||
|
||||
type AudioMeta struct {
|
||||
ptr *C.GstAudioMeta
|
||||
}
|
||||
|
||||
func wrapMetaFull(ptr *C.GstAudioMeta) *AudioMeta {
|
||||
meta := &AudioMeta{ptr}
|
||||
return meta
|
||||
}
|
||||
|
||||
func BufferAddAudioMeta(buffer *gst.Buffer, info *Info, samples int64, offsets []int) *AudioMeta {
|
||||
gSizeOffsets := C.gsize(unsafe.Sizeof(unsafe.Pointer(&offsets)))
|
||||
return wrapMetaFull(C.gst_buffer_add_audio_meta(
|
||||
(*C.GstBuffer)(unsafe.Pointer(buffer.Instance())),
|
||||
info.ptr,
|
||||
C.gsize(samples),
|
||||
&gSizeOffsets,
|
||||
))
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package audio
|
||||
|
||||
/*
|
||||
#cgo pkg-config: gstreamer-plugins-base-1.0
|
||||
#cgo pkg-config: gstreamer-plugins-base-1.0 gstreamer-audio-1.0
|
||||
#cgo CFLAGS: -Wno-deprecated-declarations
|
||||
#cgo LDFLAGS: -lgstaudio-1.0
|
||||
*/
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package video
|
||||
|
||||
/*
|
||||
#cgo pkg-config: gstreamer-plugins-base-1.0
|
||||
#cgo pkg-config: gstreamer-plugins-base-1.0 gstreamer-video-1.0
|
||||
#cgo CFLAGS: -Wno-deprecated-declarations
|
||||
#cgo LDFLAGS: -lgstvideo-1.0
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user