org.freedesktop.gstreamer.gst.PadChainListFunction Maven / Gradle / Ivy
Show all versions of gst Show documentation
/* Java-GI - Java language bindings for GObject-Introspection-based libraries
* Copyright (C) 2022-2023 Jan-Willem Harmannij
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see .
*/
/* This file has been generated with Java-GI.
* Do not edit this file directly!
* Visit https://jwharm.github.io/java-gi for more information.
*/
package org.freedesktop.gstreamer.gst;
import io.github.jwharm.javagi.gobject.*;
import io.github.jwharm.javagi.gobject.types.*;
import io.github.jwharm.javagi.base.*;
import io.github.jwharm.javagi.interop.*;
import java.lang.foreign.*;
import java.lang.invoke.*;
import org.jetbrains.annotations.*;
/**
* A function that will be called on sinkpads when chaining buffer lists.
* The function typically processes the data contained in the buffer list and
* either consumes the data or passes it on to the internally linked pad(s).
*
* The implementer of this function receives a refcount to {@code list} and
* should gst_buffer_list_unref() when the list is no longer needed.
*
* When a chainlist function detects an error in the data stream, it must
* post an error on the bus and return an appropriate {@link FlowReturn} value.
*/
@FunctionalInterface
public interface PadChainListFunction {
/**
* A function that will be called on sinkpads when chaining buffer lists.
* The function typically processes the data contained in the buffer list and
* either consumes the data or passes it on to the internally linked pad(s).
*
* The implementer of this function receives a refcount to {@code list} and
* should gst_buffer_list_unref() when the list is no longer needed.
*
* When a chainlist function detects an error in the data stream, it must
* post an error on the bus and return an appropriate {@link FlowReturn} value.
*/
org.freedesktop.gstreamer.gst.FlowReturn run(org.freedesktop.gstreamer.gst.Pad pad, @Nullable org.freedesktop.gstreamer.gst.GstObject parent, org.freedesktop.gstreamer.gst.BufferList list);
/**
* The {@code upcall} method is called from native code. The parameters
* are marshalled and {@link #run} is executed.
*/
@ApiStatus.Internal default int upcall(MemorySegment pad, MemorySegment parent, MemorySegment list) {
var _result = run((org.freedesktop.gstreamer.gst.Pad) InstanceCache.getForType(pad, org.freedesktop.gstreamer.gst.Pad::new, false),
(org.freedesktop.gstreamer.gst.GstObject) InstanceCache.getForType(parent, org.freedesktop.gstreamer.gst.GstObject.GstObjectImpl::new, false),
MemorySegment.NULL.equals(list) ? null : new org.freedesktop.gstreamer.gst.BufferList(list));
return _result.getValue();
}
/**
* Creates a callback that can be called from native code and executes the {@code run} method.
* @return the memory address of the callback function
*/
default MemorySegment toCallback(Arena arena) {
FunctionDescriptor _fdesc = FunctionDescriptor.of(ValueLayout.JAVA_INT, ValueLayout.ADDRESS, ValueLayout.ADDRESS, ValueLayout.ADDRESS);
MethodHandle _handle = Interop.upcallHandle(MethodHandles.lookup(), PadChainListFunction.class, _fdesc);
return Linker.nativeLinker().upcallStub(_handle.bindTo(this), _fdesc, arena);
}
}