deprecate old gst functions and types

This commit is contained in:
RSWilli
2025-09-16 22:36:07 +02:00
parent 8c0ce6e826
commit 2ff1eda904
130 changed files with 4401 additions and 17 deletions

View File

@@ -23,6 +23,8 @@ import (
// ClipBuffer will return a new buffer clipped to the given segment. The given buffer is no longer valid.
// The returned buffer may be nil if it is completely outside the configured segment.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func ClipBuffer(buffer *gst.Buffer, segment *gst.Segment, rate, bytesPerFrame int) *gst.Buffer {
buf := C.gst_audio_buffer_clip(
(*C.GstBuffer)(unsafe.Pointer(buffer.Ref().Instance())),
@@ -38,6 +40,8 @@ func ClipBuffer(buffer *gst.Buffer, segment *gst.Segment, rate, bytesPerFrame in
// ReorderChannels reorders the buffer against the given positions. The number of channels in each slice
// must be identical.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func ReorderChannels(buffer *gst.Buffer, format Format, from []ChannelPosition, to []ChannelPosition) bool {
return gobool(C.gst_audio_buffer_reorder_channels(
(*C.GstBuffer)(unsafe.Pointer(buffer.Instance())),
@@ -51,6 +55,8 @@ func ReorderChannels(buffer *gst.Buffer, format Format, from []ChannelPosition,
// TruncateBuffer truncates the buffer to finally have the given number of samples, removing the necessary
// amount of samples from the end and trim number of samples from the beginning. The original buffer is no
// longer valid. The returned buffer may be nil if the arguments were invalid.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func TruncateBuffer(buffer *gst.Buffer, bytesPerFrame int, trim, samples int64) *gst.Buffer {
buf := C.gst_audio_buffer_truncate(
(*C.GstBuffer)(unsafe.Pointer(buffer.Ref().Instance())),
@@ -80,6 +86,8 @@ func TruncateBuffer(buffer *gst.Buffer, bytesPerFrame int, trim, samples int64)
// that it is not supported to have a single channel spanning over two or more different GstMemory objects.
// Although the map operation will likely succeed in this case, it will be highly sub-optimal and it is
// recommended to merge all the memories in the buffer before calling this function.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func MapBuffer(info *Info, buffer *gst.Buffer, flags gst.MapFlags) (*Buffer, bool) {
var audioBuffer C.GstAudioBuffer
ret := gobool(C.gst_audio_buffer_map(
@@ -100,17 +108,25 @@ func MapBuffer(info *Info, buffer *gst.Buffer, flags gst.MapFlags) (*Buffer, boo
// and NumPlanes equals 1.
//
// The different channels in planes are always in the GStreamer channel order.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
type Buffer struct {
ptr *C.GstAudioBuffer
}
// NumSamples returns the size of the buffer in samples.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) NumSamples() int64 { return int64(b.ptr.n_samples) }
// NumPlanes returns the number of available planes.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) NumPlanes() int { return int(b.ptr.n_planes) }
// Planes returns the planes inside the mapped buffer.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) Planes() [][]byte {
out := make([][]byte, b.NumPlanes())
for i := 0; i < b.NumPlanes(); i++ {
@@ -123,10 +139,14 @@ func (b *Buffer) Planes() [][]byte {
}
// WritePlane writes data to the plane at the given index.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) WritePlane(idx int, data []byte) {
bufdata := C.audioBufferPlaneData(b.ptr, C.gint(idx))
C.memcpy(unsafe.Pointer(bufdata), unsafe.Pointer(&data[0]), C.gsize(len(data)))
}
// Unmap will unmap the mapped buffer. Use this after calling MapBuffer.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) Unmap() { C.gst_audio_buffer_unmap(b.ptr) }